Skip to content

Commit

Permalink
proposed solution for #150
Browse files Browse the repository at this point in the history
  • Loading branch information
cwentland0 committed Aug 21, 2023
1 parent f8f65a2 commit e7e21a4
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
32 changes: 32 additions & 0 deletions include/pressiodemoapps/impl/custom_bc_holder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,22 @@ struct CustomBCsHolder
}
}

template<class T>
void setInternalPointer(GhostRelativeLocation rloc, T* ptr) {
if (rloc == GhostRelativeLocation::Left){
m_funcLeft.setInternalPtr(ptr);
}
else if (rloc == GhostRelativeLocation::Front){
m_funcFront.setInternalPtr(ptr);
}
else if (rloc == GhostRelativeLocation::Right){
m_funcRight.setInternalPtr(ptr);
}
else if (rloc == GhostRelativeLocation::Back) {
m_funcBack.setInternalPtr(ptr);
}
}

private:
FuncLeftT m_funcLeft;
FuncFrontT m_funcFront;
Expand Down Expand Up @@ -119,6 +135,22 @@ struct CustomBCsHolder<FuncLeftT &, FuncFrontT &, FuncRightT &, FuncBackT &>
}
}

template<class T>
void setInternalPointer(GhostRelativeLocation rloc, T* ptr) {
if (rloc == GhostRelativeLocation::Left){
m_funcLeft.setInternalPtr(ptr);
}
else if (rloc == GhostRelativeLocation::Front){
m_funcFront.setInternalPtr(ptr);
}
else if (rloc == GhostRelativeLocation::Right){
m_funcRight.setInternalPtr(ptr);
}
else if (rloc == GhostRelativeLocation::Back) {
m_funcBack.setInternalPtr(ptr);
}
}

private:
std::reference_wrapper<const FuncLeftT> m_funcLeft;
std::reference_wrapper<const FuncFrontT> m_funcFront;
Expand Down
7 changes: 7 additions & 0 deletions include/pressiodemoapps/impl/euler_2d_prob_class.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
#include "mixin_directional_flux_balance_jacobian.hpp"
#include "Eigen/Sparse"
#include "custom_bcs_functions.hpp"
#include "ghost_relative_locations.hpp"

#ifdef PRESSIODEMOAPPS_ENABLE_OPENMP
#include <omp.h>
Expand Down Expand Up @@ -173,6 +174,12 @@ class EigenApp
return initialConditionImpl();
}

public:
template <class T>
void setBCPointer(::pressiodemoapps::impl::GhostRelativeLocation rloc, T* ptr) {
m_bcFuncsHolder.setInternalPointer(rloc, ptr);
}

protected:
int numDofPerCellImpl() const {
return numDofPerCell;
Expand Down
7 changes: 7 additions & 0 deletions include/pressiodemoapps/impl/swe_2d_prob_class.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
#include "mixin_directional_flux_balance_jacobian.hpp"
#include "Eigen/Sparse"
#include "custom_bcs_functions.hpp"
#include "ghost_relative_locations.hpp"

#ifdef PRESSIODEMOAPPS_ENABLE_OPENMP
#include <omp.h>
Expand Down Expand Up @@ -167,6 +168,12 @@ class EigenApp
return initialState;
}

public:
template <class T>
void setBCPointer(::pressiodemoapps::impl::GhostRelativeLocation rloc, T* ptr) {
m_bcFuncsHolder.setInternalPointer(rloc, ptr);
}

protected:
int numDofPerCellImpl() const {
return numDofPerCell;
Expand Down

0 comments on commit e7e21a4

Please sign in to comment.