Skip to content

Commit 6e47c85

Browse files
committed
cgns fixes
1 parent 7e4cd5a commit 6e47c85

File tree

5 files changed

+10
-23
lines changed

5 files changed

+10
-23
lines changed

apf/apfMesh.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ class Mesh
396396
GlobalNumbering* findGlobalNumbering(const char* name);
397397

398398
GlobalNumbering* getGlobalNumbering(int i);
399-
/** \brief get the global pcu */
399+
/** \brief get the mesh pcu */
400400
pcu::PCU* getPCU() const {return pcu_;}
401401
void switchPCU(pcu::PCU *newPCU);
402402
/** \brief true if any associated fields use array storage */

mds/apfMDS.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
// AJP: alternative is to allow common cgns base header
3737
// but trying to avoid that since it's not core functionality
3838
#include <apf.h>
39+
#include <PCU_C.h>
40+
3941
//
4042
namespace pcu{
4143
class PCU;
@@ -54,8 +56,6 @@ class Field;
5456

5557
/** \brief a map from global ids to vertex objects */
5658
typedef std::map<long, MeshEntity*> GlobalToVert;
57-
typedef struct PCU_t PCU_t;
58-
5959

6060
/** \brief create an empty MDS part
6161
\param model the geometric model interface
@@ -204,12 +204,10 @@ int getMdsIndex(Mesh2* in, MeshEntity* e);
204204
so call apf::reorderMdsMesh after any mesh modification. */
205205
MeshEntity* getMdsEntity(Mesh2* in, int dimension, int index);
206206

207-
Mesh2* loadMdsFromCGNS(gmi_model* g, const char* filename, CGNSBCMap& cgnsBCMap);
208-
Mesh2* loadMdsFromCGNS2(PCU_t h, gmi_model* g, const char* filename, CGNSBCMap& cgnsBCMap);
207+
Mesh2* loadMdsFromCGNS(PCU_t h, gmi_model* g, const char* filename, CGNSBCMap& cgnsBCMap);
209208

210209
// names of mesh data to read from file: (VERTEX, VelocityX; CellCentre, Pressure)
211-
Mesh2* loadMdsFromCGNS(gmi_model* g, const char* filename, CGNSBCMap& cgnsBCMap, const std::vector<std::pair<std::string, std::string>>& meshData);
212-
Mesh2* loadMdsFromCGNS2(PCU_t h, gmi_model* g, const char* filename, CGNSBCMap& cgnsBCMap, const std::vector<std::pair<std::string, std::string>>& meshData);
210+
Mesh2* loadMdsFromCGNS(PCU_t h, gmi_model* g, const char* filename, CGNSBCMap& cgnsBCMap, const std::vector<std::pair<std::string, std::string>>& meshData);
213211

214212

215213
int gmshMajorVersion(const char* filename);

mds/mdsCGNS.cc

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ void Kill(PCU_t h, const int fid, Args &&... args)
231231
{
232232
cgp_close(fid);
233233
// Finalize the MPI environment.
234-
PCU_Comm_Free(h);
234+
PCU_Comm_Free(&h);
235235
MPI_Finalize();
236236
cgp_error_exit();
237237
exit(EXIT_FAILURE);
@@ -252,7 +252,7 @@ void Kill(PCU_t h, const int fid)
252252
{
253253
cgp_close(fid);
254254
// Finalize the MPI environment.
255-
PCU_Comm_Free(h);
255+
PCU_Comm_Free(&h);
256256
MPI_Finalize();
257257
cgp_error_exit();
258258
exit(EXIT_FAILURE);
@@ -1286,7 +1286,7 @@ apf::Mesh2 *DoIt(PCU_t h, gmi_model *g, const std::string &fname, apf::CGNSBCMap
12861286
};
12871287

12881288
// process meshData and find vectors (and matrices)
1289-
const auto findMatch = [&meshData, &index, &cgid](MeshData &other, std::vector<MeshDataGroup> &meshDataGroups) {
1289+
const auto findMatch = [&meshData, &index, &cgid, &h](MeshData &other, std::vector<MeshDataGroup> &meshDataGroups) {
12901290
MeshDataGroup group;
12911291
for (auto &md : meshData)
12921292
{
@@ -1723,12 +1723,6 @@ namespace apf
17231723
{
17241724

17251725
// caller needs to bring up and pull down mpi/pcu: mpi/pcu is required and assumed.
1726-
Mesh2 *loadMdsFromCGNS(gmi_model *g, const char *fname, apf::CGNSBCMap &cgnsBCMap, const std::vector<std::pair<std::string, std::string>> &meshData)
1727-
{
1728-
PCU_t h = PCU_Get_Global_Handle();
1729-
return loadMdsFromCGNS(h, g, fname, cgnsBCMap, meshData);
1730-
}
1731-
17321726
Mesh2 *loadMdsFromCGNS(PCU_t h, gmi_model *g, const char *fname, apf::CGNSBCMap &cgnsBCMap, const std::vector<std::pair<std::string, std::string>> &meshData)
17331727
{
17341728
#ifdef HAVE_CGNS
@@ -1744,12 +1738,6 @@ Mesh2 *loadMdsFromCGNS(PCU_t h, gmi_model *g, const char *fname, apf::CGNSBCMap
17441738
}
17451739

17461740
// caller needs to bring up and pull down mpi/pcu: mpi/pcu is required and assumed.
1747-
Mesh2 *loadMdsFromCGNS(gmi_model *g, const char *fname, apf::CGNSBCMap &cgnsBCMap)
1748-
{
1749-
PCU_t h = PCU_Get_Global_Handle();
1750-
return loadMdsFromCGNS(h, g, fname, cgnsBCMap);
1751-
}
1752-
17531741
Mesh2 *loadMdsFromCGNS(PCU_t h, gmi_model *g, const char *fname, apf::CGNSBCMap &cgnsBCMap)
17541742
{
17551743
#ifdef HAVE_CGNS

pcu/pkg_tribits.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ set(HEADERS
5454
pcu_util.h
5555
reel/reel.h
5656
pcu_defines.h
57+
PCU.h
5758
)
5859
tribits_add_library(
5960
pcu

test/cgns.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ std::string doit(apf::CGNSBCMap &cgnsBCMap, const std::string &argv1, const std:
179179
gmi_model *g = gmi_load(".null");
180180
PCU_t h;
181181
h.ptr = static_cast<void*>(PCUObj);
182-
apf::Mesh2 *m = apf::loadMdsFromCGNS2(h, g, argv1.c_str(), cgnsBCMap, meshData);
182+
apf::Mesh2 *m = apf::loadMdsFromCGNS(h, g, argv1.c_str(), cgnsBCMap, meshData);
183183
m->verify();
184184
//
185185
m->writeNative(argv2.c_str());

0 commit comments

Comments
 (0)