31 #include <vtkInformation.h> 32 #include <vtkInformationVector.h> 33 #include <vtkObjectFactory.h> 34 #include <Omega_h_adapt.hpp> 35 #include <Omega_h_class.hpp> 43 if (verbosity ==
"Silent")
44 return Omega_h::SILENT;
45 else if (verbosity ==
"Each Adapt")
46 return Omega_h::EACH_ADAPT;
47 else if (verbosity ==
"Each Rebuild")
48 return Omega_h::EACH_REBUILD;
49 else if (verbosity ==
"Extra Stats")
50 return Omega_h::EXTRA_STATS;
52 std::cerr << verbosity <<
" is not a recognized verbosity level" << std::endl;
57 Omega_h::Real tolerance,
58 Omega_h::Real floor) {
61 else if (type ==
"Relative")
62 return {Omega_h::VarCompareOpts::RELATIVE, tolerance, floor};
63 else if (type ==
"Absolute")
64 return {Omega_h::VarCompareOpts::ABSOLUTE, tolerance, floor};
66 std::cerr << type <<
" is not a recognized variable compare type" 74 this->SetNumberOfInputPorts(1);
75 this->SetNumberOfOutputPorts(1);
76 std::cout <<
"omegahRefineSrv constructed" << std::endl;
80 std::cout <<
"omegahRefineSrv destructed" << std::endl;
84 vtkInformation *info) {
85 info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(),
"oshGeoMesh");
90 vtkInformation *info) {
91 info->Set(vtkDataObject::DATA_TYPE_NAME(),
"oshGeoMesh");
96 vtkInformationVector **inputVector,
97 vtkInformationVector *outputVector) {
99 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
100 vtkInformation *outInfo = outputVector->GetInformationObject(0);
105 MSH::oshGeoMesh::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
107 MSH::oshGeoMesh::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
109 Omega_h::Mesh oshOutput = input->
getOshMesh();
111 if (!input->
getOshMesh().is_valid())
return 0;
114 Omega_h::finalize_classification(&oshOutput);
117 Omega_h::MetricInput metricInput;
118 metricInput.verbose = this->
Verbose;
120 metricInput.add_source(
121 {ms.type, ms.knob, ms.tag_name, ms.isotropy, ms.scales});
129 metricInput.gradation_convergence_tolerance =
137 metricInput.element_count_over_relaxation =
143 if (!this->MetricSources.empty())
144 Omega_h::generate_target_metric_tag(&oshOutput, metricInput);
145 Omega_h::add_implied_metric_tag(&oshOutput);
148 Omega_h::AdaptOpts adaptOpts(&oshOutput);
176 std::map<std::string, Omega_h_Transfer> transferMap;
177 const std::set<std::string> reservedTagsPoints{
178 "class_id",
"class_dim",
"momentum_velocity_fixed",
"coordinates",
179 "warp",
"metric",
"target_metric",
"global"};
180 for (Omega_h::Int i = 0; i < oshOutput.ntags(0); ++i) {
181 auto tag = oshOutput.get_tag(0, i);
182 if (reservedTagsPoints.find(tag->name()) == reservedTagsPoints.end()) {
184 for (Omega_h::Int j = 1; j < oshOutput.dim(); ++j) {
185 if (!oshOutput.has_tag(j, tag->name())) {
190 transferMap[tag->name()] = OMEGA_H_INHERIT;
191 }
else if (tag->type() == OMEGA_H_REAL) {
192 transferMap[tag->name()] = OMEGA_H_LINEAR_INTERP;
196 const std::set<std::string> reservedTagsCells{
"class_id",
"class_dim",
198 for (Omega_h::Int i = 0; i < oshOutput.ntags(oshOutput.dim()); ++i) {
199 auto tag = oshOutput.get_tag(oshOutput.dim(), i);
200 if (tag->type() == OMEGA_H_REAL &&
201 reservedTagsCells.find(tag->name()) == reservedTagsCells.end()) {
202 auto it = transferMap.find(tag->name());
203 if (it == transferMap.end()) {
204 transferMap[tag->name()] = OMEGA_H_POINTWISE;
208 adaptOpts.xfer_opts.type_map = transferMap;
214 idm.second.type, idm.second.tolerance, idm.second.floor);
222 Omega_h::adapt(&oshOutput, adaptOpts);
226 }
while (Omega_h::approach_metric(&oshOutput, adaptOpts));
228 output->setOshMesh(&oshOutput);
A concrete implementation of geoMeshBase representing a Omega_h::Mesh.
Omega_h::Real MinLengthDesired
std::vector< omegahRefineMetricSource > MetricSources
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
std::map< std::string, omegahRefineVarCompareOpts > TransferOptsIntegralDiffuseMap
Omega_h::Real MaxLengthAllowed
Omega_h::Real LengthHistogramMin
Omega_h::Real MinQualityDesired
Omega_h::Real MaxLengthDesired
Omega_h::Int NqualityHistogramBins
std::map< std::string, std::string > TransferOptsIntegralMap
bool ShouldCoarsenSlivers
Omega_h::Real MinElementCount
const Omega_h::Mesh & getOshMesh() const
Get the Omega_h::Mesh.
Omega_h::Real MaxElementCount
int FillOutputPortInformation(int port, vtkInformation *info) override
vtkStandardNewMacro(NucMeshSrv)
int FillInputPortInformation(int port, vtkInformation *info) override
Omega_h::Real MaxGradationRate
bool ShouldLimitGradation
std::map< std::string, Omega_h_Transfer > TransferOptsTypeMap
Omega_h::VarCompareOpts ParseVarCompareOpts(const std::string &type, Omega_h::Real tolerance, Omega_h::Real floor)
Omega_h::Real MinQualityAllowed
bool ShouldLimitElementCount
Omega_h::Real GradationConvergenceTolerance
~omegahRefineSrv() override
Omega_h::Verbosity ParseVerbosity(const std::string &verbosity)
A service to use the Omega_h library for refinement.
Omega_h::Real LengthHistogramMax
Omega_h::Int NsliverLayers
Omega_h::Int NlengthHistogramBins
bool ShouldPreventCoarsenFlip
Omega_h::Real ElementCountOverRelaxation
Omega_h::Int NsmoothingSteps