Skip to content
Snippets Groups Projects
Commit 752abdbe authored by Stéphane Del Pino's avatar Stéphane Del Pino Committed by Stéphane Del Pino
Browse files

Change a set of Connectivity data access returned types

Many data access were provided as a WeakItemValue are now returned as
ItemValue. This may never be a problem since it is unlikely that a
Connectivity object could be destroyed and not these values.

The new API is always better.
parent 78e50317
No related branches found
No related tags found
1 merge request!132Reduce memory use and allocations for some connectivity descriptors
......@@ -134,42 +134,42 @@ class Connectivity final : public IConnectivity
public:
PUGS_INLINE
const auto&
CellValue<const CellType>
cellType() const
{
return m_cell_type;
}
PUGS_INLINE
const auto&
CellValue<const int>
cellNumber() const
{
return m_cell_number;
}
PUGS_INLINE
const auto&
FaceValue<const int>
faceNumber() const
{
return m_face_number;
}
PUGS_INLINE
const auto&
EdgeValue<const int>
edgeNumber() const
{
return m_edge_number;
}
PUGS_INLINE
const auto&
NodeValue<const int>
nodeNumber() const
{
return m_node_number;
}
template <ItemType item_type>
PUGS_INLINE const auto&
PUGS_INLINE auto
number() const
{
if constexpr (item_type == ItemType::cell) {
......@@ -186,28 +186,28 @@ class Connectivity final : public IConnectivity
}
PUGS_INLINE
const auto&
CellValue<const int>
cellOwner() const
{
return m_cell_owner;
}
PUGS_INLINE
const auto&
FaceValue<const int>
faceOwner() const
{
return m_face_owner;
}
PUGS_INLINE
const auto&
EdgeValue<const int>
edgeOwner() const
{
return m_edge_owner;
}
PUGS_INLINE
const auto&
NodeValue<const int>
nodeOwner() const
{
return m_node_owner;
......@@ -231,35 +231,35 @@ class Connectivity final : public IConnectivity
}
PUGS_INLINE
const auto&
CellValue<const bool>
cellIsOwned() const
{
return m_cell_is_owned;
}
PUGS_INLINE
const auto&
FaceValue<const bool>
faceIsOwned() const
{
return m_face_is_owned;
}
PUGS_INLINE
const auto&
EdgeValue<const bool>
edgeIsOwned() const
{
return m_edge_is_owned;
}
PUGS_INLINE
const auto&
NodeValue<const bool>
nodeIsOwned() const
{
return m_node_is_owned;
}
template <ItemType item_type>
PUGS_INLINE const auto&
PUGS_INLINE auto
isOwned() const
{
if constexpr (item_type == ItemType::cell) {
......@@ -276,7 +276,7 @@ class Connectivity final : public IConnectivity
}
PUGS_INLINE
const auto&
FaceValue<const bool>
isBoundaryFace() const
{
if (not m_is_boundary_face.isBuilt()) {
......@@ -286,7 +286,7 @@ class Connectivity final : public IConnectivity
}
PUGS_INLINE
const auto&
EdgeValue<const bool>
isBoundaryEdge() const
{
if (not m_is_boundary_edge.isBuilt()) {
......@@ -296,7 +296,7 @@ class Connectivity final : public IConnectivity
}
PUGS_INLINE
const auto&
NodeValue<const bool>
isBoundaryNode() const
{
if (not m_is_boundary_node.isBuilt()) {
......@@ -306,7 +306,7 @@ class Connectivity final : public IConnectivity
}
template <ItemType item_type>
PUGS_INLINE const auto&
PUGS_INLINE auto
isBoundary() const
{
if constexpr (item_type == ItemType::face) {
......@@ -328,43 +328,44 @@ class Connectivity final : public IConnectivity
const ConnectivityMatrix& connectivity_matrix = m_item_to_item_matrix[itemTId(item_type_0)][itemTId(item_type_1)];
return connectivity_matrix.isBuilt();
}
template <ItemType source_item_type, ItemType target_item_type>
PUGS_INLINE auto
PUGS_INLINE ItemToItemMatrix<source_item_type, target_item_type>
getItemToItemMatrix() const
{
return ItemToItemMatrix<source_item_type, target_item_type>(_getMatrix(source_item_type, target_item_type));
}
PUGS_INLINE
auto
ItemToItemMatrix<ItemType::cell, ItemType::face>
cellToFaceMatrix() const
{
return this->template getItemToItemMatrix<ItemType::cell, ItemType::face>();
}
PUGS_INLINE
auto
ItemToItemMatrix<ItemType::cell, ItemType::edge>
cellToEdgeMatrix() const
{
return this->template getItemToItemMatrix<ItemType::cell, ItemType::edge>();
}
PUGS_INLINE
auto
ItemToItemMatrix<ItemType::cell, ItemType::node>
cellToNodeMatrix() const
{
return this->template getItemToItemMatrix<ItemType::cell, ItemType::node>();
}
PUGS_INLINE
auto
ItemToItemMatrix<ItemType::face, ItemType::cell>
faceToCellMatrix() const
{
return this->template getItemToItemMatrix<ItemType::face, ItemType::cell>();
}
PUGS_INLINE
auto
ItemToItemMatrix<ItemType::face, ItemType::edge>
faceToEdgeMatrix() const
{
static_assert(Dimension > 2, "face to edge matrix makes sense in dimension > 2");
......@@ -372,7 +373,7 @@ class Connectivity final : public IConnectivity
}
PUGS_INLINE
auto
ItemToItemMatrix<ItemType::face, ItemType::node>
faceToNodeMatrix() const
{
static_assert(Dimension > 1, "face to node matrix makes sense in dimension > 1");
......@@ -380,14 +381,14 @@ class Connectivity final : public IConnectivity
}
PUGS_INLINE
auto
ItemToItemMatrix<ItemType::edge, ItemType::cell>
edgeToCellMatrix() const
{
return this->template getItemToItemMatrix<ItemType::edge, ItemType::cell>();
}
PUGS_INLINE
auto
ItemToItemMatrix<ItemType::edge, ItemType::face>
edgeToFaceMatrix() const
{
static_assert(Dimension > 2, "edge to face matrix makes sense in dimension > 2");
......@@ -395,7 +396,7 @@ class Connectivity final : public IConnectivity
}
PUGS_INLINE
auto
ItemToItemMatrix<ItemType::edge, ItemType::node>
edgeToNodeMatrix() const
{
static_assert(Dimension > 1, "edge to node matrix makes sense in dimension > 1");
......@@ -403,14 +404,14 @@ class Connectivity final : public IConnectivity
}
PUGS_INLINE
auto
ItemToItemMatrix<ItemType::node, ItemType::cell>
nodeToCellMatrix() const
{
return this->template getItemToItemMatrix<ItemType::node, ItemType::cell>();
}
PUGS_INLINE
auto
ItemToItemMatrix<ItemType::node, ItemType::face>
nodeToFaceMatrix() const
{
static_assert(Dimension > 1, "node to face matrix makes sense in dimension > 1");
......@@ -418,7 +419,7 @@ class Connectivity final : public IConnectivity
}
PUGS_INLINE
auto
ItemToItemMatrix<ItemType::node, ItemType::edge>
nodeToEdgeMatrix() const
{
static_assert(Dimension > 1, "node to edge matrix makes sense in dimension > 1");
......@@ -426,7 +427,7 @@ class Connectivity final : public IConnectivity
}
PUGS_INLINE
const auto&
FaceValuePerCell<const bool>
cellFaceIsReversed() const
{
static_assert(Dimension > 1, "reversed faces makes no sense in dimension 1");
......@@ -434,7 +435,7 @@ class Connectivity final : public IConnectivity
}
PUGS_INLINE
const auto&
EdgeValuePerFace<const bool>
faceEdgeIsReversed() const
{
static_assert(Dimension > 2, "reversed edges makes no sense in dimension 1 or 2");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment