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.
NEM::DRV::SurfacePackMeshDriver Class Reference

Detailed Description

Definition at line 38 of file SurfacePackMeshDriver.H.

Classes

struct  CustomDomain
 
struct  Files
 
struct  Opts
 
struct  Periodic3DOpts
 

Public Member Functions

 SurfacePackMeshDriver (Files files, Opts opts)
 
const FilesgetFiles () const
 
void setFiles (Files files)
 
const OptsgetOpts () const
 
void setOpts (Opts opts)
 
void execute () const override
 Run the workflow represented by the driver. More...
 

Static Public Member Functions

static std::unique_ptr< NemDriverreadJSON (const jsoncons::json &inputjson)
 Factory method for all drivers. More...
 

Private Member Functions

 SurfacePackMeshDriver ()
 

Private Attributes

Files files_
 
Opts opts_
 

Inherits NEM::DRV::PackMeshDriver.

Constructor & Destructor Documentation

◆ SurfacePackMeshDriver() [1/2]

NEM::DRV::SurfacePackMeshDriver::SurfacePackMeshDriver ( Files  files,
Opts  opts 
)

Definition at line 45 of file SurfacePackMeshDriver.C.

46  : files_(std::move(files)), opts_(std::move(opts)) {}

◆ SurfacePackMeshDriver() [2/2]

NEM::DRV::SurfacePackMeshDriver::SurfacePackMeshDriver ( )
private

Definition at line 48 of file SurfacePackMeshDriver.C.

Member Function Documentation

◆ execute()

void NEM::DRV::SurfacePackMeshDriver::execute ( ) const
overridevirtual

Implements NEM::DRV::NemDriver.

Definition at line 98 of file SurfacePackMeshDriver.C.

References NEM::DRV::SurfacePackMeshDriver::Opts::enableDefaultOut, files_, NEM::DRV::SurfacePackMeshDriver::Opts::lowerThreshold, NEM::DRV::SurfacePackMeshDriver::Opts::meshAlgorithm, NEM::DRV::SurfacePackMeshDriver::Opts::meshSize, MULTI, NONE, opts_, NEM::DRV::SurfacePackMeshDriver::Opts::periodic3DOpts, NEM::DRV::SurfacePackMeshDriver::Opts::preserveSize, NEM::DRV::SurfacePackMeshDriver::Opts::refineLevel, NEM::DRV::SurfacePackMeshDriver::Opts::removeBoundaryPacks, NEM::DRV::SurfacePackMeshDriver::Files::rocpackFile, NEM::DRV::SurfacePackMeshDriver::Opts::scaleValue, TWO, and NEM::DRV::SurfacePackMeshDriver::Opts::upperThreshold.

98  {
99  auto *objrocPck = new NEM::GEO::rocPack(this->files_.rocpackFile,
100  this->files_.outputMeshFile);
101 
102  if (this->opts_.upperThreshold.has_value() ||
103  this->opts_.lowerThreshold.has_value())
104  objrocPck->applyFilter(this->opts_.upperThreshold.value_or(0.),
105  this->opts_.lowerThreshold.value_or(0.));
106 
107  objrocPck->setMeshingAlgorithm(this->opts_.meshAlgorithm);
108 
109  if (this->opts_.preserveSize) objrocPck->setSizePreservation();
110 
111  if (this->opts_.refineLevel.has_value())
112  objrocPck->assignRefinement(this->opts_.refineLevel.value());
113 
114  if (this->opts_.removeBoundaryPacks) objrocPck->removeBoundaryVolumes();
115 
116  if (this->opts_.scaleValue.has_value())
117  objrocPck->shrinkVolumes(this->opts_.scaleValue.value());
118 
119  if (this->opts_.meshSize.has_value())
120  objrocPck->setMeshSize(this->opts_.meshSize.value());
121 
122  if (this->opts_.enableDefaultOut) objrocPck->enableDefOuts();
123 
124  // Create periodic mesh
125  if (this->opts_.periodic3DOpts.has_value()) {
126  const auto &periodic3D = this->opts_.periodic3DOpts.value();
127  if (periodic3D.customDomain && periodic3D.setPeriodicGeo) {
128  std::cerr
129  << "WARNING!! -> Cannot make geometry periodic using custom bounds."
130  << " using remove geometries on boundary option instead for meshing!"
131  << std::endl;
132  }
133  objrocPck->translateAll(periodic3D.transferMesh[0],
134  periodic3D.transferMesh[1],
135  periodic3D.transferMesh[2]);
136 
137  objrocPck->setElementOrder(periodic3D.elemOrder);
138 
139  if (periodic3D.createCohesive) {
140  objrocPck->sanityCheckOn();
141  objrocPck->enableCohesiveElements();
142  }
143 
144  switch (periodic3D.physGrpOptions) {
145  case PhysGrpOpts::MULTI: objrocPck->enablePhysicalGrps(); break;
146  case PhysGrpOpts::TWO: objrocPck->enableTwoPhysGrps(); break;
147  case PhysGrpOpts::PER_SHAPE:
148  objrocPck->enablePhysicalGroupsPerShape();
149  break;
150  case PhysGrpOpts::NONE: break;
151  }
152 
153  if (periodic3D.enablePatches) objrocPck->enableSurfacePatches();
154 
155  if (periodic3D.setPeriodicGeo) objrocPck->setPeriodicGeometry();
156 
157  if (periodic3D.customDomain) {
158  const auto &customDomain = periodic3D.customDomain.value();
159  objrocPck->setCustomDomain(
160  {customDomain.initial[0], customDomain.initial[1],
161  customDomain.initial[2], customDomain.length[0],
162  customDomain.length[1], customDomain.length[2]});
163  objrocPck->removeBoundaryVolumes();
164  objrocPck->setPeriodicMesh();
165  objrocPck->rocPack2Periodic3D();
166  } else {
167  objrocPck->setPeriodicGeometry();
168  objrocPck->setPeriodicMesh();
169  objrocPck->rocPack2Periodic3D();
170  }
171 
172  } else { // Generate STL only
173  objrocPck->rocPack2Surf();
174  }
175 
176  if (objrocPck) delete objrocPck;
177 }
bool enableDefaultOut
Enable default output formats.
jsoncons::optional< Periodic3DOpts > periodic3DOpts
If periodic3D has value, then options for the 3D mesh.
This class converts Rockpack output file into periodic geometry and writes into STL, VTK, .MSH, and ExodusII file format.
Definition: rocPack.H:77
jsoncons::optional< double > upperThreshold
Upper threshold for filtering (w.r.t mean)
jsoncons::optional< int > refineLevel
Refinement applied to original mesh.
int meshAlgorithm
Meshing algorithm of choice.
jsoncons::optional< double > scaleValue
Value of scaling between 0 to 1 with 1 being no scaling.
jsoncons::optional< double > lowerThreshold
Lower threshold for filtering (w.r.t mean)
jsoncons::optional< double > meshSize
Mesh size.
bool preserveSize
Boolean for preserving pack sizes instead of packing fraction.
bool removeBoundaryPacks
Boolean for removal of volumes intersecting boundary.

◆ getFiles()

const SurfacePackMeshDriver::Files & NEM::DRV::SurfacePackMeshDriver::getFiles ( ) const

Definition at line 51 of file SurfacePackMeshDriver.C.

References files_.

51  {
52  return files_;
53 }

◆ getOpts()

const SurfacePackMeshDriver::Opts & NEM::DRV::SurfacePackMeshDriver::getOpts ( ) const

Definition at line 59 of file SurfacePackMeshDriver.C.

References opts_.

59  {
60  return opts_;
61 }

◆ readJSON()

std::unique_ptr< NemDriver > NEM::DRV::NemDriver::readJSON ( const jsoncons::json &  inputjson)
staticinherited
Parameters
inputjsonjson input with "Program Type" key
Returns
pointer to base NemDriver class

Definition at line 37 of file NemDriver.C.

Referenced by NEM::DRV::MeshGenDriver::MeshGenDriver().

37  {
38  return inputjson.as<std::unique_ptr<NemDriver>>();
39 }

◆ setFiles()

void NEM::DRV::SurfacePackMeshDriver::setFiles ( Files  files)

Definition at line 55 of file SurfacePackMeshDriver.C.

References files_.

55  {
56  this->files_ = std::move(files);
57 }

◆ setOpts()

void NEM::DRV::SurfacePackMeshDriver::setOpts ( Opts  opts)

Definition at line 63 of file SurfacePackMeshDriver.C.

References NEM::DRV::SurfacePackMeshDriver::Opts::meshAlgorithm, opts_, and NEM::DRV::SurfacePackMeshDriver::Opts::periodic3DOpts.

63  {
64  if (opts.periodic3DOpts.has_value()) {
65  const auto &periodic3DOpts = opts.periodic3DOpts.value();
66  if (!(opts.meshAlgorithm == 1 || opts.meshAlgorithm == 4 ||
67  opts.meshAlgorithm == 7 || opts.meshAlgorithm == 9 ||
68  opts.meshAlgorithm == 10)) {
69  std::cerr << "Valid choices for 3D meshing algorithm are "
70  << " 1 (Delunay), 4 (Frontal), 7 (MMG3D), 9 (R-Tree), 10 (HXT)"
71  << std::endl;
72  throw;
73  }
74  if (!(periodic3DOpts.elemOrder == 1 || periodic3DOpts.elemOrder == 2)) {
75  std::cerr << "Only element orders 1 and 2 are supported!" << std::endl;
76  throw;
77  }
78  } else {
79  if (opts.meshAlgorithm == 1 || opts.meshAlgorithm == 2 ||
80  opts.meshAlgorithm == 5 || opts.meshAlgorithm == 6 ||
81  opts.meshAlgorithm == 7 || opts.meshAlgorithm == 8 ||
82  opts.meshAlgorithm == 9) {
83  } else {
84  std::cerr
85  << "Valid choices for 2D meshing algorithm are "
86  << " 1 (MeshAdapt), 2 (Automatic), 5 (Delunay), "
87  << " 6 (Frontal Delunay), 7 (BAMG), 8 (Frontal Delunay for Quads)"
88  << " 9 (Packing of Parallelograms)." << std::endl;
89  throw;
90  }
91  }
92  this->opts_ = std::move(opts);
93 }

Member Data Documentation

◆ files_

Files NEM::DRV::SurfacePackMeshDriver::files_
private

Definition at line 156 of file SurfacePackMeshDriver.H.

Referenced by execute(), getFiles(), and setFiles().

◆ opts_

Opts NEM::DRV::SurfacePackMeshDriver::opts_
private

Definition at line 157 of file SurfacePackMeshDriver.H.

Referenced by execute(), getOpts(), and setOpts().


The documentation for this class was generated from the following files: