SUNphi  1.0
SUNphi::Partitioner< NDims, Coord, Idx > Class Template Reference

Partition a set of grids enforcing to obay to certain rules. More...

#include <Partitioner.hpp>

Public Types

using EnforceableRel = std::pair< const PartRel *, int >
 Type to host an enforcceable relation.
 

Public Member Functions

bool volIsBound (const SGrid *grid) const
 
template<typename G >
const SGridaddGrid (G &&grid, const char *name)
 Adds a grid to the list of grids to be partitioned.
 
template<typename GF , typename GC1 , typename GC2 >
const PartReladdPartitionRelation (GF &&father, GC1 &&child1, GC2 &&child2)
 Adds a partition relation. More...
 
auto getFathersToBeChecked (const SGrid *grid) const
 Gets the list of fathers to be checked. More...
 
auto getChildrenToBeChecked (const SGrid *grid) const
 Gets the list of children to be checked. More...
 
auto getGridChecker (const SGrid *grid) const
 Returns a function which check the validity of a grid and move to next instruction. More...
 
auto getVolUnsetter (const SGrid *grid)
 Returns a function which unset the volume.
 
template<typename F >
auto getFatherVolDeducer (const SGrid *grid, const SGrid *child1, const SGrid *child2, F &&nextInstruction)
 Returns a function which tries to set the volume deducing it from children. More...
 
template<typename F >
auto getChildVolDeducer (const SGrid *grid, const SGrid *father, const SGrid *sister, F &&nextInstruction)
 Returns a function which tries to set the volume deducing it from father and sister. More...
 
auto listAllEnforceableRelations () const
 Returns a list of all enforceable relations.
 
Vector< const SGrid * > getAllFathersOf (const SGrid *grid) const
 Gets all fathers of a given grid. More...
 
Vector< std::pair< const SGrid *, const SGrid * > > getAllChildrenOf (const SGrid *grid) const
 Gets all children of a given grid. More...
 
Vector< const SGrid * > getAllGridsWithFixedOrUnfixedVol (const bool f) const
 List all grids of the partitioning with fixed or unfixed volume, according to the parameter. More...
 
Vector< const SGrid * > getAllGridsWithFixedVol () const
 List all grids of the partitioning with fixed volume.
 
Vector< const SGrid * > getAllGridsWithUnfixedVol () const
 List all grids of the partitioning with unfixed volume.
 
void printDot () const
 Print the partition relation in a Dot format. More...
 
template<typename C , typename F >
Instruction getConditionalExecuter (C &&checker, F &&fun)
 Return a conditional executer.
 
template<typename Fun >
Instruction getRelationEnforcer (const EnforceableRel &enfRel, Vector< ScopeDoer< Instruction >> &cleanup, Fun fun)
 Returns a function that enforce a given relation. More...
 
Instruction getVolumeLooper (const SGrid *g, const Instruction &fun, Vector< ScopeDoer< Instruction >> &cleanup)
 Returns a function which loops on all possible volume of g. More...
 
Instruction compile (const Instruction &fun, Vector< ScopeDoer< Instruction >> &cleanup)
 Returns the compiled partitioner. More...
 
Instruction compile (const Instruction &fun)
 Compile the partitioner. More...
 

Static Public Member Functions

static Vol greatestDivisorOfVolumes (const Vector< const SGrid * > &list)
 Return the greatest divisor of all the volumes. More...
 
static Vol leastCommonMultipleOfVolumes (const Vector< const SGrid * > &list)
 Return the least common multiple of all the volumes. More...
 

Private Types

typedef std::array< Coord, NDims > Coords
 
typedef std::array< Coord, 2 *NDims > Neigh
 
typedef Idx Vol
 
typedef Coord Side
 
typedef Coords Sides
 
using PartRel = PartitioningRelation< NDims, Coord, Idx >
 Short alias for a Partition relation.
 
using SGrid = ShadowGrid< NDims, Coord, Idx >
 Short alias of the ShadowGrid.
 
using Instruction = std::function< void(void)>
 Instruction to be exectuted.
 

Private Member Functions

template<typename G >
const SGridfindShadowOfGrid (G &&actualGrid) const
 Find the shadow of an actual grid. More...
 
void pretendToSetVol (const SGrid *grid, Vector< ScopeDoer< Instruction >> &cleanup)
 Pretend to set a volume for a grid. More...
 

Private Attributes

std::set< PartRelpartitionRelations
 List of relation to be satisfied between all the grid to be partitioned.
 
std::set< SGridgrids
 List of grids to be partitioned.
 

Detailed Description

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
class SUNphi::Partitioner< NDims, Coord, Idx >

Partition a set of grids enforcing to obay to certain rules.

Definition at line 392 of file Partitioner.hpp.

Member Typedef Documentation

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
typedef std::array<Coord,NDims> SUNphi::Partitioner< NDims, Coord, Idx >::Coords
private

Type to hold sizes, coordinate, etc

Definition at line 394 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
typedef std::array<Coord,2*NDims> SUNphi::Partitioner< NDims, Coord, Idx >::Neigh
private

Type to hold the neighbors

Definition at line 394 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
typedef Coord SUNphi::Partitioner< NDims, Coord, Idx >::Side
private

Type to hold side

Definition at line 394 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
typedef Coords SUNphi::Partitioner< NDims, Coord, Idx >::Sides
private

Type to hold sides

Definition at line 394 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
typedef Idx SUNphi::Partitioner< NDims, Coord, Idx >::Vol
private

Type to hold volume

Definition at line 394 of file Partitioner.hpp.

Member Function Documentation

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
template<typename GF , typename GC1 , typename GC2 >
const PartRel* SUNphi::Partitioner< NDims, Coord, Idx >::addPartitionRelation ( GF &&  father,
GC1 &&  child1,
GC2 &&  child2 
)
inline

Adds a partition relation.

Find father

Find child1

Find child2

Definition at line 476 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
Instruction SUNphi::Partitioner< NDims, Coord, Idx >::compile ( const Instruction fun,
Vector< ScopeDoer< Instruction >> &  cleanup 
)
inline

Returns the compiled partitioner.

List of all unfixed volume

List of enforceable relations

Parameters
funFunction to be executed at inner instruction
cleanupCollection of tasks to cleanup after compilation ends

Definition at line 955 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
Instruction SUNphi::Partitioner< NDims, Coord, Idx >::compile ( const Instruction fun)
inline

Compile the partitioner.

Contains all quantity to be cleaned after compilation

Definition at line 997 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
template<typename G >
const SGrid* SUNphi::Partitioner< NDims, Coord, Idx >::findShadowOfGrid ( G &&  actualGrid) const
inlineprivate

Find the shadow of an actual grid.

Result of research

Definition at line 416 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
Vector<std::pair<const SGrid*,const SGrid*> > SUNphi::Partitioner< NDims, Coord, Idx >::getAllChildrenOf ( const SGrid grid) const
inline

Gets all children of a given grid.

Result

Definition at line 726 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
Vector<const SGrid*> SUNphi::Partitioner< NDims, Coord, Idx >::getAllFathersOf ( const SGrid grid) const
inline

Gets all fathers of a given grid.

Returned list

Definition at line 710 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
Vector<const SGrid*> SUNphi::Partitioner< NDims, Coord, Idx >::getAllGridsWithFixedOrUnfixedVol ( const bool  f) const
inline

List all grids of the partitioning with fixed or unfixed volume, according to the parameter.

List to be returned

Definition at line 741 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
auto SUNphi::Partitioner< NDims, Coord, Idx >::getChildrenToBeChecked ( const SGrid grid) const
inline

Gets the list of children to be checked.

Returned list

Definition at line 521 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
template<typename F >
auto SUNphi::Partitioner< NDims, Coord, Idx >::getChildVolDeducer ( const SGrid grid,
const SGrid father,
const SGrid sister,
F &&  nextInstruction 
)
inline

Returns a function which tries to set the volume deducing it from father and sister.

Deduced volume

Indent current scope

Definition at line 662 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
auto SUNphi::Partitioner< NDims, Coord, Idx >::getFathersToBeChecked ( const SGrid grid) const
inline

Gets the list of fathers to be checked.

Returned list

Definition at line 506 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
template<typename F >
auto SUNphi::Partitioner< NDims, Coord, Idx >::getFatherVolDeducer ( const SGrid grid,
const SGrid child1,
const SGrid child2,
F &&  nextInstruction 
)
inline

Returns a function which tries to set the volume deducing it from children.

Deduced volume

Indent current scope

Definition at line 634 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
auto SUNphi::Partitioner< NDims, Coord, Idx >::getGridChecker ( const SGrid grid) const
inline

Returns a function which check the validity of a grid and move to next instruction.

Indent current scope

Indent current scope

Current grid volume

Keep track if constraints are satisfied

Looping on fathers

Volume of father

Looping on children

Volume of child

Definition at line 541 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
template<typename Fun >
Instruction SUNphi::Partitioner< NDims, Coord, Idx >::getRelationEnforcer ( const EnforceableRel enfRel,
Vector< ScopeDoer< Instruction >> &  cleanup,
Fun  fun 
)
inline

Returns a function that enforce a given relation.

Relation to be enforced

Index of relative to enforce

Checker to be created before proceeding in the compilation

Next instruction

Definition at line 840 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
Instruction SUNphi::Partitioner< NDims, Coord, Idx >::getVolumeLooper ( const SGrid g,
const Instruction fun,
Vector< ScopeDoer< Instruction >> &  cleanup 
)
inline

Returns a function which loops on all possible volume of g.

Indent current scope

Precompute the list of fathers to check

Precompute the list of children to check

Next instruction

Returned instruction

Indent current scope

Greatest divisor of all fathers'volume

Least common multiple of all children's volume

Volume to be looped is the quotient between fathers and children

The volume to be assigned is the product with the children

Indent current scope

Definition at line 873 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
static Vol SUNphi::Partitioner< NDims, Coord, Idx >::greatestDivisorOfVolumes ( const Vector< const SGrid * > &  list)
inlinestatic

Return the greatest divisor of all the volumes.

Greatest common divisor to be returned

Definition at line 794 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
static Vol SUNphi::Partitioner< NDims, Coord, Idx >::leastCommonMultipleOfVolumes ( const Vector< const SGrid * > &  list)
inlinestatic

Return the least common multiple of all the volumes.

Least common multiple to be returned

Definition at line 809 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
void SUNphi::Partitioner< NDims, Coord, Idx >::pretendToSetVol ( const SGrid grid,
Vector< ScopeDoer< Instruction >> &  cleanup 
)
inlineprivate

Pretend to set a volume for a grid.

Dummy volue to set

Definition at line 432 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
void SUNphi::Partitioner< NDims, Coord, Idx >::printDot ( ) const
inline

Print the partition relation in a Dot format.

Labels of all partitions

Label of the father node

Definition at line 772 of file Partitioner.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t>
bool SUNphi::Partitioner< NDims, Coord, Idx >::volIsBound ( const SGrid grid) const
inline

Determines if the volume has an upper bound coming from direct fathers or if the volume is set

Definition at line 447 of file Partitioner.hpp.


The documentation for this class was generated from the following file: