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