NeoPZ
TPZVTKGeoMesh.cpp
Go to the documentation of this file.
1 
6 #include "TPZVTKGeoMesh.h"
7 #include "pzgeoel.h"
8 #include "pzintel.h"
9 #include "tpzgeoelrefpattern.h"
10 #include "pzgeopoint.h"
11 #include <sstream>
12 #include "pzcmesh.h"
13 
17 void TPZVTKGeoMesh::PrintCMeshVTK(TPZCompMesh * cmesh, std::ofstream &file, bool matColor) {
18  cmesh->LoadReferences();
19 
20  file.clear();
21  int64_t nelements = cmesh->NElements();
22 
23  std::stringstream node, connectivity, type, material, index, referenceIndex;
24 
25  //Header
26  file << "# vtk DataFile Version 3.0" << std::endl;
27  file << "TPZGeoMesh VTK Visualization" << std::endl;
28  file << "ASCII" << std::endl << std::endl;
29 
30  file << "DATASET UNSTRUCTURED_GRID" << std::endl;
31  file << "POINTS ";
32 
33  int64_t actualNode = -1, size = 0, nVALIDelements = 0;
34 
35  for (int64_t el = 0; el < nelements; el++) {
36  TPZCompEl * cel = cmesh->ElementVec()[el];
37  if (cel == NULL || cel->Reference() == NULL) {
38  continue;
39  }
40  TPZGeoEl * gel = cel->Reference();
41  if (!gel) continue;
42  if (!gel->Reference()) {
43  continue;
44  }
45 
46  MElementType elt = gel->Type();
47  int elNnodes = MElementType_NNodes(elt);
48 
49  size += (1 + elNnodes);
50  connectivity << elNnodes;
51 
52  for (int t = 0; t < elNnodes; t++) {
53  for (int c = 0; c < 3; c++) {
54  double coord = cmesh->Reference()->NodeVec()[gel->NodeIndex(t)].Coord(c);
55  node << coord << " ";
56  }
57  node << std::endl;
58 
59  actualNode++;
60  connectivity << " " << actualNode;
61  }
62  connectivity << std::endl;
63 
64  int elType = TPZVTKGeoMesh::GetVTK_ElType(gel);
65  type << elType << std::endl;
66 
67  if (matColor == true) {
68  material << gel->MaterialId() << std::endl;
69  } else {
70  material << elType << std::endl;
71  }
72  index << cel->Index() << std::endl;
73  referenceIndex << gel->Index() << std::endl;
74 
75  nVALIDelements++;
76  }
77  node << std::endl;
78  actualNode++;
79  file << actualNode << " float" << std::endl << node.str();
80 
81  file << "CELLS " << nVALIDelements << " ";
82 
83  file << size << std::endl;
84  file << connectivity.str() << std::endl;
85 
86  file << "CELL_TYPES " << nVALIDelements << std::endl;
87  file << type.str() << std::endl;
88 
89  file << "CELL_DATA " << " " << nVALIDelements << std::endl;
90  file << "FIELD FieldData 3 " << std::endl;
91  if (matColor == true) {
92  file << "material 1 " << nVALIDelements << " int " << std::endl;
93  } else {
94  file << "ElementType 1 " << nVALIDelements << " int " << std::endl;
95  }
96  file << material.str();
97 
98  file << "elIndex 1 " << nVALIDelements << " int" << std::endl;
99  file << index.str();
100 
101  file << "geoElIndex 1 " << nVALIDelements << " int" << std::endl;
102  file << referenceIndex.str();
103 
104  file.close();
105 }
106 
107 /*
108 * Generate an output of all geomesh to VTK
109 */
110 void TPZVTKGeoMesh::PrintCMeshVTK(TPZGeoMesh * gmesh, std::ofstream &file, bool matColor) {
111 
112  file.clear();
113  int64_t nelements = gmesh->NElements();
114 
115  std::stringstream node, connectivity, type, material, index, referenceIndex;
116 
117  //Header
118  file << "# vtk DataFile Version 3.0" << std::endl;
119  file << "TPZGeoMesh VTK Visualization" << std::endl;
120  file << "ASCII" << std::endl << std::endl;
121 
122  file << "DATASET UNSTRUCTURED_GRID" << std::endl;
123  file << "POINTS ";
124 
125  int64_t actualNode = -1, size = 0, nVALIDelements = 0;
126 
127  for (int64_t el = 0; el < nelements; el++) {
128  TPZGeoEl * gel = gmesh->ElementVec()[el];
129  if (gel == NULL || gel->Reference() == NULL) {
130  continue;
131  }
132  TPZCompEl *cel = gel->Reference();
133  MElementType elt = gel->Type();
134  int elNnodes = MElementType_NNodes(elt);
135 
136  size += (1 + elNnodes);
137  connectivity << elNnodes;
138 
139  for (int t = 0; t < elNnodes; t++) {
140  for (int c = 0; c < 3; c++) {
141  double coord = gmesh->NodeVec()[gel->NodeIndex(t)].Coord(c);
142  node << coord << " ";
143  }
144  node << std::endl;
145 
146  actualNode++;
147  connectivity << " " << actualNode;
148  }
149  connectivity << std::endl;
150 
151  int elType = TPZVTKGeoMesh::GetVTK_ElType(gel);
152  type << elType << std::endl;
153 
154  if (matColor == true) {
155  material << gel->MaterialId() << std::endl;
156  } else {
157  material << elType << std::endl;
158  }
159  index << cel->Index() << std::endl;
160  referenceIndex << gel->Index() << std::endl;
161 
162  nVALIDelements++;
163  }
164  node << std::endl;
165  actualNode++;
166  file << actualNode << " float" << std::endl << node.str();
167 
168  file << "CELLS " << nVALIDelements << " ";
169 
170  file << size << std::endl;
171  file << connectivity.str() << std::endl;
172 
173  file << "CELL_TYPES " << nVALIDelements << std::endl;
174  file << type.str() << std::endl;
175 
176  file << "CELL_DATA " << " " << nVALIDelements << std::endl;
177  file << "FIELD FieldData 3 " << std::endl;
178  if (matColor == true) {
179  file << "material 1 " << nVALIDelements << " int " << std::endl;
180  } else {
181  file << "ElementType 1 " << nVALIDelements << " int " << std::endl;
182  }
183  file << material.str();
184 
185  file << "elIndex 1 " << nVALIDelements << " int" << std::endl;
186  file << index.str();
187 
188  file << "geoElIndex 1 " << nVALIDelements << " int" << std::endl;
189  file << referenceIndex.str();
190 
191  file.close();
192 }
193 
197 void TPZVTKGeoMesh::PrintGMeshVTK(TPZGeoMesh * gmesh, std::ofstream &file, bool matColor) {
198  file.clear();
199  int64_t nelements = gmesh->NElements();
200  TPZGeoEl *gel;
201 
202  std::stringstream node, connectivity, type, material, index;
203 
204  //Header
205  file << "# vtk DataFile Version 3.0" << std::endl;
206  file << "TPZGeoMesh VTK Visualization" << std::endl;
207  file << "ASCII" << std::endl << std::endl;
208 
209  file << "DATASET UNSTRUCTURED_GRID" << std::endl;
210  file << "POINTS ";
211 
212  int64_t actualNode = -1, size = 0, nVALIDelements = 0;
213 
214  for (int64_t el = 0; el < nelements; el++) {
215  gel = gmesh->ElementVec()[el];
216  if (!gel)//|| (gel->Type() == EOned && !gel->IsLinearMapping()))//Exclude Arc3D and Ellipse3D
217  {
218  continue;
219  }
220  if (gel->HasSubElement()) {
221  continue;
222  }
223 
224  MElementType elt = gel->Type();
225  int elNnodes = MElementType_NNodes(elt);
226 
227  size += (1 + elNnodes);
228  connectivity << elNnodes;
229 
230  for (int t = 0; t < elNnodes; t++) {
231  for (int c = 0; c < 3; c++) {
232  double coord = gmesh->NodeVec()[gel->NodeIndex(t)].Coord(c);
233  node << coord << " ";
234  }
235  node << std::endl;
236 
237  actualNode++;
238  connectivity << " " << actualNode;
239  }
240  connectivity << std::endl;
241 
242  int elType = TPZVTKGeoMesh::GetVTK_ElType(gel);
243  type << elType << std::endl;
244 
245  if (matColor == true) {
246  material << gel->MaterialId() << std::endl;
247  }
248  index << gel->Index() << std::endl;
249  nVALIDelements++;
250  }
251  node << std::endl;
252  actualNode++;
253  file << actualNode << " float" << std::endl << node.str();
254 
255  file << "CELLS " << nVALIDelements << " ";
256 
257  file << size << std::endl;
258  file << connectivity.str() << std::endl;
259 
260  file << "CELL_TYPES " << nVALIDelements << std::endl;
261  file << type.str() << std::endl;
262 
263  file << "CELL_DATA" << " " << nVALIDelements << std::endl;
264  file << "FIELD FieldData " << (matColor ? "2" : "1") << std::endl;
265  if (matColor == true) {
266  file << "material 1 " << nVALIDelements << " int" << std::endl;
267  file << material.str();
268  }
269  file << "elIndex 1 " << nVALIDelements << " int" << std::endl;
270  file << index.str();
271 
272  file.close();
273 }
274 
275 
276 // Generate an output of all geomesh to VTK, associating to each one the given data
277 
278 void TPZVTKGeoMesh::PrintGMeshVTK(TPZGeoMesh * gmesh, std::ofstream &file, TPZVec<int> &elData) {
279  if (gmesh->NElements() != elData.NElements()) {
280  std::cout << "Wrong vector size of elements data!" << std::endl;
281  std::cout << "See " << __PRETTY_FUNCTION__ << std::endl;
282  }
283  file.clear();
284  int64_t nelements = gmesh->NElements();
285 
286  std::stringstream node, connectivity, type, material, index;
287 
288  //Header
289  file << "# vtk DataFile Version 3.0" << std::endl;
290  file << "TPZGeoMesh VTK Visualization" << std::endl;
291  file << "ASCII" << std::endl << std::endl;
292 
293  file << "DATASET UNSTRUCTURED_GRID" << std::endl;
294  file << "POINTS ";
295 
296  int64_t actualNode = -1, size = 0, nVALIDelements = 0;
297  TPZGeoEl *gel;
298 
299  for (int64_t el = 0; el < nelements; el++) {
300  gel = gmesh->ElementVec()[el];
301  if (!gel || (gel->Type() == EOned && !gel->IsLinearMapping()))//Exclude Arc3D and Ellipse3D
302  {
303  continue;
304  }
305  if (elData[el] == -999) {
306  continue;
307  }
308 
309  MElementType elt = gel->Type();
310  int elNnodes = MElementType_NNodes(elt);
311 
312  size += (1 + elNnodes);
313  connectivity << elNnodes;
314 
315  for (int t = 0; t < elNnodes; t++) {
316  for (int c = 0; c < 3; c++) {
317  double coord = gmesh->NodeVec()[gel->NodeIndex(t)].Coord(c);
318  node << coord << " ";
319  }
320  node << std::endl;
321 
322  actualNode++;
323  connectivity << " " << actualNode;
324  }
325  connectivity << std::endl;
326 
327  int elType = TPZVTKGeoMesh::GetVTK_ElType(gel);
328  type << elType << std::endl;
329 
330  material << elData[el] << std::endl;
331  index << gel->Index() << std::endl;
332 
333  nVALIDelements++;
334  }
335  node << std::endl;
336  actualNode++;
337  file << actualNode << " float" << std::endl << node.str();
338 
339  file << "CELLS " << nVALIDelements << " ";
340 
341  file << size << std::endl;
342  file << connectivity.str() << std::endl;
343 
344  file << "CELL_TYPES " << nVALIDelements << std::endl;
345  file << type.str() << std::endl;
346 
347  file << "CELL_DATA" << " " << nVALIDelements << std::endl;
348  file << "FIELD FieldData 2" << std::endl;
349 
350  file << "Substructure 1 " << nVALIDelements << " int" << std::endl;
351  file << material.str();
352 
353  file << "elIndex 1 " << nVALIDelements << " int" << std::endl;
354  file << index.str();
355 
356  file.close();
357 }
358 
359 
360 // Generate an output of all geomesh to VTK, associating to each one the given data
361 
362 void TPZVTKGeoMesh::PrintGMeshVTK(TPZGeoMesh * gmesh, std::ofstream &file, TPZVec<REAL> &elData) {
363  if (gmesh->NElements() != elData.NElements()) {
364  std::cout << "Wrong vector size of elements data!" << std::endl;
365  std::cout << "See " << __PRETTY_FUNCTION__ << std::endl;
366  }
367  file.clear();
368  int64_t nelements = gmesh->NElements();
369 
370  std::stringstream node, connectivity, type, material, index;
371 
372  //Header
373  file << "# vtk DataFile Version 3.0" << std::endl;
374  file << "TPZGeoMesh VTK Visualization" << std::endl;
375  file << "ASCII" << std::endl << std::endl;
376 
377  file << "DATASET UNSTRUCTURED_GRID" << std::endl;
378  file << "POINTS ";
379 
380  int64_t actualNode = -1, size = 0, nVALIDelements = 0;
381  TPZGeoEl *gel;
382 
383  for (int64_t el = 0; el < nelements; el++) {
384  gel = gmesh->ElementVec()[el];
385  if (!gel || (gel->Type() == EOned && !gel->IsLinearMapping()))//Exclude Arc3D and Ellipse3D
386  {
387  continue;
388  }
389  if (elData[el] == -999.) {
390  continue;
391  }
392 
393  MElementType elt = gel->Type();
394  int elNnodes = MElementType_NNodes(elt);
395 
396  size += (1 + elNnodes);
397  connectivity << elNnodes;
398 
399  for (int t = 0; t < elNnodes; t++) {
400  for (int c = 0; c < 3; c++) {
401  double coord = gmesh->NodeVec()[gel->NodeIndex(t)].Coord(c);
402  node << coord << " ";
403  }
404  node << std::endl;
405 
406  actualNode++;
407  connectivity << " " << actualNode;
408  }
409  connectivity << std::endl;
410 
411  int elType = TPZVTKGeoMesh::GetVTK_ElType(gel);
412  type << elType << std::endl;
413 
414  material << elData[el] << std::endl;
415 
416  index << gel->Index() << std::endl;
417 
418  nVALIDelements++;
419  }
420  node << std::endl;
421  actualNode++;
422  file << actualNode << " float" << std::endl << node.str();
423 
424  file << "CELLS " << nVALIDelements << " ";
425 
426  file << size << std::endl;
427  file << connectivity.str() << std::endl;
428 
429  file << "CELL_TYPES " << nVALIDelements << std::endl;
430  file << type.str() << std::endl;
431 
432  file << "CELL_DATA" << " " << nVALIDelements << std::endl;
433  file << "FIELD FieldData 2" << std::endl;
434 
435  file << "Substructure 1 " << nVALIDelements << " float" << std::endl;
436  file << material.str();
437 
438  file << "elIndex 1 " << nVALIDelements << " int" << std::endl;
439  file << index.str();
440 
441  file.close();
442 }
443 
445 void TPZVTKGeoMesh::PrintCMeshVTK(TPZCompMesh * cmesh, std::ofstream &file, TPZVec<REAL> &elData, std::string dataName) {
446  cmesh->LoadReferences();
447 
448  file.clear();
449  int64_t nelements = cmesh->NElements();
450 
451  std::stringstream node, connectivity, type, material, index, referenceIndex;
452 
453  //Header
454  file << "# vtk DataFile Version 3.0" << std::endl;
455  file << "TPZGeoMesh VTK Visualization" << std::endl;
456  file << "ASCII" << std::endl << std::endl;
457 
458  file << "DATASET UNSTRUCTURED_GRID" << std::endl;
459  file << "POINTS ";
460 
461  int64_t actualNode = -1, size = 0, nVALIDelements = 0;
462 
463  for (int64_t el = 0; el < nelements; el++) {
464  TPZCompEl * cel = cmesh->ElementVec()[el];
465  if (!cel || !cel->Reference()) {
466  continue;
467  }
468  TPZGeoEl * gel = cel->Reference();
469  if (!gel) continue;
470  if (!gel || (gel->Type() == EOned && !gel->IsLinearMapping()))//Exclude Arc3D and Ellipse3D
471  {
472  continue;
473  }
474  if (elData[el] == -999.) {
475  continue;
476  }
477 
478  MElementType elt = gel->Type();
479  int elNnodes = MElementType_NNodes(elt);
480 
481  size += (1 + elNnodes);
482  connectivity << elNnodes;
483 
484  for (int t = 0; t < elNnodes; t++) {
485  for (int c = 0; c < 3; c++) {
486  double coord = cmesh->Reference()->NodeVec()[gel->NodeIndex(t)].Coord(c);
487  node << coord << " ";
488  }
489  node << std::endl;
490 
491  actualNode++;
492  connectivity << " " << actualNode;
493  }
494  connectivity << std::endl;
495 
496  int elType = TPZVTKGeoMesh::GetVTK_ElType(gel);
497  type << elType << std::endl;
498 
499  material << elData[el] << std::endl;
500 
501  index << cel->Index() << std::endl;
502  referenceIndex << gel->Index() << std::endl;
503 
504  nVALIDelements++;
505  }
506  node << std::endl;
507  actualNode++;
508  file << actualNode << " float" << std::endl << node.str();
509 
510  file << "CELLS " << nVALIDelements << " ";
511 
512  file << size << std::endl;
513  file << connectivity.str() << std::endl;
514 
515  file << "CELL_TYPES " << nVALIDelements << std::endl;
516  file << type.str() << std::endl;
517 
518  file << "CELL_DATA" << " " << nVALIDelements << std::endl;
519  file << "FIELD FieldData 3" << std::endl;
520 
521  file << dataName << " 1 " << nVALIDelements << " float" << std::endl;
522 
523  file << material.str();
524 
525  file << "elIndex 1 " << nVALIDelements << " int" << std::endl;
526  file << index.str();
527 
528  file << "geoElIndex 1 " << nVALIDelements << " int" << std::endl;
529  file << referenceIndex.str();
530 
531  file.close();
532 }
533 
534 // Generate an output of all geomesh to VTK, associating to each one the given data, creates a file with filename given
535 
537  std::ofstream file(filename);
538 #ifdef PZDEBUG
539  if (!file.is_open())
540  DebugStop();
541 #endif
542 
543  if (gmesh->NElements() != elData.NElements()) {
544  std::cout << "Wrong vector size of elements data!" << std::endl;
545  std::cout << "See " << __PRETTY_FUNCTION__ << std::endl;
546  }
547  file.clear();
548  int64_t nelements = gmesh->NElements();
549 
550  std::stringstream connectivity, type, material, index;
551 
552  //Header
553  file << "# vtk DataFile Version 3.0" << std::endl;
554  file << "TPZGeoMesh VTK Visualization" << std::endl;
555  file << "ASCII" << std::endl << std::endl;
556 
557  file << "DATASET UNSTRUCTURED_GRID" << std::endl;
558  file << "POINTS ";
559 
560  int64_t t, c, el;
561  int64_t actualNode = -1, size = 0, nVALIDelements = 0;
562  int64_t counternodes = gmesh->NNodes();
563  TPZGeoEl *gel;
564 
565  for (el = 0; el < nelements; el++) {
566  gel = gmesh->ElementVec()[el];
567  if (!gel || (gel->Type() == EOned && !gel->IsLinearMapping()))//Exclude Arc3D and Ellipse3D
568  {
569  continue;
570  }
571  if (elData[el] == -999) {
572  continue;
573  }
574 
575  MElementType elt = gel->Type();
576  int elNnodes = MElementType_NNodes(elt);
577 
578  size += (1 + elNnodes);
579  connectivity << elNnodes;
580 
581  for (t = 0; t < elNnodes; t++) {
582  actualNode = gel->NodeIndex(t);
583  if (actualNode < 0)
584  DebugStop();
585 
586  connectivity << " " << actualNode;
587  }
588  connectivity << std::endl;
589 
590  int elType = TPZVTKGeoMesh::GetVTK_ElType(gel);
591  type << elType << std::endl;
592 
593  material << elData[el] << std::endl;
594 
595  index << gel->Index() << std::endl;
596 
597  nVALIDelements++;
598  }
599 
600  // Printing all nodes of the mesh
601  file << counternodes << " float" << std::endl;
602  for (t = 0; t < counternodes; t++) {
603  TPZGeoNode *node = &(gmesh->NodeVec()[t]);
604  for (c = 0; c < 3; c++) {
605  double coord = node->Coord(c);
606  file << coord << " ";
607  }
608  file << std::endl;
609  }
610 
611  file << std::endl << "CELLS " << nVALIDelements << " ";
612 
613  file << size << std::endl;
614  file << connectivity.str() << std::endl;
615 
616  file << "CELL_TYPES " << nVALIDelements << std::endl;
617  file << type.str() << std::endl;
618 
619  file << "CELL_DATA" << " " << nVALIDelements << std::endl;
620  file << "FIELD FieldData 2" << std::endl;
621 
622  file << "Substructure 1 " << nVALIDelements << " int" << std::endl;
623 
624  file << material.str();
625 
626  file << "elIndex 1 " << nVALIDelements << " int" << std::endl;
627  file << index.str();
628 
629  file.close();
630 }
631 
632 // Generate an output of all geomesh to VTK, associating to each one the given data, creates a file with filename given
633 
635  std::ofstream file(filename);
636 #ifdef PZDEBUG
637  if (!file.is_open())
638  DebugStop();
639 #endif
640 
641  if (gmesh->NElements() != elData.NElements()) {
642  std::cout << "Wrong vector size of elements data!" << std::endl;
643  std::cout << "See " << __PRETTY_FUNCTION__ << std::endl;
644  }
645  file.clear();
646  int64_t nelements = gmesh->NElements();
647 
648  std::stringstream connectivity, type, datael, index;
649 
650  //Header
651  file << "# vtk DataFile Version 3.0" << std::endl;
652  file << "TPZGeoMesh VTK Visualization" << std::endl;
653  file << "ASCII" << std::endl << std::endl;
654 
655  file << "DATASET UNSTRUCTURED_GRID" << std::endl;
656  file << "POINTS ";
657 
658  int64_t t, c, el;
659  int64_t actualNode = -1, size = 0, nVALIDelements = 0;
660  int64_t counternodes = gmesh->NNodes();
661  TPZGeoEl *gel;
662 
663  for (el = 0; el < nelements; el++) {
664  gel = gmesh->ElementVec()[el];
665  if (!gel || (gel->Type() == EOned && !gel->IsLinearMapping()))//Exclude Arc3D and Ellipse3D
666  {
667  continue;
668  }
669  if (elData[el] == -999) {
670  continue;
671  }
672 
673  MElementType elt = gel->Type();
674  int elNnodes = MElementType_NNodes(elt);
675 
676  size += (1 + elNnodes);
677  connectivity << elNnodes;
678 
679  for (t = 0; t < elNnodes; t++) {
680  actualNode = gel->NodeIndex(t);
681  if (actualNode < 0)
682  DebugStop();
683 
684  connectivity << " " << actualNode;
685  }
686  connectivity << std::endl;
687 
688  int elType = TPZVTKGeoMesh::GetVTK_ElType(gel);
689  type << elType << std::endl;
690 
691  datael << elData[el] << std::endl;
692  index << gel->Index() << std::endl;
693 
694  nVALIDelements++;
695  }
696 
697  // Printing all nodes of the mesh
698  file << counternodes << " float" << std::endl;
699  for (t = 0; t < counternodes; t++) {
700  TPZGeoNode *node = &(gmesh->NodeVec()[t]);
701  for (c = 0; c < 3; c++) {
702  double coord = node->Coord(c);
703  file << coord << " ";
704  }
705  file << std::endl;
706  }
707 
708  file << std::endl << "CELLS " << nVALIDelements << " ";
709 
710  file << size << std::endl;
711  file << connectivity.str() << std::endl;
712 
713  file << "CELL_TYPES " << nVALIDelements << std::endl;
714  file << type.str() << std::endl;
715 
716  file << "CELL_DATA" << " " << nVALIDelements << std::endl;
717  file << "FIELD FieldData 2" << std::endl;
718 
719  file << "Substructure 1 " << nVALIDelements << " float" << std::endl;
720  file << datael.str();
721 
722  file << "elIndex 1 " << nVALIDelements << " int" << std::endl;
723  file << index.str();
724 
725  file.close();
726 }
727 // Generate an output of all geomesh to VTK, associating to each one the given data, creates a file with filename given
728 
730  std::ofstream file(filename);
731 #ifdef PZDEBUG
732  if (!file.is_open())
733  DebugStop();
734 #endif
735 
736  if (gmesh->NElements() != elData.NElements()) {
737  std::cout << "Wrong vector size of elements data!" << std::endl;
738  std::cout << "See " << __PRETTY_FUNCTION__ << std::endl;
739  }
740  file.clear();
741  int64_t nelements = gmesh->NElements();
742  int64_t ndatas = elData[0].NElements();
743  if (!ndatas) {
744  file.close();
745  return;
746  }
747 
748  std::stringstream connectivity, type, index;
749  std::stringstream *datael = new std::stringstream[ndatas];
750 
751  //Header
752  file << "# vtk DataFile Version 3.0" << std::endl;
753  file << "TPZGeoMesh VTK Visualization" << std::endl;
754  file << "ASCII" << std::endl << std::endl;
755 
756  file << "DATASET UNSTRUCTURED_GRID" << std::endl;
757  file << "POINTS ";
758 
759  int64_t dat, t, c, el;
760  int64_t actualNode = -1, size = 0, nVALIDelements = 0;
761  int64_t counternodes = gmesh->NNodes();
762  TPZGeoEl *gel;
763 
764  for (el = 0; el < nelements; el++) {
765  gel = gmesh->ElementVec()[el];
766  if (!gel || (gel->Type() == EOned && !gel->IsLinearMapping()))//Exclude Arc3D and Ellipse3D
767  {
768  continue;
769  }
770  if (elData[el][0] < 0.) {
771  continue;
772  }
773 
774  MElementType elt = gel->Type();
775  int elNnodes = MElementType_NNodes(elt);
776 
777  size += (1 + elNnodes);
778  connectivity << elNnodes;
779 
780  for (t = 0; t < elNnodes; t++) {
781  actualNode = gel->NodeIndex(t);
782  if (actualNode < 0)
783  DebugStop();
784 
785  connectivity << " " << actualNode;
786  }
787  connectivity << std::endl;
788 
789  int elType = TPZVTKGeoMesh::GetVTK_ElType(gel);
790  type << elType << std::endl;
791  index << gel->Index() << std::endl;
792 
793  for (dat = 0; dat < ndatas; dat++)
794  *(datael + dat) << elData[el][dat] << std::endl;
795 
796  nVALIDelements++;
797  }
798 
799  // Printing all nodes of the mesh
800  file << counternodes << " float" << std::endl;
801  for (t = 0; t < counternodes; t++) {
802  TPZGeoNode *node = &(gmesh->NodeVec()[t]);
803  for (c = 0; c < 3; c++) {
804  double coord = node->Coord(c);
805  file << coord << " ";
806  }
807  file << std::endl;
808  }
809 
810  file << std::endl << "CELLS " << nVALIDelements << " ";
811 
812  file << size << std::endl;
813  file << connectivity.str() << std::endl;
814 
815  file << "CELL_TYPES " << nVALIDelements << std::endl;
816  file << type.str() << std::endl;
817 
818  file << "CELL_DATA" << " " << nVALIDelements << std::endl;
819  file << "FIELD FieldData " << ndatas + 1 << std::endl;
820 
821  for (dat = 0; dat < ndatas; dat++) {
822  file << "Substructure" << dat + 1 << " 1 " << nVALIDelements << " float" << std::endl;
823  file << datael[dat].str();
824  file << std::endl;
825  }
826 
827  file << "elIndex 1 " << nVALIDelements << " int" << std::endl;
828  file << index.str();
829 
830  if (datael)
831  delete[] datael;
832  file.close();
833 }
834 
835 // Generate an output of all geomesh to VTK, associating to each one the given data, creates a file with filename given
836 
837 void TPZVTKGeoMesh::PrintGMeshVTK(TPZGeoMesh * gmesh, const char *filename, int var) {
838  std::ofstream file(filename);
839 #ifdef PZDEBUG
840  if (!file.is_open())
841  DebugStop();
842 #endif
843 
844  file.clear();
845  int64_t nelements = gmesh->NElements();
846 
847  std::stringstream connectivity, type, material, index;
848 
849  //Header
850  file << "# vtk DataFile Version 3.0" << std::endl;
851  file << "TPZGeoMesh VTK Visualization" << std::endl;
852  file << "ASCII" << std::endl << std::endl;
853 
854  file << "DATASET UNSTRUCTURED_GRID" << std::endl;
855  file << "POINTS ";
856 
857  int64_t t, c, el;
858  int64_t actualNode = -1, size = 0, nVALIDelements = 0;
859  int64_t counternodes = gmesh->NNodes();
860  TPZGeoEl *gel;
861  TPZCompEl *cel;
862  TPZVec<REAL> qsi(3, 0.);
863  TPZVec<STATE> sol;
864 
865  for (el = 0; el < nelements; el++) {
866  gel = gmesh->ElementVec()[el];
867  // Print only to elements not refines (computational elements actives?)
868  // if(!gel || gel->HasSubElement())
869  // continue;
870  if (!gel) continue;
871  cel = gel->Reference();
872  // if(!cel) continue;
873  if (gel->HasSubElement()) {
874  continue;
875  }
876  if (gel->Type() == EOned && !gel->IsLinearMapping())//Exclude Arc3D and Ellipse3D
877  continue;
878 
879  int elNnodes = gel->NCornerNodes();
880  size += (1 + elNnodes);
881  connectivity << elNnodes;
882 
883  for (t = 0; t < elNnodes; t++) {
884  actualNode = gel->NodeIndex(t);
885  if (actualNode < 0)
886  DebugStop();
887 
888  connectivity << " " << actualNode;
889  }
890  connectivity << std::endl;
891 
892  int elType = TPZVTKGeoMesh::GetVTK_ElType(gel);
893  type << elType << std::endl;
894 
895  // calculando o valor da solucao para o elemento
896  // cel->Solution(qsi,var,sol);
897  // if(sol.NElements()) material << sol[0] << std::endl;
898  // else material << 0.0 << std::endl;
899  material << gel->MaterialId() << std::endl;
900 
901  index << gel->Index() << std::endl;
902 
903  nVALIDelements++;
904  }
905 
906  // Printing all nodes of the mesh
907  file << counternodes << " float" << std::endl;
908  for (t = 0; t < counternodes; t++) {
909  TPZGeoNode *node = &(gmesh->NodeVec()[t]);
910  for (c = 0; c < 3; c++) {
911  double coord = node->Coord(c);
912  file << coord << " ";
913  }
914  file << std::endl;
915  }
916 
917  file << std::endl << "CELLS " << nVALIDelements << " ";
918 
919  file << size << std::endl;
920  file << connectivity.str() << std::endl;
921 
922  file << "CELL_TYPES " << nVALIDelements << std::endl;
923  file << type.str() << std::endl;
924 
925  file << "CELL_DATA" << " " << nVALIDelements << std::endl;
926  file << "FIELD FieldData 2" << std::endl;
927 
928  file << "Substructure 1 " << nVALIDelements << " double" << std::endl;
929 
930  file << material.str();
931 
932  file << "elIndex 1 " << nVALIDelements << " int" << std::endl;
933  file << index.str();
934 
935  file.close();
936 }
937 
941 void TPZVTKGeoMesh::PrintGMeshVTKneighbour_material(TPZGeoMesh * gmesh, std::ofstream &file, int neighMaterial, bool matColor) {
942  file.clear();
943  int64_t nelements = gmesh->NElements();
944 
945  std::stringstream node, connectivity, type, material, index;
946 
947  //Header
948  file << "# vtk DataFile Version 3.0" << std::endl;
949  file << "TPZGeoMesh VTK Visualization" << std::endl;
950  file << "ASCII" << std::endl << std::endl;
951 
952  file << "DATASET UNSTRUCTURED_GRID" << std::endl;
953  file << "POINTS ";
954 
955  int64_t actualNode = -1, size = 0, nVALIDelements = 0;
956 
957  for (int64_t el = 0; el < nelements; el++) {
958  TPZGeoEl *gel = gmesh->ElementVec()[el];
959  if (gel->Type() == EOned && !gel->IsLinearMapping())//Exclude Arc3D and Ellipse3D
960  {
961  continue;
962  }
963  if (gel->HasSubElement()) {
964  continue;
965  }
966 
967  bool matFound = false;
968  for (int s = 0; s < gel->NSides(); s++) {
969  TPZGeoElSide thisSide(gmesh->ElementVec()[el], s);
970  TPZGeoElSide neighSide = thisSide.Neighbour();
971 
972  while (thisSide != neighSide) {
973  if (neighSide.Element()->MaterialId() == neighMaterial) {
974  matFound = true;
975  break;
976  }
977  neighSide = neighSide.Neighbour();
978  }
979  if (matFound) {
980  break;
981  }
982  }
983  if (!matFound) {
984  continue;
985  }
986 
987  MElementType elt = gel->Type();
988  int elNnodes = MElementType_NNodes(elt);
989 
990  size += (1 + elNnodes);
991  connectivity << elNnodes;
992 
993  for (int t = 0; t < elNnodes; t++) {
994  for (int c = 0; c < 3; c++) {
995  double coord = gmesh->NodeVec()[gel->NodeIndex(t)].Coord(c);
996  node << coord << " ";
997  }
998  node << std::endl;
999 
1000  actualNode++;
1001  connectivity << " " << actualNode;
1002  }
1003  connectivity << std::endl;
1004 
1005  int elType = TPZVTKGeoMesh::GetVTK_ElType(gmesh->ElementVec()[el]);
1006  type << elType << std::endl;
1007 
1008  if (matColor == true) {
1009  material << gel->MaterialId() << std::endl;
1010  } else {
1011  material << elType << std::endl;
1012  }
1013  index << gel->Index() << std::endl;
1014  nVALIDelements++;
1015  }
1016  node << std::endl;
1017  actualNode++;
1018  file << actualNode << " float" << std::endl << node.str();
1019 
1020  file << "CELLS " << nVALIDelements << " ";
1021 
1022  file << size << std::endl;
1023  file << connectivity.str() << std::endl;
1024 
1025  file << "CELL_TYPES " << nVALIDelements << std::endl;
1026  file << type.str();
1027 
1028  file << "CELL_DATA" << " " << nVALIDelements << std::endl;
1029  file << "FIELD FieldData 2" << std::endl;
1030  if (matColor == true) {
1031  file << "material 1 " << nVALIDelements << " int" << std::endl;
1032  } else {
1033  file << "ElementType 1 " << nVALIDelements << " int" << std::endl;
1034  }
1035  file << material.str();
1036 
1037  file << "elIndex 1 " << nVALIDelements << " int" << std::endl;
1038  file << index.str();
1039 
1040  file.close();
1041 }
1042 
1043 void TPZVTKGeoMesh::PrintGMeshVTKneighbourhood(TPZGeoMesh * gmesh, int64_t elIndex, std::ofstream &file) {
1044  int elMat = 999;
1045  int surrMat = 555;
1046  std::set<int> myMaterial;
1047  myMaterial.insert(elMat);
1048  myMaterial.insert(surrMat);
1049 
1050  TPZGeoMesh * gmeshCP = new TPZGeoMesh(*gmesh);
1051 
1052  TPZGeoEl * gel = gmeshCP->ElementVec()[elIndex];
1053  SetMaterialVTK(gel, elMat);
1054 
1055  int nsides = gel->NSides();
1056  for (int s = 0; s < nsides; s++) {
1057  TPZGeoElSide thisSide(gel, s);
1058  TPZGeoElSide neighSide = thisSide.Neighbour();
1059 
1060  while (thisSide != neighSide) {
1061  TPZGeoEl * neighEl = neighSide.Element();
1062  if (thisSide.IsAncestor(neighSide) == false) {
1063  SetMaterialVTK(neighEl, surrMat);
1064  }
1065  neighSide = neighSide.Neighbour();
1066  }
1067 
1068  }
1069  PrintGMeshVTKmy_material(gmeshCP, file, myMaterial, true);
1070 }
1071 
1072 void TPZVTKGeoMesh::PrintGMeshVTK(TPZGeoMesh * gmesh, std::set<int64_t> & elIndex, std::ofstream &file) {
1073  file.clear();
1074  int64_t nelements = gmesh->NElements();
1075 
1076  std::stringstream node, connectivity, type, material;
1077 
1078  //Header
1079  file << "# vtk DataFile Version 3.0" << std::endl;
1080  file << "TPZGeoMesh VTK Visualization" << std::endl;
1081  file << "ASCII" << std::endl << std::endl;
1082 
1083  file << "DATASET UNSTRUCTURED_GRID" << std::endl;
1084  file << "POINTS ";
1085 
1086  int64_t actualNode = -1, size = 0, nVALIDelements = 0;
1087 
1088  for (int64_t el = 0; el < nelements; el++) {
1089  if (elIndex.find(el) == elIndex.end()) {
1090  continue;
1091  }
1092  TPZGeoEl *gel = gmesh->ElementVec()[el];
1093  if (gel->Type() == EOned && !gel->IsLinearMapping())//Exclude Arc3D and Ellipse3D
1094  {
1095  continue;
1096  }
1097  if (gel->HasSubElement()) {
1098  continue;
1099  }
1100 
1101  MElementType elt = gel->Type();
1102  int elNnodes = MElementType_NNodes(elt);
1103 
1104  size += (1 + elNnodes);
1105  connectivity << elNnodes;
1106 
1107  for (int t = 0; t < elNnodes; t++) {
1108  for (int c = 0; c < 3; c++) {
1109  double coord = gmesh->NodeVec()[gel->NodeIndex(t)].Coord(c);
1110  node << coord << " ";
1111  }
1112  node << std::endl;
1113 
1114  actualNode++;
1115  connectivity << " " << actualNode;
1116  }
1117  connectivity << std::endl;
1118 
1119  int elType = TPZVTKGeoMesh::GetVTK_ElType(gmesh->ElementVec()[el]);
1120  type << elType << std::endl;
1121 
1122  material << el << std::endl;
1123 
1124  nVALIDelements++;
1125  }
1126  node << std::endl;
1127  actualNode++;
1128  file << actualNode << " float" << std::endl << node.str();
1129 
1130  file << "CELLS " << nVALIDelements << " ";
1131 
1132  file << size << std::endl;
1133  file << connectivity.str() << std::endl;
1134 
1135  file << "CELL_TYPES " << nVALIDelements << std::endl;
1136  file << type.str() << std::endl;
1137 
1138  file << "CELL_DATA" << " " << nVALIDelements << std::endl;
1139  file << "FIELD FieldData 1" << std::endl;
1140 
1141  file << "elIndex 1 " << nVALIDelements << " int" << std::endl;
1142 
1143  file << material.str();
1144 
1145  file.close();
1146 }
1147 
1149  gel->SetMaterialId(mat);
1150 
1151  int64_t nnodes = gel->NNodes();
1152  for (int64_t nd = 0; nd < nnodes; nd++) {
1153  TPZVec<REAL> NodeCoord(3);
1154  TPZVec<int64_t> Topol(1);
1155 
1156  int64_t elIndex = 0;
1157 
1158  Topol[0] = gel->NodeIndex(nd);
1159 
1160  gel->Mesh()->NodeVec()[gel->NodeIndex(nd)].GetCoordinates(NodeCoord);
1161  new TPZGeoElRefPattern< pzgeom::TPZGeoPoint > (elIndex, Topol, mat, *(gel->Mesh()));
1162  }
1163 
1164  if (gel->HasSubElement()) {
1165  int nSons = gel->NSubElements();
1166  for (int s = 0; s < nSons; s++) {
1167  TPZGeoEl * son = gel->SubElement(s);
1168  SetMaterialVTK(son, mat);
1169  }
1170  }
1171 }
1172 
1176 void TPZVTKGeoMesh::PrintGMeshVTKmy_material(TPZGeoMesh * gmesh, std::ofstream &file, std::set<int> myMaterial, bool matColor) {
1177  file.clear();
1178  int64_t nelements = gmesh->NElements();
1179 
1180  std::stringstream node, connectivity, type, material, index;
1181 
1182  //Header
1183  file << "# vtk DataFile Version 3.0" << std::endl;
1184  file << "TPZGeoMesh VTK Visualization" << std::endl;
1185  file << "ASCII" << std::endl << std::endl;
1186 
1187  file << "DATASET UNSTRUCTURED_GRID" << std::endl;
1188  file << "POINTS ";
1189 
1190  int64_t actualNode = -1, size = 0, nVALIDelements = 0;
1191 
1192  for (int64_t el = 0; el < nelements; el++) {
1193  TPZGeoEl *gel = gmesh->ElementVec()[el];
1194  if (!gel) {
1195  continue;
1196  }
1197  if (gel->Dimension() == 1)//Exclude Arc3D and Ellipse3D
1198  {
1199  continue;
1200  }
1201  int mat = gel->MaterialId();
1202  bool found = !(myMaterial.find(mat) == myMaterial.end());
1203  if (gel->HasSubElement() || !found) {
1204  continue;
1205  }
1206 
1207  MElementType elt = gel->Type();
1208  int elNnodes = MElementType_NNodes(elt);
1209 
1210  size += (1 + elNnodes);
1211  connectivity << elNnodes;
1212 
1213  for (int t = 0; t < elNnodes; t++) {
1214  for (int c = 0; c < 3; c++) {
1215  double coord = gmesh->NodeVec()[gel->NodeIndex(t)].Coord(c);
1216  node << coord << " ";
1217  }
1218  node << std::endl;
1219 
1220  actualNode++;
1221  connectivity << " " << actualNode;
1222  }
1223  connectivity << std::endl;
1224 
1225  int elType = TPZVTKGeoMesh::GetVTK_ElType(gmesh->ElementVec()[el]);
1226  type << elType << std::endl;
1227 
1228  if (matColor == true) {
1229  material << gel->MaterialId() << std::endl;
1230  } else {
1231  material << elType << std::endl;
1232  }
1233  index << gel->Index() << std::endl;
1234  nVALIDelements++;
1235  }
1236  node << std::endl;
1237  actualNode++;
1238  file << actualNode << " float" << std::endl << node.str();
1239 
1240  file << "CELLS " << nVALIDelements << " ";
1241 
1242  file << size << std::endl;
1243  file << connectivity.str() << std::endl;
1244 
1245  file << "CELL_TYPES " << nVALIDelements << std::endl;
1246  file << type.str();
1247 
1248  file << "CELL_DATA" << " " << nVALIDelements << std::endl;
1249  file << "FIELD FieldData 2" << std::endl;
1250  if (matColor == true) {
1251  file << "material 1 " << nVALIDelements << " int" << std::endl;
1252  } else {
1253  file << "ElementType 1 " << nVALIDelements << " int" << std::endl;
1254  }
1255  file << material.str();
1256 
1257  file << "elIndex 1 " << nVALIDelements << " int" << std::endl;
1258  file << index.str();
1259 
1260  file.close();
1261 }
1262 
1264  MElementType pzElType = gel->Type();
1265 
1266  int elType = -1;
1267  switch (pzElType) {
1268  case(EPoint):
1269  {
1270  elType = 1;
1271  break;
1272  }
1273  case(EOned):
1274  {
1275  elType = 3;
1276  break;
1277  }
1278  case (ETriangle):
1279  {
1280  elType = 5;
1281  break;
1282  }
1283  case (EQuadrilateral):
1284  {
1285  elType = 9;
1286  break;
1287  }
1288  case (ETetraedro):
1289  {
1290  elType = 10;
1291  break;
1292  }
1293  case (EPiramide):
1294  {
1295  elType = 14;
1296  break;
1297  }
1298  case (EPrisma):
1299  {
1300  elType = 13;
1301  break;
1302  }
1303  case (ECube):
1304  {
1305  elType = 12;
1306  break;
1307  }
1308  default:
1309  {
1310  std::cout << "Element type not found on " << __PRETTY_FUNCTION__ << std::endl;
1311  DebugStop();
1312  break;
1313  }
1314  }
1315  if (elType == -1) {
1316  std::cout << "Element type not found on " << __PRETTY_FUNCTION__ << std::endl;
1317  std::cout << "MIGHT BE CURVED ELEMENT (quadratic or quarter point)" << std::endl;
1318  DebugStop();
1319  }
1320 
1321  return elType;
1322 }
1323 
1325 void TPZVTKGeoMesh::PrintPOrderPoints(TPZCompMesh &cmesh, std::set<int> dimensions, std::ofstream &file) {
1326  //Header
1327  file << "# vtk DataFile Version 3.0" << std::endl;
1328  file << "TPZGeoMesh VTK Visualization" << std::endl;
1329  file << "ASCII" << std::endl << std::endl;
1330 
1331  file << "DATASET UNSTRUCTURED_GRID" << std::endl;
1332  file << "POINTS ";
1333  std::stringstream points;
1334  int64_t numpoints = 0;
1335  std::stringstream celldata;
1336  std::stringstream fielddata;
1337  int pointtype = 1;
1338  int64_t nel = cmesh.NElements();
1339  for (int64_t iel = 0; iel < nel; iel++) {
1340  TPZCompEl *cel = cmesh.ElementVec()[iel];
1341  if (!cel) {
1342  continue;
1343  }
1344  TPZInterpolatedElement *intel = dynamic_cast<TPZInterpolatedElement *> (cel);
1345  if (!intel) {
1346  continue;
1347  }
1348  TPZGeoEl *gel = intel->Reference();
1349  int nsides = gel->NSides();
1350  for (int side = 0; side < nsides; side++) {
1351  if (intel->NSideConnects(side) == 0) {
1352  continue;
1353  }
1354  int sidedim = gel->SideDimension(side);
1355  if (dimensions.find(sidedim) == dimensions.end()) {
1356  continue;
1357  }
1358 
1359  TPZManVector<REAL, 4> coord(3, 0.), xi(gel->Dimension(), 0.);
1360  gel->CenterPoint(side, xi);
1361  gel->X(xi, coord);
1362  points << coord << std::endl;
1363  celldata << "1 " << numpoints << std::endl;
1364  numpoints++;
1365  TPZConnect &c = intel->MidSideConnect(side);
1366  int corder = c.Order();
1367  fielddata << corder << std::endl;
1368 
1369  }
1370  }
1371  file << numpoints << " float" << std::endl << points.str();
1372 
1373  file << "CELLS " << numpoints << " ";
1374 
1375  file << 2 * numpoints << std::endl;
1376  file << celldata.str() << std::endl;
1377 
1378  file << "CELL_TYPES " << numpoints << std::endl;
1379  for (int64_t i = 0; i < numpoints; i++) {
1380  file << pointtype << std::endl;
1381  }
1382 
1383  file << "CELL_DATA" << " " << numpoints << std::endl;
1384  file << "FIELD FieldData 1" << std::endl;
1385  file << "porder 1 " << numpoints << " int" << std::endl;
1386  file << fielddata.str();
1387  file << std::endl;
1388 
1389  file.close();
1390 
1391 }
int64_t NElements() const
Number of computational elements allocated.
Definition: pzcmesh.h:169
TPZGeoMesh * Reference() const
Returns a pointer to the geometrical mesh associated.
Definition: pzcmesh.h:209
filename
Definition: stats.py:82
Represents a set of shape functions associated with a computational element/side. Computational Eleme...
Definition: pzconnect.h:30
Implements a vector class which allows to use external storage provided by the user. Utility.
Definition: pzquad.h:16
int MaterialId() const
Returns the material index of the element.
Definition: pzgeoel.h:250
static void PrintGMeshVTKmy_material(TPZGeoMesh *gmesh, std::ofstream &file, std::set< int > myMaterial, bool matColor=true)
Based on a given geomesh, just the elements that have the given material id will be exported to an VT...
REAL Coord(int i) const
Returns i-th coordinate of the current node.
Definition: pzgnode.h:99
virtual int NCornerNodes() const =0
Returns the number of corner nodes of the element.
int64_t NElements() const
Number of elements of the mesh.
Definition: pzgmesh.h:129
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
Definition: pzgeoelside.h:83
int64_t NElements() const
Access method to query the number of elements of the vector.
TPZGeoElSide Neighbour() const
Definition: pzgeoel.h:754
TPZGeoMesh * Mesh() const
Returns the mesh to which the element belongs.
Definition: pzgeoel.h:220
virtual int NSides() const =0
Returns the number of connectivities of the element.
virtual int64_t NodeIndex(int i) const =0
Returns the index of the ith node the index is the location of the node in the nodevector of the mesh...
virtual int SideDimension(int side) const =0
Return the dimension of side.
void LoadReferences()
Map this grid in the geometric grid.
Definition: pzcmesh.cpp:482
virtual void CenterPoint(int side, TPZVec< REAL > &masscent) const =0
It returns the coordinates from the center of the side of the element in the element coordinate space...
virtual TPZGeoEl * SubElement(int is) const =0
Returns a pointer to the subelement is.
unsigned char Order() const
Access function to return the order associated with the connect.
Definition: pzconnect.h:217
static void PrintPOrderPoints(TPZCompMesh &cmesh, std::set< int > dimensions, std::ofstream &outfile)
Implements a generic geometric element which is refined according to a generic refinement pattern...
Definition: pzgmesh.h:35
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
static void PrintCMeshVTK(TPZCompMesh *cmesh, std::ofstream &file, bool matColor=true)
Generate an output of all geometric elements that have a computational counterpart to VTK...
int64_t Index() const
Returns the index of the element within the element vector of the mesh.
Definition: pzgeoel.h:730
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
int64_t NNodes() const
Number of nodes of the mesh.
Definition: pzgmesh.h:126
virtual TPZConnect & MidSideConnect(int is) const
Returns a reference to the connect in the middle of the side.
Definition: pzintel.cpp:94
int MElementType_NNodes(MElementType elType)
constant which defines the type of HDiv approximation space
Definition: pzeltype.h:80
virtual MElementType Type() const =0
Returns the element type acording to pzeltype.h.
TPZAdmChunkVector< TPZGeoNode > & NodeVec()
Definition: pzgmesh.h:140
TPZCompEl * Reference() const
Return a pointer to the element referenced by the geometric element.
Definition: pzgeoel.h:750
Contains declaration of TPZGeoElRefPattern class which implements a generic geometric element which i...
int64_t Index() const
Returns element index of the mesh fELementVec list.
Definition: pzcompel.h:821
static void PrintGMeshVTK(TPZGeoMesh *gmesh, std::ofstream &file, bool matColor=true)
Default constructor for graphical mesh with VTK format.
Contains declaration of TPZCompMesh class which is a repository for computational elements...
Contains the TPZGeoPoint class which implements the geometry of a point element or 0-D element...
virtual int HasSubElement() const =0
Return 1 if the element has subelements.
virtual int NNodes() const =0
Returns the number of nodes of the element.
virtual bool IsLinearMapping() const
Definition: pzgeoel.h:268
TPZGeoEl * Element() const
Definition: pzgeoelside.h:162
virtual int Dimension() const =0
Returns the dimension of the element.
static void PrintGMeshVTKneighbourhood(TPZGeoMesh *gmesh, int64_t elIndex, std::ofstream &file)
Print the elements that surround a givel geoel.
TPZGeoEl * Reference() const
Return a pointer to the corresponding geometric element if such exists, return 0 otherwise.
Definition: pzcompel.cpp:1137
static void PrintGMeshVTKneighbour_material(TPZGeoMesh *gmesh, std::ofstream &file, int neighMaterial, bool matColor=false)
Based on a given geomesh, just the elements that have an neighbour with a given material id will be e...
Implements a geometric node in the pz environment. Geometry.
Definition: pzgnode.h:31
virtual void X(TPZVec< REAL > &qsi, TPZVec< REAL > &result) const =0
Return the coordinate in real space of the point coordinate in the master element space...
virtual int NSideConnects(int iside) const override=0
Returns the number of dof nodes along side iside.
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
MElementType
Define the element types.
Definition: pzeltype.h:52
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
bool IsAncestor(TPZGeoElSide other)
Checks whether other is an ancestor of this.
Definition: pzgeoelside.cpp:95
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
Definition: pzcmesh.h:183
Definition: pzeltype.h:61
Contains declaration of TPZInterpolatedElement class which implements computational element of the in...
void SetMaterialId(int id)
Sets the material index of the element.
Definition: pzgeoel.h:395
static void SetMaterialVTK(TPZGeoEl *gel, int mat)
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
Definition: pzeltype.h:55
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
Contains the TPZVTKGeoMesh class which implements the graphical mesh to VTK environment to geometric ...
virtual int NSubElements() const =0
Returns the number of subelements of the element independent of the fact whether the element has alr...
Implements computational element based on an interpolation space. Computational Element.
Definition: pzintel.h:27
static int GetVTK_ElType(TPZGeoEl *gel)
Get type of the geometric element.
TPZAdmChunkVector< TPZGeoEl * > & ElementVec()
Methods for handling pzlists.
Definition: pzgmesh.h:138