71 #ifndef REF_ELEMENT_HH_ 72 #define REF_ELEMENT_HH_ 135 IdxVector(std::array<unsigned int,Size> data_in);
137 IdxVector(std::initializer_list<unsigned int> data_in);
139 unsigned int operator[](unsigned int idx) const;
143 template<std::
size_t Size>
153 template <
unsigned int OutDim,
unsigned int InDim>
159 template<
unsigned int dim>
179 static LocalPoint node_coords(
unsigned int nid);
185 static LocalPoint normal_vector(
unsigned int sid);
193 static BaryPoint clip(
const BaryPoint &barycentric);
198 static unsigned int normal_orientation(
unsigned int sid);
200 static double side_measure(
unsigned int sid);
208 static unsigned int oposite_node(
unsigned int sid);
214 static unsigned int line_between_faces(
unsigned int f1,
unsigned int f2);
217 static const unsigned int n_sides = dim + 1;
218 static const unsigned int n_nodes = dim + 1;
219 static const unsigned int n_nodes_per_side = dim;
220 static const unsigned int n_lines_per_node = dim;
221 static const unsigned int n_nodes_per_line = 2;
222 static const unsigned int n_sides_per_line = 2;
223 static const unsigned int n_sides_per_node = dim;
226 static const unsigned int n_lines_per_side = (
unsigned int)((dim * (dim - 1)) / 2);
229 static const unsigned int n_lines = (
unsigned int)((dim * (dim + 1)) / 2);
263 static const unsigned int n_side_permutations = (dim+1)*(2*dim*dim-5*dim+6)/6;
268 static const unsigned int side_permutations[n_side_permutations][n_nodes_per_side];
274 static unsigned int permutation_index(
unsigned int p[n_nodes_per_side]);
280 static BaryPoint local_to_bary(
const LocalPoint& lp);
286 static LocalPoint bary_to_local(
const BaryPoint& bp);
293 static BarycentricUnitVec make_bary_unit_vec();
300 static FaceBaryPoint barycentric_on_face(
const BaryPoint &barycentric,
unsigned int i_face);
304 static CentersList centers_of_subelements(
unsigned int sub_dim);
310 static std::pair<unsigned int, unsigned int> zeros_positions(
const BaryPoint &barycentric,
321 template<
unsigned int subdim>
static unsigned int topology_idx(
unsigned int zeros_positions);
328 template<
unsigned int subdim>
static unsigned int count();
337 template<
unsigned int subdim>
static arma::mat::fixed<dim+1,subdim+1> bary_coords(
unsigned int sid);
343 template<
unsigned int subdim>
static BaryPoint
interpolate(arma::vec::fixed<subdim+1> coord,
int sub_simplex_idx);
349 static BaryPoint line_barycentric_interpolation(BaryPoint first_coords,
350 BaryPoint second_coords,
351 double first_theta,
double second_theta,
double theta);
384 template <
template <
unsigned int OutDim,
unsigned int InDim>
class TInteraction,
unsigned int OutDim,
unsigned int InDim>
385 static const IdxVector< (InDim>OutDim ? InDim+1 : dim-InDim) > interact( TInteraction<OutDim,InDim> interaction );
390 template<
unsigned int OutDim,
unsigned int InDim>
391 static const IdxVector< (InDim>OutDim ? InDim+1 : dim-InDim) > interact_(
unsigned int index);
438 template<
unsigned int dim>
439 template<
unsigned int subdim>
inline 442 arma::mat::fixed<dim+1,subdim+1> bary_c;
444 for(
unsigned int i = 0; i < subdim+1; i++){
445 unsigned int nid = interact_<0,subdim>(sid)[i];
446 bary_c.col(i).zeros();
447 bary_c.col(i)(nid) = 1;
454 template<
unsigned int dim>
inline 457 ASSERT_LT_DBG(nid, n_nodes).error(
"Node number is out of range!");
459 arma::vec::fixed<dim> p;
469 template<
unsigned int dim>
470 template<
unsigned int subdim>
519 template<
unsigned int dim>
520 template<
unsigned int subdim>
523 for(
unsigned int i=0; i < RefElement<dim>::count<subdim>(); i++){
524 if(zeros_positions == topology_zeros_[subdim][i])
return i;
526 ASSERT(0).error(
"Undefined zero pattern.");
537 template<>
template<>
inline const IdxVector<2> RefElement<1>::interact_<0,1>(
unsigned int i)
539 return line_nodes_[i];}
544 return line_nodes_[i];}
549 return line_nodes_[i];}
552 template<>
template<>
inline const IdxVector<1> RefElement<1>::interact_<1,0>(
unsigned int i)
554 return node_lines_[i];}
557 template<>
template<>
inline const IdxVector<2> RefElement<2>::interact_<1,0>(
unsigned int i)
559 return node_lines_[i];}
562 template<>
template<>
inline const IdxVector<3> RefElement<3>::interact_<1,0>(
unsigned int i)
564 return node_lines_[i];}
567 template<>
template<>
inline const IdxVector<3> RefElement<3>::interact_<0,2>(
unsigned int i)
569 return side_nodes_[i];}
572 template<>
template<>
inline const IdxVector<3> RefElement<3>::interact_<2,0>(
unsigned int i)
574 return node_sides_[i];}
577 template<>
template<>
inline const IdxVector<2> RefElement<3>::interact_<2,1>(
unsigned int i)
579 return line_sides_[i];}
582 template<>
template<>
inline const IdxVector<3> RefElement<3>::interact_<1,2>(
unsigned int i)
584 return side_lines_[i];}
586 template<
unsigned int dim>
template<
unsigned int OutDim,
unsigned int InDim>
589 ASSERT(
false)(dim)(OutDim)(InDim)(i).error(
"Not implemented.");
595 template<
unsigned int dim>
596 template <
template <
unsigned int OutDim,
unsigned int InDim>
class TInteraction,
unsigned int OutDim,
unsigned int InDim>
599 return interact_<OutDim,InDim>(interaction.i_);
static arma::mat::fixed< dim+1, subdim+1 > bary_coords(unsigned int sid)
static BaryPoint interpolate(arma::vec::fixed< subdim+1 > coord, int sub_simplex_idx)
std::vector< BaryPoint > BarycentricUnitVec
arma::vec::fixed< dim > LocalPoint
static const std::vector< std::vector< std::vector< unsigned int > > > nodes_of_subelements
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
static LocalPoint node_coords(unsigned int nid)
Interaction(unsigned int i)
const std::vector< LocalPoint > & CentersList
std::array< unsigned int, Size > IdxVector
arma::vec::fixed< dim > FaceBaryPoint
arma::vec::fixed< dim+1 > BaryPoint
IntersectionPoint * interpolate(const IntersectionPoint &A1, const IntersectionPoint &A2, double t)
static unsigned int topology_idx(unsigned int zeros_positions)
#define ASSERT_LT_DBG(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.