Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templating GammaCalculator over deriv_t type #252

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
14 changes: 12 additions & 2 deletions Examples/KerrBH/KerrBHLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,18 @@ void KerrBHLevel::initialData()
m_state_new, m_state_new, INCLUDE_GHOST_CELLS);

fillAllGhosts();
BoxLoops::loop(GammaCalculator(m_dx), m_state_new, m_state_new,
EXCLUDE_GHOST_CELLS);
if (m_p.max_spatial_derivative_order == 4)
{
GammaCalculator<FourthOrderDerivatives> my_gamma_calculator(m_dx);
BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new,
EXCLUDE_GHOST_CELLS);
}
else if (m_p.max_spatial_derivative_order == 6)
{
GammaCalculator<SixthOrderDerivatives> my_gamma_calculator(m_dx);
BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new,
EXCLUDE_GHOST_CELLS);
}

#ifdef USE_AHFINDER
// Diagnostics needed for AHFinder
Expand Down
14 changes: 12 additions & 2 deletions Examples/ScalarField/ScalarFieldLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,18 @@ void ScalarFieldLevel::initialData()
m_state_new, m_state_new, INCLUDE_GHOST_CELLS);

fillAllGhosts();
BoxLoops::loop(GammaCalculator(m_dx), m_state_new, m_state_new,
EXCLUDE_GHOST_CELLS);
if (m_p.max_spatial_derivative_order == 4)
{
GammaCalculator<FourthOrderDerivatives> my_gamma_calculator(m_dx);
BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new,
EXCLUDE_GHOST_CELLS);
}
else if (m_p.max_spatial_derivative_order == 6)
{
GammaCalculator<SixthOrderDerivatives> my_gamma_calculator(m_dx);
BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new,
EXCLUDE_GHOST_CELLS);
}
}

#ifdef CH_USE_HDF5
Expand Down
4 changes: 2 additions & 2 deletions Source/CCZ4/GammaCalculator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "VarsTools.hpp"
#include "simd.hpp"

class GammaCalculator
template <class deriv_t = FourthOrderDerivatives> class GammaCalculator
{
// Only variables needed are metric
template <class data_t> struct Vars
Expand All @@ -32,7 +32,7 @@ class GammaCalculator
};

protected:
const FourthOrderDerivatives
const deriv_t
m_deriv; //!< An object for calculating derivatives of the variables

public:
Expand Down
15 changes: 13 additions & 2 deletions Tests/ApparentHorizonFinderTest3D/ApparentHorizonTest3DLevel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,19 @@ class ApparentHorizonTest3DLevel : public GRAMRLevel

// Gamma's are not needed
// fillAllGhosts();
// BoxLoops::loop(GammaCalculator(m_dx), m_state_new, m_state_new,
// EXCLUDE_GHOST_CELLS);
// fillAllGhosts();
/*if (m_p.max_spatial_derivative_order == FourthOrderDerivatives)
{
GammaCalculator<FourthOrderDerivatives> my_gamma_calculator(m_dx);
BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new,
EXCLUDE_GHOST_CELLS);
}
else if (m_p.max_spatial_derivative_order == SixthOrderDerivatives)
{
GammaCalculator<SixthOrderDerivatives> my_gamma_calculator(m_dx);
BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new,
EXCLUDE_GHOST_CELLS);
}*/
}

virtual void specificEvalRHS(GRLevelData &a_soln, GRLevelData &a_rhs,
Expand Down