Skip to content

Commit caa898e

Browse files
committed
vtkhdf
1 parent 4c14eb0 commit caa898e

29 files changed

+1435
-502
lines changed

pyphare/pyphare/pharein/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ def as_paths(rb):
328328
)
329329

330330
if len(simulation.diagnostics) > 0:
331+
if simulation.diag_options is not None and "format" in simulation.diag_options:
332+
add_string(diag_path + "format", simulation.diag_options["format"])
333+
331334
if simulation.diag_options is not None and "options" in simulation.diag_options:
332335
add_string(
333336
diag_path + "filePath", simulation.diag_options["options"]["dir"]

pyphare/pyphare/pharein/simulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def check_directory(directory, key):
481481
# diag_options = {"format":"phareh5", "options": {"dir": "phare_ouputs/"}}
482482
def check_diag_options(**kwargs):
483483
diag_options = kwargs.get("diag_options", None)
484-
formats = ["phareh5"]
484+
formats = ["phareh5", "pharevtkhdf"]
485485
if diag_options is not None and "format" in diag_options:
486486
if diag_options["format"] not in formats:
487487
raise ValueError("Error - diag_options format is invalid")

src/amr/physical_models/hybrid_model.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ class HybridModel : public IPhysicalModel<AMR_Types>
2828
using Interface = IPhysicalModel<AMR_Types>;
2929
using amr_types = AMR_Types;
3030
using electrons_t = Electrons;
31-
using patch_t = typename AMR_Types::patch_t;
32-
using level_t = typename AMR_Types::level_t;
31+
using patch_t = AMR_Types::patch_t;
32+
using level_t = AMR_Types::level_t;
3333
using gridlayout_type = GridLayoutT;
3434
using electromag_type = Electromag;
35-
using vecfield_type = typename Electromag::vecfield_type;
36-
using field_type = typename vecfield_type::field_type;
35+
using vecfield_type = Electromag::vecfield_type;
36+
using field_type = vecfield_type::field_type;
3737
using grid_type = Grid_t;
3838
using ions_type = Ions;
39-
using particle_array_type = typename Ions::particle_array_type;
39+
using particle_array_type = Ions::particle_array_type;
4040
using resources_manager_type = amr::ResourcesManager<gridlayout_type, grid_type>;
4141
using ParticleInitializerFactory
4242
= core::ParticleInitializerFactory<particle_array_type, gridlayout_type>;

src/amr/resources_manager/amr_utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ namespace amr
248248
iLevel++)
249249
{
250250
visitLevel<GridLayout>(*hierarchy.getPatchLevel(iLevel), resman,
251-
std::forward<Action>(action), std::forward<Args...>(args...));
251+
std::forward<Action>(action), std::forward<Args>(args)...);
252252
}
253253
}
254254

src/core/data/grid/gridlayout.hpp

Lines changed: 44 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@
22
#define PHARE_CORE_GRID_GridLayout_HPP
33

44

5-
#include "core/hybrid/hybrid_quantities.hpp"
5+
#include "core/def.hpp"
66
#include "core/utilities/types.hpp"
7-
#include "core/data/field/field.hpp"
8-
#include "gridlayoutdefs.hpp"
9-
#include "core/utilities/algorithm.hpp"
107
#include "core/utilities/box/box.hpp"
118
#include "core/utilities/constants.hpp"
129
#include "core/utilities/index/index.hpp"
1310
#include "core/utilities/point/point.hpp"
14-
#include "core/def.hpp"
11+
#include "core/hybrid/hybrid_quantities.hpp"
12+
13+
#include "gridlayoutdefs.hpp"
1514

1615
#include <array>
17-
#include <cmath>
1816
#include <tuple>
1917
#include <cstddef>
2018
#include <functional>
@@ -879,7 +877,6 @@ namespace core
879877
return GridLayoutImpl::centering(hybridQuantity);
880878
}
881879

882-
883880
NO_DISCARD constexpr static std::array<std::array<QtyCentering, dimension>, 6>
884881
centering(HybridQuantity::Tensor hybridQuantity)
885882
{
@@ -1027,6 +1024,29 @@ namespace core
10271024

10281025

10291026

1027+
/**
1028+
* @brief BxToMoments return the indexes and associated coef to compute the linear
1029+
* interpolation necessary to project Bx onto moments.
1030+
*/
1031+
NO_DISCARD auto static constexpr BxToMoments() { return GridLayoutImpl::BxToMoments(); }
1032+
1033+
1034+
/**
1035+
* @brief ByToMoments return the indexes and associated coef to compute the linear
1036+
* interpolation necessary to project By onto moments.
1037+
*/
1038+
NO_DISCARD auto static constexpr ByToMoments() { return GridLayoutImpl::ByToMoments(); }
1039+
1040+
1041+
/**
1042+
* @brief BzToMoments return the indexes and associated coef to compute the linear
1043+
* interpolation necessary to project Bz onto moments.
1044+
*/
1045+
NO_DISCARD auto static constexpr BzToMoments() { return GridLayoutImpl::BzToMoments(); }
1046+
1047+
1048+
1049+
10301050
/**
10311051
* @brief ExToMoments return the indexes and associated coef to compute the linear
10321052
* interpolation necessary to project Ex onto moments.
@@ -1157,30 +1177,23 @@ namespace core
11571177

11581178

11591179

1160-
1161-
auto AMRGhostBoxFor(auto const& field) const
1180+
auto AMRBoxFor(auto const& field) const
11621181
{
11631182
auto const centerings = centering(field);
1164-
auto const growBy = [&]() {
1165-
std::array<int, dimension> arr;
1166-
for (std::uint8_t i = 0; i < dimension; ++i)
1167-
arr[i] = nbrGhosts(centerings[i]);
1168-
return arr;
1169-
}();
1170-
auto ghostBox = grow(AMRBox_, growBy);
1183+
auto box = AMRBox_;
11711184
for (std::uint8_t i = 0; i < dimension; ++i)
1172-
ghostBox.upper[i] += (centerings[i] == QtyCentering::primal) ? 1 : 0;
1173-
return ghostBox;
1185+
box.upper[i] += (centerings[i] == QtyCentering::primal) ? 1 : 0;
1186+
return box;
11741187
}
11751188

1176-
auto AMRBoxFor(auto const& field) const
1189+
auto AMRGhostBoxFor(auto const& field) const
11771190
{
11781191
auto const centerings = centering(field);
1179-
return grow(AMRGhostBoxFor(field), for_N_make_array<dimension>([&](auto i) {
1180-
return -1 * nbrGhosts(centerings[i]);
1181-
}));
1192+
return grow(AMRBoxFor(field), for_N_make_array<dimension>(
1193+
[&](auto i) { return nbrGhosts(centerings[i]); }));
11821194
}
11831195

1196+
11841197
template<typename Field, typename Fn>
11851198
void evalOnBox(Field& field, Fn&& fn) const
11861199
{
@@ -1203,6 +1216,15 @@ namespace core
12031216

12041217
auto levelNumber() const { return levelNumber_; }
12051218

1219+
1220+
auto amr_lcl_idx(auto const& box) const { return boxes_iterator{box, AMRToLocal(box)}; }
1221+
auto amr_lcl_idx() const { return amr_lcl_idx(AMRBox()); }
1222+
auto domain_amr_lcl_idx(auto const& field) const { return amr_lcl_idx(AMRBoxFor(field)); }
1223+
auto ghost_amr_lcl_idx(auto const& field) const
1224+
{
1225+
return amr_lcl_idx(AMRGhostBoxFor(field));
1226+
}
1227+
12061228
private:
12071229
template<typename Field, typename IndicesFn, typename Fn>
12081230
static void evalOnBox_(Field& field, Fn& fn, IndicesFn& startToEnd)
@@ -1515,51 +1537,6 @@ namespace core
15151537
}
15161538

15171539

1518-
1519-
struct AMRLocalIndexer //
1520-
{
1521-
GridLayout const* layout;
1522-
Box<int, dimension> amr_box;
1523-
Box<std::uint32_t, dimension> lcl_box = layout->AMRToLocal(amr_box);
1524-
1525-
struct iterator
1526-
{
1527-
void operator++()
1528-
{
1529-
++amr_it;
1530-
++lcl_it;
1531-
}
1532-
auto operator*() { return std::forward_as_tuple(*amr_it, *lcl_it); }
1533-
auto operator==(auto const& that) const
1534-
{
1535-
return amr_it == that.amr_it and lcl_it == that.lcl_it;
1536-
}
1537-
auto operator!=(auto const& that) const
1538-
{
1539-
return amr_it != that.amr_it or lcl_it != that.lcl_it;
1540-
}
1541-
1542-
AMRLocalIndexer const* amr_lcl_indexer;
1543-
box_iterator<int, dimension> amr_it;
1544-
box_iterator<std::uint32_t, dimension> lcl_it;
1545-
};
1546-
1547-
auto begin() const { return iterator{this, amr_box.begin(), lcl_box.begin()}; }
1548-
auto end() const { return iterator{this, amr_box.end(), lcl_box.end()}; }
1549-
};
1550-
1551-
public:
1552-
auto amr_lcl_idx(auto const& box) const { return AMRLocalIndexer{this, box}; }
1553-
auto amr_lcl_idx() const { return amr_lcl_idx(AMRBox()); }
1554-
auto domain_amr_lcl_idx(auto const& field) const
1555-
{
1556-
return AMRLocalIndexer{this, AMRBoxFor(field)};
1557-
}
1558-
auto ghost_amr_lcl_idx(auto const& field) const
1559-
{
1560-
return AMRLocalIndexer{this, AMRGhostBoxFor(field)};
1561-
}
1562-
15631540
private:
15641541
std::array<double, dimension> meshSize_;
15651542
Point<double, dimension> origin_;

src/core/data/grid/gridlayoutdefs.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#ifndef PHARE_CORE_GRID_GRIDLAYOUTDEFS_HPP
22
#define PHARE_CORE_GRID_GRIDLAYOUTDEFS_HPP
33

4-
#include <cstddef>
54

6-
#include "core/hybrid/hybrid_quantities.hpp"
7-
#include "core/utilities/types.hpp"
85
#include "core/utilities/point/point.hpp"
6+
#include "core/hybrid/hybrid_quantities.hpp"
7+
8+
#include <cstddef>
99

1010
namespace PHARE
1111
{

0 commit comments

Comments
 (0)