From 8c46e1b5d936eae6247367eaeb268eb158b33786 Mon Sep 17 00:00:00 2001 From: Areef Waeming Date: Thu, 13 Feb 2025 10:31:48 +0000 Subject: [PATCH] Change ScalarField.cpp to ScalarField.impl.hpp --- ...terFunctions.cpp => MyMatterFunctions.hpp} | 9 ++++++++- ...terFunctions.cpp => MyMatterFunctions.hpp} | 9 ++++++++- Source/Matter/ScalarField.hpp | 3 +++ .../{ScalarField.cpp => ScalarField.impl.hpp} | 19 +++++++++---------- 4 files changed, 28 insertions(+), 12 deletions(-) rename Examples/ScalarFieldBH/{MyMatterFunctions.cpp => MyMatterFunctions.hpp} (78%) rename Examples/ScalarFieldCosmo/{MyMatterFunctions.cpp => MyMatterFunctions.hpp} (83%) rename Source/Matter/{ScalarField.cpp => ScalarField.impl.hpp} (90%) diff --git a/Examples/ScalarFieldBH/MyMatterFunctions.cpp b/Examples/ScalarFieldBH/MyMatterFunctions.hpp similarity index 78% rename from Examples/ScalarFieldBH/MyMatterFunctions.cpp rename to Examples/ScalarFieldBH/MyMatterFunctions.hpp index 6de597a..e708788 100644 --- a/Examples/ScalarFieldBH/MyMatterFunctions.cpp +++ b/Examples/ScalarFieldBH/MyMatterFunctions.hpp @@ -3,7 +3,12 @@ * Please refer to LICENSE in GRTresna's root directory. */ -#include "ScalarField.hpp" +#if !defined(SCALARFIELD_HPP_) +#error "This file should only be included through ScalarField.hpp" +#endif + +#ifndef MYMATTERFUNCTIONS_HPP_ +#define MYMATTERFUNCTIONS_HPP_ Real ScalarField::my_potential_function(const Real &phi_here) const { @@ -23,3 +28,5 @@ Real ScalarField::my_Pi_function(const RealVect &loc) const return m_matter_params.pi_0 + m_matter_params.dpi * exp(-rr / m_matter_params.dpi_length); } + +#endif /* MYMATTERFUNCTIONS_HPP_ */ \ No newline at end of file diff --git a/Examples/ScalarFieldCosmo/MyMatterFunctions.cpp b/Examples/ScalarFieldCosmo/MyMatterFunctions.hpp similarity index 83% rename from Examples/ScalarFieldCosmo/MyMatterFunctions.cpp rename to Examples/ScalarFieldCosmo/MyMatterFunctions.hpp index 07d93be..70bad57 100644 --- a/Examples/ScalarFieldCosmo/MyMatterFunctions.cpp +++ b/Examples/ScalarFieldCosmo/MyMatterFunctions.hpp @@ -3,7 +3,12 @@ * Please refer to LICENSE in GRTresna's root directory. */ -#include "ScalarField.hpp" +#if !defined(SCALARFIELD_HPP_) +#error "This file should only be included through ScalarField.hpp" +#endif + +#ifndef MYMATTERFUNCTIONS_HPP_ +#define MYMATTERFUNCTIONS_HPP_ Real ScalarField::my_potential_function(const Real &phi_here) const { @@ -29,3 +34,5 @@ Real ScalarField::my_Pi_function(const RealVect &loc) const sin(2 * M_PI * loc[2] / L)); return m_matter_params.pi_0 + dpi_value; } + +#endif /* MYMATTERFUNCTIONS_HPP_ */ \ No newline at end of file diff --git a/Source/Matter/ScalarField.hpp b/Source/Matter/ScalarField.hpp index 7f3abb5..7199eae 100644 --- a/Source/Matter/ScalarField.hpp +++ b/Source/Matter/ScalarField.hpp @@ -63,4 +63,7 @@ class ScalarField RealVect domainLength; }; +#include "MyMatterFunctions.hpp" +#include "ScalarField.impl.hpp" + #endif /* SCALARFIELD_HPP_ */ diff --git a/Source/Matter/ScalarField.cpp b/Source/Matter/ScalarField.impl.hpp similarity index 90% rename from Source/Matter/ScalarField.cpp rename to Source/Matter/ScalarField.impl.hpp index 1820b8b..269179c 100644 --- a/Source/Matter/ScalarField.cpp +++ b/Source/Matter/ScalarField.impl.hpp @@ -3,19 +3,16 @@ * Please refer to LICENSE in GRTresna's root directory. */ -#include "ScalarField.hpp" +#if !defined(SCALARFIELD_HPP_) +#error "This file should only be included through ScalarField.hpp" +#endif + +#ifndef SCALARFIELD_IMPL_HPP_ +#define SCALARFIELD_IMPL_HPP_ + #include "DerivativeOperators.hpp" -#include "EMTensor.hpp" -#include "FArrayBox.H" -#include "GRParmParse.hpp" #include "Grids.hpp" -#include "IntVect.H" -#include "LevelData.H" #include "MultigridVariables.hpp" -#include "PsiAndAijFunctions.hpp" -#include "REAL.H" -#include "RealVect.H" -#include "Tensor.hpp" void ScalarField::initialise_matter_vars(LevelData &a_multigrid_vars, const RealVect &a_dx) const @@ -75,3 +72,5 @@ emtensor_t ScalarField::compute_emtensor(const IntVect a_iv, return out; } + +#endif /* SCALARFIELD_IMPL_HPP_ */ \ No newline at end of file