OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
DistParMetisDistribution< dim, T > Class Template Reference

Detailed Description

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

Definition at line 17 of file DistParMetisDistribution.hpp.

Public Member Functions

 DistParMetisDistribution (Vcluster &v_cl)
 
void createCartGraph (grid_sm< dim, void > &grid, Box< dim, T > dom)
 Initialize the distribution graph. More...
 
DistGraph_CSR< nm_v, nm_e > & getGraph ()
 Get the current graph (main) More...
 
void decompose ()
 Create first decomposition, it divides the graph in slices and give each slice to a processor. More...
 
void refine ()
 Refine current decomposition. More...
 
float getUnbalance ()
 Compute the unbalance value. 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 getVertexWeight (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...
 
size_t getTotalMovedV ()
 return number of moved vertices in all iterations so far More...
 
size_t getMaxMovedV ()
 return number of moved vertices in all iterations so far 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 current graph and save it to file. More...
 
const DistParMetisDistribution
< dim, T > & 
operator= (const DistParMetisDistribution< dim, T > &dist)
 copy operator More...
 
const DistParMetisDistribution
< dim, T > & 
operator= (DistParMetisDistribution< dim, T > &&dist)
 copy operator More...
 

Static Private Member Functions

static void * message_receive (size_t msg_i, size_t total_msg, size_t total_p, size_t i, size_t ri, void *ptr)
 Callback of the sendrecv to set the size of the array received. 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
 
DistGraph_CSR< nm_v, nm_eg
 Processor sub-sub-domain graph.
 
DistParmetis< DistGraph_CSR
< nm_v, nm_e > > 
parmetis_graph
 Convert the graph to parmetis format.
 
openfpm::vector< idx_t > vtxdist
 Init vtxdist needed for Parmetis.
 
openfpm::vector
< openfpm::vector< idx_t > > 
partitions
 partitions
 
openfpm::vector
< openfpm::vector< size_t > > 
v_per_proc
 Init data structure to keep trace of new vertices distribution in processors (needed to update main graph)
 
size_t g_moved = 0
 Number of moved vertices in all iterations.
 
size_t m_moved = 0
 Max number of moved vertices in all iterations.
 
bool verticesGotWeights = false
 Flag to check if weights are used on vertices.
 

Constructor & Destructor Documentation

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

Constructor for the ParMetis class

Parameters
v_clVcluster to use as communication object in this class

Definition at line 76 of file DistParMetisDistribution.hpp.

Member Function Documentation

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

Initialize the distribution graph.

/param grid Grid /param dom Domain

Set grid and domain

Create sub graph

Definition at line 87 of file DistParMetisDistribution.hpp.

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

Create first decomposition, it divides the graph in slices and give each slice to a processor.

Init sub graph in parmetis format

Decompose

Get result partition for this processors

Definition at line 115 of file DistParMetisDistribution.hpp.

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

Get the current graph (main)

Definition at line 107 of file DistParMetisDistribution.hpp.

template<unsigned int dim, typename T>
size_t DistParMetisDistribution< dim, T >::getMaxMovedV ( )
inline

return number of moved vertices in all iterations so far

Returns
number of moved vertices

Definition at line 278 of file DistParMetisDistribution.hpp.

template<unsigned int dim, typename T>
size_t DistParMetisDistribution< 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
Returns
the number of neighborhood sub-sub-domain

Definition at line 326 of file DistParMetisDistribution.hpp.

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

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

Returns
number od sub-sub-domain

Definition at line 314 of file DistParMetisDistribution.hpp.

template<unsigned int dim, typename T>
size_t DistParMetisDistribution< 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 252 of file DistParMetisDistribution.hpp.

template<unsigned int dim, typename T>
void DistParMetisDistribution< 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 190 of file DistParMetisDistribution.hpp.

template<unsigned int dim, typename T>
size_t DistParMetisDistribution< dim, T >::getTotalMovedV ( )
inline

return number of moved vertices in all iterations so far

Returns
number of moved vertices

Definition at line 268 of file DistParMetisDistribution.hpp.

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

Compute the unbalance value.

Returns
the unbalance value

Definition at line 163 of file DistParMetisDistribution.hpp.

template<unsigned int dim, typename T>
size_t DistParMetisDistribution< dim, T >::getVertexWeight ( size_t  id)
inline

function that get the weight of the vertex

Parameters
idvertex id
Returns
the weight of the vertex

Definition at line 238 of file DistParMetisDistribution.hpp.

template<unsigned int dim, typename T>
static void* DistParMetisDistribution< dim, T >::message_receive ( size_t  msg_i,
size_t  total_msg,
size_t  total_p,
size_t  i,
size_t  ri,
void *  ptr 
)
inlinestaticprivate

Callback of the sendrecv to set the size of the array received.

Parameters
msg_iIndex of the message
total_msgTotal numeber of messages
total_pTotal number of processors to comunicate with
iProcessor id
riRequest id
ptrVoid pointer parameter for additional data to pass to the call-back

Definition at line 61 of file DistParMetisDistribution.hpp.

template<unsigned int dim, typename T>
const DistParMetisDistribution<dim, T>& DistParMetisDistribution< dim, T >::operator= ( const DistParMetisDistribution< dim, T > &  dist)
inline

copy operator

Parameters
distobject to copy
Returns
itself

Definition at line 352 of file DistParMetisDistribution.hpp.

template<unsigned int dim, typename T>
const DistParMetisDistribution<dim, T>& DistParMetisDistribution< dim, T >::operator= ( DistParMetisDistribution< dim, T > &&  dist)
inline

copy operator

Parameters
distobject to copy
Returns
itself

Definition at line 373 of file DistParMetisDistribution.hpp.

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

Refine current decomposition.

It makes a refinement of the current decomposition using Parmetis function RefineKWay After that it also does the remapping of the graph

Reset parmetis graph and reconstruct it

Refine

Get result partition for this processors

Definition at line 140 of file DistParMetisDistribution.hpp.

template<unsigned int dim, typename T>
void DistParMetisDistribution< 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 304 of file DistParMetisDistribution.hpp.

template<unsigned int dim, typename T>
void DistParMetisDistribution< 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 209 of file DistParMetisDistribution.hpp.

template<unsigned int dim, typename T>
void DistParMetisDistribution< 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 288 of file DistParMetisDistribution.hpp.

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

Checks if weights are used on the vertices.

Returns
true if weights are used in the decomposition

Definition at line 226 of file DistParMetisDistribution.hpp.

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

Print current graph and save it to file.

Parameters
filefile

Definition at line 339 of file DistParMetisDistribution.hpp.


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