xc
BodyMap.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 //BodyMap.h
28 
29 #ifndef BodyMap_H
30 #define BodyMap_H
31 
32 #include "EntityMap.h"
33 #include "Body.h"
34 
35 namespace XC {
36 
38 //
40 class BodyMap: public EntityMap<Body>
41  {
42  private:
43  void UpdateSets(Body *) const;
44  protected:
45 
46 
47  public:
48  BodyMap(MultiBlockTopology *mbt= nullptr);
49 
50  bool conciliaNDivs(void);
51  bool checkNDivs(void) const;
52 
53  template <class B>
54  Body *New(void);
55 
56  };
57 
58 
60 template <class B>
62  {
63  Body *retval= busca(getTag());
64  if(!retval) //It doesn't already exist.
65  {
66  Preprocessor *preprocessor= getPreprocessor();
67  retval= new B(preprocessor);
68  if(retval)
69  {
70  retval->Name()= "f"+boost::lexical_cast<std::string>(getTag());
71  (*this)[getTag()]= retval;
72  UpdateSets(retval);
73  tag++;
74  }
75  }
76  return retval;
77  }
78 
79 } //end of XC namespace
80 #endif
BodyMap(MultiBlockTopology *mbt=nullptr)
Constructor.
Definition: BodyMap.cc:43
Geometric entities container (points, lines, surfaces,...).
Definition: EntityMap.h:42
Finite element model generation tools.
Definition: Preprocessor.h:58
Model geometry manager.
Definition: MultiBlockTopology.h:68
bool conciliaNDivs(void)
Conciliates the number of divisions of the lines.
Definition: BodyMap.cc:63
const Preprocessor * getPreprocessor(void) const
Return a pointer to preprocessor.
Definition: ModelComponentContainerBase.cc:54
Body container.
Definition: BodyMap.h:40
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
Body * New(void)
Creates a new cuerpo.
Definition: BodyMap.h:61
Six-faced solid.
Definition: Body.h:64
bool checkNDivs(void) const
Checks that the number of divisions of the edges are compatible.
Definition: BodyMap.cc:71
Body * busca(const Indice &)
Return a pointer to the geometry entity whose identifier is passed as parameter.
Definition: ModelComponentContainer.h:69