Skip to content

Commit 9038a11

Browse files
committed
Added MeshTetInterface verbosity option
1 parent f5c7f9a commit 9038a11

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

include/mesh/mesh_tet_interface.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,23 @@ class MeshTetInterface
9292
*/
9393
virtual void triangulate () = 0;
9494

95+
/**
96+
* Sets a verbosity level, defaulting to 0 (print nothing), to be
97+
* set as high as 100 (print everything).
98+
*
99+
* For verbosity >= 50, print all detected surface mesh integrity
100+
* issues as they're found. Subclasses may add other output at
101+
* other verbosity levels.
102+
*/
103+
void set_verbosity(unsigned int v);
104+
95105
protected:
96106

107+
/**
108+
* verbosity setting
109+
*/
110+
const unsigned int _verbosity;
111+
97112
/**
98113
* Remove volume elements from the given mesh, after converting
99114
* their outer boundary faces to surface elements.

src/mesh/mesh_tet_interface.C

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ namespace libMesh
112112
//----------------------------------------------------------------------
113113
// MeshTetInterface class members
114114
MeshTetInterface::MeshTetInterface (UnstructuredMesh & mesh) :
115-
_desired_volume(0), _smooth_after_generating(false),
115+
_verbosity(0), _desired_volume(0), _smooth_after_generating(false),
116116
_elem_type(TET4), _mesh(mesh)
117117
{
118118
}
@@ -350,14 +350,20 @@ std::set<MeshTetInterface::SurfaceIntegrity> MeshTetInterface::check_hull_integr
350350
{
351351
// Check for proper element type
352352
if (elem->type() != TRI3)
353-
returnval.insert(NON_TRI3);
353+
{
354+
if (this->_verbosity >= 50)
355+
std::cerr << "Non-Tri3: " << elem->get_info() << std::endl;
356+
returnval.insert(NON_TRI3);
357+
}
354358

355359
for (auto s : elem->side_index_range())
356360
{
357361
const Elem * const neigh = elem->neighbor_ptr(s);
358362

359363
if (neigh == nullptr)
360364
{
365+
if (this->_verbosity >= 50)
366+
std::cerr << "Element missing neighbor " << s << ": " << elem->get_info() << std::endl;
361367
returnval.insert(MISSING_NEIGHBOR);
362368
continue;
363369
}
@@ -367,6 +373,8 @@ std::set<MeshTetInterface::SurfaceIntegrity> MeshTetInterface::check_hull_integr
367373

368374
if (nn >= 3)
369375
{
376+
if (this->_verbosity >= 50)
377+
std::cerr << "Element missing backlink " << s << ": " << elem->get_info() << std::endl;
370378
returnval.insert(MISSING_BACKLINK);
371379
continue;
372380
}
@@ -380,6 +388,8 @@ std::set<MeshTetInterface::SurfaceIntegrity> MeshTetInterface::check_hull_integr
380388
const unsigned int i2 = neigh->local_node(n2->id());
381389
if (i1 >= 3 || i2 >= 3)
382390
{
391+
if (this->_verbosity >= 50)
392+
std::cerr << "Element with bad neighbor " << s << " nodes: " << elem->get_info() << std::endl;
383393
returnval.insert(BAD_NEIGHBOR_NODES);
384394
continue;
385395
}
@@ -388,6 +398,8 @@ std::set<MeshTetInterface::SurfaceIntegrity> MeshTetInterface::check_hull_integr
388398
// (because they have the same orientation we do)
389399
if ((i2 + 1)%3 != i1)
390400
{
401+
if (this->_verbosity >= 50)
402+
std::cerr << "Element orientation mismatch with neighbor " << s << ": " << elem->get_info() << std::endl;
391403
returnval.insert(NON_ORIENTED);
392404
continue;
393405
}
@@ -396,6 +408,8 @@ std::set<MeshTetInterface::SurfaceIntegrity> MeshTetInterface::check_hull_integr
396408
// places relative to its neighbor link
397409
if (i2 != nn)
398410
{
411+
if (this->_verbosity >= 50)
412+
std::cerr << "Element with bad links on neighbor " << s << ": " << elem->get_info() << std::endl;
399413
returnval.insert(BAD_NEIGHBOR_LINKS);
400414
continue;
401415
}

0 commit comments

Comments
 (0)