Skip to content
Snippets Groups Projects
Commit 39f9d1e4 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Get node_id_per_cell_vector using connectivity object

Tried to get values from a specialized access function according to the type of
items but does not always compile depending on the placement of the called
function.
If the template function call is operated into the connectivity class,
everything works like a charm, but using it outside leads to weird compilation
issue. Is it a compiler issue?
parent 854497eb
No related branches found
No related tags found
1 merge request!6Feature/crs
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <TinyVector.hpp> #include <TinyVector.hpp>
#include <ConnectivityUtils.hpp> #include <ConnectivityUtils.hpp>
#include <TypeOfItem.hpp>
#include <RefId.hpp> #include <RefId.hpp>
#include <RefNodeList.hpp> #include <RefNodeList.hpp>
...@@ -26,6 +27,11 @@ public: ...@@ -26,6 +27,11 @@ public:
// a local node in a cell // a local node in a cell
ConnectivityMatrix m_node_id_per_cell_matrix; ConnectivityMatrix m_node_id_per_cell_matrix;
ConnectivityMatrix subItemIdPerItemMatrix() const
{
return m_node_id_per_cell_matrix;
}
private: private:
std::vector<RefNodeList> m_ref_node_list; std::vector<RefNodeList> m_ref_node_list;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <map> #include <map>
#include <algorithm> #include <algorithm>
#include <TypeOfItem.hpp>
#include <RefId.hpp> #include <RefId.hpp>
#include <RefNodeList.hpp> #include <RefNodeList.hpp>
#include <RefFaceList.hpp> #include <RefFaceList.hpp>
...@@ -33,6 +34,11 @@ class Connectivity2D ...@@ -33,6 +34,11 @@ class Connectivity2D
// a local node in a cell // a local node in a cell
ConnectivityMatrix m_node_id_per_cell_matrix; ConnectivityMatrix m_node_id_per_cell_matrix;
inline ConnectivityMatrix subItemIdPerItemMatrix() const
{
return m_node_id_per_cell_matrix;
}
private: private:
std::vector<RefFaceList> m_ref_face_list; std::vector<RefFaceList> m_ref_face_list;
std::vector<RefNodeList> m_ref_node_list; std::vector<RefNodeList> m_ref_node_list;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <algorithm> #include <algorithm>
#include <RefId.hpp> #include <RefId.hpp>
#include <TypeOfItem.hpp>
#include <RefNodeList.hpp> #include <RefNodeList.hpp>
#include <RefFaceList.hpp> #include <RefFaceList.hpp>
...@@ -41,6 +42,11 @@ public: ...@@ -41,6 +42,11 @@ public:
// a local node in a cell // a local node in a cell
ConnectivityMatrix m_node_id_per_cell_matrix; ConnectivityMatrix m_node_id_per_cell_matrix;
inline ConnectivityMatrix subItemIdPerItemMatrix() const
{
return m_node_id_per_cell_matrix;
}
private: private:
std::vector<RefFaceList> m_ref_face_list; std::vector<RefFaceList> m_ref_face_list;
std::vector<RefNodeList> m_ref_node_list; std::vector<RefNodeList> m_ref_node_list;
......
...@@ -203,9 +203,9 @@ class MeshData ...@@ -203,9 +203,9 @@ class MeshData
MeshData(const MeshType& mesh) MeshData(const MeshType& mesh)
: m_mesh(mesh), : m_mesh(mesh),
m_Cjr(mesh.connectivity().m_node_id_per_cell_matrix), m_Cjr(mesh.connectivity()),
m_ljr(mesh.connectivity().m_node_id_per_cell_matrix), m_ljr(mesh.connectivity()),
m_njr(mesh.connectivity().m_node_id_per_cell_matrix), m_njr(mesh.connectivity()),
m_xj("xj", mesh.numberOfCells()), m_xj("xj", mesh.numberOfCells()),
m_Vj("Vj", mesh.numberOfCells()) m_Vj("Vj", mesh.numberOfCells())
{ {
......
#ifndef TYPE_OF_ITEM_HPP
#define TYPE_OF_ITEM_HPP
enum class TypeOfItem {
node = 0,
edge = 1,
face = 2,
cell = 3
};
#endif // TYPE_OF_ITEM_HPP
...@@ -255,10 +255,10 @@ class AcousticSolver ...@@ -255,10 +255,10 @@ class AcousticSolver
m_connectivity(m_mesh.connectivity()), m_connectivity(m_mesh.connectivity()),
m_boundary_condition_list(bc_list), m_boundary_condition_list(bc_list),
m_br("br", m_mesh.numberOfNodes()), m_br("br", m_mesh.numberOfNodes()),
m_Ajr(m_connectivity.m_node_id_per_cell_matrix), m_Ajr(m_connectivity),
m_Ar("Ar", m_mesh.numberOfNodes()), m_Ar("Ar", m_mesh.numberOfNodes()),
m_inv_Ar("inv_Ar", m_mesh.numberOfNodes()), m_inv_Ar("inv_Ar", m_mesh.numberOfNodes()),
m_Fjr(m_connectivity.m_node_id_per_cell_matrix), m_Fjr(m_connectivity),
m_ur("ur", m_mesh.numberOfNodes()), m_ur("ur", m_mesh.numberOfNodes()),
m_rhocj("rho_c", m_mesh.numberOfCells()), m_rhocj("rho_c", m_mesh.numberOfCells()),
m_Vj_over_cj("Vj_over_cj", m_mesh.numberOfCells()) m_Vj_over_cj("Vj_over_cj", m_mesh.numberOfCells())
......
...@@ -2,18 +2,12 @@ ...@@ -2,18 +2,12 @@
#define SUBITEM_VALUE_PER_ITEM_HPP #define SUBITEM_VALUE_PER_ITEM_HPP
#include <Kokkos_StaticCrsGraph.hpp> #include <Kokkos_StaticCrsGraph.hpp>
#include <TypeOfItem.hpp>
#warning should not stand in the scheme directory #warning should not stand in the scheme directory
typedef Kokkos::StaticCrsGraph<unsigned int, Kokkos::HostSpace> ConnectivityMatrix; typedef Kokkos::StaticCrsGraph<unsigned int, Kokkos::HostSpace> ConnectivityMatrix;
enum class TypeOfItem {
node,
edge,
face,
cell
};
template <typename DataType, template <typename DataType,
TypeOfItem SubItemType, TypeOfItem SubItemType,
TypeOfItem ItemType> TypeOfItem ItemType>
...@@ -166,8 +160,10 @@ class SubItemValuePerItem ...@@ -166,8 +160,10 @@ class SubItemValuePerItem
} }
SubItemValuePerItem() = default; SubItemValuePerItem() = default;
SubItemValuePerItem(const ConnectivityMatrix& subitem_id_per_item_matrix)
: m_subitem_id_per_item_matrix(subitem_id_per_item_matrix), template <typename ConnectivityType>
SubItemValuePerItem(const ConnectivityType& connectivity)
: m_subitem_id_per_item_matrix(connectivity.subItemIdPerItemMatrix()),
m_values("values", m_subitem_id_per_item_matrix.entries.extent(0)) m_values("values", m_subitem_id_per_item_matrix.entries.extent(0))
{ {
; ;
...@@ -176,7 +172,6 @@ class SubItemValuePerItem ...@@ -176,7 +172,6 @@ class SubItemValuePerItem
~SubItemValuePerItem() = default; ~SubItemValuePerItem() = default;
}; };
template <typename DataType> template <typename DataType>
using NodeValuePerCell = SubItemValuePerItem<DataType, TypeOfItem::node, TypeOfItem::cell>; using NodeValuePerCell = SubItemValuePerItem<DataType, TypeOfItem::node, TypeOfItem::cell>;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment