Skip to content

Commit 62bbc5e

Browse files
UCaromelnicolasaunai
authored andcommitted
tests setup
1 parent a6aa8ad commit 62bbc5e

File tree

51 files changed

+872
-502
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+872
-502
lines changed

pyphare/pyphare/mock_mhd_simulator/simulation.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from . import global_vars
22

3+
34
class Simulation(object):
45
def __init__(self, **kwargs):
56
if global_vars.sim is not None:
@@ -14,3 +15,6 @@ def __init__(self, **kwargs):
1415

1516
def set_model(self, model):
1617
self.model = model
18+
19+
def clear(self):
20+
global_vars.sim = None

pyphare/pyphare/mock_mhd_simulator/simulator.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
from . import clearDict
2-
from . import populateDict
1+
from . import clearDict, populateDict
2+
33

44
def pyMHD():
55
import importlib
66

77
return importlib.import_module("pybindlibs.pyMHD")
88

9+
910
def make_cpp_simulator(dim, interp):
1011
import pybindlibs.pyMHD
1112

1213
make_sim = f"make_mhd_mock_simulator_{dim}_{interp}"
1314
return getattr(pyMHD(), make_sim)()
1415

16+
1517
class MHDMockSimulator:
1618
def __init__(self, simulation):
1719
self.cpp_sim = None
@@ -46,3 +48,7 @@ def run(self, filename, dumpfrequency=1):
4648
self._check_init()
4749
self.cpp_sim.advance(filename, dumpfrequency)
4850
return self
51+
52+
def clear_simulation(self):
53+
self.simulation.clear()
54+
return self

src/amr/amr_constants.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
#define AMR_CONSTANTS_HPP
33

44
#include <cstddef>
5-
namespace PHARE::amr {
5+
namespace PHARE::amr
6+
{
67
static std::size_t constexpr refinementRatio = 2;
78
}
89

src/amr/data/field/field_data_factory.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace amr
3535
FieldDataFactory(bool fineBoundaryRepresentsVariable, bool dataLivesOnPatchBorder,
3636
std::string const& name, PhysicalQuantity qty)
3737
: SAMRAI::hier::PatchDataFactory(
38-
SAMRAI::hier::IntVector{SAMRAI::tbox::Dimension(dimension), n_ghosts})
38+
SAMRAI::hier::IntVector{SAMRAI::tbox::Dimension(dimension), n_ghosts})
3939
, fineBoundaryRepresentsVariable_{fineBoundaryRepresentsVariable}
4040
, dataLivesOnPatchBorder_{dataLivesOnPatchBorder}
4141
, quantity_{qty}

src/amr/data/field/field_variable.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ namespace amr
3232
*/
3333
FieldVariable(std::string const& name, PhysicalQuantity qty,
3434
bool fineBoundaryRepresentsVariable = true)
35-
: SAMRAI::hier::Variable(
36-
name,
37-
std::make_shared<FieldDataFactory<GridLayoutT, FieldImpl>>(
38-
fineBoundaryRepresentsVariable, computeDataLivesOnPatchBorder_(qty), name, qty))
35+
: SAMRAI::hier::Variable(name,
36+
std::make_shared<FieldDataFactory<GridLayoutT, FieldImpl>>(
37+
fineBoundaryRepresentsVariable,
38+
computeDataLivesOnPatchBorder_(qty), name, qty))
3939
, fineBoundaryRepresentsVariable_{fineBoundaryRepresentsVariable}
4040
, dataLivesOnPatchBorder_{computeDataLivesOnPatchBorder_(qty)}
4141
{

src/amr/data/field/refine/linear_weighter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ LinearWeighter::LinearWeighter(core::QtyCentering centering, std::size_t ratio)
4949

5050

5151
std::transform(std::begin(distFromLeftNode_), std::end(distFromLeftNode_),
52-
std::back_inserter(weights_), [](auto const& d) {
53-
return std::array<double, 2>{{1. - d, d}};
54-
});
52+
std::back_inserter(weights_),
53+
[](auto const& d) { return std::array<double, 2>{{1. - d, d}}; });
5554
}
5655

5756
} // namespace PHARE::amr

src/amr/data/particles/refine/particles_data_split.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,9 @@ namespace amr
243243
std::back_inserter(destDomainParticles), isInDest);
244244
}
245245
} // end is candidate for split
246-
} // end loop on particles
247-
} // end loop on source particle arrays
248-
} // loop on destination box
246+
} // end loop on particles
247+
} // end loop on source particle arrays
248+
} // loop on destination box
249249
}
250250

251251

src/amr/load_balancing/load_balancer_manager.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class LoadBalancerManager
2929
, id_{variableDatabase_->registerVariableAndContext(loadBalancerVar_, context_,
3030
SAMRAI::hier::IntVector::getZero(dim_))}
3131
, maxLevelNumber_{dict["simulation"]["AMR"]["max_nbr_levels"].template to<int>()}
32-
, loadBalancerEstimators_(maxLevelNumber_){};
32+
, loadBalancerEstimators_(maxLevelNumber_) {};
3333

3434
~LoadBalancerManager() { variableDatabase_->removeVariable("LoadBalancerVariable"); };
3535

src/amr/messengers/messenger.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <SAMRAI/hier/PatchHierarchy.h>
1111

1212
#include "messenger_info.hpp"
13-
//#include "core/data/grid/gridlayout.hpp"
13+
// #include "core/data/grid/gridlayout.hpp"
1414

1515

1616
namespace PHARE

src/amr/messengers/messenger_factory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ std::vector<MessengerDescriptor> makeDescriptors(std::vector<std::string> modelN
1616
else
1717
throw std::runtime_error("Error max number of models is 2");
1818
}
19-
}
19+
} // namespace PHARE::amr

0 commit comments

Comments
 (0)