34 template<std::
size_t n>
37 for(
unsigned int i=0; i<array_vec.size(); i++)
38 for(
unsigned int j=0;j<n; j++)
39 vec[i].push_back(array_vec[i][j]);
118 {(1 << 1) | (1 << 2),
120 (1 << 0) | (1 << 1)},
130 {(1 << 1) | (1 << 2) | (1 << 3),
131 (1 << 0) | (1 << 2) | (1 << 3),
132 (1 << 0) | (1 << 1) | (1 << 3),
133 (1 << 0) | (1 << 1) | (1 << 2),
136 {(1 << 2) | (1 << 3),
141 (1 << 0) | (1 << 1)},
179 { {0}, {1}, {2}, {3} },
186 template<
unsigned int dim>
191 bp.rows(1, dim ) = lp;
192 bp( 0 ) = 1.0 - arma::sum(lp);
200 template<
unsigned int dim>
208 template<
unsigned int dim>
211 return n_sides - sid - 1;
215 template<
unsigned int dim>
218 ASSERT_LT(sid, n_sides).error(
"Side number is out of range!");
227 ASSERT_LT(sid, n_sides).error(
"Side number is out of range!");
229 return node_coords(sid) - node_coords(1-sid);
235 ASSERT_LT(sid, n_sides).error(
"Side number is out of range!");
236 vec::fixed<2> barycenter, bar_side, n, t;
239 t = node_coords(line_nodes_[sid][1]) - node_coords(line_nodes_[sid][0]);
241 barycenter.fill(1./3);
243 bar_side = node_coords(line_nodes_[sid][0]) - barycenter;
249 if (dot(n,bar_side) < 0) n *= -1;
257 ASSERT_LT(sid, n_sides).error(
"Side number is out of range!");
258 vec::fixed<3> barycenter, bar_side, n, t1, t2;
261 t1 = node_coords(side_nodes_[sid][1]) - node_coords(side_nodes_[sid][0]);
262 t2 = node_coords(side_nodes_[sid][2]) - node_coords(side_nodes_[sid][0]);
264 barycenter.fill(0.25);
266 bar_side = node_coords(side_nodes_[sid][0]) - barycenter;
271 if (dot(n,bar_side) < 0) n = -n;
278 template<
unsigned int dim>
281 Eigen::Vector<ArrayDbl,dim> normal_vec_array;
282 for (
uint i=0; i<dim; ++i)
283 normal_vec_array(i).resize( loc_side_idx_array.size() );
284 for (
uint sid=0; sid<loc_side_idx_array.size(); ++sid) {
286 for (
uint i=0; i<dim; ++i)
287 normal_vec_array(i)(sid) = n_vec(i);
289 return normal_vec_array;
297 Eigen::Vector<ArrayDbl,0> normal_vec_array;
298 return normal_vec_array;
303 template<
unsigned int dim>
308 for(
unsigned int i=0; i < dim; i++) {
311 unsigned int i_bary = interact_<0,dim-1>(i_face)[i];
312 face_barycentric[i] = barycentric[ i_bary ];
314 return face_barycentric;
318 template<
unsigned int dim>
322 unsigned int zeros = 0;
323 unsigned int n_zeros = 0;
324 for(
unsigned int i=0; i < dim+1; i++){
325 if(std::fabs(barycentric[i]) <
tolerance)
327 zeros = zeros | (1 << i);
332 return std::make_pair(n_zeros, zeros);
342 template<
unsigned int dim>
346 for(
unsigned int i=0; i<dim; i++) {
347 bary_unit_vec[i][i] = 1.0;
348 bary_unit_vec[i][dim] = -1.0;
349 bary_unit_vec[dim][i] = -1.0 / dim;
351 bary_unit_vec[dim][dim] = 1.0;
352 return bary_unit_vec;
356 template<
unsigned int dim>
361 for(
unsigned int i_bary=0; i_bary < dim +1; i_bary ++) {
362 if (barycentric[i_bary] < 0.0) {
366 unsigned int i_side = (dim - i_bary);
374 projection_to_face = barycentric - barycentric[i_bary]*bary_unit_vec[i_bary];
377 auto bary_on_face = barycentric_on_face(projection_to_face, i_side);
381 return interpolate<dim-1>(sub_clip, i_side);
390 template<
unsigned int dim>
394 if (
list.size() == 0) {
396 for(
unsigned int sdim=0; sdim < dim+1; sdim++) {
402 for(
auto &sub_el_nodes : nodes_of_subelements[sdim]) {
405 for(
unsigned int i_node : sub_el_nodes)
406 center+=node_coords( i_node );
408 list[sdim].push_back(center);
414 return list[sub_dim];
421 ASSERT_LT(sid, n_sides).error(
"Side number is out of range!");
430 ASSERT_LT(sid, n_sides).error(
"Side number is out of range!");
432 return norm(node_coords(line_nodes_[sid][1]) - node_coords(line_nodes_[sid][0]),2);
439 ASSERT_LT(sid, n_sides).error(
"Side number is out of range!");
441 return 0.5*norm(cross(node_coords(side_nodes_[sid][1]) - node_coords(side_nodes_[sid][0]),
442 node_coords(side_nodes_[sid][2]) - node_coords(side_nodes_[sid][0])),2);
451 while (side_lines_[f1][i] != side_lines_[f2][j])
452 if (side_lines_[f1][i] < side_lines_[f2][j]) i++;
454 return side_lines_[f1][i];
461 template<
unsigned int dim>
463 arma::vec::fixed<dim+1> first_coords,
464 arma::vec::fixed<dim+1> second_coords,
465 double first_theta,
double second_theta,
double theta){
467 arma::vec::fixed<dim+1> bary_interpolated_coords;
468 bary_interpolated_coords = ((theta - first_theta) * second_coords + (second_theta - theta) * first_coords)
469 /(second_theta - first_theta);
470 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 Eigen::Vector< ArrayDbl, dim > normal_vector_array(Eigen::Array< uint, Eigen::Dynamic, 1 > loc_side_idx_array)
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 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