18 (dim == 3) ?
"PhysicalVolume" :
19 (dim == 2) ?
"PhysicalSurface" :
24 for(std::size_t i = 0; i < name.size(); i++)
25 if(name[i] ==
' ') name[i] =
'_';
32 FILE *fp =
Fopen(name.c_str(),
"w");
34 Msg::Error(
"Unable to open file '%s'", name.c_str());
39 if(ndime != 2 && ndime != 3) {
40 Msg::Error(
"SU2 mesh output valid only for 2D or 3D models (not %dD)",
48 fprintf(fp,
"NDIME= %d\n", ndime);
55 if(saveAll || (*it)->physicals.size())
56 nelem += (*it)->getNumMeshElements();
60 if(saveAll || (*it)->physicals.size())
61 nelem += (*it)->getNumMeshElements();
65 Msg::Info(
"Writing %d elements and %d nodes", nelem, npoin);
68 fprintf(fp,
"NELEM= %d\n", nelem);
72 if(saveAll || (*it)->physicals.size())
73 for(std::size_t i = 0; i < (*it)->getNumMeshElements(); i++)
74 (*it)->getMeshElement(i)->writeSU2(fp, num++);
78 if(saveAll || (*it)->physicals.size())
79 for(std::size_t i = 0; i < (*it)->getNumMeshElements(); i++)
80 (*it)->getMeshElement(i)->writeSU2(fp, num++);
84 fprintf(fp,
"NPOIN= %d\n", npoin);
85 std::vector<GEntity *> entities;
87 for(std::size_t i = 0; i < entities.size(); i++)
88 for(std::size_t j = 0; j < entities[i]->mesh_vertices.size(); j++)
89 entities[i]->mesh_vertices[j]->
writeSU2(fp, ndime, scalingFactor);
92 std::map<int, std::vector<GEntity *> > groups[4];
94 int nmark = groups[ndime - 1].size() + groups[ndime].size();
96 fprintf(fp,
"NMARK= %d\n", nmark);
97 for(
int dim = ndime-1; dim <= ndime; dim++) {
98 if(groups[dim].size()) {
99 for(
auto it = groups[dim].begin(); it != groups[dim].end(); it++) {
100 std::vector<GEntity *> &entities = it->second;
102 for(std::size_t i = 0; i < entities.size(); i++)
105 fprintf(fp,
"MARKER_TAG= %s\n",
physicalName(
this, dim, it->first).c_str());
106 fprintf(fp,
"MARKER_ELEMS= %d\n", n);
107 for(std::size_t i = 0; i < entities.size(); i++)
108 for(std::size_t j = 0; j < entities[i]->getNumMeshElements(); j++)
109 entities[i]->getMeshElement(j)->writeSU2(fp, -1);