72 #ifndef REF_ELEMENT_HH_
73 #define REF_ELEMENT_HH_
81 #include <Eigen/Dense>
277 template<std::
size_t Size>
287 template <
unsigned int OutDim,
unsigned int InDim>
340 template<
unsigned int dim>
355 typedef Eigen::Array<double,Eigen::Dynamic,1>
ArrayDbl;
378 static Eigen::Vector<ArrayDbl,dim>
normal_vector_array(Eigen::Array<uint,Eigen::Dynamic,1> loc_side_idx_array);
422 static const unsigned int n_lines = (
unsigned int)((dim * (dim + 1)) / 2);
463 double tolerance = std::numeric_limits<double>::epsilon()*2);
480 template<
unsigned int subdim>
static unsigned int count();
489 template<
unsigned int subdim>
static arma::mat::fixed<dim+1,subdim+1>
bary_coords(
unsigned int sid);
495 template<
unsigned int subdim>
static BaryPoint interpolate(arma::vec::fixed<subdim+1> coord,
int sub_simplex_idx);
503 double first_theta,
double second_theta,
double theta);
536 template <
template <
unsigned int OutDim,
unsigned int InDim>
class TInteraction,
unsigned int OutDim,
unsigned int InDim>
537 static const IdxVector< (InDim>OutDim ? InDim+1 : dim-InDim) >
interact( TInteraction<OutDim,InDim> interaction,
bool inv =
false );
542 template<
unsigned int OutDim,
unsigned int InDim>
543 static const IdxVector< (InDim>OutDim ? InDim+1 : dim-InDim) >
interact_(
unsigned int index,
bool inv =
false);
614 template<
unsigned int dim>
615 template<
unsigned int subdim>
inline
617 ASSERT_LT(subdim, dim).error(
"Dimension mismatch!");
618 arma::mat::fixed<dim+1,subdim+1> bary_c;
620 for(
unsigned int i = 0; i < subdim+1; i++){
621 unsigned int nid = interact_<0,subdim>(sid)[i];
622 bary_c.col(i).zeros();
623 bary_c.col(i)(nid) = 1;
630 template<
unsigned int dim>
inline
633 ASSERT_LT(nid, n_nodes).error(
"Node number is out of range!");
635 arma::vec::fixed<dim> p;
645 template<
unsigned int dim>
646 template<
unsigned int subdim>
686 template<
unsigned int dim>
687 template<
unsigned int subdim>
690 for(
unsigned int i=0; i < RefElement<dim>::count<subdim>(); i++){
691 if(zeros_positions == topology_zeros_[subdim][i])
return i;
706 return line_nodes_[i];}
711 return line_nodes_[i];}
716 return line_nodes_[i];}
721 return node_lines_[i];}
726 return node_lines_[i];}
736 return side_nodes_[i];}
751 return side_lines_[i];}
753 template<
unsigned int dim>
template<
unsigned int OutDim,
unsigned int InDim>
756 ASSERT_PERMANENT(
false)(dim)(OutDim)(InDim)(i)(inv).error(
"Not implemented.");
759 return IdxVector< (InDim>OutDim ? InDim+1 : dim-InDim) >();
763 template<
unsigned int dim>
764 template <
template <
unsigned int OutDim,
unsigned int InDim>
class TInteraction,
unsigned int OutDim,
unsigned int InDim>
767 return interact_<OutDim,InDim>(interaction.i_, inv);
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
#define ASSERT_LT(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
static const std::vector< IdxVector< n_lines_per_side > > side_lines_
[n_sides] For given side, returns lines indices. For dim == 3.
static CentersList centers_of_subelements(unsigned int sub_dim)
static const std::vector< IdxVector< n_nodes_per_line > > line_nodes_
[n_lines] For given line, returns its nodes indices.
static LocalPoint bary_to_local(const BaryPoint &bp)
Converts from barycentric to local coordinates.
static unsigned int normal_orientation(unsigned int sid)
static const unsigned int n_lines_per_node
Number of lines with one common node.
Armor::ArmaVec< double, dim > FaceBaryPoint
Armor::ArmaVec< double, dim+1 > BaryPoint
static FaceBaryPoint barycentric_on_face(const BaryPoint &barycentric, unsigned int i_face)
const std::vector< LocalPoint > & CentersList
static Eigen::Vector< ArrayDbl, dim > normal_vector_array(Eigen::Array< uint, Eigen::Dynamic, 1 > loc_side_idx_array)
std::vector< BaryPoint > BarycentricUnitVec
static BaryPoint line_barycentric_interpolation(BaryPoint first_coords, BaryPoint second_coords, double first_theta, double second_theta, double theta)
static const unsigned int n_sides
Number of sides.
static const std::vector< IdxVector< n_sides_per_line > > line_sides_
[n_lines] For given line, returns sides indices. For dim == 3.
static const IdxVector<(n_lines > n_nodes) ? n_lines :n_nodes > topology_zeros_[dim+1]
Eigen::Array< double, Eigen::Dynamic, 1 > ArrayDbl
static const std::vector< IdxVector< n_lines_per_node > > node_lines_
[n_nodes] For given node, returns lines indices.
arma::vec::fixed< dim > LocalPoint
static BaryPoint local_to_bary(const LocalPoint &lp)
Converts from local to barycentric coordinates.
static const unsigned int n_lines_per_side
Number of lines on boundary of one side.
static BarycentricUnitVec make_bary_unit_vec()
static std::pair< unsigned int, unsigned int > zeros_positions(const BaryPoint &barycentric, double tolerance=std::numeric_limits< double >::epsilon() *2)
static const unsigned int n_nodes
Number of nodes.
DECLARE_EXCEPTION(ExcInvalidPermutation,<< "Side permutation not found.\n")
static const unsigned int n_nodes_per_side
Number of nodes on one side.
static const IdxVector<(InDim >OutDim ? InDim+1 :dim-InDim) > interact_(unsigned int index, bool inv=false)
Internal part of the interact function.
static arma::mat::fixed< dim+1, subdim+1 > bary_coords(unsigned int sid)
static const unsigned int n_sides_per_node
Number of sides with one common line.
static const unsigned int n_nodes_per_line
Number of nodes in one line.
static unsigned int line_between_faces(unsigned int f1, unsigned int f2)
static unsigned int topology_idx(unsigned int zeros_positions)
static const std::vector< IdxVector< n_sides_per_node > > node_sides_
[n_nodes] For given node, returns sides indices. For dim == 3.
static const unsigned int n_sides_per_line
Number of sides with one common line. dim == 3.
static BaryPoint interpolate(arma::vec::fixed< subdim+1 > coord, int sub_simplex_idx)
static LocalPoint node_coords(unsigned int nid)
static BaryPoint clip(const BaryPoint &barycentric)
static double side_measure(unsigned int sid)
static const unsigned int n_lines
Number of lines, i.e. object of dimension dim-2 on the boundary of the reference element.
static unsigned int count()
static LocalPoint normal_vector(unsigned int sid)
static const IdxVector<(InDim >OutDim ? InDim+1 :dim-InDim) > interact(TInteraction< OutDim, InDim > interaction, bool inv=false)
static unsigned int oposite_node(unsigned int sid)
static const std::vector< std::vector< std::vector< unsigned int > > > nodes_of_subelements
static const std::vector< IdxVector< n_nodes_per_side > > side_nodes_
[n_sides] For given side, returns nodes indices. For dim == 3.
static constexpr IdxVector< 3 > S3_node_sides[2][4]
static constexpr IdxVector< 3 > S3_node_lines[2][4]
static constexpr IdxVector< 2 > S3_line_sides[2][6]
typename arma::Col< Type >::template fixed< nr > ArmaVec
std::array< unsigned int, Size > IdxVector
Interaction(unsigned int i)