xc
PartitionedDomain.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.5 $
48 // $Date: 2006/01/10 00:33:09 $
49 // $Source: /usr/local/cvs/OpenSees/SRC/domain/domain/partitioned/PartitionedDomain.h,v $
50 
51 
52 // Written: fmk
53 // Created: Wed Sep 25 15:27:47: 1996
54 // Revision: A
55 //
56 // Description: This file contains the class definition for PartitionedDomain.
57 // PartitionedDomain is an abstract class. The class is responsible for holding
58 // and providing access to the Elements, Nodes, SFreedom_Constraints
59 // and MFreedom_Constraints just like a normal domain. In addition the domain provides
60 // a method to partition the domain into Subdomains.
61 //
62 // ModelBuilder. There are no partitions in a PartitionedDomain.
63 //
64 // What: "@(#) PartitionedDomain.h, revA"
65 
66 #ifndef PartitionedDomain_h
67 #define PartitionedDomain_h
68 
69 #include <domain/domain/Domain.h>
70 #include "solution/graph/graph/Graph.h"
71 
72 namespace XC {
73 class DomainPartitioner;
74 class Subdomain;
75 class SubdomainIter;
76 class ArrayOfTaggedObjects;
77 class PartitionedDomainSubIter;
78 class PartitionedDomainEleIter;
79 class SingleDomEleIter;
80 
91  {
92  private:
93  TaggedObjectStorage *elements;
94  ArrayOfTaggedObjects *theSubdomains;
95  DomainPartitioner *theDomainPartitioner;
96 
97  SingleDomEleIter *mainEleIter; // for ele that belong to elements
98  PartitionedDomainSubIter *theSubdomainIter;
99  PartitionedDomainEleIter *theEleIter;
100 
101  Graph mySubdomainGraph;
102  void alloc(void);
103  void free_mem(void);
104  protected:
105  int barrierCheck(int result);
106  DomainPartitioner *getPartitioner(void) const;
107  virtual int buildEleGraph(Graph &theEleGraph);
108  public:
109  PartitionedDomain(CommandEntity *owr,DataOutputHandler::map_output_handlers *oh);
110  PartitionedDomain(CommandEntity *owr,DomainPartitioner &thePartitioner,DataOutputHandler::map_output_handlers *oh);
111 
112  PartitionedDomain(CommandEntity *owr,int numNods, int numElems,
113  int numSPs, int numMPs, int numLPatterns, int numNLockers,
114  int numSubdom,
115  DomainPartitioner &thePartitioner,DataOutputHandler::map_output_handlers *oh);
116 
117  virtual ~PartitionedDomain(void);
118 
119  // public methods to populate a domain
120  virtual bool addElement(Element *elePtr);
121  virtual bool addNode(Node *nodePtr);
122 
123  virtual bool addLoadPattern(LoadPattern *);
125  virtual bool addSFreedom_Constraint(SFreedom_Constraint *, int loadPatternTag);
128  virtual bool addNodalLoad(NodalLoad *, int loadPatternTag);
129  virtual bool addElementalLoad(ElementalLoad *, int loadPatternTag);
130 
131  // methods to remove the components
132  virtual void clearAll(void);
133  virtual bool removeElement(int tag);
134  virtual bool removeNode(int tag);
135  virtual bool removeSFreedom_Constraint(int tag);
136  virtual bool removeMFreedom_Constraint(int tag);
137  virtual bool removeLoadPattern(int loadTag);
138 
139  // methods to access the elements
140  virtual ElementIter &getElements();
141  virtual Element *getElement(int tag);
142 
143  virtual int getNumElements(void) const;
144 
145  // public methods to update the domain
146  virtual void setCommitTag(int newTag);
147  virtual void setCurrentTime(double newTime);
148  virtual void setCommittedTime(double newTime);
149  virtual void applyLoad(double pseudoTime);
150  virtual void setLoadConstant(void);
151 
152  virtual int commit(void);
153  virtual int revertToLastCommit(void);
154  virtual int revertToStart(void);
155  virtual int update(void);
156  virtual int update(double newTime, double dT);
157  virtual int newStep(double dT);
158 
159  virtual int addRecorder(Recorder &theRecorder);
160  virtual int removeRecorders(void);
161 
162  virtual void Print(std::ostream &s, int flag =0);
163 
164  // public member functions in addition to the standard domain
165  virtual int setPartitioner(DomainPartitioner *thePartitioner);
166  virtual int partition(int numPartitions, bool usingMain = false, int mainPartitionID = 0);
167 
168  virtual bool addSubdomain(Subdomain *theSubdomain);
169  virtual int getNumSubdomains(void);
170  virtual Subdomain *getSubdomainPtr(int tag);
171  virtual SubdomainIter &getSubdomains(void);
172  virtual bool removeExternalNode(int tag);
173  virtual Graph &getSubdomainGraph(void);
174 
175  // nodal methods required in domain interface for parallel interprter
176  virtual double getNodeDisp(int nodeTag, int dof, int &errorFlag);
177  virtual int setMass(const Matrix &mass, int nodeTag);
178 
179  // friend classes
180  friend class PartitionedDomainEleIter;
181  };
182 } // end of XC namespace
183 
184 #endif
185 
186 
virtual int buildEleGraph(Graph &theEleGraph)
A method which will cause the domain to discard the current element graph and build a new one based o...
Definition: PartitionedDomain.cpp:1327
virtual int addRecorder(Recorder &theRecorder)
Adds a recorder to the model.
Definition: PartitionedDomain.cpp:1129
virtual bool removeLoadPattern(int loadTag)
To remove the load case whose tag is given by tag.
Definition: PartitionedDomain.cpp:739
Domain enclosed in another domain.
Definition: Subdomain.h:101
Object that can partition and load balance a PartitionedDomain.
Definition: DomainPartitioner.h:87
virtual SubdomainIter & getSubdomains(void)
Return an iterator for the Subdomains of the PartitionedDomain.
Definition: PartitionedDomain.cpp:1305
virtual ElementIter & getElements()
Return an iterator to the element container.
Definition: PartitionedDomain.cpp:773
virtual int partition(int numPartitions, bool usingMain=false, int mainPartitionID=0)
Triggers the partition of the domain.
Definition: PartitionedDomain.cpp:1213
virtual bool addLoadPattern(LoadPattern *)
Add the load pattern to the domain.
Definition: PartitionedDomain.cpp:536
virtual Subdomain * getSubdomainPtr(int tag)
Return the Subdomain whose tag is given by tag.
Definition: PartitionedDomain.cpp:1296
virtual bool addElement(Element *elePtr)
To add the element pointed to by theElementPtr to the domain.
Definition: PartitionedDomain.cpp:199
virtual void Print(std::ostream &s, int flag=0)
Print stuff.
Definition: PartitionedDomain.cpp:1181
An Recorder object is used in the program to store/restore information at each commit().
Definition: Recorder.h:86
virtual bool addNode(Node *nodePtr)
Adds the node pointed to by theNodePtr to the domain.
Definition: PartitionedDomain.cpp:261
Iterator over an element container.
Definition: ElementIter.h:73
virtual void setCommitTag(int newTag)
Set the committed tag to newTag.
Definition: PartitionedDomain.cpp:845
virtual int revertToStart(void)
Return the domain to its initial state and triggers the "restart" method for all the recorders...
Definition: PartitionedDomain.cpp:1096
virtual bool removeExternalNode(int tag)
a method which will only remove a node from the partitioned domain it does not touch the subdomains ...
Definition: PartitionedDomain.cpp:1441
A LoadPattern object is used to to store reference loads and single point constraints and a TimeSerie...
Definition: LoadPattern.h:93
DomainPartitioner * getPartitioner(void) const
Return a pointer to the DomainPartitioner object associated with the PartitionedDomain.
Definition: PartitionedDomain.cpp:1314
virtual int setMass(const Matrix &mass, int nodeTag)
Set the mass matrix for the node identified by the argument.
Definition: PartitionedDomain.cpp:1590
virtual bool addSubdomain(Subdomain *theSubdomain)
Adds the subdomain pointed to by theSubdomainPtr to the domain.
Definition: PartitionedDomain.cpp:1273
virtual void setCommittedTime(double newTime)
Set the committed time to newTime.
Definition: PartitionedDomain.cpp:885
ArrayOfTaggedObjects is a storage class.
Definition: ArrayOfTaggedObjects.h:91
virtual bool addSFreedom_Constraint(SFreedom_Constraint *)
Adds the single point constraint pointed to by theSPptr to the domain.
Definition: PartitionedDomain.cpp:284
virtual void setCurrentTime(double newTime)
Sets the current pseudo-time of the domain.
Definition: PartitionedDomain.cpp:867
virtual int removeRecorders(void)
Remove the recorders.
Definition: PartitionedDomain.cpp:1155
Base class for the finite elements.
Definition: Element.h:109
virtual bool addMFreedom_Constraint(MFreedom_Constraint *)
Adds the multiple freedom constraint pointed to by the argument.
Definition: PartitionedDomain.cpp:348
virtual bool removeSFreedom_Constraint(int tag)
To remove the SFreedom_Constraint whose tag is given by tag from the domain.
Definition: PartitionedDomain.cpp:678
Definition: SubdomainIter.h:70
virtual Graph & getSubdomainGraph(void)
This will create a new graph each time it is invoked; deleting the old graph.
Definition: PartitionedDomain.cpp:1451
virtual void applyLoad(double pseudoTime)
Applies the load to all the subdomains.
Definition: PartitionedDomain.cpp:827
Definition: PartitionedDomainEleIter.h:79
Single freedom constraint.
Definition: SFreedom_Constraint.h:84
virtual int update(void)
Updates the state of the domain.
Definition: PartitionedDomain.cpp:917
virtual void setLoadConstant(void)
Set all the loads as constant.
Definition: PartitionedDomain.cpp:901
The Graph class provides the abstraction of a graph.
Definition: Graph.h:93
virtual bool removeElement(int tag)
Remove the element whose tag is given by tag.
Definition: PartitionedDomain.cpp:614
virtual int getNumSubdomains(void)
Return the number of Subdomains (partitions).
Definition: PartitionedDomain.cpp:1290
virtual int commit(void)
The partioned domain iterates through all the subdomains invoking {commit()} on them.
Definition: PartitionedDomain.cpp:1024
virtual bool addElementalLoad(ElementalLoad *, int loadPatternTag)
Adds a load over element to the pattern.
Definition: PartitionedDomain.cpp:600
virtual int revertToLastCommit(void)
Return the domain to its last commited state.
Definition: PartitionedDomain.cpp:1064
virtual bool addMRMFreedom_Constraint(MRMFreedom_Constraint *)
Adds to the domain a multi-freedom multi-retained node constraint.
Definition: PartitionedDomain.cpp:528
Multiple retained nodes constraint.
Definition: MRMFreedom_Constraint.h:58
virtual bool removeMFreedom_Constraint(int tag)
To remove the MFreedom_Constraint whose tag is given by tag.
Definition: PartitionedDomain.cpp:706
virtual Element * getElement(int tag)
Return the element identified by the argument.
Definition: PartitionedDomain.cpp:785
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
Partitioned domain (aggregation of subdomains).
Definition: PartitionedDomain.h:90
virtual int getNumElements(void) const
Return the number of elements.
Definition: PartitionedDomain.cpp:814
Matrix of floats.
Definition: Matrix.h:108
Multi-freedom constraint.
Definition: MFreedom_Constraint.h:110
virtual ~PartitionedDomain(void)
Destructor.
Definition: PartitionedDomain.cpp:170
Definition: PartitionedDomainSubIter.h:72
Definition: SingleDomEleIter.h:71
Base class for loads over elements.
Definition: ElementalLoad.h:77
virtual bool removeNode(int tag)
Remove the node whose tag is given by tag.
Definition: PartitionedDomain.cpp:649
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:116
Mesh node.
Definition: Node.h:110
virtual void clearAll(void)
Removes all components from domain (nodes, elements, loads & constraints).
Definition: PartitionedDomain.cpp:176
PartitionedDomain(CommandEntity *owr, DataOutputHandler::map_output_handlers *oh)
Constructor.
Definition: PartitionedDomain.cpp:127
Load over a node.
Definition: NodalLoad.h:82
virtual bool addNodalLoad(NodalLoad *, int loadPatternTag)
Appends a nodal load to the pattern being passed as parameter.
Definition: PartitionedDomain.cpp:567
virtual double getNodeDisp(int nodeTag, int dof, int &errorFlag)
Return the value of the dof component of displacement for the node with the tag being passed as param...
Definition: PartitionedDomain.cpp:1566