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