Skip to content

Commit

Permalink
Add proxy version of ElemCorner::build_edge
Browse files Browse the repository at this point in the history
  • Loading branch information
loganharbour committed Nov 14, 2022
1 parent 69c2779 commit d7e56b9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion include/geom/elem_corner.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ class ElemCorner : public std::pair<unsigned short, unsigned short>
{ set_edge(vs.first, vs.second); }

/**
* @returns The edge when at an edge
* Builds an edge of element \p elem into the Elem \p edge when at an edge
*/
void build_edge(const Elem & elem, std::unique_ptr<const Elem> & edge) const;
/**
* @returns The built edge of element \p elem when at an edge
*/
std::unique_ptr<const Elem> build_edge(const Elem & elem) const;

Expand Down
14 changes: 12 additions & 2 deletions src/geom/elem_corner.C
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bool ElemCorner::at_edge(const Elem & elem, const unsigned short e) const
return at_edge(nodes_on_edge_ptr[0], nodes_on_edge_ptr[1]);
}

std::unique_ptr<const Elem> ElemCorner::build_edge(const Elem & elem) const
void ElemCorner::build_edge(const Elem & elem, std::unique_ptr<const Elem> & edge) const
{
libmesh_assert_greater(elem.dim(), 1);
libmesh_assert(at_edge());
Expand All @@ -42,11 +42,21 @@ std::unique_ptr<const Elem> ElemCorner::build_edge(const Elem & elem) const

for (const auto e : elem.edge_index_range())
if (elem.is_node_on_edge(first, e) && elem.is_node_on_edge(second, e))
return elem.build_edge_ptr(e);
{
elem.build_edge_ptr(edge, e);
return;
}

libmesh_error_msg("Element does not contain vertices in ElemCorner");
}

std::unique_ptr<const Elem> ElemCorner::build_edge(const Elem & elem) const
{
std::unique_ptr<const Elem> edge;
build_edge(elem, edge);
return edge;
}

std::string ElemCorner::print() const
{
std::stringstream oss;
Expand Down

0 comments on commit d7e56b9

Please sign in to comment.