29 #ifndef NEMOSYS_PACKMESHJSON_H_ 30 #define NEMOSYS_PACKMESHJSON_H_ 32 #include <jsoncons/json.hpp> 38 # define IF_CFMSH(a) a, 45 # define IF_GMSH(a) a, 69 [](
const jsoncons::string_view &x) {
81 (rocpackFile,
"Input Rocpack File"),
84 JSONCONS_N_MEMBER_NAME_TRAITS(
86 (type,
"Type", JSONCONS_RDONLY,
87 [](
const jsoncons::string_view &x) {
90 (engine,
"Engine", JSONCONS_RDONLY,
91 [](
const jsoncons::string_view &x) {
94 (periodic3DOpts,
"Periodic 3D Mesh"), (meshSize,
"Mesh Size"),
95 (meshAlgorithm,
"Mesh Algorithm"), (scaleValue,
"Scale Value"),
96 (removeBoundaryPacks,
"Remove geometries on boundary"),
97 (enableDefaultOut,
"Enalbe Default Outputs"),
98 (preserveSize,
"Enable Size Preservation"),
99 (refineLevel,
"Refinement Levels"), (upperThreshold,
"Upper Threshold"),
100 (lowerThreshold,
"Lower Threshold"))
103 0, (physGrpOptions,
"Physical Group Options"),
104 (createCohesive,
"Create cohesive elements"),
105 (enablePatches,
"Enable Patches"),
106 (setPeriodicGeo,
"Set Periodic Geometry"),
107 (elemOrder,
"Element Order"),
108 (customDomain,
"Custom Domain"),
109 (transferMesh,
"TransferMesh"))
111 JSONCONS_ENUM_NAME_TRAITS(NEM::DRV::SurfacePackMeshDriver::PhysGrpOpts,
112 (
NONE,
"None"), (
MULTI,
"Multi Physical Groups"),
113 (
TWO,
"Two Physical Groups"),
114 (PER_SHAPE,
"Physical Group per Shape"))
117 (initial,
"Initial"), (length,
"Length"))
128 template <
typename Json>
131 using allocator_type =
typename Json::allocator_type;
132 static constexpr
auto rockFile =
"Input Rocpack File";
133 static constexpr
auto pmFile =
"Output Pack Mesh File";
134 static constexpr
auto smFile =
"Output Surrounding Mesh File";
135 static constexpr
auto cmFile =
"Output Combined Mesh File";
136 static bool is(
const Json &ajson) noexcept {
137 return ajson.is_object() &&
138 (ajson.contains(rockFile) !=
140 ajson.contains(pmFile) && ajson.contains(smFile);
142 static value_type as(
const Json &ajson) {
144 throw convert_error(convert_errc::conversion_failed,
145 "Not a HexPackMeshDriver::Files");
147 if (ajson.contains(rockFile))
148 aval.setRocpackFile(ajson.at(rockFile).as_string());
151 json_traits_helper<Json>::set_udt_member(ajson, pmFile,
152 aval.outPackMeshFile);
153 json_traits_helper<Json>::set_udt_member(ajson, smFile,
154 aval.outSurroundingFile);
155 if (ajson.contains(cmFile))
156 json_traits_helper<Json>::set_udt_member(ajson, cmFile,
157 aval.outCombinedFile);
160 static Json to_json(
const value_type &aval,
161 allocator_type alloc = allocator_type()) {
162 Json ajson(json_object_arg, semantic_tag::none, alloc);
165 aval.rocpackOrGeoFile);
166 ajson.try_emplace(pmFile, aval.outPackMeshFile);
167 ajson.try_emplace(smFile, aval.outSurroundingFile);
168 ajson.try_emplace(cmFile, aval.outCombinedFile);
174 :
public std::true_type {};
177 JSONCONS_N_MEMBER_NAME_TRAITS(
179 (type,
"Type", JSONCONS_RDONLY,
180 [](
const jsoncons::string_view &x) {
183 (engine,
"Engine", JSONCONS_RDONLY,
184 [](
const jsoncons::string_view &x) {
188 (mmfMergeParams,
"MeshManipulation mergeMeshes Parameters"),
189 (mmfCreatePatchParams,
"MeshManipulation createPatch Parameters"),
190 (locAdjust,
"locInMesh_adjust"))
193 (overwriteMergeMsh,
"overwrite?"),
194 (masterCasePath,
"Master Region Path"),
195 (addCasePath,
"Add Region Path"))
198 (surroundingName,
"Surrounding PatchName"),
199 (packsName,
"Packs PatchName"),
200 (srrndngPatchType,
"Surrounding PatchType"),
201 (packsPatchType,
"Packs PatchType"),
202 (overwritecpMsh,
"overwrite?"))
208 #endif // NEMOSYS_PACKMESHJSON_H_
static constexpr auto inGeoFile
static constexpr const char * engine
static constexpr auto packMeshOpts
static constexpr auto outMeshFile
static constexpr auto bmParams
static constexpr const char * type
This class drives the flow of pack meshing by using parameters provided by users. ...
static constexpr const char * engine
#define NEM_JSON_N_GETTER_SETTER_NAME_TRAITS_FINAL(ValueType, ParentType, NumMandatoryParams,...)
#define NEM_JSON_N_GETTER_SETTER_NAME_TRAITS_INTERMEDIATE(BaseClass, ChildClasses, ParentClass, NumMandatoryParams,...)
static constexpr auto smParams
static constexpr const char * type
static constexpr auto programType
static constexpr const char * programType
static constexpr auto meshFiles
#define NEM_JSON_RDONLY_OVERRIDE(X)