Skip to content

Parallel Cgns reader/writer #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 72 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
a03c45f
I think (?) this is a typo and should be pm-> not the apf mesh m->
a-jp Oct 9, 2019
2fe2ed0
ignore vscode settings.json file
a-jp Oct 9, 2019
d90f613
cgns reading, working, but still have problems converting the apf mes…
a-jp Oct 9, 2019
90dbe79
api should take model
a-jp Oct 15, 2019
dbea6c2
cleaner testing plus bug fix and api changes
a-jp Oct 15, 2019
a90d29c
changes to tests for bcs testing
a-jp Oct 15, 2019
5c75493
more work on testing bcs
a-jp Oct 16, 2019
634af4e
be consistent with meshes repo
a-jp Oct 16, 2019
23c1313
fixes to bc tag gen
a-jp Oct 16, 2019
7d106e1
drop to c++14 from c++17 as I suspect I'll not get away with it...
a-jp Oct 17, 2019
cc4c3d2
don't use c++17 features
a-jp Oct 17, 2019
9e06849
ensure ptrs are null initialised
a-jp Oct 17, 2019
894dc7a
fix bugs when cgns is not enabled
a-jp Oct 17, 2019
a3578f6
append release/debug on output files to ensure both compile modes don…
a-jp Oct 17, 2019
3379f97
expose cgns bc map to user and require this be passed in
a-jp Oct 17, 2019
b99dc98
require cgnsBCMap to be passed around
a-jp Oct 17, 2019
f650acd
tag vertices, edges, faces, cells with a field named by the user defi…
a-jp Oct 17, 2019
bea636e
include additional bcs test
a-jp Oct 17, 2019
66168b1
write lower dimensional data
a-jp Oct 17, 2019
116da26
be consistent: use Mesh2 not Mesh
a-jp Oct 18, 2019
4ee59de
better cleanup
a-jp Oct 18, 2019
9988d17
seems to cause memory leak
a-jp Oct 18, 2019
5dd96c5
protect build from cgns
a-jp Oct 21, 2019
ea7fe9e
more build flags
a-jp Oct 21, 2019
ce77904
write out lower dimension entities for 2D and 1D
a-jp Oct 21, 2019
6a5ca5d
initial cgns writer in parallel
a-jp Oct 21, 2019
c397933
remove unused function and needless test
a-jp Oct 21, 2019
3c5f4a6
notes
a-jp Oct 22, 2019
85d5914
more work on writer plus take map
a-jp Oct 22, 2019
4efc204
bug fixes to map insertion
a-jp Oct 22, 2019
f439a8f
flip bc marker in CgnsBCMap to an integer tag from a double field, as…
a-jp Oct 22, 2019
fc6e4d9
remove penta6 as apf does not support that cell type
a-jp Oct 23, 2019
085097b
comment out field conversion to tag, is only there for debugging
a-jp Oct 25, 2019
166143e
don't modify user given bc names, restart will be wrong if so
a-jp Oct 25, 2019
c120d22
write out boundary conditions
a-jp Oct 25, 2019
28bb563
starting the writing of tags and fields
a-jp Oct 30, 2019
15ff455
reduce name length to stick within cgns defined 32 char limit
a-jp Nov 4, 2019
536be4b
mainly debug output
a-jp Nov 4, 2019
514057a
bug fixes
a-jp Nov 4, 2019
46b1c36
append debug to field and tag names
a-jp Nov 15, 2019
5465bae
write todo to screen as work should feature as part of regression test
a-jp Nov 15, 2019
d58e358
write tags and fields for vertices and cells to main base in mesh
a-jp Nov 15, 2019
cea0c84
initial edge and face mesh and tags and fields
a-jp Nov 19, 2019
62d25e8
unused args
a-jp Nov 19, 2019
a3acff6
add some dummy vectors and write them out
a-jp Nov 19, 2019
05a7865
bugs
a-jp Nov 20, 2019
e71a5fb
move test vector/scalar
a-jp Nov 20, 2019
c683a7c
if compiling cgns and omega_h bump c++ version to 2014
a-jp Nov 20, 2019
7ff6be5
allow reader to open files with more than one base, only base one is …
a-jp Nov 20, 2019
c72a353
increase regression testing by reading cgns file just written
a-jp Nov 20, 2019
ff54530
fix volume boco bug
a-jp Nov 20, 2019
4bbad48
small changes
a-jp Nov 26, 2019
a813ba2
report name of tag that fails look up
a-jp Dec 3, 2019
8d9e09c
report name of field that fails look up
a-jp Dec 3, 2019
6daff66
return newly built elements from assemble
a-jp Dec 3, 2019
08458a3
disable but retain tag writer until odd field->tag naming problem res…
a-jp Dec 3, 2019
01cbd4a
some tidy up, write vtk debug files after additional tests to compare…
a-jp Dec 3, 2019
44a2b53
reading fields and recombining them: quite hard after all
a-jp Dec 3, 2019
f8bfdb6
add mesh movement into additional tests
a-jp Dec 4, 2019
a814e19
include new test for 3D
a-jp Dec 9, 2019
eb44061
lots of bug fixes
a-jp Dec 9, 2019
7be8075
re-enable reading of test fields
a-jp Dec 9, 2019
e7f5a74
bug fix to index for vector and matrix reading
a-jp Jan 13, 2020
5bd1302
switch pair for tuple inside CGNSBCMap in prep for adding additional …
a-jp Jan 13, 2020
f41a750
move from tuple to struct
a-jp Jan 14, 2020
42384f5
remove prototype geometry classification - it doesn't work
a-jp Mar 3, 2020
27bbdb9
missing include
a-jp Mar 3, 2020
d1ad4b8
needless ;
a-jp Mar 3, 2020
87c0650
compile fixes
a-jp Mar 3, 2020
87dcaf3
remove flags not accepted by gcc
a-jp Mar 3, 2020
5a799ff
refine comment
a-jp Mar 4, 2020
e8ad191
rename cgns files consistent with pumi-meshes renaming
a-jp Mar 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
build
settings.json
27 changes: 26 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,26 @@ if(USE_XSDK_DEFAULTS)
xsdk_compiler_flags()
endif()

# require c++14
option(ENABLE_CGNS "Enable the CGNS reader: requires c++14 extensions" OFF)
message(STATUS "ENABLE_CGNS: ${ENABLE_CGNS}")

# Set some default compiler flags that should always be used
if(NOT USE_XSDK_DEFAULTS)
bob_set_shared_libs()
bob_begin_cxx_flags()
bob_end_cxx_flags()
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
if(SCOREC_ENABLE_CXX11)
bob_cxx11_flags()
if(ENABLE_CGNS)
bob_cxx14_flags()
else()
bob_cxx14_flags()
endif()
else()
if(ENABLE_CGNS)
bob_cxx14_flags()
endif()
endif()
endif()
message(STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
Expand Down Expand Up @@ -91,6 +103,7 @@ option(ENABLE_SIMMETRIX "Build with Simmetrix support" OFF)
message(STATUS "ENABLE_SIMMETRIX: ${ENABLE_SIMMETRIX}")
option(ENABLE_OMEGA_H "Enable the Omega_h interface" OFF)
message(STATUS "ENABLE_OMEGA_H: ${ENABLE_OMEGA_H}")

if(ENABLE_SIMMETRIX)
add_definitions(-DHAVE_SIMMETRIX)
endif()
Expand All @@ -117,6 +130,15 @@ if(ENABLE_OMEGA_H)
bob_public_dep(Omega_h)
endif()

if(ENABLE_CGNS)
find_package(CGNS)
include_directories(SYSTEM ${CGNS_INCLUDE_DIR})
#
find_package(HDF5)
#
add_definitions(-DHAVE_CGNS)
endif()

# Include the SCOREC project packages
add_subdirectory(lion)
add_subdirectory(pcu)
Expand All @@ -142,6 +164,9 @@ add_subdirectory(omega_h)
# this INTERFACE target bundles all the enabled libraries together
add_library(core INTERFACE)
target_link_libraries(core INTERFACE ${SCOREC_EXPORTED_TARGETS})
if(ENABLE_CGNS)
target_link_libraries(core INTERFACE ${CGNS_LIBRARIES} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})
endif()
scorec_export_library(core)

if(BUILD_EXES)
Expand Down
10 changes: 10 additions & 0 deletions apf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ set(SOURCES
apfMIS.cc
)

if(ENABLE_CGNS)
set(SOURCES ${SOURCES} apfCGNS.cc)
endif(ENABLE_CGNS)

# Package headers
set(HEADERS
apf.h
Expand Down Expand Up @@ -94,6 +98,12 @@ target_link_libraries(apf
mth
)


if(ENABLE_CGNS)
message(STATUS ${CGNS_LIBRARIES})
target_link_libraries(apf PRIVATE ${CGNS_LIBRARIES} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})
endif(ENABLE_CGNS)

scorec_export_library(apf)

bob_end_subdir()
2 changes: 1 addition & 1 deletion apf/apf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Field* makeField(
FieldShape* shape,
FieldData* data)
{
PCU_ALWAYS_ASSERT( ! m->findField(name));
PCU_ALWAYS_ASSERT_VERBOSE( ! m->findField(name), name);
Field* f = 0;
if (valueType == SCALAR)
f = new ScalarField();
Expand Down
24 changes: 24 additions & 0 deletions apf/apf.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "apfDynamicArray.h"

#include <vector>
#include <map>
#include <limits>

/** \file apf.h
Expand All @@ -34,6 +35,7 @@ class Field;
class Element;
class Mesh;
class MeshEntity;
class MeshTag;
class VectorElement;
/** \brief Mesh Elements represent the mesh coordinate vector field. */
typedef VectorElement MeshElement;
Expand Down Expand Up @@ -629,6 +631,28 @@ for (t::iterator i = (w).begin(); \
for (t::const_iterator i = (w).begin(); \
(i) != (w).end(); ++(i))

struct CGNSInfo
{
// cgns_bc_name
std::string cgnsBCSName;
/* tag value

Tag value holds [0, 1] as a
marker to indicate mesh_entities
within bc group. 1="in group", 0="not in group"
Tags set on vertices, edges, faces, and cells
*/
apf::MeshTag* bcsMarkerTag = nullptr;
// model dimension
int mdlDim = -1;
// model id
int mdlId = -1;
};

//using CGNSBCMap = std::map<std::string, std::vector<std::tuple<std::string, apf::MeshTag *, int>>>;
using CGNSBCMap = std::map<std::string, std::vector<CGNSInfo>>;
void writeCGNS(const char *prefix, Mesh *m, const CGNSBCMap &cgnsBCMap);

/** \brief Write a set of parallel VTK Unstructured Mesh files from an apf::Mesh
* with binary (base64) encoding and zlib compression (if LION_COMPRESS=ON)
* \details Nodal fields whose shape differs from the mesh shape will
Expand Down
Loading