diff --git a/src/main.cpp b/src/main.cpp index 4bdc52d00d5714866d00bc4965215c74d6e3ec21..8e640d841a1e3d82b4fabe8c255f7f038801005d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -194,7 +194,7 @@ int main(int argc, char *argv[]) typedef TinyVector<MeshType::dimension> Rd; - const ValuePerCell<const double>& Vj = mesh_data.Vj(); + const CellValue<const double>& Vj = mesh_data.Vj(); const double tmax=0.2; double t=0; @@ -301,7 +301,7 @@ int main(int argc, char *argv[]) AcousticSolver<MeshDataType> acoustic_solver(mesh_data, unknowns, bc_list); - const ValuePerCell<const double>& Vj = mesh_data.Vj(); + const CellValue<const double>& Vj = mesh_data.Vj(); const double tmax=0.2; double t=0; @@ -397,7 +397,7 @@ int main(int argc, char *argv[]) AcousticSolver<MeshDataType> acoustic_solver(mesh_data, unknowns, bc_list); - const ValuePerCell<const double>& Vj = mesh_data.Vj(); + const CellValue<const double>& Vj = mesh_data.Vj(); const double tmax=0.2; double t=0; diff --git a/src/mesh/ValuePerItem.hpp b/src/mesh/ItemValue.hpp similarity index 70% rename from src/mesh/ValuePerItem.hpp rename to src/mesh/ItemValue.hpp index 98796c2bf3906a7bbccde9802e4ff797775c8e52..a00cb3bfd773d0dc0990be6436d39f97b4c70918 100644 --- a/src/mesh/ValuePerItem.hpp +++ b/src/mesh/ItemValue.hpp @@ -1,5 +1,5 @@ -#ifndef VALUE_PER_ITEM_HPP -#define VALUE_PER_ITEM_HPP +#ifndef ITEM_VALUE_HPP +#define ITEM_VALUE_HPP #include <ItemType.hpp> #include <PastisAssert.hpp> @@ -8,7 +8,7 @@ template <typename DataType, ItemType item_type> -class ValuePerItem +class ItemValue { public: static const ItemType item_t{item_type}; @@ -19,8 +19,8 @@ class ValuePerItem Kokkos::View<DataType*> m_values; // Allows const version to access our data - friend ValuePerItem<std::add_const_t<DataType>, - item_type>; + friend ItemValue<std::add_const_t<DataType>, + item_type>; public: KOKKOS_FORCEINLINE_FUNCTION @@ -64,16 +64,16 @@ class ValuePerItem template <typename DataType2> KOKKOS_INLINE_FUNCTION - ValuePerItem& - operator=(const ValuePerItem<DataType2, item_type>& value_per_item) + ItemValue& + operator=(const ItemValue<DataType2, item_type>& value_per_item) { // ensures that DataType is the same as source DataType2 static_assert(std::is_same<std::remove_const_t<DataType>, std::remove_const_t<DataType2>>(), - "Cannot assign ValuePerItem of different type"); + "Cannot assign ItemValue of different type"); // ensures that const is not lost through copy static_assert(((std::is_const<DataType2>() and std::is_const<DataType>()) or not std::is_const<DataType2>()), - "Cannot assign const ValuePerItem to a non const ValuePerItem"); + "Cannot assign const ItemValue to a non-const ItemValue"); m_values = value_per_item.m_values; m_is_built = value_per_item.m_is_built; @@ -83,32 +83,32 @@ class ValuePerItem template <typename DataType2> KOKKOS_INLINE_FUNCTION - ValuePerItem(const ValuePerItem<DataType2, item_type>& value_per_item) + ItemValue(const ItemValue<DataType2, item_type>& value_per_item) { this->operator=(value_per_item); } - ValuePerItem() = default; + ItemValue() = default; - ValuePerItem(const IConnectivity& connectivity) + ItemValue(const IConnectivity& connectivity) : m_is_built{true} { m_values = Kokkos::View<std::remove_const_t<DataType>*>("values", connectivity.numberOf<item_type>()); } - ~ValuePerItem() = default; + ~ItemValue() = default; }; template <typename DataType> -using ValuePerNode = ValuePerItem<DataType, ItemType::node>; +using NodeValue = ItemValue<DataType, ItemType::node>; template <typename DataType> -using ValuePerEdge = ValuePerItem<DataType, ItemType::edge>; +using EdgeValue = ItemValue<DataType, ItemType::edge>; template <typename DataType> -using ValuePerFace = ValuePerItem<DataType, ItemType::face>; +using FaceValue = ItemValue<DataType, ItemType::face>; template <typename DataType> -using ValuePerCell = ValuePerItem<DataType, ItemType::cell>; +using CellValue = ItemValue<DataType, ItemType::cell>; -#endif // VALUE_PER_ITEM_HPP +#endif // ITEM_VALUE_HPP diff --git a/src/mesh/MeshData.hpp b/src/mesh/MeshData.hpp index b03f8cda8c323a569115802f306d914ff0921929..254ff42b1ac47f57c377762ed95ac0dfc9af7865 100644 --- a/src/mesh/MeshData.hpp +++ b/src/mesh/MeshData.hpp @@ -4,7 +4,7 @@ #include <Kokkos_Core.hpp> #include <TinyVector.hpp> -#include <ValuePerItem.hpp> +#include <ItemValue.hpp> #include <SubItemValuePerItem.hpp> #include <map> @@ -28,7 +28,7 @@ class MeshData NodeValuePerCell<double> m_ljr; NodeValuePerCell<Rd> m_njr; Kokkos::View<Rd*> m_xj; - ValuePerCell<const double> m_Vj; + CellValue<const double> m_Vj; KOKKOS_INLINE_FUNCTION void _updateCenter() @@ -71,7 +71,7 @@ class MeshData const auto& cell_to_node_matrix = m_mesh.connectivity().getMatrix(ItemType::cell, ItemType::node); - ValuePerCell<double> Vj(m_mesh.connectivity()); + CellValue<double> Vj(m_mesh.connectivity()); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ double sum_cjr_xr = 0; const auto& cell_nodes = cell_to_node_matrix.rowConst(j); @@ -231,7 +231,7 @@ class MeshData return m_xj; } - const ValuePerCell<const double>& Vj() const + const CellValue<const double>& Vj() const { return m_Vj; } diff --git a/src/scheme/AcousticSolver.hpp b/src/scheme/AcousticSolver.hpp index 2732799763ea7dc1510e5f4c71078ffad5564532..6f83bdcaa229ca5b816711fba6ca4c3cb849deca 100644 --- a/src/scheme/AcousticSolver.hpp +++ b/src/scheme/AcousticSolver.hpp @@ -239,7 +239,7 @@ class AcousticSolver const Kokkos::View<const Rd*>& uj, const Kokkos::View<const double*>& pj, const Kokkos::View<const double*>& cj, - const ValuePerCell<const double>& Vj, + const CellValue<const double>& Vj, const NodeValuePerCell<Rd>& Cjr, const NodeValuePerCell<double>& ljr, const NodeValuePerCell<Rd>& njr) { @@ -286,7 +286,7 @@ class AcousticSolver } KOKKOS_INLINE_FUNCTION - double acoustic_dt(const ValuePerCell<const double>& Vj, + double acoustic_dt(const CellValue<const double>& Vj, const Kokkos::View<const double*>& cj) const { const NodeValuePerCell<double>& ljr = m_mesh_data.ljr(); @@ -324,7 +324,7 @@ class AcousticSolver Kokkos::View<double*> cj = unknowns.cj(); const Kokkos::View<const Rd*> xj = m_mesh_data.xj(); - const ValuePerCell<const double>& Vj = m_mesh_data.Vj(); + const CellValue<const double>& Vj = m_mesh_data.Vj(); const NodeValuePerCell<Rd>& Cjr = m_mesh_data.Cjr(); const NodeValuePerCell<double>& ljr = m_mesh_data.ljr(); const NodeValuePerCell<Rd>& njr = m_mesh_data.njr(); diff --git a/src/scheme/FiniteVolumesEulerUnknowns.hpp b/src/scheme/FiniteVolumesEulerUnknowns.hpp index aafb44aaaf47f3d275169e14ab447e2f5b90035c..fd58774a6fd2902b96d6664bde4bbc98b0ab8fc2 100644 --- a/src/scheme/FiniteVolumesEulerUnknowns.hpp +++ b/src/scheme/FiniteVolumesEulerUnknowns.hpp @@ -152,7 +152,7 @@ public: m_Ej[j] = m_ej[j]+0.5*(m_uj[j],m_uj[j]); }); - const ValuePerCell<const double>& Vj = m_mesh_data.Vj(); + const CellValue<const double>& Vj = m_mesh_data.Vj(); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ m_mj[j] = m_rhoj[j] * Vj[j]; });