21 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 35 template <
unsigned int Dim, FEFamily T_radial, InfMapType T_map>
40 template <
unsigned int Dim, FEFamily T_radial, InfMapType T_map>
44 template <
unsigned int Dim, FEFamily T_radial, InfMapType T_map>
54 template <
unsigned int Dim, FEFamily T_radial, InfMapType T_map>
58 const ElemType base_et (Base::get_elem_type(inf_elem_type));
71 template <
unsigned int Dim, FEFamily T_radial, InfMapType T_map>
76 const ElemType base_et (Base::get_elem_type(inf_elem_type));
78 unsigned int n_base, n_radial;
79 compute_node_indices(inf_elem_type, n, n_base, n_radial);
92 return Radial::n_dofs_at_node(fet.
radial_order, n_radial);
100 template <
unsigned int Dim, FEFamily T_radial, InfMapType T_map>
104 const ElemType base_et (Base::get_elem_type(inf_elem_type));
118 template <
unsigned int Dim, FEFamily T_radial, InfMapType T_map>
121 const std::vector<Number> & ,
122 std::vector<Number> & nodal_soln)
125 if (!_warned_for_nodal_soln)
127 libMesh::err <<
"WARNING: nodal_soln(...) does _not_ work for infinite elements." << std::endl
128 <<
" Will return an empty nodal solution. Use " << std::endl
129 <<
" InfFE<Dim,T_radial,T_map>::compute_data(..) instead!" << std::endl;
130 _warned_for_nodal_soln =
true;
142 libmesh_assert (nodal_soln.empty());
153 template <
unsigned int Dim, FEFamily T_radial, InfMapType T_map>
156 const unsigned int i,
159 libmesh_assert_not_equal_to (Dim, 0);
165 libMesh::err <<
"WARNING: InfFE<Dim,T_radial,T_map>::shape(...) does _not_" << std::endl
166 <<
" return the correct trial function! Use " << std::endl
167 <<
" InfFE<Dim,T_radial,T_map>::compute_data(..) instead!" 169 _warned_for_shape =
true;
173 const ElemType base_et (Base::get_elem_type(inf_elem_type));
175 const Real v (p(Dim-1));
177 unsigned int i_base, i_radial;
178 compute_shape_indices(fet, inf_elem_type, i, i_base, i_radial);
197 template <
unsigned int Dim, FEFamily T_radial, InfMapType T_map>
199 const Elem * inf_elem,
200 const unsigned int i,
203 libmesh_assert(inf_elem);
204 libmesh_assert_not_equal_to (Dim, 0);
210 libMesh::err <<
"WARNING: InfFE<Dim,T_radial,T_map>::shape(...) does _not_" << std::endl
211 <<
" return the correct trial function! Use " << std::endl
212 <<
" InfFE<Dim,T_radial,T_map>::compute_data(..) instead!" 214 _warned_for_shape =
true;
219 const Real v (p(Dim-1));
220 std::unique_ptr<const Elem> base_el (inf_elem->
build_side_ptr(0));
222 unsigned int i_base, i_radial;
223 compute_shape_indices(fet, inf_elem->
type(), i, i_base, i_radial);
240 template <
unsigned int Dim, FEFamily T_radial, InfMapType T_map>
242 const Elem * inf_elem,
245 libmesh_assert(inf_elem);
246 libmesh_assert_not_equal_to (Dim, 0);
249 const Order radial_mapping_order (Radial::mapping_order());
251 const Real v (p(Dim-1));
252 std::unique_ptr<const Elem> base_el (inf_elem->
build_side_ptr(0));
260 Real interpolated_dist = 0.;
266 interpolated_dist =
Point(inf_elem->
point(0) - inf_elem->
point(1)).norm();
272 const unsigned int n_base_nodes = base_el->n_nodes();
275 const Order base_mapping_order (base_el->default_order());
276 const ElemType base_mapping_elem_type (base_el->type());
279 for (
unsigned int n=0; n<n_base_nodes; n++)
280 interpolated_dist +=
Point(base_el->point(n) - origin).norm()
287 const unsigned int n_base_nodes = base_el->n_nodes();
290 const Order base_mapping_order (base_el->default_order());
291 const ElemType base_mapping_elem_type (base_el->type());
294 for (
unsigned int n=0; n<n_base_nodes; n++)
295 interpolated_dist +=
Point(base_el->point(n) - origin).norm()
301 libmesh_error_msg(
"Unknown Dim = " << Dim);
309 data.phase = interpolated_dist
314 #ifdef LIBMESH_USE_COMPLEX_NUMBERS 325 const Number time_harmonic = exp(exponent);
327 const Number time_harmonic = 1;
328 #endif //LIBMESH_USE_COMPLEX_NUMBERS 335 const unsigned int n_dof = n_dofs (fet, inf_elem->
type());
336 data.shape.resize(n_dof);
338 for (
unsigned int i=0; i<n_dof; i++)
341 unsigned int i_base, i_radial;
342 compute_shape_indices(fet, inf_elem->
type(), i, i_base, i_radial);
352 libmesh_error_msg(
"compute_data() for 1-dimensional InfFE not implemented.");
360 template <
unsigned int Dim, FEFamily T_radial, InfMapType T_map>
362 const unsigned int outer_node_index,
363 unsigned int & base_node,
364 unsigned int & radial_node)
366 switch (inf_elem_type)
370 libmesh_assert_less (outer_node_index, 2);
372 radial_node = outer_node_index;
380 libmesh_assert_less (outer_node_index, 4);
381 base_node = outer_node_index % 2;
382 radial_node = outer_node_index / 2;
388 libmesh_assert_less (outer_node_index, 6);
389 base_node = outer_node_index % 3;
390 radial_node = outer_node_index / 3;
396 libmesh_assert_less (outer_node_index, 8);
397 base_node = outer_node_index % 4;
398 radial_node = outer_node_index / 4;
406 switch (outer_node_index)
412 base_node = outer_node_index;
420 base_node = outer_node_index-2;
439 libmesh_error_msg(
"Unrecognized outer_node_index = " << outer_node_index);
447 switch (outer_node_index)
455 base_node = outer_node_index;
465 base_node = outer_node_index-4;
475 base_node = outer_node_index-4;
485 base_node = outer_node_index-8;
491 libmesh_assert_equal_to (inf_elem_type,
INFHEX18);
499 libmesh_assert_equal_to (inf_elem_type,
INFHEX18);
506 libmesh_error_msg(
"Unrecognized outer_node_index = " << outer_node_index);
513 switch (outer_node_index)
520 base_node = outer_node_index;
529 base_node = outer_node_index-3;
538 base_node = outer_node_index-3;
547 base_node = outer_node_index-6;
552 libmesh_error_msg(
"Unrecognized outer_node_index = " << outer_node_index);
558 libmesh_error_msg(
"ERROR: Bad infinite element type=" << inf_elem_type <<
", node=" << outer_node_index);
567 template <
unsigned int Dim, FEFamily T_radial, InfMapType T_map>
569 const unsigned int outer_node_index,
570 unsigned int & base_node,
571 unsigned int & radial_node)
573 libmesh_assert_not_equal_to (inf_elem_type,
INVALID_ELEM);
575 static std::vector<unsigned int> _static_base_node_index;
576 static std::vector<unsigned int> _static_radial_node_index;
595 if (inf_elem_type==_compute_node_indices_fast_current_elem_type)
597 base_node = _static_base_node_index [outer_node_index];
598 radial_node = _static_radial_node_index[outer_node_index];
604 _compute_node_indices_fast_current_elem_type = inf_elem_type;
608 switch (inf_elem_type)
651 libmesh_error_msg(
"ERROR: Bad infinite element type=" << inf_elem_type <<
", node=" << outer_node_index);
655 _static_base_node_index.resize (
n_nodes);
656 _static_radial_node_index.resize(
n_nodes);
658 for (
unsigned int n=0; n<
n_nodes; n++)
659 compute_node_indices (inf_elem_type,
661 _static_base_node_index [outer_node_index],
662 _static_radial_node_index[outer_node_index]);
665 base_node = _static_base_node_index [outer_node_index];
666 radial_node = _static_radial_node_index[outer_node_index];
676 template <
unsigned int Dim, FEFamily T_radial, InfMapType T_map>
679 const unsigned int i,
680 unsigned int & base_shape,
681 unsigned int & radial_shape)
710 const unsigned int radial_order_p_one = radial_order+1;
712 const ElemType base_elem_type (Base::get_elem_type(inf_elem_type));
727 switch (inf_elem_type)
732 n_base_side_nodes = 0;
733 n_base_face_nodes = 0;
742 n_base_side_nodes = 0;
743 n_base_face_nodes = 0;
752 n_base_side_nodes = 1;
753 n_base_face_nodes = 0;
762 n_base_side_nodes = 0;
763 n_base_face_nodes = 0;
772 n_base_side_nodes = 4;
773 n_base_face_nodes = 0;
782 n_base_side_nodes = 4;
783 n_base_face_nodes = 1;
793 n_base_side_nodes = 0;
794 n_base_face_nodes = 0;
803 n_base_side_nodes = 3;
804 n_base_face_nodes = 0;
811 libmesh_error_msg(
"Unrecognized inf_elem_type = " << inf_elem_type);
817 const unsigned int n_dof_at_base_vertices = n_base_vertices*n_base_vertex_dof;
818 const unsigned int n_dof_at_all_vertices = n_dof_at_base_vertices*radial_order_p_one;
820 const unsigned int n_dof_at_base_sides = n_base_side_nodes*n_base_side_dof;
821 const unsigned int n_dof_at_all_sides = n_dof_at_base_sides*radial_order_p_one;
823 const unsigned int n_dof_at_base_face = n_base_face_nodes*n_base_face_dof;
824 const unsigned int n_dof_at_all_faces = n_dof_at_base_face*radial_order_p_one;
828 if (i < n_dof_at_base_vertices)
835 else if (i < n_dof_at_all_vertices)
842 const unsigned int i_offset = i - n_dof_at_base_vertices;
845 radial_shape = (i_offset % radial_order) + 1;
846 base_shape = i_offset / radial_order;
849 else if (i < n_dof_at_all_vertices+n_dof_at_base_sides)
853 base_shape = i - radial_order * n_dof_at_base_vertices;
856 else if (i < n_dof_at_all_vertices+n_dof_at_all_sides)
859 const unsigned int i_offset = i - (n_dof_at_all_vertices
860 + n_dof_at_base_sides);
861 radial_shape = (i_offset % radial_order) + 1;
862 base_shape = (i_offset / radial_order) + n_dof_at_base_vertices;
865 else if (i < n_dof_at_all_vertices+n_dof_at_all_sides+n_dof_at_base_face)
869 base_shape = i - radial_order*(n_dof_at_base_vertices
870 + n_dof_at_base_sides);
873 else if (i < n_dof_at_all_vertices+n_dof_at_all_sides+n_dof_at_all_faces)
876 const unsigned int i_offset = i - (n_dof_at_all_vertices
878 + n_dof_at_base_face);
879 radial_shape = (i_offset % radial_order) + 1;
880 base_shape = (i_offset / radial_order) + n_dof_at_base_vertices + n_dof_at_base_sides;
883 else if (i < n_dof_at_all_vertices+n_dof_at_all_sides+n_dof_at_all_faces+n_base_elem_dof)
887 base_shape = i - (n_dof_at_all_vertices
889 + n_dof_at_all_faces);
894 libmesh_assert_less (i, n_dofs(fet, inf_elem_type));
896 const unsigned int i_offset = i - (n_dof_at_all_vertices
900 radial_shape = (i_offset % radial_order) + 1;
901 base_shape = (i_offset / radial_order) + n_dof_at_base_vertices + n_dof_at_base_sides + n_dof_at_base_face;
946 #endif //ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS static void compute_node_indices_fast(const ElemType inf_elem_type, const unsigned int outer_node_index, unsigned int &base_node, unsigned int &radial_node)
static unsigned int n_dofs_per_elem(const unsigned int dim, const FEType &fe_t, const ElemType t)
Manages the family, order, etc. parameters for a given FE.
static unsigned int n_dofs_per_elem(const FEType &fet, const ElemType inf_elem_type)
static bool _warned_for_shape
Base class for all the infinite geometric element types.
static unsigned int n_dofs(const unsigned int dim, const FEType &fe_t, const ElemType t)
virtual Point origin() const
const unsigned int invalid_uint
static OutputShape shape(const ElemType t, const Order o, const unsigned int i, const Point &p)
static unsigned int n_dofs_at_node(const FEType &fet, const ElemType inf_elem_type, const unsigned int n)
Helper class used with FEInterface::compute_data().
OrderWrapper radial_order
The base class for all geometric element types.
INSTANTIATE_INF_FE_MBRF(1, CARTESIAN, Elem *, Base::build_elem(const Elem *))
static Real shape(const FEType &fet, const ElemType t, const unsigned int i, const Point &p)
static void compute_node_indices(const ElemType inf_elem_type, const unsigned int outer_node_index, unsigned int &base_node, unsigned int &radial_node)
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i, bool proxy=true)=0
const dof_id_type n_nodes
static unsigned int n_dofs(const FEType &fet, const ElemType inf_elem_type)
static Real decay(const Real v)
static Real shape(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int i, const Point &p)
static Real eval(Real v, Order o_radial, unsigned int i)
OStreamProxy err(std::cerr)
static unsigned int n_dofs_at_node(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int n)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static void compute_shape_indices(const FEType &fet, const ElemType inf_elem_type, const unsigned int i, unsigned int &base_shape, unsigned int &radial_shape)
static bool _warned_for_nodal_soln
static void compute_data(const FEType &fe_t, const Elem *inf_elem, FEComputeData &data)
static void nodal_soln(const FEType &fet, const Elem *elem, const std::vector< Number > &elem_soln, std::vector< Number > &nodal_soln)
static ElemType _compute_node_indices_fast_current_elem_type
virtual ElemType type() const =0
A geometric point in (x,y,z) space.
const Point & point(const unsigned int i) const