ParMooN
 All Classes Functions Variables Friends Pages
TetGenMeshLoader.h
1 // =======================================================================
2 // @(#)Domain.C 1.23 05/05/00
3 //
4 // Class: TTetGenMeshLoader
5 // Purpose: creates domain with tetgen from a .smesh file
6 //
7 // Author: Andreas Hahn 26.04.2010
8 //
9 // History:
10 //
11 // =======================================================================
12 
13 #ifndef __TETGENMESHLOADER__
14 #define __TETGENMESHLOADER__
15 
16 #define __TETGEN_14X__
17 
18 #include <tetgen.h>
19 
20 #include <Constants.h>
21 #include <MooNMD_Io.h>
22 
23 class TBoundPart;
24 class TBoundComp3D;
25 class TVertex;
26 class TBaseCell;
27 class TJoint;
28 class TDomain;
29 
31 {
32  protected:
34  char *mFileName;
35 
37  char *mBoundFile;
38 
41 
44 
47 
49  int **mTrifaceHash;
50 
52  tetgenio mTetIn;
53  tetgenio mTetOut;
54 #ifdef __TETGEN_14X__
55  tetgenbehavior mTetBeh;
56  tetgenio mTetAddIn;
57 #endif
58 
60  bool plc;
61  bool reconstruct;
62  bool insertpoints;
63 
64  protected:
65  int ReadBoundFile(int N_BoundComps);
66  int ReadBoundComp(std::ifstream *in, int &CurrBoundComp, int &Range);
67  int ReadBoundType(std::ifstream *in, char *buff);
68  int ReadBoundParams(std::ifstream *in, char *type, int CurrBoundComp, int Range);
69  int ReadBoundParamsCylinder(std::ifstream *in, double &radius,
70  double &px, double &py, double &pz,
71  double &ax, double &ay, double &az,
72  double &nx, double &ny, double &nz);
73  int ReadBoundParamsSphere(std::ifstream *in, double &radius,
74  double &mx, double &my, double &mz);
75 
76  int ExtractValue(const char *buff, int increment, double &val);
77  int ExtractVector(const char *buff, int increment,
78  double &val1, double &val2, double &val3);
79 
80  int SetBdPlaneParams(int N_BoundComps);
81 
82  void Normalize3D(double *vec);
83  void Cross3D(double *vec1, double *vec2, double *res);
84 
85  int AllocVertices(double &StartX, double &StartY, double &StartZ,
86  double &BoundX, double &BoundY, double &BoundZ);
87  int AllocRootCells(TBaseCell **&CellTree, int &N_RootCells);
88  int AllocJoints(TBaseCell **CellTree);
89  int DistributeJoints(TBaseCell **CellTree);
90 
91  int FindTriface(int a, int b, int c);
92  void HashTrifaces();
93  int CreateAdjacency();
94 
95  void MakeOptionString(std::string &opts);
96 
97  void MakeBoundaryLayer_smesh();
98  void MakeBoundaryLayer_msh();
99  void FindBoundaryPoints_msh(int *pointlist, double *normallist);
100 
101  int Load_msh(const char *filename);
102 
104  int BuildBoundary (TBoundPart **&BdParts, int &N_BoundParts,
105  int &N_BoundComps, int *&StartBdCompID, int *&Interfaces);
106 
108  int BuildBoundary2 (TBoundPart **&BdParts, int &N_BoundParts,
109  int &N_BoundComps, int *&StartBdCompID, int *&Interfaces);
110 
112  int Tetgen();
113 
115  int BuildMooNMDMesh(TBaseCell **&CellTree, int &N_RootCells,
116  double &StartX, double &StartY, double &StartZ,
117  double &BoundX, double &BoundY, double &BoundZ);
118 
119  public:
120  typedef struct
121  {
122  TBoundPart **BdParts;
123  int N_BoundParts;
124  int N_BoundComps;
125  int *StartBdCompID;
126  int *Interfaces;
127  TBaseCell **CellTree;
128  int N_RootCells;
129  double StartX;
130  double StartY;
131  double StartZ;
132  double BoundX;
133  double BoundY;
134  double BoundZ;
135  } TDummyDomain;
136 
137  public:
138  // CTOR
139 // TTetGenMeshLoader() : mFileName(0), mAllBoundComps(0), mBoundFile(0),
140 // mAllVertices(0), mAllJoints(0) {};
142  TTetGenMeshLoader(const char *FileName);
143 
144  // DTOR
146 
148  int Generate(TDomain *Domain);
149  int Generate(int N_Points, double *Points, int N_Facets, int *Facets,
150  int N_Regions, double *Regions, TDummyDomain *Domain);
151 };
152 #endif
int BuildMooNMDMesh(TBaseCell **&CellTree, int &N_RootCells, double &StartX, double &StartY, double &StartZ, double &BoundX, double &BoundY, double &BoundZ)
Definition: TetGenMeshLoader.C:1109
bool plc
Definition: TetGenMeshLoader.h:60
Definition: TetGenMeshLoader.h:30
int Tetgen()
Definition: TetGenMeshLoader.C:1125
contains the boundary description, the virtual cell tree and macro grid
Definition: Domain.h:36
tetgenio mTetIn
Definition: TetGenMeshLoader.h:52
TVertex ** mAllVertices
Definition: TetGenMeshLoader.h:43
TJoint ** mAllJoints
Definition: TetGenMeshLoader.h:46
Definition: Joint.h:48
Definition: BoundComp3D.h:17
TBoundComp3D ** mAllBoundComps
Definition: TetGenMeshLoader.h:40
int BuildBoundary2(TBoundPart **&BdParts, int &N_BoundParts, int &N_BoundComps, int *&StartBdCompID, int *&Interfaces)
Definition: TetGenMeshLoader.C:991
Definition: BoundPart.h:21
int Generate(TDomain *Domain)
Definition: TetGenMeshLoader.C:774
information for finite element data structure
Definition: BaseCell.h:25
int BuildBoundary(TBoundPart **&BdParts, int &N_BoundParts, int &N_BoundComps, int *&StartBdCompID, int *&Interfaces)
Definition: TetGenMeshLoader.C:97
Definition: Vertex.h:19
Definition: TetGenMeshLoader.h:120
char * mBoundFile
Definition: TetGenMeshLoader.h:37
char * mFileName
Definition: TetGenMeshLoader.h:34