#include <deal.II/grid/reference_cell.h>
#include <deal.II/grid/tria_description.h>
+#include <deal.II/grid/tria_objects_orientations.h>
DEAL_II_NAMESPACE_OPEN
, cell_types(cell_types)
{}
- inline std::vector<unsigned char> &
+ inline TriaObjectsOrientations &
entity_orientations(const unsigned int structdim)
{
if (structdim == 1)
return quad_orientation;
}
- inline const std::vector<unsigned char> &
+ inline const TriaObjectsOrientations &
entity_orientations(const unsigned int structdim) const
{
if (structdim == 1)
CRS<T> line_vertices;
- std::vector<unsigned char> line_orientation;
+ TriaObjectsOrientations line_orientation;
CRS<T> quad_vertices;
CRS<T> quad_lines;
- std::vector<unsigned char> quad_orientation;
+ TriaObjectsOrientations quad_orientation;
CRS<T> cell_entities;
CRS<T> neighbors;
const CRS<unsigned int> & crs,
CRS<unsigned int> & crs_d, // result
CRS<unsigned int> & crs_0, // result
- std::vector<unsigned char> & orientations, // result
+ TriaObjectsOrientations & orientations, // result
const FU & second_key_function)
{
const bool compatibility_mode = true;
}
col_d.resize(keys.size());
- orientations.resize(keys.size());
+ orientations.reinit(keys.size());
// step 2: sort according to key so that entities with same key can be
// merged
if (ref_key != std::get<0>(keys[i]))
{
- // new key
+ // new key: default orientation is correct
counter++;
ref_key = std::get<0>(keys[i]);
ref_indices = ad_entity_vertices[offset_i];
for (const auto j : ad_entity_vertices[offset_i])
if (j != 0)
col_0.push_back(j - offset);
-
- // take its orientation as default
- col_d[offset_i] = counter;
- orientations[offset_i] = 1;
}
else
{
- col_d[offset_i] = counter;
- orientations[offset_i] =
+ // previously seen key: set orientation relative to the first
+ // occurrence
+ orientations.set_raw_orientation(
+ offset_i,
ad_entity_types[offset_i].compute_orientation(
- ad_entity_vertices[offset_i], ref_indices);
+ ad_entity_vertices[offset_i], ref_indices));
}
+ col_d[offset_i] = counter;
}
ptr_0.push_back(col_0.size());
}
const CRS<unsigned int> & crs,
CRS<unsigned int> & crs_d,
CRS<unsigned int> & crs_0,
- std::vector<unsigned char> & orientations,
+ TriaObjectsOrientations & orientations,
const FU & second_key_function)
{
std::size_t key_length = 0;
const CRS<unsigned int> & con_lv,
const CRS<unsigned int> & con_cq,
const CRS<unsigned int> & con_qv,
- const std::vector<unsigned char> & ori_cq,
+ const TriaObjectsOrientations & ori_cq,
CRS<unsigned int> & con_ql, // result
- std::vector<unsigned char> & ori_ql, // result
+ TriaObjectsOrientations & ori_ql, // result
std::vector<dealii::ReferenceCell> & quad_t_id // result
)
{
// reset output
- ori_ql = {};
con_ql.ptr = {};
con_ql.col = {};
// allocate memory
con_ql.col.resize(con_ql.ptr.back());
- ori_ql.resize(con_ql.ptr.back());
+ ori_ql.reinit(con_ql.ptr.back());
// loop over cells
for (unsigned int c = 0; c < con_cq.ptr.size() - 1; ++c)
const unsigned int f = con_cq.col[f_];
// only faces with default orientation have to do something
- if (ori_cq[f_] != 1)
+ if (ori_cq.get_raw_orientation(f_) != 1u)
continue;
// determine entity type of face
}
// ... comparison gives orientation
- ori_ql[con_ql.ptr[f] + l] = (same ? 1 : 0);
+ ori_ql.set_raw_orientation(con_ql.ptr[f] + l, same ? 1u : 0u);
}
}
}
if (dim == 2 || dim == 3) // build lines
{
- std::vector<unsigned char> dummy;
+ TriaObjectsOrientations dummy;
build_entity(1,
cell_t,
// set line orientations
const unsigned char raw_orientation =
- connectivity.entity_orientations(1)[k];
+ connectivity.entity_orientations(1).get_raw_orientation(
+ k);
// it doesn't make sense to set any flags except
// orientation for a line
Assert(raw_orientation == 0u || raw_orientation == 1u,
// in 2D optional: since in in pure QUAD meshes same line
// orientations can be guaranteed
- const bool orientation_needed =
- dim == 3 ||
- (dim == 2 &&
- std::any_of(connectivity.entity_orientations(1).begin(),
- connectivity.entity_orientations(1).end(),
- [](const auto &i) { return i == 0; }));
+ bool orientation_needed = false;
+ if (dim == 3)
+ orientation_needed = true;
+ else if (dim == 2)
+ {
+ const auto &orientations = connectivity.entity_orientations(1);
+ for (unsigned int i = 0; i < orientations.n_objects(); ++i)
+ if (orientations.get_raw_orientation(i) != 1u)
+ {
+ orientation_needed = true;
+ break;
+ }
+ }
// allocate memory
reserve_space_(cells_0, n_cell);
{
level.face_orientations.set_raw_orientation(
cell * GeometryInfo<dim>::faces_per_cell + j,
- connectivity.entity_orientations(dim - 1)[i]);
+ connectivity.entity_orientations(dim - 1)
+ .get_raw_orientation(i));
}
}
}