Skip to content

Commit

Permalink
reorganize source code into subdirectories (#689)
Browse files Browse the repository at this point in the history
### Description
The code used to be simple, but now it's not. I've reorganized all of
the source code files under `src/` into subdirectories (one level only).

Unfortunately, virtually every file had to be changed in order to update
header include paths. No other changes were made to the code (other than
file renaming).

The new `src/` directory layout is as follows:
```console
$ tree -d .
.
├── chemistry
├── cooling
├── hydro
├── io
├── linear_advection
├── math
├── particles
├── problems
│   ├── Advection
│   ├── Advection2D
│   ├── AdvectionSemiellipse
│   ├── BinaryOrbitCIC
│   ├── Cooling
│   ├── FCQuantities
│   ├── HydroBlast2D
│   ├── HydroBlast3D
│   ├── HydroContact
│   ├── HydroHighMach
│   ├── HydroKelvinHelmholz
│   ├── HydroLeblanc
│   ├── HydroQuirk
│   ├── HydroRichtmeyerMeshkov
│   ├── HydroShocktube
│   ├── HydroShocktubeCMA
│   ├── HydroShuOsher
│   ├── HydroSMS
│   ├── HydroVacuum
│   ├── HydroWave
│   ├── NSCBC
│   ├── ODEIntegration
│   ├── PassiveScalar
│   ├── PopIII
│   ├── PrimordialChem
│   ├── RadBeam
│   ├── RadForce
│   ├── RadhydroBB
│   ├── RadhydroPulse
│   ├── RadhydroPulseDyn
│   ├── RadhydroPulseGrey
│   ├── RadhydroPulseMGconst
│   ├── RadhydroPulseMGint
│   ├── RadhydroShell
│   ├── RadhydroShock
│   ├── RadhydroShockCGS
│   ├── RadhydroShockMultigroup
│   ├── RadhydroUniformAdvecting
│   ├── RadMarshak
│   ├── RadMarshakAsymptotic
│   ├── RadMarshakCGS
│   ├── RadMarshakVaytet
│   ├── RadMatterCoupling
│   ├── RadMatterCouplingRSLA
│   ├── RadPulse
│   ├── RadShadow
│   ├── RadStreaming
│   ├── RadStreamingY
│   ├── RadSuOlson
│   ├── RadTophat
│   ├── RadTube
│   ├── RandomBlast
│   ├── RayleighTaylor2D
│   ├── RayleighTaylor3D
│   ├── ShockCloud
│   ├── SphericalCollapse
│   └── StarCluster
├── radiation
├── turbulence
└── util
```

### Related issues
N/A

### Checklist
_Before this pull request can be reviewed, all of these tasks should be
completed. Denote completed tasks with an `x` inside the square brackets
`[ ]` in the Markdown source below:_
- [x] I have added a description (see above).
- [x] I have added a link to any related issues see (see above).
- [x] I have read the [Contributing
Guide](https://github.com/quokka-astro/quokka/blob/development/CONTRIBUTING.md).
- [ ] I have added tests for any new physics that this PR adds to the
code.
- [x] I have tested this PR on my local computer and all tests pass.
- [x] I have manually triggered the GPU tests with the magic comment
`/azp run`.
- [x] I have requested a reviewer for this PR.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
BenWibking and pre-commit-ci[bot] authored Jul 29, 2024
1 parent da1931a commit c37cfb2
Show file tree
Hide file tree
Showing 248 changed files with 469 additions and 469 deletions.
1 change: 0 additions & 1 deletion src/AdvectionSimulation.cpp

This file was deleted.

79 changes: 10 additions & 69 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if(QUOKKA_OPENPMD)
add_subdirectory(${QuokkaCode_SOURCE_DIR}/extern/openPMD-api ${QuokkaCode_BINARY_DIR}/openPMD-api)
include_directories(${OpenPMD_INCLUDE_DIRS_RET})
link_libraries(openPMD::openPMD)
set(openPMDSources "${CMAKE_CURRENT_SOURCE_DIR}/openPMD.cpp")
set(openPMDSources "${CMAKE_CURRENT_SOURCE_DIR}/io/openPMD.cpp")
message(STATUS "WARNING: OpenPMD plotfiles are ENABLED. Face-centered variables will only be available as cell-centered averages in plotfiles!")
else()
set(openPMDSources "")
Expand Down Expand Up @@ -129,75 +129,16 @@ link_libraries(yaml-cpp::yaml-cpp)
include(CTest)

set (QuokkaSourcesNoEOS "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/DiagBase.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/DiagFilter.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/DiagFramePlane.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/DiagPDF.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GrackleLikeCooling.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GrackleDataReader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/TabulatedCooling.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/CloudyDataReader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/io/DiagBase.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/io/DiagFilter.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/io/DiagFramePlane.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/io/DiagPDF.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/cooling/GrackleLikeCooling.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/cooling/GrackleDataReader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/cooling/TabulatedCooling.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/cooling/CloudyDataReader.cpp"
"${openPMDSources}")

set (QuokkaObjSources "${QuokkaSourcesNoEOS}" "${gamma_law_sources}")

add_subdirectory(Advection)
add_subdirectory(Advection2D)
add_subdirectory(AdvectionSemiellipse)

add_subdirectory(HydroBlast2D)
add_subdirectory(HydroBlast3D)
add_subdirectory(HydroContact)
add_subdirectory(HydroKelvinHelmholz)
add_subdirectory(HydroLeblanc)
add_subdirectory(HydroRichtmeyerMeshkov)
add_subdirectory(HydroShocktube)
add_subdirectory(HydroShocktubeCMA)
add_subdirectory(HydroShuOsher)
add_subdirectory(HydroSMS)
add_subdirectory(HydroVacuum)
add_subdirectory(HydroWave)
add_subdirectory(HydroQuirk)
add_subdirectory(HydroHighMach)
add_subdirectory(RayleighTaylor2D)
add_subdirectory(RayleighTaylor3D)
add_subdirectory(RadBeam)
add_subdirectory(RadForce)
add_subdirectory(RadMarshak)
add_subdirectory(RadMarshakCGS)
add_subdirectory(RadMarshakAsymptotic)
add_subdirectory(RadMarshakVaytet)
add_subdirectory(RadMatterCoupling)
add_subdirectory(RadMatterCouplingRSLA)
add_subdirectory(RadPulse)
add_subdirectory(RadShadow)
add_subdirectory(RadStreaming)
add_subdirectory(RadStreamingY)
add_subdirectory(RadSuOlson)
add_subdirectory(RadTophat)
add_subdirectory(RadTube)

add_subdirectory(RadhydroShell)
add_subdirectory(RadhydroShock)
add_subdirectory(RadhydroShockCGS)
add_subdirectory(RadhydroShockMultigroup)
add_subdirectory(RadhydroUniformAdvecting)
add_subdirectory(RadhydroPulse)
add_subdirectory(RadhydroPulseDyn)
add_subdirectory(RadhydroPulseGrey)
add_subdirectory(RadhydroPulseMGconst)
add_subdirectory(RadhydroPulseMGint)
add_subdirectory(RadhydroBB)

add_subdirectory(BinaryOrbitCIC)
add_subdirectory(Cooling)
add_subdirectory(FCQuantities)
add_subdirectory(NSCBC)
add_subdirectory(ODEIntegration)
add_subdirectory(PassiveScalar)
add_subdirectory(RandomBlast)
add_subdirectory(PrimordialChem)
add_subdirectory(PopIII)
add_subdirectory(ShockCloud)
add_subdirectory(StarCluster)
add_subdirectory(SphericalCollapse)
add_subdirectory(problems)
10 changes: 5 additions & 5 deletions src/RadhydroSimulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@
#include <conduit_node.hpp>
#endif

#include "Chemistry.hpp"
#include "GrackleLikeCooling.hpp"
#include "SimulationData.hpp"
#include "TabulatedCooling.hpp"
#include "chemistry/Chemistry.hpp"
#include "cooling/GrackleLikeCooling.hpp"
#include "cooling/TabulatedCooling.hpp"
#include "eos.H"
#include "hydro_system.hpp"
#include "hydro/hydro_system.hpp"
#include "hyperbolic_system.hpp"
#include "physics_info.hpp"
#include "physics_numVars.hpp"
#include "radiation_system.hpp"
#include "radiation/radiation_system.hpp"
#include "simulation.hpp"

// Simulation class should be initialized only once per program (i.e., is a singleton)
Expand Down
2 changes: 1 addition & 1 deletion src/Chemistry.cpp → src/chemistry/Chemistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// \brief Implements methods for primordial chemistry using Microphysics
///

#include "Chemistry.hpp"
#include "chemistry/Chemistry.hpp"
#include "burn_type.H"
#include "burner.H"

Expand Down
4 changes: 2 additions & 2 deletions src/Chemistry.hpp → src/chemistry/Chemistry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "AMReX.H"
#include "AMReX_GpuQualifiers.H"

#include "hydro_system.hpp"
#include "radiation_system.hpp"
#include "hydro/hydro_system.hpp"
#include "radiation/radiation_system.hpp"

#ifdef PRIMORDIAL_CHEM
#include "actual_eos_data.H"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "fmt/core.h"

#include "CloudyDataReader.hpp"
#include "FastMath.hpp"
#include "math/FastMath.hpp"

namespace quokka::TabulatedCooling
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include "AMReX_BLassert.H"
#include "AMReX_Print.H"
#include "AMReX_TableData.H"
#include "FastMath.hpp"
#include "fmt/core.h"
#include "math/FastMath.hpp"

namespace quokka::GrackleLikeCooling
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/// tables.
///

#include "GrackleLikeCooling.hpp"
#include "cooling/GrackleLikeCooling.hpp"

namespace quokka::GrackleLikeCooling
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
#include "AMReX_GpuQualifiers.H"
#include "AMReX_iMultiFab.H"

#include "FastMath.hpp"
#include "GrackleDataReader.hpp"
#include "Interpolate2D.hpp"
#include "ODEIntegrate.hpp"
#include "fmt/core.h"
#include "fundamental_constants.H"
#include "hydro_system.hpp"
#include "radiation_system.hpp"
#include "root_finding.hpp"
#include "hydro/hydro_system.hpp"
#include "math/FastMath.hpp"
#include "math/Interpolate2D.hpp"
#include "math/ODEIntegrate.hpp"
#include "math/root_finding.hpp"
#include "radiation/radiation_system.hpp"

namespace quokka::GrackleLikeCooling
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/// tables.
///

#include "TabulatedCooling.hpp"
#include "cooling/TabulatedCooling.hpp"
#include "CloudyDataReader.hpp"

namespace quokka::TabulatedCooling
Expand Down
12 changes: 6 additions & 6 deletions src/TabulatedCooling.hpp → src/cooling/TabulatedCooling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
#include "AMReX_iMultiFab.H"
#include "fmt/core.h"

#include "FastMath.hpp"
#include "Interpolate2D.hpp"
#include "ODEIntegrate.hpp"
#include "fundamental_constants.H"
#include "hydro_system.hpp"
#include "radiation_system.hpp"
#include "root_finding.hpp"
#include "hydro/hydro_system.hpp"
#include "math/FastMath.hpp"
#include "math/Interpolate2D.hpp"
#include "math/ODEIntegrate.hpp"
#include "math/root_finding.hpp"
#include "radiation/radiation_system.hpp"

namespace quokka::TabulatedCooling
{
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions src/HLLC.hpp → src/hydro/HLLC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#include <AMReX.H>
#include <AMReX_REAL.H>

#include "ArrayView.hpp"
#include "EOS.hpp"
#include "HydroState.hpp"
#include "valarray.hpp"
#include "hydro/EOS.hpp"
#include "hydro/HydroState.hpp"
#include "util/ArrayView.hpp"
#include "util/valarray.hpp"

namespace quokka::Riemann
{
Expand Down
6 changes: 3 additions & 3 deletions src/HLLD.hpp → src/hydro/HLLD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include <AMReX.H>
#include <AMReX_REAL.H>

#include "ArrayView.hpp"
#include "HydroState.hpp"
#include "valarray.hpp"
#include "hydro/HydroState.hpp"
#include "util/ArrayView.hpp"
#include "util/valarray.hpp"

namespace quokka::Riemann
{
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/LLF.hpp → src/hydro/LLF.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <AMReX.H>
#include <AMReX_REAL.H>

#include "HydroState.hpp"
#include "valarray.hpp"
#include "hydro/HydroState.hpp"
#include "util/valarray.hpp"

namespace quokka::Riemann
{
Expand Down
6 changes: 3 additions & 3 deletions src/NSCBC_inflow.hpp → src/hydro/NSCBC_inflow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

#include "AMReX_GpuQualifiers.H"
#include "AMReX_REAL.H"
#include "EOS.hpp"
#include "hydro_system.hpp"
#include "valarray.hpp"
#include "hydro/EOS.hpp"
#include "hydro/hydro_system.hpp"
#include "util/valarray.hpp"

namespace NSCBC
{
Expand Down
6 changes: 3 additions & 3 deletions src/NSCBC_outflow.hpp → src/hydro/NSCBC_outflow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

#include "AMReX_GpuQualifiers.H"
#include "AMReX_REAL.H"
#include "EOS.hpp"
#include "hydro_system.hpp"
#include "valarray.hpp"
#include "hydro/EOS.hpp"
#include "hydro/hydro_system.hpp"
#include "util/valarray.hpp"

namespace NSCBC
{
Expand Down
2 changes: 1 addition & 1 deletion src/hydro_system.cpp → src/hydro/hydro_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
/// \brief Implements methods for solving the (1d) Euler equations.
///

#include "hydro_system.hpp"
#include "hydro/hydro_system.hpp"
8 changes: 4 additions & 4 deletions src/hydro_system.hpp → src/hydro/hydro_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
#include "AMReX_iMultiFab.H"

// internal headers
#include "ArrayView.hpp"
#include "EOS.hpp"
#include "HLLC.hpp"
#include "HLLD.hpp"
#include "LLF.hpp"
#include "hydro/EOS.hpp"
#include "hyperbolic_system.hpp"
#include "physics_info.hpp"
#include "radiation_system.hpp"
#include "valarray.hpp"
#include "radiation/radiation_system.hpp"
#include "util/ArrayView.hpp"
#include "util/valarray.hpp"

// Microphysics headers
#include "extern_parameters.H"
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/hyperbolic_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include "AMReX_SPACE.H"

// internal headers
#include "ArrayView.hpp"
#include "math_impl.hpp"
#include "math/math_impl.hpp"
#include "util/ArrayView.hpp"

// #define MULTIDIM_EXTREMA_CHECK

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/linear_advection/AdvectionSimulation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "linear_advection/AdvectionSimulation.hpp"
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#include "AMReX_YAFluxRegister.H"
#include <AMReX_FluxRegister.H>

#include "ArrayView.hpp"
#include "linear_advection.hpp"
#include "linear_advection/linear_advection.hpp"
#include "simulation.hpp"
#include "util/ArrayView.hpp"

// Simulation class should be initialized only once per program (i.e., is a singleton)
template <typename problem_t> class AdvectionSimulation : public AMRSimulation<problem_t>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
/// \brief Implements methods for solving a scalar linear advection equation.
///

#include "linear_advection.hpp"
#include "linear_advection/linear_advection.hpp"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/ODEIntegrate.hpp → src/math/ODEIntegrate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "AMReX_GpuQualifiers.H"
#include "AMReX_REAL.H"

#include "valarray.hpp"
#include "util/valarray.hpp"

using Real = amrex::Real;

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/interpolate.cpp → src/math/interpolate.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <cassert>
#include <cmath>

#include "interpolate.hpp"
#include "math/interpolate.hpp"

#define LIKELY_IN_CACHE_SIZE 8

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/root_finding.hpp → src/math/root_finding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

#endif

#include "math_impl.hpp"
#include "math/math_impl.hpp"

#ifdef BOOST_MATH_LOG_ROOT_ITERATIONS
#define BOOST_MATH_LOGGER_INCLUDE <boost/math/tools/iteration_logger.hpp>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(test_advection test_advection.cpp ../fextract.cpp ${QuokkaObjSources})
add_executable(test_advection test_advection.cpp ../../util/fextract.cpp ${QuokkaObjSources})

if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_advection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include "AMReX_ParallelDescriptor.H"
#include "AMReX_REAL.H"

#include "AdvectionSimulation.hpp"
#include "fextract.hpp"
#include "linear_advection/AdvectionSimulation.hpp"
#include "test_advection.hpp"
#include "util/fextract.hpp"

struct SawtoothProblem {
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

// external headers
#ifdef HAVE_PYTHON
#include "matplotlibcpp.h"
#include "util/matplotlibcpp.h"
#endif
#include <fmt/format.h>

// internal headers

#include "linear_advection.hpp"
#include "linear_advection/linear_advection.hpp"

// function definitions

Expand Down
File renamed without changes.
Loading

0 comments on commit c37cfb2

Please sign in to comment.