diff --git a/src/mesh/Connectivity.cpp b/src/mesh/Connectivity.cpp index f84f3835abe00acb25561ada3d071a29c5adc167..9d95f2896a073345f6d163534795143ca4e47487 100644 --- a/src/mesh/Connectivity.cpp +++ b/src/mesh/Connectivity.cpp @@ -228,14 +228,14 @@ Connectivity(const std::vector<std::vector<unsigned int>>& cell_by_node_vector, { CellValue<CellType> cell_type(*this); - Kokkos::parallel_for(this->numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(this->numberOfCells(), PASTIS_LAMBDA(const CellId& j){ cell_type[j] = cell_type_vector[j]; }); m_cell_type = cell_type; } { CellValue<double> inv_cell_nb_nodes(*this); - Kokkos::parallel_for(this->numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(this->numberOfCells(), PASTIS_LAMBDA(const CellId& j){ const auto& cell_nodes = cell_to_node_matrix.rowConst(j); inv_cell_nb_nodes[j] = 1./cell_nodes.length; }); diff --git a/src/mesh/MeshData.hpp b/src/mesh/MeshData.hpp index 4e177f527e0758184d586e6d48000de89bf65f6e..0f016f0e95ec577fbf5e51561a97c45a64254731 100644 --- a/src/mesh/MeshData.hpp +++ b/src/mesh/MeshData.hpp @@ -40,7 +40,7 @@ class MeshData = m_mesh.connectivity().cellToNodeMatrix(); CellValue<Rd> xj(m_mesh.connectivity()); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j){ const auto& cell_nodes = cell_to_node_matrix[j]; xj[j] = 0.5*(xr[cell_nodes[0]]+xr[cell_nodes[1]]); }); @@ -54,7 +54,7 @@ class MeshData const auto& cell_to_node_matrix = m_mesh.connectivity().cellToNodeMatrix(); CellValue<Rd> xj(m_mesh.connectivity()); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j){ Rd X = zero; const auto& cell_nodes = cell_to_node_matrix[j]; for (size_t R=0; R<cell_nodes.size(); ++R) { @@ -74,7 +74,7 @@ class MeshData = m_mesh.connectivity().cellToNodeMatrix(); CellValue<double> Vj(m_mesh.connectivity()); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j){ double sum_cjr_xr = 0; const auto& cell_nodes = cell_to_node_matrix[j]; @@ -98,7 +98,7 @@ class MeshData { NodeValuePerCell<Rd> Cjr(m_mesh.connectivity()); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j){ const auto& cell_nodes = cell_to_node_matrix[j]; for (size_t R=0; R<cell_nodes.size(); ++R) { int Rp1 = (R+1)%cell_nodes.size(); @@ -112,7 +112,7 @@ class MeshData { NodeValuePerCell<double> ljr(m_mesh.connectivity()); - Kokkos::parallel_for(m_Cjr.numberOfValues(), KOKKOS_LAMBDA(const size_t& jr){ + Kokkos::parallel_for(m_Cjr.numberOfValues(), PASTIS_LAMBDA(const size_t& jr){ ljr[jr] = l2Norm(m_Cjr[jr]); }); m_ljr = ljr; @@ -120,7 +120,7 @@ class MeshData { NodeValuePerCell<Rd> njr(m_mesh.connectivity()); - Kokkos::parallel_for(m_Cjr.numberOfValues(), KOKKOS_LAMBDA(const size_t& jr){ + Kokkos::parallel_for(m_Cjr.numberOfValues(), PASTIS_LAMBDA(const size_t& jr){ njr[jr] = (1./m_ljr[jr])*m_Cjr[jr]; }); m_njr = njr; @@ -132,7 +132,7 @@ class MeshData const auto& face_to_node_matrix = m_mesh.connectivity().faceToNodeMatrix(); - Kokkos::parallel_for(m_mesh.numberOfFaces(), KOKKOS_LAMBDA(const FaceId& l) { + Kokkos::parallel_for(m_mesh.numberOfFaces(), PASTIS_LAMBDA(const FaceId& l) { const auto& face_nodes = face_to_node_matrix[l]; const size_t nb_nodes = face_nodes.size(); std::vector<Rd> dxr(nb_nodes); @@ -164,11 +164,11 @@ class MeshData { NodeValuePerCell<Rd> Cjr(m_mesh.connectivity()); - Kokkos::parallel_for(Cjr.numberOfValues(), KOKKOS_LAMBDA(const size_t& jr){ + Kokkos::parallel_for(Cjr.numberOfValues(), PASTIS_LAMBDA(const size_t& jr){ Cjr[jr] = zero; }); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j) { + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j) { const auto& cell_nodes = cell_to_node_matrix[j]; const auto& cell_faces = cell_to_face_matrix[j]; @@ -209,7 +209,7 @@ class MeshData { NodeValuePerCell<double> ljr(m_mesh.connectivity()); - Kokkos::parallel_for(m_Cjr.numberOfValues(), KOKKOS_LAMBDA(const size_t& jr){ + Kokkos::parallel_for(m_Cjr.numberOfValues(), PASTIS_LAMBDA(const size_t& jr){ ljr[jr] = l2Norm(m_Cjr[jr]); }); m_ljr = ljr; @@ -217,7 +217,7 @@ class MeshData { NodeValuePerCell<Rd> njr(m_mesh.connectivity()); - Kokkos::parallel_for(m_Cjr.numberOfValues(), KOKKOS_LAMBDA(const size_t& jr){ + Kokkos::parallel_for(m_Cjr.numberOfValues(), PASTIS_LAMBDA(const size_t& jr){ njr[jr] = (1./m_ljr[jr])*m_Cjr[jr]; }); m_njr = njr; @@ -271,7 +271,7 @@ class MeshData // in 1d Cjr are computed once for all { NodeValuePerCell<Rd> Cjr(m_mesh.connectivity()); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j) { + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j) { Cjr(j,0)=-1; Cjr(j,1)= 1; }); @@ -281,7 +281,7 @@ class MeshData m_njr = m_Cjr; { NodeValuePerCell<double> ljr(m_mesh.connectivity()); - Kokkos::parallel_for(ljr.numberOfValues(), KOKKOS_LAMBDA(const size_t& jr){ + Kokkos::parallel_for(ljr.numberOfValues(), PASTIS_LAMBDA(const size_t& jr){ ljr[jr] = 1; }); m_ljr = ljr; diff --git a/src/mesh/MeshNodeBoundary.hpp b/src/mesh/MeshNodeBoundary.hpp index 9b8bc4e00c5c6abeae4a07be8fad5f08b093666a..a8026cc8609a178c891ca2a67e3739bb897c5067 100644 --- a/src/mesh/MeshNodeBoundary.hpp +++ b/src/mesh/MeshNodeBoundary.hpp @@ -37,7 +37,7 @@ class MeshNodeBoundary = mesh.connectivity().faceToCellMatrix(); const Array<const FaceId>& face_list = ref_face_list.faceList(); - Kokkos::parallel_for(face_list.size(), KOKKOS_LAMBDA(const int& l){ + Kokkos::parallel_for(face_list.size(), PASTIS_LAMBDA(const int& l){ const auto& face_cells = face_to_cell_matrix[face_list[l]]; if (face_cells.size()>1) { std::cerr << "internal faces cannot be used to define mesh boundaries\n"; @@ -64,7 +64,7 @@ class MeshNodeBoundary node_ids.resize(std::distance(node_ids.begin(), last)); Array<NodeId> node_list(node_ids.size()); - Kokkos::parallel_for(node_ids.size(), KOKKOS_LAMBDA(const int& r){ + Kokkos::parallel_for(node_ids.size(), PASTIS_LAMBDA(const int& r){ node_list[r] = node_ids[r]; }); m_node_list = node_list; @@ -158,7 +158,7 @@ _checkBoundaryIsFlat(const TinyVector<2,double>& normal, const NodeValue<const R2>& xr = mesh.xr(); - Kokkos::parallel_for(m_node_list.size(), KOKKOS_LAMBDA(const size_t& r) { + Kokkos::parallel_for(m_node_list.size(), PASTIS_LAMBDA(const size_t& r) { const R2& x = xr[m_node_list[r]]; if ((x-origin,normal)>1E-13*length) { std::cerr << "this FlatBoundary is not flat!\n"; diff --git a/src/scheme/AcousticSolver.hpp b/src/scheme/AcousticSolver.hpp index 0db6f75ec44c12e77a0199a9cdad6f0e735839d2..389e916e0c3f9c0a5b1364fc6e1bf06b7cfb9a12 100644 --- a/src/scheme/AcousticSolver.hpp +++ b/src/scheme/AcousticSolver.hpp @@ -39,7 +39,7 @@ class AcousticSolver computeRhoCj(const CellValue<const double>& rhoj, const CellValue<const double>& cj) { - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j) { + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j) { m_rhocj[j] = rhoj[j]*cj[j]; }); return m_rhocj; @@ -51,7 +51,7 @@ class AcousticSolver const NodeValuePerCell<const double>& ljr, const NodeValuePerCell<const Rd>& njr) { - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j) { + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j) { const size_t& nb_nodes =m_Ajr.numberOfSubValues(j); const double& rho_c = rhocj[j]; for (size_t r=0; r<nb_nodes; ++r) { @@ -68,7 +68,7 @@ class AcousticSolver const auto& node_local_numbers_in_their_cells = m_connectivity.nodeLocalNumbersInTheirCells(); - Kokkos::parallel_for(m_mesh.numberOfNodes(), KOKKOS_LAMBDA(const NodeId& r) { + Kokkos::parallel_for(m_mesh.numberOfNodes(), PASTIS_LAMBDA(const NodeId& r) { Rdd sum = zero; const auto& node_to_cell = node_to_cell_matrix[r]; const auto& node_local_number_in_its_cells @@ -96,7 +96,7 @@ class AcousticSolver const auto& node_local_numbers_in_their_cells = m_connectivity.nodeLocalNumbersInTheirCells(); - Kokkos::parallel_for(m_mesh.numberOfNodes(), KOKKOS_LAMBDA(const NodeId& r) { + Kokkos::parallel_for(m_mesh.numberOfNodes(), PASTIS_LAMBDA(const NodeId& r) { Rd& br = m_br[r]; br = zero; const auto& node_to_cell = node_to_cell_matrix[r]; @@ -144,7 +144,7 @@ class AcousticSolver const Array<const NodeId>& node_list = symmetry_bc.nodeList(); - Kokkos::parallel_for(symmetry_bc.numberOfNodes(), KOKKOS_LAMBDA(const int& r_number) { + Kokkos::parallel_for(symmetry_bc.numberOfNodes(), PASTIS_LAMBDA(const int& r_number) { const NodeId r = node_list[r_number]; m_Ar[r] = P*m_Ar[r]*P + nxn; @@ -162,7 +162,7 @@ class AcousticSolver { inverse(Ar, m_inv_Ar); const NodeValue<const Rdd> invAr = m_inv_Ar; - Kokkos::parallel_for(m_mesh.numberOfNodes(), KOKKOS_LAMBDA(const NodeId& r) { + Kokkos::parallel_for(m_mesh.numberOfNodes(), PASTIS_LAMBDA(const NodeId& r) { m_ur[r]=invAr[r]*br[r]; }); @@ -179,7 +179,7 @@ class AcousticSolver const auto& cell_to_node_matrix = m_mesh.connectivity().cellToNodeMatrix(); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j) { + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j) { const auto& cell_nodes = cell_to_node_matrix[j]; for (size_t r=0; r<cell_nodes.size(); ++r) { @@ -191,7 +191,7 @@ class AcousticSolver void inverse(const NodeValue<const Rdd>& A, NodeValue<Rdd>& inv_A) const { - Kokkos::parallel_for(m_mesh.numberOfNodes(), KOKKOS_LAMBDA(const NodeId& r) { + Kokkos::parallel_for(m_mesh.numberOfNodes(), PASTIS_LAMBDA(const NodeId& r) { inv_A[r] = ::inverse(A[r]); }); } @@ -258,7 +258,7 @@ class AcousticSolver const auto& cell_to_node_matrix = m_mesh.connectivity().cellToNodeMatrix(); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j){ const auto& cell_nodes = cell_to_node_matrix[j]; double S = 0; @@ -297,7 +297,7 @@ class AcousticSolver = m_mesh.connectivity().cellToNodeMatrix(); const CellValue<const double> inv_mj = unknowns.invMj(); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j) { + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j) { const auto& cell_nodes = cell_to_node_matrix[j]; Rd momentum_fluxes = zero; @@ -311,18 +311,18 @@ class AcousticSolver Ej[j] -= (dt*inv_mj[j]) * energy_fluxes; }); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j) { + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j) { ej[j] = Ej[j] - 0.5 * (uj[j],uj[j]); }); NodeValue<Rd> mutable_xr = m_mesh.mutableXr(); - Kokkos::parallel_for(m_mesh.numberOfNodes(), KOKKOS_LAMBDA(const NodeId& r){ + Kokkos::parallel_for(m_mesh.numberOfNodes(), PASTIS_LAMBDA(const NodeId& r){ mutable_xr[r] += dt*ur[r]; }); m_mesh_data.updateAllData(); const CellValue<const double> mj = unknowns.mj(); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j){ rhoj[j] = mj[j]/Vj[j]; }); } diff --git a/src/scheme/BlockPerfectGas.hpp b/src/scheme/BlockPerfectGas.hpp index 704787756bc97ac60b48699c8215c9444cb87bf2..13dbfd81660ddd40d1e63229f6da78eaa5a05a05 100644 --- a/src/scheme/BlockPerfectGas.hpp +++ b/src/scheme/BlockPerfectGas.hpp @@ -34,7 +34,7 @@ public: const CellValue<const double>& e = m_ej; const CellValue<const double>& gamma = m_gammaj; - Kokkos::parallel_for(nj, KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(nj, PASTIS_LAMBDA(const CellId& j){ const double gamma_minus_one = gamma[j]-1; m_pj[j] = gamma_minus_one*rho[j]*e[j]; m_cj[j] = std::sqrt(gamma[j]*gamma_minus_one*e[j]); @@ -48,12 +48,12 @@ public: const CellValue<const double>& p = m_pj; const CellValue<const double>& gamma = m_gammaj; - Kokkos::parallel_for(nj, KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(nj, PASTIS_LAMBDA(const CellId& j){ m_ej[j] = p[j]/(rho[j]*(gamma[j]-1)); }); const CellValue<const double>& e = m_ej; - Kokkos::parallel_for(nj, KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(nj, PASTIS_LAMBDA(const CellId& j){ m_cj[j] = std::sqrt(gamma[j]*(gamma[j]-1)*e[j]); }); } diff --git a/src/scheme/BoundaryCondition.hpp b/src/scheme/BoundaryCondition.hpp index 2a9ac539b9d61b8238b0c06ffa48df1e55ec79bd..ed73e14bcbd4569227dd790b9c1425ac76ced28a 100644 --- a/src/scheme/BoundaryCondition.hpp +++ b/src/scheme/BoundaryCondition.hpp @@ -69,7 +69,7 @@ public: m_number_of_faces(faces.size()) { Array<unsigned int> face_list(faces.size()); - Kokkos::parallel_for(m_number_of_faces, KOKKOS_LAMBDA(const int& f){ + Kokkos::parallel_for(m_number_of_faces, PASTIS_LAMBDA(const int& f){ face_list[f]=faces[f]; }); m_face_list = face_list; diff --git a/src/scheme/FiniteVolumesEulerUnknowns.hpp b/src/scheme/FiniteVolumesEulerUnknowns.hpp index 2eaaf474dbbe520da30cc2c5b0ad5b4737e12538..fc1178b77ed6b6b9f8f04860cd875af67ae90b5f 100644 --- a/src/scheme/FiniteVolumesEulerUnknowns.hpp +++ b/src/scheme/FiniteVolumesEulerUnknowns.hpp @@ -124,7 +124,7 @@ public: { const CellValue<const Rd>& xj = m_mesh_data.xj(); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j){ if (xj[j][0]<0.5) { m_rhoj[j]=1; } else { @@ -132,7 +132,7 @@ public: } }); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j){ if (xj[j][0]<0.5) { m_pj[j]=1; } else { @@ -140,27 +140,27 @@ public: } }); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j){ m_uj[j] = zero; }); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j){ m_gammaj[j] = 1.4; }); BlockPerfectGas block_eos(m_rhoj, m_ej, m_pj, m_gammaj, m_cj); block_eos.updateEandCFromRhoP(); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j){ m_Ej[j] = m_ej[j]+0.5*(m_uj[j],m_uj[j]); }); const CellValue<const double>& Vj = m_mesh_data.Vj(); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j){ m_mj[j] = m_rhoj[j] * Vj[j]; }); - Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const CellId& j){ + Kokkos::parallel_for(m_mesh.numberOfCells(), PASTIS_LAMBDA(const CellId& j){ m_inv_mj[j] = 1./m_mj[j]; }); } diff --git a/src/utils/PastisMacros.hpp b/src/utils/PastisMacros.hpp index 43bade922351898b2a8ef4c3b28f32e81fdf9ee2..59d2a579512a67a637f8c47f5745db89efea0a24 100644 --- a/src/utils/PastisMacros.hpp +++ b/src/utils/PastisMacros.hpp @@ -1,5 +1,5 @@ -#ifndef PASTIS_UTILS_HPP -#define PASTIS_UTILS_HPP +#ifndef PASTIS_MACROS_HPP +#define PASTIS_MACROS_HPP #include <Kokkos_Macros.hpp> @@ -8,4 +8,6 @@ #define PASTIS_INLINE KOKKOS_INLINE_FUNCTION #define PASTIS_FORCEINLINE KOKKOS_FORCEINLINE_FUNCTION -#endif // PASTIS_UTILS_HPP +#define PASTIS_LAMBDA KOKKOS_LAMBDA + +#endif // PASTIS_MACROS_HPP