Open PaperOpt
OpenPaperOpt/FiberStatic.h
Go to the documentation of this file.
00001 #ifndef FiberStatic_H
00002 #define FiberStatic_H
00003 
00004 #include "utilities.h"
00005 #include "V2.h"
00006 #include "V3.h"
00007 #include "FiberSegment.h"
00008 #include "Staticsheet.h"
00009 
00010 namespace p3d{
00011         
00012         class Staticsheet;
00013 
00014 #define FIBER_C   (5.4e-8)  //Nm
00015 #define FIBER_WWF (10e9)    //1/N(m^2)  //TODO: Make per fiber property with distribution
00016         
00017         const double gFiberRaw=1e-12;  //Approw with water  g/um^3  See headder!!
00018 
00025         class Fiber {
00026         public:
00027                 Fiber(double length,double radius,double formFC,double seglen);
00028                 Fiber(ifstream& rInput);
00029                 ~Fiber() {}
00030 
00031                 double  Length() const {return mLength;}
00032                 double  Radius() const {return mRadius;}
00033                 double  FormFC() const {return mFormFC;}
00034                 int             NumSeg() const {return mNumSeg;}
00039                 double  Weight();
00044                 double  Angle()  const {return mAngle;}
00049                 double* Angles() const {return mAngles;}
00050                 double  Seglen() const {return mSegLen;} //um
00051 
00052                 void   Angle(double angle) {mAngle=angle;}
00053                 void   Angles(double* angles) {mAngles=angles;}
00054 
00060                 void   GenerateSegments(Staticsheet* vol); //Fiber starting at (0,0)
00061                 void   Translate(V2 <double> len);
00066                 void   DropAngularInformation() {mAngles.clear();}
00067 
00072                 const  FiberSegment* GetSegments() const {return mSegments;}
00073                 FiberSegment* GetSegments()       {return mSegments;}
00074 
00081                 void   GetSegmentCoordinates(int segNo,V2 <double>& rV1,V2 <double>& rV2) const ;
00082 
00083                 int    GetDataSize() const ;
00084 
00090                 void SaveFiberBinary(ofstream& rFile);
00091 
00096                 void ReadFiberFromFile(string input);
00097 
00098         private:
00099                 //Fiber characteristics, allways present
00100                 double  mLength; //um, will be uppdated to match discretisation
00101                 double  mRadius; //um, 1/2 width
00102                 double  mFormFC; //%,  100%=Straight, 50%=Curled, (Cf= 1/mFormFC ??)
00103                 double  mSegLen; //um, length of one segment
00104                 int    mNumSeg; //    number of segments (not including end position&derivative)
00105 
00106                 //NOTE: Validity of the folowing parameters is known by host
00107 
00108                 //Angle
00109                 double  mAngle;  //rad,Orientation of fiber [0..2*PI],0=MD, -1=Unset
00110                 AutoDelete<double> mAngles; //rad,Pointer to segment angles if any
00111 
00112                 //Placing
00113                 AutoDelete<FiberSegment> mSegments;
00114         };
00115 
00116 
00117 
00118 }
00119 
00120 #endif