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

Remove ItemValue::operator()(const size_t&)

It was redundant with ItemValue::operator[](const size_t&)
parent f5e1bf08
Branches
Tags
1 merge request!7Feature/itemvalue
......@@ -33,15 +33,6 @@ class ItemValue
return m_is_built;
}
// Following Kokkos logic, these classes are view and const view does allow
// changes in data
KOKKOS_FORCEINLINE_FUNCTION
DataType& operator()(const size_t& j) const
{
Assert(m_is_built);
return m_values(j);
}
KOKKOS_INLINE_FUNCTION
size_t numberOfValues() const
{
......
......@@ -106,7 +106,7 @@ class MeshData
for (size_t R=0; R<cell_nodes.length; ++R) {
int Rp1 = (R+1)%cell_nodes.length;
int Rm1 = (R+cell_nodes.length-1)%cell_nodes.length;
Rd half_xrp_xrm = 0.5*(xr(cell_nodes(Rp1))-xr(cell_nodes(Rm1)));
Rd half_xrp_xrm = 0.5*(xr[cell_nodes(Rp1)]-xr[cell_nodes(Rm1)]);
Cjr(j,R) = Rd{-half_xrp_xrm[1], half_xrp_xrm[0]};
}
});
......
......@@ -330,7 +330,7 @@ _getOutgoingNormal(const MeshType& mesh)
const auto& j0_nodes = cell_to_node_matrix.rowConst(j0);
double max_height = 0;
for (size_t r=0; r<j0_nodes.length; ++r) {
const double height = (xr(j0_nodes(r))-xr(r0), normal);
const double height = (xr[j0_nodes(r)]-xr[r0], normal);
if (std::abs(height) > std::abs(max_height)) {
max_height = height;
}
......@@ -367,7 +367,7 @@ _getOutgoingNormal(const MeshType& mesh)
const auto& j0_nodes = cell_to_node_matrix.rowConst(j0);
double max_height = 0;
for (size_t r=0; r<j0_nodes.length; ++r) {
const double height = (xr(j0_nodes(r))-xr(r0), normal);
const double height = (xr[j0_nodes(r)]-xr[r0], normal);
if (std::abs(height) > std::abs(max_height)) {
max_height = height;
}
......@@ -404,7 +404,7 @@ _getOutgoingNormal(const MeshType& mesh)
const auto& j0_nodes = cell_to_node_matrix.rowConst(j0);
double max_height = 0;
for (size_t r=0; r<j0_nodes.length; ++r) {
const double height = (xr(j0_nodes(r))-xr(r0), normal);
const double height = (xr[j0_nodes(r)]-xr[r0], normal);
if (std::abs(height) > std::abs(max_height)) {
max_height = height;
}
......
......@@ -49,8 +49,8 @@ class AcousticSolver
KOKKOS_INLINE_FUNCTION
void operator() (const size_type i, value_type& update) const
{
if (x_(i) < update) {
update = x_(i);
if (x_[i] < update) {
update = x_[i];
}
}
......@@ -89,7 +89,7 @@ class AcousticSolver
{
Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j) {
const size_t& nb_nodes =m_Ajr.numberOfSubValues(j);
const double& rho_c = rhocj(j);
const double& rho_c = rhocj[j];
for (size_t r=0; r<nb_nodes; ++r) {
m_Ajr(j,r) = tensorProduct(rho_c*Cjr(j,r), njr(j,r));
}
......@@ -116,7 +116,7 @@ class AcousticSolver
const unsigned int R = node_local_number_in_its_cells[j];
sum += Ajr(J,R);
}
m_Ar(r) = sum;
m_Ar[r] = sum;
});
return m_Ar;
......@@ -135,7 +135,7 @@ class AcousticSolver
= m_connectivity.nodeLocalNumbersInTheirCells();
Kokkos::parallel_for(m_mesh.numberOfNodes(), KOKKOS_LAMBDA(const int& r) {
Rd& br = m_br(r);
Rd& br = m_br[r];
br = zero;
const auto& node_to_cell = node_to_cell_matrix.rowConst(r);
const auto& node_local_number_in_its_cells
......@@ -143,7 +143,7 @@ class AcousticSolver
for (size_t j=0; j<node_to_cell.length; ++j) {
const unsigned int J = node_to_cell(j);
const unsigned int R = node_local_number_in_its_cells[j];
br += Ajr(J,R)*uj(J) + pj(J)*Cjr(J,R);
br += Ajr(J,R)*uj[J] + pj[J]*Cjr(J,R);
}
});
......@@ -180,11 +180,13 @@ class AcousticSolver
const Rdd nxn = tensorProduct(n,n);
const Rdd P = I-nxn;
const Array<const unsigned int>& node_list
= symmetry_bc.nodeList();
Kokkos::parallel_for(symmetry_bc.numberOfNodes(), KOKKOS_LAMBDA(const int& r_number) {
const int r = symmetry_bc.nodeList()[r_number];
const int r = node_list[r_number];
m_Ar(r) = P*m_Ar(r)*P + nxn;
m_br(r) = P*m_br(r);
m_Ar[r] = P*m_Ar[r]*P + nxn;
m_br[r] = P*m_br[r];
});
break;
}
......@@ -199,7 +201,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 int& r) {
m_ur[r]=invAr(r)*br(r);
m_ur[r]=invAr[r]*br[r];
});
return m_ur;
......@@ -220,7 +222,7 @@ class AcousticSolver
const auto& cell_nodes = cell_to_node_matrix.rowConst(j);
for (size_t r=0; r<cell_nodes.length; ++r) {
m_Fjr(j,r) = Ajr(j,r)*(uj(j)-ur(cell_nodes(r)))+pj(j)*Cjr(j,r);
m_Fjr(j,r) = Ajr(j,r)*(uj[j]-ur[cell_nodes(r)])+pj[j]*Cjr(j,r);
}
});
}
......@@ -229,7 +231,7 @@ class AcousticSolver
NodeValue<Rdd>& inv_A) const
{
Kokkos::parallel_for(m_mesh.numberOfNodes(), KOKKOS_LAMBDA(const int& r) {
inv_A(r) = ::inverse(A(r));
inv_A[r] = ::inverse(A[r]);
});
}
......@@ -247,7 +249,7 @@ class AcousticSolver
const CellValue<const double> rhocj = computeRhoCj(rhoj, cj);
computeAjr(rhocj, Cjr, ljr, njr);
NodeValuePerCell<const Rdd> Ajr = m_Ajr;;
NodeValuePerCell<const Rdd> Ajr = m_Ajr;
const NodeValue<const Rdd> Ar = computeAr(Ajr);
const NodeValue<const Rd> br = computeBr(m_Ajr, Cjr, uj, pj);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment