xc
DamageModels.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 #ifndef DamageModels_h
30 #define DamageModels_h
31 
32 #include <vector>
33 #include <cstddef>
34 
35 namespace XC {
36 class DamageModel;
37 
41 class DamageModels: protected std::vector<DamageModel *>
42  {
43  private:
44  void alloc(const DamageModels &);
45  void alloc(const DamageModel *);
46  void free(void);
47  protected:
48  inline reference operator[](size_t i)
49  { return DamageModelsBase::operator[](i); }
50  public:
51  typedef std::vector<DamageModel *> DamageModelsBase;
52  DamageModels(const size_t &sz= 5, const DamageModel *ptr= nullptr);
53  DamageModels(const DamageModels &);
54  ~DamageModels(void);
56  bool empty(void) const;
57  void clear(void);
58  void setDamageModel(const DamageModel *);
59  void setDamageModel(size_t i,DamageModel *);
60 
61  inline const_reference operator[](size_t i) const
62  { return DamageModelsBase::operator[](i); }
63 
64  int revertToLastCommit(void);
65  int revertToStart(void);
66  };
67 
68 } // end of XC namespace
69 
70 #endif
int revertToLastCommit(void)
Returns the damage models to its last committed state.
Definition: DamageModels.cc:123
Damage models for Joint elements.
Definition: DamageModels.h:41
bool empty(void) const
Returns true if no damage model has been assigned.
Definition: DamageModels.cc:102
void clear(void)
Clears vector.
Definition: DamageModels.cc:98
int revertToStart(void)
Returns the estado de los dmg_models al inicial.
Definition: DamageModels.cc:138
DamageModels & operator=(const DamageModels &)
Assignment operator.
Definition: DamageModels.cc:87
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Base class for damage models.
Definition: DamageModel.h:107
~DamageModels(void)
Destructor.
Definition: DamageModels.cc:94
void setDamageModel(const DamageModel *)
Set value for all the damage models.
Definition: DamageModels.cc:111
DamageModels(const size_t &sz=5, const DamageModel *ptr=nullptr)
Constructor.
Definition: DamageModels.cc:77