Skip to content

Commit

Permalink
Rewrite the interface for (side_)nodal_soln() to take vdim
Browse files Browse the repository at this point in the history
  • Loading branch information
nmnobre committed Jan 31, 2025
1 parent 2f26c55 commit 74cbc69
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 91 deletions.
9 changes: 6 additions & 3 deletions include/fe/fe.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ class FE : public FEGenericBase<typename FEOutputType<T>::type>
*
* On a p-refined element, \p o should be the base order of the element.
*/
static void nodal_soln(const Elem * elem, const Order o,
static void nodal_soln(const unsigned vdim,
const Elem * elem, const Order o,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
bool add_p_level = true);
Expand All @@ -397,7 +398,8 @@ class FE : public FEGenericBase<typename FEOutputType<T>::type>
*
* On a p-refined element, \p o should be the base order of the element.
*/
static void side_nodal_soln(const Elem * elem, const Order o,
static void side_nodal_soln(const unsigned vdim,
const Elem * elem, const Order o,
const unsigned int side,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln_on_side,
Expand Down Expand Up @@ -739,7 +741,8 @@ class FE : public FEGenericBase<typename FEOutputType<T>::type>
/**
* A default implementation for side_nodal_soln
*/
static void default_side_nodal_soln(const Elem * elem, const Order o,
static void default_side_nodal_soln(const unsigned vdim,
const Elem * elem, const Order o,
const unsigned int side,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln_on_side,
Expand Down
4 changes: 3 additions & 1 deletion include/fe/fe_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ class FEInterface
* should be updated so that it does not take a \p dim argument.
*/
static void nodal_soln(const unsigned int dim,
const unsigned int vdim,
const FEType & fe_t,
const Elem * elem,
const std::vector<Number> & elem_soln,
Expand All @@ -304,7 +305,8 @@ class FEInterface
* order of the element. The Elem::p_level(), if any, is accounted
* for internally by this routine.
*/
static void side_nodal_soln(const FEType & fe_t,
static void side_nodal_soln(const unsigned int vdim,
const FEType & fe_t,
const Elem * elem,
const unsigned int side,
const std::vector<Number> & elem_soln,
Expand Down
12 changes: 7 additions & 5 deletions include/fe/fe_macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
template LIBMESH_EXPORT void FE<2,SUBDIVISION>::init_shape_functions(const std::vector<Point> &, const Elem *); \
template LIBMESH_EXPORT void FE<2,SUBDIVISION>::init_dual_shape_functions(unsigned int, unsigned int); \
template LIBMESH_EXPORT void FE<2,SUBDIVISION>::default_all_shape_derivs (const Elem * elem, const Order o, const std::vector<Point> & p, std::vector<std::vector<Real>> * comps[3], const bool add_p_level); \
template LIBMESH_EXPORT void FE<2,SUBDIVISION>::default_side_nodal_soln(const Elem * elem, const Order o, const unsigned int side, const std::vector<Number> & elem_soln, std::vector<Number> & nodal_soln_on_side, bool add_p_level)
template LIBMESH_EXPORT void FE<2,SUBDIVISION>::default_side_nodal_soln(const unsigned vdim, const Elem * elem, const Order o, const unsigned int side, const std::vector<Number> & elem_soln, std::vector<Number> & nodal_soln_on_side, bool add_p_level)

#else // LIBMESH_ENABLE_INFINITE_ELEMENTS

Expand All @@ -64,7 +64,7 @@
template LIBMESH_EXPORT void FE<2,SUBDIVISION>::init_shape_functions(const std::vector<Point> &, const Elem *); \
template LIBMESH_EXPORT void FE<2,SUBDIVISION>::init_dual_shape_functions(unsigned int, unsigned int); \
template LIBMESH_EXPORT void FE<2,SUBDIVISION>::default_all_shape_derivs (const Elem * elem, const Order o, const std::vector<Point> & p, std::vector<std::vector<Real>> * comps[3], const bool add_p_level); \
template LIBMESH_EXPORT void FE<2,SUBDIVISION>::default_side_nodal_soln(const Elem * elem, const Order o, const unsigned int side, const std::vector<Number> & elem_soln, std::vector<Number> & nodal_soln_on_side, bool add_p_level)
template LIBMESH_EXPORT void FE<2,SUBDIVISION>::default_side_nodal_soln(const unsigned vdim, const Elem * elem, const Order o, const unsigned int side, const std::vector<Number> & elem_soln, std::vector<Number> & nodal_soln_on_side, bool add_p_level)

#endif // LIBMESH_ENABLE_INFINITE_ELEMENTS

Expand Down Expand Up @@ -121,7 +121,8 @@

#define LIBMESH_FE_NODAL_SOLN_DIM(_fetype, _funcname, _dim) \
template <> \
void FE<_dim,_fetype>::nodal_soln(const Elem * elem, \
void FE<_dim,_fetype>::nodal_soln(const unsigned, \
const Elem * elem, \
const Order order, \
const std::vector<Number> & elem_soln,\
std::vector<Number> & nodal_soln, \
Expand All @@ -137,13 +138,14 @@ LIBMESH_FE_NODAL_SOLN_DIM(fetype, _funcname, 3)

#define LIBMESH_FE_SIDE_NODAL_SOLN_DIM(_fetype, _dim) \
template <> \
void FE<_dim,_fetype>::side_nodal_soln(const Elem * elem, \
void FE<_dim,_fetype>::side_nodal_soln(const unsigned vdim, \
const Elem * elem, \
const Order order, \
const unsigned int side, \
const std::vector<Number> & elem_soln,\
std::vector<Number> & nodal_soln, \
const bool add_p_level) \
{ default_side_nodal_soln(elem, order, side, elem_soln, nodal_soln, add_p_level); }
{ default_side_nodal_soln(vdim, elem, order, side, elem_soln, nodal_soln, add_p_level); }

#define LIBMESH_FE_SIDE_NODAL_SOLN(fetype) \
LIBMESH_FE_SIDE_NODAL_SOLN_DIM(fetype, 0) \
Expand Down
5 changes: 3 additions & 2 deletions src/fe/fe.C
Original file line number Diff line number Diff line change
Expand Up @@ -706,14 +706,15 @@ FE<Dim,T>::default_all_shape_derivs (const Elem * elem,

template <unsigned int Dim, FEFamily T>
void
FE<Dim,T>::default_side_nodal_soln(const Elem * elem, const Order o,
FE<Dim,T>::default_side_nodal_soln(const unsigned vdim,
const Elem * elem, const Order o,
const unsigned int side,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln_on_side,
const bool add_p_level)
{
std::vector<Number> full_nodal_soln;
nodal_soln(elem, o, elem_soln, full_nodal_soln, add_p_level);
nodal_soln(vdim, elem, o, elem_soln, full_nodal_soln, add_p_level);
const std::vector<unsigned int> side_nodes =
elem->nodes_on_side(side);

Expand Down
40 changes: 24 additions & 16 deletions src/fe/fe_hierarchic_vec.C
Original file line number Diff line number Diff line change
Expand Up @@ -96,70 +96,78 @@ void hierarchic_vec_nodal_soln(const Elem * elem,
// of explicit instantiation at the end of this file.
// This could be macro-ified so that it fits on one line...
template <>
void FE<0,HIERARCHIC_VEC>::nodal_soln(const Elem * elem,
void FE<0,HIERARCHIC_VEC>::nodal_soln(const unsigned vdim,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ FE<0,HIERARCHIC>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }
{ FE<0,HIERARCHIC>::nodal_soln(vdim, elem, order, elem_soln, nodal_soln, add_p_level); }

template <>
void FE<1,HIERARCHIC_VEC>::nodal_soln(const Elem * elem,
void FE<1,HIERARCHIC_VEC>::nodal_soln(const unsigned vdim,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ FE<1,HIERARCHIC>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }
{ FE<1,HIERARCHIC>::nodal_soln(vdim, elem, order, elem_soln, nodal_soln, add_p_level); }

template <>
void FE<2,HIERARCHIC_VEC>::nodal_soln(const Elem * elem,
void FE<2,HIERARCHIC_VEC>::nodal_soln(const unsigned,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ hierarchic_vec_nodal_soln(elem, order, elem_soln, 2 /*dimension*/, nodal_soln, add_p_level); }
{ hierarchic_vec_nodal_soln(elem, order, elem_soln, 2 /*dim*/, nodal_soln, add_p_level); }

template <>
void FE<3,HIERARCHIC_VEC>::nodal_soln(const Elem * elem,
void FE<3,HIERARCHIC_VEC>::nodal_soln(const unsigned,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ hierarchic_vec_nodal_soln(elem, order, elem_soln, 3 /*dimension*/, nodal_soln, add_p_level); }
{ hierarchic_vec_nodal_soln(elem, order, elem_soln, 3 /*dim*/, nodal_soln, add_p_level); }

LIBMESH_FE_SIDE_NODAL_SOLN(HIERARCHIC_VEC)

template <>
void FE<0,L2_HIERARCHIC_VEC>::nodal_soln(const Elem * elem,
void FE<0,L2_HIERARCHIC_VEC>::nodal_soln(const unsigned vdim,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ FE<0,HIERARCHIC_VEC>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }
{ FE<0,HIERARCHIC_VEC>::nodal_soln(vdim, elem, order, elem_soln, nodal_soln, add_p_level); }

template <>
void FE<1,L2_HIERARCHIC_VEC>::nodal_soln(const Elem * elem,
void FE<1,L2_HIERARCHIC_VEC>::nodal_soln(const unsigned vdim,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ FE<1,HIERARCHIC_VEC>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }
{ FE<1,HIERARCHIC_VEC>::nodal_soln(vdim, elem, order, elem_soln, nodal_soln, add_p_level); }

template <>
void FE<2,L2_HIERARCHIC_VEC>::nodal_soln(const Elem * elem,
void FE<2,L2_HIERARCHIC_VEC>::nodal_soln(const unsigned vdim,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ FE<2,HIERARCHIC_VEC>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }
{ FE<2,HIERARCHIC_VEC>::nodal_soln(vdim, elem, order, elem_soln, nodal_soln, add_p_level); }

template <>
void FE<3,L2_HIERARCHIC_VEC>::nodal_soln(const Elem * elem,
void FE<3,L2_HIERARCHIC_VEC>::nodal_soln(const unsigned vdim,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ FE<3,HIERARCHIC_VEC>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }
{ FE<3,HIERARCHIC_VEC>::nodal_soln(vdim, elem, order, elem_soln, nodal_soln, add_p_level); }

LIBMESH_FE_SIDE_NODAL_SOLN(L2_HIERARCHIC_VEC)

Expand Down
9 changes: 5 additions & 4 deletions src/fe/fe_interface.C
Original file line number Diff line number Diff line change
Expand Up @@ -865,8 +865,8 @@ void FEInterface::dofs_on_edge(const Elem * const elem,




void FEInterface::nodal_soln(const unsigned int dim,
const unsigned int vdim,
const FEType & fe_t,
const Elem * elem,
const std::vector<Number> & elem_soln,
Expand All @@ -885,12 +885,13 @@ void FEInterface::nodal_soln(const unsigned int dim,

const Order order = fe_t.order;

void_fe_with_vec_switch(nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level));
void_fe_with_vec_switch(nodal_soln(vdim, elem, order, elem_soln, nodal_soln, add_p_level));
}



void FEInterface::side_nodal_soln(const FEType & fe_t,
void FEInterface::side_nodal_soln(const unsigned int vdim,
const FEType & fe_t,
const Elem * elem,
const unsigned int side,
const std::vector<Number> & elem_soln,
Expand All @@ -910,7 +911,7 @@ void FEInterface::side_nodal_soln(const FEType & fe_t,
const Order order = fe_t.order;
const unsigned int dim = elem->dim();

void_fe_with_vec_switch(side_nodal_soln(elem, order, side, elem_soln, nodal_soln, add_p_level));
void_fe_with_vec_switch(side_nodal_soln(vdim, elem, order, side, elem_soln, nodal_soln, add_p_level));
}


Expand Down
36 changes: 22 additions & 14 deletions src/fe/fe_lagrange_vec.C
Original file line number Diff line number Diff line change
Expand Up @@ -634,31 +634,35 @@ void lagrange_vec_nodal_soln(const Elem * elem,
// of explicit instantiation at the end of this file.
// This could be macro-ified so that it fits on one line...
template <>
void FE<0,LAGRANGE_VEC>::nodal_soln(const Elem * elem,
void FE<0,LAGRANGE_VEC>::nodal_soln(const unsigned vdim,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ FE<0,LAGRANGE>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }
{ FE<0,LAGRANGE>::nodal_soln(vdim, elem, order, elem_soln, nodal_soln, add_p_level); }

template <>
void FE<1,LAGRANGE_VEC>::nodal_soln(const Elem * elem,
void FE<1,LAGRANGE_VEC>::nodal_soln(const unsigned vdim,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ FE<1,LAGRANGE>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }
{ FE<1,LAGRANGE>::nodal_soln(vdim, elem, order, elem_soln, nodal_soln, add_p_level); }

template <>
void FE<2,LAGRANGE_VEC>::nodal_soln(const Elem * elem,
void FE<2,LAGRANGE_VEC>::nodal_soln(const unsigned,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ lagrange_vec_nodal_soln(elem, order, elem_soln, 2 /*dimension*/, nodal_soln, add_p_level); }

template <>
void FE<3,LAGRANGE_VEC>::nodal_soln(const Elem * elem,
void FE<3,LAGRANGE_VEC>::nodal_soln(const unsigned,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
Expand All @@ -668,36 +672,40 @@ void FE<3,LAGRANGE_VEC>::nodal_soln(const Elem * elem,
LIBMESH_FE_SIDE_NODAL_SOLN(LAGRANGE_VEC)

template <>
void FE<0,L2_LAGRANGE_VEC>::nodal_soln(const Elem * elem,
void FE<0,L2_LAGRANGE_VEC>::nodal_soln(const unsigned vdim,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ FE<0,LAGRANGE_VEC>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }
{ FE<0,LAGRANGE_VEC>::nodal_soln(vdim, elem, order, elem_soln, nodal_soln, add_p_level); }

template <>
void FE<1,L2_LAGRANGE_VEC>::nodal_soln(const Elem * elem,
void FE<1,L2_LAGRANGE_VEC>::nodal_soln(const unsigned vdim,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ FE<1,LAGRANGE_VEC>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }
{ FE<1,LAGRANGE_VEC>::nodal_soln(vdim, elem, order, elem_soln, nodal_soln, add_p_level); }

template <>
void FE<2,L2_LAGRANGE_VEC>::nodal_soln(const Elem * elem,
void FE<2,L2_LAGRANGE_VEC>::nodal_soln(const unsigned vdim,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ FE<2,LAGRANGE_VEC>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }
{ FE<2,LAGRANGE_VEC>::nodal_soln(vdim, elem, order, elem_soln, nodal_soln, add_p_level); }

template <>
void FE<3,L2_LAGRANGE_VEC>::nodal_soln(const Elem * elem,
void FE<3,L2_LAGRANGE_VEC>::nodal_soln(const unsigned vdim,
const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
{ FE<3,LAGRANGE_VEC>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }
{ FE<3,LAGRANGE_VEC>::nodal_soln(vdim, elem, order, elem_soln, nodal_soln, add_p_level); }

LIBMESH_FE_SIDE_NODAL_SOLN(L2_LAGRANGE_VEC)

Expand Down
Loading

0 comments on commit 74cbc69

Please sign in to comment.