XC Open source finite element analysis program
LoadCombination.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 //LoadCombination.h
28 
29 #ifndef LOADCOMBINATION_H
30 #define LOADCOMBINATION_H
31 
32 #include "domain/component/ForceReprComponent.h"
33 
34 namespace XC {
35 class MapLoadPatterns;
36 class LoadPattern;
37 class LoadLoader;
38 class LoadCombinationGroup;
39 
41 //
44  {
45  LoadLoader *loader;
46  class sumando: public EntCmd
48  {
49  float factor;
50  LoadPattern *lpattern;
51  void neg(void);
52  public:
53  sumando(const float &f= 1.0,LoadPattern *lp= nullptr);
55  const float &Factor(void) const;
56  const LoadPattern *Caso(void) const;
57  LoadPattern *Caso(void);
58  const std::string &getNombreCaso(const MapLoadPatterns &lps) const;
59 
60  sumando getNeg(void) const;
61  const sumando &suma(const sumando &otro);
62  const sumando &resta(const sumando &otro);
63  const sumando &multiplica(const float &otro);
64  const sumando &divide(const float &otro);
65 
66  std::string getString(const MapLoadPatterns &,const std::string &fmt) const;
67  void Print(std::ostream &os) const;
68 
69  };
70  public:
71  typedef std::deque<sumando> TDescomp;
72  typedef TDescomp::iterator iterator;
73  typedef TDescomp::const_iterator const_iterator;
74  private:
75  std::string nombre;
76  TDescomp descomp;
77  //used only to receive data.
78  static std::map<int,std::string> map_str_descomp;
79  protected:
80  void set_gamma_f(void);
81  void set_domain(void);
82  friend class Domain;
83  friend class FEM_ObjectBroker;
84  void add_component(const sumando &);
85  void interpreta_descomp(const std::string &str);
86  void limpia_ceros(void);
87  void clear(void);
88  const_iterator buscaCaso(const LoadPattern *) const;
89  iterator buscaCaso(const LoadPattern *);
90 
91  iterator begin(void)
92  { return descomp.begin(); }
93  iterator end(void)
94  { return descomp.end(); }
95 
96  LoadCombination &suma(const LoadCombination &otro);
98 
99  DbTagData &getDbTagData(void) const;
100  int sendData(CommParameters &cp);
101  int recvData(const CommParameters &cp);
102  int recvDescomp(void);
103 
104 
105  friend class LoadCombinationGroup;
106  LoadCombination(LoadCombinationGroup *owr= nullptr,const std::string &nmb= "",int tag= 0,LoadLoader *ll= nullptr);
107  inline void setNombre(const std::string &nmb)
108  { nombre= nmb;}
109  inline void setLoader(LoadLoader *ll)
110  { loader= ll; }
111 
112  public:
113  ~LoadCombination(void);
114 
115  virtual void setDomain(Domain *theDomain);
116  bool addToDomain(void);
117  void removeFromDomain(void);
118 
119  inline const std::string &getNombre(void) const
120  { return nombre; }
121 
122  inline void setDescomp(const std::string &descomp)
123  { interpreta_descomp(descomp); }
124 
125  const LoadCombinationGroup *getGrupo(void) const;
127 
128  const_iterator begin(void) const
129  { return descomp.begin(); }
130  const_iterator end(void) const
131  { return descomp.end(); }
132  size_t size(void) const
133  { return descomp.size(); }
134  bool empty(void) const
135  { return descomp.empty(); }
136 
137  float getCoefCaso(const LoadPattern *) const;
138 
139  LoadCombination &multiplica(const float &otro);
140  LoadCombination &divide(const float &otro);
141  LoadCombination &suma(const std::string &);
142  LoadCombination &resta(const std::string &);
143  LoadCombination &asigna(const std::string &);
144  inline LoadCombination &operator+=(const LoadCombination &c)
145  { return suma(c); }
146  LoadCombination &operator-=(const LoadCombination &c)
147  { return resta(c); }
148  LoadCombination &operator*=(const float &f)
149  { return multiplica(f); }
150  LoadCombination &operator/=(const float &f)
151  { return divide(f); }
154  LoadCombination operator*(const float &) const;
155  LoadCombination operator/(const float &) const;
156  bool operator==(const LoadCombination &) const;
157  bool operator!=(const LoadCombination &) const;
158  bool dominaA(const LoadCombination &otra) const;
159 
160  const LoadCombination *getPtrCombPrevia(void) const;
161  const std::string getNombreCombPrevia(void) const;
162  int getTagCombPrevia(void) const;
163  const std::string getDescompCombPrevia(void) const;
164  const std::string getDescompRestoSobrePrevia(void) const;
165 
166  int sendSelf(CommParameters &);
167  int recvSelf(const CommParameters &);
168 
169  std::string getString(const std::string &fmt= "") const;
170  virtual void Print(std::ostream &s, int flag =0) const;
171 
172  };
173 
174 std::ostream &operator<<(std::ostream &os,const LoadCombination &);
175 
176 } // end of XC namespace
177 
178 #endif
A LoadPattern object is used to to store reference loads and single point constraints and a TimeSerie...
Definition: LoadPattern.h:87
int recvSelf(const CommParameters &)
Receives object through the channel being passed as parameter.
Definition: LoadCombination.cc:441
LoadCombination operator-(const LoadCombination &) const
Substraction operator.
Definition: LoadCombination.cc:549
const std::string getDescompCombPrevia(void) const
Returns, if possible, the decomposition of the "previous" combination.
Definition: LoadCombination.cc:353
int recvDescomp(void)
Returns the combination decomposition (it must be called only after setting un the object&#39;s owner and...
Definition: LoadCombination.cc:417
LoadCombination & suma(const LoadCombination &otro)
Sums the combination being passed as parameter.
Definition: LoadCombination.cc:454
const LoadCombinationGroup * getGrupo(void) const
Returns the group to wich the combination belongs.
Definition: LoadCombination.cc:314
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:98
virtual void Print(std::ostream &s, int flag=0) const
Imprime.
Definition: LoadCombination.cc:674
Vector que almacena los dbTags de los miembros de la clase.
Definition: DbTagData.h:43
virtual void setDomain(Domain *theDomain)
Asigna a pointer al domain.
LoadCombination operator/(const float &) const
Division by a number operator.
Definition: LoadCombination.cc:565
void limpia_ceros(void)
Deletes the null weighted load combinations.
Definition: LoadCombination.cc:304
void add_component(const sumando &)
Adds a component to the combination.
Definition: LoadCombination.cc:226
LoadCombination operator*(const float &) const
Product by a number operator.
Definition: LoadCombination.cc:557
Load pattern combination (1.5*PP+1.0*CP+1.6*SC ...).
Definition: LoadCombination.h:43
void interpreta_descomp(const std::string &str)
Computes the combination from the string being passed as parameter.
Definition: LoadCombination.cc:240
FEM_ObjectBroker is is an object broker class for the finite element method. All methods are virtual ...
Definition: FEM_ObjectBroker.h:138
Base class for components that represent forces.
Definition: ForceReprComponent.h:37
std::deque< sumando > TDescomp
Container type for the combination expression (1.5*PP+1.0*CP+1.6*SC ...).
Definition: LoadCombination.h:71
bool dominaA(const LoadCombination &otra) const
Returns true if the factors that weight all the load patterns of this load combination are greater th...
Definition: LoadCombination.cc:620
LoadCombination & resta(const LoadCombination &otro)
Substracts the combination being passed as parameter.
Definition: LoadCombination.cc:480
LoadCombination & asigna(const std::string &)
Assigns the combination identified by the name being passed as parameter.
Definition: LoadCombination.cc:505
Load pattern container.
Definition: MapLoadPatterns.h:45
int recvData(const CommParameters &cp)
Receives members through the channel being passed as parameter.
Definition: LoadCombination.cc:401
Load combination container.
Definition: LoadCombinationGroup.h:46
int sendSelf(CommParameters &)
Sends object through the channel being passed as parameter.
Definition: LoadCombination.cc:429
bool addToDomain(void)
Adds to the domain being passed as parameter each of the load cases of the combination.
Definition: LoadCombination.cc:180
int getTagCombPrevia(void) const
Returns, if possible, the tag of the "previous" combination.
Definition: LoadCombination.cc:343
LoadCombination & multiplica(const float &otro)
Multiplies the combination by the number being passed as parameter.
Definition: LoadCombination.cc:521
const std::string getDescompRestoSobrePrevia(void) const
Returns, si puede, la diferencia entre esta y la previa.
Definition: LoadCombination.cc:363
float getCoefCaso(const LoadPattern *) const
Returns the weighting factor for the load case being passed as parameter.
Definition: LoadCombination.cc:574
const_iterator buscaCaso(const LoadPattern *) const
Returns a const iterator pointing to the load pattern being passed as parameter.
Definition: LoadCombination.cc:274
LoadCombination & divide(const float &otro)
Divides the combination by the number being passed as parameter.
Definition: LoadCombination.cc:533
const LoadCombination * getPtrCombPrevia(void) const
Returns, if possible, a pointer to the "previous" combination.
Definition: LoadCombination.cc:323
LoadCombination(LoadCombinationGroup *owr=nullptr, const std::string &nmb="", int tag=0, LoadLoader *ll=nullptr)
Constructor.
Definition: LoadCombination.cc:141
LoadCombination operator+(const LoadCombination &) const
Addition operator.
Definition: LoadCombination.cc:541
const std::string getNombreCombPrevia(void) const
Returns, if possible, the name of the "previous" combination.
Definition: LoadCombination.cc:333
Lee load patterns desde archivo. Load definition manager.
Definition: LoadLoader.h:44
DbTagData & getDbTagData(void) const
Returns a vector para almacenar los dbTags de los miembros de la clase.
Definition: LoadCombination.cc:385
Communication parameters between processes.
Definition: CommParameters.h:65
int sendData(CommParameters &cp)
Send members through the channel being passed as parameter.
Definition: LoadCombination.cc:392
================================================================================
Definition: ContinuaReprComponent.h:34
std::string getString(const std::string &fmt="") const
Returns a string that represents the load combination «1.35*G1+0.90*G1».
Definition: LoadCombination.cc:658
~LoadCombination(void)
Destructor.
Definition: LoadCombination.cc:146
void clear(void)
Deletes the components of the load combination.
Definition: LoadCombination.cc:300
void set_domain(void)
Assigns the domain to each domain.
Definition: LoadCombination.cc:164
void removeFromDomain(void)
Removes from the domain being passed as parameter the load cases of the combination.
Definition: LoadCombination.cc:210