xc
LoadPatternCombination.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 //LoadPatternCombination.h
29 
30 #ifndef LOADPATTERNCOMBINATION_H
31 #define LOADPATTERNCOMBINATION_H
32 
33 #include "domain/component/ForceReprComponent.h"
34 
35 namespace XC {
36 class MapLoadPatterns;
37 class LoadPattern;
38 class LoadHandler;
39 class LoadCombinationGroup;
40 
42 //
46  {
47  protected:
48  std::string name;
50  //used only to receive data.
51  static std::map<int,std::string> map_str_descomp;
52 
54  class summand: public CommandEntity
55  {
56  float factor;
57  LoadPattern *lpattern;
58  void neg(void);
59  public:
60  summand(const float &f= 1.0,LoadPattern *lp= nullptr);
62  const float &getFactor(void) const;
63  const LoadPattern *getLoadPattern(void) const;
65  const std::string &getLoadPatternName(const MapLoadPatterns &lps) const;
66 
67  bool set_gamma_f(void);
68  summand getNeg(void) const;
69  const summand &add(const summand &);
70  const summand &subtract(const summand &);
71  const summand &multiplica(const float &);
72  const summand &divide(const float &);
73 
74  std::string getString(const MapLoadPatterns &,const std::string &fmt) const;
75  void Print(std::ostream &os) const;
76 
77  };
78  public:
79  typedef std::deque<summand> TDescomp;
80  typedef TDescomp::iterator iterator;
81  typedef TDescomp::const_iterator const_iterator;
82  protected:
83  TDescomp descomp;
84 
85  void set_gamma_f(TDescomp &);
86  void set_domain(void);
87 
88  void clear(void);
89  void add_component(const summand &);
90  bool interpreta_descomp(const std::string &str);
91  void limpia_ceros(void);
92  const_iterator findLoadPattern(const LoadPattern *) const;
93  iterator findLoadPattern(const LoadPattern *);
94 
95  DbTagData &getDbTagData(void) const;
96  int sendData(Communicator &comm);
97  int recvData(const Communicator &comm);
98 
99  iterator begin(void)
100  { return descomp.begin(); }
101  iterator end(void)
102  { return descomp.end(); }
103 
104  inline void setNombre(const std::string &nm)
105  { name= nm;}
106  bool add_to_domain(TDescomp &);
107  public:
108  LoadPatternCombination(int tag= 0,int classTag= LOAD_TAG_LoadPatternCombination,const std::string &nm= "", LoadHandler *ll= nullptr);
110  inline void setHandler(LoadHandler *ll)
111  { handler= ll; }
112 
113  inline const std::string &getName(void) const
114  { return name; }
115 
116  virtual void setDomain(Domain *theDomain);
117 
118  bool addToDomain(void);
119  bool addToDomain(const std::set<std::string> &filter);
120  bool addToDomain(boost::python::list &filter);
121  bool isActive(void) const;
122  void removeFromDomain(void);
123 
124  inline bool setDescomp(const std::string &descomp)
125  { return interpreta_descomp(descomp); }
126 
127  float getLoadPatternFactor(const LoadPattern *) const;
128 
129  const_iterator begin(void) const
130  { return descomp.begin(); }
131  const_iterator end(void) const
132  { return descomp.end(); }
133  size_t size(void) const
134  { return descomp.size(); }
135  bool empty(void) const
136  { return descomp.empty(); }
137 
138  std::string getString(const std::string &fmt= "") const;
139  boost::python::dict getPyDict(void) const;
140  void setPyDict(const boost::python::dict &);
141  virtual void Print(std::ostream &s, int flag =0) const;
142 
143  };
144 
145 std::ostream &operator<<(std::ostream &os,const LoadPatternCombination &);
146 
147 } // end of XC namespace
148 
149 #endif
int sendData(Communicator &comm)
Send members through the communicator argument.
Definition: LoadPatternCombination.cc:446
boost::python::dict getPyDict(void) const
Return a Python dictionary containing the object members values.
Definition: EntityWithProperties.cc:126
void Print(std::ostream &os) const
Imprime.
Definition: LoadPatternCombination.cc:146
Communication parameters between processes.
Definition: Communicator.h:66
Base class for components that represent forces.
Definition: ForceReprComponent.h:39
summand getNeg(void) const
Returns the summand with sign changed.
Definition: LoadPatternCombination.cc:88
void limpia_ceros(void)
Deletes the null weighted load combinations.
Definition: LoadPatternCombination.cc:256
bool set_gamma_f(void)
Assigns the weightings for the load pattern.
Definition: LoadPatternCombination.cc:68
LoadHandler * handler
Pointer to the load case manager.
Definition: LoadPatternCombination.h:49
const summand & add(const summand &)
Add to this summand the argument.
Definition: LoadPatternCombination.cc:96
const LoadPattern * getLoadPattern(void) const
Returns the LoadPattern corresponding to the summand.
Definition: LoadPatternCombination.cc:56
summand(const float &f=1.0, LoadPattern *lp=nullptr)
constructor.
Definition: LoadPatternCombination.cc:48
Each of the terms (factor*LoadPattern) of the combination.
Definition: LoadPatternCombination.h:54
Vector that stores the dbTags of the class members.
Definition: DbTagData.h:44
A load pattern is the spatial distribution as well as its variation in time of a specific set of forc...
Definition: LoadPattern.h:97
const summand & divide(const float &)
Divides the summand by the value being passed as parameter.
Definition: LoadPatternCombination.cc:125
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: EntityWithProperties.cc:153
const_iterator findLoadPattern(const LoadPattern *) const
Returns a const iterator pointing to the load pattern being passed as parameter.
Definition: LoadPatternCombination.cc:230
float getLoadPatternFactor(const LoadPattern *) const
Returns the weighting factor for the load case being passed as parameter.
Definition: LoadPatternCombination.cc:428
void add_component(const summand &)
Adds a component to the combination.
Definition: LoadPatternCombination.cc:170
const summand & multiplica(const float &)
Multiplies the summand by the value being passed as parameter.
Definition: LoadPatternCombination.cc:118
bool interpreta_descomp(const std::string &str)
Computes the combination from the string being passed as parameter.
Definition: LoadPatternCombination.cc:185
bool isActive(void) const
Return true if the combination is fully added to the domain.
Definition: LoadPatternCombination.cc:359
~LoadPatternCombination(void)
Destructor.
Definition: LoadPatternCombination.cc:162
void removeFromDomain(void)
Removes from the domain being passed as parameter the load cases of the combination.
Definition: LoadPatternCombination.cc:393
Objet that can execute python scripts.
Definition: CommandEntity.h:40
bool addToDomain(void)
Adds to the domain each of the load cases of the combination.
Definition: LoadPatternCombination.cc:326
LoadPatternCombination(int tag=0, int classTag=LOAD_TAG_LoadPatternCombination, const std::string &nm="", LoadHandler *ll=nullptr)
Constructor.
Definition: LoadPatternCombination.cc:157
bool add_to_domain(TDescomp &)
Adds to the domain the load patterns in the argument deque.
Definition: LoadPatternCombination.cc:296
DbTagData & getDbTagData(void) const
Returns a vector to store the dbTags de los miembros of the clase.
Definition: LoadPatternCombination.cc:439
std::deque< summand > TDescomp
Container type for the combination expression (1.5*PP+1.0*CP+1.6*SC ...).
Definition: LoadPatternCombination.h:79
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Load pattern container.
Definition: MapLoadPatterns.h:46
std::string getString(const MapLoadPatterns &, const std::string &fmt) const
Returns a string representation of the combination i.e.
Definition: LoadPatternCombination.cc:134
void set_domain(void)
Assigns the domain to each domain.
Definition: LoadPatternCombination.cc:273
const float & getFactor(void) const
Returns the factor that multiplies the load pattern.
Definition: LoadPatternCombination.cc:52
Load definition manager.
Definition: LoadHandler.h:45
void clear(void)
Deletes the components of the load combination.
Definition: LoadPatternCombination.cc:166
Base class for load pattern combinations (1.5*selfWeight+1.0*permanentLoad+1.6*trafficLoad ...
Definition: LoadPatternCombination.h:45
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:117
const std::string & getLoadPatternName(const MapLoadPatterns &lps) const
Returns the name of the load case corresponding to the summand.
Definition: LoadPatternCombination.cc:64
const summand & subtract(const summand &)
Subtract from this summand the argument.
Definition: LoadPatternCombination.cc:107
virtual void setDomain(Domain *theDomain)
Assigns the domain to the combination load patterns.
Definition: LoadPatternCombination.cc:289
int recvData(const Communicator &comm)
Receives members through the communicator argument.
Definition: LoadPatternCombination.cc:455