28 template<std::
size_t n>
31 for(
unsigned int i=0; i<m; i++)
32 for(
unsigned int j=0;j<n; j++)
33 vec[i].push_back(array[i][j]);
140 {(1 << 0) | (1 << 1),
142 (1 << 1) | (1 << 2)},
149 {(1 << 1) | (1 << 2) | (1 << 3),
150 (1 << 0) | (1 << 2) | (1 << 3),
151 (1 << 0) | (1 << 1) | (1 << 3),
152 (1 << 0) | (1 << 1) | (1 << 2),
155 {(1 << 2) | (1 << 3),
160 (1 << 0) | (1 << 1)},
256 { {0}, {1}, {2}, {3} },
263 template<
unsigned int dim>
268 bp.rows(1, dim ) = lp;
269 bp( 0 ) = 1.0 - arma::sum(lp);
277 template<
unsigned int dim>
285 template<
unsigned int dim>
288 return n_sides - sid - 1;
292 template<
unsigned int dim>
295 ASSERT_LT_DBG(sid, n_sides).error(
"Side number is out of range!");
304 ASSERT_LT_DBG(sid, n_sides).error(
"Side number is out of range!");
306 return node_coords(sid) - node_coords(1-sid);
312 ASSERT_LT_DBG(sid, n_sides).error(
"Side number is out of range!");
313 vec::fixed<2> barycenter, bar_side, n, t;
316 t = node_coords(line_nodes_[sid][1]) - node_coords(line_nodes_[sid][0]);
318 barycenter.fill(1./3);
320 bar_side = node_coords(line_nodes_[sid][0]) - barycenter;
326 if (dot(n,bar_side) < 0) n *= -1;
334 ASSERT_LT_DBG(sid, n_sides).error(
"Side number is out of range!");
335 vec::fixed<3> barycenter, bar_side, n, t1, t2;
338 t1 = node_coords(side_nodes_[sid][1]) - node_coords(side_nodes_[sid][0]);
339 t2 = node_coords(side_nodes_[sid][2]) - node_coords(side_nodes_[sid][0]);
341 barycenter.fill(0.25);
343 bar_side = node_coords(side_nodes_[sid][0]) - barycenter;
348 if (dot(n,bar_side) < 0) n = -n;
355 template<
unsigned int dim>
360 for(
unsigned int i=0; i < dim; i++) {
363 unsigned int i_bary = interact_<0,dim-1>(i_face)[i];
364 face_barycentric[i] = barycentric[ i_bary ];
366 return face_barycentric;
376 template<
unsigned int dim>
380 for(
unsigned int i=0; i<dim; i++) {
381 bary_unit_vec[i][i] = 1.0;
382 bary_unit_vec[i][dim] = -1.0;
383 bary_unit_vec[dim][i] = -1.0 / dim;
385 bary_unit_vec[dim][dim] = 1.0;
386 return bary_unit_vec;
390 template<
unsigned int dim>
395 for(
unsigned int i_bary=0; i_bary < dim +1; i_bary ++) {
396 if (barycentric[i_bary] < 0.0) {
400 unsigned int i_side = (dim - i_bary);
402 arma::vec projection_to_face(dim+1);
408 projection_to_face = barycentric - barycentric[i_bary]*bary_unit_vec[i_bary];
411 auto bary_on_face = barycentric_on_face(projection_to_face, i_side);
424 template<
unsigned int dim>
428 if (list.size() == 0) {
430 for(
unsigned int sdim=0; sdim < dim+1; sdim++) {
436 for(
auto &sub_el_nodes : nodes_of_subelements[sdim]) {
439 for(
unsigned int i_node : sub_el_nodes)
440 center+=node_coords( i_node );
442 list[sdim].push_back(center);
448 return list[sub_dim];
455 ASSERT_LT_DBG(sid, n_sides).error(
"Side number is out of range!");
464 ASSERT_LT_DBG(sid, n_sides).error(
"Side number is out of range!");
466 return norm(node_coords(line_nodes_[sid][1]) - node_coords(line_nodes_[sid][0]),2);
473 ASSERT_LT_DBG(sid, n_sides).error(
"Side number is out of range!");
475 return 0.5*norm(cross(node_coords(side_nodes_[sid][1]) - node_coords(side_nodes_[sid][0]),
476 node_coords(side_nodes_[sid][2]) - node_coords(side_nodes_[sid][0])),2);
485 while (side_lines_[f1][i] != side_lines_[f2][j])
486 if (side_lines_[f1][i] < side_lines_[f2][j]) i++;
488 return side_lines_[f1][i];
492 template<
unsigned int dim>
496 for (index = 0; index < n_side_permutations; index++)
497 if (equal(p, p + n_nodes_per_side, side_permutations[index]))
511 template<
unsigned int dim>
513 arma::vec::fixed<dim+1> first_coords,
514 arma::vec::fixed<dim+1> second_coords,
515 double first_theta,
double second_theta,
double theta){
517 arma::vec::fixed<dim+1> bary_interpolated_coords;
518 bary_interpolated_coords = ((theta - first_theta) * second_coords + (second_theta - theta) * first_coords)
519 /(second_theta - first_theta);
520 return bary_interpolated_coords;
static LocalPoint normal_vector(unsigned int sid)
#define ASSERT_EQ_DBG(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
std::vector< std::vector< unsigned int > > _array_to_vec(const IdxVector< n > array[], unsigned int m)
static BaryPoint line_barycentric_interpolation(BaryPoint first_coords, BaryPoint second_coords, double first_theta, double second_theta, double theta)
static unsigned int permutation_index(unsigned int p[n_nodes_per_side])
arma::vec::fixed< dim > LocalPoint
static unsigned int line_between_faces(unsigned int f1, unsigned int f2)
static unsigned int normal_orientation(unsigned int sid)
static unsigned int oposite_node(unsigned int sid)
static CentersList centers_of_subelements(unsigned int sub_dim)
static LocalPoint bary_to_local(const BaryPoint &bp)
Converts from barycentric to local coordinates.
Global macros to enhance readability and debugging, general constants.
static FaceBaryPoint barycentric_on_face(const BaryPoint &barycentric, unsigned int i_face)
#define ASSERT_LE_DBG(a, b)
Definition of comparative assert macro (Less or Equal) only for debug mode.
std::array< unsigned int, Size > IdxVector
static double side_measure(unsigned int sid)
arma::vec::fixed< dim > FaceBaryPoint
static BaryPoint local_to_bary(const LocalPoint &lp)
Converts from local to barycentric coordinates.
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc...
static BarycentricUnitVec make_bary_unit_vec()
static BaryPoint clip(const BaryPoint &barycentric)
arma::vec::fixed< dim+1 > BaryPoint
IntersectionPoint * interpolate(const IntersectionPoint &A1, const IntersectionPoint &A2, double t)
#define ASSERT_LT_DBG(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.