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 Feb 4, 2025
1 parent 6b29b15 commit 7593ef4
Show file tree
Hide file tree
Showing 13 changed files with 134 additions and 82 deletions.
9 changes: 6 additions & 3 deletions include/fe/fe.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ class FE : public FEGenericBase<typename FEOutputType<T>::type>
static void nodal_soln(const Elem * elem, const Order o,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
bool add_p_level = true);
bool add_p_level = true,
const unsigned vdim = 1);

/**
* Build the nodal soln on one side from the (full) element soln.
Expand All @@ -401,7 +402,8 @@ class FE : public FEGenericBase<typename FEOutputType<T>::type>
const unsigned int side,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln_on_side,
bool add_p_level = true);
bool add_p_level = true,
const unsigned vdim = 1);

/**
* \returns The number of shape functions associated with
Expand Down Expand Up @@ -743,7 +745,8 @@ class FE : public FEGenericBase<typename FEOutputType<T>::type>
const unsigned int side,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln_on_side,
bool add_p_level = true);
bool add_p_level = true,
const unsigned vdim = 1);

/**
* An array of the node locations on the last
Expand Down
6 changes: 4 additions & 2 deletions include/fe/fe_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ class FEInterface
const Elem * elem,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level = true);
const bool add_p_level = true,
const unsigned int vdim = 1);


/**
Expand All @@ -309,7 +310,8 @@ class FEInterface
const unsigned int side,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level = true);
const bool add_p_level = true,
const unsigned int vdim = 1);

/**
* This is now deprecated; use FEMap::map instead.
Expand Down
26 changes: 14 additions & 12 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 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, const unsigned)

#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 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, const unsigned)

#endif // LIBMESH_ENABLE_INFINITE_ELEMENTS

Expand Down Expand Up @@ -125,7 +125,8 @@ void FE<_dim,_fetype>::nodal_soln(const Elem * elem, \
const Order order, \
const std::vector<Number> & elem_soln,\
std::vector<Number> & nodal_soln, \
const bool add_p_level) \
const bool add_p_level, \
const unsigned) \
{ _funcname(elem, order, elem_soln, nodal_soln, add_p_level); }

#define LIBMESH_FE_NODAL_SOLN(fetype, _funcname) \
Expand All @@ -135,15 +136,16 @@ LIBMESH_FE_NODAL_SOLN_DIM(fetype, _funcname, 2) \
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, \
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); }
#define LIBMESH_FE_SIDE_NODAL_SOLN_DIM(_fetype, _dim) \
template <> \
void FE<_dim,_fetype>::side_nodal_soln(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, \
const unsigned vdim) \
{ default_side_nodal_soln(elem, order, side, elem_soln, nodal_soln, add_p_level, vdim); }

#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 @@ -710,10 +710,11 @@ FE<Dim,T>::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,
const bool add_p_level)
const bool add_p_level,
const unsigned vdim)
{
std::vector<Number> full_nodal_soln;
nodal_soln(elem, o, elem_soln, full_nodal_soln, add_p_level);
nodal_soln(elem, o, elem_soln, full_nodal_soln, add_p_level, vdim);
const std::vector<unsigned int> side_nodes =
elem->nodes_on_side(side);

Expand Down
24 changes: 16 additions & 8 deletions src/fe/fe_hierarchic_vec.C
Original file line number Diff line number Diff line change
Expand Up @@ -100,31 +100,35 @@ void FE<0,HIERARCHIC_VEC>::nodal_soln(const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
const bool add_p_level,
const unsigned)
{ FE<0,HIERARCHIC>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }

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

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

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

LIBMESH_FE_SIDE_NODAL_SOLN(HIERARCHIC_VEC)
Expand All @@ -134,31 +138,35 @@ void FE<0,L2_HIERARCHIC_VEC>::nodal_soln(const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
const bool add_p_level,
const unsigned)
{ FE<0,HIERARCHIC_VEC>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }

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

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

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

LIBMESH_FE_SIDE_NODAL_SOLN(L2_HIERARCHIC_VEC)
Expand Down
11 changes: 6 additions & 5 deletions src/fe/fe_interface.C
Original file line number Diff line number Diff line change
Expand Up @@ -621,13 +621,13 @@ void FEInterface::dofs_on_edge(const Elem * const elem,




void FEInterface::nodal_soln(const unsigned int dim,
const FEType & fe_t,
const Elem * elem,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
const bool add_p_level,
const unsigned int vdim)
{
#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS

Expand All @@ -641,7 +641,7 @@ 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(elem, order, elem_soln, nodal_soln, add_p_level, vdim));
}


Expand All @@ -651,7 +651,8 @@ void FEInterface::side_nodal_soln(const FEType & fe_t,
const unsigned int side,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
const bool add_p_level,
const unsigned int vdim)
{
#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS

Expand All @@ -666,7 +667,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(elem, order, side, elem_soln, nodal_soln, add_p_level, vdim));
}


Expand Down
24 changes: 16 additions & 8 deletions src/fe/fe_lagrange_vec.C
Original file line number Diff line number Diff line change
Expand Up @@ -638,31 +638,35 @@ void FE<0,LAGRANGE_VEC>::nodal_soln(const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
const bool add_p_level,
const unsigned)
{ FE<0,LAGRANGE>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }

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

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

LIBMESH_FE_SIDE_NODAL_SOLN(LAGRANGE_VEC)
Expand All @@ -672,31 +676,35 @@ void FE<0,L2_LAGRANGE_VEC>::nodal_soln(const Elem * elem,
const Order order,
const std::vector<Number> & elem_soln,
std::vector<Number> & nodal_soln,
const bool add_p_level)
const bool add_p_level,
const unsigned)
{ FE<0,LAGRANGE_VEC>::nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level); }

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

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

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

LIBMESH_FE_SIDE_NODAL_SOLN(L2_LAGRANGE_VEC)
Expand Down
Loading

0 comments on commit 7593ef4

Please sign in to comment.