Go to the documentation of this file. 1 #pragma once // Ensure that file is included only once in a single compilation.
32 template <
unsigned int hyEdge_dimT,
33 unsigned int space_dimT,
34 typename pt_coord_t = double,
36 typename hyEdge_index_t =
unsigned int>
79 template <
unsigned int hyEdge_dimTT>
84 if constexpr (hyEdge_dimTT == 0)
87 for (
unsigned int dim_pt = 0; dim_pt < space_dimT; ++dim_pt)
91 (pt_coord_t)
geometry.n_elements_[ext_dim];
93 "The unit cube has only these cooridnates.");
96 for (; dim < hyEdge_dimT &&
char_length[dim] != 0.; ++dim)
99 for (
unsigned int dim_pt = 0; dim_pt < space_dimT; ++dim_pt)
103 (pt_coord_t)
geometry.n_elements_[ext_dim];
104 hy_assert(0. <= helper && helper <= 1.,
"The unit cube has only these cooridnates.");
116 for (
unsigned int i = 2 * hyEdge_dimTT - 2; i < 2 * hyEdge_dimTT; ++i)
127 for (
unsigned int dim = 0; dim < hyEdge_dimT; ++dim)
139 static constexpr
unsigned int hyEdge_dim() {
return hyEdge_dimT; }
143 static constexpr
unsigned int space_dim() {
return space_dimT; }
156 fill_data<hyEdge_dimT>(0, elem,
geometry);
166 template <
unsigned int n_vec>
170 for (
unsigned int i = 0; i < points.
size(); ++i)
171 hy_assert(points[i] >= 0. && points[i] <= 1.,
"Point must lie in reference square!");
174 rep_mat<space_dimT, n_vec, pt_coord_t>(
translation);
175 for (
unsigned int j = 0; j < n_vec; ++j)
176 for (
unsigned int i = 0; i < hyEdge_dimT; ++i)
187 template <
unsigned int n_vec>
191 hy_assert(hyEdge_dimT == space_dimT,
"This is only valid of the problem is of volumetype.");
192 for (
unsigned int i = 0; i < points.
size(); ++i)
193 hy_assert(points[i] >= 0. && points[i] <= 1.,
"Point must lie in reference square!");
195 for (
unsigned int j = 0; j < n_vec; ++j)
196 for (
unsigned int i = 0; i < space_dimT; ++i)
212 hy_assert(
index < hyEdge_dimT,
"There are only " << hyEdge_dimT <<
" spanning vectors.");
224 return diagonal<hyEdge_dimT, hyEdge_dimT, pt_coord_t>(
char_length);
235 unsigned int helper = 0;
238 while (std::find(dim_ind.begin(), dim_ind.end(), helper) != dim_ind.end())
251 pt_coord_t
area = 1.;
252 for (
unsigned int dim = 0; dim < hyEdge_dimT; ++dim)
261 hy_assert(
index < 2 * hyEdge_dimT,
"A hyperedge has 2 * dim(hyEdge) faces.");
262 pt_coord_t
area = 1.;
263 for (
unsigned int dim = 0; dim < hyEdge_dimT; ++dim)
264 if (dim !=
index / 2)
278 hy_assert(
index < 2 * hyEdge_dimT,
"A hyperedge has 2 * dim(hyEdge) inner normals.");
293 hy_assert(
index < 2 * hyEdge_dimT,
"A hyperedge has 2 * dim(hyEdge) inner normals.");
303 hy_assert(
index < 2 * hyEdge_dimT,
"A hyperedge has 2 * dim(hyEdge) inner normals.");
305 local_center[
index / 2] =
index % 2 ? 1. : 0.;
316 "This function returns one of the dim(space) - dim(hyEdge) orthonormal vectors "
317 <<
"which are orthogonal to the hyperedge.");
320 unsigned int dim = 0;
321 for (
unsigned int cnt = 0; cnt <
index + 1; ++dim)
331 template <
unsigned int n_sub_po
ints,
typename one_dim_
float_t>
336 static_assert(n_sub_points > 0,
"No subpoints do not make sense!");
338 "The index must not exceed the number of prescribed lexicographic points.");
340 for (
unsigned int dim = 0; dim < hyEdge_dimT; ++dim)
342 pt[dim] = (pt_coord_t)points_1d[
index % n_sub_points];
343 index /= n_sub_points;
352 template <
unsigned int n_sub_po
ints,
typename one_dim_
float_t>
355 unsigned int boundary_number,
356 float boundary_scale,
359 static_assert(n_sub_points > 0,
"No subpoints do not make sense!");
360 hy_assert(
index < std::pow(n_sub_points, hyEdge_dimT - 1) * hyEdge_dimT * 2,
361 "The index must not exceed the number of prescribed lexicographic points.");
362 Point<hyEdge_dimT - 1, pt_coord_t> subpt;
363 index =
index - std::pow(n_sub_points, hyEdge_dimT - 1) * boundary_number;
364 for (
unsigned int subdim = 0; subdim < hyEdge_dimT - 1; ++subdim)
366 subpt[subdim] = (pt_coord_t)points_1d[
index % n_sub_points];
367 index /= n_sub_points;
370 unsigned int subd = 0;
371 for (
unsigned int d = 0; d < hyEdge_dimT; d++)
373 if (boundary_number / 2 == d)
374 pt[d] = boundary_scale * (boundary_number % 2 - 0.5) + 0.5;
376 pt[d] = subpt[subd++];
388 static constexpr
unsigned int hyEdge_dim() {
return hyEdge_dimT; }
394 static constexpr
unsigned int space_dim() {
return space_dimT; }
503 Wrapper::create_tpcc<hyEdge_dimT, hyEdge_dimT, TPCC::boundaries::both, hyEdge_index_t>(
Tensor coordinates for a facet of dimension k in the complex of dimension n.
Definition: element.h:38
This file provides the function hy_assert.
A namespace containing the different wrapper functions.
Definition: lapack.hxx:20
index
Definition: check_push_test.py:10
@ both
Definition: lexicographic.h:11
ConstructorVecT constructor_value_type
Defines the value type of input argument for standard constructor.
Definition: unit_cube.hxx:440
A namespace containing classes describing hypergraph geometries.
Definition: file.hxx:8
Point< space_dimT, pt_coord_t > face_barycenter(const unsigned int index) const
Return barycenter of face of given index.
Definition: unit_cube.hxx:301
boundaries
Definition: lexicographic.h:9
SmallVec< hyEdge_dimT, pt_coord_t > char_length
Lengths of the orthotope's lines which are parallel to the dim_indices axes.
Definition: unit_cube.hxx:62
unsigned int fill_data(unsigned int index, const Wrapper::tpcc_elem_t< hyEdge_dimTT, space_dimT > &elem, const UnitCube &geometry)
Fill data of hyEdge.
Definition: unit_cube.hxx:80
const Wrapper::tpcc_t< hyEdge_dimT, space_dimT, TPCC::boundaries::both, hyEdge_index_t > tpcc_elements_
Tensor product chain complex for elements.
Definition: unit_cube.hxx:407
unsigned int exterior_coordinate(const auto &elem, const unsigned int index)
Return coordinate value with respect to index-th orthonormal direction on element.
Definition: tpcc.hxx:150
unsigned int n_loc_ref_elem
Number of refined elements per element.
Definition: unit_cube.hxx:419
auto get_face(const auto &elem, const unsigned int index)
Return i-th element facet.
Definition: tpcc.hxx:121
Point< space_dimT, pt_coord_t > inner_normal(const unsigned int index) const
Return inner normal of given index.
Definition: unit_cube.hxx:291
unsigned int interior_coordinate(const auto &elem, const unsigned int index)
Return coordinate value with respect to index-th orthonormal direction of element.
Definition: tpcc.hxx:159
const SmallVec< space_dimT, unsigned int > n_elements_
Number of elements per spatial dimension.
Definition: unit_cube.hxx:402
hyEdge(const hyEdge_index_t index, const UnitCube &geometry)
Construct a orthotopic hyperedge from its index and the surrounding unit hypercube.
Definition: unit_cube.hxx:150
auto get_element(const auto &tpcc, const auto index)
Return the element of given index the TPCC.
Definition: tpcc.hxx:92
Point< space_dimT, pt_coord_t > boundary_lexicographic(unsigned int index, unsigned int boundary_number, float boundary_scale, const SmallVec< n_sub_points, one_dim_float_t > &points_1d) const
Return equidistant tensorial point of given index on a given boundary face (slightly moved away from ...
Definition: unit_cube.hxx:353
Define the geometry of a unit cube that is subdivided into several orthotopes.
Definition: unit_cube.hxx:37
static constexpr unsigned int size()
Return size a SmallMat.
Definition: dense_la.hxx:54
void adapt_data(const Wrapper::tpcc_elem_t< hyEdge_dimT, hyEdge_dimT > &elem, const UnitCube &geometry)
Refine coarse elememnt.
Definition: unit_cube.hxx:124
Definition: combinations.h:8
static constexpr unsigned int hyEdge_dim()
Return the template parameter representing the dimension of a hyperedge.
Definition: unit_cube.hxx:388
UnitCube(const Topology::Cubic< hyEdge_dimT, space_dimT > &other)
Construct a unit cube from its topological information.
Definition: unit_cube.hxx:469
const SmallSquareMat< space_dimT, pt_coord_t > mat_q() const
Return matrix Q of the QR decomposition of the linear transoformation.
Definition: unit_cube.hxx:229
SmallVec< hyEdge_dimT, unsigned int > dim_indices
The dimensions in wihch the orthotope evolves.
Definition: unit_cube.hxx:58
index_t n_elements(const auto &tpcc)
Return the element of given index the TPCC.
Definition: tpcc.hxx:80
Point< space_dimT, pt_coord_t > outer_normal(const unsigned int index) const
Return outer normal of given index.
Definition: unit_cube.hxx:313
Lexicographic enumeration of the k-dimensional faces in a tensor product chain complex of dimension n...
Definition: lexicographic.h:44
SmallVec< space_dimT, pt_coord_t > span_vec(const unsigned int index) const
Return matrix column of the affine-linear transformation.
Definition: unit_cube.hxx:210
Definition of the topology of a hypergraph — Cubic HyperGraphs.
Definition: cubic.hxx:40
Point< hyEdge_dimT, pt_coord_t > local_normal(const unsigned int index) const
Return local normal of given index.
Definition: unit_cube.hxx:276
pt_coord_t area() const
Return Haussdorff/Lebesque measure of the hyperedge.
Definition: unit_cube.hxx:249
SmallMat< space_dimT, n_vec, pt_coord_t > map_ref_to_phys(const SmallMat< hyEdge_dimT, n_vec, pt_coord_t > &points) const
Map n_vec points from reference to physical element.
Definition: unit_cube.hxx:167
const SmallSquareMat< hyEdge_dimT, pt_coord_t > mat_r() const
Return reduced matrix R of the QR decomposition of the linear transoformation.
Definition: unit_cube.hxx:222
static constexpr unsigned int space_dim()
Return dimension of the surrounding space.
Definition: unit_cube.hxx:143
Definition of the geometry of a single hyperedge.
Definition: unit_cube.hxx:48
Point< space_dimT, pt_coord_t > translation
Translation vector of the origin.
Definition: unit_cube.hxx:54
static constexpr unsigned int pow(unsigned int base)
Return n to the power dim.
Definition: hypercube.hxx:25
unsigned int get_refinement() const
Return the refinement level (equal to number of subintervals).
Definition: unit_cube.hxx:495
pt_coord_t face_area(const unsigned int index) const
Return Haussdorff measure of the specified hypernode.
Definition: unit_cube.hxx:259
#define hy_assert(Expr, Msg)
The assertion to be used within HyperHDG — deactivate using -DNDEBUG compile flag.
Definition: hy_assert.hxx:38
hyEdge value_type
Defines the return value of the class.
Definition: unit_cube.hxx:430
static constexpr unsigned int space_dim()
Return the template parameter representing the dimension of the space.
Definition: unit_cube.hxx:394
Wrapper::tpcc_t< hyEdge_dimT, hyEdge_dimT, TPCC::boundaries::both, hyEdge_index_t > tpcc_ref_elem_
Tensor product chain complex for refined elements.
Definition: unit_cube.hxx:415
void set_refinement(unsigned int level)
Set the refinement level (equal to number of subintervals).
Definition: unit_cube.hxx:499
SmallMat< space_dimT, n_vec, pt_coord_t > & map_ref_to_phys(SmallMat< space_dimT, n_vec, pt_coord_t > &points) const
Map n_vec points from reference to physical element.
Definition: unit_cube.hxx:188
tpcc_t< hyEdge_dim, space_dim, bndT, index_t > create_tpcc(const SmallVec< space_dim, index_t > &vec)
Create a tensor product chain complex.
Definition: tpcc.hxx:62
unsigned int n_subintervals_
Refinment level corresponds to number of subintervals per dimension.
Definition: unit_cube.hxx:411
UnitCube(const constructor_value_type &n_elements)
Construct a cubic that describes a unit cube hypergraph.
Definition: unit_cube.hxx:449
const value_type operator[](const hyEdge_index_t index) const
Get geometrical hyperedge of given index.
Definition: unit_cube.hxx:491
This class implements a small/dense matrix.
Definition: dense_la.hxx:34
unsigned int exterior_direction(const auto &elem, const unsigned int index)
Return the index-th orthonormal direction to element.
Definition: tpcc.hxx:138
static constexpr unsigned int hyEdge_dim()
Return dimension of the hyperedge.
Definition: unit_cube.hxx:139
Point< space_dimT, pt_coord_t > lexicographic(unsigned int index, const SmallVec< n_sub_points, one_dim_float_t > &points_1d) const
Return lexicographically ordered equidistant tensorial point of given index.
Definition: unit_cube.hxx:332
Helper class containing numbers and functions related to hypercubes.
Definition: hypercube.hxx:12