OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
SpaceDistribution< dim, T > Class Template Reference

Class that distribute sub-sub-domains across processors using an hilbert curve to divide the space. More...

Detailed Description

template<unsigned int dim, typename T>
class SpaceDistribution< dim, T >

Class that distribute sub-sub-domains across processors using an hilbert curve to divide the space.

Initialize a Cartesian graph and decompose

// Physical domain
Box<3, float> box( { 0.0, 0.0, 0.0 }, { 10.0, 10.0, 10.0 });
// Grid info
grid_sm<3, void> info( { 17, 17, 17 });
// Initialize Cart graph and decompose
space_dist.createCartGraph(info,box);
// first decomposition
space_dist.decompose();

Definition at line 24 of file SpaceDistribution.hpp.

#include <SpaceDistribution.hpp>

Public Member Functions

 SpaceDistribution (Vcluster<> &v_cl)
 
 SpaceDistribution (const ParMetisDistribution< dim, T > &pm)
 
 SpaceDistribution (SpaceDistribution< dim, T > &&pm)
 
void createCartGraph (grid_sm< dim, void > &grid, Box< dim, T > dom)
 Create the Cartesian graph. More...
 
Graph_CSR< nm_v< dim >, nm_e > & getGraph ()
 Get the current graph (main) More...
 
void decompose ()
 Create the decomposition. More...
 
void refine ()
 Refine current decomposition. More...
 
float getUnbalance ()
 Compute the unbalance of the processor compared to the optimal balance. More...
 
void getSubSubDomainPosition (size_t id, T(&pos)[dim])
 function that return the position of the vertex in the space More...
 
void setComputationCost (size_t id, size_t weight)
 Function that set the weight of the vertex. More...
 
bool weightsAreUsed ()
 Checks if weights are used on the vertices. More...
 
size_t getSubSubDomainComputationCost (size_t id)
 function that get the weight of the vertex More...
 
size_t getProcessorLoad ()
 Compute the processor load counting the total weights of its vertices. More...
 
void setMigrationCost (size_t id, size_t migration)
 Set migration cost of the vertex id. More...
 
void setCommunicationCost (size_t v_id, size_t e, size_t communication)
 Set communication cost of the edge id. More...
 
size_t getNSubSubDomains ()
 Returns total number of sub-sub-domains in the distribution graph. More...
 
size_t getNSubSubDomainNeighbors (size_t id)
 Returns total number of neighbors of the sub-sub-domain id. More...
 
void write (const std::string &file)
 Print the current distribution and save it to VTK file. More...
 
const SpaceDistribution< dim, T > & operator= (const SpaceDistribution< dim, T > &dist)
 
const SpaceDistribution< dim, T > & operator= (SpaceDistribution< dim, T > &&dist)
 
size_t get_ndec ()
 It return the decomposition id. More...
 

Private Attributes

Vclusterv_cl
 Vcluster.
 
grid_sm< dim, void > gr
 Structure that store the cartesian grid information.
 
Box< dim, T > domain
 rectangular domain to decompose
 
Graph_CSR< nm_v< dim >, nm_egp
 Global sub-sub-domain graph.
 

Constructor & Destructor Documentation

◆ SpaceDistribution() [1/3]

template<unsigned int dim, typename T>
SpaceDistribution< dim, T >::SpaceDistribution ( Vcluster<> &  v_cl)
inline

Constructor

Parameters
v_clVcluster to use as communication object in this class

Definition at line 45 of file SpaceDistribution.hpp.

◆ SpaceDistribution() [2/3]

template<unsigned int dim, typename T>
SpaceDistribution< dim, T >::SpaceDistribution ( const ParMetisDistribution< dim, T > &  pm)
inline

Copy constructor

Parameters
pmDistribution to copy

Definition at line 55 of file SpaceDistribution.hpp.

◆ SpaceDistribution() [3/3]

template<unsigned int dim, typename T>
SpaceDistribution< dim, T >::SpaceDistribution ( SpaceDistribution< dim, T > &&  pm)
inline

Copy constructor

Parameters
pmDistribution to copy

Definition at line 66 of file SpaceDistribution.hpp.

Member Function Documentation

◆ createCartGraph()

template<unsigned int dim, typename T>
void SpaceDistribution< dim, T >::createCartGraph ( grid_sm< dim, void > &  grid,
Box< dim, T >  dom 
)
inline

Create the Cartesian graph.

Parameters
gridinfo
domdomain

Definition at line 77 of file SpaceDistribution.hpp.

◆ decompose()

template<unsigned int dim, typename T>
void SpaceDistribution< dim, T >::decompose ( )
inline

Create the decomposition.

Definition at line 114 of file SpaceDistribution.hpp.

◆ get_ndec()

template<unsigned int dim, typename T>
size_t SpaceDistribution< dim, T >::get_ndec ( )
inline

It return the decomposition id.

It just return 0

Returns
0

Definition at line 390 of file SpaceDistribution.hpp.

◆ getGraph()

template<unsigned int dim, typename T>
Graph_CSR<nm_v<dim>, nm_e>& SpaceDistribution< dim, T >::getGraph ( )
inline

Get the current graph (main)

Definition at line 106 of file SpaceDistribution.hpp.

◆ getNSubSubDomainNeighbors()

template<unsigned int dim, typename T>
size_t SpaceDistribution< dim, T >::getNSubSubDomainNeighbors ( size_t  id)
inline

Returns total number of neighbors of the sub-sub-domain id.

Parameters
idid of the sub-sub-domain

Definition at line 348 of file SpaceDistribution.hpp.

◆ getNSubSubDomains()

template<unsigned int dim, typename T>
size_t SpaceDistribution< dim, T >::getNSubSubDomains ( )
inline

Returns total number of sub-sub-domains in the distribution graph.

Returns
number of sub-sub-domain

Definition at line 339 of file SpaceDistribution.hpp.

◆ getProcessorLoad()

template<unsigned int dim, typename T>
size_t SpaceDistribution< dim, T >::getProcessorLoad ( )
inline

Compute the processor load counting the total weights of its vertices.

Returns
the computational load of the processor graph

Definition at line 298 of file SpaceDistribution.hpp.

◆ getSubSubDomainComputationCost()

template<unsigned int dim, typename T>
size_t SpaceDistribution< dim, T >::getSubSubDomainComputationCost ( size_t  id)
inline

function that get the weight of the vertex

Parameters
idvertex id
Returns
the weight of the vertex

Definition at line 289 of file SpaceDistribution.hpp.

◆ getSubSubDomainPosition()

template<unsigned int dim, typename T>
void SpaceDistribution< dim, T >::getSubSubDomainPosition ( size_t  id,
T(&)  pos[dim] 
)
inline

function that return the position of the vertex in the space

Parameters
idvertex id
posvector that will contain x, y, z

Definition at line 248 of file SpaceDistribution.hpp.

◆ getUnbalance()

template<unsigned int dim, typename T>
float SpaceDistribution< dim, T >::getUnbalance ( )
inline

Compute the unbalance of the processor compared to the optimal balance.

Returns
the unbalance from the optimal one 0.01 mean 1%

Definition at line 237 of file SpaceDistribution.hpp.

◆ refine()

template<unsigned int dim, typename T>
void SpaceDistribution< dim, T >::refine ( )
inline

Refine current decomposition.

Has no effect in this case

Definition at line 228 of file SpaceDistribution.hpp.

◆ setCommunicationCost()

template<unsigned int dim, typename T>
void SpaceDistribution< dim, T >::setCommunicationCost ( size_t  v_id,
size_t  e,
size_t  communication 
)
inline

Set communication cost of the edge id.

Parameters
v_idId of the source vertex of the edge
ei child of the vertex
communicationCommunication value

Definition at line 330 of file SpaceDistribution.hpp.

◆ setComputationCost()

template<unsigned int dim, typename T>
void SpaceDistribution< dim, T >::setComputationCost ( size_t  id,
size_t  weight 
)
inline

Function that set the weight of the vertex.

Parameters
idvertex id
weightto give to the vertex

Definition at line 268 of file SpaceDistribution.hpp.

◆ setMigrationCost()

template<unsigned int dim, typename T>
void SpaceDistribution< dim, T >::setMigrationCost ( size_t  id,
size_t  migration 
)
inline

Set migration cost of the vertex id.

Parameters
idof the vertex to update
migrationcost of the migration

Definition at line 320 of file SpaceDistribution.hpp.

◆ weightsAreUsed()

template<unsigned int dim, typename T>
bool SpaceDistribution< dim, T >::weightsAreUsed ( )
inline

Checks if weights are used on the vertices.

Returns
true if weights are used in the decomposition

Definition at line 277 of file SpaceDistribution.hpp.

◆ write()

template<unsigned int dim, typename T>
void SpaceDistribution< dim, T >::write ( const std::string &  file)
inline

Print the current distribution and save it to VTK file.

Parameters
filefilename

Definition at line 358 of file SpaceDistribution.hpp.


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