Skip to content

Commit 711529c

Browse files
committed
Rewrite the interface for (side_)nodal_soln() to take vdim
1 parent 1fcc9ae commit 711529c

13 files changed

+102
-64
lines changed

include/fe/fe.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,8 @@ class FE : public FEGenericBase<typename FEOutputType<T>::type>
389389
static void nodal_soln(const Elem * elem, const Order o,
390390
const std::vector<Number> & elem_soln,
391391
std::vector<Number> & nodal_soln,
392-
bool add_p_level = true);
392+
bool add_p_level = true,
393+
const unsigned vdim = 1);
393394

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

406408
/**
407409
* \returns The number of shape functions associated with
@@ -791,7 +793,8 @@ class FE : public FEGenericBase<typename FEOutputType<T>::type>
791793
const unsigned int side,
792794
const std::vector<Number> & elem_soln,
793795
std::vector<Number> & nodal_soln_on_side,
794-
bool add_p_level = true);
796+
bool add_p_level = true,
797+
const unsigned vdim = 1);
795798

796799
/**
797800
* An array of the node locations on the last

include/fe/fe_interface.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ class FEInterface
289289
const Elem * elem,
290290
const std::vector<Number> & elem_soln,
291291
std::vector<Number> & nodal_soln,
292-
const bool add_p_level = true);
292+
const bool add_p_level = true,
293+
const unsigned int vdim = 1);
293294

294295

295296
/**
@@ -305,7 +306,8 @@ class FEInterface
305306
const unsigned int side,
306307
const std::vector<Number> & elem_soln,
307308
std::vector<Number> & nodal_soln,
308-
const bool add_p_level = true);
309+
const bool add_p_level = true,
310+
const unsigned int vdim = 1);
309311

310312
#ifdef LIBMESH_ENABLE_DEPRECATED
311313
/**

include/fe/fe_macro.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
template LIBMESH_EXPORT void FE<2,SUBDIVISION>::init_shape_functions(const std::vector<Point> &, const Elem *); \
5252
template LIBMESH_EXPORT void FE<2,SUBDIVISION>::init_dual_shape_functions(unsigned int, unsigned int); \
5353
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); \
54-
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)
54+
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)
5555

5656
#else // LIBMESH_ENABLE_INFINITE_ELEMENTS
5757

@@ -64,7 +64,7 @@
6464
template LIBMESH_EXPORT void FE<2,SUBDIVISION>::init_shape_functions(const std::vector<Point> &, const Elem *); \
6565
template LIBMESH_EXPORT void FE<2,SUBDIVISION>::init_dual_shape_functions(unsigned int, unsigned int); \
6666
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); \
67-
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)
67+
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)
6868

6969
#endif // LIBMESH_ENABLE_INFINITE_ELEMENTS
7070

@@ -126,7 +126,8 @@ void FE<_dim,_fetype>::nodal_soln(const Elem * elem, \
126126
const Order order, \
127127
const std::vector<Number> & elem_soln,\
128128
std::vector<Number> & nodal_soln, \
129-
const bool add_p_level) \
129+
const bool add_p_level, \
130+
const unsigned) \
130131
{ UNPACK _funcname(elem, order, elem_soln, nodal_soln, add_p_level); }
131132

132133
#define LIBMESH_FE_NODAL_SOLN(fetype, _funcname) \
@@ -136,15 +137,16 @@ LIBMESH_FE_NODAL_SOLN_DIM(fetype, (_funcname), 2) \
136137
LIBMESH_FE_NODAL_SOLN_DIM(fetype, (_funcname), 3)
137138

138139

139-
#define LIBMESH_FE_SIDE_NODAL_SOLN_DIM(_fetype, _dim) \
140-
template <> \
141-
void FE<_dim,_fetype>::side_nodal_soln(const Elem * elem, \
142-
const Order order, \
143-
const unsigned int side, \
144-
const std::vector<Number> & elem_soln,\
145-
std::vector<Number> & nodal_soln, \
146-
const bool add_p_level) \
147-
{ default_side_nodal_soln(elem, order, side, elem_soln, nodal_soln, add_p_level); }
140+
#define LIBMESH_FE_SIDE_NODAL_SOLN_DIM(_fetype, _dim) \
141+
template <> \
142+
void FE<_dim,_fetype>::side_nodal_soln(const Elem * elem, \
143+
const Order order, \
144+
const unsigned int side, \
145+
const std::vector<Number> & elem_soln, \
146+
std::vector<Number> & nodal_soln, \
147+
const bool add_p_level, \
148+
const unsigned vdim) \
149+
{ default_side_nodal_soln(elem, order, side, elem_soln, nodal_soln, add_p_level, vdim); }
148150

149151
#define LIBMESH_FE_SIDE_NODAL_SOLN(fetype) \
150152
LIBMESH_FE_SIDE_NODAL_SOLN_DIM(fetype, 0) \

src/fe/fe.C

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,10 +710,11 @@ FE<Dim,T>::default_side_nodal_soln(const Elem * elem, const Order o,
710710
const unsigned int side,
711711
const std::vector<Number> & elem_soln,
712712
std::vector<Number> & nodal_soln_on_side,
713-
const bool add_p_level)
713+
const bool add_p_level,
714+
const unsigned vdim)
714715
{
715716
std::vector<Number> full_nodal_soln;
716-
nodal_soln(elem, o, elem_soln, full_nodal_soln, add_p_level);
717+
nodal_soln(elem, o, elem_soln, full_nodal_soln, add_p_level, vdim);
717718
const std::vector<unsigned int> side_nodes =
718719
elem->nodes_on_side(side);
719720

src/fe/fe_hierarchic_vec.C

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,17 @@ void FE<2,HIERARCHIC_VEC>::nodal_soln(const Elem * elem,
101101
const Order order,
102102
const std::vector<Number> & elem_soln,
103103
std::vector<Number> & nodal_soln,
104-
const bool add_p_level)
104+
const bool add_p_level,
105+
const unsigned)
105106
{ hierarchic_vec_nodal_soln(elem, order, elem_soln, 2 /*dim*/, nodal_soln, add_p_level); }
106107

107108
template <>
108109
void FE<3,HIERARCHIC_VEC>::nodal_soln(const Elem * elem,
109110
const Order order,
110111
const std::vector<Number> & elem_soln,
111112
std::vector<Number> & nodal_soln,
112-
const bool add_p_level)
113+
const bool add_p_level,
114+
const unsigned)
113115
{ hierarchic_vec_nodal_soln(elem, order, elem_soln, 3 /*dim*/, nodal_soln, add_p_level); }
114116

115117
LIBMESH_FE_SIDE_NODAL_SOLN(HIERARCHIC_VEC)

src/fe/fe_interface.C

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -622,13 +622,13 @@ void FEInterface::dofs_on_edge(const Elem * const elem,
622622

623623

624624

625-
626625
void FEInterface::nodal_soln(const unsigned int dim,
627626
const FEType & fe_t,
628627
const Elem * elem,
629628
const std::vector<Number> & elem_soln,
630629
std::vector<Number> & nodal_soln,
631-
const bool add_p_level)
630+
const bool add_p_level,
631+
const unsigned int vdim)
632632
{
633633
#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
634634

@@ -642,7 +642,7 @@ void FEInterface::nodal_soln(const unsigned int dim,
642642

643643
const Order order = fe_t.order;
644644

645-
void_fe_with_vec_switch(nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level));
645+
void_fe_with_vec_switch(nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level, vdim));
646646
}
647647

648648

@@ -652,7 +652,8 @@ void FEInterface::side_nodal_soln(const FEType & fe_t,
652652
const unsigned int side,
653653
const std::vector<Number> & elem_soln,
654654
std::vector<Number> & nodal_soln,
655-
const bool add_p_level)
655+
const bool add_p_level,
656+
const unsigned int vdim)
656657
{
657658
#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
658659

@@ -667,7 +668,7 @@ void FEInterface::side_nodal_soln(const FEType & fe_t,
667668
const Order order = fe_t.order;
668669
const unsigned int dim = elem->dim();
669670

670-
void_fe_with_vec_switch(side_nodal_soln(elem, order, side, elem_soln, nodal_soln, add_p_level));
671+
void_fe_with_vec_switch(side_nodal_soln(elem, order, side, elem_soln, nodal_soln, add_p_level, vdim));
671672
}
672673

673674

src/fe/fe_lagrange_vec.C

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,15 +641,17 @@ void FE<2,LAGRANGE_VEC>::nodal_soln(const Elem * elem,
641641
const Order order,
642642
const std::vector<Number> & elem_soln,
643643
std::vector<Number> & nodal_soln,
644-
const bool add_p_level)
644+
const bool add_p_level,
645+
const unsigned)
645646
{ lagrange_vec_nodal_soln(elem, order, elem_soln, 2 /*dim*/, nodal_soln, add_p_level); }
646647

647648
template <>
648649
void FE<3,LAGRANGE_VEC>::nodal_soln(const Elem * elem,
649650
const Order order,
650651
const std::vector<Number> & elem_soln,
651652
std::vector<Number> & nodal_soln,
652-
const bool add_p_level)
653+
const bool add_p_level,
654+
const unsigned)
653655
{ lagrange_vec_nodal_soln(elem, order, elem_soln, 3 /*dim*/, nodal_soln, add_p_level); }
654656

655657
LIBMESH_FE_SIDE_NODAL_SOLN(LAGRANGE_VEC)

src/fe/fe_monomial_vec.C

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ FE<2, MONOMIAL_VEC>::nodal_soln(const Elem * elem,
119119
const Order order,
120120
const std::vector<Number> & elem_soln,
121121
std::vector<Number> & nodal_soln,
122-
const bool add_p_level)
122+
const bool add_p_level,
123+
const unsigned)
123124
{
124125
monomial_vec_nodal_soln(elem, order, elem_soln, 2 /*dim*/, nodal_soln, add_p_level);
125126
}
@@ -130,7 +131,8 @@ FE<3, MONOMIAL_VEC>::nodal_soln(const Elem * elem,
130131
const Order order,
131132
const std::vector<Number> & elem_soln,
132133
std::vector<Number> & nodal_soln,
133-
const bool add_p_level)
134+
const bool add_p_level,
135+
const unsigned)
134136
{
135137
monomial_vec_nodal_soln(elem, order, elem_soln, 3 /*dim*/, nodal_soln, add_p_level);
136138
}

src/fe/fe_nedelec_one.C

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ void nedelec_one_nodal_soln(const Elem * elem,
4343
const Order order,
4444
const std::vector<Number> & elem_soln,
4545
const int dim,
46+
const int vdim,
4647
std::vector<Number> & nodal_soln,
4748
const bool add_p_level)
4849
{
@@ -51,7 +52,7 @@ void nedelec_one_nodal_soln(const Elem * elem,
5152

5253
const Order totalorder = order + add_p_level*elem->p_level();
5354

54-
nodal_soln.resize(n_nodes*dim);
55+
nodal_soln.resize(n_nodes*vdim);
5556

5657
FEType p_refined_fe_type(totalorder, NEDELEC_ONE);
5758

@@ -82,8 +83,8 @@ void nedelec_one_nodal_soln(const Elem * elem,
8283
for (unsigned int n = 0; n < n_nodes; n++)
8384
// u = Sum (u_i phi_i)
8485
for (unsigned int i=0; i<n_sf; i++)
85-
for (int d = 0; d < dim; d++)
86-
nodal_soln[dim*n+d] += elem_soln[i]*(vis_phi[i][n](d));
86+
for (int d = 0; d < vdim; d++)
87+
nodal_soln[vdim*n+d] += elem_soln[i]*(vis_phi[i][n](d));
8788

8889
return;
8990
} // nedelec_one_nodal_soln
@@ -337,32 +338,36 @@ void FE<0,NEDELEC_ONE>::nodal_soln(const Elem *,
337338
const Order,
338339
const std::vector<Number> &,
339340
std::vector<Number> &,
340-
bool)
341+
bool,
342+
const unsigned)
341343
{ NEDELEC_LOW_D_ERROR_MESSAGE }
342344

343345
template <>
344346
void FE<1,NEDELEC_ONE>::nodal_soln(const Elem *,
345347
const Order,
346348
const std::vector<Number> &,
347349
std::vector<Number> &,
348-
bool)
350+
bool,
351+
const unsigned)
349352
{ NEDELEC_LOW_D_ERROR_MESSAGE }
350353

351354
template <>
352355
void FE<2,NEDELEC_ONE>::nodal_soln(const Elem * elem,
353356
const Order order,
354357
const std::vector<Number> & elem_soln,
355358
std::vector<Number> & nodal_soln,
356-
const bool add_p_level)
357-
{ nedelec_one_nodal_soln(elem, order, elem_soln, 2 /*dim*/, nodal_soln, add_p_level); }
359+
const bool add_p_level,
360+
const unsigned vdim)
361+
{ nedelec_one_nodal_soln(elem, order, elem_soln, 2 /*dim*/, vdim, nodal_soln, add_p_level); }
358362

359363
template <>
360364
void FE<3,NEDELEC_ONE>::nodal_soln(const Elem * elem,
361365
const Order order,
362366
const std::vector<Number> & elem_soln,
363367
std::vector<Number> & nodal_soln,
364-
const bool add_p_level)
365-
{ nedelec_one_nodal_soln(elem, order, elem_soln, 3 /*dim*/, nodal_soln, add_p_level); }
368+
const bool add_p_level,
369+
const unsigned)
370+
{ nedelec_one_nodal_soln(elem, order, elem_soln, 3 /*dim*/, 3 /*vdim*/, nodal_soln, add_p_level); }
366371

367372
LIBMESH_FE_SIDE_NODAL_SOLN(NEDELEC_ONE)
368373

0 commit comments

Comments
 (0)