diff --git a/include/geom/cell_inf_hex.h b/include/geom/cell_inf_hex.h index 4cab6435fb2..c2a2ce2a2ed 100644 --- a/include/geom/cell_inf_hex.h +++ b/include/geom/cell_inf_hex.h @@ -127,7 +127,7 @@ class InfHex : public InfCell /** * We number faces last. */ - virtual bool is_face(const unsigned int i) const override final { return (i >= 12 && i < 16); } + virtual bool is_face(const unsigned int i) const override final { return (i >= 12 && i < 17); } /** * \returns \p true if the specified child is on the diff --git a/include/geom/cell_inf_prism.h b/include/geom/cell_inf_prism.h index eaf49925c90..ba178872ade 100644 --- a/include/geom/cell_inf_prism.h +++ b/include/geom/cell_inf_prism.h @@ -110,12 +110,12 @@ class InfPrism : public InfCell /** * We number edges next. */ - virtual bool is_edge(const unsigned int i) const override final { return (i > 6 && i < 9); } + virtual bool is_edge(const unsigned int i) const override final { return (i >= 6 && i < 9); } /** * We number faces last. */ - virtual bool is_face(const unsigned int i) const override final { return (i > 9 && i < 12); } + virtual bool is_face(const unsigned int i) const override final { return (i >= 9 && i < 12); } /** * \returns \p true if the specified (local) node number is a diff --git a/include/geom/elem.h b/include/geom/elem.h index c1b02425019..bc6eec403ad 100644 --- a/include/geom/elem.h +++ b/include/geom/elem.h @@ -738,6 +738,11 @@ class Elem : public ReferenceCountedObject, */ virtual bool is_face(const unsigned int i) const = 0; + /** + * \returns \p true if the specified (local) node number is an internal node. + */ + bool is_internal(const unsigned int i) const; + /** * \returns \p true if the specified (local) node number is on the * specified side. diff --git a/src/geom/elem.C b/src/geom/elem.C index c7ac2b2931a..eaafc58d250 100644 --- a/src/geom/elem.C +++ b/src/geom/elem.C @@ -3197,4 +3197,27 @@ void Elem::swap2boundaryedges(unsigned short e1, boundary_info->add_edge(this, e1, ids2); } +bool +Elem::is_internal(const unsigned int i) const +{ + switch (this->dim()) + { + case 0: + return false; + + case 1: + return !this->is_vertex(i); + + case 2: + return !this->is_vertex(i) && !this->is_edge(i); + + case 3: + return !this->is_vertex(i) && !this->is_edge(i) && !this->is_face(i); + + default: + libmesh_error_msg("impossible element dimension " << std::to_string(this->dim())); + return 0; + } +} + } // namespace libMesh diff --git a/src/geom/face_tri7.C b/src/geom/face_tri7.C index 98e875e13db..f93748e7a22 100644 --- a/src/geom/face_tri7.C +++ b/src/geom/face_tri7.C @@ -128,7 +128,7 @@ bool Tri7::is_vertex(const unsigned int i) const bool Tri7::is_edge(const unsigned int i) const { - if (i < 3) + if (i < 3 || i == 6) return false; return true; } diff --git a/tests/geom/elem_test.C b/tests/geom/elem_test.C index c0b7255cb59..64b2b5e626b 100644 --- a/tests/geom/elem_test.C +++ b/tests/geom/elem_test.C @@ -636,6 +636,34 @@ public: test_n_refinements(2); } + void test_is_internal() + { + LOG_UNIT_TEST; + + for (const auto & elem : + this->_mesh->active_local_element_ptr_range()) + for (const auto nd : elem->node_index_range()) + { + if ((elem->type() == EDGE3 || elem->type() == EDGE4) && nd >= 2) + CPPUNIT_ASSERT(elem->is_internal(nd)); + else if (elem->type() == HEX27 && nd == 26) + CPPUNIT_ASSERT(elem->is_internal(nd)); + else if (elem->type() == PRISM21 && nd == 20) + CPPUNIT_ASSERT(elem->is_internal(nd)); + else if ((elem->type() == QUAD9 || elem->type() == QUADSHELL9) && nd == 8) + CPPUNIT_ASSERT(elem->is_internal(nd)); + else if (elem->type() == TRI7 && nd == 6) + CPPUNIT_ASSERT(elem->is_internal(nd)); + else if (elem->type() == INFHEX18 && nd == 17) + CPPUNIT_ASSERT(elem->is_internal(nd)); + else if (elem->type() == INFQUAD6 && nd == 5) + CPPUNIT_ASSERT(elem->is_internal(nd)); + else + CPPUNIT_ASSERT(!elem->is_internal(nd)); + } + } + + }; #define ELEMTEST \ @@ -651,8 +679,9 @@ public: CPPUNIT_TEST( test_center_node_on_side ); \ CPPUNIT_TEST( test_side_type ); \ CPPUNIT_TEST( test_elem_side_builder ); \ - CPPUNIT_TEST( test_refinement); \ - CPPUNIT_TEST( test_double_refinement); + CPPUNIT_TEST( test_refinement ); \ + CPPUNIT_TEST( test_double_refinement ); \ + CPPUNIT_TEST( test_is_internal ) #define INSTANTIATE_ELEMTEST(elemtype) \ class ElemTest_##elemtype : public ElemTest { \