AMR Adaptive Multi Resolution Grid. More...
AMR Adaptive Multi Resolution Grid.
dim | Dimensionality |
St | type of space |
T | what each point of the grid store |
Decomposition | type of decomposition |
Definition at line 133 of file grid_dist_amr.hpp.
#include <grid_dist_amr.hpp>
Public Member Functions | |
grid_dist_amr (const Box< dim, St > &domain, const Ghost< dim, long int > &g) | |
Constructor. | |
grid_dist_amr (const Box< dim, St > &domain, const Ghost< dim, long int > &g, periodicity< dim > &bc) | |
Constructor. | |
void | initLevels (const Decomposition &dec, size_t n_lvl, const size_t(&g_sz)[dim]) |
Initialize the amr grid. | |
template<typename TT > | |
void | initLevels (const Decomposition_encap< Decomposition, TT > &dec, size_t n_lvl, const size_t(&g_sz)[dim]) |
Initialize the amr grid. | |
void | recalculate_mvoff () |
Recalculate the offset array for the moveLvlUp and moveLvlDw. | |
void | initLevels (size_t n_lvl, const size_t(&g_sz)[dim], size_t opt=0) |
Initialize the amr grid. | |
template<typename Model > | |
void | addComputationCosts (Model md=Model(), size_t ts=1) |
Add the computation cost on the decomposition using a resolution function. | |
Decomposition_encap< Decomposition, decltype(gd_array)> | getDecomposition () |
Get the object that store the information about the decomposition. | |
grid_dist_id< dim, St, T, Decomposition, Memory, device_grid > & | getLevel (size_t lvl) |
Get the underlying grid level. | |
grid_dist_amr_key_iterator< dim, device_grid, decltype(grid_dist_id< dim, St, T, Decomposition, Memory, device_grid >::type_of_subiterator()), decltype(grid_dist_id< dim, St, T, Decomposition, Memory, device_grid >::type_of_subiterator()) > | getDomainIteratorCells () |
grid_dist_iterator_sub< dim, device_grid > | getDomainIteratorCells (size_t lvl) |
auto | getGridGhostIterator (size_t lvl) -> decltype(gd_array.get(lvl).getGridGhostIterator(grid_key_dx< dim >(), grid_key_dx< dim >())) |
Get an iterator to the grid. | |
auto | getGridIterator (size_t lvl) -> decltype(gd_array.get(lvl).getGridIterator()) |
Get an iterator to the grid. | |
auto | getGridIterator (size_t lvl, grid_key_dx< dim > &start, grid_key_dx< dim > &stop) -> decltype(gd_array.get(lvl).getGridIterator(start, stop)) |
Get an iterator to the grid. | |
auto | getGridIteratorCells (size_t lvl) -> decltype(gd_array.get(lvl).getGridIterator()) |
Get an iterator to the grid. | |
grid_dist_iterator< dim, device_grid, decltype(device_grid::type_of_subiterator()), FREE > | getDomainIterator (size_t lvl) const |
return an iterator over the level lvl | |
grid_dist_iterator< dim, device_grid, decltype(device_grid::type_of_iterator()), FIXED > | getDomainGhostIterator (size_t lvl) const |
return an iterator over the level lvl | |
grid_dist_amr_key_iterator< dim, device_grid, decltype(device_grid::type_of_subiterator())> | getDomainIterator () |
Get domain iterator. | |
grid_dist_amr_key_iterator< dim, device_grid, decltype(device_grid::type_of_iterator()), grid_dist_iterator< dim, device_grid, decltype(device_grid::type_of_iterator()), FIXED > > | getDomainGhostIterator () |
Get domain iterator. | |
template<unsigned int p> | |
auto | get (const grid_dist_amr_key< dim > &v1) const -> decltype(gd_array.get(v1.getLvl()).template get< p >(v1.getKey())) |
Get the reference of the selected element. | |
template<unsigned int p> | |
auto | get (const grid_dist_amr_key< dim > &v1) -> decltype(gd_array.get(v1.getLvl()).template get< p >(v1.getKey())) |
Get the reference of the selected element. | |
template<unsigned int p> | |
auto | get (size_t lvl, const grid_dist_key_dx< dim > &v1) const -> decltype(gd_array.get(lvl).template get< p >(v1)) |
Get the reference of the selected element. | |
template<unsigned int p> | |
auto | get (size_t lvl, const grid_dist_key_dx< dim > &v1) -> decltype(gd_array.get(lvl).template get< p >(v1)) |
Get the reference of the selected element. | |
template<unsigned int p> | |
auto | insert (const grid_dist_amr_key< dim > &v1) -> decltype(gd_array.get(v1.getLvl()).template insert< p >(v1.getKey())) |
Get the reference of the selected element. | |
template<unsigned int p> | |
auto | insert (size_t lvl, const grid_dist_key_dx< dim > &v1) -> decltype(gd_array.get(lvl).template insert< p >(v1)) |
Get the reference of the selected element. | |
grid_dist_id< dim, St, T, Decomposition, Memory, device_grid > & | getDistGrid (size_t lvl) |
Get the internal distributed grid. | |
void | remove (const grid_dist_amr_key< dim > &v1) |
Remove a grid point (this function make sense only in case of sparse grid) | |
void | remove (size_t lvl, const grid_dist_key_dx< dim > &v1) |
Remove a grid point (this function make sense only in case of sparse grid) | |
void | construct_level_connections () |
construct level connections for padding particles | |
template<typename stencil_type > | |
void | tagBoundaries () |
construct level connections for padding particles | |
template<int... prp> | |
void | ghost_get (size_t opt=0) |
It synchronize the ghost parts. | |
void | map (size_t opt=0) |
It move all the grid parts that do not belong to the local processor to the respective processor. | |
template<template< typename, typename > class op, int... prp> | |
void | ghost_put () |
Apply the ghost put. | |
size_t | size_inserted (size_t lvl) |
Return the number of inserted points on a particular level. | |
void | setBackgroundValue (T &bv) |
set the background value | |
void | clear () |
delete all the points in the grid | |
const grid_sm< dim, void > & | getGridInfoVoid (size_t lvl) const |
Get an object containing the grid informations for a specific level. | |
size_t | getNLvl () |
Return the maximum number of levels in the AMR struct. | |
void | moveLvlDw (grid_dist_amr_key< dim > &key) |
Move down (to finer level) the key. | |
grid_dist_key_dx< dim > | moveDw (int lvl, const grid_dist_key_dx< dim > &key) |
Move down (to finer level) the key. | |
grid_dist_amr_key< dim > | getAMRKey (size_t lvl, grid_dist_key_dx< dim > key) |
From a distributed key it return a AMR key that contain also the grid level. | |
void | moveLvlUp (grid_dist_amr_key< dim > &key) |
Move up (to coarser level) the key. | |
grid_dist_key_dx< dim > | moveUp (int lvl, const grid_dist_key_dx< dim > &key) |
Move up (to coarser level) the key. | |
grid_key_dx< dim > | getGKey (const grid_dist_amr_key< dim > &v1) |
Get the position on the grid in global coordinates. | |
grid_key_dx< dim > | getGKey (int lvl, const grid_dist_key_dx< dim > &v1) |
Get the position on the grid in global coordinates. | |
Point< dim, St > | getPos (const grid_dist_amr_key< dim > &v1) |
Get the the position of the point. | |
Point< dim, St > | getPos (int lvl, const grid_dist_key_dx< dim > &v1) |
Get the the position of the point. | |
Point< dim, St > | getSpacing (size_t lvl) |
return the spacing for the grid in the level lvl | |
bool | existPoint (const grid_dist_amr_key< dim > &v1) |
bool | existPoint (int lvl, const grid_dist_key_dx< dim > &v1) |
bool | write (std::string output, size_t opt=VTK_WRITER|FORMAT_ASCII) |
Write on vtk file. | |
Private Types | |
typedef decltype(device_grid::type_of_subiterator()) | device_sub_it |
Type of structure sub-grid iterator. | |
typedef decltype(device_grid::type_of_iterator()) | device_it |
Type of structure for the grid iterator. | |
Private Member Functions | |
void | initialize_other (size_t n_lvl, size_t(&g_sz_lvl)[dim]) |
Initialize the others levels. | |
Private Attributes | |
Box< dim, St > | domain |
Simulation domain. | |
Ghost< dim, long int > | g_int |
Ghost integer. | |
periodicity< dim > | bc |
Boundary conditions of the structure. | |
openfpm::vector< grid_dist_id< dim, St, T, Decomposition, Memory, device_grid >, HeapMemory, memory_traits_lin, openfpm::grow_policy_identity, STD_VECTOR > | gd_array |
array of grids | |
openfpm::vector< grid_dist_iterator< dim, device_grid, device_sub_it, FREE > > | git |
Domain iterator for each distributed grid. | |
openfpm::vector< grid_dist_iterator< dim, device_grid, device_it, FIXED > > | git_g |
Domain and ghost iterator for each distributed grid. | |
openfpm::vector< grid_dist_iterator_sub< dim, device_grid > > | git_sub |
Iterator for each distributed grid. | |
openfpm::vector< openfpm::vector< offset_mv< dim > > > | mv_off |
Moving offsets. | |
T | bck |
background level | |
|
private |
Type of structure for the grid iterator.
Definition at line 155 of file grid_dist_amr.hpp.
|
private |
Type of structure sub-grid iterator.
Definition at line 152 of file grid_dist_amr.hpp.
|
inline |
Constructor.
domain | Simulation domain |
g | ghost extension |
Definition at line 210 of file grid_dist_amr.hpp.
|
inline |
Constructor.
domain | Simulation domain |
g | ghost extension |
bc | boundary conditions |
Definition at line 226 of file grid_dist_amr.hpp.
|
inline |
Add the computation cost on the decomposition using a resolution function.
md | Model to use |
ts | It is an optional parameter approximately should be the number of ghost get between two rebalancing at first decomposition this number can be ignored (default = 1) because not used |
Definition at line 351 of file grid_dist_amr.hpp.
|
inline |
delete all the points in the grid
In case of sparse grid in delete all the inserted points, in case of dense it does nothing
Definition at line 825 of file grid_dist_amr.hpp.
|
inline |
construct level connections for padding particles
Definition at line 722 of file grid_dist_amr.hpp.
|
inline |
Definition at line 1034 of file grid_dist_amr.hpp.
|
inline |
Definition at line 1044 of file grid_dist_amr.hpp.
|
inline |
Get the reference of the selected element.
p | property to get (is an integer) |
v1 | grid_key that identify the element in the grid |
Definition at line 593 of file grid_dist_amr.hpp.
|
inline |
Get the reference of the selected element.
p | property to get (is an integer) |
v1 | grid_key that identify the element in the grid |
Definition at line 577 of file grid_dist_amr.hpp.
|
inline |
Get the reference of the selected element.
p | property to get (is an integer) |
v1 | grid_key that identify the element in the grid |
Definition at line 626 of file grid_dist_amr.hpp.
|
inline |
Get the reference of the selected element.
p | property to get (is an integer) |
v1 | grid_key that identify the element in the grid |
Definition at line 610 of file grid_dist_amr.hpp.
|
inline |
From a distributed key it return a AMR key that contain also the grid level.
lvl | level |
key | distributed key |
Definition at line 911 of file grid_dist_amr.hpp.
|
inline |
Get the object that store the information about the decomposition.
Definition at line 361 of file grid_dist_amr.hpp.
|
inline |
Get the internal distributed grid.
lvl | level |
Definition at line 683 of file grid_dist_amr.hpp.
|
inline |
Get domain iterator.
Definition at line 556 of file grid_dist_amr.hpp.
|
inline |
return an iterator over the level lvl
lvl | level |
Definition at line 526 of file grid_dist_amr.hpp.
|
inline |
Get domain iterator.
Definition at line 537 of file grid_dist_amr.hpp.
|
inline |
return an iterator over the level lvl
lvl | level |
Definition at line 511 of file grid_dist_amr.hpp.
|
inline |
Definition at line 384 of file grid_dist_amr.hpp.
|
inline |
Definition at line 410 of file grid_dist_amr.hpp.
|
inline |
Get the position on the grid in global coordinates.
v1 | amr key |
Definition at line 975 of file grid_dist_amr.hpp.
|
inline |
Get the position on the grid in global coordinates.
lvl | level |
v1 | point in the level |
Definition at line 988 of file grid_dist_amr.hpp.
|
inline |
Get an iterator to the grid.
Definition at line 432 of file grid_dist_amr.hpp.
|
inline |
Get an object containing the grid informations for a specific level.
lvl | level |
Definition at line 838 of file grid_dist_amr.hpp.
|
inline |
Get an iterator to the grid.
Definition at line 451 of file grid_dist_amr.hpp.
|
inline |
Get an iterator to the grid.
Definition at line 461 of file grid_dist_amr.hpp.
|
inline |
Get an iterator to the grid.
Definition at line 485 of file grid_dist_amr.hpp.
|
inline |
Get the underlying grid level.
lvl | level |
Definition at line 375 of file grid_dist_amr.hpp.
|
inline |
Return the maximum number of levels in the AMR struct.
Definition at line 848 of file grid_dist_amr.hpp.
|
inline |
Get the the position of the point.
v1 | AMR point |
Definition at line 1000 of file grid_dist_amr.hpp.
|
inline |
Get the the position of the point.
v1 | AMR point |
Definition at line 1012 of file grid_dist_amr.hpp.
|
inline |
return the spacing for the grid in the level lvl
lvl | level |
Definition at line 1024 of file grid_dist_amr.hpp.
|
inline |
It synchronize the ghost parts.
prp... | Properties to synchronize |
Definition at line 761 of file grid_dist_amr.hpp.
|
inline |
Apply the ghost put.
prp... | Properties to apply ghost put |
Definition at line 787 of file grid_dist_amr.hpp.
|
inlineprivate |
Initialize the others levels.
n_grid_dist_id<dim,St,T,Decomposition,Memory,device_grid>lvl | number of levels |
g_sz_lvl | grid size on each level |
Definition at line 178 of file grid_dist_amr.hpp.
|
inline |
Initialize the amr grid.
dec | Decomposition (this parameter is useful in case we want to constrain the AMR to an external decomposition) |
n_lvl | maximum number of levels (0 mean no additional levels) |
g_sz | coarsest grid size on each direction |
Definition at line 238 of file grid_dist_amr.hpp.
|
inline |
Initialize the amr grid.
dec | Decomposition (this parameter is useful in case we want to constrain the AMR to an external decomposition) |
n_lvl | maximum number of levels (0 mean no additional levels) |
g_sz | coarsest grid size on each direction |
Definition at line 259 of file grid_dist_amr.hpp.
|
inline |
Initialize the amr grid.
n_lvl | maximum number of levels (0 mean no additional levels) |
g_sz | coarsest grid size on each direction |
opt | options |
Definition at line 330 of file grid_dist_amr.hpp.
|
inline |
Get the reference of the selected element.
p | property to get (is an integer) |
v1 | grid_key that identify the element in the grid |
Definition at line 646 of file grid_dist_amr.hpp.
|
inline |
Get the reference of the selected element.
p | property to get (is an integer) |
v1 | grid_key that identify the element in the grid |
Definition at line 665 of file grid_dist_amr.hpp.
|
inline |
It move all the grid parts that do not belong to the local processor to the respective processor.
Definition at line 772 of file grid_dist_amr.hpp.
|
inline |
Move down (to finer level) the key.
lvl | level |
key | multi-resolution AMR key |
Definition at line 884 of file grid_dist_amr.hpp.
|
inline |
Move down (to finer level) the key.
key | multi-resolution AMR key |
Definition at line 858 of file grid_dist_amr.hpp.
|
inline |
Move up (to coarser level) the key.
key | multi-resolution AMR key |
Definition at line 921 of file grid_dist_amr.hpp.
|
inline |
Move up (to coarser level) the key.
lvl | level |
key | multi-resolution AMR key |
Definition at line 947 of file grid_dist_amr.hpp.
|
inline |
Recalculate the offset array for the moveLvlUp and moveLvlDw.
Definition at line 269 of file grid_dist_amr.hpp.
|
inline |
Remove a grid point (this function make sense only in case of sparse grid)
v1 | grid_key that identify the element in the AMR grid to eleminate |
Definition at line 696 of file grid_dist_amr.hpp.
|
inline |
Remove a grid point (this function make sense only in case of sparse grid)
v1 | grid_key that identify the element in the AMR grid to eleminate |
Definition at line 710 of file grid_dist_amr.hpp.
|
inline |
set the background value
You can use this function make sense in case of sparse in case of dense it does nothing
Definition at line 811 of file grid_dist_amr.hpp.
|
inline |
Return the number of inserted points on a particular level.
Definition at line 800 of file grid_dist_amr.hpp.
|
inline |
construct level connections for padding particles
stencil_type | type of stencil |
Definition at line 746 of file grid_dist_amr.hpp.
|
inline |
Write on vtk file.
output | filename output |
Definition at line 1055 of file grid_dist_amr.hpp.
|
private |
Boundary conditions of the structure.
Definition at line 142 of file grid_dist_amr.hpp.
|
private |
background level
Definition at line 170 of file grid_dist_amr.hpp.
|
private |
Simulation domain.
Definition at line 136 of file grid_dist_amr.hpp.
|
private |
Ghost integer.
Definition at line 139 of file grid_dist_amr.hpp.
|
private |
array of grids
Definition at line 149 of file grid_dist_amr.hpp.
|
private |
Domain iterator for each distributed grid.
Definition at line 158 of file grid_dist_amr.hpp.
|
private |
Domain and ghost iterator for each distributed grid.
Definition at line 161 of file grid_dist_amr.hpp.
|
private |
Iterator for each distributed grid.
Definition at line 164 of file grid_dist_amr.hpp.
|
private |
Moving offsets.
Definition at line 167 of file grid_dist_amr.hpp.