xc
Public Member Functions | List of all members
XC::DomainPartitioner Class Reference

Object that can partition and load balance a PartitionedDomain. More...

#include <DomainPartitioner.h>

Inheritance diagram for XC::DomainPartitioner:
Inheritance graph
[legend]
Collaboration diagram for XC::DomainPartitioner:
Collaboration graph
[legend]

Public Member Functions

 DomainPartitioner (GraphPartitioner &theGraphPartitioner, LoadBalancer &theLoadBalancer)
 Constructor. More...
 
 DomainPartitioner (GraphPartitioner &theGraphPartitioner)
 Constructor. More...
 
virtual void setPartitionedDomain (PartitionedDomain &theDomain)
 
virtual int partition (int numParts, bool useMainDomain=false, int mainPartition=0)
 Method invoked to partition the Domain. More...
 
virtual int balance (Graph &theWeightedSubdomainGraph)
 Load balance. More...
 
virtual int getNumPartitions (void) const
 Returns the number of partitions in the PartitionedDomain.
 
virtual GraphgetPartitionGraph (void)
 Return the partition graph. More...
 
virtual GraphgetColoredGraph (void)
 Return the colored graph. More...
 
virtual int swapVertex (int from, int to, int vertexTag, bool adjacentVertexNotInOther=true)
 Moves a vertes from subdomain from to subdomain to. More...
 
virtual int swapBoundary (int from, int to, bool adjacentVertexNotInOther=true)
 Method to move from from to to, all elements on the interface of from that are adjacent with to. More...
 
virtual int releaseVertex (int from, int vertexTag, Graph &theWeightedPartitionGraph, bool mustReleaseToLighter=true, double factorGreater=1.0, bool adjacentVertexNotInOther=true)
 Method which when invoked will take the element given by vertex reference of the vertex whose tag is given by vertexTag from subdomain from and place it in the subdomain to which it is most attracted (to which it is most connected). More...
 
virtual int releaseBoundary (int from, Graph &theWeightedPartitionGraph, bool mustReleaseToLighter=true, double factorGreater=1.0, bool adjacentVertexNotInOther=true)
 Release all the elements on the boundary of subdomain from. More...
 
- Public Member Functions inherited from CommandEntity
 CommandEntity (CommandEntity *owr=nullptr)
 Default constructor.
 
CommandEntityOwner (void)
 Return a pointer to the object owner.
 
const CommandEntityOwner (void) const
 Return un puntero al objeto propietario de ESTE.
 
const StandardOutputWrappergetStandardOutputWrapper (void) const
 Return the regular output stream wrapper.
 
StandardOutputWrappergetStandardOutputWrapper (void)
 Return the regular output stream wrapper.
 
const std::string & getLogFileName (void) const
 Returns log file name.
 
void setLogFileName (const std::string &)
 Sets log file name.
 
const std::string & getErrFileName (void) const
 Returns err file name.
 
void setErrFileName (const std::string &)
 Sets error file name.
 
const std::string & getOutputFileName (void) const
 Returns regular output file name.
 
void setOutputFileName (const std::string &)
 Sets regular output file name.
 
boost::python::object evalPy (boost::python::object dict, const std::string &)
 Return the Python object that results from evaluating the argument.
 
boost::python::object execPy (boost::python::object dict, const std::string &)
 Return the Python objects that results from executing the code in the string argument.
 
boost::python::object execFilePy (boost::python::object dict, const std::string &)
 Return the Python object that results from executing the code in the file.
 
- Public Member Functions inherited from EntityWithProperties
 EntityWithProperties (EntityWithProperties *owr=nullptr)
 Default constructor.
 
virtual bool operator== (const EntityWithProperties &) const
 Comparison operator.
 
void clearPyProps (void)
 Clear python properties map.
 
bool hasPyProp (const std::string &)
 Returns true if property exists.
 
boost::python::object getPyProp (const std::string &str)
 Return the Python object with the name being passed as parameter.
 
void setPyProp (std::string str, boost::python::object val)
 Sets/appends a value tho the Python object's dictionary.
 
void copyPropsFrom (const EntityWithProperties &)
 Copy the properties from the argument.
 
boost::python::list getPropNames (void) const
 Return the names of the object properties weightings.
 
const PythonDict & getPropertiesDict (void) const
 Return a std::map container with the properties of the object.
 
boost::python::dict getPyDict (void) const
 Return a Python dictionary containing the object members values.
 
void setPyDict (const boost::python::dict &)
 Set the values of the object members from a Python dictionary.
 
- Public Member Functions inherited from EntityWithOwner
 EntityWithOwner (EntityWithOwner *owr=nullptr)
 Default constructor.
 
 EntityWithOwner (const EntityWithOwner &)
 Copy constructor.
 
EntityWithOwneroperator= (const EntityWithOwner &)
 Assignment operator.
 
virtual bool operator== (const EntityWithOwner &) const
 Comparison operator.
 
virtual ~EntityWithOwner (void)
 Virtual destructor.
 
virtual std::string getClassName (void) const
 Returns demangled class name.
 
void set_owner (EntityWithOwner *owr)
 Assigns the owner of the object.
 
EntityWithOwnerOwner (void)
 
const EntityWithOwnerOwner (void) const
 

Additional Inherited Members

- Public Types inherited from EntityWithProperties
typedef std::map< std::string, boost::python::object > PythonDict
 
- Static Public Member Functions inherited from CommandEntity
static void resetStandardOutput (void)
 Reset the standard output streams to its defaults buffers.
 
- Static Public Member Functions inherited from EntityWithOwner
static int getVerbosityLevel (void)
 Get the value of the verbosity level.
 
static void setVerbosityLevel (const int &)
 Set the value of the verbosity level.
 
- Protected Member Functions inherited from CommandEntity
template<class T >
void string_to (T &, const std::string &) const
 
- Static Protected Member Functions inherited from CommandEntity
static CommandEntityentcmd_cast (boost::any &data)
 
- Static Protected Attributes inherited from EntityWithOwner
static int verbosity = 1
 Object that owns THIS ONE. More...
 

Detailed Description

Object that can partition and load balance a PartitionedDomain.

A DomainPartitioner is an object used to partition and load balance a PartitionedDomain. The DomainPartitioner uses the element graph of the domain to partition and load balance. Derived types can use the node graph of the domain. The partitioner uses a GraphPartitioner and a LoadBalancingAlgo to partition and load balance the domain.

Constructor & Destructor Documentation

◆ DomainPartitioner() [1/2]

XC::DomainPartitioner::DomainPartitioner ( GraphPartitioner theGraphPartitioner,
LoadBalancer theLoadBalancer 
)

Constructor.

Constructs a DomainPartitioner which will use {theGraphPartitioner} to initially partition the PartitionedDomain using the element graph and the theLoadBalancer to load balance the PartitionedDomain. The max number of subdomains that the Domain can be partitioned is currently set at 8.

◆ DomainPartitioner() [2/2]

XC::DomainPartitioner::DomainPartitioner ( GraphPartitioner theGraphPartitioner)

Constructor.

Constructs a DomainPartitioner which will use {theGraphPartitioner} to initially partition the PartitionedDomain. The max number of subdomains that the Domain can be partitioned is currently set at 8.

Member Function Documentation

◆ balance()

int XC::DomainPartitioner::balance ( Graph theWeightedPGraph)
virtual

Load balance.

Checks first to see that the partitionFlag has been set; if it hasn'nt an error message is printed and a \(-1\) is returned. If a LoadBalancer was passed in the constructor balance() is invoked on this object; if no LoadBalancer was passed nothing is done and method returns \(0\). If balancing is performed, the DomainPartitioner invokes hasDomainChanged() on each Subdomain; if the Subdomain has changed invokeChangeOnAnalysis(). Finally {hasDomainChanged()} is invoked on the PartitionedDomain; if it has changed invokeChangeOnAnalysis(). partitionFlag is set to true.

Method which invokes {setPartitioner(this)} on the LoadBalancingAlgo. It then invokes {balance(load)} on this object, where load is vector of size numParts containing the load of each subdomain.

◆ getColoredGraph()

XC::Graph & XC::DomainPartitioner::getColoredGraph ( void  )
virtual

Return the colored graph.

A method which returns the current colored graph representing the partitioning of the elements in the subdomains. Does this by invoking getElementGraph() on the PartitionedDomain. Note that this is the same graph that was colored by the DomainPartitioner in partitioning the PartitionedDomain.

◆ getPartitionGraph()

XC::Graph & XC::DomainPartitioner::getPartitionGraph ( void  )
virtual

Return the partition graph.

Method which returns the partition graph. This is a graph with a vertex for every partition and an edge between partitions if there exists an element in one partition which is connected to an element in the other partition.

◆ partition()

int XC::DomainPartitioner::partition ( int  numParts,
bool  usingMain = false,
int  mainPartitionTag = 0 
)
virtual

Method invoked to partition the Domain.

Method invoked to partition the Domain. It first checks to see that the PartitionedDomain has at least numParts Subdomains, with tags 1 through numParts; if not prints an error message and returns -1. It then asks the domain for the element graph. This graph is then partitioned using the GraphPartitioner into numParts; if partitioning fails an error message is printed and \(-10 +\) number returned from GraphPartitioner is returned. If successful the domain is partitioned according to the following rules: {itemize} All nodes which are internal to a partition are added using the addNode() method of the Subdomain. These nodes are removed from the PartionedDomain using removeNode(). External nodes (these are nodes shared across partitions as a result of element connectivity or MP_Constraints are added to those Subdomains whose elements reference them. They are added using the addExternalNode() command. SFreedom_Constraints whose node is interior to a Subdomain are removed from the PartitionedDomain and added to the Subdomain. MP_Constraints whose two nodes are interior to a Subdomain are removed from the PartitionedDomain and added to the Subdomain. The elements are sent to the partition whose tag is given by the color of the vertex in the partitioned (colored) element graph. The elements are removed from the PartitionedDomain using {removeElement()} and added to the Subdomain using addElement(). For the loads, a check is made to ensure that each Subdomain has a LoadCase with a tag equal to the tags in the LoadCases that have been added to the PartitionedDomain; if not new LoadCases are created and added to the Subdomain. It then iterates through all the NodalLoads in the LoadCases in the PartionedDomain, if the corresponding node is external the NodalLoad is removed and added to the corresponding LoadCase in the Subdomain. ELEMENTAL LOADS are not yet dealt with. {itemize}

The DomainPartitioner invokes hasDomainChanged() on each Subdomain; if the Subdomain has changed invokeChangeOnAnalysis(). Finally {hasDomainChanged()} is invoked on the PartitionedDomain; if it has changed invokeChangeOnAnalysis(). partitionFlag is set to true.

◆ releaseBoundary()

int XC::DomainPartitioner::releaseBoundary ( int  from,
Graph theWeightedPartitionGraph,
bool  mustReleaseToLighter = true,
double  factorGreater = 1.0,
bool  adjacentVertexNotInOther = true 
)
virtual

Release all the elements on the boundary of subdomain from.

Method which when invoked will release all the elements on the boundary of subdomain from. It performs the operation by creating an ID of all the vertices on the boundary of the from Subdomain. Then releaseBoundary() is invoked on all these vertices.

◆ releaseVertex()

int XC::DomainPartitioner::releaseVertex ( int  from,
int  vertexTag,
Graph theWeightedPartitionGraph,
bool  mustReleaseToLighter = true,
double  factorGreater = 1.0,
bool  adjacentVertexNotInOther = true 
)
virtual

Method which when invoked will take the element given by vertex reference of the vertex whose tag is given by vertexTag from subdomain from and place it in the subdomain to which it is most attracted (to which it is most connected).

If it is equally attracted to two subdomains it is sent to the one with the lightest load (the loads on the subdomains are given in the {theWeightedPartitionGraph}. If the mustReleaseToLighter is {true} a check is first made to see if the load on the intended subdomain is lighter than the load in from and that the ratio in load between from and the new domain is greater than {factorGreater}; if this is the case the element is swapped, if not the element is not swapped. An additional requirement that the vertex that is to be swapped is not adjacent to any other partition can also be set. The method determines which partition the vertex is to be sent to and then returns the result of invoking swapVertex() on itself, with this partition used as the to argument in the arguments.

◆ swapBoundary()

int XC::DomainPartitioner::swapBoundary ( int  from,
int  to,
bool  adjacentVertexNotInOther = true 
)
virtual

Method to move from from to to, all elements on the interface of from that are adjacent with to.

Method which when invoked will take all the boundary elements in subdomain from that are connected to elements in subdomain {to} and place them in subdomain to. If adjacentVertexOther is true no Elements which are connected to elements in subdomains other than to and from are moved. Returns \(0\) if successful, returns an error message and \(-1\) if PartitionedDomain has not been partitioned, \(-2\) if from Subdomain does not exist, \(-3\) if {to Subdomain} does not exist. The Elements, Nodes, NodalLoads, SFreedom_Constraints and MP_Constraints that need to be moved between the two Subdomains, or between the PartitionedDomain and Subdomains are also moved. NO ELEMENTAL LOADS are moved yet. It performs the operation by creating an ID of vertices and then using code similar to that used in {swapVertex()}; swapVErtex() is not called repeatedly as this was found to be too slow.

◆ swapVertex()

int XC::DomainPartitioner::swapVertex ( int  from,
int  to,
int  vertexTag,
bool  adjacentVertexNotInOther = true 
)
virtual

Moves a vertes from subdomain from to subdomain to.

Method which will take the element given by vertex reference of the vertex whose tag is given by vertexTag from subdomain from and place it in subdomain to. If notAdjacentOther is {true} a check is made to ensure that the vertex to be swapped is not adjacent to a vertex in any other partition. Returns \(0\) if successful, returns an error message and \(-1\) if PartitionedDomain has not been partitioned, \(-2\) if from Subdomain does not exist, \(-3\) if {to Subdomain} does not exist, \(-4\) if a vertex given by tag does not exist, returns \(-5\) if notAdjacentOther was true and the vertex was adjacent to a vertex in another partition, and returns \(-6\) if no Element with a tag similar to tag exists (this should not happen if element graph is built correctly). The Element, Nodes, NodalLoads, SFreedom_Constraints and MP_Constraints that need to be moved between the two Subdomains, or between the PartitionedDomain and Subdomains are also moved. NO ELEMENTAL LOADS are moved yet.


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