Path: blob/devel/ElmerGUI/netgen/libsrc/geom2d/splinegeometry.hpp
3206 views
/*123JS, Nov 2007456The 2D/3D template-base classes should go into the libsrc/gprim directory78in geom2d only 2D - Geometry classes (with material properties etc.)91011*/121314151617#ifndef _FILE_SPLINEGEOMETRY18#define _FILE_SPLINEGEOMETRY19#include "../csg/csgparser.hpp"2021///22extern void LoadBoundarySplines (const char * filename,23ARRAY < GeomPoint<2> > & geompoints,24ARRAY < SplineSeg<2>* > & splines,25double & elto0);26///27extern void PartitionBoundary (const ARRAY < SplineSeg<2>* > & splines,28double h, double elto0,29Mesh & mesh2d);303132// allow to turn off messages: cover all couts !!33extern int printmessage_importance;3435template < int D >36class SplineGeometry37{38ARRAY < GeomPoint<D> > geompoints;39ARRAY < SplineSeg<D>* > splines;40double elto0;41ARRAY<char*> materials;42ARRAY<string*> bcnames;43ARRAY<double> maxh;44ARRAY<bool> quadmeshing;45ARRAY<bool> tensormeshing;4647private:48void AppendSegment(SplineSeg<D> * spline, const int leftdomain, const int rightdomain,49const int bc,50const double reffac, const bool hprefleft, const bool hprefright,51const int copyfrom);5253public:54~SplineGeometry();5556int Load (const ARRAY<double> & raw_data, const int startpos = 0);57void Load (const char * filename);58void CSGLoad (CSGScanner & scan);5960void LoadData( ifstream & infile );61void LoadDataNew ( ifstream & infile );62void LoadDataV2 ( ifstream & infile );6364void PartitionBoundary (double h, Mesh & mesh2d);6566void GetRawData (ARRAY<double> & raw_data) const;6768void CopyEdgeMesh (int from, int to, Mesh & mesh2d, Point3dTree & searchtree);6970const ARRAY<SplineSeg<D>*> & GetSplines () const71{ return splines; }7273int GetNSplines (void) const { return splines.Size(); }74string GetSplineType (const int i) const { return splines[i]->GetType(); }75SplineSeg<D> & GetSpline (const int i) {return *splines[i];}76const SplineSeg<D> & GetSpline (const int i) const {return *splines[i];}7778void GetBoundingBox (Box<D> & box) const;79Box<D> GetBoundingBox () const80{ Box<D> box; GetBoundingBox (box); return box; }8182int GetNP () const { return geompoints.Size(); }83const GeomPoint<D> & GetPoint(int i) const { return geompoints[i]; }8485void SetGrading (const double grading);86void AppendPoint (const double x, const double y, const double reffac = 1., const bool hpref = false);87void AppendPoint (const Point<D> & p, const double reffac = 1., const bool hpref = false);8889void AppendLineSegment (const int n1, const int n2,90const int leftdomain, const int rightdomain, const int bc = -1,91const double reffac = 1.,92const bool hprefleft = false, const bool hprefright = false,93const int copyfrom = -1);94void AppendSplineSegment (const int n1, const int n2, const int n3,95const int leftdomain, const int rightdomain, const int bc = -1,96const double reffac = 1.,97const bool hprefleft = false, const bool hprefright = false,98const int copyfrom = -1);99void AppendCircleSegment (const int n1, const int n2, const int n3,100const int leftdomain, const int rightdomain, const int bc = -1,101const double reffac = 1.,102const bool hprefleft = false, const bool hprefright = false,103const int copyfrom = -1);104void AppendDiscretePointsSegment (const ARRAY< Point<D> > & points,105const int leftdomain, const int rightdomain, const int bc = -1,106const double reffac = 1.,107const bool hprefleft = false, const bool hprefright = false,108const int copyfrom = -1);109void TestComment ( ifstream & infile ) ;110void GetMaterial( const int domnr, char* & material );111112double GetDomainMaxh ( const int domnr );113bool GetDomainQuadMeshing ( int domnr )114{115if ( quadmeshing.Size() ) return quadmeshing[domnr-1];116else return false;117}118bool GetDomainTensorMeshing ( int domnr )119{120if ( tensormeshing.Size() ) return tensormeshing[domnr-1];121else return false;122}123124string GetBCName ( const int bcnr ) const;125126string * BCNamePtr ( const int bcnr );127};128129130void MeshFromSpline2D (SplineGeometry<2> & geometry,131Mesh *& mesh,132MeshingParameters & mp);133134135136typedef SplineGeometry<2> SplineGeometry2d;137138139#endif // _FILE_SPLINEGEOMETRY140141142