Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyphare/pyphare/pharein/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def check_hyper_resistivity(**kwargs):

def check_clustering(**kwargs):
valid_keys = ["berger", "tile"]
clustering = kwargs.get("clustering", "berger")
clustering = kwargs.get("clustering", "tile")
if clustering not in valid_keys:
raise ValueError(
f"Error: clustering type is not supported, supported types are {valid_keys}"
Expand Down Expand Up @@ -906,7 +906,7 @@ class Simulation(object):

* **max_nbr_levels** (``int``), default=1, max number of levels in the hierarchy. Used if no `refinement_boxes` are set
* **tag_buffer** (``int``), default=1, value representing the number of cells by which tagged cells are buffered before clustering into boxes. The larger `tag_buffer`, the wider refined regions will be around tagged cells.
* **clustering** (``str``), {"berger" (default), "tile"}, type of clustering to use for AMR. `tile` results in wider patches, less artifacts and better scalability
* **clustering** (``str``), {"berger", "tile" (default)}, type of clustering to use for AMR. `tile` results in wider patches, less artifacts and better scalability

**Expert parameters:**

Expand Down
2 changes: 1 addition & 1 deletion src/amr/data/field/coarsening/default_field_coarsener.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include "core/utilities/point/point.hpp"
#include "core/data/grid/gridlayoutdefs.hpp"

#include "amr/data/field/coarsening/field_coarsen_index_weight.hpp"
#include "amr/resources_manager/amr_utils.hpp"
#include "amr/data/field/coarsening/field_coarsen_index_weight.hpp"

#include <SAMRAI/hier/Box.h>

Expand Down
9 changes: 2 additions & 7 deletions src/amr/data/field/coarsening/field_coarsen_index_weight.hpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
#ifndef PHARE_FIELD_COARSEN_HPP
#define PHARE_FIELD_COARSEN_HPP


#include "core/def/phare_mpi.hpp"

#include "core/def.hpp"
#include "coarsen_weighter.hpp"
#include "core/def/phare_mpi.hpp" // IWYU pragma: keep
#include "core/data/grid/gridlayoutdefs.hpp"
#include "core/hybrid/hybrid_quantities.hpp"
#include "core/data/field/field.hpp"
#include "core/utilities/constants.hpp"

#include "amr/resources_manager/amr_utils.hpp"

#include "coarsen_weighter.hpp"

#include <SAMRAI/hier/Box.h>

Expand Down
71 changes: 8 additions & 63 deletions src/amr/data/field/coarsening/field_coarsen_operator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

#include "core/def/phare_mpi.hpp" // IWYU pragma: keep
#include "core/utilities/constants.hpp"
#include "core/utilities/point/point.hpp"
#include "amr/data/tensorfield/tensor_field_data.hpp"

#include "amr/data/field/field_data.hpp"
#include "amr/utilities/box/amr_box.hpp"
#include "amr/data/field/field_geometry.hpp"
#include "amr/data/tensorfield/tensor_field_data.hpp"

#include "default_field_coarsener.hpp"

#include <SAMRAI/hier/Box.h>
#include <SAMRAI/hier/CoarsenOperator.h>
#include <SAMRAI/hier/IntVector.h>
#include <SAMRAI/hier/CoarsenOperator.h>


namespace PHARE::amr
Expand All @@ -23,74 +23,19 @@ namespace PHARE::amr
template<typename Dst>
void coarsen_field(Dst& destinationField, auto& sourceField, auto& intersectionBox, auto& coarsener)
{
auto constexpr static dimension = Dst::dimension;

// now we can loop over the intersection box

core::Point<int, dimension> startIndex;
core::Point<int, dimension> endIndex;

startIndex[dirX] = intersectionBox.lower(dirX);
endIndex[dirX] = intersectionBox.upper(dirX);

if constexpr (dimension > 1)
{
startIndex[dirY] = intersectionBox.lower(dirY);
endIndex[dirY] = intersectionBox.upper(dirY);
}
if constexpr (dimension > 2)
{
startIndex[dirZ] = intersectionBox.lower(dirZ);
endIndex[dirZ] = intersectionBox.upper(dirZ);
}

if constexpr (dimension == 1)
{
for (int ix = startIndex[dirX]; ix <= endIndex[dirX]; ++ix)
{
coarsener(sourceField, destinationField, {{ix}});
}
}


else if constexpr (dimension == 2)
{
for (int ix = startIndex[dirX]; ix <= endIndex[dirX]; ++ix)
{
for (int iy = startIndex[dirY]; iy <= endIndex[dirY]; ++iy)
{
coarsener(sourceField, destinationField, {{ix, iy}});
}
}
}


else if constexpr (dimension == 3)
{
for (int ix = startIndex[dirX]; ix <= endIndex[dirX]; ++ix)
{
for (int iy = startIndex[dirY]; iy <= endIndex[dirY]; ++iy)
{
for (int iz = startIndex[dirZ]; iz <= endIndex[dirZ]; ++iz)

{
coarsener(sourceField, destinationField, {{ix, iy, iz}});
}
}
}
} // end 3D
for (auto const bix : phare_box_from<Dst::dimension>(intersectionBox))
coarsener(sourceField, destinationField, bix);
}


} // namespace PHARE::amr


namespace PHARE
{
namespace amr
{
using core::dirX;
using core::dirY;
using core::dirZ;

//
template<typename GridLayoutT, typename FieldT, typename FieldCoarsenerPolicy,
typename PhysicalQuantity = decltype(std::declval<FieldT>().physicalQuantity())>
Expand Down Expand Up @@ -152,7 +97,7 @@ namespace amr
* get the Field and GridLayout encapsulated into the fieldData.
* With the help of FieldGeometry, transform the coarseBox to the correct index.
* After that we can now create FieldCoarsen with the indexAndWeight implementation
* selected. Finaly loop over the indexes in the box, and apply the coarsening defined
* selected. Finally loop over the indexes in the box, and apply the coarsening defined
* in FieldCoarsen operator
*
*/
Expand Down
16 changes: 3 additions & 13 deletions src/amr/data/field/field_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,21 @@
#include "core/def/phare_mpi.hpp" // IWYU pragma: keep

#include "core/logger.hpp"
#include "core/data/grid/gridlayout.hpp"
#include "core/data/grid/gridlayout_impl.hpp"
#include "core/data/field/field_box.hpp"

#include "amr/resources_manager/amr_utils.hpp"

#include "field_geometry.hpp"
#include "core/data/field/field_box.hpp"


#include <SAMRAI/hier/PatchData.h>
#include <SAMRAI/tbox/MemoryUtilities.h>

#include <utility>

namespace PHARE
{
namespace amr
{
// We use another class here so that we can specialize specifics function: copy , pack , unpack
// on the dimension and we don't want to loose non specialized function related to SAMRAI
// interface
template<typename GridLayoutT, std::size_t dim, typename Grid_t,
typename PhysicalQuantity = decltype(std::declval<Grid_t>().physicalQuantity())>
class FieldDataInternals
{
};


/**@brief FieldData is the specialization of SAMRAI::hier::PatchData to Field objects
*
Expand Down
14 changes: 7 additions & 7 deletions src/amr/data/field/field_data_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
#define PHARE_SRC_AMR_FIELD_FIELD_DATA_FACTORY_HPP


#include "core/def/phare_mpi.hpp"
#include "core/def/phare_mpi.hpp" // IWYU pragma: keep

#include <SAMRAI/geom/CartesianPatchGeometry.h>
#include <SAMRAI/hier/Patch.h>
#include <SAMRAI/hier/PatchDataFactory.h>
#include <SAMRAI/tbox/MemoryUtilities.h>

#include <utility>
#include <SAMRAI/hier/PatchDataFactory.h>
#include <SAMRAI/geom/CartesianPatchGeometry.h>

#include "field_data.hpp"

#include <utility>

namespace PHARE
{
namespace amr
Expand All @@ -35,7 +35,7 @@ namespace amr
FieldDataFactory(bool fineBoundaryRepresentsVariable, bool dataLivesOnPatchBorder,
std::string const& name, PhysicalQuantity qty)
: SAMRAI::hier::PatchDataFactory(
SAMRAI::hier::IntVector{SAMRAI::tbox::Dimension(dimension), n_ghosts})
SAMRAI::hier::IntVector{SAMRAI::tbox::Dimension(dimension), n_ghosts})
, fineBoundaryRepresentsVariable_{fineBoundaryRepresentsVariable}
, dataLivesOnPatchBorder_{dataLivesOnPatchBorder}
, quantity_{qty}
Expand Down Expand Up @@ -127,7 +127,7 @@ namespace amr
nbCell[iDim] = box.numberCells(iDim);
}

const std::size_t baseField
std::size_t const baseField
= SAMRAI::tbox::MemoryUtilities::align(sizeof(FieldData<GridLayoutT, FieldImpl>));

GridLayoutT gridLayout{dl, nbCell, origin};
Expand Down
9 changes: 3 additions & 6 deletions src/amr/data/field/field_geometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
#define PHARE_SRC_AMR_FIELD_FIELD_GEOMETRY_HPP


#include "core/def/phare_mpi.hpp"


#include "SAMRAI/hier/IntVector.h"
#include "core/data/grid/gridlayoutdefs.hpp"
#include "core/data/grid/gridlayout.hpp"
#include "core/utilities/types.hpp"
#include "core/data/grid/gridlayout.hpp"
#include "core/data/grid/gridlayoutdefs.hpp"

#include "field_overlap.hpp"

#include <SAMRAI/hier/Box.h>
#include "SAMRAI/hier/IntVector.h"
#include <SAMRAI/hier/BoxGeometry.h>

#include <cassert>
Expand Down
4 changes: 2 additions & 2 deletions src/amr/data/field/field_overlap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#define PHARE_SRC_AMR_FIELD_FIELD_OVERLAP_HPP


#include "core/def/phare_mpi.hpp"
#include "core/def/phare_mpi.hpp" // IWYU pragma: keep

#include <SAMRAI/hier/BoxContainer.h>
#include <SAMRAI/hier/BoxOverlap.h>
#include <SAMRAI/hier/BoxContainer.h>
#include <SAMRAI/hier/Transformation.h>

namespace PHARE
Expand Down
2 changes: 1 addition & 1 deletion src/amr/data/field/field_variable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define PHARE_SRC_AMR_FIELD_FIELD_VARIABLE_HPP


#include "core/def/phare_mpi.hpp"
#include "core/def/phare_mpi.hpp" // IWYU pragma: keep

#include <SAMRAI/hier/Variable.h>

Expand Down
7 changes: 3 additions & 4 deletions src/amr/data/field/field_variable_fill_pattern.hpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
#ifndef PHARE_SRC_AMR_FIELD_FIELD_VARIABLE_FILL_PATTERN_HPP
#define PHARE_SRC_AMR_FIELD_FIELD_VARIABLE_FILL_PATTERN_HPP

#include "amr/data/tensorfield/tensor_field_overlap.hpp"
#include "core/logger.hpp"
#include "core/def/phare_mpi.hpp"

#include "core/utilities/types.hpp"
#include <core/hybrid/hybrid_quantities.hpp>

#include "core/data/tensorfield/tensorfield.hpp"

#include <amr/utilities/box/amr_box.hpp>
#include "amr/data/field/field_geometry.hpp"
#include "amr/data/tensorfield/tensor_field_overlap.hpp"
#include "amr/data/tensorfield/tensor_field_geometry.hpp"

#include <SAMRAI/pdat/CellOverlap.h>
#include "SAMRAI/xfer/VariableFillPattern.h"
#include "core/utilities/types.hpp"

#include <cassert>
#include <cstddef>
Expand Down
11 changes: 6 additions & 5 deletions src/amr/data/field/refine/electric_field_refiner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
#define PHARE_ELECTRIC_FIELD_REFINER_HPP


#include "core/def/phare_mpi.hpp"
#include "core/def/phare_mpi.hpp" // IWYU pragma: keep

#include <SAMRAI/hier/Box.h>

#include "amr/resources_manager/amr_utils.hpp"
#include "core/utilities/constants.hpp"
#include "core/data/grid/gridlayoutdefs.hpp"
#include "core/utilities/point/point.hpp"
#include "core/data/grid/gridlayoutdefs.hpp"

#include "amr/resources_manager/amr_utils.hpp"

#include <SAMRAI/hier/Box.h>

#include <cstddef>

Expand Down
11 changes: 4 additions & 7 deletions src/amr/data/field/refine/field_linear_refine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@
#define PHARE_FIELD_LINEAR_REFINE_HPP


#include "core/def/phare_mpi.hpp"


#include "core/def.hpp"
#include "core/data/grid/gridlayoutdefs.hpp"
#include "core/data/field/field.hpp"
#include "linear_weighter.hpp"
#include "core/def/phare_mpi.hpp" // IWYU pragma: keep
#include "core/utilities/constants.hpp"
#include "core/utilities/point/point.hpp"
#include "core/data/grid/gridlayoutdefs.hpp"

#include "linear_weighter.hpp"

#include <SAMRAI/hier/Box.h>
#include <SAMRAI/hier/IntVector.h>

#include <array>
#include <utility>
#include <vector>


namespace PHARE
Expand Down
Loading