xc
LoadPattern.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.12 $
49 // $Date: 2005/11/22 19:44:22 $
50 // $Source: /usr/local/cvs/OpenSees/SRC/domain/load/pattern/LoadPattern.h,v $
51 
52 
53 #ifndef LoadPattern_h
54 #define LoadPattern_h
55 
56 // Written: fmk
57 // Created: 07/99
58 // Revision: A
59 //
60 // Purpose: This file contains the class definition for LoadPattern.
61 // LoadPattern is a concrete class
62 //
63 // What: "@(#) LoadPattern.h, revA"
64 
65 #include "NodeLocker.h"
66 #include "LoadContainer.h"
67 #include <utility/matrix/Vector.h>
68 
69 namespace XC {
70 class NodalLoad;
71 class TimeSeries;
72 class ElementalLoad;
73 class NodalLoadIter;
74 class ElementalLoadIter;
75 class GroundMotion;
76 class Vector;
77 class MapLoadPatterns;
78 
83 //
85 //
97 class LoadPattern: public NodeLocker
98  {
99  private:
100  std::string description;
101  double loadFactor;
102  double gamma_f;
103 
104  TimeSeries *theSeries;
105 
106  // storage objects for the loads.
107  LoadContainer theLoads;
108 
109  // AddingSensitivity:BEGIN //////////////////////////////////////
110  Vector randomLoads;
111  bool RVisRandomProcessDiscretizer;
112  // AddingSensitivity:END ////////////////////////////////////////
113 
114  void free(void);
115  protected:
116  bool isConstant;
117  DbTagData &getDbTagData(void) const;
118  int sendData(Communicator &comm);
119  int recvData(const Communicator &comm);
120  public:
121  LoadPattern(int tag= 0);
122  LoadPattern(int tag, int classTag); // for subclasses
123  virtual ~LoadPattern(void);
124 
125  // method to set the associated TimeSeries and Domain
126  const TimeSeries *getTimeSeries(void) const;
127  TimeSeries *getTimeSeries(void);
128  virtual void setTimeSeries(TimeSeries *theSeries);
129  virtual void setDomain(Domain *theDomain);
130  bool addToDomain(void);
131  void removeFromDomain(void);
132  virtual bool isActive(void) const;
133 
134  // methods to add loads
135  virtual bool addNodalLoad(NodalLoad *);
136  NodalLoad *newNodalLoad(const int &,const Vector &);
137  virtual bool addElementalLoad(ElementalLoad *);
139  ElementalLoad *newElementalLoad(const std::string &);
140  virtual bool addSFreedom_Constraint(SFreedom_Constraint *theSp);
141 
143  inline LoadContainer &getLoads(void)
144  { return theLoads; }
146  inline const LoadContainer &getLoads(void) const
147  { return theLoads; }
149  inline int getNumNodalLoads(void) const
150  { return theLoads.getNumNodalLoads(); }
152  inline int getNumElementalLoads(void) const
153  { return theLoads.getNumElementalLoads(); }
155  inline int getNumLoads(void) const
156  { return theLoads.getNumLoads(); }
157  bool empty(void) const;
158 
159  // methods to remove things (loads, time_series,...)
160  virtual void clearAll(void);
161  virtual void clearLoads(void);
162  virtual bool removeNodalLoad(int tag);
163  virtual bool removeElementalLoad(int tag);
164 
165  bool actsOn(const Node *) const;
166  void removeLoadsOn(const Node *);
167  void copyLoads(const Node *, const Node *);
168  bool actsOn(const Element *) const;
169  void removeLoadsOn(const Element *);
170  void copyLoads(const Element *, const Element *);
171 
172  // methods to apply loads
173  virtual void applyLoad(double pseudoTime = 0.0);
174  virtual void setLoadConstant(void);
175  inline void setIsConstant(const bool &b)
176  { isConstant= b; }
177  inline bool getIsConstant(void) const
178  { return isConstant; }
179 
180  const MapLoadPatterns *getMapLoadPatterns(void) const;
182  const std::string &getName(void) const;
183  std::string getFactoredName(void) const;
184  inline const std::string &getDescription(void) const
185  { return description; }
186  inline void setDescription(const std::string &d)
187  { description= d; }
188  virtual const double &getLoadFactor(void) const;
189  const double &GammaF(void) const;
190  double &GammaF(void);
191  void setGammaF(const double &);
192  LoadPattern &operator*=(const double &fact);
193  LoadPattern &operator/=(const double &fact);
194  // methods for o/p
195  boost::python::dict getPyDict(void) const;
196  void setPyDict(const boost::python::dict &);
197 
198  virtual int sendSelf(Communicator &);
199  virtual int recvSelf(const Communicator &);
200 
201  virtual void Print(std::ostream &s, int flag =0) const;
202 
203  virtual LoadPattern *getCopy(void);
204 
205  virtual int addMotion(GroundMotion &theMotion, int tag);
206  virtual GroundMotion *getMotion(int tag);
207 
208  // AddingSensitivity:BEGIN //////////////////////////////////////////
209  virtual void applyLoadSensitivity(double pseudoTime = 0.0);
210  virtual int setParameter(const std::vector<std::string> &argv, Parameter &param);
211  virtual int updateParameter(int parameterID, Information &info);
212  virtual int activateParameter(int parameterID);
213  virtual const Vector &getExternalForceSensitivity(int gradNumber);
214  // AddingSensitivity:END ///////////////////////////////////////////
215  };
216 
217 } // end of XC namespace
218 
219 #endif
220 
221 
222 
223 
224 
225 
226 
bool newElementalLoad(ElementalLoad *)
Appends the elemental load being passed as parameter.
Definition: LoadPattern.cpp:323
virtual int activateParameter(int parameterID)
Activates the parameter identified by parameterID.
Definition: LoadPattern.cpp:677
Float vector abstraction.
Definition: Vector.h:94
LoadContainer & getLoads(void)
Return the load container.
Definition: LoadPattern.h:143
int getNumNodalLoads(void) const
Return the number of nodal loads.
Definition: LoadPattern.h:149
const LoadContainer & getLoads(void) const
Return the load container.
Definition: LoadPattern.h:146
const double & GammaF(void) const
Returns the partial safety factor according to the load combination.
Definition: LoadPattern.cpp:463
Information about an element.
Definition: Information.h:81
void setGammaF(const double &)
Sets the partial safety factor according to the load combination.
Definition: LoadPattern.cpp:471
virtual bool addNodalLoad(NodalLoad *)
Adds the nodal load being passed as parameter.
Definition: LoadPattern.cpp:240
Communication parameters between processes.
Definition: Communicator.h:66
virtual bool removeElementalLoad(int tag)
Remove the load over element which tag is being passed as parameter.
Definition: LoadPattern.cpp:386
virtual const double & getLoadFactor(void) const
Returns the weighting factor obtained from the TimeSeries object.
Definition: LoadPattern.cpp:459
virtual void setLoadConstant(void)
Marks the LoadPattern as being constant.
Definition: LoadPattern.cpp:455
bool empty(void) const
Returns true if there is no loads nor constraints.
Definition: LoadPattern.cpp:231
Vector that stores the dbTags of the class members.
Definition: DbTagData.h:44
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: LoadPattern.cpp:510
int sendData(Communicator &comm)
Send members through the communicator argument.
Definition: LoadPattern.cpp:532
int recvData(const Communicator &comm)
Receives members through the communicator argument.
Definition: LoadPattern.cpp:545
int getNumLoads(void) const
Returns the total number of loads.
Definition: LoadContainer.cc:215
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 void setTimeSeries(TimeSeries *theSeries)
Set the time series for the pattern.
Definition: LoadPattern.cpp:170
virtual bool addElementalLoad(ElementalLoad *)
Adds the element load being passed as parameter.
Definition: LoadPattern.cpp:302
Base class for the finite elements.
Definition: Element.h:112
virtual void setDomain(Domain *theDomain)
Set the domain for the pattern loads.
Definition: LoadPattern.cpp:187
DbTagData & getDbTagData(void) const
Returns a vector to store the dbTags of the class members.
Definition: LoadPattern.cpp:490
virtual void clearLoads(void)
Deletes all loads.
Definition: LoadPattern.cpp:364
int getNumElementalLoads(void) const
Return the number of elemental loads.
Definition: LoadPattern.h:152
virtual void Print(std::ostream &s, int flag=0) const
Prints load pattern information.
Definition: LoadPattern.cpp:587
Single freedom constraint.
Definition: SFreedom_Constraint.h:85
Base class for ground motions.
Definition: GroundMotion.h:84
virtual LoadPattern * getCopy(void)
Virtual constructor.
Definition: LoadPattern.cpp:106
A LoadContainer object is used to to store loads on nodes and elements.
Definition: LoadContainer.h:78
int getNumLoads(void) const
Return the number of loads.
Definition: LoadPattern.h:155
void removeLoadsOn(const Node *)
Removes the given node from all the load patterns.
Definition: LoadPattern.cpp:398
const TimeSeries * getTimeSeries(void) const
Return the time series pointer (const version).
Definition: LoadPattern.cpp:162
LoadPattern(int tag=0)
Constructor.
Definition: LoadPattern.cpp:100
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: LoadPattern.cpp:497
virtual int sendSelf(Communicator &)
Sends object through the communicator argument.
Definition: LoadPattern.cpp:557
virtual void clearAll(void)
Deletes all loads, constraints AND pointer to time series.
Definition: LoadPattern.cpp:370
std::string getFactoredName(void) const
Returns the name of this load pattern multiplied by its partial safety factor.
Definition: LoadPattern.cpp:149
int getNumNodalLoads(void) const
Returns the number of nodal loadss.
Definition: LoadContainer.cc:197
Single freedom constraints that make part of a load pattern.
Definition: NodeLocker.h:45
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
NodalLoad * newNodalLoad(const int &, const Vector &)
Creates a nodal load.
Definition: LoadPattern.cpp:264
Load pattern container.
Definition: MapLoadPatterns.h:46
Time variation of loads.
Definition: TimeSeries.h:85
virtual bool removeNodalLoad(int tag)
Remove the nodal load which tag is being passed as parameter.
Definition: LoadPattern.cpp:378
virtual ~LoadPattern(void)
Destructor.
Definition: LoadPattern.cpp:115
LoadPattern & operator/=(const double &fact)
Divides the partial safety factor.
Definition: LoadPattern.cpp:482
void removeFromDomain(void)
Removes load.
Definition: LoadPattern.cpp:208
virtual int setParameter(const std::vector< std::string > &argv, Parameter &param)
Sets the value param to the parameter argv.
Definition: LoadPattern.cpp:629
bool addToDomain(void)
Apply load.
Definition: LoadPattern.cpp:194
virtual void applyLoad(double pseudoTime=0.0)
Apply the load for pseudo-time being passed as parameter.
Definition: LoadPattern.cpp:434
virtual bool addSFreedom_Constraint(SFreedom_Constraint *theSp)
Adds the constraint being passed as parameter.
Definition: LoadPattern.cpp:360
Parameter.
Definition: Parameter.h:68
virtual int recvSelf(const Communicator &)
Receives object through the communicator argument.
Definition: LoadPattern.cpp:572
Base class for loads over elements.
Definition: ElementalLoad.h:79
const MapLoadPatterns * getMapLoadPatterns(void) const
Returns a const pointer to the container of the load pattern.
Definition: LoadPattern.cpp:119
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:117
Mesh node.
Definition: Node.h:112
void copyLoads(const Node *, const Node *)
Copy the loads from the first node to the second one.
Definition: LoadPattern.cpp:404
bool actsOn(const Node *) const
Return true if the load pattern acts on the given node.
Definition: LoadPattern.cpp:394
virtual bool isActive(void) const
Return true if the load pattern is already added to the domain.
Definition: LoadPattern.cpp:221
LoadPattern & operator*=(const double &fact)
Multiplies the partial safety factor.
Definition: LoadPattern.cpp:475
Load over a node.
Definition: NodalLoad.h:83
const std::string & getName(void) const
Returns the name of this load pattern.
Definition: LoadPattern.cpp:141
virtual int updateParameter(int parameterID, Information &info)
Updates the parameter identified by parameterID with info.
Definition: LoadPattern.cpp:662
int getNumElementalLoads(void) const
Returns the number of elemental loadss.
Definition: LoadContainer.cc:206
bool isConstant
to indicate whether setConstant has been called
Definition: LoadPattern.h:116