netgen/libsrc/gprim/splinegeometry.hpp

74 lines
1.7 KiB
C++
Raw Normal View History

2011-02-28 18:13:18 +05:00
/*
JS, Nov 2007
The 2D/3D template-base classes should go into the libsrc/gprim directory
in geom2d only 2D - Geometry classes (with material properties etc.)
*/
#include "spline.hpp"
#ifndef _FILE_SPLINEGEOMETRY
#define _FILE_SPLINEGEOMETRY
namespace netgen
{
template < int D >
class SplineGeometry
{
// protected:
public:
2019-07-09 13:39:16 +05:00
NgArray < GeomPoint<D> > geompoints;
NgArray < SplineSeg<D>* > splines;
2011-02-28 18:13:18 +05:00
SplineGeometry() : geompoints{}, splines{} { ; }
2019-08-07 21:36:16 +05:00
virtual DLL_HEADER ~SplineGeometry();
2011-02-28 18:13:18 +05:00
2019-07-09 13:39:16 +05:00
DLL_HEADER int Load (const NgArray<double> & raw_data, const int startpos = 0);
2011-02-28 18:13:18 +05:00
2018-12-14 16:01:58 +05:00
virtual void DoArchive(Archive& ar)
{
ar & geompoints & splines;
}
2019-07-09 13:39:16 +05:00
DLL_HEADER void GetRawData (NgArray<double> & raw_data) const;
2011-02-28 18:13:18 +05:00
2019-07-09 13:39:16 +05:00
const NgArray<SplineSeg<D>*> & GetSplines () const
2011-02-28 18:13:18 +05:00
{ return splines; }
int GetNSplines (void) const { return splines.Size(); }
string GetSplineType (const int i) const { return splines[i]->GetType(); }
SplineSeg<D> & GetSpline (const int i) {return *splines[i];}
const SplineSeg<D> & GetSpline (const int i) const {return *splines[i];}
DLL_HEADER void GetBoundingBox (Box<D> & box) const;
2011-02-28 18:13:18 +05:00
Box<D> GetBoundingBox () const
{ Box<D> box; GetBoundingBox (box); return box; }
int GetNP () const { return geompoints.Size(); }
const GeomPoint<D> & GetPoint(int i) const { return geompoints[i]; }
// void SetGrading (const double grading);
DLL_HEADER void AppendPoint (const Point<D> & p, const double reffac = 1., const bool hpref = false);
2011-02-28 18:13:18 +05:00
void AppendSegment(SplineSeg<D> * spline)
{
splines.Append (spline);
}
};
}
#endif // _FILE_SPLINEGEOMETRY