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 ...@@ -134,42 +134,42 @@ class Connectivity final : public IConnectivity
public: public:
PUGS_INLINE PUGS_INLINE
const auto& CellValue<const CellType>
cellType() const cellType() const
{ {
return m_cell_type; return m_cell_type;
} }
PUGS_INLINE PUGS_INLINE
const auto& CellValue<const int>
cellNumber() const cellNumber() const
{ {
return m_cell_number; return m_cell_number;
} }
PUGS_INLINE PUGS_INLINE
const auto& FaceValue<const int>
faceNumber() const faceNumber() const
{ {
return m_face_number; return m_face_number;
} }
PUGS_INLINE PUGS_INLINE
const auto& EdgeValue<const int>
edgeNumber() const edgeNumber() const
{ {
return m_edge_number; return m_edge_number;
} }
PUGS_INLINE PUGS_INLINE
const auto& NodeValue<const int>
nodeNumber() const nodeNumber() const
{ {
return m_node_number; return m_node_number;
} }
template <ItemType item_type> template <ItemType item_type>
PUGS_INLINE const auto& PUGS_INLINE auto
number() const number() const
{ {
if constexpr (item_type == ItemType::cell) { if constexpr (item_type == ItemType::cell) {
...@@ -186,28 +186,28 @@ class Connectivity final : public IConnectivity ...@@ -186,28 +186,28 @@ class Connectivity final : public IConnectivity
} }
PUGS_INLINE PUGS_INLINE
const auto& CellValue<const int>
cellOwner() const cellOwner() const
{ {
return m_cell_owner; return m_cell_owner;
} }
PUGS_INLINE PUGS_INLINE
const auto& FaceValue<const int>
faceOwner() const faceOwner() const
{ {
return m_face_owner; return m_face_owner;
} }
PUGS_INLINE PUGS_INLINE
const auto& EdgeValue<const int>
edgeOwner() const edgeOwner() const
{ {
return m_edge_owner; return m_edge_owner;
} }
PUGS_INLINE PUGS_INLINE
const auto& NodeValue<const int>
nodeOwner() const nodeOwner() const
{ {
return m_node_owner; return m_node_owner;
...@@ -231,35 +231,35 @@ class Connectivity final : public IConnectivity ...@@ -231,35 +231,35 @@ class Connectivity final : public IConnectivity
} }
PUGS_INLINE PUGS_INLINE
const auto& CellValue<const bool>
cellIsOwned() const cellIsOwned() const
{ {
return m_cell_is_owned; return m_cell_is_owned;
} }
PUGS_INLINE PUGS_INLINE
const auto& FaceValue<const bool>
faceIsOwned() const faceIsOwned() const
{ {
return m_face_is_owned; return m_face_is_owned;
} }
PUGS_INLINE PUGS_INLINE
const auto& EdgeValue<const bool>
edgeIsOwned() const edgeIsOwned() const
{ {
return m_edge_is_owned; return m_edge_is_owned;
} }
PUGS_INLINE PUGS_INLINE
const auto& NodeValue<const bool>
nodeIsOwned() const nodeIsOwned() const
{ {
return m_node_is_owned; return m_node_is_owned;
} }
template <ItemType item_type> template <ItemType item_type>
PUGS_INLINE const auto& PUGS_INLINE auto
isOwned() const isOwned() const
{ {
if constexpr (item_type == ItemType::cell) { if constexpr (item_type == ItemType::cell) {
...@@ -276,7 +276,7 @@ class Connectivity final : public IConnectivity ...@@ -276,7 +276,7 @@ class Connectivity final : public IConnectivity
} }
PUGS_INLINE PUGS_INLINE
const auto& FaceValue<const bool>
isBoundaryFace() const isBoundaryFace() const
{ {
if (not m_is_boundary_face.isBuilt()) { if (not m_is_boundary_face.isBuilt()) {
...@@ -286,7 +286,7 @@ class Connectivity final : public IConnectivity ...@@ -286,7 +286,7 @@ class Connectivity final : public IConnectivity
} }
PUGS_INLINE PUGS_INLINE
const auto& EdgeValue<const bool>
isBoundaryEdge() const isBoundaryEdge() const
{ {
if (not m_is_boundary_edge.isBuilt()) { if (not m_is_boundary_edge.isBuilt()) {
...@@ -296,7 +296,7 @@ class Connectivity final : public IConnectivity ...@@ -296,7 +296,7 @@ class Connectivity final : public IConnectivity
} }
PUGS_INLINE PUGS_INLINE
const auto& NodeValue<const bool>
isBoundaryNode() const isBoundaryNode() const
{ {
if (not m_is_boundary_node.isBuilt()) { if (not m_is_boundary_node.isBuilt()) {
...@@ -306,7 +306,7 @@ class Connectivity final : public IConnectivity ...@@ -306,7 +306,7 @@ class Connectivity final : public IConnectivity
} }
template <ItemType item_type> template <ItemType item_type>
PUGS_INLINE const auto& PUGS_INLINE auto
isBoundary() const isBoundary() const
{ {
if constexpr (item_type == ItemType::face) { if constexpr (item_type == ItemType::face) {
...@@ -328,43 +328,44 @@ class Connectivity final : public IConnectivity ...@@ -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)]; const ConnectivityMatrix& connectivity_matrix = m_item_to_item_matrix[itemTId(item_type_0)][itemTId(item_type_1)];
return connectivity_matrix.isBuilt(); return connectivity_matrix.isBuilt();
} }
template <ItemType source_item_type, ItemType target_item_type> template <ItemType source_item_type, ItemType target_item_type>
PUGS_INLINE auto PUGS_INLINE ItemToItemMatrix<source_item_type, target_item_type>
getItemToItemMatrix() const getItemToItemMatrix() const
{ {
return ItemToItemMatrix<source_item_type, target_item_type>(_getMatrix(source_item_type, target_item_type)); return ItemToItemMatrix<source_item_type, target_item_type>(_getMatrix(source_item_type, target_item_type));
} }
PUGS_INLINE PUGS_INLINE
auto ItemToItemMatrix<ItemType::cell, ItemType::face>
cellToFaceMatrix() const cellToFaceMatrix() const
{ {
return this->template getItemToItemMatrix<ItemType::cell, ItemType::face>(); return this->template getItemToItemMatrix<ItemType::cell, ItemType::face>();
} }
PUGS_INLINE PUGS_INLINE
auto ItemToItemMatrix<ItemType::cell, ItemType::edge>
cellToEdgeMatrix() const cellToEdgeMatrix() const
{ {
return this->template getItemToItemMatrix<ItemType::cell, ItemType::edge>(); return this->template getItemToItemMatrix<ItemType::cell, ItemType::edge>();
} }
PUGS_INLINE PUGS_INLINE
auto ItemToItemMatrix<ItemType::cell, ItemType::node>
cellToNodeMatrix() const cellToNodeMatrix() const
{ {
return this->template getItemToItemMatrix<ItemType::cell, ItemType::node>(); return this->template getItemToItemMatrix<ItemType::cell, ItemType::node>();
} }
PUGS_INLINE PUGS_INLINE
auto ItemToItemMatrix<ItemType::face, ItemType::cell>
faceToCellMatrix() const faceToCellMatrix() const
{ {
return this->template getItemToItemMatrix<ItemType::face, ItemType::cell>(); return this->template getItemToItemMatrix<ItemType::face, ItemType::cell>();
} }
PUGS_INLINE PUGS_INLINE
auto ItemToItemMatrix<ItemType::face, ItemType::edge>
faceToEdgeMatrix() const faceToEdgeMatrix() const
{ {
static_assert(Dimension > 2, "face to edge matrix makes sense in dimension > 2"); static_assert(Dimension > 2, "face to edge matrix makes sense in dimension > 2");
...@@ -372,7 +373,7 @@ class Connectivity final : public IConnectivity ...@@ -372,7 +373,7 @@ class Connectivity final : public IConnectivity
} }
PUGS_INLINE PUGS_INLINE
auto ItemToItemMatrix<ItemType::face, ItemType::node>
faceToNodeMatrix() const faceToNodeMatrix() const
{ {
static_assert(Dimension > 1, "face to node matrix makes sense in dimension > 1"); static_assert(Dimension > 1, "face to node matrix makes sense in dimension > 1");
...@@ -380,14 +381,14 @@ class Connectivity final : public IConnectivity ...@@ -380,14 +381,14 @@ class Connectivity final : public IConnectivity
} }
PUGS_INLINE PUGS_INLINE
auto ItemToItemMatrix<ItemType::edge, ItemType::cell>
edgeToCellMatrix() const edgeToCellMatrix() const
{ {
return this->template getItemToItemMatrix<ItemType::edge, ItemType::cell>(); return this->template getItemToItemMatrix<ItemType::edge, ItemType::cell>();
} }
PUGS_INLINE PUGS_INLINE
auto ItemToItemMatrix<ItemType::edge, ItemType::face>
edgeToFaceMatrix() const edgeToFaceMatrix() const
{ {
static_assert(Dimension > 2, "edge to face matrix makes sense in dimension > 2"); static_assert(Dimension > 2, "edge to face matrix makes sense in dimension > 2");
...@@ -395,7 +396,7 @@ class Connectivity final : public IConnectivity ...@@ -395,7 +396,7 @@ class Connectivity final : public IConnectivity
} }
PUGS_INLINE PUGS_INLINE
auto ItemToItemMatrix<ItemType::edge, ItemType::node>
edgeToNodeMatrix() const edgeToNodeMatrix() const
{ {
static_assert(Dimension > 1, "edge to node matrix makes sense in dimension > 1"); static_assert(Dimension > 1, "edge to node matrix makes sense in dimension > 1");
...@@ -403,14 +404,14 @@ class Connectivity final : public IConnectivity ...@@ -403,14 +404,14 @@ class Connectivity final : public IConnectivity
} }
PUGS_INLINE PUGS_INLINE
auto ItemToItemMatrix<ItemType::node, ItemType::cell>
nodeToCellMatrix() const nodeToCellMatrix() const
{ {
return this->template getItemToItemMatrix<ItemType::node, ItemType::cell>(); return this->template getItemToItemMatrix<ItemType::node, ItemType::cell>();
} }
PUGS_INLINE PUGS_INLINE
auto ItemToItemMatrix<ItemType::node, ItemType::face>
nodeToFaceMatrix() const nodeToFaceMatrix() const
{ {
static_assert(Dimension > 1, "node to face matrix makes sense in dimension > 1"); static_assert(Dimension > 1, "node to face matrix makes sense in dimension > 1");
...@@ -418,7 +419,7 @@ class Connectivity final : public IConnectivity ...@@ -418,7 +419,7 @@ class Connectivity final : public IConnectivity
} }
PUGS_INLINE PUGS_INLINE
auto ItemToItemMatrix<ItemType::node, ItemType::edge>
nodeToEdgeMatrix() const nodeToEdgeMatrix() const
{ {
static_assert(Dimension > 1, "node to edge matrix makes sense in dimension > 1"); static_assert(Dimension > 1, "node to edge matrix makes sense in dimension > 1");
...@@ -426,7 +427,7 @@ class Connectivity final : public IConnectivity ...@@ -426,7 +427,7 @@ class Connectivity final : public IConnectivity
} }
PUGS_INLINE PUGS_INLINE
const auto& FaceValuePerCell<const bool>
cellFaceIsReversed() const cellFaceIsReversed() const
{ {
static_assert(Dimension > 1, "reversed faces makes no sense in dimension 1"); static_assert(Dimension > 1, "reversed faces makes no sense in dimension 1");
...@@ -434,7 +435,7 @@ class Connectivity final : public IConnectivity ...@@ -434,7 +435,7 @@ class Connectivity final : public IConnectivity
} }
PUGS_INLINE PUGS_INLINE
const auto& EdgeValuePerFace<const bool>
faceEdgeIsReversed() const faceEdgeIsReversed() const
{ {
static_assert(Dimension > 2, "reversed edges makes no sense in dimension 1 or 2"); 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