xc
RowSet.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 //RowSet.h
28 
29 #ifndef ROWSET_H
30 #define ROWSET_H
31 
32 #include "SetEstruct.h"
33 #include "xc_utils/src/geom/pos_vec/Array3dRange.h"
34 
35 namespace XC {
36 
37 class SFreedom_Constraint;
38 
47 template <class ROWTTZNOD,class ROWTTZELEM>
48 class RowSet: public SetEstruct
49  {
50  ROWTTZNOD node_row;
51  ROWTTZELEM element_row;
52  public:
53  typedef typename ROWTTZNOD::reference reference_nod;
54  typedef typename ROWTTZNOD::const_reference const_reference_nod;
55 
56  typedef typename ROWTTZELEM::reference reference_elem;
57  typedef typename ROWTTZELEM::const_reference const_reference_elem;
58  public:
59  RowSet(const ROWTTZNOD &fn,const ROWTTZELEM &fe,const std::string &nmb="",Preprocessor *preprocessor= nullptr);
60  RowSet(const RowSet &);
61  RowSet &operator=(const RowSet &);
62  virtual SetEstruct *getCopy(void) const;
63  reference_nod Node(const size_t &i)
64  { return node_row(i); }
65  const reference_nod Node(const size_t &i) const
66  { return node_row(i); }
67  reference_elem Element(const size_t &i)
68  { return element_row(i); }
69  const reference_elem Element(const size_t &i) const
70  { return element_row(i); }
71 
72  Array3dRange NodeRange(void) const
73  { return Array3dRange(node_row); }
74  Array3dRange ElementRange(void) const
75  { return Array3dRange(element_row); }
76 
77  virtual size_t getNumNodeLayers(void) const
78  { return node_row.getNumberOfLayers(); }
79  virtual size_t getNumNodeRows(void) const
80  { return node_row.getNumberOfRows(); }
81  virtual size_t getNumNodeColumns(void) const
82  { return node_row.getNumberOfColumns(); }
83  virtual size_t getNumElementLayers(void) const
84  { return element_row.getNumberOfLayers(); }
85  virtual size_t getNumElementRows(void) const
86  { return element_row.getNumberOfRows(); }
87  virtual size_t getNumElementColumns(void) const
88  { return element_row.getNumberOfColumns(); }
89 
90  virtual XC::Node *getNode(const size_t &i=1,const size_t &j=1,const size_t &k=1)
91  { return node_row(i,j,k); }
92  virtual const XC::Node *getNode(const size_t &i=1,const size_t &j=1,const size_t &k=1) const
93  { return node_row(i,j,k); }
94  virtual XC::Element *getElement(const size_t &i=1,const size_t &j=1,const size_t &k=1)
95  { return element_row(i,j,k); }
96  virtual const XC::Element *getElement(const size_t &i=1,const size_t &j=1,const size_t &k=1) const
97  { return element_row(i,j,k); }
98 
99  //void fix(int &tag_fix,const SFreedom_Constraint &);
100 
101  };
102 
103 template <class ROWTTZNOD,class ROWTTZELEM>
104 RowSet<ROWTTZNOD,ROWTTZELEM>::RowSet(const ROWTTZNOD &fn,const ROWTTZELEM &fe,const std::string &nmb,Preprocessor *preprocessor)
105  : SetEstruct(nmb,preprocessor), node_row(fn), element_row(fe) {}
106 
107 template <class ROWTTZNOD,class ROWTTZELEM>
109  : SetEstruct(other), node_row(other.node_row), element_row(other.element_row) {}
110 
112 template <class ROWTTZNOD,class ROWTTZELEM>
114  {
115  SetEstruct::operator=(other);
116  node_row= other.node_row;
117  element_row= other.element_row;
118  return *this;
119  }
120 
122 template <class ROWTTZNOD,class ROWTTZELEM>
124  { return new RowSet<ROWTTZNOD,ROWTTZELEM>(*this); }
125 
126 
127 /* //! @brief Impone desplazamiento nulo en the nodes de this set. */
128 /* template <class ROWTTZNOD,class ROWTTZELEM> */
129 /* void XC::RowSet<ROWTTZNOD,ROWTTZELEM>::fix(const SFreedom_Constraint &spc) */
130 /* { fix(node_row,spc); } */
131 
132 
133 } //end of XC namespace
134 #endif
virtual SetEstruct * getCopy(void) const
Virtual constructor.
Definition: RowSet.h:123
Set of objects in a row.
Definition: RowSet.h:48
Finite element model generation tools.
Definition: Preprocessor.h:58
SetEstruct(const std::string &nmb="", Preprocessor *preprocessor=nullptr)
Constructor.
Definition: SetEstruct.cc:41
Base class for the finite elements.
Definition: Element.h:109
RowSet & operator=(const RowSet &)
Assignment operator.
Definition: RowSet.h:113
structured set, i.
Definition: SetEstruct.h:45
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
Mesh node.
Definition: Node.h:110
SetEstruct & operator=(const SetEstruct &)
Assignment operator.
Definition: SetEstruct.cc:49