62
63
void _associateEntityWithMeshVertices();
65
// store the vertices in the entity they are associated with, and
66
// delete those that are not associated with any geo entity
67
void _storeVerticesInEntities(std::map<int, MVertex*> &vertices);
68
void _storeVerticesInEntities(std::vector<MVertex*> &vertices);
64
70
// entity that is currently being meshed (used for error reporting)
65
71
GEntity *_currentMeshEntity;
110
117
void setName(std::string name){ modelName = name; }
111
118
std::string getName(){ return modelName; }
113
// get the number of regions in this model.
120
// get the number of entities in this model
114
121
int getNumRegions() const { return regions.size(); }
115
122
int getNumFaces() const { return faces.size(); }
116
123
int getNumEdges() const { return edges.size(); }
117
int getNumVertices() const { return vertices.size(); }
124
int getNumVertices() const { return vertices.size(); }
126
// quickly check if the model is empty (contains no entities)
119
129
typedef std::set<GRegion*, GEntityLessThan>::iterator riter;
120
130
typedef std::set<GFace*, GEntityLessThan>::iterator fiter;
148
158
void remove(GEdge *e);
149
159
void remove(GVertex *v);
151
// Snap vertices on model edges by using geometry tolerance
161
// snap vertices on model edges by using geometry tolerance
152
162
void snapVertices();
154
// Get a vector containing all the entities in the model
155
std::vector<GEntity*> getEntities();
164
// fill a vector containing all the entities in the model
165
void getEntities(std::vector<GEntity*> &entities);
157
// Checks if there are no physical entities in the model
167
// check if there are no physical entities in the model
158
168
bool noPhysicalGroups();
160
// Returns all physical groups (one map per dimension: 0-D to 3-D)
170
// return all physical groups (one map per dimension: 0-D to 3-D)
161
171
void getPhysicalGroups(std::map<int, std::vector<GEntity*> > groups[4]);
163
// Deletes physical groups in the model
173
// delete physical groups in the model
164
174
void deletePhysicalGroups();
165
175
void deletePhysicalGroup(int dim, int num);
167
// Returns the highest number associated with a physical entity
177
// return the highest number associated with a physical entity
168
178
int getMaxPhysicalNumber();
170
// Get an iterator on the elementary/physical names
180
// get an iterator on the elementary/physical names
171
181
piter firstPhysicalName() { return physicalNames.begin(); }
172
182
piter lastPhysicalName() { return physicalNames.end(); }
173
183
piter firstElementaryName() { return elementaryNames.begin(); }
174
184
piter lastElementaryName() { return elementaryNames.end(); }
176
// Get the number of physical names
186
// get the number of physical names
177
187
int numPhysicalNames(){ return physicalNames.size(); }
179
// Associate a name with a physical number (returns new id if number==0)
189
// associate a name with a physical number (returns new id if number==0)
180
190
int setPhysicalName(std::string name, int number=0);
182
// Get the name (if any) of a given physical group
192
// get the name (if any) of a given physical group
183
193
std::string getPhysicalName(int number);
186
196
SBoundingBox3d bounds();
188
// Returns the mesh status for the entire model
198
// return the mesh status for the entire model
189
199
int getMeshStatus(bool countDiscrete=true);
191
// Returns the total number of elements in the mesh
201
// return the total number of elements in the mesh
192
202
int getNumMeshElements();
194
// Access a mesh element by coordinates
204
// get the number of each type of element in the mesh at the largest
205
// dimension and return the dimension
206
int getNumMeshElements(unsigned c[4]);
208
// access a mesh element by coordinates
195
209
MElement *getMeshElementByCoord(SPoint3 &p);
197
// Returns the total number of vertices in the mesh
211
// return the total number of vertices in the mesh
198
212
int getNumMeshVertices();
200
// Access a mesh vertex by tag, using the vertex cache
214
// access a mesh vertex by tag, using the vertex cache
201
215
MVertex *getMeshVertexByTag(int n);
203
217
// get all the mesh vertices associated with the physical group
215
229
void setCurrentMeshEntity(GEntity *e){ _currentMeshEntity = e; }
216
230
GEntity *getCurrentMeshEntity(){ return _currentMeshEntity; }
218
// Deletes all invisble mesh elements
232
// delete all invisble mesh elements
219
233
void removeInvisibleElements();
221
// The list of partitions
235
// the list of partitions
222
236
std::set<int> &getMeshPartitions() { return meshPartitions; }
223
std::set<int> &recomputeMeshPartitions();
237
void recomputeMeshPartitions();
225
// Deletes all the partitions
239
// delete all the partitions
226
240
void deleteMeshPartitions();
228
// Performs various coherence tests on the mesh
229
void checkMeshCoherence();
231
// A container for smooth normals
242
// store/recall min and max partitions size
243
void setMinPartitionSize(const int pSize) { partitionSize[0] = pSize; }
244
void setMaxPartitionSize(const int pSize) { partitionSize[1] = pSize; }
245
int getMinPartitionSize() const { return partitionSize[0]; }
246
int getMaxPartitionSize() const { return partitionSize[1]; }
248
// perform various coherence tests on the mesh
249
void checkMeshCoherence(double tolerance);
251
// remove duplicate mesh vertices
252
int removeDuplicateMeshVertices(double tolerance);
254
// a container for smooth normals
232
255
smooth_normals *normals;
235
258
int mesh(int dimension);
237
260
// Gmsh native CAD format
253
276
// Gmsh mesh file format
254
277
int readMSH(const std::string &name);
255
278
int writeMSH(const std::string &name, double version=1.0, bool binary=false,
256
bool saveAll=false, double scalingFactor=1.0);
279
bool saveAll=false, bool saveParametric=false, double scalingFactor=1.0);
258
281
// Mesh statistics (as Gmsh post-processing views)
259
282
int writePOS(const std::string &name, bool printElementary,
260
283
bool printElementNumber, bool printGamma, bool printEta, bool printRho,
261
bool saveAll=false, double scalingFactor=1.0);
284
bool printDisto,bool saveAll=false, double scalingFactor=1.0);
263
286
// Stereo lithography format
264
287
int readSTL(const std::string &name, double tolerance=1.e-3);
293
316
// CFD General Notation System files
294
317
int readCGNS(const std::string &name);
295
int writeCGNS(const std::string &name, double scalingFactor=1.0);
318
int writeCGNS(const std::string &name, int zoneDefinition,
319
const CGNSOptions &options, double scalingFactor=1.0);
297
321
// Med "Modele d'Echange de Donnees" file format (the static routine
298
322
// is allowed to load multiple models/meshes)
302
326
bool saveAll=false, double scalingFactor=1.0);
305
int readVTK(const std::string &name);
329
int readVTK(const std::string &name, bool bigEndian=false);
306
330
int writeVTK(const std::string &name, bool binary=false,
331
bool saveAll=false, double scalingFactor=1.0,
332
bool bigEndian=false);
335
int readDIFF(const std::string &name);
336
int writeDIFF(const std::string &name, bool binary=false,
307
337
bool saveAll=false, double scalingFactor=1.0);