xc
LineMap.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 //LineMap.h
28 
29 #ifndef LINEMAP_H
30 #define LINEMAP_H
31 
32 #include "EntityMap.h"
33 #include "Edge.h"
34 
35 class Line3d;
36 class Plane;
37 
38 namespace XC {
39 
40 class Edge;
41 class Line;
42 class DividedLine;
43 class CmbEdge;
44 class CircularArc;
45 
47 //
49 class LineMap: public EntityMap<Edge>
50  {
51  private:
52  void UpdateSets(Edge *) const;
53  protected:
54  template <class E>
55  Edge *Crea(void);
56 
57 
58  public:
59  LineMap(MultiBlockTopology *mbt= nullptr);
60 
61  Vector3d getVector(const Indice &i,const Indice &j) const;
62  Line3d getRecta(const Indice &i,const Indice &j) const;
63  Plane getPlane(const Indice &i,const Indice &j,const Indice &k) const;
64 
65  template <class E>
66  Edge *New(void);
67  Edge *createLine(Pnt *,Pnt *);
69  Edge *createArc(Pnt *,Pnt *,Pnt *);
70  Edge *createLineSequence(void);
71  Edge *createCopy(const Edge *l);
72 
73  Line *newLine(const size_t &, const size_t &);
74  DividedLine *newDividedLine(const size_t &, const size_t &);
75  CircularArc *newCircleArc(const size_t &, const size_t &, const size_t &);
76  CmbEdge *newLineSequence(void);
77  };
78 
80 template <class E>
82  {
83  Preprocessor *preprocessor= getPreprocessor();
84  assert(preprocessor);
85  Edge *retval= new E(preprocessor);
86  retval->Name()= "l"+boost::lexical_cast<std::string>(getTag());
87  (*this)[getTag()]= retval;
88  UpdateSets(retval);
89  tag++;
90  return retval;
91  }
92 
94 template <class E>
96  {
97  Edge *retval= busca(getTag());
98  if(!retval) //El edge is new.
99  retval= Crea<E>();
100  return retval;
101  }
102 
103 } //end of XC namespace
104 #endif
Edge * createDividedLine(Pnt *, Pnt *)
Creates a new line between the points being passed as parameters and inserts it on the container...
Definition: LineMap.cc:154
Edge * New(void)
Creates a new Edge.
Definition: LineMap.h:95
Base class for one-dimensional geometry objects.
Definition: Edge.h:46
Edge * createLine(Pnt *, Pnt *)
Creates a new line between the points being passed as parameters and inserts it on the container...
Definition: LineMap.cc:117
CmbEdge * newLineSequence(void)
Line sequence.
Definition: LineMap.cc:90
LineMap(MultiBlockTopology *mbt=nullptr)
Constructor.
Definition: LineMap.cc:45
Geometric entities container (points, lines, surfaces,...).
Definition: EntityMap.h:42
Finite element model generation tools.
Definition: Preprocessor.h:58
CircularArc * newCircleArc(const size_t &, const size_t &, const size_t &)
Circle arc.
Definition: LineMap.cc:75
Model geometry manager.
Definition: MultiBlockTopology.h:68
Line segment between two points.
Definition: DividedLine.h:39
Edge * createArc(Pnt *, Pnt *, Pnt *)
Creates a new arc of circle between the points being passed as parameters and inserts it in the edge ...
Definition: LineMap.cc:189
Edge * createLineSequence(void)
Creates a line sequence (polyline) with those being passed as parameters and inserts it in the edge s...
Definition: LineMap.cc:220
DividedLine * newDividedLine(const size_t &, const size_t &)
Divided line.
Definition: LineMap.cc:62
Line * newLine(const size_t &, const size_t &)
Line segment.
Definition: LineMap.cc:49
Circumference arc.
Definition: CircularArc.h:43
Edge * createCopy(const Edge *l)
Return a copy of the argument edge.
Definition: LineMap.cc:228
Line container.
Definition: LineMap.h:49
Line: base class for 1D objects.
Definition: Line.h:41
Compound line.
Definition: CmbEdge.h:42
Point (KPoint).
Definition: Pnt.h:49
const Preprocessor * getPreprocessor(void) const
Return a pointer to preprocessor.
Definition: ModelComponentContainerBase.cc:54
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
Edge * Crea(void)
Creates a new line.
Definition: LineMap.h:81
Edge * busca(const Indice &)
Return a pointer to the geometry entity whose identifier is passed as parameter.
Definition: ModelComponentContainer.h:69