xc
Body.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 //Body.h
29 //Class for block entities. (XXX: rename as Block?)
30 
31 #ifndef BODY_H
32 #define BODY_H
33 
34 #include "preprocessor/multi_block_topology/entities/EntMdlr.h"
35 #include "preprocessor/multi_block_topology/entities/1d/CmbEdge.h"
36 
37 
38 class Pos3d;
39 
40 namespace XC {
41 
42 class Face;
43 class Pnt;
44 class SurfaceMap;
45 
50  {
51  size_t l1;
52  size_t l2;
53  size_t l3;
54  size_t l4;
55  bool forward;
56 
57  SideSequence(const size_t first= 1,const bool &forward= true);
58  inline bool operator==(const SideSequence &other) const
59  { return ((l1==other.l1) && (l2==other.l2) && (l3==other.l3) && (l4==other.l4)); }
61  const bool &isDirect(void) const
62  { return forward; }
63 
64  boost::python::dict getPyDict(void) const;
65  void setPyDict(const boost::python::dict &);
66  };
67 
71 class Body: public EntMdlr
72  {
73  public:
77  class BodyFace: public CommandEntity
78  {
79  Face *surface;
80  SideSequence side_seq;
81  public:
82  BodyFace(Body *b= nullptr, Face *ptr= nullptr,const size_t &p=1,const bool &d=true);
83  virtual bool operator==(const BodyFace &) const;
84  Face *Surface(void);
85  const Face *Surface(void) const;
86  void SetSurf(Face *s);
87 
88  const std::string &getName(void) const;
89  bool Vacia(void) const;
90  size_t getNumberOfLines(void) const;
91  size_t getNumberOfVertices(void) const;
92  const CmbEdge::Side *getSide(const size_t &) const;
93  CmbEdge::Side *getSide(const size_t &);
94  const Pnt *getVertex(const size_t &) const;
95  Pnt *getVertex(const size_t &);
96  virtual Pos3dArray get_positions(void) const;
97  void create_nodes(void);
98 
99  std::deque<const Edge *> getNDivErrors(void) const;
100  bool checkNDivs(void) const;
101 
102  Node *getNode(const size_t &,const size_t &);
103  std::vector<Node *> getCornerNodes(void);
104 
105  boost::python::dict getPyDict(void) const;
106  void setPyDict(SurfaceMap &, const boost::python::dict &);
107  };
108 
109  protected:
110  void set_surf(Face *s);
111 
112  virtual BodyFace *getFace(const size_t &i)= 0;
113  public:
114  Body(Preprocessor *m,const std::string &name= "");
116  inline virtual unsigned short int GetDimension(void) const
117  { return 3; }
118 
120  virtual size_t getNumberOfLines(void) const= 0;
122  virtual size_t getNumberOfVertices(void) const= 0;
124  virtual size_t getNumberOfFaces(void) const= 0;
125  virtual std::set<const Face *> getSurfaces(void) const= 0;
126  virtual std::set<Face *> getSurfaces(void)= 0;
127  virtual const BodyFace *getFace(const size_t &i) const= 0;
128  virtual const CmbEdge::Side *getEdge(const size_t &i) const= 0;
129  virtual const Pnt *getVertex(const size_t &i) const= 0;
130  virtual Pnt *getVertex(const size_t &i)= 0;
131  std::deque<const Pnt *> getVertices(void) const;
132  std::deque<Pnt *> getVertices(void);
133  boost::python::list getVerticesPy(void);
134  std::vector<int> getIndicesVertices(void) const;
135  virtual BND3d Bnd(void) const;
136  virtual double getVolume(void) const;
137  bool In(const GeomObj3d &, const double &tol= 0.0) const;
138  bool Out(const GeomObj3d &, const double &tol= 0.0) const;
139 
140  virtual std::deque<const Edge *> getNDivErrors(void) const= 0;
141  virtual bool checkNDivs(void) const= 0;
142 
143  std::set<SetBase *> get_sets(void) const;
144  void add_to_sets(std::set<SetBase *> &);
145  };
146 
147 std::set<const Body *> getConnectedBodies(const Face &s);
148 
149 } //end of XC namespace
150 
151 #endif
Component of a compound line.
Definition: CmbEdge.h:59
size_t l4
Index edge 4.
Definition: Body.h:54
std::set< const Body * > getConnectedBodies(const Face &s)
Return the bodies that touch the surface passed as parameter (neighbors).
Definition: Body.cc:368
Finite element model generation tools.
Definition: Preprocessor.h:59
Array of positions in a three-dimensional space.
Definition: Pos3dArray.h:38
SideSequence(const size_t first=1, const bool &forward=true)
Constructor.
Definition: Body.cc:44
Surface that limits the body (face as seen by the body).
Definition: Body.h:77
const bool & isDirect(void) const
Return true if the edge sequence is direct (edge1 -> edge4).
Definition: Body.h:61
Model points container.
Definition: SurfaceMap.h:43
Order in edges of an hexahedron face.
Definition: Body.h:49
bool forward
Forward or reverse sequence.
Definition: Body.h:55
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: Body.cc:76
Objet that can execute python scripts.
Definition: CommandEntity.h:40
size_t l1
Index edge 1.
Definition: Body.h:51
"boundary" en tres dimensiones.
Definition: BND3d.h:34
Point (KPoint).
Definition: Pnt.h:50
Multiblock topology object (point, line, face, block,...).
Definition: EntMdlr.h:55
Posición en tres dimensiones.
Definition: Pos3d.h:44
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Six-faced solid.
Definition: Body.h:71
virtual unsigned short int GetDimension(void) const
Return the object dimension.
Definition: Body.h:116
size_t l3
Index edge 3.
Definition: Body.h:53
Mesh node.
Definition: Node.h:111
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: Body.cc:64
Surface.
Definition: Face.h:45
size_t l2
Index edge 2.
Definition: Body.h:52
Clase base para los objetos en tres dimensiones.
Definition: GeomObj3d.h:43