|
IPPL (Independent Parallel Particle Layer)
IPPL
|
#include <FieldLayout.h>
Classes | |
| struct | bound_type |
Public Types | |
| using | NDIndex_t = NDIndex<Dim> |
| using | view_type = typename detail::ViewType<NDIndex_t, 1>::view_type |
| using | host_mirror_type = typename view_type::host_mirror_type |
| using | rank_list = std::vector<int> |
| using | bounds_list = std::vector<bound_type> |
| using | neighbor_list = std::array<rank_list, detail::countHypercubes(Dim) - 1> |
| using | neighbor_range_list = std::array<bounds_list, detail::countHypercubes(Dim) - 1> |
Public Member Functions | |
| FieldLayout (const mpi::Communicator &=MPI_COMM_WORLD) | |
| FieldLayout (mpi::Communicator, const NDIndex< Dim > &domain, std::array< bool, Dim > decomp, bool isAllPeriodic=false) | |
| virtual | ~FieldLayout ()=default |
| void | initialize (const NDIndex< Dim > &domain, std::array< bool, Dim > decomp, bool isAllPeriodic=false) |
| const NDIndex< Dim > & | getDomain () const |
| template<unsigned Dim2> | |
| bool | operator== (const FieldLayout< Dim2 > &x) const |
| bool | operator== (const FieldLayout< Dim > &x) const |
| bool | getDistribution (unsigned int d) const |
| std::array< bool, Dim > | isParallel () const |
| const NDIndex_t & | getLocalNDIndex () const |
| const NDIndex_t & | getLocalNDIndex (int rank) const |
| const host_mirror_type | getHostLocalDomains () const |
| const view_type | getDeviceLocalDomains () const |
| const neighbor_list & | getNeighbors () const |
| const neighbor_range_list & | getNeighborsSendRange () const |
| const neighbor_range_list & | getNeighborsRecvRange () const |
| void | findPeriodicNeighbors (const int nghost, const NDIndex< Dim > &localDomain, NDIndex< Dim > &grown, NDIndex< Dim > &neighborDomain, const int rank, std::map< unsigned int, int > &offsets, unsigned d0=0, unsigned codim=0) |
| void | findNeighbors (int nghost=1) |
| void | addNeighbors (const NDIndex_t &gnd, const NDIndex_t &nd, const NDIndex_t &ndNeighbor, const NDIndex_t &intersect, int nghost, int rank) |
| void | write (std::ostream &=std::cout) const |
| void | updateLayout (const std::vector< NDIndex_t > &domains) |
Static Public Member Functions | |
| static int | getMatchingIndex (int index) |
Public Attributes | |
| bool | isAllPeriodic_m |
| mpi::Communicator | comm |
Protected Member Functions | |
| void | calcWidths () |
Protected Attributes | |
| NDIndex_t | gDomain_m |
| Global domain. | |
| view_type | dLocalDomains_m |
| Local domains (device view). | |
| host_mirror_type | hLocalDomains_m |
| Local domains (host mirror view). | |
| std::array< bool, Dim > | isParallelDim_m |
| unsigned int | minWidth_m [Dim] |
Private Member Functions | |
| bound_type | getBounds (const NDIndex_t &nd1, const NDIndex_t &nd2, const NDIndex_t &offset, int nghost) |
| int | getPeriodicOffset (const NDIndex_t &nd, const unsigned int d, const int k) |
Private Attributes | |
| neighbor_list | neighbors_m |
| neighbor_range_list | neighborsSendRange_m |
| neighbor_range_list | neighborsRecvRange_m |
Definition at line 166 of file FieldLayout.h.
| using ippl::FieldLayout< Dim >::bounds_list = std::vector<bound_type> |
Definition at line 192 of file FieldLayout.h.
| using ippl::FieldLayout< Dim >::host_mirror_type = typename view_type::host_mirror_type |
Definition at line 170 of file FieldLayout.h.
| using ippl::FieldLayout< Dim >::NDIndex_t = NDIndex<Dim> |
Definition at line 168 of file FieldLayout.h.
| using ippl::FieldLayout< Dim >::neighbor_list = std::array<rank_list, detail::countHypercubes(Dim) - 1> |
Definition at line 194 of file FieldLayout.h.
| using ippl::FieldLayout< Dim >::neighbor_range_list = std::array<bounds_list, detail::countHypercubes(Dim) - 1> |
Definition at line 195 of file FieldLayout.h.
| using ippl::FieldLayout< Dim >::rank_list = std::vector<int> |
Definition at line 191 of file FieldLayout.h.
| using ippl::FieldLayout< Dim >::view_type = typename detail::ViewType<NDIndex_t, 1>::view_type |
Definition at line 169 of file FieldLayout.h.
| ippl::FieldLayout< Dim >::FieldLayout | ( | const mpi::Communicator & | communicator = MPI_COMM_WORLD | ) |
Default constructor, which should only be used if you are going to call 'initialize' soon after (before using in any context)
Definition at line 37 of file FieldLayout.hpp.
References comm, Dim, dLocalDomains_m, hLocalDomains_m, and minWidth_m.
Referenced by FieldLayout(), operator==(), operator==(), ippl::SubFieldLayout< Dim >::operator==(), ippl::SubFieldLayout< Dim >::SubFieldLayout(), ippl::SubFieldLayout< Dim >::SubFieldLayout(), and ippl::SubFieldLayout< Dim >::SubFieldLayout().
| ippl::FieldLayout< Dim >::FieldLayout | ( | mpi::Communicator | communicator, |
| const NDIndex< Dim > & | domain, | ||
| std::array< bool, Dim > | decomp, | ||
| bool | isAllPeriodic = false ) |
Definition at line 47 of file FieldLayout.hpp.
References FieldLayout(), initialize(), and isParallel().
|
virtualdefault |
| void ippl::FieldLayout< Dim >::addNeighbors | ( | const NDIndex_t & | gnd, |
| const NDIndex_t & | nd, | ||
| const NDIndex_t & | ndNeighbor, | ||
| const NDIndex_t & | intersect, | ||
| int | nghost, | ||
| int | rank ) |
Adds a neighbor to the neighbor list
| gnd | the local domain, including ghost cells |
| nd | the local domain |
| ndNeighbor | the neighbor rank's domain |
| intersect | the intersection of the domains |
| nghost | number of ghost cells |
| rank | the neighbor's rank |
Definition at line 275 of file FieldLayout.hpp.
References getBounds().
|
protected |
Definition at line 172 of file FieldLayout.hpp.
References Dim, gDomain_m, hLocalDomains_m, ippl::NDIndex< Dim >::length(), and minWidth_m.
Referenced by initialize(), ippl::SubFieldLayout< Dim >::initialize(), and updateLayout().
| void ippl::FieldLayout< Dim >::findNeighbors | ( | int | nghost = 1 | ) |
Finds all neighboring ranks based on the field layout
| nghost | number of ghost cells (default 1) |
Definition at line 228 of file FieldLayout.hpp.
References comm, ippl::detail::countHypercubes(), Dim, IpplTimings::getTimer(), hLocalDomains_m, neighbors_m, neighborsRecvRange_m, neighborsSendRange_m, and IpplTimings::startTimer().
Referenced by initialize(), ippl::SubFieldLayout< Dim >::initialize(), and updateLayout().
| void ippl::FieldLayout< Dim >::findPeriodicNeighbors | ( | const int | nghost, |
| const NDIndex< Dim > & | localDomain, | ||
| NDIndex< Dim > & | grown, | ||
| NDIndex< Dim > & | neighborDomain, | ||
| const int | rank, | ||
| std::map< unsigned int, int > & | offsets, | ||
| unsigned | d0 = 0, | ||
| unsigned | codim = 0 ) |
Recursively finds neighbor ranks for layouts with all periodic boundary conditions
| nghost | number of ghost cells |
| localDomain | the rank's local domain |
| grown | the local domain, grown by the number of ghost cells |
| neighborDomain | a candidate neighbor rank's domain |
| rank | the candidate neighbor's rank |
| offsets | a dictionary containing offsets along different dimensions |
| d0 | the dimension from which to start checking (default 0) |
| codim | the codimension of overlapping regions to check (default 0) |
Definition at line 190 of file FieldLayout.hpp.
References Dim, and getPeriodicOffset().
|
private |
Obtain the bounds to send / receive. The second domain, i.e., nd2, is grown by nghost cells in each dimension in order to figure out the intersecting cells.
| nd1 | either remote or owned domain |
| nd2 | either remote or owned domain |
| offset | to map global to local grid point |
| nghost | number of ghost cells per dimension |
Definition at line 305 of file FieldLayout.hpp.
References ippl::NDIndex< Dim >::grow().
Referenced by addNeighbors().
| const FieldLayout< Dim >::view_type ippl::FieldLayout< Dim >::getDeviceLocalDomains | ( | ) | const |
Definition at line 135 of file FieldLayout.hpp.
References dLocalDomains_m.
|
inline |
Definition at line 252 of file FieldLayout.h.
References gDomain_m, and minWidth_m.
|
inline |
Definition at line 219 of file FieldLayout.h.
References gDomain_m.
Referenced by ippl::detail::HaloCells< T, Dim, ViewArgs >::applyPeriodicSerialDim(), ippl::OrthogonalRecursiveBisection< Field, Tp >::binaryRepartition(), ippl::detail::RegionLayout< T, Dim, Mesh, Properties >::changeDomain(), ippl::detail::HaloCells< T, Dim, ViewArgs >::exchangeBoundaries(), ippl::BareField< T, Dim, ViewArgs... >::getDomain(), ippl::BareField< T, Dim, ViewArgs... >::getIndex(), ippl::FFTPeriodicPoissonSolver< FieldLHS, FieldRHS >::initialize(), operator==(), operator==(), ippl::SubFieldLayout< Dim >::operator==(), and ippl::SubFieldLayout< Dim >::operator==().
| const FieldLayout< Dim >::host_mirror_type ippl::FieldLayout< Dim >::getHostLocalDomains | ( | ) | const |
Definition at line 129 of file FieldLayout.hpp.
References hLocalDomains_m.
Referenced by ippl::ExtrapolateFace< Field >::apply(), ippl::detail::HaloCells< T, Dim, ViewArgs >::applyPeriodicSerialDim(), ChargedParticles< PLayout, T, Dim >::dumpLocalDomains(), ippl::detail::HaloCells< T, Dim, ViewArgs >::exchangeBoundaries(), ippl::detail::RegionLayout< T, Dim, Mesh, Properties >::fillRegions(), and ippl::PeriodicFace< Field >::findBCNeighbors().
| const FieldLayout< Dim >::NDIndex_t & ippl::FieldLayout< Dim >::getLocalNDIndex | ( | ) | const |
Definition at line 116 of file FieldLayout.hpp.
References comm, and hLocalDomains_m.
Referenced by ippl::assemble_rhs_from_particles(), ippl::detail::HaloCells< T, Dim, ViewArgs >::exchangeBoundaries(), ippl::FFTBase< Field, FFT, Backend, BufferType >::FFTBase(), ippl::LagrangeSpace< T, Dim, Order, ElementType, QuadratureType, FieldLHS, FieldRHS >::initializeElementIndices(), ippl::NedelecSpace< T, Dim, Order, ElementType, QuadratureType, FieldType >::initializeElementIndices(), ippl::interpolate_to_diracs(), main(), operator==(), ippl::SubFieldLayout< Dim >::operator==(), ippl::SubFieldLayout< Dim >::operator==(), and ippl::OrthogonalRecursiveBisection< Field, Tp >::scatterR().
| const FieldLayout< Dim >::NDIndex_t & ippl::FieldLayout< Dim >::getLocalNDIndex | ( | int | rank | ) | const |
Definition at line 121 of file FieldLayout.hpp.
References comm, hLocalDomains_m, and PAssert.
|
static |
Given the index of a hypercube, find the index of the opposite hypercube, i.e. the component with the same codimension belonging to a neighboring domain that touches the hypercube with the given index, as determined by the ternary encoding for hypercubes.
For neighbor communication, the opposite component is the one that receives sent data or sends us data to receive for a given component.
The matching index is given by swapping alls 1s for 0s and vice versa in the ternary encoding, while keeping the 2s unchanged. This can be understood from the fact that if the local component is on the upper boundary of the local domain, the neighbor component must be on the lower boundary of its local domain, and vice versa. The 2s are unchanged because both the local component and the neighbor component must be parallel to the same axes, otherwise their intersection would have lower or higher dimension than the components themselves.
| index | index of the known component |
Definition at line 22 of file FieldLayout.hpp.
References ippl::detail::countHypercubes(), and Dim.
Referenced by ippl::detail::HaloCells< T, Dim, ViewArgs >::exchangeBoundaries().
| const FieldLayout< Dim >::neighbor_list & ippl::FieldLayout< Dim >::getNeighbors | ( | ) | const |
Get a list of all the neighbors, arranged by ternary encoding of the hypercubes
Definition at line 140 of file FieldLayout.hpp.
References neighbors_m.
Referenced by ippl::detail::HaloCells< T, Dim, ViewArgs >::exchangeBoundaries().
| const FieldLayout< Dim >::neighbor_range_list & ippl::FieldLayout< Dim >::getNeighborsRecvRange | ( | ) | const |
Get the domain ranges corresponding to regions that should be received from neighbor ranks
Definition at line 151 of file FieldLayout.hpp.
References neighborsRecvRange_m.
Referenced by ippl::detail::HaloCells< T, Dim, ViewArgs >::exchangeBoundaries().
| const FieldLayout< Dim >::neighbor_range_list & ippl::FieldLayout< Dim >::getNeighborsSendRange | ( | ) | const |
Get the domain ranges corresponding to regions that should be sent to neighbor ranks
Definition at line 145 of file FieldLayout.hpp.
References neighborsSendRange_m.
Referenced by ippl::detail::HaloCells< T, Dim, ViewArgs >::exchangeBoundaries().
|
private |
Definition at line 327 of file FieldLayout.hpp.
References gDomain_m, and ippl::max.
Referenced by findPeriodicNeighbors().
| void ippl::FieldLayout< Dim >::initialize | ( | const NDIndex< Dim > & | domain, |
| std::array< bool, Dim > | decomp, | ||
| bool | isAllPeriodic = false ) |
Definition at line 71 of file FieldLayout.hpp.
References calcWidths(), comm, Dim, dLocalDomains_m, findNeighbors(), gDomain_m, hLocalDomains_m, isAllPeriodic_m, isParallel(), isParallelDim_m, ippl::NDIndex< Dim >::length(), and ippl::detail::Partitioner< Dim >::split().
Referenced by FieldLayout(), ippl::SubFieldLayout< Dim >::initialize(), and ippl::SubFieldLayout< Dim >::initialize().
|
inline |
Definition at line 258 of file FieldLayout.h.
References isParallelDim_m.
Referenced by FieldLayout(), ippl::FFTPeriodicPoissonSolver< FieldLHS, FieldRHS >::initialize(), initialize(), ippl::SubFieldLayout< Dim >::initialize(), ippl::SubFieldLayout< Dim >::initialize(), ippl::SubFieldLayout< Dim >::SubFieldLayout(), and ippl::SubFieldLayout< Dim >::SubFieldLayout().
|
inline |
Definition at line 235 of file FieldLayout.h.
References comm, Dim, FieldLayout(), gDomain_m, getDomain(), getLocalNDIndex(), and hLocalDomains_m.
|
inline |
Definition at line 225 of file FieldLayout.h.
References FieldLayout(), gDomain_m, and getDomain().
| void ippl::FieldLayout< Dim >::updateLayout | ( | const std::vector< NDIndex_t > & | domains | ) |
Definition at line 54 of file FieldLayout.hpp.
References calcWidths(), dLocalDomains_m, findNeighbors(), and hLocalDomains_m.
Referenced by ippl::OrthogonalRecursiveBisection< Field, Tp >::binaryRepartition().
| void ippl::FieldLayout< Dim >::write | ( | std::ostream & | out = std::cout | ) | const |
Definition at line 157 of file FieldLayout.hpp.
References comm, gDomain_m, and hLocalDomains_m.
Referenced by ippl::operator<<().
| mpi::Communicator ippl::FieldLayout< Dim >::comm |
Definition at line 353 of file FieldLayout.h.
Referenced by ippl::detail::HaloCells< T, Dim, ViewArgs >::applyPeriodicSerialDim(), ippl::OrthogonalRecursiveBisection< Field, Tp >::binaryRepartition(), ippl::detail::HaloCells< T, Dim, ViewArgs >::exchangeBoundaries(), FieldLayout(), findNeighbors(), ippl::BareField< T, Dim, ViewArgs... >::getCommunicator(), getLocalNDIndex(), getLocalNDIndex(), ippl::FFTPeriodicPoissonSolver< FieldLHS, FieldRHS >::initialize(), initialize(), ippl::SubFieldLayout< Dim >::initialize(), operator==(), ippl::SubFieldLayout< Dim >::operator==(), ippl::SubFieldLayout< Dim >::operator==(), and write().
|
protected |
Local domains (device view).
Definition at line 382 of file FieldLayout.h.
Referenced by FieldLayout(), getDeviceLocalDomains(), initialize(), ippl::SubFieldLayout< Dim >::initialize(), and updateLayout().
|
protected |
Global domain.
Definition at line 379 of file FieldLayout.h.
Referenced by calcWidths(), getDistribution(), getDomain(), getPeriodicOffset(), initialize(), ippl::SubFieldLayout< Dim >::initialize(), operator==(), operator==(), ippl::SubFieldLayout< Dim >::operator==(), and write().
|
protected |
Local domains (host mirror view).
Definition at line 385 of file FieldLayout.h.
Referenced by calcWidths(), FieldLayout(), findNeighbors(), getHostLocalDomains(), getLocalNDIndex(), getLocalNDIndex(), initialize(), ippl::SubFieldLayout< Dim >::initialize(), operator==(), ippl::SubFieldLayout< Dim >::operator==(), ippl::SubFieldLayout< Dim >::operator==(), updateLayout(), and write().
| bool ippl::FieldLayout< Dim >::isAllPeriodic_m |
Definition at line 351 of file FieldLayout.h.
Referenced by initialize().
|
protected |
Definition at line 387 of file FieldLayout.h.
Referenced by initialize(), and isParallel().
|
protected |
Definition at line 390 of file FieldLayout.h.
Referenced by calcWidths(), FieldLayout(), and getDistribution().
|
private |
Definition at line 371 of file FieldLayout.h.
Referenced by findNeighbors(), and getNeighbors().
|
private |
Definition at line 375 of file FieldLayout.h.
Referenced by findNeighbors(), and getNeighborsRecvRange().
|
private |
Definition at line 375 of file FieldLayout.h.
Referenced by findNeighbors(), and getNeighborsSendRange().