Skip to content
Snippets Groups Projects
Commit 15304c42 authored by Fanny CHOPOT's avatar Fanny CHOPOT
Browse files

creation fonction updateVolumeCenter

parent f29a6992
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@ private:
Kokkos::View<Rd**> m_Cjr;
Kokkos::View<Rd*> m_xj;
Kokkos::View<double*> m_Vj;
Kokkos::View<double*> m_Dj;
KOKKOS_INLINE_FUNCTION
void _updateCenter()
......@@ -71,6 +72,28 @@ private:
});
}
// Ajout fonction pour calculer h_i+1/2
KOKKOS_INLINE_FUNCTION
void _updateVolumeCenter()
{
const Kokkos::View<const unsigned int**>& cell_nodes
= m_mesh.connectivity().cellNodes();
const Kokkos::View<const unsigned short*> cell_nb_nodes
= m_mesh.connectivity().cellNbNodes();
const Kokkos::View<const Rd*> xj;
_updateCenter();
Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){
double sum_cjr_xj = 0;
for (int R=0; R<cell_nb_nodes[j]; ++R) {
sum_cjr_xj += (m_xj[cell_nodes(j,R)], m_Cjr(j,R));
}
m_Dj[j] = inv_dimension * sum_cjr_xj;
});
}
KOKKOS_INLINE_FUNCTION
void _updateCjr() {
if(dimension == 1) {
......@@ -105,10 +128,16 @@ public:
return m_Vj;
}
const Kokkos::View<const double*> Dj() const
{
return m_Dj;
}
void updateAllData()
{
this->_updateCenter();
this->_updateVolume();
this->_updateVolumeCenter();
this->_updateCjr();
}
......@@ -116,7 +145,8 @@ public:
: m_mesh(mesh),
m_Cjr("Cjr", mesh.numberOfCells(), mesh.connectivity().maxNbNodePerCell()),
m_xj("xj", mesh.numberOfCells()),
m_Vj("Vj", mesh.numberOfCells())
m_Vj("Vj", mesh.numberOfCells()),
m_Dj("Dj", mesh.numberOfCells())
{
if (dimension==1) {
// in 1d Cjr are computed once for all
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment