Skip to content

Commit b8d38b2

Browse files
committed
reduce boilerplate
1 parent ee2e00d commit b8d38b2

17 files changed

Lines changed: 68 additions & 98 deletions

Common/include/fem/fem_cgns_elements.hpp

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ class CBoundaryFace;
4545

4646
/*!
4747
* \class CCGNSElementType
48-
* \brief Class which stores the CGNS element type info for a connectivity
49-
section.
50-
* \version 7.2.0 "Blackbird"
48+
* \brief Class which stores the CGNS element type info for a connectivity section.
5149
*/
5250

5351
class CCGNSElementType {
@@ -59,7 +57,7 @@ class CCGNSElementType {
5957
cgsize_t indEnd; /*!< \brief Index of the last element in the CGNS connectivity. */
6058
cgsize_t nElem; /*!< \brief Number of elements present for this element type. */
6159

62-
string connName; /*!< \brief Name of this connectivity. */
60+
std::string connName; /*!< \brief Name of this connectivity. */
6361

6462
bool volumeConn; /*!< \brief Whether or not this is a volume connectivity. */
6563
bool surfaceConn; /*!< \brief Whether or not this is a surface connectivity. */
@@ -85,7 +83,7 @@ class CCGNSElementType {
8583
const unsigned long nBoundElemRank,
8684
const unsigned long startingBoundElemIDRank,
8785
unsigned long &locBoundElemCount,
88-
vector<CBoundaryFace> &boundElems);
86+
std::vector<CBoundaryFace> &boundElems);
8987

9088
/*--- Member function, which reads the required connectivity range. ---*/
9189
void ReadConnectivityRange(const int fn,
@@ -104,7 +102,7 @@ class CCGNSElementType {
104102
unsigned short &VTK_Type,
105103
unsigned short &nPoly,
106104
unsigned short &nDOFs,
107-
vector<unsigned short> &SU2ToCGNS);
105+
std::vector<unsigned short> &SU2ToCGNS);
108106

109107
/*--- Member function, which determines the element dimension, i.e. the
110108
number of parametric coordinates. ---*/
@@ -122,158 +120,158 @@ class CCGNSElementType {
122120
given element in the stored types. If not present, a new index
123121
is created. ---*/
124122
unsigned short IndexInStoredTypes(const ElementType_t typeElem,
125-
vector<ElementType_t> &CGNS_Type,
126-
vector<unsigned short> &VTK_Type,
127-
vector<unsigned short> &nPoly,
128-
vector<unsigned short> &nDOFs,
129-
vector<vector<unsigned short> > &SU2ToCGNS);
123+
std::vector<ElementType_t> &CGNS_Type,
124+
std::vector<unsigned short> &VTK_Type,
125+
std::vector<unsigned short> &nPoly,
126+
std::vector<unsigned short> &nDOFs,
127+
std::vector<std::vector<unsigned short> > &SU2ToCGNS);
130128

131129
/*--- Functions to create the conversion data from CGNS format to SU2 format
132130
for all the supported CGNS elements. ---*/
133131
void CreateDataNODE(unsigned short &VTK_Type,
134132
unsigned short &nPoly,
135133
unsigned short &nDOFs,
136-
vector<unsigned short> &SU2ToCGNS);
134+
std::vector<unsigned short> &SU2ToCGNS);
137135

138136
void CreateDataBAR_2(unsigned short &VTK_Type,
139137
unsigned short &nPoly,
140138
unsigned short &nDOFs,
141-
vector<unsigned short> &SU2ToCGNS);
139+
std::vector<unsigned short> &SU2ToCGNS);
142140

143141
void CreateDataBAR_3(unsigned short &VTK_Type,
144142
unsigned short &nPoly,
145143
unsigned short &nDOFs,
146-
vector<unsigned short> &SU2ToCGNS);
144+
std::vector<unsigned short> &SU2ToCGNS);
147145

148146
void CreateDataBAR_4(unsigned short &VTK_Type,
149147
unsigned short &nPoly,
150148
unsigned short &nDOFs,
151-
vector<unsigned short> &SU2ToCGNS);
149+
std::vector<unsigned short> &SU2ToCGNS);
152150

153151
void CreateDataBAR_5(unsigned short &VTK_Type,
154152
unsigned short &nPoly,
155153
unsigned short &nDOFs,
156-
vector<unsigned short> &SU2ToCGNS);
154+
std::vector<unsigned short> &SU2ToCGNS);
157155

158156
void CreateDataTRI_3(unsigned short &VTK_Type,
159157
unsigned short &nPoly,
160158
unsigned short &nDOFs,
161-
vector<unsigned short> &SU2ToCGNS);
159+
std::vector<unsigned short> &SU2ToCGNS);
162160

163161
void CreateDataTRI_6(unsigned short &VTK_Type,
164162
unsigned short &nPoly,
165163
unsigned short &nDOFs,
166-
vector<unsigned short> &SU2ToCGNS);
164+
std::vector<unsigned short> &SU2ToCGNS);
167165

168166
void CreateDataTRI_10(unsigned short &VTK_Type,
169167
unsigned short &nPoly,
170168
unsigned short &nDOFs,
171-
vector<unsigned short> &SU2ToCGNS);
169+
std::vector<unsigned short> &SU2ToCGNS);
172170

173171
void CreateDataTRI_15(unsigned short &VTK_Type,
174172
unsigned short &nPoly,
175173
unsigned short &nDOFs,
176-
vector<unsigned short> &SU2ToCGNS);
174+
std::vector<unsigned short> &SU2ToCGNS);
177175

178176
void CreateDataQUAD_4(unsigned short &VTK_Type,
179177
unsigned short &nPoly,
180178
unsigned short &nDOFs,
181-
vector<unsigned short> &SU2ToCGNS);
179+
std::vector<unsigned short> &SU2ToCGNS);
182180

183181
void CreateDataQUAD_9(unsigned short &VTK_Type,
184182
unsigned short &nPoly,
185183
unsigned short &nDOFs,
186-
vector<unsigned short> &SU2ToCGNS);
184+
std::vector<unsigned short> &SU2ToCGNS);
187185

188186
void CreateDataQUAD_16(unsigned short &VTK_Type,
189187
unsigned short &nPoly,
190188
unsigned short &nDOFs,
191-
vector<unsigned short> &SU2ToCGNS);
189+
std::vector<unsigned short> &SU2ToCGNS);
192190

193191
void CreateDataQUAD_25(unsigned short &VTK_Type,
194192
unsigned short &nPoly,
195193
unsigned short &nDOFs,
196-
vector<unsigned short> &SU2ToCGNS);
194+
std::vector<unsigned short> &SU2ToCGNS);
197195

198196
void CreateDataTETRA_4(unsigned short &VTK_Type,
199197
unsigned short &nPoly,
200198
unsigned short &nDOFs,
201-
vector<unsigned short> &SU2ToCGNS);
199+
std::vector<unsigned short> &SU2ToCGNS);
202200

203201
void CreateDataTETRA_10(unsigned short &VTK_Type,
204202
unsigned short &nPoly,
205203
unsigned short &nDOFs,
206-
vector<unsigned short> &SU2ToCGNS);
204+
std::vector<unsigned short> &SU2ToCGNS);
207205

208206
void CreateDataTETRA_20(unsigned short &VTK_Type,
209207
unsigned short &nPoly,
210208
unsigned short &nDOFs,
211-
vector<unsigned short> &SU2ToCGNS);
209+
std::vector<unsigned short> &SU2ToCGNS);
212210

213211
void CreateDataTETRA_35(unsigned short &VTK_Type,
214212
unsigned short &nPoly,
215213
unsigned short &nDOFs,
216-
vector<unsigned short> &SU2ToCGNS);
214+
std::vector<unsigned short> &SU2ToCGNS);
217215

218216
void CreateDataPYRA_5(unsigned short &VTK_Type,
219217
unsigned short &nPoly,
220218
unsigned short &nDOFs,
221-
vector<unsigned short> &SU2ToCGNS);
219+
std::vector<unsigned short> &SU2ToCGNS);
222220

223221
void CreateDataPYRA_14(unsigned short &VTK_Type,
224222
unsigned short &nPoly,
225223
unsigned short &nDOFs,
226-
vector<unsigned short> &SU2ToCGNS);
224+
std::vector<unsigned short> &SU2ToCGNS);
227225

228226
void CreateDataPYRA_30(unsigned short &VTK_Type,
229227
unsigned short &nPoly,
230228
unsigned short &nDOFs,
231-
vector<unsigned short> &SU2ToCGNS);
229+
std::vector<unsigned short> &SU2ToCGNS);
232230

233231
void CreateDataPYRA_55(unsigned short &VTK_Type,
234232
unsigned short &nPoly,
235233
unsigned short &nDOFs,
236-
vector<unsigned short> &SU2ToCGNS);
234+
std::vector<unsigned short> &SU2ToCGNS);
237235

238236
void CreateDataPENTA_6(unsigned short &VTK_Type,
239237
unsigned short &nPoly,
240238
unsigned short &nDOFs,
241-
vector<unsigned short> &SU2ToCGNS);
239+
std::vector<unsigned short> &SU2ToCGNS);
242240

243241
void CreateDataPENTA_18(unsigned short &VTK_Type,
244242
unsigned short &nPoly,
245243
unsigned short &nDOFs,
246-
vector<unsigned short> &SU2ToCGNS);
244+
std::vector<unsigned short> &SU2ToCGNS);
247245

248246
void CreateDataPENTA_40(unsigned short &VTK_Type,
249247
unsigned short &nPoly,
250248
unsigned short &nDOFs,
251-
vector<unsigned short> &SU2ToCGNS);
249+
std::vector<unsigned short> &SU2ToCGNS);
252250

253251
void CreateDataPENTA_75(unsigned short &VTK_Type,
254252
unsigned short &nPoly,
255253
unsigned short &nDOFs,
256-
vector<unsigned short> &SU2ToCGNS);
254+
std::vector<unsigned short> &SU2ToCGNS);
257255

258256
void CreateDataHEXA_8(unsigned short &VTK_Type,
259257
unsigned short &nPoly,
260258
unsigned short &nDOFs,
261-
vector<unsigned short> &SU2ToCGNS);
259+
std::vector<unsigned short> &SU2ToCGNS);
262260

263261
void CreateDataHEXA_27(unsigned short &VTK_Type,
264262
unsigned short &nPoly,
265263
unsigned short &nDOFs,
266-
vector<unsigned short> &SU2ToCGNS);
264+
std::vector<unsigned short> &SU2ToCGNS);
267265

268266
void CreateDataHEXA_64(unsigned short &VTK_Type,
269267
unsigned short &nPoly,
270268
unsigned short &nDOFs,
271-
vector<unsigned short> &SU2ToCGNS);
269+
std::vector<unsigned short> &SU2ToCGNS);
272270

273271
void CreateDataHEXA_125(unsigned short &VTK_Type,
274272
unsigned short &nPoly,
275273
unsigned short &nDOFs,
276-
vector<unsigned short> &SU2ToCGNS);
274+
std::vector<unsigned short> &SU2ToCGNS);
277275
};
278276
#endif
279277
#endif

Common/include/geometry/primal_grid/CLine.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
* See CPrimalGridWithConnectivity.
3636
*/
3737
struct CLineConnectivity {
38-
static constexpr unsigned short nNodes = N_POINTS_LINE;
39-
static constexpr unsigned short nFaces = N_FACES_LINE;
38+
enum { nNodes = N_POINTS_LINE };
39+
enum { nFaces = N_FACES_LINE };
40+
enum { maxNodesFace = N_POINTS_LINE };
41+
enum { VTK_Type = LINE };
4042
static constexpr unsigned short nNodesFace[1]={2};
41-
static constexpr unsigned short maxNodesFace = 2;
4243
static constexpr unsigned short Faces[1][2]={{0,1}};
4344
static constexpr unsigned short nNeighbor_Nodes[2]={1,1};
4445
static constexpr unsigned short Neighbor_Nodes[2][1]={{1},{0}};
45-
static constexpr unsigned short VTK_Type = 3;
4646
};
4747

4848
/*!

Common/include/geometry/primal_grid/CPrimalGrid.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include <limits>
3535
#include <memory>
3636

37-
#include "../../parallelization/mpi_structure.hpp"
3837
#include "../../option_structure.hpp"
3938

4039
/*!

Common/include/geometry/primal_grid/CPrism.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
* See CPrimalGridWithConnectivity.
3636
*/
3737
struct CPrismConnectivity {
38-
static constexpr unsigned short nNodes = N_POINTS_PRISM;
39-
static constexpr unsigned short nFaces = N_FACES_PRISM;
38+
enum { nNodes = N_POINTS_PRISM };
39+
enum { nFaces = N_FACES_PRISM };
40+
enum { maxNodesFace = N_POINTS_QUADRILATERAL };
41+
enum { VTK_Type = PRISM };
4042
static constexpr unsigned short nNodesFace[5] = {4,4,4,3,3};
41-
static constexpr unsigned short maxNodesFace = 4;
4243
static constexpr unsigned short Faces[5][4] = {{3,4,1,0},{5,2,1,4},{2,5,3,0},{0,1,2,2},{5,4,3,3}};
4344
static constexpr unsigned short nNeighbor_Nodes[6] = {3,3,3,3,3,3};
4445
static constexpr unsigned short Neighbor_Nodes[6][3] = {{1,2,3},{0,2,4},{1,0,5},{0,4,5},{3,5,1},{4,3,2}};
45-
static constexpr unsigned short VTK_Type = 13;
4646
};
4747

4848
/*!

Common/include/geometry/primal_grid/CPyramid.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
* See CPrimalGridWithConnectivity.
3636
*/
3737
struct CPyramidConnectivity {
38-
static constexpr unsigned short nNodes = N_POINTS_PYRAMID;
39-
static constexpr unsigned short nFaces = N_FACES_PYRAMID;
38+
enum { nNodes = N_POINTS_PYRAMID };
39+
enum { nFaces = N_FACES_PYRAMID };
40+
enum { maxNodesFace = N_POINTS_QUADRILATERAL };
41+
enum { VTK_Type = PYRAMID };
4042
static constexpr unsigned short nNodesFace[5] = {4,3,3,3,3};
41-
static constexpr unsigned short maxNodesFace = 4;
4243
static constexpr unsigned short Faces[5][4] = {{0,3,2,1},{4,3,0,0},{4,0,1,1},{2,4,1,1},{3,4,2,2}};
4344
static constexpr unsigned short nNeighbor_Nodes[5] = {3,3,3,3,4};
4445
static constexpr unsigned short Neighbor_Nodes[5][4] = {{1,3,4,4},{0,2,4,4},{1,3,4,4},{2,0,4,4},{0,1,2,3}};
45-
static constexpr unsigned short VTK_Type = 14;
4646
};
4747

4848
/*!

Common/include/geometry/primal_grid/CQuadrilateral.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
* See CPrimalGridWithConnectivity.
3636
*/
3737
struct CQuadrilateralConnectivity {
38-
static constexpr unsigned short nNodes = N_POINTS_QUADRILATERAL;
39-
static constexpr unsigned short nFaces = N_FACES_QUADRILATERAL;
38+
enum { nNodes = N_POINTS_QUADRILATERAL };
39+
enum { nFaces = N_FACES_QUADRILATERAL };
40+
enum { maxNodesFace = N_POINTS_LINE };
41+
enum { VTK_Type = QUADRILATERAL };
4042
static constexpr unsigned short nNodesFace[4] = {2,2,2,2};
41-
static constexpr unsigned short maxNodesFace = 2;
4243
static constexpr unsigned short Faces[4][2] = {{0,1},{1,2},{2,3},{3,0}};
4344
static constexpr unsigned short nNeighbor_Nodes[4] = {2,2,2,2};
4445
static constexpr unsigned short Neighbor_Nodes[4][2] = {{1,3},{2,0},{3,1},{0,2}};
45-
static constexpr unsigned short VTK_Type = 9;
4646
};
4747

4848
/*!

Common/include/geometry/primal_grid/CTetrahedron.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
* See CPrimalGridWithConnectivity.
3636
*/
3737
struct CTetrahedronConnectivity {
38-
static constexpr unsigned short nNodes = N_POINTS_TETRAHEDRON;
39-
static constexpr unsigned short nFaces = N_FACES_TETRAHEDRON;
38+
enum { nNodes = N_POINTS_TETRAHEDRON };
39+
enum { nFaces = N_FACES_TETRAHEDRON };
40+
enum { maxNodesFace = N_POINTS_TRIANGLE };
41+
enum { VTK_Type = TETRAHEDRON };
4042
static constexpr unsigned short nNodesFace[4]={3,3,3,3};
41-
static constexpr unsigned short maxNodesFace = 3;
4243
static constexpr unsigned short Faces[4][3]={{0,2,1},{0,1,3},{0,3,2},{1,2,3}};
4344
static constexpr unsigned short nNeighbor_Nodes[4]={3,3,3,3};
4445
static constexpr unsigned short Neighbor_Nodes[4][3]={{1,2,3},{0,2,3},{0,1,3},{0,1,2}};
45-
static constexpr unsigned short VTK_Type = 10;
4646
};
4747

4848
/*!

Common/include/geometry/primal_grid/CTriangle.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
* See CPrimalGridWithConnectivity.
3636
*/
3737
struct CTriangleConnectivity {
38-
static constexpr unsigned short nNodes = N_FACES_TRIANGLE;
39-
static constexpr unsigned short nFaces = N_POINTS_TRIANGLE;
38+
enum { nNodes = N_FACES_TRIANGLE };
39+
enum { nFaces = N_POINTS_TRIANGLE };
40+
enum { maxNodesFace = N_POINTS_LINE };
41+
enum { VTK_Type = TRIANGLE };
4042
static constexpr unsigned short nNodesFace[3] = {2,2,2};
41-
static constexpr unsigned short maxNodesFace = 2;
4243
static constexpr unsigned short Faces[3][2] = {{0,1},{1,2},{2,0}};
4344
static constexpr unsigned short nNeighbor_Nodes[3] = {2,2,2};
4445
static constexpr unsigned short Neighbor_Nodes[3][2] = {{1,2},{2,0},{0,1}};
45-
static constexpr unsigned short VTK_Type = 5;
4646
};
4747

4848
/*!

Common/include/geometry/primal_grid/CVertexMPI.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
struct CVertexMPIConnectivity {
3838
// some of the index directions (e.g. Faces) would actually have 0 elements,
3939
// but we cannot declare arrays of length 0
40-
static constexpr unsigned short nNodes = 1;
41-
static constexpr unsigned short nFaces = 0;
40+
enum { nNodes = 1 };
41+
enum { nFaces = 0 };
42+
enum { maxNodesFace = 0 };
43+
enum { VTK_Type = VERTEX };
4244
static constexpr unsigned short nNodesFace[1] = {0};
43-
static constexpr unsigned short maxNodesFace = 0;
4445
static constexpr unsigned short Faces[1][1] = {{0}};
4546
static constexpr unsigned short nNeighbor_Nodes[1] = {0};
4647
static constexpr unsigned short Neighbor_Nodes[1][1] = {{0}};
47-
static constexpr unsigned short VTK_Type = 1;
4848
};
4949

5050
/*!

Common/src/fem/fem_cgns_elements.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
#include <climits>
3535
#include <algorithm>
3636

37+
using namespace std;
38+
3739
#if CGNS_VERSION >= 3300
3840

3941
void CCGNSElementType::DetermineMetaData(const unsigned short nDim,

0 commit comments

Comments
 (0)