Skip to content

Commit

Permalink
Merge pull request #1033 from DLR-AMR/fix-rename-uints
Browse files Browse the repository at this point in the history
Renamed uints to the more commong uint32_t datatype.
  • Loading branch information
holke authored Apr 11, 2024
2 parents 527a04c + 4fc4a06 commit bd22617
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,14 @@ t8_geometry_lagrange::t8_geom_h27_basis (const double *ref_point) const
}

t8_forest_t
t8_lagrange_element::create_uniform_forest (t8_cmesh_t cmesh, uint level) const
t8_lagrange_element::create_uniform_forest (t8_cmesh_t cmesh, uint32_t level) const
{
t8_forest_t forest;
forest = t8_forest_new_uniform (cmesh, t8_scheme_new_default_cxx (), level, 0, sc_MPI_COMM_WORLD);
return forest;
}

t8_lagrange_element::t8_lagrange_element (t8_eclass_t eclass, uint degree, std::vector<double> &nodes)
t8_lagrange_element::t8_lagrange_element (t8_eclass_t eclass, uint32_t degree, std::vector<double> &nodes)
: eclass (eclass), degree (degree), nodes (nodes)
{
// TODO: Check if the number of nodes corresponds to the element type and degree.
Expand All @@ -279,20 +279,20 @@ t8_lagrange_element::t8_lagrange_element (t8_eclass_t eclass, uint degree, std::
t8_cmesh_commit (cmesh, sc_MPI_COMM_WORLD);
}

const uint t8_lagrange_element::lagrange_nodes[T8_ECLASS_COUNT][2];
const uint32_t t8_lagrange_element::lagrange_nodes[T8_ECLASS_COUNT][2];

t8_eclass_t
t8_lagrange_element::get_type () const
{
return eclass;
}

std::vector<std::vector<uint>>
std::vector<std::vector<uint32_t>>
t8_lagrange_element::get_face_nodes () const
{
std::ostringstream invalid_degree;
invalid_degree << "Invalid degree " << degree << ".\n";
std::vector<std::vector<uint>> face_nodes;
std::vector<std::vector<uint32_t>> face_nodes;
switch (eclass) {
case T8_ECLASS_LINE:
if (degree == 1)
Expand Down Expand Up @@ -370,20 +370,20 @@ t8_lagrange_element::face_classes () const
}

std::vector<double>
t8_lagrange_element::get_node_coords (uint node) const
t8_lagrange_element::get_node_coords (uint32_t node) const
{
const double *v = t8_cmesh_get_tree_vertices (cmesh, 0);
return std::vector<double> (v + 3 * node, v + 3 * node + 3);
}

std::vector<std::vector<double>>
t8_lagrange_element::get_node_coords (std::vector<uint> &nodes) const
t8_lagrange_element::get_node_coords (std::vector<uint32_t> &nodes) const
{
const double *v = t8_cmesh_get_tree_vertices (cmesh, 0);
size_t n_node = nodes.size ();
std::vector<std::vector<double>> node_coords (n_node);
for (size_t i = 0; i < n_node; ++i) {
uint i_node = nodes[i];
uint32_t i_node = nodes[i];
node_coords[i] = std::vector<double> (v + 3 * i_node, v + 3 * i_node + 3);
}
return node_coords;
Expand All @@ -394,10 +394,10 @@ t8_lagrange_element::decompose () const
{
/* Get the node numbers of the faces */
std::vector<t8_eclass_t> fc = face_classes ();
std::vector<std::vector<uint>> fn = get_face_nodes ();
std::vector<std::vector<uint32_t>> fn = get_face_nodes ();
/* Create a new Lagrange element from each face */
std::vector<t8_lagrange_element> faces;
const uint n_face = t8_eclass_num_faces[eclass];
const uint32_t n_face = t8_eclass_num_faces[eclass];
faces.reserve (n_face);
for (size_t i_face = 0; i_face < n_face; ++i_face) {
auto nc = flatten<double> (get_node_coords (fn[i_face]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ class t8_lagrange_element {
* \param nodes x,y,z coordinates of the nodes, adhering to the numbering
* convention.
*/
t8_lagrange_element (t8_eclass_t eclass, uint degree, std::vector<double> &nodes);
t8_lagrange_element (t8_eclass_t eclass, uint32_t degree, std::vector<double> &nodes);

/**
* Destroy the t8_lagrange_element object.
Expand Down Expand Up @@ -385,7 +385,7 @@ class t8_lagrange_element {
* \return x,y,z coordinates of the node.
*/
std::vector<double>
get_node_coords (uint node) const;
get_node_coords (uint32_t node) const;

/**
* Coordinates of the specified nodes.
Expand All @@ -394,14 +394,14 @@ class t8_lagrange_element {
* \return x,y,z coordinates of the nodes.
*/
std::vector<std::vector<double>>
get_node_coords (std::vector<uint> &nodes) const;
get_node_coords (std::vector<uint32_t> &nodes) const;

/**
* Node labels on the faces of the element.
*
* \return Node labels on each face of the element.
*/
std::vector<std::vector<uint>>
std::vector<std::vector<uint32_t>>
get_face_nodes () const;

/**
Expand Down Expand Up @@ -434,7 +434,7 @@ class t8_lagrange_element {
* \return Coordinates of the points, given in x,y,z.
*/
std::vector<std::array<double, T8_ECLASS_MAX_DIM>>
sample (uint n_point) const;
sample (uint32_t n_point) const;

/**
* Map this element on the face of a higher-dimensional element.
Expand Down Expand Up @@ -489,16 +489,16 @@ class t8_lagrange_element {
/** Lagrange elements have the same element class as the linear ones. */
t8_eclass_t eclass;
/** Polynomial degree of the geometrical mapping. */
const uint degree;
const uint32_t degree;
/** Points in the physical space, which span the geometry of the element. */
const std::vector<double> nodes;
/** Coarse mesh, wrapped by this class. */
t8_cmesh_t cmesh;
/** Number of nodes in the Lagrange element of a given class and degree */
static constexpr uint lagrange_nodes[T8_ECLASS_COUNT][2] = { { 1, 1 }, { 2, 3 }, { 4, 9 }, { 3, 6 }, { 8, 27 } };
static constexpr uint32_t lagrange_nodes[T8_ECLASS_COUNT][2] = { { 1, 1 }, { 2, 3 }, { 4, 9 }, { 3, 6 }, { 8, 27 } };

t8_forest_t
create_uniform_forest (t8_cmesh_t cmesh, uint level) const;
create_uniform_forest (t8_cmesh_t cmesh, uint32_t level) const;
};

#endif /* !T8_GEOMETRY_LAGRANGE_HXX */
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ allclose (const U &a, const V &b, double tol = T8_PRECISION_SQRT_EPS)
* \return Coordinates of the points, given in x,y,z.
*/
std::vector<std::array<double, T8_ECLASS_MAX_DIM>>
sample (t8_eclass_t eclass, uint n_point)
sample (t8_eclass_t eclass, uint32_t n_point)
{
std::srand (time (NULL));
std::vector<std::array<double, T8_ECLASS_MAX_DIM>> points (n_point);
Expand Down Expand Up @@ -228,7 +228,7 @@ TEST_P (LagrangeCmesh, lagrange_mapping)
t8_lagrange_element lag = create_sample_element (eclass, degree);
/* Compare the mappings on each boundary face of the Lagrange element */
std::vector<t8_lagrange_element> faces = lag.decompose ();
uint i_face = 0;
uint32_t i_face = 0;
for (const auto &face : faces) {
auto points_on_face = sample (face.get_type (), T8_NUM_SAMPLE_POINTS);
for (const auto &point : points_on_face) {
Expand Down

0 comments on commit bd22617

Please sign in to comment.