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::OmegahRefineDriver Class Reference

Detailed Description

Definition at line 41 of file OmegahRefineDriver.H.

Classes

struct  Opts
 
struct  Transfer
 
struct  VarCompare
 

Public Types

using Files = DriverInOutFiles
 

Public Member Functions

 OmegahRefineDriver (Files files, Opts opts)
 
const Opts & getOpts () const
 
void setOpts (Opts opts)
 
void execute () const override
 Run the workflow represented by the driver. More...
 
virtual const Files & getFiles () const
 
virtual void setFiles (Files files)
 

Static Public Member Functions

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

Protected Attributes

Files files_
 

Private Member Functions

 OmegahRefineDriver ()
 

Private Attributes

Opts opts_
 

Inherits NEM::DRV::RefineDriver.

Member Typedef Documentation

◆ Files

Definition at line 42 of file RefineDriver.H.

Constructor & Destructor Documentation

◆ OmegahRefineDriver() [1/2]

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

Definition at line 54 of file OmegahRefineDriver.C.

55  : RefineDriver(std::move(files)), opts_(std::move(opts)) {}
RefineDriver(Files files)
Definition: RefineDriver.C:34

◆ OmegahRefineDriver() [2/2]

NEM::DRV::OmegahRefineDriver::OmegahRefineDriver ( )
private

Definition at line 57 of file OmegahRefineDriver.C.

58  : OmegahRefineDriver({{}, {}}, Opts{{}}) {}

Member Function Documentation

◆ execute()

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

Implements NEM::DRV::NemDriver.

Definition at line 66 of file OmegahRefineDriver.C.

References NEM::DRV::OmegahRefineDriver::Opts::ElementCountOverRelaxation, NEM::DRV::RefineDriver::files_, NEM::DRV::OmegahRefineDriver::Opts::GradationConvergenceTolerance, NEM::DRV::DriverInOutFiles::inputMeshFile, NEM::DRV::OmegahRefineDriver::Opts::LengthHistogramMax, NEM::DRV::OmegahRefineDriver::Opts::LengthHistogramMin, NEM::DRV::OmegahRefineDriver::Opts::MaxElementCount, NEM::DRV::OmegahRefineDriver::Opts::MaxGradationRate, NEM::DRV::OmegahRefineDriver::Opts::MaxLength, NEM::DRV::OmegahRefineDriver::Opts::MaxLengthAllowed, NEM::DRV::OmegahRefineDriver::Opts::MaxLengthDesired, NEM::DRV::OmegahRefineDriver::Opts::MetricSources, NEM::DRV::OmegahRefineDriver::Opts::MinElementCount, NEM::DRV::OmegahRefineDriver::Opts::MinLength, NEM::DRV::OmegahRefineDriver::Opts::MinLengthDesired, NEM::DRV::OmegahRefineDriver::Opts::MinQualityAllowed, NEM::DRV::OmegahRefineDriver::Opts::MinQualityDesired, NEM::MSH::New(), NEM::DRV::OmegahRefineDriver::Opts::NlengthHistogramBins, NEM::DRV::OmegahRefineDriver::Opts::NqualityHistogramBins, NEM::DRV::OmegahRefineDriver::Opts::NsliverLayers, NEM::DRV::OmegahRefineDriver::Opts::NsmoothingSteps, opts_, NEM::DRV::DriverInOutFiles::outputMeshFile, NEM::MSH::Read(), NEM::DRV::OmegahRefineDriver::Opts::reconstructGeo, NEM::DRV::OmegahRefineDriver::Opts::ShouldCoarsen, NEM::DRV::OmegahRefineDriver::Opts::ShouldCoarsenSlivers, NEM::DRV::OmegahRefineDriver::Opts::ShouldLimitElementCount, NEM::DRV::OmegahRefineDriver::Opts::ShouldLimitGradation, NEM::DRV::OmegahRefineDriver::Opts::ShouldLimitLengths, NEM::DRV::OmegahRefineDriver::Opts::ShouldPreventCoarsenFlip, NEM::DRV::OmegahRefineDriver::Opts::ShouldRefine, NEM::DRV::OmegahRefineDriver::Opts::ShouldSwap, NEM::DRV::OmegahRefineDriver::Opts::TransferOpts, NEM::DRV::OmegahRefineDriver::Opts::TransferOptsIntegralDiffuse, NEM::DRV::OmegahRefineDriver::Opts::Verbose, and NEM::DRV::OmegahRefineDriver::Opts::Verbosity.

66  {
67  auto inMesh = vtkSmartPointer<NEM::MSH::geoMeshBase>::Take(
69  if (this->opts_.reconstructGeo) {
70  inMesh->reconstructGeo();
71  }
72  vtkSmartPointer<NEM::MSH::oshGeoMesh> osh_mesh =
74  osh_mesh->takeGeoMesh(inMesh);
75 
76  // Pass through omegahRefineSrv
77  vtkSmartPointer<NEM::SRV::omegahRefineSrv> orSrv =
79  orSrv->AddInputDataObject(osh_mesh);
80 
81  // Set metric input options
82  if (this->opts_.Verbose) orSrv->SetVerbose(this->opts_.Verbose.value());
83  for (const auto &ms : this->opts_.MetricSources)
84  orSrv->AddMetricSource(ms.type, ms.knob, ms.tag_name, ms.isotropy,
85  ms.scales);
86  if (this->opts_.ShouldLimitLengths)
87  orSrv->SetShouldLimitLengths(this->opts_.ShouldLimitLengths.value());
88  if (this->opts_.MaxLength) orSrv->SetMaxLength(this->opts_.MaxLength.value());
89  if (this->opts_.MinLength) orSrv->SetMinLength(this->opts_.MinLength.value());
90  if (this->opts_.ShouldLimitGradation)
91  orSrv->SetShouldLimitGradation(this->opts_.ShouldLimitGradation.value());
92  if (this->opts_.MaxGradationRate)
93  orSrv->SetMaxGradationRate(this->opts_.MaxGradationRate.value());
95  orSrv->SetGradationConvergenceTolerance(
96  this->opts_.GradationConvergenceTolerance.value());
98  orSrv->SetShouldLimitElementCount(
99  this->opts_.ShouldLimitElementCount.value());
100  if (this->opts_.MaxElementCount)
101  orSrv->SetMaxElementCount(this->opts_.MaxElementCount.value());
102  if (this->opts_.MinElementCount)
103  orSrv->SetMinElementCount(this->opts_.MinElementCount.value());
105  orSrv->SetElementCountOverRelaxation(
106  this->opts_.ElementCountOverRelaxation.value());
107  if (this->opts_.NsmoothingSteps)
108  orSrv->SetNsmoothingSteps(this->opts_.NsmoothingSteps.value());
109 
110  // Set adapt options
111  if (this->opts_.MinLengthDesired)
112  orSrv->SetMinLengthDesired(this->opts_.MinLengthDesired.value());
113  if (this->opts_.MaxLengthDesired)
114  orSrv->SetMaxLengthDesired(this->opts_.MaxLengthDesired.value());
115  if (this->opts_.MaxLengthAllowed)
116  orSrv->SetMaxLengthAllowed(this->opts_.MaxLengthAllowed.value());
117  if (this->opts_.MinQualityAllowed)
118  orSrv->SetMinQualityAllowed(this->opts_.MinQualityAllowed.value());
119  if (this->opts_.MinQualityDesired)
120  orSrv->SetMinQualityDesired(this->opts_.MinQualityDesired.value());
121  if (this->opts_.NsliverLayers)
122  orSrv->SetNsliverLayers(this->opts_.NsliverLayers.value());
123  if (this->opts_.Verbosity) orSrv->SetVerbosity(this->opts_.Verbosity.value());
124  if (this->opts_.LengthHistogramMin)
125  orSrv->SetLengthHistogramMin(this->opts_.LengthHistogramMin.value());
126  if (this->opts_.LengthHistogramMax)
127  orSrv->SetLengthHistogramMax(this->opts_.LengthHistogramMax.value());
128  if (this->opts_.NlengthHistogramBins)
129  orSrv->SetNlengthHistogramBins(this->opts_.NlengthHistogramBins.value());
130  if (this->opts_.NqualityHistogramBins)
131  orSrv->SetNqualityHistogramBins(this->opts_.NqualityHistogramBins.value());
132  if (this->opts_.ShouldRefine)
133  orSrv->SetShouldRefine(this->opts_.ShouldRefine.value());
134  if (this->opts_.ShouldCoarsen)
135  orSrv->SetShouldCoarsen(this->opts_.ShouldCoarsen.value());
136  if (this->opts_.ShouldSwap)
137  orSrv->SetShouldSwap(this->opts_.ShouldSwap.value());
138  if (this->opts_.ShouldCoarsenSlivers)
139  orSrv->SetShouldCoarsenSlivers(this->opts_.ShouldCoarsenSlivers.value());
141  orSrv->SetShouldPreventCoarsenFlip(
142  this->opts_.ShouldPreventCoarsenFlip.value());
143 
144  // Add transfer options
145  for (const auto &xfer : this->opts_.TransferOpts) {
146  if (xfer.integralName) {
147  orSrv->AddTransferOpts(xfer.arrayName, xfer.method,
148  xfer.integralName.value());
149  } else {
150  orSrv->AddTransferOpts(xfer.arrayName, xfer.method);
151  }
152  }
153  for (const auto &xfer : this->opts_.TransferOptsIntegralDiffuse)
154  orSrv->AddTransferOptsIntegralDiffuse(xfer.integralName, xfer.type,
155  xfer.tolerance, xfer.floor);
156 
157  orSrv->Update();
158 
159  // Populate the output mesh
160  auto outMesh = vtkSmartPointer<NEM::MSH::geoMeshBase>::Take(
162  outMesh->takeGeoMesh(orSrv->GetOutput());
163  outMesh->write(this->files_.outputMeshFile);
164 }
jsoncons::optional< bool > ShouldLimitElementCount
std::vector< VarCompare > TransferOptsIntegralDiffuse
std::string outputMeshFile
Definition: NemDriver.H:91
jsoncons::optional< Omega_h::Real > MaxLengthDesired
jsoncons::optional< bool > ShouldLimitGradation
jsoncons::optional< Omega_h::Int > NqualityHistogramBins
jsoncons::optional< Omega_h::Real > MinQualityAllowed
geoMeshBase * Read(const std::string &fileName)
Read a mesh from file.
jsoncons::optional< Omega_h::Real > LengthHistogramMax
geoMeshBase * New(MeshType meshType)
Create a new mesh object.
jsoncons::optional< bool > ShouldRefine
jsoncons::optional< std::string > Verbosity
jsoncons::optional< Omega_h::Real > MinQualityDesired
jsoncons::optional< Omega_h::Real > MinElementCount
jsoncons::optional< Omega_h::Int > NlengthHistogramBins
jsoncons::optional< bool > ShouldSwap
jsoncons::optional< Omega_h::Real > MaxLengthAllowed
jsoncons::optional< bool > ShouldCoarsenSlivers
jsoncons::optional< bool > ShouldCoarsen
jsoncons::optional< bool > ShouldLimitLengths
jsoncons::optional< Omega_h::Real > MinLength
jsoncons::optional< Omega_h::Real > GradationConvergenceTolerance
jsoncons::optional< Omega_h::Real > MaxGradationRate
std::string inputMeshFile
Definition: NemDriver.H:90
jsoncons::optional< bool > Verbose
std::vector< Transfer > TransferOpts
jsoncons::optional< Omega_h::Real > MaxElementCount
jsoncons::optional< Omega_h::Int > NsliverLayers
jsoncons::optional< Omega_h::Real > LengthHistogramMin
jsoncons::optional< Omega_h::Real > MinLengthDesired
std::vector< NEM::SRV::omegahRefineMetricSource > MetricSources
jsoncons::optional< Omega_h::Real > MaxLength
jsoncons::optional< Omega_h::Real > ElementCountOverRelaxation
jsoncons::optional< Omega_h::Int > NsmoothingSteps
jsoncons::optional< bool > ShouldPreventCoarsenFlip

◆ getFiles()

const RefineDriver::Files & NEM::DRV::RefineDriver::getFiles ( ) const
virtualinherited

Definition at line 40 of file RefineDriver.C.

References NEM::DRV::RefineDriver::files_.

40  {
41  return files_;
42 }

◆ getOpts()

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

Definition at line 60 of file OmegahRefineDriver.C.

References opts_.

60  {
61  return opts_;
62 }

◆ 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::RefineDriver::setFiles ( Files  files)
virtualinherited

Definition at line 44 of file RefineDriver.C.

References NEM::DRV::RefineDriver::files_.

44  {
45  this->files_ = std::move(files);
46 }

◆ setOpts()

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

Definition at line 64 of file OmegahRefineDriver.C.

References opts_.

64 { this->opts_ = std::move(opts); }

Member Data Documentation

◆ files_

◆ opts_

Opts NEM::DRV::OmegahRefineDriver::opts_
private

Definition at line 115 of file OmegahRefineDriver.H.

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


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