XC Open source finite element analysis program
ElementPtrs.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 //ElementPtrs.h
28 
29 #ifndef ElementPtrs_h
30 #define ElementPtrs_h
31 
32 #include "xc_utils/src/nucleo/EntCmd.h"
33 
34 namespace XC {
35 class Element;
36 class Domain;
37 class ID;
38 
39 
41 //
43 class ElementPtrs: public EntCmd
44  {
45  public:
46  typedef std::vector<Element *> vector_ptr_elements;
47  typedef vector_ptr_elements::const_reference const_reference;
48  typedef vector_ptr_elements::reference reference;
49  typedef vector_ptr_elements::iterator iterator;
50  typedef vector_ptr_elements::const_iterator const_iterator;
51 
52  private:
53  vector_ptr_elements theElements;
54  protected:
55 
56  public:
57  ElementPtrs(void);
58  ~ElementPtrs(void);
59 
60  virtual void setPtrs(Domain *theDomain, const ID &theElementTags);
61 
62  virtual size_t removeElement(const int &tag);
63 
64  inline size_t size(void) const
65  { return theElements.size(); }
66  inline const_reference front() const
67  { return theElements.front(); }
68  inline reference front()
69  { return theElements.front(); }
70  inline const_reference back() const
71  { return theElements.back(); }
72  inline reference back()
73  { return theElements.back(); }
74  inline const_iterator begin() const
75  { return theElements.begin(); }
76  inline iterator begin()
77  { return theElements.begin(); }
78  inline const_iterator end() const
79  { return theElements.end(); }
80  inline iterator end()
81  { return theElements.end(); }
82  iterator find(const int &tag);
83  const_iterator find(const int &tag) const;
84  Element *findPtr(const int &tag);
85  const Element *findPtr(const int &tag) const;
86 
87  const_reference operator()(const size_t &i) const;
88  reference operator()(const size_t &i);
89  const_reference operator[](const size_t &i) const;
90  reference operator[](const size_t &i);
91 
92 
93  };
94 } // end of XC namespace
95 
96 #endif
97 
virtual void setPtrs(Domain *theDomain, const ID &theElementTags)
Set the element pointers from the element identifiers being passed as parameter.
Definition: ElementPtrs.cc:49
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:98
Pointers to the elements affected by the load.
Definition: ElementPtrs.h:43
virtual size_t removeElement(const int &tag)
Erases the element identified by the tag being passed as parameter.
Definition: ElementPtrs.cc:110
Base calass for the finite elements.
Definition: Element.h:104
ElementPtrs(void)
Constructor.
Definition: ElementPtrs.cc:39
Definition: ID.h:77
iterator find(const int &tag)
Returns an iterator to the element identified by the tag being passed as parameter.
Definition: ElementPtrs.cc:70
~ElementPtrs(void)
Destructor.
Definition: ElementPtrs.cc:44
================================================================================
Definition: ContinuaReprComponent.h:34