1 /* 2 3 4 JS, Nov 2007 5 6 7 The 2D/3D template-base classes should go into the libsrc/gprim directory 8 9 in geom2d only 2D - Geometry classes (with material properties etc.) 10 11 12 */ 13 14 #include "spline.hpp" 15 16 17 #ifndef _FILE_SPLINEGEOMETRY 18 #define _FILE_SPLINEGEOMETRY 19 20 namespace netgen 21 { 22 23 24 template < int D > 25 class SplineGeometry 26 { 27 // protected: 28 public: 29 NgArray < GeomPoint<D> > geompoints; 30 NgArray < SplineSeg<D>* > splines; 31 SplineGeometry()32 SplineGeometry() : geompoints{}, splines{} { ; } 33 virtual DLL_HEADER ~SplineGeometry(); 34 35 DLL_HEADER int Load (const NgArray<double> & raw_data, const int startpos = 0); 36 DoArchive(Archive & ar)37 virtual void DoArchive(Archive& ar) 38 { 39 ar & geompoints & splines; 40 } 41 42 DLL_HEADER void GetRawData (NgArray<double> & raw_data) const; 43 44 GetSplines() const45 const NgArray<SplineSeg<D>*> & GetSplines () const 46 { return splines; } 47 GetNSplines(void) const48 int GetNSplines (void) const { return splines.Size(); } GetSplineType(const int i) const49 string GetSplineType (const int i) const { return splines[i]->GetType(); } GetSpline(const int i)50 SplineSeg<D> & GetSpline (const int i) {return *splines[i];} GetSpline(const int i) const51 const SplineSeg<D> & GetSpline (const int i) const {return *splines[i];} 52 53 DLL_HEADER void GetBoundingBox (Box<D> & box) const; GetBoundingBox() const54 Box<D> GetBoundingBox () const 55 { Box<D> box; GetBoundingBox (box); return box; } 56 GetNP() const57 int GetNP () const { return geompoints.Size(); } GetPoint(int i) const58 const GeomPoint<D> & GetPoint(int i) const { return geompoints[i]; } 59 60 // void SetGrading (const double grading); 61 DLL_HEADER void AppendPoint (const Point<D> & p, const double reffac = 1., const bool hpref = false); 62 AppendSegment(SplineSeg<D> * spline)63 void AppendSegment(SplineSeg<D> * spline) 64 { 65 splines.Append (spline); 66 } 67 }; 68 69 70 71 } 72 73 #endif // _FILE_SPLINEGEOMETRY 74