NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
MeshGenJson.H
Go to the documentation of this file.
1 /*******************************************************************************
2 * Promesh *
3 * Copyright (C) 2022, IllinoisRocstar LLC. All rights reserved. *
4 * *
5 * Promesh is the property of IllinoisRocstar LLC. *
6 * *
7 * IllinoisRocstar LLC *
8 * Champaign, IL *
9 * www.illinoisrocstar.com *
10 * promesh@illinoisrocstar.com *
11 *******************************************************************************/
12 /*******************************************************************************
13 * This file is part of Promesh *
14 * *
15 * This version of Promesh is free software: you can redistribute it and/or *
16 * modify it under the terms of the GNU Lesser General Public License as *
17 * published by the Free Software Foundation, either version 3 of the License, *
18 * or (at your option) any later version. *
19 * *
20 * Promesh is distributed in the hope that it will be useful, but WITHOUT ANY *
21 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more *
23 * details. *
24 * *
25 * You should have received a copy of the GNU Lesser General Public License *
26 * along with this program. If not, see <https://www.gnu.org/licenses/>. *
27 * *
28 *******************************************************************************/
29 #ifndef NEMOSYS_MESHGENJSON_H_
30 #define NEMOSYS_MESHGENJSON_H_
31 
32 #include <algorithm>
33 #include <array>
34 #include <cmath>
35 #include <jsoncons/json.hpp>
36 #include <map>
37 #include <memory>
38 #include <string>
39 #include <vector>
40 #include "Drivers/NemJsonMacros.H"
41 
43 
44 #ifdef HAVE_CFMSH
45 # define HAVE_MSHGEN
46 # define IF_CFMSH(a) a,
50 #else
51 # define IF_CFMSH(a)
52 #endif
53 
54 #ifdef HAVE_NGEN
55 # define HAVE_MSHGEN
56 # define IF_NGEN(a) a,
58 #else
59 # define IF_NGEN(a)
60 #endif
61 
62 #ifdef HAVE_GMSH
63 # define HAVE_MSHGEN
64 # define IF_GMSH(a) a,
66 #else
67 # define IF_GMSH(a)
68 #endif
69 
70 #ifndef HAVE_MSHGEN
71 # error "No mesh generators enabled. Check configuration settings."
72 #endif
73 
74 namespace NEM {
75 namespace DRV {
76 namespace JSON {
77 
78 static constexpr auto meshGenOpts = "Mesh Generation Options";
79 static constexpr auto meshGenEngine = "Mesh Generation Engine";
80 
81 struct colorMapPair {
82  std::array<int, 3> color;
83  std::string group;
84 };
85 
86 inline std::vector<colorMapPair> gmshColorMapToJSON(
87  const std::map<std::array<int, 3>, std::string> &colorMap) {
88  std::vector<colorMapPair> out(colorMap.size());
89  std::transform(colorMap.begin(), colorMap.end(), out.begin(),
90  [](const std::pair<const std::array<int, 3>, std::string> &x) {
91  return colorMapPair{x.first, x.second};
92  });
93  return out;
94 }
95 
96 inline std::map<std::array<int, 3>, std::string> gmshColorMapFromJSON(
97  const std::vector<colorMapPair> &colorMap) {
98  std::map<std::array<int, 3>, std::string> out;
99  for (const auto &color : colorMap) {
100  out.emplace(color.color, color.group);
101  }
102  return out;
103 }
104 
105 } // namespace JSON
106 } // namespace DRV
107 } // namespace NEM
108 
109 // MeshGenDriver
117  void),
124  [](const jsoncons::string_view &x) {
126  }))
127 
128 JSONCONS_ALL_MEMBER_NAME_TRAITS(NEM::DRV::MeshGenDriver::MeshGenFiles,
129  (inputGeoFile, NEM::DRV::JSON::inGeoFile),
130  (outputMeshFile, NEM::DRV::JSON::outMeshFile))
131 
132 #ifdef HAVE_CFMSH
133 // BlockMeshMeshGenDriver
136  (getFiles, setFiles, NEM::DRV::JSON::meshFiles, JSONCONS_RDWR),
137  (getOpts, setOpts, NEM::DRV::JSON::meshGenOpts, JSONCONS_RDWR))
138 
139 JSONCONS_ALL_MEMBER_NAME_TRAITS(
141  (meshEngine, NEM::DRV::JSON::meshGenEngine, JSONCONS_RDONLY,
142  [](const jsoncons::string_view &x) {
144  }),
145  (params, NEM::DRV::JSON::bmParams))
146 
147 JSONCONS_N_MEMBER_NAME_TRAITS(
148  blockMeshParams, 1, (cnvrtToMeters, "scaleToMeters"),
149  (ownBlockMshDict, "Input Dict File"), (cellSize, "Cell_Size"),
150  (nCells, "NumCells"),
151  (shape, "Block Parameters", JSONCONS_RDWR, NEM_JSON_CHECK_KEY_ONLY,
152  std::dynamic_pointer_cast<bmBox>,
153  (std::dynamic_pointer_cast<bmShape, bmBox>)),
154  (shape, "Sphere Parameters", JSONCONS_RDWR, NEM_JSON_CHECK_KEY_ONLY,
155  std::dynamic_pointer_cast<bmSphere>,
156  (std::dynamic_pointer_cast<bmShape, bmSphere>)),
157  (shape, "Cylinder/Tapered_Cone Parameters", JSONCONS_RDWR,
158  NEM_JSON_CHECK_KEY_ONLY, std::dynamic_pointer_cast<bmCylTaperedCone>,
159  (std::dynamic_pointer_cast<bmShape, bmCylTaperedCone>)))
160 
161 JSONCONS_N_MEMBER_NAME_TRAITS(bmBox, 0, (autoGenerate, "Auto_Generate"),
162  (init, "InitialPoint"), (len, "Length"),
163  (smplGrading, "Grading"))
164 
165 NEM_JSON_SMART_PTR_VAL(bmBox, std::shared_ptr)
166 
167 JSONCONS_N_MEMBER_NAME_TRAITS(bmAutoGenBox, 0, (packFileName, "InputPackFile"),
168  (offset, "Offset"))
169 
170 JSONCONS_N_MEMBER_NAME_TRAITS(bmSphere, 2, (center, "Center"),
171  (radius, "Radius"), (sphrGrading, "Grading"))
172 
173 NEM_JSON_SMART_PTR_VAL(bmSphere, std::shared_ptr)
174 
175 JSONCONS_N_MEMBER_NAME_TRAITS(bmCylTaperedCone, 3, (centerCyl, "Center"),
176  (height, "Height"), (radius1, "Radius1"),
177  (radius2, "Radius2"), (cylGrading, "Grading"))
178 
180 
181 // CFMeshMeshGenDriver
184  (getFiles, setFiles, NEM::DRV::JSON::meshFiles, JSONCONS_RDWR),
185  (getOpts, setOpts, NEM::DRV::JSON::meshGenOpts, JSONCONS_RDWR))
186 
187 JSONCONS_ALL_MEMBER_NAME_TRAITS(
189  (meshEngine, NEM::DRV::JSON::meshGenEngine, JSONCONS_RDONLY,
190  [](const jsoncons::string_view &x) {
192  }),
193  (params, "CFMesh Parameters"))
194 
195 JSONCONS_N_MEMBER_NAME_TRAITS(
196  cfmeshParams, 1, (generator, "Generator"), (maxCellSize, "MaxCellSize"),
197  (minCellSize, "MinCellSize"), (bndryCellSize, "BoundaryCellSize"),
198  (bndryCellSizeRefThk, "BoundaryCellSizeRefinementThickness"),
199  (keepCellIB, "KeepCellsIntersectingBoundary"),
200  (chkGluMsh, "CheckForGluedMesh"),
201  (alwDiscDomains, "AllowDisconnectedDomains"),
202  (boundaryLayers, "BoundaryLayers"), (srfEdge, "SurfaceFeatureEdges"),
203  (objRefLst, "ObjectRefinements"),
204  (improveMeshQuality, "ImproveMeshQuality"), (refPatches, "LocalRefinement"),
205  (renBndry, "RenameBoundary"))
206 
207 JSONCONS_N_MEMBER_NAME_TRAITS(cfmBoundaryLayer, 2, (blNLyr, "NLayers"),
208  (blThkRto, "ThicknessRatio"),
209  (maxFrstLyrThk, "MaxFirstLayerThickness"),
210  (alwDiscont, "AllowDiscontinuity"),
211  (blPatches, "PatchBoundaryLayers"))
212 
213 JSONCONS_N_MEMBER_NAME_TRAITS(cfmPtchBndLyr, 1, (patchName, "PatchName"),
214  (alwDiscont, "AllowDiscontinuity"),
215  (maxFrstLyrThk, "MaxFirstLayerThickness"),
216  (blNLyr, "NLayers"), (blThkRto, "ThicknessRatio"))
217 
218 JSONCONS_N_MEMBER_NAME_TRAITS(cfmSrfFeatEdge, 0, (srfEdgAng, "Angle"))
219 
220 JSONCONS_ALL_MEMBER_NAME_TRAITS(cfmObjRef, (name, "Name"), (params, "Params"))
221 
222 JSONCONS_N_MEMBER_NAME_TRAITS(cfmMeshQual, 4, (qltNItr, "NIterations"),
223  (qltNLop, "NLoops"),
224  (qltQltThr, "QualityThreshold"),
225  (qltNSrfItr, "NSurfaceIterations"),
226  (qltConCelSet, "ConstrainedCellsSet"))
227 
228 JSONCONS_N_MEMBER_NAME_TRAITS(cfmLclRefPatch, 1, (patchName, "PatchName"),
229  (aditRefLvls, "AdditionalRefinementLevels"),
230  (refThickness, "RefinementThickness"),
231  (cellSize, "CellSize"))
232 
233 JSONCONS_ALL_MEMBER_NAME_TRAITS(cfmRenBndry, (defName, "DefaultName"),
234  (defType, "DefaultType"),
235  (newPatches, "NewPatchNames"))
236 
237 JSONCONS_ALL_MEMBER_NAME_TRAITS(cfmNewPatch, (name, "Name"),
238  (newName, "NewName"), (newType, "NewType"))
239 
240 // SnappyMeshMeshGenDriver
243  (getFiles, setFiles, NEM::DRV::JSON::meshFiles, JSONCONS_RDWR),
244  (getOpts, setOpts, NEM::DRV::JSON::meshGenOpts, JSONCONS_RDWR))
245 
246 JSONCONS_ALL_MEMBER_NAME_TRAITS(
248  (meshEngine, NEM::DRV::JSON::meshGenEngine, JSONCONS_RDONLY,
249  [](const jsoncons::string_view &x) {
251  }),
252  (params, NEM::DRV::JSON::smParams))
253 
254 JSONCONS_N_MEMBER_NAME_TRAITS(
255  snappymeshParams, 3, (withCastMesh, "Castellated Mesh"),
256  (withSnap, "Snapping"), (withLayers, "Layer Addition"),
257  (mergeTol, "mergeTolerance"), (geoDef, "Geometry Definition"),
258  (castMeshControls, "Castellated Mesh Controls"),
259  (snapControls, "Snapping Controls"), (layerControls, "Layer Controls"),
260  (qualityControls, "Mesh Quality Controls"))
261 
262 JSONCONS_N_MEMBER_NAME_TRAITS(shmGeo, 1,
263  (withMultiPatches, "Enable Multi Patches"),
264  (singleSolidPatch, "InputPatchName"),
265  (stlPatchDefs, "Geometry Patches"),
266  (srchShape, "Custom Patches"))
267 
268 JSONCONS_ALL_MEMBER_NAME_TRAITS(shmSTLDefinition,
269  (STLPatchName, "Geometry Patch Name"),
270  (snappyPatchName, "Output Patch Name"))
271 
275  2, (patchName, "Custom Patch Name"),
276  (getType(), "Searchable Shape",
277  JSONCONS_RDONLY))
278 
280 
282  (minBound, "minimum bound"),
283  (maxBound, "maximum bound"))
284 
286  3, (axisPoint1, "Axis Point 1"),
287  (axisPoint2, "Axis Point 2"),
288  (radius, "Radius"))
289 
291  (center, "Center"), (radius, "Radius"))
292 
293 JSONCONS_N_MEMBER_NAME_TRAITS(
294  shmCastMeshControls, 1, (withCellZones, "CellZones"),
295  (castMeshGpLvl, "GeneralGapLevelIncrement"), (maxLCells, "maxLocalCells"),
296  (maxGCells, "maxGlobalCells"), (minRefCells, "minRefCells"),
297  (cellsBetnLvls, "nCellsBetweenLevels"),
298  (refSurfLvlMin, "surfaceRefinementLvlMin"),
299  (refSurfLvlMax, "surfaceRefinementLvlMax"),
300  (featAngle, "resolveFeatureAngle"), (gapLvlInc, "gapLevelIncrement"),
301  (planarAngle, "planarAngle"), (locMesh, "locationInMesh"),
302  (alwFreeZone, "allowFreeStandingZoneFaces"), (ftrEdge, "Feature File"),
303  (surfRefs, "SurfaceRefinementRegions"), (geomRefs, "GeomRefinementRegions"))
304 
305 JSONCONS_N_MEMBER_NAME_TRAITS(shmFeatureEdgeRef, 2, (fileName, "File Name"),
306  (maxLvl, "MaxLevel"), (minLvl, "MinLevel"))
307 
308 JSONCONS_N_MEMBER_NAME_TRAITS(shmSurfRefine, 2, (refPatchName, "Patch Name"),
309  (maxLvl, "MaxLevel"), (patchType, "Patch Type"),
310  (minLvl, "MinLevel"))
311 
312 JSONCONS_ALL_MEMBER_NAME_TRAITS(shmRegionRefine, (patchName, "Patch Name"),
313  (mode, "Mode"), (minLvl, "MinLevel"),
314  (maxLvl, "MaxLevel"))
315 
316 JSONCONS_N_MEMBER_NAME_TRAITS(
317  shmSnapControls, 0, (nSmoothPatch, "nSmoothPatch"),
318  (tolerance, "tolerance"), (nSolveIter, "snapSolveIter"),
319  (nRelaxIter, "snapRelaxIter"), (nFeatureSnapIter, "nFeatureSnapIter"),
320  (implicitFeatureSnap, "implicitFeatureSnap"),
321  (explicitFeatureSnap, "explicitFeatureSnap"),
322  (multiRegionFeatureSnap, "multiRegionFeatureSnap"))
323 
324 JSONCONS_N_MEMBER_NAME_TRAITS(
325  shmLayerControls, 0, (relSize, "relativeSizes"),
326  (expRatio, "expansionRatio"), (finLThick, "finalLayerThickness"),
327  (minThick, "minThickness"), (firstLyrThickness, "firstLayerThickness"),
328  (thickness, "thickness"), (nGrow, "nGrow"), (featAngle, "featureAngle"),
329  (relaxIter, "nRelaxIter"), (smthSurfNorm, "nSmoothSurfaceNormals"),
330  (smthNorm, "nSmoothNormals"), (smthThick, "nSmoothThickness"),
331  (maxFcTR, "maxFaceThicknessRatio"),
332  (maxThickTMR, "maxThicknessToMedialRatio"),
333  (minMedAngl, "minMedialAxisAngle"), (bufferCells, "nBufferCellsNoExtrude"),
334  (nIter, "nLayerIter"), (nRelaxedIter, "nRelaxedIter"),
335  (slipFeatureAngle, "slipFeatureAngle"),
336  (nMedialAxisIter, "nMedialAxisIter"),
337  (nSmoothDisplacement, "nSmoothDisplacement"), (layerVec, "Layers"))
338 
339 JSONCONS_N_MEMBER_NAME_TRAITS(shmLayers, 1, (patchName, "Patch Name"),
340  (nSurfaceLayers, "nSurfaceLayers"),
341  (expansionRatio, "expansionRatio"),
342  (finalLayerThickness, "finalLayerThickness"),
343  (firstLyrThickness, "firstLyrThickness"),
344  (thickness, "thickness"),
345  (minThickness, "minThickness"))
346 
347 JSONCONS_N_MEMBER_NAME_TRAITS(
348  shmMeshQualityControls, 0, (maxNonOrtho, "maxNonOrtho"),
349  (maxBndrySkew, "maxBoundarySkewness"), (maxIntSkew, "maxInternalSkewness"),
350  (maxConc, "maxConcave"), (minVol, "minVol"), (minTetQ, "minTetQuality"),
351  (minArea, "minArea"), (minTwist, "minTwist"), (minFaceW, "minFaceWeight"),
352  (minVolRto, "minVolRatio"), (minDet, "minDeterminant"),
353  (minTriTwist, "minTriangleTwist"), (smoothScale, "qcnSmoothScale"),
354  (errReduction, "errorReduction"))
355 #endif
356 
357 #ifdef HAVE_NGEN
358 // NetgenMeshGenDriver
361  (getFiles, setFiles, NEM::DRV::JSON::meshFiles, JSONCONS_RDWR),
362  (getOpts, setOpts, NEM::DRV::JSON::meshGenOpts, JSONCONS_RDWR))
363 
364 JSONCONS_ALL_MEMBER_NAME_TRAITS(
366  (meshEngine, NEM::DRV::JSON::meshGenEngine, JSONCONS_RDONLY,
367  [](const jsoncons::string_view &x) {
369  }),
370  (params, "Netgen Parameters"))
371 
372 JSONCONS_N_MEMBER_NAME_TRAITS(
373  netgenParams, 0, (uselocalh, "uselocalh"), (maxh, "maxh"),
374  (fineness, "fineness"), (grading, "grading"),
375  (elementsperedge, "elementsperedge"),
376  (elementspercurve, "elementspercurve"),
377  (closeedgeenable, "closeedgeenable"), (closeedgefact, "closeedgefact"),
378  (second_order, "second_order"), (meshsize_filename, "meshsize_filename"),
379  (quad_dominated, "quad_dominated"), (optvolmeshenable, "optvolmeshenable"),
380  (optsteps_2d, "optsteps_2d"), (optsteps_3d, "optsteps_3d"),
381  (invert_tets, "invert_tets"), (invert_trigs, "invert_trigs"),
382  (check_overlap, "check_overlap"),
383  (check_overlapping_boundary, "check_overlapping_boundary"),
384  (refine_with_geom, "refine_with_geometry_adaptation"),
385  (refine_without_geom, "refine_without_geometry_adaptation"))
386 #endif
387 
388 #ifdef HAVE_GMSH
389 // GmshMeshGenDriver
392  (getFiles, setFiles, NEM::DRV::JSON::meshFiles, JSONCONS_RDWR),
393  (getOpts, setOpts, NEM::DRV::JSON::meshGenOpts, JSONCONS_RDWR))
394 
395 JSONCONS_ALL_MEMBER_NAME_TRAITS(
397  (meshEngine, NEM::DRV::JSON::meshGenEngine, JSONCONS_RDONLY,
398  [](const jsoncons::string_view &x) {
400  }),
401  (params, "Gmsh Parameters"))
402 
403 JSONCONS_N_MEMBER_NAME_TRAITS(
404  NEM::GEN::gmshParams, 0, (minSize, "minSize"), (maxSize, "maxSize"),
405  (algo2D, "surfaceAlgorithm"), (algo3D, "volumeAlgorithm"),
406  (extSizeFromBoundary, "extendSizeFromBoundary"),
407  (sizeFromCurvature, "sizeFromCurvature"),
408  (minElePer2Pi, "minElementsPer2Pi"), (optimize, "optimize"),
409  (optimizeThreshold, "optimizeThreshold"), (sizeFields, "SizeFields"),
410  (bgField, "BackgroundField"), (elementOrder, "elementOrder"),
411  (subdivisionAlg, "subdivisionAlgorithm"), (saveAll, "saveAll"),
412  (fragmentAll, "fragment"),
413  (color2groupMap, "ColorMap", JSONCONS_RDWR, NEM_JSON_CHECK_KEY_ONLY,
415  (transfiniteBlocks, "TransfiniteBlocks"))
416 
417 JSONCONS_ALL_MEMBER_NAME_TRAITS(NEM::DRV::JSON::colorMapPair, (color, "Color"),
418  (group, "Group"))
419 
420 namespace jsoncons {
421 template <typename Json>
422 struct json_type_traits<Json, NEM::GEN::TransfiniteBlock> {
423  using value_type = NEM::GEN::TransfiniteBlock;
424  using allocator_type = typename Json::allocator_type;
425  static constexpr auto idStr = "Volume";
426  static constexpr auto axisStr = "Axis";
427  static constexpr auto vertStr = "Vertices";
428  static constexpr auto progStr = "Progression";
429  static constexpr auto bumpStr = "Bump";
430  static bool is(const Json &ajson) noexcept {
431  return ajson.is_object() && ajson.contains(idStr) &&
432  ajson.contains(axisStr) && ajson.contains("x") &&
433  ajson.contains("y") && ajson.contains("z");
434  }
435  static value_type as(const Json &ajson) {
436  static const std::array<std::pair<jsoncons::string_view, int>, 3> axisMap{
437  {{"x", 0}, {"y", 1}, {"z", 2}}};
438  if (!is(ajson))
439  throw convert_error(convert_errc::conversion_failed,
440  "Not a NEM::GEN::TransfiniteBlock");
441  value_type aval{};
442  json_traits_helper<Json>::set_udt_member(ajson, idStr, aval.id);
443  json_traits_helper<Json>::set_udt_member(ajson, axisStr, aval.axis);
444  for (int i = 0; i < 3; ++i) {
445  auto &axis = aval.axis[i];
446  double axis_len =
447  std::sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);
448  if (axis_len < 1e-3) {
449  std::cerr
450  << "Axis " << i << " for block " << aval.id
451  << " is too small. Please prescribe an axis with length > 1e-3"
452  << std::endl;
453  exit(1);
454  }
455  for (auto &val : axis) {
456  val /= axis_len;
457  }
458  }
459  for (const auto &axis : axisMap) {
460  const auto &axisJson = ajson[axis.first];
461  aval.vert[axis.second] = axisJson[vertStr].template as<int>();
462  if (axisJson.contains(bumpStr)) {
463  aval.type[axis.second] = bumpStr;
464  aval.coef[axis.second] = axisJson[bumpStr].as_double();
465  } else if (axisJson.contains(progStr)) {
466  aval.type[axis.second] = progStr;
467  aval.coef[axis.second] = axisJson[progStr].as_double();
468  }
469  }
470  return aval;
471  }
472  static Json to_json(const value_type &aval,
473  allocator_type alloc = allocator_type()) {
474  static const std::array<std::pair<jsoncons::string_view, int>, 3> axisMap{
475  {{"x", 0}, {"y", 1}, {"z", 2}}};
476  Json ajson(json_object_arg, semantic_tag::none, alloc);
477  ajson.try_emplace(idStr, aval.id);
478  ajson.try_emplace(axisStr, aval.axis);
479  for (const auto &axis : axisMap) {
480  auto &axisJson = ajson[axis.first];
481  axisJson.try_emplace(vertStr, aval.vert[axis.second]);
482  axisJson.try_emplace(aval.type[axis.second], aval.coef[axis.second]);
483  }
484  return ajson;
485  }
486 };
487 template <>
488 struct is_json_type_traits_declared<NEM::GEN::TransfiniteBlock>
489  : public std::true_type {};
490 } // namespace jsoncons
491 
492 namespace jsoncons {
493 template <typename Json>
494 struct json_type_traits<Json, NEM::GEN::volSizeField> {
495  using value_type = NEM::GEN::volSizeField;
496  using allocator_type = typename Json::allocator_type;
497  static bool is(const Json &ajson) noexcept {
498  return ajson.is_object() && ajson.contains("Type") &&
499  ajson.contains("ID") && ajson.contains("Params");
500  }
501  static value_type as(const Json &ajson) {
502  if (!is(ajson))
503  throw convert_error(convert_errc::conversion_failed,
504  "Not a NEM::GEN::volSizeField");
505  value_type aval{};
506  json_traits_helper<Json>::set_udt_member(ajson, "Type", aval.type);
507  json_traits_helper<Json>::set_udt_member(ajson, "ID", aval.id);
508  for (const auto &param : ajson.at("Params").object_range()) {
509  const auto &val = param.value();
510  if (val.is_array()) {
511  if (val.at(0).is_string()) {
512  aval.strg_list_params.emplace_back(
513  param.key(), val.template as<std::vector<std::string>>());
514  } else {
515  aval.num_list_params.emplace_back(
516  param.key(), val.template as<std::vector<double>>());
517  }
518  } else {
519  aval.params.emplace_back(param.key(), val.as_double());
520  }
521  }
522  return aval;
523  }
524  static Json to_json(const value_type &aval,
525  allocator_type alloc = allocator_type()) {
526  Json ajson(json_object_arg, semantic_tag::none, alloc);
527  ajson.try_emplace("Type", aval.type);
528  ajson.try_emplace("ID", aval.id);
529  auto &params = ajson["Params"];
530  for (const auto &param : aval.strg_list_params) {
531  params.try_emplace(param.first, param.second);
532  }
533  for (const auto &param : aval.num_list_params) {
534  params.try_emplace(param.first, param.second);
535  }
536  for (const auto &param : aval.params) {
537  params.try_emplace(param.first, param.second);
538  }
539  return ajson;
540  }
541 };
542 template <>
543 struct is_json_type_traits_declared<NEM::GEN::volSizeField>
544  : public std::true_type {};
545 } // namespace jsoncons
546 #endif
547 
548 #undef IF_CFMSH
549 #undef IF_NGEN
550 #undef IF_GMSH
551 #undef HAVE_MSHGEN
552 
553 #endif // NEMOSYS_MESHGENJSON_H_
snappymeshParams contains all parameters essential for mesh generation using snappymeshGen class meth...
A structure for STL definition.
static constexpr const char * programType
Definition: MeshGenDriver.H:59
#define NEM_JSON_CHECK_KEY_ONLY(x)
base class for drivers
Definition: NemDriver.H:46
Castellated Mesh Controls.
#define IF_NGEN(a)
Definition: MeshGenJson.H:59
static constexpr auto inGeoFile
#define NEM_JSON_SMART_PTR_VAL(BaseClass, PointerTempl)
Geometry definition.
static constexpr auto meshGenOpts
Definition: MeshGenJson.H:78
std::map< std::array< int, 3 >, std::string > gmshColorMapFromJSON(const std::vector< colorMapPair > &colorMap)
Definition: MeshGenJson.H:96
A structure to respresent regions refining capability in snappymeshGen.
blockMeshParams contains the parameters important for automatic meshing using blockMeshGen class...
A struct for defining hexahedral transfinite volumes.
Definition: gmshParams.H:67
static constexpr auto outMeshFile
#define NEM_JSON_N_MEMBER_NAME_TRAITS_BASE(BaseClass, ChildClasses, NumMandatoryParams,...)
static constexpr auto bmParams
#define NEM_JSON_N_MEMBER_NAME_TRAITS_FINAL(ValueType, ParentType, NumMandatoryParams,...)
Definition: NemJsonMacros.H:83
Mesh Quality Controls.
std::vector< colorMapPair > gmshColorMapToJSON(const std::map< std::array< int, 3 >, std::string > &colorMap)
Definition: MeshGenJson.H:86
#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
gmshParams contains all parameters essential for mesh generation using gmshGen class methods...
Definition: gmshParams.H:92
#define IF_GMSH(a)
Definition: MeshGenJson.H:67
#define IF_CFMSH(a)
Definition: MeshGenJson.H:46
static constexpr const char * meshEngine
A structure to respresent shape patches defining capability in snappymeshGen.
A structure for feature edge refinement.
A structure to represent geometry surface refining capability in snappymeshgGen.
std::array< int, 3 > color
Definition: MeshGenJson.H:82
Layer Controls.
static constexpr const char * meshEngine
Snapping Controls.
static constexpr auto programType
#define NEM_JSON_WRAP_SMART_PTR(BaseClass, PointerTempl)
A structure for defining volumetric mesh size fields.
Definition: gmshParams.H:50
static constexpr const char * meshEngine
static constexpr auto meshFiles
#define NEM_JSON_RDONLY_OVERRIDE(X)
Definition: NemJsonMacros.H:39
static constexpr auto meshGenEngine
Definition: MeshGenJson.H:79
A struct for layer addition.
static constexpr const char * meshEngine