SUNphi
1.0
|
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 SGrid * | addGrid (G &&grid, const char *name) |
Adds a grid to the list of grids to be partitioned. | |
template<typename GF , typename GC1 , typename GC2 > | |
const PartRel * | addPartitionRelation (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 SGrid * | findShadowOfGrid (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< PartRel > | partitionRelations |
List of relation to be satisfied between all the grid to be partitioned. | |
std::set< SGrid > | grids |
List of grids to be partitioned. | |
Partition a set of grids enforcing to obay to certain rules.
Definition at line 392 of file Partitioner.hpp.
|
private |
Type to hold sizes, coordinate, etc
Definition at line 394 of file Partitioner.hpp.
|
private |
Type to hold the neighbors
Definition at line 394 of file Partitioner.hpp.
|
private |
Type to hold side
Definition at line 394 of file Partitioner.hpp.
|
private |
Type to hold sides
Definition at line 394 of file Partitioner.hpp.
|
private |
Type to hold volume
Definition at line 394 of file Partitioner.hpp.
|
inline |
Adds a partition relation.
Find father
Find child1
Find child2
Definition at line 476 of file Partitioner.hpp.
|
inline |
Returns the compiled partitioner.
List of all unfixed volume
List of enforceable relations
fun | Function to be executed at inner instruction |
cleanup | Collection of tasks to cleanup after compilation ends |
Definition at line 955 of file Partitioner.hpp.
|
inline |
Compile the partitioner.
Contains all quantity to be cleaned after compilation
Definition at line 997 of file Partitioner.hpp.
|
inlineprivate |
Find the shadow of an actual grid.
Result of research
Definition at line 416 of file Partitioner.hpp.
|
inline |
|
inline |
|
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.
|
inline |
Gets the list of children to be checked.
Returned list
Definition at line 521 of file Partitioner.hpp.
|
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.
|
inline |
Gets the list of fathers to be checked.
Returned list
Definition at line 506 of file Partitioner.hpp.
|
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.
|
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.
|
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.
|
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.
|
inlinestatic |
Return the greatest divisor of all the volumes.
Greatest common divisor to be returned
Definition at line 794 of file Partitioner.hpp.
|
inlinestatic |
Return the least common multiple of all the volumes.
Least common multiple to be returned
Definition at line 809 of file Partitioner.hpp.
|
inlineprivate |
Pretend to set a volume for a grid.
Dummy volue to set
Definition at line 432 of file Partitioner.hpp.
|
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.
|
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.