Skip to content

Commit cbb6bc4

Browse files
committed
Modifications due to rebase on main
1 parent 1f71ea0 commit cbb6bc4

File tree

1 file changed

+33
-52
lines changed

1 file changed

+33
-52
lines changed

src/Core/Mesh/ExportBlocksCGNSImplementation.cpp

Lines changed: 33 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "Mesh/ExportBlocksCGNSImplementation.h"
1010
#include "Mesh/MeshItf.h"
1111
#include "Mesh/Surface.h"
12+
#include "Group/GroupManager.h"
1213
/*----------------------------------------------------------------------------*/
1314
#include <gmds/ig/Mesh.h>
1415
#include <gmds/io/IGMeshIOService.h>
@@ -39,11 +40,6 @@ namespace Mgx3D {
3940
/*----------------------------------------------------------------------------*/
4041
void ExportBlocksCGNSImplementation::perform3D()
4142
{
42-
std::vector<Topo::Vertex*> topo_vertices;
43-
std::vector<Topo::Block*> topo_blocs;
44-
std::vector<Topo::CoFace*> topo_faces;
45-
46-
4743
gmds::Mesh mesh(gmds::MeshModel(gmds::DIM3 | gmds::N | gmds::F | gmds::R |
4844
gmds::R2N | gmds::N2R | gmds::R2F | gmds::F2R | gmds::F2N | gmds::N2F));
4945

@@ -58,10 +54,10 @@ namespace Mgx3D {
5854
std::vector<Topo::CoFace*> topo_faces = m_context.getTopoManager().getCoFacesObj();
5955
std::map<std::string, int> topoF_2_gmdsF;
6056
for (auto cf : topo_faces) {
61-
int n0 = cf->getVertex(0)->getNode();
62-
int n1 = cf->getVertex(1)->getNode();
63-
int n2 = cf->getVertex(2)->getNode();
64-
int n3 = cf->getVertex(3)->getNode();
57+
int n0 = cf->getVertices()[0]->getNode();
58+
int n1 = cf->getVertices()[1]->getNode();
59+
int n2 = cf->getVertices()[2]->getNode();
60+
int n3 = cf->getVertices()[3]->getNode();
6561

6662
gmds::Face f = mesh.newQuad(n0,n1,n2,n3);
6763

@@ -100,16 +96,16 @@ namespace Mgx3D {
10096
gmds::Region r = mesh.newHex(ids[0],ids[1],ids[2],ids[3],
10197
ids[4],ids[5],ids[6],ids[7]);
10298

103-
if(topo_blocs[iBlock]->getNbCoFaces() != 6 ){
99+
if(topo_blocs[iBlock]->getCoFaces().size() != 6 ){
104100
throw TkUtil::Exception(TkUtil::UTF8String ("Le bloc "+topo_blocs[iBlock]->getName()+" n'est pas conforme.", TkUtil::Charset::UTF_8));
105101
}
106102

107-
int iface0 = topoF_2_gmdsF[block->getFace(vertices[0],vertices[1],vertices[2],vertices[3])->getCoFace(0)->getName()];
108-
int iface1 = topoF_2_gmdsF[block->getFace(vertices[0],vertices[1],vertices[5],vertices[4])->getCoFace(0)->getName()];
109-
int iface2 = topoF_2_gmdsF[block->getFace(vertices[1],vertices[2],vertices[6],vertices[5])->getCoFace(0)->getName()];
110-
int iface3 = topoF_2_gmdsF[block->getFace(vertices[2],vertices[3],vertices[7],vertices[6])->getCoFace(0)->getName()];
111-
int iface4 = topoF_2_gmdsF[block->getFace(vertices[3],vertices[0],vertices[4],vertices[7])->getCoFace(0)->getName()];
112-
int iface5 = topoF_2_gmdsF[block->getFace(vertices[4],vertices[5],vertices[6],vertices[7])->getCoFace(0)->getName()];
103+
int iface0 = topoF_2_gmdsF[block->getFace(vertices[0],vertices[1],vertices[2],vertices[3])->getCoFaces()[0]->getName()];
104+
int iface1 = topoF_2_gmdsF[block->getFace(vertices[0],vertices[1],vertices[5],vertices[4])->getCoFaces()[0]->getName()];
105+
int iface2 = topoF_2_gmdsF[block->getFace(vertices[1],vertices[2],vertices[6],vertices[5])->getCoFaces()[0]->getName()];
106+
int iface3 = topoF_2_gmdsF[block->getFace(vertices[2],vertices[3],vertices[7],vertices[6])->getCoFaces()[0]->getName()];
107+
int iface4 = topoF_2_gmdsF[block->getFace(vertices[3],vertices[0],vertices[4],vertices[7])->getCoFaces()[0]->getName()];
108+
int iface5 = topoF_2_gmdsF[block->getFace(vertices[4],vertices[5],vertices[6],vertices[7])->getCoFaces()[0]->getName()];
113109

114110
r.add<gmds::Face>(iface0);
115111
r.add<gmds::Face>(iface1);
@@ -169,9 +165,7 @@ namespace Mgx3D {
169165
//gmds::Variable<int>* sym = mesh.newVariable<int, gmds::GMDS_NODE>("Symetrie");
170166

171167

172-
std::vector<Group::GroupEntity*> groups2D;
173-
getStdContext()->getGroupManager().getGroups(groups2D, Internal::SelectionManager::DIM::D2);
174-
168+
std::vector<Group::GroupEntity*> groups2D = getStdContext()->getGroupManager().getGroups(Internal::SelectionManager::DIM::D2);
175169
std::vector<std::string> groupsname;
176170
for(auto g : groups2D){
177171
std::string name = g->getName();
@@ -226,8 +220,7 @@ namespace Mgx3D {
226220
//gmds::Variable<int>* fluide = mesh.newVariable<int>(gmds::GMDS_NODE,"Fluide"); //Valeur par défaut
227221
//gmds::Variable<int>* solide = mesh.newVariable<int, gmds::GMDS_NODE>("Solide");
228222

229-
std::vector<Group::GroupEntity*> groups3D;
230-
getStdContext()->getGroupManager().getGroups(groups3D, Internal::SelectionManager::DIM::D3);
223+
std::vector<Group::GroupEntity*> groups3D = getStdContext()->getGroupManager().getGroups(Internal::SelectionManager::DIM::D3);
231224

232225
groupsname.clear();
233226
for(auto g : groups3D){
@@ -263,11 +256,6 @@ namespace Mgx3D {
263256
/*----------------------------------------------------------------------------*/
264257
void ExportBlocksCGNSImplementation::perform2D()
265258
{
266-
std::vector<Topo::Vertex*> topo_vertices;
267-
std::vector<Topo::CoFace*> topo_faces;
268-
std::vector<Topo::CoEdge*> topo_edges;
269-
270-
271259
gmds::Mesh mesh(gmds::MeshModel(gmds::DIM2 | gmds::N | gmds::E | gmds::F |
272260
gmds::F2N | gmds::N2F | gmds::F2E | gmds::E2F | gmds::E2N | gmds::N2E));
273261

@@ -279,50 +267,47 @@ namespace Mgx3D {
279267
gmds::Node n = mesh.newNode(n_local.X(),n_local.Y(),n_local.Z());
280268
}
281269

282-
m_context.getTopoManager().getCoFaces(topo_faces);
283-
m_context.getTopoManager().getCoEdges(topo_edges);
284-
285270
std::map<std::string, int> topoE_2_gmdsE;
286-
271+
const std::vector<Topo::CoEdge*>& topo_edges = m_context.getTopoManager().getCoEdgesObj();
287272
for (auto ce : topo_edges) {
288-
int n0 = ce->getVertex(0)->getNode();
289-
int n1 = ce->getVertex(1)->getNode();
273+
int n0 = ce->getVertices()[0]->getNode();
274+
int n1 = ce->getVertices()[1]->getNode();
290275

291276
gmds::Edge e = mesh.newEdge(n0,n1);
292277

293278
topoE_2_gmdsE[ce->getName()] = e.id();
294279
}
295280

296281
std::map<std::string, int> topoF_2_gmdsF;
297-
282+
const std::vector<Topo::CoFace*>& topo_faces = m_context.getTopoManager().getCoFacesObj();
298283
for(int iFace = 0; iFace < topo_faces.size(); iFace++){
299284
Topo::CoFace* face = topo_faces[iFace];
300285
std::vector<unsigned long> ids;
301286
std::vector<Topo::Vertex*> vertices;
302287
vertices.resize(4);
303288

304-
vertices[0] = face->getVertex(0);
305-
vertices[1] = face->getVertex(1);
306-
vertices[2] = face->getVertex(2);
307-
vertices[3] = face->getVertex(3);
289+
vertices[0] = face->getVertices()[0];
290+
vertices[1] = face->getVertices()[1];
291+
vertices[2] = face->getVertices()[2];
292+
vertices[3] = face->getVertices()[3];
308293

309294

310-
ids.push_back(topo_faces[iFace]->getVertex(0)->getNode());
311-
ids.push_back(topo_faces[iFace]->getVertex(1)->getNode());
312-
ids.push_back(topo_faces[iFace]->getVertex(2)->getNode());
313-
ids.push_back(topo_faces[iFace]->getVertex(3)->getNode());
295+
ids.push_back(topo_faces[iFace]->getVertices()[0]->getNode());
296+
ids.push_back(topo_faces[iFace]->getVertices()[1]->getNode());
297+
ids.push_back(topo_faces[iFace]->getVertices()[2]->getNode());
298+
ids.push_back(topo_faces[iFace]->getVertices()[3]->getNode());
314299

315300

316301
gmds::Face f = mesh.newQuad(ids[0],ids[1],ids[2],ids[3]);
317302

318-
if(topo_faces[iFace]->getNbEdges()!= 4 ){
303+
if(topo_faces[iFace]->getEdges().size()!= 4 ){
319304
throw TkUtil::Exception(TkUtil::UTF8String ("La face "+topo_faces[iFace]->getName()+" n'est pas conforme.", TkUtil::Charset::UTF_8));
320305
}
321306

322-
int iedge0 = topoE_2_gmdsE[face->getEdge(vertices[0],vertices[1])->getCoEdge(0)->getName()];
323-
int iedge1 = topoE_2_gmdsE[face->getEdge(vertices[1],vertices[2])->getCoEdge(0)->getName()];
324-
int iedge2 = topoE_2_gmdsE[face->getEdge(vertices[2],vertices[3])->getCoEdge(0)->getName()];
325-
int iedge3 = topoE_2_gmdsE[face->getEdge(vertices[3],vertices[0])->getCoEdge(0)->getName()];
307+
int iedge0 = topoE_2_gmdsE[face->getEdge(vertices[0],vertices[1])->getCoEdges()[0]->getName()];
308+
int iedge1 = topoE_2_gmdsE[face->getEdge(vertices[1],vertices[2])->getCoEdges()[0]->getName()];
309+
int iedge2 = topoE_2_gmdsE[face->getEdge(vertices[2],vertices[3])->getCoEdges()[0]->getName()];
310+
int iedge3 = topoE_2_gmdsE[face->getEdge(vertices[3],vertices[0])->getCoEdges()[0]->getName()];
326311

327312
f.add<gmds::Edge>(iedge0);
328313
f.add<gmds::Edge>(iedge1);
@@ -362,9 +347,7 @@ namespace Mgx3D {
362347
}
363348
}
364349

365-
std::vector<Group::GroupEntity*> groups1D;
366-
getStdContext()->getGroupManager().getGroups(groups1D, Internal::SelectionManager::DIM::D1);
367-
350+
std::vector<Group::GroupEntity*> groups1D = getStdContext()->getGroupManager().getGroups(Internal::SelectionManager::DIM::D1);
368351
std::vector<std::string> groupsname;
369352
for(auto g : groups1D){
370353
std::string name = g->getName();
@@ -388,9 +371,7 @@ namespace Mgx3D {
388371
}
389372
}
390373

391-
std::vector<Group::GroupEntity*> groups2D;
392-
getStdContext()->getGroupManager().getGroups(groups2D, Internal::SelectionManager::DIM::D2);
393-
374+
std::vector<Group::GroupEntity*> groups2D = getStdContext()->getGroupManager().getGroups(Internal::SelectionManager::DIM::D2);
394375
groupsname.clear();
395376
for(auto g : groups2D){
396377
std::string name = g->getName();

0 commit comments

Comments
 (0)