xc
VectorCells.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 //VectorCells.h
29 
30 #ifndef VectorCells_h
31 #define VectorCells_h
32 
33 #include <vector>
34 #include <iostream>
35 
36 namespace XC {
37 class Cell;
38 
40 //
42 class VectorCells: protected std::vector<Cell *>
43  {
44  public:
45  typedef std::vector<Cell *> v_cell;
46  typedef v_cell::reference reference;
47  typedef v_cell::const_reference const_reference;
48  typedef v_cell::iterator iterator;
49  typedef v_cell::const_iterator const_iterator;
50  private:
51  void free_mem(void);
52  void free_mem(const size_t i);
53  void alloc(const size_t i,const Cell &c);
54  inline reference operator[](const size_t i)
55  { return v_cell::operator[](i); }
56  public:
57 
58  VectorCells(const size_t &sz= 0);
59  VectorCells(const VectorCells &);
61  ~VectorCells(void);
62 
63  inline size_t size(void) const
64  { return v_cell::size(); }
65 
66  void resize(const size_t sz);
67 
68  void put(const size_t i,const Cell &c);
69  inline const_reference operator[](const size_t i) const
70  { return v_cell::operator[](i); }
71 
72  void Print(std::ostream &s) const;
73  };
74 
75 } // end of XC namespace
76 
77 
78 #endif
VectorCells(const size_t &sz=0)
Constructor.
Definition: VectorCells.cc:56
VectorCells & operator=(const VectorCells &)
Assignment operator.
Definition: VectorCells.cc:73
void put(const size_t i, const Cell &c)
Put the cell in the i-th position.
Definition: VectorCells.cc:103
Base class for cells (cross-section discretization).
Definition: Cell.h:75
void Print(std::ostream &s) const
Print stuff.
Definition: VectorCells.cc:107
~VectorCells(void)
Destructor.
Definition: VectorCells.cc:87
Cells vector.
Definition: VectorCells.h:42
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
void resize(const size_t sz)
Destructor.
Definition: VectorCells.cc:92