26int main(
int argc,
char *argv[]) {
30 DMType dm_name =
"DMMOFEM";
33 moab::Core coarse_core;
34 moab::Interface &coarse_moab = coarse_core;
39 moab::Interface &fine_moab = fine_core;
42 char coarse_file[255] =
"coarse.h5m";
43 char surface_file[255] =
"surface.h5m";
44 char output_file[255] =
"out_geometry_fit.h5m";
45 char output_postproc[255] =
"geometry_fit_postproc.h5m";
46 double planar_angle_deg = 2.0;
47 double max_disp_factor = 0.3;
48 PetscBool write_postproc = PETSC_TRUE;
49 PetscBool debug_surfaces = PETSC_FALSE;
52 PetscOptionsBegin(m_field.
get_comm(),
"",
"geometry fit tool",
"none");
53 CHKERR PetscOptionsString(
"-coarse_file",
"coarse 3d mesh file name",
"",
54 coarse_file, coarse_file, 255, PETSC_NULLPTR);
55 CHKERR PetscOptionsString(
"-surface_file",
"fine surface mesh file name",
56 "", surface_file, surface_file, 255,
58 CHKERR PetscOptionsString(
"-output_file",
"output mesh file name",
"",
59 output_file, output_file, 255, PETSC_NULLPTR);
60 CHKERR PetscOptionsString(
"-output_postproc",
61 "output postprocess mesh file name",
"",
62 output_postproc, output_postproc, 255,
66 "angle threshold in degrees to skip planar edges",
"",
67 planar_angle_deg, &planar_angle_deg, PETSC_NULLPTR);
69 "-max_midnode_disp_factor",
70 "skip adjustment if |delta| > factor * edge length",
"",
71 max_disp_factor, &max_disp_factor, PETSC_NULLPTR);
72 CHKERR PetscOptionsBool(
"-write_postproc",
73 "write postprocess mesh output",
"",
74 write_postproc, &write_postproc, PETSC_NULLPTR);
75 CHKERR PetscOptionsBool(
"-debug",
76 "dump intermediate fine-surface feature VTKs",
"",
77 debug_surfaces, &debug_surfaces, PETSC_NULLPTR);
87 CHKERR fine_moab.load_file(surface_file);
91 CHKERR coarse_moab.get_entities_by_dimension(0, 3, coarse_vols);
92 if (coarse_vols.empty()) {
94 "no 3d entities found in coarse mesh");
101 CHKERR fine_moab.get_entities_by_dimension(0, 3, fine_vols);
102 if (!fine_vols.empty()) {
103 Skinner fine_skinner(&fine_moab);
104 CHKERR fine_skinner.find_skin(0, fine_vols,
false, fine_tris);
106 CHKERR fine_moab.get_entities_by_dimension(0, 2, fine_tris);
108 if (fine_tris.empty()) {
110 "no surface triangles found in fine mesh");
113 bool has_geometry =
false;
119 simple->addDomainField(
"GEOMETRY",
H1, base, 3);
130 m_field, fine_moab, fine_tris,
"GEOMETRY", planar_angle_deg,
131 max_disp_factor, debug_surfaces);
135 CHKERR coarse_moab.write_file(output_file);
136 MOFEM_LOG(
"WORLD", Sev::inform) <<
"Wrote file " << output_file;
137 if (write_postproc) {
140 auto post_proc_mesh = boost::make_shared<moab::Core>();
141 auto post_proc_begin =
142 boost::make_shared<PostProcBrokenMeshInMoabBaseBegin>(m_field,
144 auto post_proc_end = boost::make_shared<PostProcBrokenMeshInMoabBaseEnd>(
145 m_field, post_proc_mesh);
150 boost::make_shared<PostProcEleDomain>(m_field, post_proc_mesh);
153 auto x_ptr = boost::make_shared<MatrixDouble>();
154 post_proc_fe->getOpPtrVector().push_back(
157 post_proc_fe->getOpPtrVector().push_back(
new OpPPMap(
158 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(), {},
159 {{
"GEOMETRY", x_ptr}}, {}, {}));
161 pip->getDomainRhsFE() = post_proc_fe;
164 post_proc_begin->getFEMethod());
165 CHKERR pip->loopFiniteElements();
167 post_proc_end->getFEMethod());
168 CHKERR post_proc_end->writeFile(output_postproc);
170 <<
"Wrote postprocess mesh " << output_postproc;
Post-process fields on refined mesh.
virtual MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)=0
Make a loop over dofs.
Post post-proc data at points from hash maps.