xc
TransfCooHandler.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 //TransfCooHandler.h
29 
30 #ifndef TRANSFCOOLOADER_H
31 #define TRANSFCOOLOADER_H
32 
33 #include "PrepHandler.h"
34 #include <map>
35 
36 namespace XC {
37 class Domain;
38 class CrdTransf;
39 class LinearCrdTransf2d;
40 class LinearCrdTransf3d;
41 class PDeltaCrdTransf2d;
42 class PDeltaCrdTransf3d;
43 class CorotCrdTransf2d;
44 class CorotCrdTransf3d;
45 
46 
51  {
52  public:
53  typedef std::map<std::string,CrdTransf *> map_transfcoo;
54  typedef map_transfcoo::const_iterator const_iterator;
55  typedef map_transfcoo::iterator iterator;
56  private:
57  map_transfcoo transfcoo;
58  int tag_trf;
59  protected:
60  void free_mem(void);
63  public:
65  const map_transfcoo &Map(void) const;
66 
67  template<class T>
68  T *newCrdTransf(const std::string &);
69  LinearCrdTransf2d *newLinearCrdTransf2d(const std::string &);
70  LinearCrdTransf3d *newLinearCrdTransf3d(const std::string &);
71  PDeltaCrdTransf2d *newPDeltaCrdTransf2d(const std::string &);
72  PDeltaCrdTransf3d *newPDeltaCrdTransf3d(const std::string &);
73  CorotCrdTransf2d *newCorotCrdTransf2d(const std::string &);
74  CorotCrdTransf3d *newCorotCrdTransf3d(const std::string &);
75 
76  const_iterator begin(void) const;
77  const_iterator end(void) const;
78  iterator begin(void);
79  iterator end(void);
80  const_iterator find(const std::string &str) const;
81  iterator find(const std::string &str);
82  CrdTransf *find_ptr(const std::string &str);
83  CrdTransf *find_ptr(const int &tag);
84  const CrdTransf *find_ptr(const std::string &str) const;
85  const CrdTransf *find_ptr(const int &tag) const;
86  std::string getName(const int &tag) const;
87 
88  ~TransfCooHandler(void);
89 
90  void clearAll(void);
91  };
92 
93 template<class T>
94 T *TransfCooHandler::newCrdTransf(const std::string &trfName)
95  {
96  T *retval= nullptr;
97  CrdTransf *ptr= find_ptr(trfName);
98  if(ptr)
99  {
100  std::cerr << getClassName() << "::" << __FUNCTION__
101  << "transformation: '" << trfName
102  << "' already exists. I do nothing." << std::endl;
103  retval= dynamic_cast<T *>(ptr);
104  }
105  else
106  {
107  retval= new T(tag_trf++);
108  assert(retval);
109  retval->set_owner(this);
110  transfcoo[trfName]= retval;
111  }
112  return retval;
113  }
114 } // end of XC namespace
115 
116 #endif
PDeltaCrdTransf3d provides the abstraction of a linear transformation for a spatial frame between the...
Definition: PDeltaCrdTransf3d.h:74
~TransfCooHandler(void)
Destructor.
Definition: TransfCooHandler.cc:64
Finite element model generation tools.
Definition: Preprocessor.h:59
CrdTransf provides the abstraction of a frame coordinate transformation.
Definition: CrdTransf.h:88
Linear coordinate transformation.
Definition: LinearCrdTransf3d.h:75
Base class for the preprocessor objects that create model entities: nodes, elements, loads, etc.
Definition: PrepHandler.h:47
const_iterator find(const std::string &str) const
Returns an iterator to the transformation with the name being passed as parameter.
Definition: TransfCooHandler.cc:109
PDeltaCrdTransf3d * newPDeltaCrdTransf3d(const std::string &)
Creates a new pdelta 3D coordinate transformation.
Definition: TransfCooHandler.cc:80
CorotCrdTransf3d * newCorotCrdTransf3d(const std::string &)
Creates a new corotationa 3D coordinate transformation.
Definition: TransfCooHandler.cc:88
Coordinate transformation corrotacional en 3d.
Definition: CorotCrdTransf2d.h:71
LinearCrdTransf2d * newLinearCrdTransf2d(const std::string &)
Creates a new linear 2D coordinate transformation.
Definition: TransfCooHandler.cc:68
const_iterator end(void) const
Returns an iterator apuntando después del final de la lista.
Definition: TransfCooHandler.cc:99
void clearAll(void)
Deletes all members.
Definition: TransfCooHandler.cc:182
virtual std::string getClassName(void) const
Returns demangled class name.
Definition: EntityWithOwner.cc:90
CorotCrdTransf2d * newCorotCrdTransf2d(const std::string &)
Creates a new corotationa 2D coordinate transformation.
Definition: TransfCooHandler.cc:84
CrdTransf * find_ptr(const std::string &str)
Returns a pointer to the transformation with the name being passed as parameter (returns nullptr if n...
Definition: TransfCooHandler.cc:117
PDeltaCrdTransf2d provides the abstraction of a linear transformation for a spatial frame between the...
Definition: PDeltaCrdTransf2d.h:77
const_iterator begin(void) const
Returns an iterator which points to principio de la lista.
Definition: TransfCooHandler.cc:96
Manager for the creation/deletion of coordinate transformations.
Definition: TransfCooHandler.h:50
TransfCooHandler(const TransfCooHandler &)
Copy constructor.
Definition: TransfCooHandler.cc:51
PDeltaCrdTransf2d * newPDeltaCrdTransf2d(const std::string &)
Creates a new pdelta 2D coordinate transformation.
Definition: TransfCooHandler.cc:76
std::string getName(const int &tag) const
Returns the name that corresponds to the coordinate transformation tag being passed as parameter...
Definition: TransfCooHandler.cc:168
LinearCrdTransf3d * newLinearCrdTransf3d(const std::string &)
Creates a new linear 3D coordinate transformation.
Definition: TransfCooHandler.cc:72
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
LinearCrdTransf2d provides the abstraction of a linear transformation for a spatial frame between the...
Definition: LinearCrdTransf2d.h:75
TransfCooHandler & operator=(const TransfCooHandler &)
Assignment operator.
Definition: TransfCooHandler.cc:56
void free_mem(void)
Frees memory.
Definition: TransfCooHandler.cc:39
Coordinate transformation corrotacional en 3d.
Definition: CorotCrdTransf3d.h:74
const map_transfcoo & Map(void) const
Returns a reference to the coordinate transformation map (container).
Definition: TransfCooHandler.cc:92