Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/t8_schemes/t8_default/t8_default_hex/t8_default_hex.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,24 @@ class t8_default_scheme_hex: public t8_default_scheme_common<t8_default_scheme_h
int
element_face_get_parent_face (const t8_element_t *elem, int face) const;

/** Given an element and a face of an element as well as an ancestor of the element
* that has a face that is an ancestor of the given face, compute the corresponding face number of the ancestor element.
*
* \param [in] tree_class The eclass of the current tree.
* \param [in] elem An element.
* \param [in] face Then number of a face of \a element.
* \param [in] ancestor An ancestor of \a element that has a common face with \a face. (Could be \a element itself).
* \return The face number \a f_a corresponding to the face of with \a face is a asubface.
* <0 on failure.
*/
inline int
element_face_get_ancestor_face (const t8_element_t *elem, const int face, const t8_element_t *ancestor) const
{
// For Hex elements the face number does not change when refining.
T8_ASSERT (is_ancestor (ancestor, elem));
return face;
}

/** Given an element and a face of this element. If the face lies on the
* tree boundary, return the face number of the tree face.
* If not the return value is arbitrary.
Expand Down
21 changes: 21 additions & 0 deletions src/t8_schemes/t8_default/t8_default_line/t8_default_line.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,27 @@ class t8_default_scheme_line: public t8_default_scheme_common<t8_default_scheme_
int
element_face_get_parent_face (const t8_element_t *elem, int face) const;

/** Given an element and a face of an element as well as an ancestor of the element
* that has a face that is an ancestor of the given face, compute the corresponding face number of the ancestor element.
*
* \param [in] tree_class The eclass of the current tree.
* \param [in] elem An element.
* \param [in] face Then number of a face of \a element.
* \param [in] ancestor An ancestor of \a element that has a common face with \a face. (Could be \a element itself).
* \return The face number \a f_a corresponding to the face of with \a face is a asubface.
* <0 on failure.
*/
inline int
element_face_get_ancestor_face (const t8_element_t *elem, const int face, const t8_element_t *ancestor) const
{
// For Line elements the face number does not change when refining.
T8_ASSERT (element_is_valid (elem));
T8_ASSERT (element_is_valid (ancestor));
T8_ASSERT (0 <= face && face < element_get_num_face (elem));
T8_ASSERT (is_ancestor (ancestor, elem));
return face;
}

/** Given an element and a face of this element. If the face lies on the
* tree boundary, return the face number of the tree face.
* If not the return value is arbitrary.
Expand Down
21 changes: 21 additions & 0 deletions src/t8_schemes/t8_default/t8_default_prism/t8_default_prism.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,27 @@ class t8_default_scheme_prism: public t8_default_scheme_common<t8_default_scheme
int
element_face_get_parent_face (const t8_element_t *elem, int face) const;

/** Given an element and a face of an element as well as an ancestor of the element
* that has a face that is an ancestor of the given face, compute the corresponding face number of the ancestor element.
*
* \param [in] tree_class The eclass of the current tree.
* \param [in] elem An element.
* \param [in] face Then number of a face of \a element.
* \param [in] ancestor An ancestor of \a element that has a common face with \a face. (Could be \a element itself).
* \return The face number \a f_a corresponding to the face of with \a face is a asubface.
* <0 on failure.
*/
inline int
element_face_get_ancestor_face (const t8_element_t *elem, const int face, const t8_element_t *ancestor) const
{
// For Prism elements the face number does not change when refining.
T8_ASSERT (element_is_valid (elem));
T8_ASSERT (element_is_valid (ancestor));
T8_ASSERT (0 <= face && face < element_get_num_face (elem));
T8_ASSERT (is_ancestor (ancestor, elem));
return face;
}

/** Given an element and a face of this element. If the face lies on the
* tree boundary, return the face number of the tree face.
* If not the return value is arbitrary.
Expand Down
21 changes: 21 additions & 0 deletions src/t8_schemes/t8_default/t8_default_quad/t8_default_quad.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,27 @@ class t8_default_scheme_quad: public t8_default_scheme_common<t8_default_scheme_
int
element_face_get_parent_face (const t8_element_t *elem, int face) const;

/** Given an element and a face of an element as well as an ancestor of the element
* that has a face that is an ancestor of the given face, compute the corresponding face number of the ancestor element.
*
* \param [in] tree_class The eclass of the current tree.
* \param [in] elem An element.
* \param [in] face Then number of a face of \a element.
* \param [in] ancestor An ancestor of \a element that has a common face with \a face. (Could be \a element itself).
* \return The face number \a f_a corresponding to the face of with \a face is a asubface.
* <0 on failure.
*/
inline int
element_face_get_ancestor_face (const t8_element_t *elem, const int face, const t8_element_t *ancestor) const
{
// For Quad elements the face number does not change when refining.
T8_ASSERT (element_is_valid (elem));
T8_ASSERT (element_is_valid (ancestor));
T8_ASSERT (0 <= face && face < element_get_num_face (elem));
T8_ASSERT (is_ancestor (ancestor, elem));
return face;
}

/** Given an element and a face of this element. If the face lies on the
* tree boundary, return the face number of the tree face.
* If not the return value is arbitrary.
Expand Down
21 changes: 21 additions & 0 deletions src/t8_schemes/t8_default/t8_default_tri/t8_default_tri.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,27 @@ class t8_default_scheme_tri: public t8_default_scheme_common<t8_default_scheme_t
int
element_face_get_parent_face (const t8_element_t *elem, int face) const;

/** Given an element and a face of an element as well as an ancestor of the element
* that has a face that is an ancestor of the given face, compute the corresponding face number of the ancestor element.
*
* \param [in] tree_class The eclass of the current tree.
* \param [in] elem An element.
* \param [in] face Then number of a face of \a element.
* \param [in] ancestor An ancestor of \a element that has a common face with \a face. (Could be \a element itself).
* \return The face number \a f_a corresponding to the face of with \a face is a asubface.
* <0 on failure.
*/
inline int
element_face_get_ancestor_face (const t8_element_t *elem, const int face, const t8_element_t *ancestor) const
{
// For Triangle elements the face number does not change when refining.
T8_ASSERT (element_is_valid (elem));
T8_ASSERT (element_is_valid (ancestor));
T8_ASSERT (0 <= face && face < element_get_num_face (elem));
T8_ASSERT (is_ancestor (ancestor, elem));
return face;
}

/** Given an element and a face of this element. If the face lies on the tree boundary, return the face number of
* the tree face. If not the return value is arbitrary.
* \param [in] elem The element.
Expand Down
21 changes: 21 additions & 0 deletions src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,27 @@ class t8_default_scheme_vertex: public t8_default_scheme_common<t8_default_schem
return 0; /* prevents compiler warning */
}

/** Given an element and a face of an element as well as an ancestor of the element
* that has a face that is an ancestor of the given face, compute the corresponding face number of the ancestor element.
*
* \param [in] tree_class The eclass of the current tree.
* \param [in] elem An element.
* \param [in] face Then number of a face of \a element.
* \param [in] ancestor An ancestor of \a element that has a common face with \a face. (Could be \a element itself).
* \return The face number \a f_a corresponding to the face of with \a face is a asubface.
* <0 on failure.
*/
inline int
element_face_get_ancestor_face (const t8_element_t *elem, const int face, const t8_element_t *ancestor) const
{
// For vertex elements the face number does not change when refining.
T8_ASSERT (element_is_valid (elem));
T8_ASSERT (element_is_valid (ancestor));
T8_ASSERT (0 <= face && face < element_get_num_face (elem));
T8_ASSERT (is_ancestor (ancestor, elem));
return face;
}

/** Given an element and a face of this element. If the face lies on the
* tree boundary, return the face number of the tree face.
* If not the return value is arbitrary.
Expand Down
18 changes: 18 additions & 0 deletions src/t8_schemes/t8_scheme.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,24 @@ class t8_scheme {
eclass_schemes[tree_class]);
};

/** Given an element and a face of an element as well as an ancestor of the element
* that has a face that is an ancestor of the given face, compute the corresponding face number of the ancestor element.
*
* \param [in] tree_class The eclass of the current tree.
* \param [in] elem An element.
* \param [in] face Then number of a face of \a element.
* \param [in] ancestor An ancestor of \a element that has a common face with \a face. (Could be \a element itself).
* \return The face number \a f_a corresponding to the face of with \a face is a asubface.
* <0 on failure.
*/
inline int
element_face_get_ancestor_face (const t8_eclass_t tree_class, const t8_element_t *elem, const int face,
const t8_element_t *ancestor) const
{
return std::visit ([&] (auto &&scheme) { return scheme.element_face_get_ancestor_face (elem, face, ancestor); },
eclass_schemes[tree_class]);
};

/** Given an element and a face of this element. If the face lies on the
* tree boundary, return the face number of the tree face.
* If not the return value is arbitrary.
Expand Down