xc
PartitionedDomain.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.5 $
49 // $Date: 2006/01/10 00:33:09 $
50 // $Source: /usr/local/cvs/OpenSees/SRC/domain/domain/partitioned/PartitionedDomain.h,v $
51 
52 
53 // Written: fmk
54 // Created: Wed Sep 25 15:27:47: 1996
55 // Revision: A
56 //
57 // Description: This file contains the class definition for PartitionedDomain.
58 // PartitionedDomain is an abstract class. The class is responsible for holding
59 // and providing access to the Elements, Nodes, SFreedom_Constraints
60 // and MFreedom_Constraints just like a normal domain. In addition the domain provides
61 // a method to partition the domain into Subdomains.
62 //
63 // ModelBuilder. There are no partitions in a PartitionedDomain.
64 //
65 // What: "@(#) PartitionedDomain.h, revA"
66 
67 #ifndef PartitionedDomain_h
68 #define PartitionedDomain_h
69 
70 #include <domain/domain/Domain.h>
71 #include "solution/graph/graph/Graph.h"
72 
73 namespace XC {
74 class DomainPartitioner;
75 class Subdomain;
76 class SubdomainIter;
77 class ArrayOfTaggedObjects;
78 class PartitionedDomainSubIter;
79 class PartitionedDomainEleIter;
80 class SingleDomEleIter;
81 
92  {
93  private:
94  TaggedObjectStorage *elements;
95  ArrayOfTaggedObjects *theSubdomains;
96  DomainPartitioner *theDomainPartitioner;
97 
98  SingleDomEleIter *mainEleIter; // for ele that belong to elements
99  PartitionedDomainSubIter *theSubdomainIter;
100  PartitionedDomainEleIter *theEleIter;
101 
102  Graph mySubdomainGraph;
103  bool has_sent_yet;
104 
105  void alloc(void);
106  void free_mem(void);
107  protected:
108  int barrierCheck(int result);
109  DomainPartitioner *getPartitioner(void) const;
110  virtual int buildEleGraph(Graph &theEleGraph);
111  public:
112  PartitionedDomain(CommandEntity *owr,DataOutputHandler::map_output_handlers *oh);
113  PartitionedDomain(CommandEntity *owr,DomainPartitioner &thePartitioner,DataOutputHandler::map_output_handlers *oh);
114 
115  PartitionedDomain(CommandEntity *owr,int numNods, int numElems,
116  int numSPs, int numMPs, int numLPatterns, int numNLockers,
117  int numSubdom,
118  DomainPartitioner &thePartitioner,DataOutputHandler::map_output_handlers *oh);
119 
120  virtual ~PartitionedDomain(void);
121 
122  // public methods to populate a domain
123  virtual bool addElement(Element *elePtr);
124  virtual bool addNode(Node *nodePtr);
125 
126  virtual bool addLoadPattern(LoadPattern *);
128  virtual bool addSFreedom_Constraint(SFreedom_Constraint *, int loadPatternTag);
131  virtual bool addNodalLoad(NodalLoad *, int loadPatternTag);
132  virtual bool addElementalLoad(ElementalLoad *, int loadPatternTag);
133 
134  // methods to remove the components
135  virtual void clearAll(void);
136  virtual bool removeElement(int tag);
137  virtual bool removeNode(int tag);
138  virtual bool removeSFreedom_Constraint(int tag);
139  virtual bool removeMFreedom_Constraint(int tag);
140  virtual bool removeLoadPattern(int loadTag);
141 
142  // methods to access the elements
143  virtual ElementIter &getElements();
144  virtual Element *getElement(int tag);
145 
146  virtual int getNumElements(void) const;
147 
148  // public methods to update the domain
149  virtual void setCommitTag(int newTag);
150  virtual void setCurrentTime(double newTime);
151  virtual void setCommittedTime(double newTime);
152  virtual void applyLoad(double pseudoTime);
153  virtual void setLoadConstant(void);
154 
155  virtual int commit(void);
156  virtual int revertToLastCommit(void);
157  virtual int revertToStart(void);
158  virtual int update(void);
159  virtual int update(double newTime, double dT);
160  virtual int newStep(double dT);
161 
162  virtual int addRecorder(Recorder &theRecorder);
163  virtual int removeRecorders(void);
164 
165  virtual void Print(std::ostream &s, int flag =0) const;
166 
167  // public member functions in addition to the standard domain
168  virtual int setPartitioner(DomainPartitioner *thePartitioner);
169  virtual int partition(int numPartitions, bool usingMain = false, int mainPartitionID = 0);
170 
171  virtual bool addSubdomain(Subdomain *theSubdomain);
172  virtual int getNumSubdomains(void);
173  virtual Subdomain *getSubdomainPtr(int tag);
174  virtual SubdomainIter &getSubdomains(void);
175  virtual bool removeExternalNode(int tag);
176  virtual Graph &getSubdomainGraph(void);
177 
178  // nodal methods required in domain interface for parallel interprter
179  virtual double getNodeDisp(int nodeTag, int dof, int &errorFlag);
180  virtual int setMass(const Matrix &mass, int nodeTag);
181 
182  // friend classes
183  friend class PartitionedDomainEleIter;
184  };
185 } // end of XC namespace
186 
187 #endif
188 
189 
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:1440
virtual int addRecorder(Recorder &theRecorder)
Add the recorder to the partitioned domain.
Definition: PartitionedDomain.cpp:1231
virtual void Print(std::ostream &s, int flag=0) const
Print stuff.
Definition: PartitionedDomain.cpp:1291
virtual bool removeLoadPattern(int loadTag)
To remove the load case whose tag is given by tag.
Definition: PartitionedDomain.cpp:835
Domain enclosed in another domain.
Definition: Subdomain.h:102
Object that can partition and load balance a PartitionedDomain.
Definition: DomainPartitioner.h:88
virtual SubdomainIter & getSubdomains(void)
Return an iterator for the Subdomains of the PartitionedDomain.
Definition: PartitionedDomain.cpp:1418
virtual ElementIter & getElements()
Return an iterator to the element container.
Definition: PartitionedDomain.cpp:871
virtual int partition(int numPartitions, bool usingMain=false, int mainPartitionID=0)
Triggers the partition of the domain.
Definition: PartitionedDomain.cpp:1323
virtual bool addLoadPattern(LoadPattern *)
Add the load pattern to the domain.
Definition: PartitionedDomain.cpp:583
virtual Subdomain * getSubdomainPtr(int tag)
Return the Subdomain whose tag is given by tag.
Definition: PartitionedDomain.cpp:1409
virtual bool addElement(Element *elePtr)
To add the element pointed to by theElementPtr to the domain.
Definition: PartitionedDomain.cpp:202
An Recorder object is used in the program to store/restore information at each commit().
Definition: Recorder.h:87
virtual bool addNode(Node *nodePtr)
Adds the node pointed to by theNodePtr to the domain.
Definition: PartitionedDomain.cpp:265
Iterator over an element container.
Definition: ElementIter.h:74
virtual void setCommitTag(int newTag)
Set the committed tag to newTag.
Definition: PartitionedDomain.cpp:943
virtual int revertToStart(void)
Return the domain to its initial state and triggers the "restart" method for all the recorders...
Definition: PartitionedDomain.cpp:1195
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:1554
A load pattern is the spatial distribution as well as its variation in time of a specific set of forc...
Definition: LoadPattern.h:97
DomainPartitioner * getPartitioner(void) const
Return a pointer to the DomainPartitioner object associated with the PartitionedDomain.
Definition: PartitionedDomain.cpp:1427
virtual int setMass(const Matrix &mass, int nodeTag)
Set the mass matrix for the node identified by the argument.
Definition: PartitionedDomain.cpp:1703
virtual bool addSubdomain(Subdomain *theSubdomain)
Adds the subdomain pointed to by theSubdomainPtr to the domain.
Definition: PartitionedDomain.cpp:1386
virtual void setCommittedTime(double newTime)
Set the committed time to newTime.
Definition: PartitionedDomain.cpp:983
ArrayOfTaggedObjects is a storage class.
Definition: ArrayOfTaggedObjects.h:92
virtual bool addSFreedom_Constraint(SFreedom_Constraint *)
Adds the single point constraint pointed to by theSPptr to the domain.
Definition: PartitionedDomain.cpp:288
virtual void setCurrentTime(double newTime)
Sets the current pseudo-time of the domain.
Definition: PartitionedDomain.cpp:965
virtual int removeRecorders(void)
Remove recorders from the domain.
Definition: PartitionedDomain.cpp:1262
Base class for the finite elements.
Definition: Element.h:112
virtual bool addMFreedom_Constraint(MFreedom_Constraint *)
Adds the multiple freedom constraint pointed to by the argument.
Definition: PartitionedDomain.cpp:392
virtual bool removeSFreedom_Constraint(int tag)
To remove the SFreedom_Constraint whose tag is given by tag from the domain.
Definition: PartitionedDomain.cpp:765
Definition: SubdomainIter.h:71
virtual Graph & getSubdomainGraph(void)
This will create a new graph each time it is invoked; deleting the old graph.
Definition: PartitionedDomain.cpp:1564
virtual void applyLoad(double pseudoTime)
Applies the load to all the subdomains.
Definition: PartitionedDomain.cpp:925
Definition: PartitionedDomainEleIter.h:80
Single freedom constraint.
Definition: SFreedom_Constraint.h:85
Objet that can execute python scripts.
Definition: CommandEntity.h:40
virtual int update(void)
Updates the state of the domain.
Definition: PartitionedDomain.cpp:1015
virtual void setLoadConstant(void)
Set all the loads as constant.
Definition: PartitionedDomain.cpp:999
The Graph class provides the abstraction of a graph.
Definition: Graph.h:94
virtual bool removeElement(int tag)
Remove the element whose tag is given by tag.
Definition: PartitionedDomain.cpp:698
virtual int getNumSubdomains(void)
Return the number of Subdomains (partitions).
Definition: PartitionedDomain.cpp:1403
virtual int commit(void)
The partioned domain iterates through all the subdomains invoking {commit()} on them.
Definition: PartitionedDomain.cpp:1122
virtual bool addElementalLoad(ElementalLoad *, int loadPatternTag)
Adds a load over element to the pattern.
Definition: PartitionedDomain.cpp:652
virtual int revertToLastCommit(void)
Return the domain to its last committed state.
Definition: PartitionedDomain.cpp:1163
virtual bool addMRMFreedom_Constraint(MRMFreedom_Constraint *)
Adds to the domain a multi-freedom multi-retained node constraint.
Definition: PartitionedDomain.cpp:575
Multiple retained nodes constraint.
Definition: MRMFreedom_Constraint.h:59
virtual bool removeMFreedom_Constraint(int tag)
To remove the MFreedom_Constraint whose tag is given by tag.
Definition: PartitionedDomain.cpp:799
virtual Element * getElement(int tag)
Return the element identified by the argument.
Definition: PartitionedDomain.cpp:883
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Partitioned domain (aggregation of subdomains).
Definition: PartitionedDomain.h:91
virtual int getNumElements(void) const
Return the number of elements.
Definition: PartitionedDomain.cpp:912
Matrix of floats.
Definition: Matrix.h:111
Multi-freedom constraint.
Definition: MFreedom_Constraint.h:113
virtual ~PartitionedDomain(void)
Destructor.
Definition: PartitionedDomain.cpp:171
Definition: PartitionedDomainSubIter.h:73
Definition: SingleDomEleIter.h:72
Base class for loads over elements.
Definition: ElementalLoad.h:79
virtual bool removeNode(int tag)
Remove the node whose tag is given by tag.
Definition: PartitionedDomain.cpp:735
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:117
Mesh node.
Definition: Node.h:111
virtual void clearAll(void)
Removes all components from domain (nodes, elements, loads & constraints).
Definition: PartitionedDomain.cpp:177
PartitionedDomain(CommandEntity *owr, DataOutputHandler::map_output_handlers *oh)
Constructor.
Definition: PartitionedDomain.cpp:128
Load over a node.
Definition: NodalLoad.h:83
virtual bool addNodalLoad(NodalLoad *, int loadPatternTag)
Appends a nodal load to the pattern being passed as parameter.
Definition: PartitionedDomain.cpp:617
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:1679