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