28 template<
unsigned int 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]);
102 { {0}, {1}, {2}, {3} },
109 template<
unsigned int dim>
112 OLD_ASSERT(nid < n_nodes,
"Vertex number is out of range!");
124 template<
unsigned int dim>
127 OLD_ASSERT(nid < n_nodes,
"Vertex number is out of range!");
144 OLD_ASSERT(sid < n_sides,
"Side number is out of range!");
146 return node_coords(sid) - node_coords(1-sid);
152 OLD_ASSERT(sid < n_sides,
"Side number is out of range!");
153 vec::fixed<2> barycenter, bar_side, n, t;
156 t = node_coords(side_nodes[sid][1]) - node_coords(side_nodes[sid][0]);
158 barycenter.fill(1./3);
160 bar_side = node_coords(side_nodes[sid][0]) - barycenter;
166 if (dot(n,bar_side) < 0) n *= -1;
174 OLD_ASSERT(sid < n_sides,
"Side number is out of range!");
175 vec::fixed<3> barycenter, bar_side, n, t1, t2;
178 t1 = node_coords(side_nodes[sid][1]) - node_coords(side_nodes[sid][0]);
179 t2 = node_coords(side_nodes[sid][2]) - node_coords(side_nodes[sid][0]);
181 barycenter.fill(0.25);
183 bar_side = node_coords(side_nodes[sid][0]) - barycenter;
188 if (dot(n,bar_side) < 0) n = -n;
195 template<
unsigned int dim>
200 for(
unsigned int i=0; i < dim; i++) {
201 unsigned int i_sub_node = (i+1)%dim;
202 unsigned int i_bary = (dim + side_nodes[i_face][i_sub_node])%(dim+1);
203 face_barycentric[i] = barycentric[ i_bary ];
205 return face_barycentric;
209 template<
unsigned int dim>
215 for(
unsigned int i_sub_coord=0; i_sub_coord<dim; i_sub_coord++) {
216 unsigned int i_sub_node = (i_sub_coord+1)%dim;
217 barycentric+=face_barycentric(i_sub_coord)*node_barycentric_coords( side_nodes[i_face][i_sub_node]);
228 template<
unsigned int dim>
232 for(
unsigned int i=0; i<dim; i++) {
233 bary_unit_vec[i][i] = 1.0;
234 bary_unit_vec[i][dim] = -1.0;
235 bary_unit_vec[dim][i] = -1.0 / dim;
237 bary_unit_vec[dim][dim] = 1.0;
238 return bary_unit_vec;
242 template<
unsigned int dim>
247 for(
unsigned int i_bary=0; i_bary < dim +1; i_bary ++) {
248 if (barycentric[i_bary] < 0.0) {
252 unsigned int i_side = (2*dim - i_bary)%(dim +1);
254 arma::vec projection_to_face(dim+1);
260 projection_to_face = barycentric - barycentric[i_bary]*bary_unit_vec[i_bary];
263 auto bary_on_face = barycentric_on_face(projection_to_face, i_side);
267 return barycentric_from_face(sub_clip, i_side);
276 template<
unsigned int dim>
280 if (list.size() == 0) {
282 for(
unsigned int sdim=0; sdim < dim+1; sdim++) {
288 for(
auto &sub_el_nodes : nodes_of_subelements[sdim]) {
291 for(
unsigned int i_node : sub_el_nodes)
292 center+=node_coords( i_node );
294 list[sdim].push_back(center);
300 return list[sub_dim];
307 OLD_ASSERT(sid < n_sides,
"Side number is out of range!");
316 OLD_ASSERT(sid < n_sides,
"Side number is out of range!");
318 return norm(node_coords(side_nodes[sid][1]) - node_coords(side_nodes[sid][0]),2);
325 OLD_ASSERT(sid < n_sides,
"Side number is out of range!");
327 return 0.5*norm(cross(node_coords(side_nodes[sid][1]) - node_coords(side_nodes[sid][0]),
328 node_coords(side_nodes[sid][2]) - node_coords(side_nodes[sid][0])),2);
337 while (side_lines[f1][i] != side_lines[f2][j])
338 if (side_lines[f1][i] < side_lines[f2][j]) i++;
340 return side_lines[f1][i];
345 template<
unsigned int dim>
349 for (index = 0; index < n_side_permutations; index++)
350 if (equal(p, p + n_nodes_per_side, side_permutations[index]))
static LocalPoint normal_vector(unsigned int sid)
std::vector< std::vector< unsigned int > > _array_to_vec(const unsigned int array[][n], unsigned int m)
#define ASSERT_EQ_DBG(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
static LocalPoint node_coords(unsigned int nid)
static unsigned int permutation_index(unsigned int p[n_nodes_per_side])
arma::vec::fixed< dim > LocalPoint
static BaryPoint barycentric_from_face(const FaceBaryPoint &face_barycentric, unsigned int i_face)
static unsigned int line_between_faces(unsigned int f1, unsigned int f2)
static CentersList centers_of_subelements(unsigned int sub_dim)
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.
static double side_measure(unsigned int sid)
arma::vec::fixed< dim > FaceBaryPoint
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc...
static BarycentricUnitVec make_bary_unit_vec()
static BaryPoint clip(const BaryPoint &barycentric)
static BaryPoint node_barycentric_coords(unsigned int nid)
arma::vec::fixed< dim+1 > BaryPoint