Path: blob/devel/ElmerGUI/netgen/libsrc/meshing/meshing2.hpp
3206 views
#ifndef FILE_MESHING21#define FILE_MESHING223/**************************************************************************/4/* File: meshing2.hpp */5/* Author: Joachim Schoeberl */6/* Date: 01. Okt. 95 */7/**************************************************************************/891011enum MESHING2_RESULT12{13MESHING2_OK = 0,14MESHING2_GIVEUP = 1,15};161718/*1920The basis class for 2D mesh generation.21Has the method GenerateMesh2223For surface mesh generation, or non-Euklidean meshing,24derive from Meshing2, and replace transformation.2526*/2728class Meshing229{30/// the current advancing front31AdFront2 * adfront;32/// rules for mesh generation33ARRAY<netrule*> rules;34/// statistics35ARRAY<int> ruleused, canuse, foundmap;36///37Box<3> boundingbox;38///39double starttime;40///41double maxarea;4243public:44///45Meshing2 (const Box<3> & aboundingbox);4647///48virtual ~Meshing2 ();4950/// Load rules, either from file, or compiled rules51void LoadRules (const char * filename);5253///54MESHING2_RESULT GenerateMesh (Mesh & mesh, double gh, int facenr);5556///57void AddPoint (const Point3d & p, PointIndex globind, MultiPointGeomInfo * mgi = NULL,58bool pointonsurface = true);5960///61void AddBoundaryElement (INDEX i1, INDEX i2,62const PointGeomInfo & gi1, const PointGeomInfo & gi2);6364///65void SetStartTime (double astarttime);6667///68void SetMaxArea (double amaxarea);6970protected:71///72virtual void StartMesh ();73///74virtual void EndMesh ();75///76virtual double CalcLocalH (const Point3d & p, double gh) const;7778///79virtual void DefineTransformation (const Point3d & p1, const Point3d & p2,80const PointGeomInfo * geominfo1,81const PointGeomInfo * geominfo2);82///83virtual void TransformToPlain (const Point3d & locpoint, const MultiPointGeomInfo & geominfo,84Point2d & plainpoint, double h, int & zone);85/// return 0 .. ok86/// return >0 .. cannot transform point to true surface87virtual int TransformFromPlain (Point2d & plainpoint,88Point3d & locpoint,89PointGeomInfo & geominfo,90double h);9192/// projects to surface93/// return 0 .. ok94virtual int BelongsToActiveChart (const Point3d & p,95const PointGeomInfo & gi);9697/// computes geoinfo data for line with respect to98/// selected chart99virtual int ComputePointGeomInfo (const Point3d & p,100PointGeomInfo & gi);101102/// Tries to select unique geominfo on active chart103/// return 0: success104/// return 1: failed105virtual int ChooseChartPointGeomInfo (const MultiPointGeomInfo & mpgi,106PointGeomInfo & pgi);107108109110/*111tests, whether endpoint (= 1 or 2) of line segment p1-p2112is inside of the selected chart. The endpoint must be on the113chart114*/115virtual int IsLineVertexOnChart (const Point3d & p1, const Point3d & p2,116int endpoint, const PointGeomInfo & geominfo);117118/*119get (projected) boundary of current chart120*/121virtual void GetChartBoundary (ARRAY<Point2d> & points,122ARRAY<Point3d> & points3d,123ARRAY<INDEX_2> & lines, double p) const;124125virtual double Area () const;126127128/** Applies 2D rules.129Tests all 2D rules */130int ApplyRules (ARRAY<Point2d> & lpoints,131ARRAY<int> & legalpoints,132int maxlegalpoint,133ARRAY<INDEX_2> & llines,134int maxlegelline,135ARRAY<Element2d> & elements, ARRAY<INDEX> & dellines,136int tolerance);137138139};140141142143144145146147148#endif149150151152153154155156157158