meshing headers

This commit is contained in:
Joachim Schoeberl 2011-03-02 20:50:39 +00:00
parent 807d091d9e
commit ab0077c609
11 changed files with 2198 additions and 2164 deletions

View File

@ -7,41 +7,42 @@
/* Date: 23. Aug. 09 */ /* Date: 23. Aug. 09 */
/**************************************************************************/ /**************************************************************************/
class Tcl_Interp;
struct Tcl_Interp;
namespace netgen namespace netgen
{ {
class NetgenGeometry class NetgenGeometry
{ {
public: public:
virtual ~NetgenGeometry () { ; } virtual ~NetgenGeometry () { ; }
virtual int GenerateMesh (Mesh*& mesh, MeshingParameters & mparam, virtual int GenerateMesh (Mesh*& mesh, MeshingParameters & mparam,
int perfstepsstart, int perfstepsend); int perfstepsstart, int perfstepsend);
virtual const Refinement & GetRefinement () const; virtual const Refinement & GetRefinement () const;
virtual void Save (string filename) const; virtual void Save (string filename) const;
virtual void SaveToMeshFile (ostream & ost) const { ; } virtual void SaveToMeshFile (ostream & ost) const { ; }
}; };
class GeometryRegister class GeometryRegister
{ {
public: public:
virtual ~GeometryRegister(); virtual ~GeometryRegister();
virtual NetgenGeometry * Load (string filename) const = 0; virtual NetgenGeometry * Load (string filename) const = 0;
virtual NetgenGeometry * LoadFromMeshFile (istream & ist) const { return NULL; } virtual NetgenGeometry * LoadFromMeshFile (istream & ist) const { return NULL; }
virtual class VisualScene * GetVisualScene (const NetgenGeometry * geom) const virtual class VisualScene * GetVisualScene (const NetgenGeometry * geom) const
{ return NULL; } { return NULL; }
virtual void SetParameters (Tcl_Interp * interp) { ; } virtual void SetParameters (Tcl_Interp * interp) { ; }
}; };
extern Array<GeometryRegister*> geometryregister; extern Array<GeometryRegister*> geometryregister;
} }

View File

@ -12,39 +12,43 @@
global functions and variables global functions and variables
*/ */
/// namespace netgen
DLL_HEADER extern double GetTime ();
extern void ResetTime ();
///
extern int testmode;
/// calling parameters
// extern Flags parameters;
extern MeshingParameters mparam;
extern Array<int> tets_in_qualclass;
class multithreadt
{ {
public:
int pause;
int testmode;
int redraw;
int drawing;
int terminate;
int running;
double percent;
const char * task;
bool demorunning;
multithreadt();
};
extern volatile multithreadt multithread; ///
DLL_HEADER extern double GetTime ();
extern void ResetTime ();
extern string ngdir; ///
extern DebugParameters debugparam; extern int testmode;
extern bool verbose;
/// calling parameters
// extern Flags parameters;
extern MeshingParameters mparam;
extern Array<int> tets_in_qualclass;
class multithreadt
{
public:
int pause;
int testmode;
int redraw;
int drawing;
int terminate;
int running;
double percent;
const char * task;
bool demorunning;
multithreadt();
};
extern volatile multithreadt multithread;
extern string ngdir;
extern DebugParameters debugparam;
extern bool verbose;
}
#endif #endif

View File

@ -8,176 +8,180 @@
/**************************************************************************/ /**************************************************************************/
namespace netgen
/// box for grading
class GradingBox
{ {
/// xmid
float xmid[3];
/// half edgelength
float h2;
///
GradingBox * childs[8];
///
GradingBox * father;
///
double hopt;
///
public:
struct
/// box for grading
class GradingBox
{ {
unsigned int cutboundary:1; /// xmid
unsigned int isinner:1; float xmid[3];
unsigned int oldcell:1; /// half edgelength
unsigned int pinner:1; float h2;
} flags; ///
GradingBox * childs[8];
///
GradingBox * father;
///
double hopt;
///
public:
/// struct
GradingBox (const double * ax1, const double * ax2); {
/// unsigned int cutboundary:1;
void DeleteChilds(); unsigned int isinner:1;
/// unsigned int oldcell:1;
unsigned int pinner:1;
} flags;
Point<3> PMid() const { return Point<3> (xmid[0], xmid[1], xmid[2]); } ///
double H2() const { return h2; } GradingBox (const double * ax1, const double * ax2);
///
void DeleteChilds();
///
friend class LocalH; Point<3> PMid() const { return Point<3> (xmid[0], xmid[1], xmid[2]); }
double H2() const { return h2; }
static BlockAllocator ball; friend class LocalH;
void * operator new(size_t);
void operator delete (void *); static BlockAllocator ball;
}; void * operator new(size_t);
void operator delete (void *);
};
/** /**
Control of 3D mesh grading Control of 3D mesh grading
*/ */
class LocalH class LocalH
{ {
/// ///
GradingBox * root; GradingBox * root;
/// ///
double grading; double grading;
/// ///
Array<GradingBox*> boxes; Array<GradingBox*> boxes;
/// ///
Box3d boundingbox; Box3d boundingbox;
public: public:
/// ///
LocalH (const Point3d & pmin, const Point3d & pmax, double grading); LocalH (const Point3d & pmin, const Point3d & pmax, double grading);
/// ///
LocalH (const Box<3> & box, double grading); LocalH (const Box<3> & box, double grading);
/// ///
~LocalH(); ~LocalH();
/// ///
void Delete(); void Delete();
/// ///
void SetGrading (double agrading) { grading = agrading; } void SetGrading (double agrading) { grading = agrading; }
/// ///
void SetH (const Point3d & x, double h); void SetH (const Point3d & x, double h);
/// ///
double GetH (const Point3d & x) const; double GetH (const Point3d & x) const;
/// minimal h in box (pmin, pmax) /// minimal h in box (pmin, pmax)
double GetMinH (const Point3d & pmin, const Point3d & pmax) const; double GetMinH (const Point3d & pmin, const Point3d & pmax) const;
/// mark boxes intersecting with boundary-box /// mark boxes intersecting with boundary-box
// void CutBoundary (const Point3d & pmin, const Point3d & pmax) // void CutBoundary (const Point3d & pmin, const Point3d & pmax)
// { CutBoundaryRec (pmin, pmax, root); } // { CutBoundaryRec (pmin, pmax, root); }
void CutBoundary (const Box<3> & box) void CutBoundary (const Box<3> & box)
{ CutBoundaryRec (box.PMin(), box.PMax(), root); } { CutBoundaryRec (box.PMin(), box.PMax(), root); }
/// find inner boxes /// find inner boxes
void FindInnerBoxes (class AdFront3 * adfront, void FindInnerBoxes (class AdFront3 * adfront,
int (*testinner)(const Point3d & p1)); int (*testinner)(const Point3d & p1));
void FindInnerBoxes (class AdFront2 * adfront, void FindInnerBoxes (class AdFront2 * adfront,
int (*testinner)(const Point<2> & p1)); int (*testinner)(const Point<2> & p1));
/// clears all flags /// clears all flags
void ClearFlags () void ClearFlags ()
{ ClearFlagsRec(root); } { ClearFlagsRec(root); }
/// widen refinement zone /// widen refinement zone
void WidenRefinement (); void WidenRefinement ();
/// get points in inner elements /// get points in inner elements
void GetInnerPoints (Array<Point<3> > & points); void GetInnerPoints (Array<Point<3> > & points);
/// get points in outer closure /// get points in outer closure
void GetOuterPoints (Array<Point<3> > & points); void GetOuterPoints (Array<Point<3> > & points);
/// ///
void Convexify (); void Convexify ();
/// ///
int GetNBoxes () { return boxes.Size(); } int GetNBoxes () { return boxes.Size(); }
const Box3d & GetBoundingBox () const const Box3d & GetBoundingBox () const
{ return boundingbox; } { return boundingbox; }
/// ///
void PrintMemInfo (ostream & ost) const; void PrintMemInfo (ostream & ost) const;
private: private:
/// ///
double GetMinHRec (const Point3d & pmin, const Point3d & pmax, double GetMinHRec (const Point3d & pmin, const Point3d & pmax,
const GradingBox * box) const; const GradingBox * box) const;
/// ///
void CutBoundaryRec (const Point3d & pmin, const Point3d & pmax, void CutBoundaryRec (const Point3d & pmin, const Point3d & pmax,
GradingBox * box); GradingBox * box);
/// ///
void FindInnerBoxesRec ( int (*inner)(const Point3d & p), void FindInnerBoxesRec ( int (*inner)(const Point3d & p),
GradingBox * box); GradingBox * box);
/// ///
void FindInnerBoxesRec2 (GradingBox * box, void FindInnerBoxesRec2 (GradingBox * box,
class AdFront3 * adfront, class AdFront3 * adfront,
Array<Box3d> & faceboxes, Array<Box3d> & faceboxes,
Array<int> & finds, int nfinbox); Array<int> & finds, int nfinbox);
void FindInnerBoxesRec ( int (*inner)(const Point<2> & p), void FindInnerBoxesRec ( int (*inner)(const Point<2> & p),
GradingBox * box); GradingBox * box);
/// ///
void FindInnerBoxesRec2 (GradingBox * box, void FindInnerBoxesRec2 (GradingBox * box,
class AdFront2 * adfront, class AdFront2 * adfront,
Array<Box<3> > & faceboxes, Array<Box<3> > & faceboxes,
Array<int> & finds, int nfinbox); Array<int> & finds, int nfinbox);
/// ///
void SetInnerBoxesRec (GradingBox * box); void SetInnerBoxesRec (GradingBox * box);
/// ///
void ClearFlagsRec (GradingBox * box); void ClearFlagsRec (GradingBox * box);
/// ///
void ConvexifyRec (GradingBox * box); void ConvexifyRec (GradingBox * box);
friend ostream & operator<< (ostream & ost, const LocalH & loch); friend ostream & operator<< (ostream & ost, const LocalH & loch);
}; };
inline ostream & operator<< (ostream & ost, const GradingBox & box) inline ostream & operator<< (ostream & ost, const GradingBox & box)
{ {
ost << "gradbox, pmid = " << box.PMid() << ", h2 = " << box.H2() ost << "gradbox, pmid = " << box.PMid() << ", h2 = " << box.H2()
<< " cutbound = " << box.flags.cutboundary << " isinner = " << box.flags.isinner << " cutbound = " << box.flags.cutboundary << " isinner = " << box.flags.isinner
<< endl; << endl;
return ost; return ost;
} }
inline ostream & operator<< (ostream & ost, const LocalH & loch)
{
for (int i = 0; i < loch.boxes.Size(); i++)
ost << "box[" << i << "] = " << *(loch.boxes[i]);
return ost;
}
inline ostream & operator<< (ostream & ost, const LocalH & loch)
{
for (int i = 0; i < loch.boxes.Size(); i++)
ost << "box[" << i << "] = " << *(loch.boxes[i]);
return ost;
} }
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -12,20 +12,22 @@
namespace netgen namespace netgen
{ {
// extern int printmessage_importance;
extern int printmessage_importance;
class CSGeometry; class CSGeometry;
class NetgenGeometry;
}
#include "msghandler.hpp" #include "msghandler.hpp"
#include "meshtype.hpp" #include "meshtype.hpp"
#include "localh.hpp" #include "localh.hpp"
#include "meshclass.hpp" #include "meshclass.hpp"
#include "global.hpp" #include "global.hpp"
namespace netgen
{
#include "meshtool.hpp" #include "meshtool.hpp"
#include "ruler2.hpp" #include "ruler2.hpp"
#include "adfront2.hpp" #include "adfront2.hpp"
@ -37,17 +39,12 @@ namespace netgen
#include "adfront3.hpp" #include "adfront3.hpp"
#include "ruler3.hpp" #include "ruler3.hpp"
#ifndef SMALLLIB
#define _INCLUDE_MORE #define _INCLUDE_MORE
#endif
#ifdef LINUX
#define _INCLUDE_MORE
#endif
#ifdef _INCLUDE_MORE
#include "meshing3.hpp" #include "meshing3.hpp"
#include "improve3.hpp" #include "improve3.hpp"
#endif
#include "findip.hpp" #include "findip.hpp"
#include "findip2.hpp" #include "findip2.hpp"
@ -55,23 +52,20 @@ namespace netgen
#include "curvedelems.hpp" #include "curvedelems.hpp"
#include "clusters.hpp" #include "clusters.hpp"
#ifdef _INCLUDE_MORE
#include "meshfunc.hpp" #include "meshfunc.hpp"
#endif
#include "bisect.hpp" #include "bisect.hpp"
#include "hprefinement.hpp" #include "hprefinement.hpp"
#include "boundarylayer.hpp" #include "boundarylayer.hpp"
#include "specials.hpp" #include "specials.hpp"
}
#include "validate.hpp" #include "validate.hpp"
#include "basegeom.hpp"
#ifdef PARALLEL #ifdef PARALLEL
#include "paralleltop.hpp" #include "paralleltop.hpp"
// #include "../parallel/parallelmesh.hpp"
#endif #endif
}
#include "basegeom.hpp"
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -8,45 +8,49 @@
/**************************************************************************/ /**************************************************************************/
extern void PrintDot(char ch = '.'); namespace netgen
{
extern void PrintDot(char ch = '.');
//Message Pipeline: //Message Pipeline:
//importance: importance of message: 1=very important, 3=middle, 5=low, 7=unimportant //importance: importance of message: 1=very important, 3=middle, 5=low, 7=unimportant
extern void PrintMessage(int importance, extern void PrintMessage(int importance,
const MyStr& s1, const MyStr& s2=MyStr()); const MyStr& s1, const MyStr& s2=MyStr());
extern void PrintMessage(int importance, extern void PrintMessage(int importance,
const MyStr& s1, const MyStr& s2, const MyStr& s3, const MyStr& s4=MyStr()); const MyStr& s1, const MyStr& s2, const MyStr& s3, const MyStr& s4=MyStr());
extern void PrintMessage(int importance, extern void PrintMessage(int importance,
const MyStr& s1, const MyStr& s2, const MyStr& s3, const MyStr& s4, const MyStr& s1, const MyStr& s2, const MyStr& s3, const MyStr& s4,
const MyStr& s5, const MyStr& s6=MyStr(), const MyStr& s7=MyStr(), const MyStr& s8=MyStr()); const MyStr& s5, const MyStr& s6=MyStr(), const MyStr& s7=MyStr(), const MyStr& s8=MyStr());
// CR without line-feed // CR without line-feed
extern void PrintMessageCR(int importance, extern void PrintMessageCR(int importance,
const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="", const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="",
const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
extern void PrintFnStart(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="",
const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8=""); const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
extern void PrintFnStart(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="", extern void PrintWarning(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="",
const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
extern void PrintError(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="",
const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8=""); const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
extern void PrintWarning(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="", extern void PrintFileError(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="",
const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8=""); const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
extern void PrintError(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="", extern void PrintSysError(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="",
const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8=""); const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
extern void PrintFileError(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="", extern void PrintUserError(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="",
const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8=""); const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
extern void PrintSysError(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="", extern void PrintTime(const MyStr& s1="", const MyStr& s2="", const MyStr& s3="", const MyStr& s4="",
const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8=""); const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
extern void PrintUserError(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="", extern void SetStatMsg(const MyStr& s);
const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
extern void PrintTime(const MyStr& s1="", const MyStr& s2="", const MyStr& s3="", const MyStr& s4="",
const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
extern void SetStatMsg(const MyStr& s);
extern void PushStatus(const MyStr& s); extern void PushStatus(const MyStr& s);
extern void PushStatusF(const MyStr& s); extern void PushStatusF(const MyStr& s);
extern void PopStatus(); extern void PopStatus();
extern void SetThreadPercent(double percent); extern void SetThreadPercent(double percent);
extern void GetStatus(MyStr & s, double & percentage); extern void GetStatus(MyStr & s, double & percentage);
}
#endif #endif

View File

@ -1,267 +1,268 @@
#ifndef FILE_PARALLELTOP #ifndef FILE_PARALLELTOP
#define FILE_PARALLELTOP #define FILE_PARALLELTOP
#include <meshing.hpp> namespace netgen
extern int ntasks;
class ParallelMeshTopology
{ {
const Mesh & mesh;
// number of local elements, vertices, points (?), edges, faces extern int ntasks;
int ne, nv, np, ned, nfa;
// number of local segments and surface elements class ParallelMeshTopology
int nseg, nsurfel;
// number of global elements, vertices, ???, faces
int neglob, nvglob;
int nparel;
int nfaglob;
/**
mapping from local to distant vertex number
each row of the table corresponds to one vertex
each row contains a list of pairs (procnr, dist_vnum)
*/
TABLE<int,PointIndex::BASE> loc2distvert;
TABLE<int,0> loc2distedge, loc2distface, loc2distel;
TABLE<int,0> loc2distsegm, loc2distsurfel;
BitArray * isexchangeface, * isexchangevert, * isexchangeedge, * isexchangeel;
BitArray isghostedge, isghostface;
bool coarseupdate;
int overlap;
public:
ParallelMeshTopology (const Mesh & amesh);
~ParallelMeshTopology ();
/// set number of local vertices, reset sizes of loc2dist_vert, isexchangevert...
void SetNV ( int anv );
void SetNE ( int ane );
void SetNSE ( int anse );
void SetNSegm ( int anseg );
void Reset ();
void SetLoc2Glob_Vert ( int locnum, int globnum ) { loc2distvert[locnum][0] = globnum; }
void SetLoc2Glob_VolEl ( int locnum, int globnum ) { loc2distel[locnum-1][0] = globnum; }
void SetLoc2Glob_SurfEl ( int locnum, int globnum ) { loc2distsurfel[locnum-1][0] = globnum; }
void SetLoc2Glob_Segm ( int locnum, int globnum ) { loc2distsegm[locnum-1][0] = globnum; }
int GetLoc2Glob_Vert ( int locnum ) const { return loc2distvert[locnum][0]; }
int GetLoc2Glob_VolEl ( int locnum ) const { return loc2distel[locnum-1][0]; }
void GetVertNeighbours ( int vnum, Array<int> & dests ) const;
int Glob2Loc_SurfEl ( int globnum );
int Glob2Loc_VolEl ( int globnum );
int Glob2Loc_Segm ( int globnum );
int Glob2Loc_Vert ( int globnum );
int GetNDistantPNums ( int locpnum ) const { return loc2distvert[locpnum].Size() / 2 + 1; }
int GetNDistantFaceNums ( int locfacenum ) const { return loc2distface[locfacenum-1].Size() / 2 + 1; }
int GetNDistantEdgeNums ( int locedgenum ) const { return loc2distedge[locedgenum-1].Size() / 2 + 1; }
int GetNDistantElNums ( int locelnum ) const { return loc2distel[locelnum-1].Size() / 2 + 1; }
int GetDistantPNum ( int proc, int locpnum ) const;
int GetDistantEdgeNum ( int proc, int locedgenum ) const;
int GetDistantFaceNum ( int proc, int locedgenum ) const;
int GetDistantElNum ( int proc, int locelnum ) const;
int GetDistantPNums ( int locpnum, int * distpnums ) const;
int GetDistantEdgeNums ( int locedgenum, int * distedgenums ) const;
int GetDistantFaceNums ( int locedgenum, int * distfacenums ) const;
int GetDistantElNums ( int locelnum, int * distfacenums ) const;
void Print() const;
void SetExchangeFace ( int fnr ) { isexchangeface->Set( (fnr-1)*(ntasks+1) ); }
void SetExchangeVert ( int vnum ) { isexchangevert->Set( (vnum-1)*(ntasks+1) ); }
void SetExchangeElement ( int elnum ) { isexchangeel->Set((elnum-1)*(ntasks+1) ); }
void SetExchangeEdge ( int ednum ) { isexchangeedge->Set ((ednum-1)*(ntasks+1)); }
// fuer diese Fkts kann man ja O(N) - bitarrays lassen
bool IsExchangeVert ( PointIndex vnum ) const
{ {
return loc2distvert[vnum].Size() > 1; const Mesh & mesh;
// return isexchangevert->Test((vnum-1)*(ntasks+1));
}
bool IsExchangeEdge ( int ednum ) const // number of local elements, vertices, points (?), edges, faces
{ int ne, nv, np, ned, nfa;
/*
if ( isexchangeedge->Test( (ednum-1)*(ntasks+1) ) != // number of local segments and surface elements
( loc2distedge[ednum-1].Size() > 1) ) int nseg, nsurfel;
{
// number of global elements, vertices, ???, faces
int neglob, nvglob;
int nparel;
int nfaglob;
/**
mapping from local to distant vertex number
each row of the table corresponds to one vertex
each row contains a list of pairs (procnr, dist_vnum)
*/
TABLE<int,PointIndex::BASE> loc2distvert;
TABLE<int,0> loc2distedge, loc2distface, loc2distel;
TABLE<int,0> loc2distsegm, loc2distsurfel;
BitArray * isexchangeface, * isexchangevert, * isexchangeedge, * isexchangeel;
BitArray isghostedge, isghostface;
bool coarseupdate;
int overlap;
public:
ParallelMeshTopology (const Mesh & amesh);
~ParallelMeshTopology ();
/// set number of local vertices, reset sizes of loc2dist_vert, isexchangevert...
void SetNV ( int anv );
void SetNE ( int ane );
void SetNSE ( int anse );
void SetNSegm ( int anseg );
void Reset ();
void SetLoc2Glob_Vert ( int locnum, int globnum ) { loc2distvert[locnum][0] = globnum; }
void SetLoc2Glob_VolEl ( int locnum, int globnum ) { loc2distel[locnum-1][0] = globnum; }
void SetLoc2Glob_SurfEl ( int locnum, int globnum ) { loc2distsurfel[locnum-1][0] = globnum; }
void SetLoc2Glob_Segm ( int locnum, int globnum ) { loc2distsegm[locnum-1][0] = globnum; }
int GetLoc2Glob_Vert ( int locnum ) const { return loc2distvert[locnum][0]; }
int GetLoc2Glob_VolEl ( int locnum ) const { return loc2distel[locnum-1][0]; }
void GetVertNeighbours ( int vnum, Array<int> & dests ) const;
int Glob2Loc_SurfEl ( int globnum );
int Glob2Loc_VolEl ( int globnum );
int Glob2Loc_Segm ( int globnum );
int Glob2Loc_Vert ( int globnum );
int GetNDistantPNums ( int locpnum ) const { return loc2distvert[locpnum].Size() / 2 + 1; }
int GetNDistantFaceNums ( int locfacenum ) const { return loc2distface[locfacenum-1].Size() / 2 + 1; }
int GetNDistantEdgeNums ( int locedgenum ) const { return loc2distedge[locedgenum-1].Size() / 2 + 1; }
int GetNDistantElNums ( int locelnum ) const { return loc2distel[locelnum-1].Size() / 2 + 1; }
int GetDistantPNum ( int proc, int locpnum ) const;
int GetDistantEdgeNum ( int proc, int locedgenum ) const;
int GetDistantFaceNum ( int proc, int locedgenum ) const;
int GetDistantElNum ( int proc, int locelnum ) const;
int GetDistantPNums ( int locpnum, int * distpnums ) const;
int GetDistantEdgeNums ( int locedgenum, int * distedgenums ) const;
int GetDistantFaceNums ( int locedgenum, int * distfacenums ) const;
int GetDistantElNums ( int locelnum, int * distfacenums ) const;
void Print() const;
void SetExchangeFace ( int fnr ) { isexchangeface->Set( (fnr-1)*(ntasks+1) ); }
void SetExchangeVert ( int vnum ) { isexchangevert->Set( (vnum-1)*(ntasks+1) ); }
void SetExchangeElement ( int elnum ) { isexchangeel->Set((elnum-1)*(ntasks+1) ); }
void SetExchangeEdge ( int ednum ) { isexchangeedge->Set ((ednum-1)*(ntasks+1)); }
// fuer diese Fkts kann man ja O(N) - bitarrays lassen
bool IsExchangeVert ( PointIndex vnum ) const
{
return loc2distvert[vnum].Size() > 1;
// return isexchangevert->Test((vnum-1)*(ntasks+1));
}
bool IsExchangeEdge ( int ednum ) const
{
/*
if ( isexchangeedge->Test( (ednum-1)*(ntasks+1) ) !=
( loc2distedge[ednum-1].Size() > 1) )
{
cerr << "isexedge differs, id = " << id << ", ednum = " << ednum << endl; cerr << "isexedge differs, id = " << id << ", ednum = " << ednum << endl;
} }
*/ */
// return loc2distedge[ednum-1].Size() > 1; // return loc2distedge[ednum-1].Size() > 1;
int i = (ednum-1)*(ntasks+1); int i = (ednum-1)*(ntasks+1);
return isexchangeedge->Test(i); return isexchangeedge->Test(i);
} }
bool IsExchangeFace ( int fnum ) const bool IsExchangeFace ( int fnum ) const
{ {
/* /*
if ( isexchangeface->Test( (fnum-1)*(ntasks+1) ) != if ( isexchangeface->Test( (fnum-1)*(ntasks+1) ) !=
( loc2distface[fnum-1].Size() > 1) ) ( loc2distface[fnum-1].Size() > 1) )
{ {
cerr << "it differs, id = " << id << ", fnum = " << fnum << endl; cerr << "it differs, id = " << id << ", fnum = " << fnum << endl;
} }
*/ */
// nur hier funktioniert's so nicht ???? (JS) // nur hier funktioniert's so nicht ???? (JS)
// return loc2distface[fnum-1].Size() > 1; // return loc2distface[fnum-1].Size() > 1;
return isexchangeface->Test( (fnum-1)*(ntasks+1) ); return isexchangeface->Test( (fnum-1)*(ntasks+1) );
} }
bool IsExchangeElement ( int elnum ) const bool IsExchangeElement ( int elnum ) const
{ {
// return loc2distel[elnum-1].Size() > 1; // return loc2distel[elnum-1].Size() > 1;
return isexchangeel->Test((elnum-1)*(ntasks+1)); return isexchangeel->Test((elnum-1)*(ntasks+1));
} }
bool IsExchangeSEl ( int selnum ) const bool IsExchangeSEl ( int selnum ) const
{ {
return loc2distsurfel[selnum-1].Size() > 1; return loc2distsurfel[selnum-1].Size() > 1;
} }
void SetExchangeFace (int dest, int fnr ) void SetExchangeFace (int dest, int fnr )
{ {
// isexchangeface->Set((fnr-1)*(ntasks+1) + (dest+1)); // isexchangeface->Set((fnr-1)*(ntasks+1) + (dest+1));
} }
void SetExchangeVert (int dest, int vnum ) void SetExchangeVert (int dest, int vnum )
{ {
// isexchangevert->Set((vnum-1)*(ntasks+1) + (dest+1) ); // isexchangevert->Set((vnum-1)*(ntasks+1) + (dest+1) );
} }
void SetExchangeElement (int dest, int vnum ) void SetExchangeElement (int dest, int vnum )
{ {
isexchangeel->Set( (vnum-1)*(ntasks+1) + (dest+1) ); isexchangeel->Set( (vnum-1)*(ntasks+1) + (dest+1) );
} }
void SetExchangeEdge (int dest, int ednum ) void SetExchangeEdge (int dest, int ednum )
{ {
// isexchangeedge->Set ( (ednum-1)*(ntasks+1) + (dest+1) ); // isexchangeedge->Set ( (ednum-1)*(ntasks+1) + (dest+1) );
} }
bool IsExchangeVert (int dest, int vnum ) const bool IsExchangeVert (int dest, int vnum ) const
{ {
FlatArray<int> exchange = loc2distvert[vnum]; FlatArray<int> exchange = loc2distvert[vnum];
for (int i = 1; i < exchange.Size(); i += 2) for (int i = 1; i < exchange.Size(); i += 2)
if (exchange[i] == dest) return true; if (exchange[i] == dest) return true;
return false; return false;
// return isexchangevert->Test((vnum-1)*(ntasks+1) + (dest+1) ); // return isexchangevert->Test((vnum-1)*(ntasks+1) + (dest+1) );
} }
bool IsExchangeEdge (int dest, int ednum ) const bool IsExchangeEdge (int dest, int ednum ) const
{ {
FlatArray<int> exchange = loc2distedge[ednum-1]; FlatArray<int> exchange = loc2distedge[ednum-1];
for (int i = 1; i < exchange.Size(); i += 2) for (int i = 1; i < exchange.Size(); i += 2)
if (exchange[i] == dest) return true; if (exchange[i] == dest) return true;
return false; return false;
// return isexchangeedge->Test((ednum-1)*(ntasks+1) + (dest+1)); // return isexchangeedge->Test((ednum-1)*(ntasks+1) + (dest+1));
} }
bool IsExchangeFace (int dest, int fnum ) const bool IsExchangeFace (int dest, int fnum ) const
{ {
FlatArray<int> exchange = loc2distface[fnum-1]; FlatArray<int> exchange = loc2distface[fnum-1];
for (int i = 1; i < exchange.Size(); i += 2) for (int i = 1; i < exchange.Size(); i += 2)
if (exchange[i] == dest) return true; if (exchange[i] == dest) return true;
return false; return false;
// return isexchangeface->Test((fnum-1)*(ntasks+1) + (dest+1) ); // return isexchangeface->Test((fnum-1)*(ntasks+1) + (dest+1) );
} }
bool IsExchangeElement (int dest, int elnum ) const bool IsExchangeElement (int dest, int elnum ) const
{ {
// das geht auch nicht // das geht auch nicht
/* /*
FlatArray<int> exchange = loc2distel[elnum-1]; FlatArray<int> exchange = loc2distel[elnum-1];
for (int i = 1; i < exchange.Size(); i += 2) for (int i = 1; i < exchange.Size(); i += 2)
if (exchange[i] == dest) return true; if (exchange[i] == dest) return true;
return false; return false;
*/ */
return isexchangeel->Test((elnum-1)*(ntasks+1) + (dest+1)); return isexchangeel->Test((elnum-1)*(ntasks+1) + (dest+1));
} }
int Overlap() const int Overlap() const
{ return overlap; } { return overlap; }
int IncreaseOverlap () int IncreaseOverlap ()
{ overlap++; return overlap; } { overlap++; return overlap; }
void Update(); void Update();
void UpdateCoarseGrid(); void UpdateCoarseGrid();
void UpdateCoarseGridOverlap(); void UpdateCoarseGridOverlap();
void UpdateRefinement (); void UpdateRefinement ();
void UpdateTopology (); void UpdateTopology ();
void UpdateExchangeElements(); void UpdateExchangeElements();
void UpdateCoarseGridGlobal(); void UpdateCoarseGridGlobal();
bool DoCoarseUpdate() const bool DoCoarseUpdate() const
{ return !coarseupdate; } { return !coarseupdate; }
void SetDistantFaceNum ( int dest, int locnum, int distnum ); void SetDistantFaceNum ( int dest, int locnum, int distnum );
void SetDistantPNum ( int dest, int locnum, int distnum ); void SetDistantPNum ( int dest, int locnum, int distnum );
void SetDistantEdgeNum ( int dest, int locnum, int distnum ); void SetDistantEdgeNum ( int dest, int locnum, int distnum );
void SetDistantEl ( int dest, int locnum, int distnum ); void SetDistantEl ( int dest, int locnum, int distnum );
void SetDistantSurfEl ( int dest, int locnum, int distnum ); void SetDistantSurfEl ( int dest, int locnum, int distnum );
void SetDistantSegm ( int dest, int locnum, int distnum ); void SetDistantSegm ( int dest, int locnum, int distnum );
bool IsGhostEl ( int elnum ) const { return mesh.VolumeElement(elnum).IsGhost(); } bool IsGhostEl ( int elnum ) const { return mesh.VolumeElement(elnum).IsGhost(); }
bool IsGhostFace ( int fanum ) const { return isghostface.Test(fanum-1); } bool IsGhostFace ( int fanum ) const { return isghostface.Test(fanum-1); }
bool IsGhostEdge ( int ednum ) const { return isghostedge.Test(ednum-1); } bool IsGhostEdge ( int ednum ) const { return isghostedge.Test(ednum-1); }
bool IsGhostVert ( int pnum ) const { return mesh.Point(pnum).IsGhost(); } bool IsGhostVert ( int pnum ) const { return mesh.Point(pnum).IsGhost(); }
// inline void SetGhostVert ( const int pnum ) // inline void SetGhostVert ( const int pnum )
// { isghostvert.Set(pnum-1); } // { isghostvert.Set(pnum-1); }
void SetGhostEdge ( int ednum ) void SetGhostEdge ( int ednum )
{ isghostedge.Set(ednum-1); } { isghostedge.Set(ednum-1); }
void ClearGhostEdge ( int ednum ) void ClearGhostEdge ( int ednum )
{ isghostedge.Clear(ednum-1); } { isghostedge.Clear(ednum-1); }
void SetGhostFace ( int fanum ) void SetGhostFace ( int fanum )
{ isghostface.Set(fanum-1); } { isghostface.Set(fanum-1); }
void ClearGhostFace ( int fanum ) void ClearGhostFace ( int fanum )
{ isghostface.Clear(fanum-1); } { isghostface.Clear(fanum-1); }
bool IsElementInPartition ( int elnum, int dest ) const bool IsElementInPartition ( int elnum, int dest ) const
{ {
return IsExchangeElement ( dest, elnum); return IsExchangeElement ( dest, elnum);
} }
void SetElementInPartition ( int elnum, int dest ) void SetElementInPartition ( int elnum, int dest )
{ {
SetExchangeElement ( dest, elnum ); SetExchangeElement ( dest, elnum );
} }
void SetNVGlob ( int anvglob ) { nvglob = anvglob; } void SetNVGlob ( int anvglob ) { nvglob = anvglob; }
void SetNEGlob ( int aneglob ) { neglob = aneglob; } void SetNEGlob ( int aneglob ) { neglob = aneglob; }
int GetNVGlob () { return nvglob; } int GetNVGlob () { return nvglob; }
int GetNEGlob () { return neglob; } int GetNEGlob () { return neglob; }
}; };
}

View File

@ -1,17 +1,21 @@
#ifndef VALIDATE_HPP #ifndef VALIDATE_HPP
#define VALIDATE_HPP #define VALIDATE_HPP
namespace netgen
{
void GetPureBadness(Mesh & mesh, Array<double> & pure_badness,
const BitArray & isnewpoint);
double Validate(const Mesh & mesh, Array<ElementIndex> & bad_elements,
const Array<double> & pure_badness,
double max_worsening, const bool uselocalworsening,
Array<double> * quality_loss = NULL);
void RepairBisection(Mesh & mesh, Array<ElementIndex> & bad_elements,
const BitArray & isnewpoint, const Refinement & refinement,
const Array<double> & pure_badness,
double max_worsening, const bool uselocalworsening,
const Array< Array<int,PointIndex::BASE>* > & idmaps);
}
void GetPureBadness(Mesh & mesh, Array<double> & pure_badness,
const BitArray & isnewpoint);
double Validate(const Mesh & mesh, Array<ElementIndex> & bad_elements,
const Array<double> & pure_badness,
double max_worsening, const bool uselocalworsening,
Array<double> * quality_loss = NULL);
void RepairBisection(Mesh & mesh, Array<ElementIndex> & bad_elements, const BitArray & isnewpoint, const Refinement & refinement,
const Array<double> & pure_badness,
double max_worsening, const bool uselocalworsening,
const Array< Array<int,PointIndex::BASE>* > & idmaps);
#endif // VALIDATE_HPP #endif // VALIDATE_HPP

View File

@ -5,7 +5,7 @@ dist_pkgdata_DATA = boxcyl.geo circle_on_cube.geo cone.geo cube.geo \
cylsphere.geo ellipsoid.geo ellipticcyl.geo extrusion.geo fichera.geo lshape3d.geo \ cylsphere.geo ellipsoid.geo ellipticcyl.geo extrusion.geo fichera.geo lshape3d.geo \
manyholes.geo manyholes2.geo matrix.geo ortho.geo period.geo revolution.geo \ manyholes.geo manyholes2.geo matrix.geo ortho.geo period.geo revolution.geo \
sculpture.geo shaft.geo shell.geo sphere.geo sphereincube.geo torus.geo trafo.geo \ sculpture.geo shaft.geo shell.geo sphere.geo sphereincube.geo torus.geo trafo.geo \
twobricks.geo twocubes.geo twocyl.geo \ twobricks.geo twocubes.geo twocyl.geo boundarycondition.geo \
hinge.stl part1.stl frame.step screw.step \ hinge.stl part1.stl frame.step screw.step \
squarehole.in2d squarecircle.in2d square.in2d squarehole.in2d squarecircle.in2d square.in2d

View File

@ -0,0 +1,16 @@
algebraic3d
solid p1 = plane (0.5, 0, 0; 1, 0, 0);
# since surfaces of both bricks are identic they get the same bc id:
solid brick1 = orthobrick (0,0,0; 1,1,1) and p1 -bc=1;
solid brick2 = orthobrick (0,0,-1; 1,1,0) and p1 -bc=2;
tlo brick1;
tlo brick2;
# override bc number:
# all faces of solid p1 belonging to the boundary of tlo brick1 get bc=3
boundarycondition p1 brick1 3;