35 template<std::
size_t n>
38 for(
unsigned int i=0; i<array_vec.size(); i++)
39 for(
unsigned int j=0;j<n; j++)
40 vec[i].push_back(array_vec[i][j]);
119 {(1 << 1) | (1 << 2),
121 (1 << 0) | (1 << 1)},
131 {(1 << 1) | (1 << 2) | (1 << 3),
132 (1 << 0) | (1 << 2) | (1 << 3),
133 (1 << 0) | (1 << 1) | (1 << 3),
134 (1 << 0) | (1 << 1) | (1 << 2),
137 {(1 << 2) | (1 << 3),
142 (1 << 0) | (1 << 1)},
180 { {0}, {1}, {2}, {3} },
187 template<
unsigned int dim>
192 bp.rows(1, dim ) = lp;
193 bp( 0 ) = 1.0 - arma::sum(lp);
201 template<
unsigned int dim>
209 template<
unsigned int dim>
212 return n_sides - sid - 1;
216 template<
unsigned int dim>
219 ASSERT_LT(sid, n_sides).error(
"Side number is out of range!");
228 ASSERT_LT(sid, n_sides).error(
"Side number is out of range!");
230 return node_coords(sid) - node_coords(1-sid);
236 ASSERT_LT(sid, n_sides).error(
"Side number is out of range!");
237 vec::fixed<2> barycenter, bar_side, n, t;
240 t = node_coords(line_nodes_[sid][1]) - node_coords(line_nodes_[sid][0]);
242 barycenter.fill(1./3);
244 bar_side = node_coords(line_nodes_[sid][0]) - barycenter;
250 if (dot(n,bar_side) < 0) n *= -1;
258 ASSERT_LT(sid, n_sides).error(
"Side number is out of range!");
259 vec::fixed<3> barycenter, bar_side, n, t1, t2;
262 t1 = node_coords(side_nodes_[sid][1]) - node_coords(side_nodes_[sid][0]);
263 t2 = node_coords(side_nodes_[sid][2]) - node_coords(side_nodes_[sid][0]);
265 barycenter.fill(0.25);
267 bar_side = node_coords(side_nodes_[sid][0]) - barycenter;
272 if (dot(n,bar_side) < 0) n = -n;
279 template<
unsigned int dim>
282 Eigen::Matrix<ArenaVec<double>, dim, 1> normal_vec_array;
283 for (
uint i=0; i<dim; ++i)
284 normal_vec_array(i) =
ArenaVec<double>( loc_side_idx_vec.data_size(), loc_side_idx_vec.arena() );
285 for (
uint sid=0; sid<loc_side_idx_vec.data_size(); ++sid) {
287 for (
uint i=0; i<dim; ++i) {
288 normal_vec_array(i)(sid) = n_vec(i);
291 return normal_vec_array;
299 Eigen::Matrix<ArenaVec<double>, 0, 1> normal_vec_array;
300 return normal_vec_array;
305 template<
unsigned int dim>
310 for(
unsigned int i=0; i < dim; i++) {
313 unsigned int i_bary = interact_<0,dim-1>(i_face)[i];
314 face_barycentric[i] = barycentric[ i_bary ];
316 return face_barycentric;
320 template<
unsigned int dim>
324 unsigned int zeros = 0;
325 unsigned int n_zeros = 0;
326 for(
unsigned int i=0; i < dim+1; i++){
327 if(std::fabs(barycentric[i]) <
tolerance)
329 zeros = zeros | (1 << i);
334 return std::make_pair(n_zeros, zeros);
344 template<
unsigned int dim>
348 for(
unsigned int i=0; i<dim; i++) {
349 bary_unit_vec[i][i] = 1.0;
350 bary_unit_vec[i][dim] = -1.0;
351 bary_unit_vec[dim][i] = -1.0 / dim;
353 bary_unit_vec[dim][dim] = 1.0;
354 return bary_unit_vec;
358 template<
unsigned int dim>
363 for(
unsigned int i_bary=0; i_bary < dim +1; i_bary ++) {
364 if (barycentric[i_bary] < 0.0) {
368 unsigned int i_side = (dim - i_bary);
376 projection_to_face = barycentric - barycentric[i_bary]*bary_unit_vec[i_bary];
379 auto bary_on_face = barycentric_on_face(projection_to_face, i_side);
383 return interpolate<dim-1>(sub_clip, i_side);
392 template<
unsigned int dim>
396 if (
list.size() == 0) {
398 for(
unsigned int sdim=0; sdim < dim+1; sdim++) {
404 for(
auto &sub_el_nodes : nodes_of_subelements[sdim]) {
407 for(
unsigned int i_node : sub_el_nodes)
408 center+=node_coords( i_node );
410 list[sdim].push_back(center);
416 return list[sub_dim];
423 ASSERT_LT(sid, n_sides).error(
"Side number is out of range!");
432 ASSERT_LT(sid, n_sides).error(
"Side number is out of range!");
434 return norm(node_coords(line_nodes_[sid][1]) - node_coords(line_nodes_[sid][0]),2);
441 ASSERT_LT(sid, n_sides).error(
"Side number is out of range!");
443 return 0.5*norm(cross(node_coords(side_nodes_[sid][1]) - node_coords(side_nodes_[sid][0]),
444 node_coords(side_nodes_[sid][2]) - node_coords(side_nodes_[sid][0])),2);
453 while (side_lines_[f1][i] != side_lines_[f2][j])
454 if (side_lines_[f1][i] < side_lines_[f2][j]) i++;
456 return side_lines_[f1][i];
463 template<
unsigned int dim>
465 arma::vec::fixed<dim+1> first_coords,
466 arma::vec::fixed<dim+1> second_coords,
467 double first_theta,
double second_theta,
double theta){
469 arma::vec::fixed<dim+1> bary_interpolated_coords;
470 bary_interpolated_coords = ((theta - first_theta) * second_coords + (second_theta - theta) * first_coords)
471 /(second_theta - first_theta);
472 return bary_interpolated_coords;
#define ASSERT_LT(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
#define ASSERT_LE(a, b)
Definition of comparative assert macro (Less or Equal) only for debug mode.
static CentersList centers_of_subelements(unsigned int sub_dim)
static LocalPoint bary_to_local(const BaryPoint &bp)
Converts from barycentric to local coordinates.
static unsigned int normal_orientation(unsigned int sid)
Armor::ArmaVec< double, dim > FaceBaryPoint
Armor::ArmaVec< double, dim+1 > BaryPoint
static FaceBaryPoint barycentric_on_face(const BaryPoint &barycentric, unsigned int i_face)
static BaryPoint line_barycentric_interpolation(BaryPoint first_coords, BaryPoint second_coords, double first_theta, double second_theta, double theta)
arma::vec::fixed< dim > LocalPoint
static BaryPoint local_to_bary(const LocalPoint &lp)
Converts from local to barycentric coordinates.
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 unsigned int line_between_faces(unsigned int f1, unsigned int f2)
static BaryPoint clip(const BaryPoint &barycentric)
static double side_measure(unsigned int sid)
static LocalPoint normal_vector(unsigned int sid)
static unsigned int oposite_node(unsigned int sid)
static Eigen::Matrix< ArenaVec< double >, dim, 1 > normal_vector_array(ArenaVec< uint > loc_side_idx_vec)
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]
Global macros to enhance readability and debugging, general constants.
std::vector< std::vector< unsigned int > > _array_to_vec(const std::vector< IdxVector< n >> array_vec)
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc.
std::array< unsigned int, Size > IdxVector