xc
DomainPartitioner.h
1 //----------------------------------------------------------------------------
2 // XC program; finite element analysis code
3 // for structural analysis and design.
4 //
5 // Copyright (C) Luis Claudio Pérez Tato
6 //
7 // This program derives from OpenSees <http://opensees.berkeley.edu>
8 // developed by the «Pacific earthquake engineering research center».
9 //
10 // Except for the restrictions that may arise from the copyright
11 // of the original program (see copyright_opensees.txt)
12 // XC is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // This software is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program.
25 // If not, see <http://www.gnu.org/licenses/>.
26 //----------------------------------------------------------------------------
27 /* ****************************************************************** **
28 ** OpenSees - Open System for Earthquake Engineering Simulation **
29 ** Pacific Earthquake Engineering Research Center **
30 ** **
31 ** **
32 ** (C) Copyright 1999, The Regents of the University of California **
33 ** All Rights Reserved. **
34 ** **
35 ** Commercial use of this program without express permission of the **
36 ** University of California, Berkeley, is strictly prohibited. See **
37 ** file 'COPYRIGHT' in main directory for information on usage and **
38 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. **
39 ** **
40 ** Developed by: **
41 ** Frank McKenna (fmckenna@ce.berkeley.edu) **
42 ** Gregory L. Fenves (fenves@ce.berkeley.edu) **
43 ** Filip C. Filippou (filippou@ce.berkeley.edu) **
44 ** **
45 ** ****************************************************************** */
46 
47 // $Revision: 1.3 $
48 // $Date: 2006/01/10 00:31:52 $
49 // $Source: /usr/local/cvs/OpenSees/SRC/domain/partitioner/DomainPartitioner.h,v $
50 
51 // Written: fmk
52 // Created: Fri Sep 20 15:27:47: 1996
53 // Revision: A
54 //
55 // Description: This file contains the class definition for DomainPartitioner.
56 // A DomainPartitioner is an object used to partition a PartitionedDomain.
57 //
58 // What: "@(#) DomainPartitioner.h, revA"
59 
60 #ifndef DomainPartitioner_h
61 #define DomainPartitioner_h
62 
63 #include <utility/matrix/ID.h>
64 #include "xc_utils/src/kernel/CommandEntity.h"
65 
66 namespace XC {
67 class GraphPartitioner;
68 class LoadBalancer;
69 class PartitionedDomain;
70 class Vector;
71 class Graph;
72 class TaggedObjectStorage;
73 
77 //
79 //
87 class DomainPartitioner: public CommandEntity
88  {
89  private:
90  PartitionedDomain *myDomain;
91  GraphPartitioner &thePartitioner;
92  LoadBalancer *theBalancer;
93 
94  Graph *theElementGraph;
95  std::vector<Graph> theBoundaryElements;
96 
97  TaggedObjectStorage *theNodeLocations;
98  ID *elementPlace;
99  int numPartitions;
100  ID primes;
101  bool partitionFlag;
102 
103  bool usingMainDomain;
104  int mainPartition;
105 
106  int inic(const size_t &);
107  public:
108  DomainPartitioner(GraphPartitioner &theGraphPartitioner,
109  LoadBalancer &theLoadBalancer);
110 
111  DomainPartitioner(GraphPartitioner &theGraphPartitioner);
112 
113  virtual void setPartitionedDomain(PartitionedDomain &theDomain);
114  virtual int partition(int numParts, bool useMainDomain = false, int mainPartition = 0);
115 
116  virtual int balance(Graph &theWeightedSubdomainGraph);
117 
118  // public member functions needed by the load balancer
119  virtual int getNumPartitions(void) const;
120  virtual Graph &getPartitionGraph(void);
121  virtual Graph &getColoredGraph(void);
122 
123  virtual int swapVertex(int from,
124  int to,
125  int vertexTag,
126  bool adjacentVertexNotInOther = true);
127 
128  virtual int swapBoundary(int from,
129  int to,
130  bool adjacentVertexNotInOther = true);
131 
132  virtual int releaseVertex(int from,
133  int vertexTag,
134  Graph &theWeightedPartitionGraph,
135  bool mustReleaseToLighter = true,
136  double factorGreater = 1.0,
137  bool adjacentVertexNotInOther = true);
138 
139  virtual int releaseBoundary(int from,
140  Graph &theWeightedPartitionGraph,
141  bool mustReleaseToLighter = true,
142  double factorGreater = 1.0,
143  bool adjacentVertexNotInOther = true);
144  };
145 } // end of XC namespace
146 
147 #endif
148 
149 
DomainPartitioner(GraphPartitioner &theGraphPartitioner, LoadBalancer &theLoadBalancer)
Constructor.
Definition: DomainPartitioner.cpp:111
virtual int swapVertex(int from, int to, int vertexTag, bool adjacentVertexNotInOther=true)
Moves a vertes from subdomain from to subdomain to.
Definition: DomainPartitioner.cpp:670
Object that can partition and load balance a PartitionedDomain.
Definition: DomainPartitioner.h:87
Vector of integers.
Definition: ID.h:93
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...
Definition: DomainPartitioner.cpp:1028
virtual int partition(int numParts, bool useMainDomain=false, int mainPartition=0)
Method invoked to partition the Domain.
Definition: DomainPartitioner.cpp:171
virtual int getNumPartitions(void) const
Returns the number of partitions in the PartitionedDomain.
Definition: DomainPartitioner.cpp:614
virtual Graph & getColoredGraph(void)
Return the colored graph.
Definition: DomainPartitioner.cpp:641
Base class for graph partitioners.
Definition: GraphPartitioner.h:84
The Graph class provides the abstraction of a graph.
Definition: Graph.h:93
virtual Graph & getPartitionGraph(void)
Return the partition graph.
Definition: DomainPartitioner.cpp:623
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.
Definition: DomainPartitioner.cpp:1526
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
Partitioned domain (aggregation of subdomains).
Definition: PartitionedDomain.h:90
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 ...
Definition: DomainPartitioner.cpp:1435
A LoadBalancer is an object used to balance a PartitionedDomain.
Definition: LoadBalancer.h:80
virtual int balance(Graph &theWeightedSubdomainGraph)
Load balance.
Definition: DomainPartitioner.cpp:581