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_DBG(sid, n_sides).error(
"Side number is out of range!");
227 ASSERT_LT_DBG(sid, n_sides).error(
"Side number is out of range!");
229 return node_coords(sid) - node_coords(1-sid);
235 ASSERT_LT_DBG(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_DBG(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>
283 for(
unsigned int i=0; i < dim; i++) {
286 unsigned int i_bary = interact_<0,dim-1>(i_face)[i];
287 face_barycentric[i] = barycentric[ i_bary ];
289 return face_barycentric;
293 template<
unsigned int dim>
297 unsigned int zeros = 0;
298 unsigned int n_zeros = 0;
299 for(
unsigned int i=0; i < dim+1; i++){
300 if(std::fabs(barycentric[i]) <
tolerance)
302 zeros = zeros | (1 << i);
307 return std::make_pair(n_zeros, zeros);
317 template<
unsigned int dim>
321 for(
unsigned int i=0; i<dim; i++) {
322 bary_unit_vec[i][i] = 1.0;
323 bary_unit_vec[i][dim] = -1.0;
324 bary_unit_vec[dim][i] = -1.0 / dim;
326 bary_unit_vec[dim][dim] = 1.0;
327 return bary_unit_vec;
331 template<
unsigned int dim>
336 for(
unsigned int i_bary=0; i_bary < dim +1; i_bary ++) {
337 if (barycentric[i_bary] < 0.0) {
341 unsigned int i_side = (dim - i_bary);
349 projection_to_face = barycentric - barycentric[i_bary]*bary_unit_vec[i_bary];
352 auto bary_on_face = barycentric_on_face(projection_to_face, i_side);
356 return interpolate<dim-1>(sub_clip, i_side);
365 template<
unsigned int dim>
369 if (
list.size() == 0) {
371 for(
unsigned int sdim=0; sdim < dim+1; sdim++) {
377 for(
auto &sub_el_nodes : nodes_of_subelements[sdim]) {
380 for(
unsigned int i_node : sub_el_nodes)
381 center+=node_coords( i_node );
383 list[sdim].push_back(center);
389 return list[sub_dim];
396 ASSERT_LT_DBG(sid, n_sides).error(
"Side number is out of range!");
405 ASSERT_LT_DBG(sid, n_sides).error(
"Side number is out of range!");
407 return norm(node_coords(line_nodes_[sid][1]) - node_coords(line_nodes_[sid][0]),2);
414 ASSERT_LT_DBG(sid, n_sides).error(
"Side number is out of range!");
416 return 0.5*norm(cross(node_coords(side_nodes_[sid][1]) - node_coords(side_nodes_[sid][0]),
417 node_coords(side_nodes_[sid][2]) - node_coords(side_nodes_[sid][0])),2);
426 while (side_lines_[f1][i] != side_lines_[f2][j])
427 if (side_lines_[f1][i] < side_lines_[f2][j]) i++;
429 return side_lines_[f1][i];
436 template<
unsigned int dim>
438 arma::vec::fixed<dim+1> first_coords,
439 arma::vec::fixed<dim+1> second_coords,
440 double first_theta,
double second_theta,
double theta){
442 arma::vec::fixed<dim+1> bary_interpolated_coords;
443 bary_interpolated_coords = ((theta - first_theta) * second_coords + (second_theta - theta) * first_coords)
444 /(second_theta - first_theta);
445 return bary_interpolated_coords;