2009-01-13 04:40:13 +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.)
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _FILE_SPLINEGEOMETRY
|
|
|
|
#define _FILE_SPLINEGEOMETRY
|
|
|
|
#include "../csg/csgparser.hpp"
|
|
|
|
|
|
|
|
///
|
|
|
|
extern void LoadBoundarySplines (const char * filename,
|
2009-01-25 17:35:25 +05:00
|
|
|
Array < GeomPoint<2> > & geompoints,
|
|
|
|
Array < SplineSeg<2>* > & splines,
|
2009-01-13 04:40:13 +05:00
|
|
|
double & elto0);
|
|
|
|
///
|
2009-01-25 17:35:25 +05:00
|
|
|
extern void PartitionBoundary (const Array < SplineSeg<2>* > & splines,
|
2009-01-13 04:40:13 +05:00
|
|
|
double h, double elto0,
|
|
|
|
Mesh & mesh2d);
|
|
|
|
|
|
|
|
|
|
|
|
// allow to turn off messages: cover all couts !!
|
|
|
|
extern int printmessage_importance;
|
|
|
|
|
|
|
|
template < int D >
|
2009-08-24 06:03:40 +06:00
|
|
|
class SplineGeometry
|
2009-01-13 04:40:13 +05:00
|
|
|
{
|
2009-01-25 17:35:25 +05:00
|
|
|
Array < GeomPoint<D> > geompoints;
|
|
|
|
Array < SplineSeg<D>* > splines;
|
2009-01-13 04:40:13 +05:00
|
|
|
double elto0;
|
2009-01-25 17:35:25 +05:00
|
|
|
Array<char*> materials;
|
|
|
|
Array<string*> bcnames;
|
|
|
|
Array<double> maxh;
|
|
|
|
Array<bool> quadmeshing;
|
|
|
|
Array<bool> tensormeshing;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
private:
|
|
|
|
void AppendSegment(SplineSeg<D> * spline, const int leftdomain, const int rightdomain,
|
|
|
|
const int bc,
|
|
|
|
const double reffac, const bool hprefleft, const bool hprefright,
|
|
|
|
const int copyfrom);
|
|
|
|
|
|
|
|
public:
|
|
|
|
~SplineGeometry();
|
|
|
|
|
2009-01-25 17:35:25 +05:00
|
|
|
int Load (const Array<double> & raw_data, const int startpos = 0);
|
2009-01-13 04:40:13 +05:00
|
|
|
void Load (const char * filename);
|
|
|
|
void CSGLoad (CSGScanner & scan);
|
|
|
|
|
|
|
|
void LoadData( ifstream & infile );
|
|
|
|
void LoadDataNew ( ifstream & infile );
|
|
|
|
void LoadDataV2 ( ifstream & infile );
|
|
|
|
|
|
|
|
void PartitionBoundary (double h, Mesh & mesh2d);
|
|
|
|
|
2009-01-25 17:35:25 +05:00
|
|
|
void GetRawData (Array<double> & raw_data) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
void CopyEdgeMesh (int from, int to, Mesh & mesh2d, Point3dTree & searchtree);
|
|
|
|
|
2009-01-25 17:35:25 +05:00
|
|
|
const Array<SplineSeg<D>*> & GetSplines () const
|
2009-01-13 04:40:13 +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];}
|
|
|
|
|
|
|
|
void GetBoundingBox (Box<D> & box) const;
|
|
|
|
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);
|
2009-07-23 00:13:50 +06:00
|
|
|
// void AppendPoint (const double x, const double y, const double reffac = 1., const bool hpref = false);
|
2009-01-13 04:40:13 +05:00
|
|
|
void AppendPoint (const Point<D> & p, const double reffac = 1., const bool hpref = false);
|
|
|
|
|
|
|
|
void AppendLineSegment (const int n1, const int n2,
|
|
|
|
const int leftdomain, const int rightdomain, const int bc = -1,
|
|
|
|
const double reffac = 1.,
|
|
|
|
const bool hprefleft = false, const bool hprefright = false,
|
|
|
|
const int copyfrom = -1);
|
|
|
|
void AppendSplineSegment (const int n1, const int n2, const int n3,
|
|
|
|
const int leftdomain, const int rightdomain, const int bc = -1,
|
|
|
|
const double reffac = 1.,
|
|
|
|
const bool hprefleft = false, const bool hprefright = false,
|
|
|
|
const int copyfrom = -1);
|
|
|
|
void AppendCircleSegment (const int n1, const int n2, const int n3,
|
|
|
|
const int leftdomain, const int rightdomain, const int bc = -1,
|
|
|
|
const double reffac = 1.,
|
|
|
|
const bool hprefleft = false, const bool hprefright = false,
|
|
|
|
const int copyfrom = -1);
|
2009-01-25 17:35:25 +05:00
|
|
|
void AppendDiscretePointsSegment (const Array< Point<D> > & points,
|
2009-01-13 04:40:13 +05:00
|
|
|
const int leftdomain, const int rightdomain, const int bc = -1,
|
|
|
|
const double reffac = 1.,
|
|
|
|
const bool hprefleft = false, const bool hprefright = false,
|
|
|
|
const int copyfrom = -1);
|
|
|
|
void TestComment ( ifstream & infile ) ;
|
|
|
|
void GetMaterial( const int domnr, char* & material );
|
|
|
|
|
|
|
|
double GetDomainMaxh ( const int domnr );
|
|
|
|
bool GetDomainQuadMeshing ( int domnr )
|
|
|
|
{
|
|
|
|
if ( quadmeshing.Size() ) return quadmeshing[domnr-1];
|
|
|
|
else return false;
|
|
|
|
}
|
|
|
|
bool GetDomainTensorMeshing ( int domnr )
|
|
|
|
{
|
|
|
|
if ( tensormeshing.Size() ) return tensormeshing[domnr-1];
|
|
|
|
else return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
string GetBCName ( const int bcnr ) const;
|
|
|
|
|
|
|
|
string * BCNamePtr ( const int bcnr );
|
2009-08-25 20:00:20 +06:00
|
|
|
|
|
|
|
|
2009-01-13 04:40:13 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void MeshFromSpline2D (SplineGeometry<2> & geometry,
|
|
|
|
Mesh *& mesh,
|
|
|
|
MeshingParameters & mp);
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-25 20:00:20 +06:00
|
|
|
class SplineGeometry2d : public SplineGeometry<2>, public NetgenGeometry
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~SplineGeometry2d();
|
|
|
|
|
|
|
|
virtual int GenerateMesh (Mesh*& mesh,
|
|
|
|
int perfstepsstart, int perfstepsend, char* optstring);
|
|
|
|
|
|
|
|
virtual const Refinement & GetRefinement () const;
|
|
|
|
};
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
|
|
|
#endif // _FILE_SPLINEGEOMETRY
|