netgen/libsrc/meshing/meshing2.hpp

165 lines
3.8 KiB
C++
Raw Normal View History

2009-01-13 04:40:13 +05:00
#ifndef FILE_MESHING2
#define FILE_MESHING2
/**************************************************************************/
/* File: meshing2.hpp */
/* Author: Joachim Schoeberl */
/* Date: 01. Okt. 95 */
/**************************************************************************/
enum MESHING2_RESULT
{
MESHING2_OK = 0,
2009-01-18 05:53:00 +05:00
MESHING2_GIVEUP = 1
2009-01-13 04:40:13 +05:00
};
/*
The basis class for 2D mesh generation.
Has the method GenerateMesh
For surface mesh generation, or non-Euklidean meshing,
derive from Meshing2, and replace transformation.
*/
class Meshing2
{
/// the current advancing front
AdFront2 adfront;
2009-01-13 04:40:13 +05:00
/// rules for mesh generation
2019-07-09 13:39:16 +05:00
NgArray<netrule*> rules;
2009-01-13 04:40:13 +05:00
/// statistics
2019-07-09 13:39:16 +05:00
NgArray<int> ruleused, canuse, foundmap;
2009-01-13 04:40:13 +05:00
///
Box<3> boundingbox;
///
double starttime;
///
double maxarea;
2011-07-25 15:38:37 +06:00
Vec3d ex, ey;
Point3d globp1;
2009-01-13 04:40:13 +05:00
public:
///
2011-07-25 14:40:23 +06:00
DLL_HEADER Meshing2 (const MeshingParameters & mp, const Box<3> & aboundingbox);
2009-01-13 04:40:13 +05:00
///
DLL_HEADER virtual ~Meshing2 ();
2009-01-13 04:40:13 +05:00
/// Load rules, either from file, or compiled rules
2011-07-25 14:40:23 +06:00
void LoadRules (const char * filename, bool quad);
2009-01-13 04:40:13 +05:00
///
2011-07-25 14:40:23 +06:00
DLL_HEADER MESHING2_RESULT GenerateMesh (Mesh & mesh, const MeshingParameters & mp, double gh, int facenr);
2009-01-13 04:40:13 +05:00
DLL_HEADER void Delaunay (Mesh & mesh, int domainnr, const MeshingParameters & mp);
DLL_HEADER void BlockFillLocalH (Mesh & mesh, const MeshingParameters & mp);
2010-09-23 20:07:12 +06:00
2009-01-13 04:40:13 +05:00
///
DLL_HEADER void AddPoint (const Point3d & p, PointIndex globind, MultiPointGeomInfo * mgi = NULL,
2009-01-13 04:40:13 +05:00
bool pointonsurface = true);
///
DLL_HEADER void AddBoundaryElement (INDEX i1, INDEX i2,
2009-01-13 04:40:13 +05:00
const PointGeomInfo & gi1, const PointGeomInfo & gi2);
///
void SetStartTime (double astarttime);
///
void SetMaxArea (double amaxarea);
protected:
///
virtual void StartMesh ();
///
virtual void EndMesh ();
///
virtual double CalcLocalH (const Point3d & p, double gh) const;
///
virtual void DefineTransformation (const Point3d & p1, const Point3d & p2,
const PointGeomInfo * geominfo1,
const PointGeomInfo * geominfo2);
///
virtual void TransformToPlain (const Point3d & locpoint, const MultiPointGeomInfo & geominfo,
Point2d & plainpoint, double h, int & zone);
/// return 0 .. ok
/// return >0 .. cannot transform point to true surface
virtual int TransformFromPlain (Point2d & plainpoint,
Point3d & locpoint,
PointGeomInfo & geominfo,
double h);
/// projects to surface
/// return 0 .. ok
virtual int BelongsToActiveChart (const Point3d & p,
const PointGeomInfo & gi);
/// computes geoinfo data for line with respect to
/// selected chart
virtual int ComputePointGeomInfo (const Point3d & p,
PointGeomInfo & gi);
/// Tries to select unique geominfo on active chart
/// return 0: success
/// return 1: failed
virtual int ChooseChartPointGeomInfo (const MultiPointGeomInfo & mpgi,
PointGeomInfo & pgi);
/*
tests, whether endpoint (= 1 or 2) of line segment p1-p2
is inside of the selected chart. The endpoint must be on the
chart
*/
virtual int IsLineVertexOnChart (const Point3d & p1, const Point3d & p2,
int endpoint, const PointGeomInfo & geominfo);
/*
get (projected) boundary of current chart
*/
2019-07-09 13:39:16 +05:00
virtual void GetChartBoundary (NgArray<Point2d> & points,
NgArray<Point3d> & points3d,
NgArray<INDEX_2> & lines, double p) const;
2009-01-13 04:40:13 +05:00
virtual double Area () const;
/** Applies 2D rules.
Tests all 2D rules */
2019-07-09 13:39:16 +05:00
int ApplyRules (NgArray<Point2d> & lpoints,
NgArray<int> & legalpoints,
2009-01-13 04:40:13 +05:00
int maxlegalpoint,
2019-07-09 13:39:16 +05:00
NgArray<INDEX_2> & llines,
2009-01-13 04:40:13 +05:00
int maxlegelline,
2019-07-09 13:39:16 +05:00
NgArray<Element2d> & elements, NgArray<INDEX> & dellines,
2011-07-25 17:33:19 +06:00
int tolerance,
const MeshingParameters & mp);
2009-01-13 04:40:13 +05:00
};
#endif