Skip to content

Commit b33d4f0

Browse files
committed
cgns: handle when cgns is built with or without scoping (CGNS_ENABLE_SCOPING)
1 parent ab8c5a8 commit b33d4f0

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

modules/aero/src/CGNSWriter3D.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ using namespace gmds;
1414
/*----------------------------------------------------------------------------*/
1515
using namespace aero;
1616

17-
#define Structured CG_Structured
18-
#define RealDouble CG_RealDouble
19-
#define BCTypeUserDefined CG_BCTypeUserDefined
20-
#define PointRange CG_PointRange
21-
#define Unstructured CG_Unstructured
22-
#define TRI_3 CG_TRI_3
17+
// this handles CGNS built without CGNS_ENABLE_SCOPING
18+
#if CG_BUILD_SCOPE == 0
19+
# define CG_Structured Structured
20+
# define CG_RealDouble RealDouble
21+
# define CG_BCTypeUserDefined BCTypeUserDefined
22+
# define CG_PointRange PointRange
23+
# define CG_Unstructured Unstructured
24+
# define CG_TRI_3 TRI_3
25+
#endif
2326
/*----------------------------------------------------------------------------*/
2427
CGNSWriter3D::CGNSWriter3D(Blocking3D *ABlocking)
2528
:m_blocks(ABlocking),m_mesh(nullptr)
@@ -106,7 +109,7 @@ void CGNSWriter3D::writeZones()
106109
// Ici on va remplir les infos sur le nombre de sommets, mailles etc du bloc
107110
cgsize_t zone_size[9] = {discrI, discrJ, discrK, discrI - 1, discrJ - 1, discrK - 1,0,0,0};
108111

109-
cg_zone_write(m_indexFile, m_indexBase, zonename, zone_size, Structured, &m_indexZone);
112+
cg_zone_write(m_indexFile, m_indexBase, zonename, zone_size, CG_Structured, &m_indexZone);
110113

111114
int size = discrI * discrJ * discrK;
112115
auto x_coords = new double[size];
@@ -133,9 +136,9 @@ void CGNSWriter3D::writeZones()
133136
char coord_nameZ[32];
134137
strcpy(coord_nameZ, "CoordinateZ");
135138

136-
cg_coord_write(m_indexFile, m_indexBase, m_indexZone, RealDouble, coord_nameX, x_coords, &index_coord);
137-
cg_coord_write(m_indexFile, m_indexBase, m_indexZone, RealDouble, coord_nameY, y_coords, &index_coord);
138-
cg_coord_write(m_indexFile, m_indexBase, m_indexZone, RealDouble, coord_nameZ, z_coords, &index_coord);
139+
cg_coord_write(m_indexFile, m_indexBase, m_indexZone, CG_RealDouble, coord_nameX, x_coords, &index_coord);
140+
cg_coord_write(m_indexFile, m_indexBase, m_indexZone, CG_RealDouble, coord_nameY, y_coords, &index_coord);
141+
cg_coord_write(m_indexFile, m_indexBase, m_indexZone, CG_RealDouble, coord_nameZ, z_coords, &index_coord);
139142

140143

141144
//Writing Boundary Condition
@@ -597,7 +600,7 @@ void CGNSWriter3D::writeBoundaryCondition(int &num_bc, cgsize_t* pts, int id_zon
597600
std::string bctype_s = bctype_ss.str();
598601
strcpy(bc_name,bctype_s.c_str());
599602

600-
if(cg_boco_write(m_indexFile,m_indexBase,id_zone,bc_name,BCTypeUserDefined,PointRange,2,pts,&num_bc)
603+
if(cg_boco_write(m_indexFile,m_indexBase,id_zone,bc_name,CG_BCTypeUserDefined,CG_PointRange,2,pts,&num_bc)
601604
!= CG_OK) {
602605
std::cout<<cg_get_error()<<std::endl;
603606
}
@@ -681,4 +684,4 @@ void CGNSWriter3D::_getIndicesIdAndVal(const int* ipnts1, const int* ipnts2, boo
681684
return;
682685
}
683686
}
684-
}
687+
}

0 commit comments

Comments
 (0)