xc
Subdomain.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.6 $
48 // $Date: 2005/11/30 23:47:00 $
49 // $Source: /usr/local/cvs/OpenSees/SRC/domain/subdomain/Subdomain.h,v $
50 
51 
52 #ifndef Subdomain_h
53 #define Subdomain_h
54 
55 // File: ~/domain/subdomain/Subdomain.h
56 //
57 // Written: fmk
58 // Created: 11/96
59 // Revision: A
60 // Revision: B 03/98 - revised to allow parallel model generation
61 //
62 // Description: This file contains the class definition for Subdomain.
63 // Subdomain is a container class.
64 //
65 // What: "@(#) Subdomain.h, revA"
66 
67 #include "domain/domain/Domain.h"
68 #include "domain/mesh/element/Element.h"
69 #include "utility/Timer.h"
70 #include "SubdomainNodIter.h"
71 
72 namespace XC {
73 class Node;
74 class ID;
75 class TaggedObjectStorage;
76 class DomainDecompositionAnalysis;
77 class PartitionedModelBuilder;
78 class EquiSolnAlgo;
79 class IncrementalIntegrator;
80 class LinearSOE;
81 class ConvergenceTest;
82 class FE_Element;
83 
87 //
89 //
101 class Subdomain: public Element, public Domain
102  {
103  private:
104  double realCost;
105  double cpuCost;
106  int pageCost;
107  Timer theTimer;
108  DomainDecompositionAnalysis *theAnalysis;
109  mutable ID *extNodes;
110  FE_Element *theFEele;
111 
112  SingleDomNodIter *internalNodeIter;
113  SingleDomNodIter *externalNodeIter;
114  SubdomainNodIter *theNodIter;
115 
116  PartitionedModelBuilder *thePartitionedModelBuilder;
117  static Matrix badResult;
118  protected:
119  virtual int buildMap(void) const;
120  mutable bool mapBuilt;
121  mutable ID *map;
122  mutable Vector *mappedVect;
123  mutable Matrix *mappedMatrix;
124 
125 
127  TaggedObjectStorage *internalNodes;
128  TaggedObjectStorage *externalNodes;
129 
130  DomainDecompositionAnalysis *getDDAnalysis(void);
131  public:
132  Subdomain(int tag,DataOutputHandler::map_output_handlers *oh,CommandEntity *owr);
133 
134  virtual ~Subdomain(void);
135 
136  // method added for parallel domain generation
137  virtual int buildSubdomain(int numSubdomains,PartitionedModelBuilder &theBuilder);
138 
139  // Domain methods which must be rewritten
140  virtual void clearAll(void);
141  virtual bool addNode(Node *);
142  virtual bool removeNode(int tag);
143  virtual NodeIter &getNodes(void);
144  virtual const Node *getNode(int tag) const;
145  virtual Node *getNode(int tag);
146  virtual NodePtrsWithIDs &getNodePtrs(void);
147  virtual const NodePtrsWithIDs &getNodePtrs(void) const;
148 
149  virtual bool hasNode(int tag);
150  virtual bool hasElement(int tag);
151 
152  virtual int getNumNodes(void) const;
153  virtual int commit(void);
154  virtual int revertToLastCommit(void);
155  virtual int revertToStart(void);
156  virtual int update(void);
157  virtual int update(double newTime, double dT);
158 
159 #ifdef _PARALLEL_PROCESSING
160  virtual int barrierCheckIN(void) {return 0;};
161  virtual int barrierCheckOUT(int) {return 0;};
162 #endif
163 
164  virtual void Print(std::ostream &s, int flag =0);
165 
166  // Domain type methods unique to a Subdomain
167  virtual NodeIter &getInternalNodeIter(void);
168  virtual NodeIter &getExternalNodeIter(void) const;
169  virtual bool addExternalNode(Node *);
170 
171  virtual void wipeAnalysis(void);
172  virtual void setDomainDecompAnalysis(DomainDecompositionAnalysis &theAnalysis);
173  virtual int setAnalysisAlgorithm(EquiSolnAlgo &theAlgorithm);
174  virtual int setAnalysisIntegrator(IncrementalIntegrator &theIntegrator);
175  virtual int setAnalysisLinearSOE(LinearSOE &theSOE);
176  virtual int setAnalysisConvergenceTest(ConvergenceTest &theTest);
177  virtual int invokeChangeOnAnalysis(void);
178 
179  // Element methods which must be written
180  virtual int getNumExternalNodes(void) const;
181  virtual const ID &getExternalNodes(void) const;
182  virtual int getNumDOF(void) const;
183 
184  virtual int commitState(void);
185 
186  virtual const Matrix &getTangentStiff(void);
187  virtual const Matrix &getInitialStiff(void);
188  virtual const Matrix &getDamp(void);
189  virtual const Matrix &getMass(void);
190 
191  virtual void zeroLoad(void);
192  virtual int addLoad(ElementalLoad *theLoad, double loadFactor);
193  virtual int addInertiaLoadToUnbalance(const Vector &accel);
194 
195  virtual const Vector &getResistingForce(void) const;
196  virtual const Vector &getResistingForceIncInertia(void) const;
197  virtual bool isSubdomain(void);
198  virtual int setRayleighDampingFactors(const RayleighDampingFactors &rF);
199 
200  // Element type methods unique to a subdomain
201  virtual int computeTang(void);
202  virtual int computeResidual(void);
203  virtual const Matrix &getTang(void);
204 
205  void setFE_ElementPtr(FE_Element *theFE_Ele);
206  virtual const Vector &getLastExternalSysResponse(void);
207  virtual int computeNodalResponse(void);
208  virtual int newStep(double deltaT);
209  virtual bool doesIndependentAnalysis(void);
210 
211  virtual int sendSelf(CommParameters &);
212  virtual int recvSelf(const CommParameters &);
213 
214  virtual double getCost(void);
215  };
216 } // end of XC namespace
217 
218 #endif
219 
220 
virtual int getNumExternalNodes(void) const
Returns the number of external nodes that have been successfully added to the subdomain as external n...
Definition: Subdomain.cpp:484
virtual const Matrix & getInitialStiff(void)
For this class does nothing but print an error message.
Definition: Subdomain.cpp:567
virtual int computeResidual(void)
The method first starts a Timer object running.
Definition: Subdomain.cpp:693
Float vector abstraction.
Definition: Vector.h:93
Domain enclosed in another domain.
Definition: Subdomain.h:101
virtual double getCost(void)
Return the current value of realCost.
Definition: Subdomain.cpp:855
virtual bool isSubdomain(void)
Return true.
Definition: Subdomain.cpp:660
virtual const Vector & getResistingForce(void) const
Return the Vector obtained from invoking getCondensedRHS() on the DomainDecompositionAnalysis object...
Definition: Subdomain.cpp:621
Definition: SingleDomNodIter.h:70
Linear system of equations.
Definition: LinearSOE.h:91
virtual int setRayleighDampingFactors(const RayleighDampingFactors &rF)
Set Rayleigh damping factors.
Definition: Subdomain.cpp:664
virtual const Vector & getLastExternalSysResponse(void)
Return the Vector obtained by calling getLastSysResponse() on the associated FE_Element.
Definition: Subdomain.cpp:756
virtual int getNumDOF(void) const
Returns the num of external dof associated with the subdomain.
Definition: Subdomain.cpp:541
Vector of integers.
Definition: ID.h:93
virtual int computeNodalResponse(void)
Set the nodal responses for the nodes in the subdomain.
Definition: Subdomain.cpp:788
virtual void Print(std::ostream &s, int flag=0)
Print stuff.
Definition: Subdomain.cpp:386
Subdomain(int tag, DataOutputHandler::map_output_handlers *oh, CommandEntity *owr)
Constructor.
Definition: Subdomain.cpp:103
Base class for the finite elements.
Definition: Element.h:109
virtual bool addNode(Node *)
Method to add a node to the subdomain.
Definition: Subdomain.cpp:172
virtual bool removeNode(int tag)
Remove a node from the subdomain.
Definition: Subdomain.cpp:240
Used when performing a domain decomposition analysis.
Definition: DomainDecompositionAnalysis.h:90
Iterator on the subdomain nodes.
Definition: SubdomainNodIter.h:79
virtual NodeIter & getInternalNodeIter(void)
Return an iterator to the internal nodes of the subdomain, nodes that are added using the addNode() c...
Definition: Subdomain.cpp:407
Measure of system resources.
Definition: Timer.h:91
virtual const Node * getNode(int tag) const
Return a pointer to the node identified by the argument.
Definition: Subdomain.cpp:283
virtual int commitState(void)
Invokes commit() on itself.
Definition: Subdomain.cpp:554
IncrementalIntegrator is an algorithmic class for setting up the finite element equations in an incre...
Definition: IncrementalIntegrator.h:96
virtual int getNumNodes(void) const
Returns the number of external and internal Nodes.
Definition: Subdomain.cpp:341
EquiSolnAlgo is an abstract base class, i.e.
Definition: EquiSolnAlgo.h:88
virtual ~Subdomain(void)
Destructor.
Definition: Subdomain.cpp:133
Rayleigh damping factors.
Definition: RayleighDampingFactors.h:58
virtual int commit(void)
invokes the base Domain classes commit() method.
Definition: Subdomain.cpp:346
convergence test.
Definition: ConvergenceTest.h:80
virtual int update(void)
Updates the state of the domain.
Definition: Subdomain.cpp:379
FE_Element * getFE_ElementPtr(void)
Return a pointer to the last FE_Element set using {setFE_ElementPtr}.
Definition: Subdomain.cpp:750
Node pointer container for elements.
Definition: NodePtrsWithIDs.h:45
virtual int computeTang(void)
The method first starts a Timer object running.
Definition: Subdomain.cpp:671
Finite element as seen by analysis.
Definition: FE_Element.h:107
The PartitionedModelBuilder class is an abstract class.
Definition: PartitionedModelBuilder.h:86
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
virtual bool addExternalNode(Node *)
A Method to add the node pointed to by the argument.
Definition: Subdomain.cpp:202
virtual void zeroLoad(void)
Zeroes the loads over the element.
Definition: Subdomain.cpp:601
Iterator over the nodes.
Definition: NodeIter.h:73
Communication parameters between processes.
Definition: CommParameters.h:65
Matrix of floats.
Definition: Matrix.h:108
virtual const Vector & getResistingForceIncInertia(void) const
Returns the resisting force vector including inertia forces.
Definition: Subdomain.cpp:644
virtual NodeIter & getExternalNodeIter(void) const
Return an itertor to the external nodes of the subdomain, nodes that have been added using the {addEx...
Definition: Subdomain.cpp:416
Base class for loads over elements.
Definition: ElementalLoad.h:77
virtual void clearAll(void)
Removes all components from domain (nodes, elements, loads & constraints).
Definition: Subdomain.cpp:144
virtual const Matrix & getDamp(void)
For this class does nothing but print an error message.
Definition: Subdomain.cpp:579
void setFE_ElementPtr(FE_Element *theFE_Ele)
Set the corresponding {FE_Element} to be that poited to by {theFEelePtr}.
Definition: Subdomain.cpp:743
virtual int recvSelf(const CommParameters &)
Receive itself.
Definition: Subdomain.cpp:836
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:116
Mesh node.
Definition: Node.h:110
virtual const ID & getExternalNodes(void) const
Returns an ID containing the tags of all nodes added to the subdomain as external nodes and have yet ...
Definition: Subdomain.cpp:489
virtual int revertToStart(void)
Return the domain to its initial state and triggers the "restart" method for all the recorders...
Definition: Subdomain.cpp:368
virtual int revertToLastCommit(void)
Return the domain to its last commited state.
Definition: Subdomain.cpp:357
virtual NodeIter & getNodes(void)
Return an iter to all nodes that have been added to the subdomain.
Definition: Subdomain.cpp:255
virtual int sendSelf(CommParameters &)
Send itself.
Definition: Subdomain.cpp:817
virtual const Matrix & getMass(void)
For this class does nothing but print an error message.
Definition: Subdomain.cpp:590
virtual void setDomainDecompAnalysis(DomainDecompositionAnalysis &theAnalysis)
Sets the corresponding DomainDecompositionAnalysis object to be {theAnalysis}.
Definition: Subdomain.cpp:435
virtual const Matrix & getTang(void)
Return the Matrix obtained from invoking getTangent() on the DomainDecompositionAnalysis object...
Definition: Subdomain.cpp:719