xc
ShadowSubdomain.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: 2005/11/30 23:47:00 $
50 // $Source: /usr/local/cvs/OpenSees/SRC/domain/subdomain/ShadowSubdomain.h,v $
51 
52 
53 #ifndef ShadowSubdomain_h
54 #define ShadowSubdomain_h
55 
56 // Written: fmk
57 // Revision: A
58 //
59 // Description: This file contains the class definition for ShadowSubdomain.
60 // ShadowSubdomain is a container class. The class is responsible for holding
61 // and providing access to the Elements, Nodes, LoadCases, SFreedom_Constraints
62 // and MFreedom_Constraints that have been added to the ShadowSubdomain.
63 //
64 // What: "@(#) ShadowSubdomain.h, revA"
65 
66 #include "Subdomain.h"
67 #include <utility/actor/shadow/Shadow.h>
68 #include "utility/matrix/ID.h"
69 
70 namespace XC {
72 //
74 class ShadowSubdomain: public Shadow, public Subdomain
75  {
76  private:
77  mutable ID msgData;
78  ID theElements;
79  ID theNodes;
80  ID theExternalNodes;
81  ID theLoadCases;
82 
83  TaggedObjectStorage *theShadowSPs;
84  TaggedObjectStorage *theShadowMPs;
85  TaggedObjectStorage *theShadowLPs;
86 
87  int numDOF;
88  int numElements;
89  int numNodes;
90  int numExternalNodes;
91  int numSPs;
92  int numMPs;
93  int numLoadPatterns;
94 
95  bool buildRemote;
96  bool gotRemoteData;
97 
98  FE_Element *theFEele;
99 
100  mutable Vector *theVector; // for storing residual info
101  mutable Matrix *theMatrix; // for storing tangent info
102 
103  static char *shadowSubdomainProgram;
104 
105  static int count; // MHS
106  static int numShadowSubdomains;
107  static std::deque<ShadowSubdomain *> theShadowSubdomains;
108 
109  void free_vectors(void) const;
110  void alloc_vectors(const size_t &) const;
111  void resize_vectors(const size_t &) const;
112  void free_arrays(void);
113  void alloc_arrays(const size_t &,const size_t &);
114  protected:
115  virtual int buildMap(void) const;
116  virtual int buildEleGraph(Graph &theEleGraph);
117  virtual int buildNodeGraph(Graph &theNodeGraph);
118 
119  public:
120  ShadowSubdomain(int tag, MachineBroker &theMachineBroker, FEM_ObjectBroker &theObjectBroker,DataOutputHandler::map_output_handlers *oh,CommandEntity *owr);
121  ShadowSubdomain(int tag, Channel &, FEM_ObjectBroker &,DataOutputHandler::map_output_handlers *,CommandEntity *);
122  virtual ~ShadowSubdomain(void);
123 
124  // method added for parallel domain generation
125  virtual int buildSubdomain(int numSubdomains,
126  PartitionedModelBuilder &theBuilder);
127  virtual int getRemoteData(void);
128 
129  // Methods inherited from Domain, Subdomain and Element
130  // which must be rewritten
131 
132  virtual bool addElement(Element *);
133  virtual bool addNode(Node *);
134  virtual bool addExternalNode(Node *);
137  virtual bool addLoadPattern(LoadPattern *);
138  virtual bool addNodalLoad(NodalLoad *, int loadPattern);
139  virtual bool addElementalLoad(ElementalLoad *, int loadPattern);
140  virtual bool addSFreedom_Constraint(SFreedom_Constraint *, int loadPattern);
141 
142 
143  virtual bool hasNode(int tag);
144  virtual bool hasElement(int tag);
145 
146  virtual void clearAll(void);
147  virtual bool removeElement(int tag);
148  virtual bool removeNode(int tag);
149  virtual bool removeSFreedom_Constraint(int tag);
150  virtual bool removeMFreedom_Constraint(int tag);
151  virtual bool removeLoadPattern(int tag);
152  virtual bool removeNodalLoad(int tag, int loadPattern);
153  virtual bool removeElementalLoad(int tag, int loadPattern);
154  virtual bool removeSFreedom_Constraint(int tag, int loadPattern);
155 
156  virtual ElementIter &getElements();
157  virtual NodeIter &getNodes();
158  virtual NodeIter &getInternalNodeIter(void);
159  virtual NodeIter &getExternalNodeIter(void);
160 
161  virtual Element *getElementPtr(int tag);
162  virtual Node *getNodePtr(int tag);
163 
164  virtual int getNumElements(void) const;
165  virtual int getNumNodes(void) const;
166  virtual int getNumSPs(void) const;
167  virtual int getNumMPs(void) const;
168  virtual int getNumLoadPatterns(void) const;
169 
170  virtual Graph &getElementGraph(void);
171  virtual Graph &getNodeGraph(void);
172 
173  // methods to update the domain
174  virtual void setCommitTag(int newTag);
175  virtual void setCurrentTime(double newTime);
176  virtual void setCommittedTime(double newTime);
177  virtual void applyLoad(double pseudoTime);
178  virtual void setLoadConstant(void);
179 
180  virtual int update(void);
181  virtual int update(double newTime, double dT);
182  virtual int commit(void);
183  virtual int revertToLastCommit(void);
184  virtual int revertToStart(void);
185  virtual int barrierCheckIN(void);
186  virtual int barrierCheckOUT(int);
187 
188  virtual int setRayleighDampingFactors(const RayleighDampingFactors &rF);
189 
190  virtual int addRecorder(Recorder &theRecorder);
191  virtual int removeRecorders(void);
192 
193  virtual void wipeAnalysis(void);
194  virtual void setDomainDecompAnalysis(DomainDecompositionAnalysis &theAnalysis);
195  virtual int setAnalysisAlgorithm(EquiSolnAlgo &theAlgorithm);
196  virtual int setAnalysisIntegrator(IncrementalIntegrator &theIntegrator);
197  virtual int setAnalysisLinearSOE(LinearSOE &theSOE);
198  virtual int setAnalysisConvergenceTest(ConvergenceTest &theTest);
199  virtual void clearAnalysis(void);
200  virtual void domainChange(void);
201 
202  virtual int getNumExternalNodes(void) const;
203  virtual const ID &getExternalNodes(void) const;
204  virtual int getNumDOF(void) const;
205 
206  virtual const Matrix &getTang(void);
207  virtual const Vector &getResistingForce(void) const;
208 
209  virtual int computeTang(void);
210  virtual int computeResidual(void);
211 
212  const Vector &getLastExternalSysResponse(void);
213  virtual int computeNodalResponse(void);
214  virtual int newStep(double deltaT);
215 
216  virtual int sendSelf(Communicator &);
217  virtual int recvSelf(const Communicator &);
218 
219  virtual double getCost(void);
220 
221  virtual void Print(std::ostream &s, int flag =0) const;
222 
223  // nodal methods required in domain interface for parallel interprter
224  virtual double getNodeDisp(int nodeTag, int dof, int &errorFlag);
225  virtual int setMass(const Matrix &mass, int nodeTag);
226  };
227 } // end of XC namespace
228 
229 #endif
virtual int computeResidual(void)
The method first starts a Timer object running.
Definition: ShadowSubdomain.cpp:1127
virtual void applyLoad(double pseudoTime)
Apply the loads for the given time pseudoTime.
Definition: ShadowSubdomain.cpp:785
virtual int setRayleighDampingFactors(const RayleighDampingFactors &rF)
Set Rayleigh damping factors.
Definition: ShadowSubdomain.cpp:881
virtual int sendSelf(Communicator &)
Send itself.
Definition: ShadowSubdomain.cpp:1217
virtual double getCost(void)
Return the current value of realCost.
Definition: ShadowSubdomain.cpp:1203
Float vector abstraction.
Definition: Vector.h:94
Domain enclosed in another domain.
Definition: Subdomain.h:102
virtual bool removeElementalLoad(int tag, int loadPattern)
Removes the elemental load from container.
Definition: ShadowSubdomain.cpp:620
virtual int computeTang(void)
The method first starts a Timer object running.
Definition: ShadowSubdomain.cpp:1101
virtual bool removeLoadPattern(int tag)
Remove from domain el load pattern identified by the argument.
Definition: ShadowSubdomain.cpp:586
Communication parameters between processes.
Definition: Communicator.h:66
virtual bool addElementalLoad(ElementalLoad *, int loadPattern)
Adds a load over element to the pattern.
Definition: ShadowSubdomain.cpp:451
Linear system of equations.
Definition: LinearSOE.h:92
virtual NodeIter & getInternalNodeIter(void)
Return an iterator to the internal nodes of the subdomain, nodes that are added using the addNode() c...
Definition: ShadowSubdomain.cpp:685
virtual int buildNodeGraph(Graph &theNodeGraph)
Builds the node graph.
Definition: ShadowSubdomain.cpp:1250
virtual int commit(void)
invokes the base Domain classes commit() method.
Definition: ShadowSubdomain.cpp:921
An Recorder object is used in the program to store/restore information at each commit().
Definition: Recorder.h:87
Iterator over an element container.
Definition: ElementIter.h:74
virtual int getNumDOF(void) const
Returns the num of external dof associated with the subdomain.
Definition: ShadowSubdomain.cpp:1057
virtual int addRecorder(Recorder &theRecorder)
Adds a recorder to the model.
Definition: ShadowSubdomain.cpp:905
virtual const Matrix & getTang(void)
Return the Matrix obtained from invoking getTangent() on the DomainDecompositionAnalysis object...
Definition: ShadowSubdomain.cpp:1067
virtual bool removeSFreedom_Constraint(int tag)
Removes from domain the single freedom constraint identified by the argument.
Definition: ShadowSubdomain.cpp:560
FEM_ObjectBroker is is an object broker class for the finite element method.
Definition: FEM_ObjectBroker.h:151
virtual Graph & getElementGraph(void)
Builds (if necessary) the domain elements graph and returns a reference to it.
Definition: ShadowSubdomain.cpp:764
Vector of integers.
Definition: ID.h:95
virtual bool removeNode(int tag)
Remove a node from the subdomain.
Definition: ShadowSubdomain.cpp:524
const Vector & getLastExternalSysResponse(void)
Return the Vector obtained by calling getLastSysResponse() on the associated FE_Element.
Definition: ShadowSubdomain.cpp:1154
A load pattern is the spatial distribution as well as its variation in time of a specific set of forc...
Definition: LoadPattern.h:97
virtual int revertToLastCommit(void)
Return the domain to its last committed state.
Definition: ShadowSubdomain.cpp:932
Base class for the finite elements.
Definition: Element.h:112
virtual void clearAll(void)
Removes all components from domain (nodes, elements, loads & constraints).
Definition: ShadowSubdomain.cpp:897
virtual void setLoadConstant(void)
Set all the loads as constant.
Definition: ShadowSubdomain.cpp:831
virtual bool addElement(Element *)
Adds to the domain the element being passed as parameter.
Definition: ShadowSubdomain.cpp:267
virtual int getNumNodes(void) const
Returns the number of external and internal Nodes.
Definition: ShadowSubdomain.cpp:753
Used when performing a domain decomposition analysis.
Definition: DomainDecompositionAnalysis.h:91
virtual bool addLoadPattern(LoadPattern *)
Appends the load pattern to the domain.
Definition: ShadowSubdomain.cpp:379
Local object associated with an remote actor.
Definition: Shadow.h:91
virtual bool removeMFreedom_Constraint(int tag)
Removes from domain the multi-freedom constraint identified by the argument.
Definition: ShadowSubdomain.cpp:573
Single freedom constraint.
Definition: SFreedom_Constraint.h:85
Objet that can execute python scripts.
Definition: CommandEntity.h:40
The Graph class provides the abstraction of a graph.
Definition: Graph.h:94
IncrementalIntegrator is an algorithmic class for setting up the finite element equations in an incre...
Definition: IncrementalIntegrator.h:100
Local representation of a remote subdomain.
Definition: ShadowSubdomain.h:74
virtual int buildEleGraph(Graph &theEleGraph)
Builds the element graph.
Definition: ShadowSubdomain.cpp:1243
virtual int update(void)
Updates the state of the domain.
Definition: ShadowSubdomain.cpp:839
Channel is an abstract base class which defines the channel interface.
Definition: Channel.h:92
Base class for solution algorithms.
Definition: EquiSolnAlgo.h:91
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: ShadowSubdomain.cpp:1265
virtual bool addExternalNode(Node *)
A Method to add the node pointed to by the argument.
Definition: ShadowSubdomain.cpp:319
virtual const Vector & getResistingForce(void) const
Return the Vector obtained from invoking getCondensedRHS() on the DomainDecompositionAnalysis object...
Definition: ShadowSubdomain.cpp:1084
Rayleigh damping factors.
Definition: RayleighDampingFactors.h:59
A MachineBroker is responsible for getting an actor process running on the parallel machine...
Definition: MachineBroker.h:77
convergence test.
Definition: ConvergenceTest.h:81
virtual ElementIter & getElements()
Returns an iterator to the element container.
Definition: ShadowSubdomain.cpp:665
virtual void setCommittedTime(double newTime)
Set the committed time to newTime.
Definition: ShadowSubdomain.cpp:821
virtual int computeNodalResponse(void)
Set the nodal responses for the nodes in the subdomain.
Definition: ShadowSubdomain.cpp:1164
virtual Graph & getNodeGraph(void)
Builds (if necessary) the domain node graph and returns a reference to it.
Definition: ShadowSubdomain.cpp:774
virtual void setDomainDecompAnalysis(DomainDecompositionAnalysis &theAnalysis)
Sets the corresponding DomainDecompositionAnalysis object to be {theAnalysis}.
Definition: ShadowSubdomain.cpp:964
Finite element as seen by analysis.
Definition: FE_Element.h:108
virtual int revertToStart(void)
Return the domain to its initial state and triggers the "restart" method for all the recorders...
Definition: ShadowSubdomain.cpp:943
The PartitionedModelBuilder class is an abstract class.
Definition: PartitionedModelBuilder.h:87
virtual void setCommitTag(int newTag)
Set the committed tag to newTag.
Definition: ShadowSubdomain.cpp:800
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
virtual bool addNodalLoad(NodalLoad *, int loadPattern)
Appends a nodal load to the pattern being passed as parameter.
Definition: ShadowSubdomain.cpp:426
virtual int getNumExternalNodes(void) const
Returns the number of external nodes that have been successfully added to the subdomain as external n...
Definition: ShadowSubdomain.cpp:1038
Iterator over the nodes.
Definition: NodeIter.h:74
Matrix of floats.
Definition: Matrix.h:111
Multi-freedom constraint.
Definition: MFreedom_Constraint.h:113
virtual bool addNode(Node *)
Method to add a node to the subdomain.
Definition: ShadowSubdomain.cpp:299
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: ShadowSubdomain.cpp:1048
virtual int setMass(const Matrix &mass, int nodeTag)
Set the mass matrix for the node identified by the argument.
Definition: ShadowSubdomain.cpp:1281
virtual bool removeNodalLoad(int tag, int loadPattern)
Removes the nodal load from container.
Definition: ShadowSubdomain.cpp:600
virtual int recvSelf(const Communicator &)
Receive itself.
Definition: ShadowSubdomain.cpp:1224
Base class for loads over elements.
Definition: ElementalLoad.h:79
virtual bool removeElement(int tag)
Remove the element identified by the argument.
Definition: ShadowSubdomain.cpp:493
Mesh node.
Definition: Node.h:111
virtual bool addMFreedom_Constraint(MFreedom_Constraint *)
Adds to the domain a multi-freedom constraint.
Definition: ShadowSubdomain.cpp:361
virtual int getNumElements(void) const
Return the number of elements.
Definition: ShadowSubdomain.cpp:747
virtual int removeRecorders(void)
Remove the recorders.
Definition: ShadowSubdomain.cpp:914
virtual bool addSFreedom_Constraint(SFreedom_Constraint *)
Adds a single freedom constraint to the domain.
Definition: ShadowSubdomain.cpp:342
virtual void setCurrentTime(double newTime)
Set the current time to newTime.
Definition: ShadowSubdomain.cpp:808
Load over a node.
Definition: NodalLoad.h:83
virtual void Print(std::ostream &s, int flag=0) const
Print stuff.
Definition: ShadowSubdomain.cpp:1232
virtual void domainChange(void)
Sets a flag indicating that the integer returned in the next call to hasDomainChanged() must be incre...
Definition: ShadowSubdomain.cpp:1024
virtual NodeIter & getNodes()
Return an iter to all nodes that have been added to the subdomain.
Definition: ShadowSubdomain.cpp:675