xc
MapTrfGeom.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 //MapTrfGeom.h
28 
29 #ifndef MAPTrfGeom_H
30 #define MAPTrfGeom_H
31 
32 #include "preprocessor/multi_block_topology/ModelComponentContainer.h"
33 #include "TrfGeom.h"
34 #include "boost/lexical_cast.hpp"
35 
36 
37 namespace XC {
38 
40 //
42 class MapTrfGeom: public ModelComponentContainer<TrfGeom>
43  {
44  public:
45  MapTrfGeom(MultiBlockTopology *mbt= nullptr);
46 
47  template <class T>
48  TrfGeom *Nueva(void);
49  TrfGeom *newTransformation(const std::string &type);
50  };
51 
53 template <class T>
54 XC::TrfGeom *XC::MapTrfGeom::Nueva(void)
55  {
56  TrfGeom *retval= busca(getTag());
57  if(!retval) //Doesn't already exist.
58  {
59  Preprocessor *preprocessor= getPreprocessor();
60  retval= new T(preprocessor);
61  if(retval)
62  {
63  retval->Name()= "t"+boost::lexical_cast<std::string>(getTag());
64  (*this)[getTag()]= retval;
65  tag++;
66  }
67  }
68  return retval;
69  }
70 
71 } //end of XC namespace
72 #endif
Finite element model generation tools.
Definition: Preprocessor.h:58
Model geometry manager.
Definition: MultiBlockTopology.h:68
Geometric transformations container.
Definition: MapTrfGeom.h:42
const Preprocessor * getPreprocessor(void) const
Return a pointer to preprocessor.
Definition: ModelComponentContainerBase.cc:54
Geometric transformation that can be applied to the components of a set.
Definition: TrfGeom.h:49
MapTrfGeom(MultiBlockTopology *mbt=nullptr)
Constructor.
Definition: MapTrfGeom.cc:45
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
TrfGeom * newTransformation(const std::string &type)
Defines a new transformation.
Definition: MapTrfGeom.cc:49
Container for model entities.
Definition: ModelComponentContainer.h:42
TrfGeom * busca(const Indice &)
Return a pointer to the geometry entity whose identifier is passed as parameter.
Definition: ModelComponentContainer.h:69