Open PaperOpt
OpenPaperOpt/Staticsheet.h
Go to the documentation of this file.
00001 #ifndef STATICSHEET_H
00002 #define STATICSHEET_H
00003 
00004 #include "utilities.h"
00005 #include "StructureObject.h"
00006 #include "Array2D.h"
00007 #include "V2.h"
00008 #include "SurfAcc.h"
00009 #include "FiberStatic.h"
00010 #include "Distribution.h"
00011 #include "DistributionVonMises.h"
00012 #include "DistributionComponents.h"
00013 #include "DistributionOneDimension.h"
00014 #include "DistributionThreeDimension.h"
00015 #include "DistributionFromFiberSamples.h"
00016 
00017 namespace p3d{
00018         
00019         class Fiber;
00026         class Staticsheet: public StructureObject{
00027         
00028         public:
00029                 Staticsheet(double xsize,double ysize,double seglen);
00030                 ~Staticsheet();
00031 
00032                 int GetDataSize();
00033                 void SaveStaticsheet(string filename);
00034                 int ReadFiberFromFile(string filename);
00035 
00040                 int     Process(WavePacket & wp, int up_down,int internal) const {return 0;};
00041                 
00048                 int AddFibers(int num,double length,double radius,double formFC);
00058                 int AddFibers(Distributions::Distribution *pDistlen, Distributions::Distribution *pDistwid, Distributions::Distribution * formFC, int num);
00059                 
00068                 int AddFibers(Distributions::DistributionOneDimension *pDistlen,Distributions::DistributionThreeDimension * pDsitWidFactor, int num);
00069                 
00076                 int AddFibers(Distributions::DistributionFromFiberSamples *pDistSource, int num);
00077                 
00083                 void ShuffleFibers();
00084 
00092                 void SetRandomOrientation_vonMises(double kapa,double theta);
00093 
00099                 void ApproximateLocalCurl();
00100 
00108                 void PlaceFibers(bool killAngularInformation=true,int numPlaceTests=5);
00109 
00116                 void MakePaper3DStructure(Array2D<float> * surf); 
00117 
00125                 void CalcHeightData(double* mat,int numCells);
00126 
00127 
00128                 //Accessors / estimators
00129                 double  GetSizeX() const {return mSizeX;} //um
00130                 double  GetSizeY() const {return mSizeY;} //um
00131                 double  GetTotalWeight()   const {return mTotalWeight;}
00132                 //add new set function
00133                 void    SetTotalWeight(double totalWeight) {mTotalWeight=totalWeight;}
00134                 double  GetSurfaceWeight() const {return mTotalWeight/(mSizeX*mSizeY)*1e12;} //gram/m^2, verry bad approximation!!!!
00135                 void   EstimateLocalSurfWeight(int res,double* data); //Res must be on form 2^n. Assumes little bending of each segment
00136                 void   EstimateSurfaces(double probesize,int* resp,float** datau,float** datal,double* meandiff); 
00137                                                       //probesize in um. Selects res on form 2^n
00138                                                       //alocates matrixes, if set, user responcibility to clear
00139                 void SaveEstimateSurfaces(string filename,int res,float* datau,float* datal,double meandiff);
00140                 int    GetSegType() const {return mSegType;}
00141                 int    GetFlags()   const {return mInitFlg;}
00142 
00143                 void    SetSegType(int segType) {mSegType=segType;}
00144                 void    SetFlags(int initFlg) {mInitFlg=initFlg;}
00145 
00146                 double GetTop()     const {if (!(mInitFlg&SIMVOL_FLAG_POS3D)) throw StdExcept("Staticsheet:: :No 3d positions");return mSStr_top;}
00147                 double GetMedTop()  const {if (!(mInitFlg&SIMVOL_FLAG_POS3D)) throw StdExcept("Staticsheet:: :No 3d positions");return mSStr_mtop;}
00148                 double GetBot()     const {if (!(mInitFlg&SIMVOL_FLAG_POS3D)) throw StdExcept("Staticsheet:: :No 3d positions");return mSStr_bot;}
00149                 double GetMedBot()  const {if (!(mInitFlg&SIMVOL_FLAG_POS3D)) throw StdExcept("Staticsheet:: :No 3d positions");return mSStr_mbot;}
00150 
00151                 void SetTop(double SStr_top)    {mSStr_top=SStr_top;}
00152                 void SetMedTop(double SStr_mtop)        {mSStr_mtop=SStr_mtop;}
00153                 void SetBot(double SStr_bot)    {mSStr_bot=SStr_bot;}
00154                 void SetMedBot(double SStr_mbot)        {mSStr_mbot=SStr_mbot;}
00155 
00156                 vector<Fiber*>::const_iterator FiberBegin() const {return mFibers.begin();}
00157                 vector<Fiber*>::const_iterator FiberEnd()   const {return mFibers.end();}
00158         
00159         private:
00160 
00161                 //Size of surface
00162                 double mSizeX;   //um
00163                 double mSizeY;   //um
00164 
00165                 //Surface structure (generated by 3d-generator, avaliable when SIMVOL_FLAG_POS3D set)
00166                 double mSStr_top;
00167                 double mSStr_mtop;
00168                 double mSStr_bot;
00169                 double mSStr_mbot;
00170 
00171                 //Segment length for fibers
00172                 double mSegLen;  //um
00173 
00174                 //Data validity of fibers
00175                 int    mInitFlg; //SIMVOL_FLAG_xxx
00176                 int    mSegType; //SEGT_xxx
00177 
00178                 //Orgin
00179                 string mOrgin;
00180 
00181                 vector<Fiber*> mFibers;
00182                 double         mTotalWeight;
00183         };
00184 
00185 }
00186 
00187 #endif