netgen/libsrc/geom2d/geometry2d.hpp

198 lines
4.3 KiB
C++
Raw Normal View History

2009-01-13 04:40:13 +05:00
#ifndef FILE_GEOMETRY2D
#define FILE_GEOMETRY2D
/* *************************************************************************/
/* File: geometry2d.hpp */
/* Author: Joachim Schoeberl */
/* Date: 20. Jul. 02 */
/* *************************************************************************/
#include <myadt.hpp>
#include <gprim.hpp>
2009-09-07 17:50:13 +06:00
2011-02-28 18:34:54 +05:00
// #include "../gprim/spline.hpp"
2011-02-28 19:17:25 +05:00
// #include "../gprim/splinegeometry.hpp"
2009-01-13 04:40:13 +05:00
#include "geom2dmesh.hpp"
2009-09-07 17:50:13 +06:00
2011-02-28 17:59:27 +05:00
namespace netgen
{
class SplineSegExt : public SplineSeg<2>
{
public:
2011-02-28 18:34:54 +05:00
const SplineSeg<2> & seg;
2011-02-28 17:59:27 +05:00
/// left domain
int leftdom;
/// right domain
int rightdom;
/// refinement at line
double reffak;
/// maximal h;
double hmax;
/// boundary condition number
int bc;
/// copy spline mesh from other spline (-1.. do not copy)
int copyfrom;
/// perfrom anisotropic refinement (hp-refinement) to edge
bool hpref_left;
/// perfrom anisotropic refinement (hp-refinement) to edge
bool hpref_right;
///
int layer;
2011-02-28 18:34:54 +05:00
SplineSegExt (const SplineSeg<2> & hseg)
2011-02-28 17:59:27 +05:00
: seg(hseg)
{
layer = 1;
}
2013-02-06 18:55:47 +06:00
~SplineSegExt ()
{
delete &seg;
}
2011-02-28 17:59:27 +05:00
virtual const GeomPoint<2> & StartPI () const
{
return seg.StartPI();
}
virtual const GeomPoint<2> & EndPI () const
{
return seg.EndPI();
}
virtual Point<2> GetPoint (double t) const
{
return seg.GetPoint(t);
}
virtual Vec<2> GetTangent (const double t) const
{
return seg.GetTangent(t);
}
virtual void GetDerivatives (const double t,
Point<2> & point,
Vec<2> & first,
Vec<2> & second) const
{
seg.GetDerivatives (t, point, first, second);
}
virtual void GetCoeff (Vector & coeffs) const
{
seg.GetCoeff (coeffs);
}
virtual void GetPoints (int n, Array<Point<2> > & points) const
{
seg.GetPoints (n, points);
}
virtual double MaxCurvature () const
{
return seg.MaxCurvature();
}
virtual string GetType () const
{
return seg.GetType();
}
2012-08-27 22:07:27 +06:00
virtual double CalcCurvature (double t) const
{
Point<2> point;
Vec<2> first, second;
GetDerivatives (t, point, first, second);
double curv = fabs(first(0)*second(1)-first(1)*second(0)) / pow(first.Length(), 3);
return curv;
}
2011-02-28 17:59:27 +05:00
};
class SplineGeometry2d : public SplineGeometry<2>, public NetgenGeometry
{
protected:
Array<char*> materials;
Array<double> maxh;
Array<bool> quadmeshing;
Array<bool> tensormeshing;
Array<int> layer;
Array<string*> bcnames;
double elto0;
public:
2011-09-02 18:36:54 +06:00
DLL_HEADER virtual ~SplineGeometry2d();
2011-02-28 17:59:27 +05:00
2011-09-02 18:36:54 +06:00
DLL_HEADER void Load (const char * filename);
2011-02-28 17:59:27 +05:00
2011-09-02 18:36:54 +06:00
DLL_HEADER void LoadData( ifstream & infile );
DLL_HEADER void LoadDataNew ( ifstream & infile );
DLL_HEADER void LoadDataV2 ( ifstream & infile );
2011-02-28 17:59:27 +05:00
void TestComment ( ifstream & infile ) ;
const SplineSegExt & GetSpline (const int i) const
{
return dynamic_cast<const SplineSegExt&> (*splines[i]);
}
SplineSegExt & GetSpline (const int i)
{
return dynamic_cast<SplineSegExt&> (*splines[i]);
}
2014-09-26 02:23:31 +06:00
DLL_HEADER virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
int perfstepsstart, int perfstepsend);
2011-02-28 17:59:27 +05:00
2012-08-27 22:07:27 +06:00
void PartitionBoundary (MeshingParameters & mp, double h, Mesh & mesh2d);
2011-02-28 17:59:27 +05:00
void CopyEdgeMesh (int from, int to, Mesh & mesh2d, Point3dTree & searchtree);
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;
}
int GetDomainLayer ( int domnr )
{
if ( layer.Size() ) return layer[domnr-1];
else return 1;
}
string GetBCName ( const int bcnr ) const;
string * BCNamePtr ( const int bcnr );
2011-09-02 18:36:54 +06:00
DLL_HEADER virtual Refinement & GetRefinement () const;
2011-02-28 17:59:27 +05:00
};
}
2009-01-13 04:40:13 +05:00
#endif