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