hp2FEM  0.1
Public Member Functions | Public Attributes | Protected Member Functions
PartitionData Class Reference

Stores informations about the partition. More...

#include <PartitionData.h>

Collaboration diagram for PartitionData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PartitionData ()
 Constructor to partition informations.
void Partitioner (Model &GlobalModel)
 Performs the partitioning through the metis algorithm.
void Partitioner (long *ElemPartitions, PartitionData &ParData)
 Constructor.
PartitionData operator= (PartitionData &Instance)
 Copy constructor to partition informations.
void Print (FILE *File, char *Message=(char *)"")
 Prints informations about finite element mesh for each partition.
 ~PartitionData ()
 Destructor to partition informations.
void Free ()
 Releases the physical memory deallocate for the PartitionData class.

Public Attributes

long ID
 Id of the partition.
int MinimumID
 the minimum ID of all partitions.
BuiltInArray< bool > PartitionsToBePerformed
 Indicates which partitions will be perfomed.
OneIndexTable< long > AdjacentsInfo
 Stores informations about the adjacents.
BuiltInArray< long > LocalElements
 Local elements of the partition.
BuiltInArray< long > GlobalElementsMap
 This array is used to map global to local elements of the partition.
OneIndexTable< long > LocalIncidences
 Local incidences for a partition.
BuiltInArray< long > LocalToGlobalIncidencesMap
 This array is used to map local to global incidences of the partition.
OneIndexTable< long > LocalIncidForNeighbors
 Store the local incidence in the corresponding order to be received from each neighbor ID.
BuiltInArray< long > BoundaryElements
 Boundary elements of the partition ID.
OneIndexTable< long > BoundaryElementsInfo
 Information about the boundary elements of the partition ID.
OneIndexTable< long > BoundaryIncidences
 Boundary incidences of the Partition ID.
BuiltInArray< long > InternalElements
 Internal elements of the partition ID.
OneIndexTable< long > InternalIncidences
 Internal incidences for a partition ID.
BuiltInArray< long > OverlappingElements
 The overlapping elements were the adjacents elements of this partition ID.
OneIndexTable< long > OverlappingElemIncidences
 Stores the shared local incidences beween the boundary elements and its adjacents.
OneIndexTable< long > OverlappingElemTopoIndices
 Stores the element topological indices of the boundary elements that were shared with boundary element adjacents.
BuiltInArray< long > NeighborsPartitions
 The neighbors partitions.
BuiltInArray< long > TotalNumVertices
 The total number of vertices per partition.
BuiltInArray< long > PartitionsBoundIncidStartSize
 This table stores for each adjacent partition the begin boundary incidence and the offset (the number of shared boundary incidences).
unsigned long NumAdjPartitions
 Number of adjacents partitions.
unsigned long NumElements
 Number of local elements in the partition ID.
unsigned long NumIncidences
 Stores the number of local incidences in the partition ID.
unsigned long NumBoundaryElements
 Number of boundary elements in the partition ID.
unsigned long NumInternalElements
 Number of internal elements in the partition ID.
unsigned long NumBoundaryIncidences
 The number of boundary incidences in the partition ID.
unsigned long NumInternalIncidences
 The number of internal incidences in the partition ID.

Protected Member Functions

void BuildPartitionElements (int Rank, int NumGlobalElems, BuiltInArray< int > &xadj, BuiltInArray< int > &adjncy, BuiltInArray< int > &ewgt, BuiltInArray< int > &partition, bool &WithOverlapping)
 Initializes the partition data.
int BuildPartitionIncidences_StoreSharedLocalOrder (Model &GlobalModel, bool &WithOverlapping, struct LocalVariablesSize &VariablesSize)
 Constructs information about the incidences numbering for a partition.
int BuildPartitionIncidences_StoreSharedGlobalOrder (Model &GlobalModel)
 Constructs information about the incidences numbering for a partition.
int BuildPartitionIncidencesClockwise (Model &GlobalModel)
 Constructs information about the incidences numbering for a partition.
int BuildOverlappingPartitionIncidences (Model &GlobalModel, bool &WithOverlapping, struct LocalVariablesSize &VariablesSize)
 Constructs information about the element adjacents of this partition ID.
int BuildOverlappingElementsIncidences (Mesh &SolMesh, BuiltInArray< long > &GlobalToLocalMap, struct LocalVariablesSize &VariablesSize)
 Constructs information about the element adjacents of this partition ID.
void NumberingBoundaryIncidenceClockWise (ElementElementTable &ElemElemTable, Mesh &SolMesh, BuiltInArray< long > &GlobalIncidMapTmp, unsigned long FirstBoundaryElem, unsigned long FirstBoundaryElemInd, unsigned long FirstBoundaryEdge, unsigned long &NextBoundaryEdge, unsigned long &NextBoundary, unsigned long &LastBoundaryIncid)
 Numbering boundaries incidences in opposite direction of the topological element edge numbering.
void BuildLocalIncidForNeighbors (OneIndexTable< long > &GlobalIncidForNeighbors, BuiltInArray< long > &GlobalToLocalMap)
 The partition ID gets the shared global incidences with is neighbors and converts to local incidence. After, stores for each partition neighbor an array with the shared local incidence.
void BuildLocalIncidForNeighbors_MessageExchange (OneIndexTable< long > &GlobalIncidForNeighbors, BuiltInArray< long > &GlobalToLocalMap)
 The partition ID gets the shared global incidences with is neighbors and converts to local incidence. After, stores for each partition neighbor an array with the shared local incidence.
void ReinitializesRankTags (int NumRanks, unsigned long NumNeighbors, BuiltInArray< bool > &CheckNeighbors, BuiltInArray< bool > &RanksTag, int &LastRank)
 Reinitializes the tag for each rank.
void SearchFirstPartitionToNumbering (ElementElementTable &ElemElemTable, int &FirstPartition, unsigned long &FirstBoundOut, unsigned long &FirstBoundIndOut, long &FirstEdgeOut)
 Searchs the first partition ID to start numbering the incidences. The first partition should be a boundary partitions. Furthermore, it'll calculate the first boundary element and its first edge to start the numbering incidence.
void SearchFirstBoundInInternalPartition (ElementElementTable &ElemElemTable, unsigned long &FirstBoundOut, unsigned long &FirstBoundIndOut, long &FirstEdgeOut)
 Searchs the first boundary element on the partition ID to start numbering the incidences.
void SearchFirstBoundInBoundPartition (ElementElementTable &ElemElemTable, unsigned long &FirstBoundOut, unsigned long &FirstBoundIndOut, long &FirstEdgeOut)
 Searchs the first boundary element on the partition ID to start numbering the incidences.
void SetInternalAndBoundaryElements (BuiltInArray< int > &xadj, BuiltInArray< int > &partition, bool &WithOverlapping)
 Stores the internal and informations about the boundaries elements.
void SetInternalAndBoundaryIncidences ()
 Sets the boundary and internal incidences using the local element incidences of the ID partition.
void SetBoundaryIncidences ()
 Sets the boundary incidences using the local element incidences of the ID partition.
void SetSizeLocalIncidences (FiniteElementGroup &Group)
 Set size of local element incidence.
long GetNextPartitionToBeNumbering (unsigned long BoundElem, unsigned long bound_elem_i, unsigned long curr_edge, ElementElementTable &ElemElemTable)
 Get Next Partition Boundary to be Numbering.
unsigned long GetNumberSharedVertices (unsigned long NumberVertA, long *ElemA_Incid, unsigned long NumberVertB, long *ElemB_Incid)
 Calculates and returns the number of shared vertices between differents elements.
unsigned long GetSharedGlobalIncidences (unsigned long NumberIncidA, long *ElemA_Incid, unsigned long NumberIncidB, long *ElemB_Incid, unsigned long &NumberSharedIncidence, long *ElemTopologicalIndA, long *SharedIncidences)
 Calculates and returns the number of shared global incidences between differents elements.
void SetMetisAlgorithmOptions (int *options)
 Settings the options for the METIS algorithms.

Detailed Description

Stores informations about the partition.


Member Function Documentation

void PartitionData::BuildLocalIncidForNeighbors ( OneIndexTable< long > &  GlobalIncidForNeighbors,
BuiltInArray< long > &  GlobalToLocalMap 
) [protected]

The partition ID gets the shared global incidences with is neighbors and converts to local incidence. After, stores for each partition neighbor an array with the shared local incidence.

Parameters:
[in]GlobalIncidForNeighbors- Stores the shared global incidences for each neighbor.
[in]GlobalToLocalMap- Stores the incidence local for each global incidence in this partition id.

****************************************************************************************************

void PartitionData::BuildLocalIncidForNeighbors_MessageExchange ( OneIndexTable< long > &  GlobalIncidForNeighbors,
BuiltInArray< long > &  GlobalToLocalMap 
) [protected]

The partition ID gets the shared global incidences with is neighbors and converts to local incidence. After, stores for each partition neighbor an array with the shared local incidence.

This method is construct using point to point communication through mpi.

Parameters:
[in]GlobalIncidForNeighbors- Stores the shared global incidences for each neighbor.
[in]GlobalToLocalMap- Stores the incidence local for each global incidence in this partition id.

****************************************************************************************************

*

int PartitionData::BuildOverlappingElementsIncidences ( Mesh SolMesh,
BuiltInArray< long > &  GlobalToLocalMap,
struct LocalVariablesSize VariablesSize 
) [protected]

Constructs information about the element adjacents of this partition ID.

the informations stored were: the adjacents elements , the shared partition local incidence for each adjacent element and the shared topological element indices for each adjacent element.

Parameters:
[in]SolMesh- Solution finite element mesh used to get polynomial order and global incidences.
[in]GlobalToLocalMap- A mapping that store the local incidence for each global incidence. In this case, global inicidence is the index "i" in this GlobalToLocalMap array.
[in]VariablesSize- Struct to stores the size in bytes of all arrays and tables used to construct overlapping elements and its incidences.

, , struct LocalVariablesSize& VariablesSize

Calculates the maximum boundary element adjacent.

Stores the boundary element on the BoundaryElementsAdjTmp Array.

Calculates the number of partitions adjacents.

Stores the partitions adjacents.

Calculates the number of shared incidences for each boundary element adjacent.

Print to test

int PartitionData::BuildOverlappingPartitionIncidences ( Model GlobalModel,
bool &  WithOverlapping,
struct LocalVariablesSize VariablesSize 
) [protected]

Constructs information about the element adjacents of this partition ID.

the informations stored were: the adjacents elements , the shared partition local incidence for each adjacent element and the shared topological element indices for each adjacent element.

Parameters:
[in]GlobalModel- Finite Element global model of the solution mesh.
[in]WithOverlapping- A flag to indicate if the solver will be run with overlapping elements
[in]VariablesSize- Struct to stores the size in bytes of all arrays and tables used to construct overlapping elements and its incidences.

***********************************************************************************************

***********************************************************************************************

***********************************************************************************************

****************************************************************************************************

void PartitionData::BuildPartitionElements ( int  Rank,
int  NumGlobalElems,
BuiltInArray< int > &  xadj,
BuiltInArray< int > &  adjncy,
BuiltInArray< int > &  ewgt,
BuiltInArray< int > &  partition,
bool &  WithOverlapping 
) [protected]

Initializes the partition data.

the informations main initializes are:

  • list of local elements for partition
  • list of boundary elements
  • list of internal elements
  • an array containing the informations about the adjacents for each element.
Parameters:
[in]Rank- Number of process
[in]NumGlobalElems- Total number of global elements in the mesh.
[in]WithOverlapping- A flag to indicate if the solver will be run with overlapping elements
[in]xadj- Mapping to indicate the adjacents for each local element in this partition ID.
[in]adjncy- List of adjacents of all elements in this partition ID.
[in]ewgt- List of weights for each adjacents elements.
[in]partition- Array that contain for each element with index i, the partition[i] correspondent.

Constructs information about the incidences numbering for a partition.

Parameters:
[in]GlobalModel- Finite Element global model of the solution mesh.
int PartitionData::BuildPartitionIncidences_StoreSharedLocalOrder ( Model GlobalModel,
bool &  WithOverlapping,
struct LocalVariablesSize VariablesSize 
) [protected]

Constructs information about the incidences numbering for a partition.

Parameters:
[in]GlobalModel- Finite Element global model of the solution mesh.
[in]WithOverlapping- A flag to indicate if the solver will be run with overlapping elements
[in]VariablesSize- Struct to stores the size in bytes of all arrays and tables used to construct overlapping elements and its incidences.
int PartitionData::BuildPartitionIncidencesClockwise ( Model GlobalModel) [protected]

Constructs information about the incidences numbering for a partition.

The shared incidences between partitions will be construct sequentially.

Parameters:
[in]GlobalModel- Finite Element global model of the solution mesh.

Releases the physical memory deallocate for the PartitionData class.

Note:
Statically allocated variables are set to the default values.
long PartitionData::GetNextPartitionToBeNumbering ( unsigned long  BoundElem,
unsigned long  bound_elem_i,
unsigned long  curr_edge,
ElementElementTable ElemElemTable 
) [protected]

Get Next Partition Boundary to be Numbering.

Parameters:
[in]BoundElem- The last boundary element numbered of the partition ID
[in]bound_elem_i- The indice in the BoundaryElements array of the last boundary element numbered of the partition ID
[in]curr_edge- The last edge numbered in the last boundary element table.
[in]ElemElemTable- element element table that store the neighbors for each element.
unsigned long PartitionData::GetNumberSharedVertices ( unsigned long  NumberVertA,
long *  ElemA_Incid,
unsigned long  NumberVertB,
long *  ElemB_Incid 
) [protected]

Calculates and returns the number of shared vertices between differents elements.

Parameters:
[in]NumberVertA- Number of the vertices of the first element.
[in]ElemA_Incid- The incidences of the first element.
[in]NumberVertB- Number of the vertices of the second element.
[in]ElemB_Incid- The incidences of the second element.
unsigned long PartitionData::GetSharedGlobalIncidences ( unsigned long  NumberIncidA,
long *  ElemA_Incid,
unsigned long  NumberIncidB,
long *  ElemB_Incid,
unsigned long &  NumberSharedIncidence,
long *  ElemTopologicalIndA,
long *  SharedIncidences 
) [protected]

Calculates and returns the number of shared global incidences between differents elements.

Parameters:
[in]NumberIncidA- Number of the incidences of the first element.
[in]ElemA_Incid- The incidences of the first element.
[in]NumberIncidB- Number of the incidences of the second element.
[in]ElemB_Incid- The incidences of the second element.
[out]NumberSharedIncidence- The number of shared incidences between element A and B.
[out]ElemTopologicalIndA- The topological indices of the element A.
[out]SharedIncidences- The shared incidences between element A and B.
void PartitionData::NumberingBoundaryIncidenceClockWise ( ElementElementTable ElemElemTable,
Mesh SolMesh,
BuiltInArray< long > &  GlobalIncidMapTmp,
unsigned long  FirstBoundaryElem,
unsigned long  FirstBoundaryElemInd,
unsigned long  FirstBoundaryEdge,
unsigned long &  NextBoundaryEdge,
unsigned long &  NextBoundary,
unsigned long &  LastBoundaryIncid 
) [protected]

Numbering boundaries incidences in opposite direction of the topological element edge numbering.

Parameters:
[in]ElemElemTable- This table is used to access the neighbors of the boundaries elements.
[in]SolMesh- Finite element mesh used to access the PolyOrder and the Topological Element Edge Indices.
[in]GlobalIncidMap- Array to map global to local incidences of the ID partition. (The size of this array is Maximum number of global inicidence)
[in]FirstBoundaryElem- The first boundary element to starts the numbering incidences in the partition ID.
[in]FirstBoundaryElemInd- The indice of the boundary element local in the partition ID.
[in]FirstBoundaryEdge- The edge of the boundary element to start numbering incidences.
[out]NextBoundaryEdge- Returns the first edge of the next partition to start numbering.
[out]NextBoundary- Returns the first boundary element of the next partition to start numbering.
[out]LastBoundaryIncid- Returns the last boundary element indice to access the next partition ID trough its neighbor by the NextBoundaryEdge.
void PartitionData::Partitioner ( Model GlobalModel)

Performs the partitioning through the metis algorithm.

Parameters:
[in]GlobalModel- Finite Element global model of the solution mesh.
void PartitionData::ReinitializesRankTags ( int  NumRanks,
unsigned long  NumNeighbors,
BuiltInArray< bool > &  CheckNeighbors,
BuiltInArray< bool > &  RanksTag,
int &  LastRank 
) [protected]

Reinitializes the tag for each rank.

Starts tag the rank i with true and its neighbors with false, where i = 0..N-1.

Parameters:
[in]NumRanks- The number of process.
[in]NumNeighbors- Number of neighbors of the partition ID.
[out]CheckNeighbors- An array where each position indicates if the neighbor of the partition ID send and receive data.
[out]RanksTag- Store the tags for each rank. The true tag indicates the rank just could be send and false it just could be receiv.
[out]LastRank- Store the last rank assigned as true. Obs.: The LastRank i start with true, where i = 0..N-1.
void PartitionData::SearchFirstBoundInBoundPartition ( ElementElementTable ElemElemTable,
unsigned long &  FirstBoundOut,
unsigned long &  FirstBoundIndOut,
long &  FirstEdgeOut 
) [protected]

Searchs the first boundary element on the partition ID to start numbering the incidences.

Parameters:
[in]ElemElemTable- Element element table that stores the element neighbors by the edges.
[out]FirstBoundOut- Stores the first boundary element to start the numbering the incidences.
[out]FirstBoundIndOut- Stores the first boundary element indice to start the numbering the incidences.
[out]FirstEdgeOut- Stores the first edge in the first boundary element to start the numbering the incidences.
void PartitionData::SearchFirstBoundInInternalPartition ( ElementElementTable ElemElemTable,
unsigned long &  FirstBoundOut,
unsigned long &  FirstBoundIndOut,
long &  FirstEdgeOut 
) [protected]

Searchs the first boundary element on the partition ID to start numbering the incidences.

Parameters:
[in]ElemElemTable- Element element table that stores the element neighbors by the edges.
[out]FirstBoundOut- Stores the first boundary element to start the numbering the incidences.
[out]FirstBoundIndOut- Stores the first boundary element indice to start the numbering the incidences.
[out]FirstEdgeOut- Stores the first edge in the first boundary element to start the numbering the incidences.
void PartitionData::SearchFirstPartitionToNumbering ( ElementElementTable ElemElemTable,
int &  FirstPartition,
unsigned long &  FirstBoundOut,
unsigned long &  FirstBoundIndOut,
long &  FirstEdgeOut 
) [protected]

Searchs the first partition ID to start numbering the incidences. The first partition should be a boundary partitions. Furthermore, it'll calculate the first boundary element and its first edge to start the numbering incidence.

Parameters:
[in]ElemElemTable- Element element table that stores the element neighbors by the edges.
[out]FirstPartition- First partition to start numbering the boundary incidences.
[out]FirstBoundOut- Stores the first boundary element to start the numbering the incidences.
[out]FirstBoundIndOut- Stores the first boundary element indice to start the numbering the incidences.
[out]FirstEdgeOut- Stores the first edge in the first boundary element to start the numbering the incidences.
void PartitionData::SetInternalAndBoundaryElements ( BuiltInArray< int > &  xadj,
BuiltInArray< int > &  partition,
bool &  WithOverlapping 
) [protected]

Stores the internal and informations about the boundaries elements.

the informations main initializes are:

  • list of boundary elements
  • list of internal elements
  • a table containing the informations about the boundary elements adjacents that belongs another patition.
Parameters:
[in]xadj- Mapping to indicate the adjacents for each local element in this partition ID.
[in]partition- Array that contain for each element with index i, the partition[i] correspondent.
[in]WithOverlapping- A flag to indicate if the solver will be run with overlapping elements
void PartitionData::SetMetisAlgorithmOptions ( int *  options) [protected]

Settings the options for the METIS algorithms.

Parameters:
[in]options- The options to configure the METIS_PartGraphRecursive() function.

Set size of local element incidence.

Parameters:
[in]Group- This group is used to acess the Number of Element Nodes to calculate the number of incidences for each element.

Member Data Documentation

Stores informations about the adjacents.

Each line of OneIndexTable, represents an element i of the mesh on the partition. Each row of the OneIndexTable have three parts: First- Array of adjacents. Second - Array of partition number for each adjacent. Third - Array of the shared vertices number for each adjacent.

Information about the boundary elements of the partition ID.

Each line of OneIndexTable, represents an boundary element of the mesh on the partition. Each row of the OneIndexTable have three parts: First - Array of adjacents that belongs to another partition. Second - Array of partition number for each adjacent. Third - Array of the shared vertices number for each adjacent.

This array is used to map global to local elements of the partition.

It's allocated with maximum global element number in the partition ID.

Local incidences for a partition.

the incidences is stored for each element in the partition ID.

This table stores for each adjacent partition the begin boundary incidence and the offset (the number of shared boundary incidences).

The size of this array is 2 x N, where the first line store the first boundary incidence and second line the offset to send to neighbor partition. N is the number of neighbors partitions.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Friends Defines