gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
GModelIO_DIFF.cpp
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #include <stdlib.h>
7 #include <string.h>
8 #include "GModel.h"
9 #include "OS.h"
10 #include "MElement.h"
11 
12 static bool getMeshVertices(int num, int *indices,
13  std::map<int, MVertex *> &map,
14  std::vector<MVertex *> &vertices)
15 {
16  for(int i = 0; i < num; i++) {
17  if(!map.count(indices[i])) {
18  Msg::Error("Wrong node index %d", indices[i]);
19  return false;
20  }
21  else
22  vertices.push_back(map[indices[i]]);
23  }
24  return true;
25 }
26 
27 static bool getMeshVertices(int num, int *indices, std::vector<MVertex *> &vec,
28  std::vector<MVertex *> &vertices, int minVertex = 0)
29 {
30  for(int i = 0; i < num; i++) {
31  if(indices[i] < minVertex ||
32  indices[i] > (int)(vec.size() - 1 + minVertex)) {
33  Msg::Error("Wrong node index %d", indices[i]);
34  return false;
35  }
36  else
37  vertices.push_back(vec[indices[i]]);
38  }
39  return true;
40 }
41 
42 int GModel::readDIFF(const std::string &name)
43 {
44  FILE *fp = Fopen(name.c_str(), "r");
45  if(!fp) {
46  Msg::Error("Unable to open file '%s'", name.c_str());
47  return 0;
48  }
49 
50  char str[256] = "XXX";
51  std::map<int, std::vector<MElement *> > elements[10];
52  std::map<int, std::map<int, std::string> > physicals[4];
53  std::map<int, MVertex *> vertexMap;
54  std::vector<MVertex *> vertexVector;
55 
56  {
57  while(strstr(str, "Number of space dim. =") == nullptr) {
58  if(!fgets(str, sizeof(str), fp) || feof(fp)) break;
59  }
60 
61  int dim;
62  if(sscanf(str, "%*s %*s %*s %*s %*s %d", &dim) != 1) {
63  fclose(fp);
64  return 0;
65  }
66  Msg::Info("dimension %d", dim);
67 
68  int numElements;
69  if(!fgets(str, sizeof(str), fp) || feof(fp)) {
70  fclose(fp);
71  return 0;
72  }
73  while(strstr(str, "Number of elements =") == nullptr) {
74  if(!fgets(str, sizeof(str), fp) || feof(fp)) break;
75  }
76  if(sscanf(str, "%*s %*s %*s %*s %d", &numElements) != 1) {
77  fclose(fp);
78  return 0;
79  }
80  Msg::Info("%d elements", numElements);
81 
82  int numVertices;
83  if(!fgets(str, sizeof(str), fp) || feof(fp)) {
84  fclose(fp);
85  return 0;
86  }
87  while(strstr(str, "Number of nodes =") == nullptr) {
88  if(!fgets(str, sizeof(str), fp) || feof(fp)) break;
89  }
90  if(sscanf(str, "%*s %*s %*s %*s %d", &numVertices) != 1) {
91  fclose(fp);
92  return 0;
93  }
94  Msg::Info("%d nodes", numVertices);
95 
96  int numVerticesPerElement;
97  if(!fgets(str, sizeof(str), fp) || feof(fp)) {
98  fclose(fp);
99  return 0;
100  }
101  while(strstr(str, "Max number of nodes in an element:") == nullptr) {
102  if(!fgets(str, sizeof(str), fp) || feof(fp)) break;
103  }
104  if(sscanf(str, "%*s %*s %*s %*s %*s %*s %*s %d", &numVerticesPerElement) !=
105  1) {
106  fclose(fp);
107  return 0;
108  }
109  Msg::Info("numVerticesPerElement %d", numVerticesPerElement);
110 
111  bool several_subdomains;
112  if(!fgets(str, sizeof(str), fp) || feof(fp)) {
113  fclose(fp);
114  return 0;
115  }
116  if(!strncmp(&str[2], "Only one material", 17) ||
117  !strncmp(&str[2], "Only one subdomain", 18)) {
118  if(!strncmp(&str[37], "dpTRUE", 6) || !strncmp(&str[37], "true", 4) ||
119  !strncmp(&str[36], "dpTRUE", 6) || !strncmp(&str[36], "true", 4)) {
120  several_subdomains = false;
121  }
122  else {
123  several_subdomains = true;
124  }
125  Msg::Info("several_subdomains %x %s", several_subdomains, str);
126  }
127 
128  int nbi;
129  std::vector<int> bi;
130  if(!fgets(str, sizeof(str), fp) || feof(fp)) {
131  fclose(fp);
132  return 0;
133  }
134  while(strstr(str, "Boundary indicators:") == nullptr &&
135  strstr(str, "boundary indicators:") == nullptr) {
136  if(!fgets(str, sizeof(str), fp) || feof(fp)) break;
137  }
138  if(sscanf(str, "%d %*s %*s", &nbi) != 1) {
139  fclose(fp);
140  return 0;
141  }
142  Msg::Info("nbi %d", nbi);
143  if(nbi != 0) bi.resize(nbi);
144  std::string format_read_bi = "%*d %*s %*s";
145  for(int i = 0; i < nbi; i++) {
146  if(format_read_bi[format_read_bi.size() - 1] == 'd') {
147  format_read_bi[format_read_bi.size() - 1] = '*';
148  format_read_bi += "d %d";
149  }
150  else
151  format_read_bi += " %d";
152  if(sscanf(str, format_read_bi.c_str(), &bi[i]) != 1) {
153  fclose(fp);
154  return 0;
155  }
156  Msg::Info("bi[%d]=%d", i, bi[i]);
157  }
158 
159  while(str[0] != '#') {
160  if(!fgets(str, sizeof(str), fp) || feof(fp)) break;
161  }
162  vertexVector.clear();
163  vertexMap.clear();
164  int minVertex = numVertices + 1, maxVertex = -1;
165  int num = 0;
166  std::vector<std::vector<int> > elementary(numVertices);
167 
168  Msg::StartProgressMeter(numVertices);
169  for(int i = 0; i < numVertices; i++) {
170  if(!fgets(str, sizeof(str), fp)) {
171  fclose(fp);
172  return 0;
173  }
174  double xyz[3];
175  int tmp;
176  if(sscanf(str, "%d ( %lf , %lf , %lf ) [%d]", &num, &xyz[0], &xyz[1],
177  &xyz[2], &tmp) != 5) {
178  fclose(fp);
179  return 0;
180  }
181  elementary[i].resize(tmp + 1);
182  elementary[i][0] = tmp;
183  minVertex = std::min(minVertex, num);
184  maxVertex = std::max(maxVertex, num);
185  if(vertexMap.count(num))
186  Msg::Warning("Skipping duplicate node %d", num);
187  else
188  vertexMap[num] = new MVertex(xyz[0], xyz[1], xyz[2], nullptr, num);
189  if(numVertices > 100000) Msg::ProgressMeter(i + 1, true, "Reading nodes");
190  // If the vertex numbering is dense, tranfer the map into a
191  // vector to speed up element creation
192  if((int)vertexMap.size() == numVertices &&
193  ((minVertex == 1 && maxVertex == numVertices) ||
194  (minVertex == 0 && maxVertex == numVertices - 1))) {
195  Msg::Info("Vertex numbering is dense");
196  vertexVector.resize(vertexMap.size() + 1);
197  if(minVertex == 1)
198  vertexVector[0] = nullptr;
199  else
200  vertexVector[numVertices] = nullptr;
201  for(auto it = vertexMap.begin(); it != vertexMap.end(); ++it)
202  vertexVector[it->first] = it->second;
203  vertexMap.clear();
204  }
205  Msg::Info("%d ( %lf , %lf , %lf ) [%d]", i, xyz[0], xyz[1], xyz[2],
206  elementary[i][0]);
207  std::string format_read_bi = "%*d ( %*lf , %*lf , %*lf ) [%*d]";
208  for(int j = 0; j < elementary[i][0]; j++) {
209  if(format_read_bi[format_read_bi.size() - 1] == 'd') {
210  format_read_bi[format_read_bi.size() - 1] = '*';
211  format_read_bi += "d %d";
212  }
213  else
214  format_read_bi += " %d";
215  if(sscanf(str, format_read_bi.c_str(), &(elementary[i][j + 1])) != 1) {
216  fclose(fp);
217  return 0;
218  }
219  Msg::Info("elementary[%d][%d]=%d", i + 1, j + 1, elementary[i][j + 1]);
220  }
221  }
223 
224  while(str[0] != '#') {
225  if(!fgets(str, sizeof(str), fp) || feof(fp)) break;
226  }
227  std::vector<int> material(numElements);
228  std::vector<std::vector<int> > ElementsNodes(numElements);
229  for(int i = 0; i < numElements; i++) {
230  ElementsNodes[i].resize(numVerticesPerElement);
231  }
232  char eleTypec[20] = "";
233  std::string eleType;
234  std::vector<int> mapping;
235 
236  Msg::StartProgressMeter(numElements);
237  for(int i = 1; i <= numElements; i++) {
238  if(!fgets(str, sizeof(str), fp)) {
239  fclose(fp);
240  return 0;
241  }
242  int num = 0, type, physical = 0;
243  unsigned int partition = 0;
244  int indices[60];
245  if(sscanf(str, "%*d %s %d", eleTypec, &material[i - 1]) != 2) {
246  fclose(fp);
247  return 0;
248  }
249  eleType = std::string(eleTypec);
250  int k2; // local number for the element
251  int NoVertices; // number of vertices per element
252  if(eleType == "ElmT3n2D") {
253  NoVertices = 3;
254  static int map[3] = {0, 1, 2}; // identical to gmsh
255  mapping = std::vector<int>(map, map + sizeof(map) / sizeof(int));
256  type = MSH_TRI_3;
257  }
258  else if(eleType == "ElmT6n2D") {
259  NoVertices = 6;
260  static int map[6] = {0, 1, 2, 3, 4, 5}; // identical to gmsh
261  mapping = std::vector<int>(map, map + sizeof(map) / sizeof(int));
262  type = MSH_TRI_6;
263  }
264  else if(eleType == "ElmB4n2D") {
265  NoVertices = 4;
266  static int map[4] = {0, 1, 3, 2}; // local numbering
267  mapping = std::vector<int>(map, map + sizeof(map) / sizeof(int));
268  type = MSH_QUA_4;
269  }
270  else if(eleType == "ElmB8n2D") {
271  NoVertices = 8;
272  static int map[8] = {0, 1, 3, 2, 4, 6, 7, 5}; // local numbering
273  mapping = std::vector<int>(map, map + sizeof(map) / sizeof(int));
274  type = MSH_QUA_8;
275  }
276  else if(eleType == "ElmB9n2D") {
277  NoVertices = 9;
278  static int map[9] = {0, 4, 1, 7, 8, 5, 3, 6, 2}; // local numbering
279  mapping = std::vector<int>(map, map + sizeof(map) / sizeof(int));
280  type = MSH_QUA_9;
281  }
282  else if(eleType == "ElmT4n3D") {
283  NoVertices = 4;
284  static int map[4] = {0, 1, 2, 3}; // identical to gmsh
285  mapping = std::vector<int>(map, map + sizeof(map) / sizeof(int));
286  type = MSH_TET_4;
287  }
288  else if(eleType == "ElmT10n3D") {
289  NoVertices = 10;
290  static int map[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; // local numbering
291  mapping = std::vector<int>(map, map + sizeof(map) / sizeof(int));
292  type = MSH_TET_10;
293  }
294  else if(eleType == "ElmB8n3D") {
295  NoVertices = 8;
296  static int map[8] = {4, 5, 0, 1, 7, 6, 3, 2};
297  mapping = std::vector<int>(map, map + sizeof(map) / sizeof(int));
298  type = MSH_HEX_8;
299  }
300  else if(eleType == "ElmB20n3D") {
301  NoVertices = 20;
302  static int map[20] = {4, 5, 0, 1, 7, 6, 3, 2, 16, 8,
303  19, 13, 15, 12, 14, 17, 18, 9, 11};
304  mapping = std::vector<int>(map, map + sizeof(map) / sizeof(int));
305  type = MSH_HEX_20;
306  }
307  else if(eleType == "ElmB27n3D") {
308  NoVertices = 27;
309  static int map[27] = {4, 16, 5, 10, 21, 12, 0, 8, 1,
310  17, 25, 18, 22, 26, 23, 9, 20, 11,
311  7, 19, 6, 15, 24, 14, 3, 13, 2};
312  mapping = std::vector<int>(map, map + sizeof(map) / sizeof(int));
313  type = MSH_HEX_27;
314  }
315  else {
316  fclose(fp);
317  return 0;
318  }
319  std::string format_read_vertices = "%*d %*s %*d";
320  for(int k = 0; k < NoVertices; k++) {
321  if(format_read_vertices[format_read_vertices.size() - 2] != '*') {
322  format_read_vertices[format_read_vertices.size() - 1] = '*';
323  format_read_vertices += "d %d";
324  }
325  else
326  format_read_vertices += " %d";
327  k2 = mapping[k];
328  if(sscanf(str, format_read_vertices.c_str(),
329  &ElementsNodes[i - 1][k2]) != 1) {
330  fclose(fp);
331  return 0;
332  }
333  }
334  mapping.clear();
335  for(int j = 0; j < NoVertices; j++) indices[j] = ElementsNodes[i - 1][j];
336  std::vector<MVertex *> vertices;
337  if(vertexVector.size()) {
338  if(!getMeshVertices(numVerticesPerElement, indices, vertexVector,
339  vertices)) {
340  fclose(fp);
341  return 0;
342  }
343  }
344  else {
345  if(!getMeshVertices(numVerticesPerElement, indices, vertexMap,
346  vertices)) {
347  fclose(fp);
348  return 0;
349  }
350  }
351 
353  MElement *e = f.create(type, vertices, num, partition);
354  if(!e) {
355  Msg::Error("Unknown type of element %d", type);
356  fclose(fp);
357  return 0;
358  }
359  int reg = elementary[i - 1][1];
360  switch(e->getType()) {
361  case TYPE_PNT: elements[0][reg].push_back(e); break;
362  case TYPE_LIN: elements[1][reg].push_back(e); break;
363  case TYPE_TRI: elements[2][reg].push_back(e); break;
364  case TYPE_QUA: elements[3][reg].push_back(e); break;
365  case TYPE_TET: elements[4][reg].push_back(e); break;
366  case TYPE_HEX: elements[5][reg].push_back(e); break;
367  case TYPE_PRI: elements[6][reg].push_back(e); break;
368  case TYPE_PYR: elements[7][reg].push_back(e); break;
369  default:
370  Msg::Error("Wrong type of element");
371  fclose(fp);
372  return 0;
373  }
374  int dim = e->getDim();
375  if(physical &&
376  (!physicals[dim].count(reg) || !physicals[dim][reg].count(physical)))
377  physicals[dim][reg][physical] = "unnamed";
378  if(partition > getNumPartitions()) setNumPartitions(partition);
379 
380  if(numElements > 100000)
381  Msg::ProgressMeter(i + 1, true, "Reading elements");
382  }
384  }
385 
386  // store the elements in their associated elementary entity. If the
387  // entity does not exist, create a new (discrete) one.
388  for(int i = 0; i < (int)(sizeof(elements) / sizeof(elements[0])); i++)
389  _storeElementsInEntities(elements[i]);
390 
391  // associate the correct geometrical entity with each mesh vertex
393 
394  // store the vertices in their associated geometrical entity
395  if(vertexVector.size())
396  _storeVerticesInEntities(vertexVector);
397  else
398  _storeVerticesInEntities(vertexMap);
399 
400  // store the physical tags
401  for(int i = 0; i < 4; i++) _storePhysicalTagsInEntities(i, physicals[i]);
402 
403  fclose(fp);
404  return 1;
405 }
406 
407 int GModel::writeDIFF(const std::string &name, bool binary, bool saveAll,
408  double scalingFactor)
409 {
410  if(binary) {
411  Msg::Error("Binary DIFF output is not implemented");
412  return 0;
413  }
414 
415  FILE *fp = Fopen(name.c_str(), binary ? "wb" : "w");
416  if(!fp) {
417  Msg::Error("Unable to open file '%s'", name.c_str());
418  return 0;
419  }
420 
421  // make this an option?
422  bool usePhysicalTags = true;
423 
424  if(noPhysicalGroups()) {
425  saveAll = true;
426  usePhysicalTags = false;
427  }
428 
429  // get the number of vertices and flag vertices to skip
430  int numVertices = indexMeshVertices(saveAll, 0, false);
431 
432  // get all the entities in the model
433  std::vector<GEntity *> entities;
434  getEntities(entities);
435 
436  // find max dimension of mesh elements we need to save
437  int dim = 0;
438  for(std::size_t i = 0; i < entities.size(); i++) {
439  if((entities[i]->physicals.size() || saveAll) &&
440  entities[i]->getNumMeshElements()) {
441  dim = std::max(dim, entities[i]->dim());
442  }
443  }
444 
445  // tag the vertices according to which boundary entity they belong to (note
446  // that we use a brute force approach here, so that we can deal with models
447  // with incomplete topology)
448  std::vector<std::list<int> > vertexTags(numVertices);
449  std::list<int> boundaryIndicators;
450  for(std::size_t ient = 0; ient < entities.size(); ient++) {
451  GEntity *ge = entities[ient];
452  if(ge->dim() != dim - 1) continue;
453  // we are on a "boundary"
454  if(usePhysicalTags) {
455  for(auto p : ge->physicals) boundaryIndicators.push_back(p);
456  }
457  else {
458  boundaryIndicators.push_back(ge->tag());
459  }
460  for(std::size_t i = 0; i < ge->getNumMeshElements(); i++) {
461  MElement *e = ge->getMeshElement(i);
462  for(std::size_t j = 0; j < e->getNumVertices(); j++) {
463  MVertex *v = e->getVertex(j);
464  if(v->getIndex() > 0) {
465  if(usePhysicalTags) {
466  for(auto p : ge->physicals)
467  vertexTags[v->getIndex() - 1].push_back(p);
468  }
469  else {
470  vertexTags[v->getIndex() - 1].push_back(ge->tag());
471  }
472  }
473  }
474  }
475  }
476  boundaryIndicators.sort();
477  boundaryIndicators.unique();
478  for(int i = 0; i < numVertices; i++) {
479  vertexTags[i].sort();
480  vertexTags[i].unique();
481  }
482 
483  // loop over all elements we need to save
484  std::size_t numElements = 0;
485  std::size_t maxNumNodesPerElement = 0, minNumNodesPerElement = 1000;
486  for(std::size_t i = 0; i < entities.size(); i++) {
487  if(entities[i]->physicals.size() || saveAll) {
488  for(std::size_t j = 0; j < entities[i]->getNumMeshElements(); j++) {
489  MElement *e = entities[i]->getMeshElement(j);
490  if(e->getStringForDIFF() && e->getDim() == dim) {
491  numElements++;
492  maxNumNodesPerElement =
493  std::max(maxNumNodesPerElement, e->getNumVertices());
494  minNumNodesPerElement =
495  std::min(minNumNodesPerElement, e->getNumVertices());
496  }
497  }
498  }
499  }
500 
501  fprintf(fp, "\n\n");
502  fprintf(fp, " Finite element mesh (GridFE):\n\n");
503  fprintf(fp, " Number of space dim. = 3\n");
504  fprintf(fp, " Number of elements = %lu\n", numElements);
505  fprintf(fp, " Number of nodes = %d\n\n", numVertices);
506  fprintf(fp, " All elements are of the same type: %s\n",
507  (maxNumNodesPerElement != minNumNodesPerElement) ? "dpFALSE" : "dpTRUE");
508  fprintf(fp, " Max number of nodes in an element: %lu \n",
509  maxNumNodesPerElement);
510  fprintf(fp, " Only one subdomain : dpFALSE\n");
511  fprintf(fp, " Lattice data ? 0\n\n\n\n");
512  fprintf(fp, " %d Boundary indicators: ", (int)boundaryIndicators.size());
513  for(auto it = boundaryIndicators.begin(); it != boundaryIndicators.end();
514  it++)
515  fprintf(fp, " %d", *it);
516 
517  fprintf(fp, "\n\n\n");
518  fprintf(fp, " Nodal coordinates and nodal boundary indicators,\n");
519  fprintf(fp, " the columns contain:\n");
520  fprintf(fp, " - node number\n");
521  fprintf(fp, " - coordinates\n");
522  fprintf(fp, " - no of boundary indicators that are set (ON)\n");
523  fprintf(fp, " - the boundary indicators that are set (ON) if any.\n");
524  fprintf(fp, "#\n");
525 
526  // write mesh vertices
527  for(std::size_t i = 0; i < entities.size(); i++) {
528  for(std::size_t j = 0; j < entities[i]->mesh_vertices.size(); j++) {
529  MVertex *v = entities[i]->mesh_vertices[j];
530  if(v->getIndex() > 0) {
531  v->writeDIFF(fp, binary, scalingFactor);
532  fprintf(fp, " [%d] ", (int)vertexTags[v->getIndex() - 1].size());
533  for(auto it = vertexTags[v->getIndex() - 1].begin();
534  it != vertexTags[v->getIndex() - 1].end(); it++)
535  fprintf(fp, " %d ", *it);
536  fprintf(fp, "\n");
537  }
538  }
539  }
540 
541  fprintf(fp, "\n");
542  fprintf(fp, "\n");
543  fprintf(fp, " Element types and connectivity\n");
544  fprintf(fp, " the columns contain:\n");
545  fprintf(fp, " - element number\n");
546  fprintf(fp, " - element type\n");
547  fprintf(fp, " - subdomain number \n");
548  fprintf(fp, " - the global node numbers of the nodes in the element.\n");
549  fprintf(fp, "#\n");
550 
551  // write mesh elements
552  int num = 0;
553  for(std::size_t i = 0; i < entities.size(); i++) {
554  if(entities[i]->physicals.size() || saveAll) {
555  for(std::size_t j = 0; j < entities[i]->getNumMeshElements(); j++) {
556  MElement *e = entities[i]->getMeshElement(j);
557  if(e->getStringForDIFF() && e->getDim() == dim) {
558  if(usePhysicalTags) {
559  for(auto p : entities[i]->physicals)
560  e->writeDIFF(fp, ++num, binary, p);
561  }
562  else {
563  e->writeDIFF(fp, ++num, binary, entities[i]->tag());
564  }
565  }
566  }
567  }
568  }
569  fprintf(fp, "\n");
570 
571  fclose(fp);
572  return 1;
573 }
MSH_HEX_8
#define MSH_HEX_8
Definition: GmshDefines.h:84
MSH_TRI_6
#define MSH_TRI_6
Definition: GmshDefines.h:88
TYPE_LIN
#define TYPE_LIN
Definition: GmshDefines.h:65
Msg::Info
static void Info(const char *fmt,...)
Definition: GmshMessage.cpp:587
MElementFactory
Definition: MElement.h:517
OS.h
MVertex
Definition: MVertex.h:24
MElement::getDim
virtual int getDim() const =0
MSH_QUA_4
#define MSH_QUA_4
Definition: GmshDefines.h:82
Msg::Warning
static void Warning(const char *fmt,...)
Definition: GmshMessage.cpp:543
Msg::Error
static void Error(const char *fmt,...)
Definition: GmshMessage.cpp:482
GEntity::physicals
std::vector< int > physicals
Definition: GEntity.h:65
LegendrePolynomials::f
void f(int n, double u, double *val)
Definition: orthogonalBasis.cpp:77
TYPE_PNT
#define TYPE_PNT
Definition: GmshDefines.h:64
GModel::_storeElementsInEntities
void _storeElementsInEntities(std::map< int, std::vector< MElement * > > &map)
Definition: GModel.cpp:2273
TYPE_TRI
#define TYPE_TRI
Definition: GmshDefines.h:66
GEntity
Definition: GEntity.h:31
GModel::readDIFF
int readDIFF(const std::string &name)
Definition: GModelIO_DIFF.cpp:42
TYPE_PRI
#define TYPE_PRI
Definition: GmshDefines.h:70
GModel::getNumPartitions
std::size_t getNumPartitions() const
Definition: GModel.h:602
MElement::getNumVertices
virtual std::size_t getNumVertices() const =0
GModel::setNumPartitions
void setNumPartitions(std::size_t npart)
Definition: GModel.h:603
Fopen
FILE * Fopen(const char *f, const char *mode)
Definition: OS.cpp:273
GModel::writeDIFF
int writeDIFF(const std::string &name, bool binary=false, bool saveAll=false, double scalingFactor=1.0)
Definition: GModelIO_DIFF.cpp:407
MSH_TRI_3
#define MSH_TRI_3
Definition: GmshDefines.h:81
MElement::getVertex
virtual const MVertex * getVertex(int num) const =0
MElement::getType
virtual int getType() const =0
getMeshVertices
static bool getMeshVertices(int num, int *indices, std::map< int, MVertex * > &map, std::vector< MVertex * > &vertices)
Definition: GModelIO_DIFF.cpp:12
GEntity::getNumMeshElements
virtual std::size_t getNumMeshElements() const
Definition: GEntity.h:348
Msg::StopProgressMeter
static void StopProgressMeter()
Definition: GmshMessage.cpp:318
MElement::writeDIFF
virtual void writeDIFF(FILE *fp, int num, bool binary=false, int physical_property=1)
Definition: MElement.cpp:1877
GModel::vertices
std::set< GVertex *, GEntityPtrLessThan > vertices
Definition: GModel.h:146
MSH_QUA_8
#define MSH_QUA_8
Definition: GmshDefines.h:95
MSH_HEX_20
#define MSH_HEX_20
Definition: GmshDefines.h:96
MElement
Definition: MElement.h:30
GEntity::tag
int tag() const
Definition: GEntity.h:280
MSH_TET_10
#define MSH_TET_10
Definition: GmshDefines.h:90
GModel::getEntities
void getEntities(std::vector< GEntity * > &entities, int dim=-1) const
Definition: GModel.cpp:651
TYPE_PYR
#define TYPE_PYR
Definition: GmshDefines.h:69
MSH_QUA_9
#define MSH_QUA_9
Definition: GmshDefines.h:89
TYPE_QUA
#define TYPE_QUA
Definition: GmshDefines.h:67
MElement::getStringForDIFF
virtual const char * getStringForDIFF() const
Definition: MElement.h:494
MVertex::getIndex
long int getIndex() const
Definition: MVertex.h:93
GEntity::getMeshElement
virtual MElement * getMeshElement(std::size_t index) const
Definition: GEntity.h:363
MSH_TET_4
#define MSH_TET_4
Definition: GmshDefines.h:83
MSH_HEX_27
#define MSH_HEX_27
Definition: GmshDefines.h:91
MElement.h
GModel::noPhysicalGroups
bool noPhysicalGroups()
Definition: GModel.cpp:828
Msg::StartProgressMeter
static void StartProgressMeter(int ntotal)
Definition: GmshMessage.cpp:312
TYPE_HEX
#define TYPE_HEX
Definition: GmshDefines.h:71
TYPE_TET
#define TYPE_TET
Definition: GmshDefines.h:68
GModel.h
GModel::_storeVerticesInEntities
void _storeVerticesInEntities(std::map< int, MVertex * > &vertices)
Definition: GModel.cpp:2496
GEntity::dim
virtual int dim() const
Definition: GEntity.h:196
Msg::ProgressMeter
static void ProgressMeter(int n, bool log, const char *fmt,...)
Definition: GmshMessage.cpp:783
MVertex::writeDIFF
void writeDIFF(FILE *fp, bool binary, double scalingFactor=1.0)
Definition: MVertex.cpp:388
GModel::_associateEntityWithMeshVertices
void _associateEntityWithMeshVertices()
Definition: GModel.cpp:2470
GModel::indexMeshVertices
std::size_t indexMeshVertices(bool all, int singlePartition=0, bool renumber=true)
Definition: GModel.cpp:2135
GModel::_storePhysicalTagsInEntities
void _storePhysicalTagsInEntities(int dim, std::map< int, std::map< int, std::string > > &map)
Definition: GModel.cpp:2568