Skip to content

Commit e904a50

Browse files
Nightly Botcwsmith
authored andcommitted
Merging develop into master
2 parents 229f849 + 0472e54 commit e904a50

26 files changed

+3734
-26
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
build
2+
settings.json

CMakeLists.txt

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ option(USE_XSDK_DEFAULTS "enable the XDSK v0.3.0 default configuration" NO)
1616
#requre c++11 without extensions
1717
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1818
set(CMAKE_CXX_EXTENSION OFF)
19-
set(CMAKE_CXX_STANDARD 11)
19+
if(NOT ENABLE_CGNS)
20+
set(CMAKE_CXX_STANDARD 11)
21+
endif()
2022

2123
xsdk_begin_package()
2224
bob_begin_package()
@@ -25,12 +27,22 @@ if(USE_XSDK_DEFAULTS)
2527
xsdk_compiler_flags()
2628
endif()
2729

30+
# require c++14
31+
option(ENABLE_CGNS "Enable the CGNS reader: requires c++14 extensions" OFF)
32+
message(STATUS "ENABLE_CGNS: ${ENABLE_CGNS}")
33+
2834
# Set some default compiler flags that should always be used
2935
if(NOT USE_XSDK_DEFAULTS)
3036
bob_set_shared_libs()
3137
bob_begin_cxx_flags()
3238
bob_end_cxx_flags()
3339
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
40+
if(ENABLE_CGNS) #takes precedence over SCOREC_ENABLE_CXX11
41+
message(STATUS "enabling cxx14")
42+
bob_cxx14_flags()
43+
elseif(SCOREC_ENABLE_CXX11)
44+
bob_cxx11_flags()
45+
endif()
3446
endif()
3547
message(STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
3648

@@ -95,6 +107,7 @@ message(STATUS "ENABLE_SIMMETRIX: ${ENABLE_SIMMETRIX}")
95107
option(ENABLE_OMEGA_H "Enable the Omega_h interface" OFF)
96108
option(PUMI_USE_OMEGA_H_VERSION "Specify the Omega_h version PUMI should use" 10.0.0)
97109
message(STATUS "ENABLE_OMEGA_H: ${ENABLE_OMEGA_H}")
110+
98111
if(ENABLE_SIMMETRIX)
99112
add_definitions(-DHAVE_SIMMETRIX)
100113
endif()
@@ -121,6 +134,15 @@ if(ENABLE_OMEGA_H)
121134
bob_public_dep(Omega_h)
122135
endif()
123136

137+
if(ENABLE_CGNS)
138+
set(SCOREC_USE_CGNS_DEFAULT ${ENABLE_CGNS})
139+
bob_public_dep(CGNS)
140+
#CGNS does not provide cmake targets :(
141+
include_directories(SYSTEM ${CGNS_INCLUDE_DIR})
142+
set(SCOREC_USE_HDF5_DEFAULT ${ENABLE_CGNS})
143+
bob_public_dep(HDF5)
144+
add_definitions(-DHAVE_CGNS)
145+
endif()
124146

125147
# Include the SCOREC project packages
126148
add_subdirectory(lion)
@@ -148,7 +170,12 @@ add_subdirectory(omega_h)
148170
# this INTERFACE target bundles all the enabled libraries together
149171
add_library(core INTERFACE)
150172
target_link_libraries(core INTERFACE ${SCOREC_EXPORTED_TARGETS})
151-
target_compile_features(core INTERFACE cxx_std_11)
173+
if(ENABLE_CGNS)
174+
target_link_libraries(core INTERFACE ${CMAKE_DL_LIBS}) #HDF5 uses dlopen
175+
target_compile_features(core INTERFACE cxx_std_14)
176+
else()
177+
target_compile_features(core INTERFACE cxx_std_11)
178+
endif()
152179
scorec_export_library(core)
153180

154181
#check for mallinfo2

apf/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ set(SOURCES
5656
apfMIS.cc
5757
)
5858

59+
if(ENABLE_CGNS)
60+
set(SOURCES ${SOURCES} apfCGNS.cc)
61+
endif(ENABLE_CGNS)
62+
5963
# Package headers
6064
set(HEADERS
6165
apf.h

apf/apf.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Field* makeField(
7373
FieldShape* shape,
7474
FieldData* data)
7575
{
76-
PCU_ALWAYS_ASSERT( ! m->findField(name));
76+
PCU_ALWAYS_ASSERT_VERBOSE( ! m->findField(name), name);
7777
Field* f = 0;
7878
// Cases with Vector shape functions
7979
if (shape->isVectorShape()) {

apf/apf.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "apfDynamicArray.h"
1414

1515
#include <vector>
16+
#include <map>
1617
#include <limits>
1718

1819
/** \file apf.h
@@ -34,6 +35,7 @@ class Field;
3435
class Element;
3536
class Mesh;
3637
class MeshEntity;
38+
class MeshTag;
3739
class VectorElement;
3840
/** \brief Mesh Elements represent the mesh coordinate vector field. */
3941
typedef VectorElement MeshElement;
@@ -642,6 +644,28 @@ for (t::iterator i = (w).begin(); \
642644
for (t::const_iterator i = (w).begin(); \
643645
(i) != (w).end(); ++(i))
644646

647+
struct CGNSInfo
648+
{
649+
// cgns_bc_name
650+
std::string cgnsBCSName;
651+
/* tag value
652+
653+
Tag value holds [0, 1] as a
654+
marker to indicate mesh_entities
655+
within bc group. 1="in group", 0="not in group"
656+
Tags set on vertices, edges, faces, and cells
657+
*/
658+
apf::MeshTag* bcsMarkerTag = nullptr;
659+
// model dimension
660+
int mdlDim = -1;
661+
// model id
662+
int mdlId = -1;
663+
};
664+
665+
//using CGNSBCMap = std::map<std::string, std::vector<std::tuple<std::string, apf::MeshTag *, int>>>;
666+
using CGNSBCMap = std::map<std::string, std::vector<CGNSInfo>>;
667+
void writeCGNS(const char *prefix, Mesh *m, const CGNSBCMap &cgnsBCMap);
668+
645669
/** \brief Write a set of parallel VTK Unstructured Mesh files from an apf::Mesh
646670
* with binary (base64) encoding and zlib compression (if LION_COMPRESS=ON)
647671
* \details Nodal fields whose shape differs from the mesh shape will

0 commit comments

Comments
 (0)