xc
ClosedTriangleMesh.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 //ClosedTriangleMesh.h
28 
29 #ifndef CLOSEDTRIANGLEMESH_H
30 #define CLOSEDTRIANGLEMESH_H
31 
32 #include "xc_utils/src/geom/d2/Trihedron.h"
33 #include <set>
34 #include <deque>
35 #include "utility/actor/actor/MovableObject.h"
36 
37 class Triang3dMesh;
38 class TriangleMap;
39 
40 namespace XC {
41 
42 class Vector;
43 class FiberSectionBase;
44 
46 //
48 class ClosedTriangleMesh: public GeomObj3d, public MovableObject
49  {
50  protected:
51  typedef std::vector<Trihedron> v_trihedrons;
52  typedef v_trihedrons::iterator iterator;
53  typedef v_trihedrons::const_iterator const_iterator;
54 
55  v_trihedrons trihedrons;
56  double tol;
57  double rMax;
58  double rMin;
59 
60  GeomObj::list_Pos3d get_intersection(const Pos3d &p) const;
61  protected:
62  void getPositionsMatrix(Matrix &);
63  virtual void setPositionsMatrix(const Matrix &);
64  int sendData(CommParameters &);
65  int recvData(const CommParameters &);
66  public:
67  ClosedTriangleMesh(void);
68  ClosedTriangleMesh(const Pos3d &org,const Triang3dMesh &mll);
71  virtual ClosedTriangleMesh *clon(void) const;
72 
73  virtual double GetMax(short unsigned int i) const;
74  virtual double GetMin(short unsigned int i) const;
75  virtual Pos3d getCenterOfMass(void) const;
76  virtual double getLength(void) const;
77  virtual double getArea(void) const;
78  virtual double getVolume(void) const;
79  virtual double Ix(void) const;
80  virtual double Iy(void) const;
81  virtual double Iz(void) const;
82  short unsigned int Dimension() const
83  { return 3; }
84 
85  size_t GetNumFacetas(void) const;
86 
87  TriangleMap getTriangleMap(void) const;
88 
89  iterator begin(void);
90  iterator end(void);
91  const_iterator begin() const;
92  const_iterator end() const;
93  size_t size(void) const;
94 
95  const_iterator findTrihedron(const Pos3d &p) const;
96  const Trihedron *findTrihedronPtr(const Pos3d &p) const;
97 
98  int sendSelf(CommParameters &);
99  int recvSelf(const CommParameters &);
100  void write(std::ofstream &);
101  void read(std::ifstream &);
102  void writeTo(const std::string &);
103  void readFrom(const std::string &);
104  void Print(std::ostream &os) const;
105  };
106 
107 } // end of XC namespace
108 
109 #endif
void readFrom(const std::string &)
Read from file.
Definition: ClosedTriangleMesh.cc:102
GeomObj::list_Pos3d get_intersection(const Pos3d &p) const
Radius of the sphere that passes through the nearest vertex.
Definition: ClosedTriangleMesh.cc:282
ClosedTriangleMesh(void)
Default constructor.
Definition: ClosedTriangleMesh.cc:50
Object that can move between processes.
Definition: MovableObject.h:99
int recvData(const CommParameters &)
Receives object members through the channel being passed as parameter.
Definition: ClosedTriangleMesh.cc:399
const_iterator findTrihedron(const Pos3d &p) const
Search for the trihedron that contains the point being passed as parameter.
Definition: ClosedTriangleMesh.cc:205
void read(std::ifstream &)
Read the matrix from a binary file.
Definition: ClosedTriangleMesh.cc:377
void getPositionsMatrix(Matrix &)
Return a matrix with the coordinates of the points that define each one of the trihedrons.
Definition: ClosedTriangleMesh.cc:328
void Print(std::ostream &os) const
Print stuff.
Definition: ClosedTriangleMesh.cc:320
virtual void setPositionsMatrix(const Matrix &)
Create the trihedrons that define the diagram from the matrix that contains the points that define ea...
Definition: ClosedTriangleMesh.cc:350
int sendData(CommParameters &)
Sends object members through the channel being passed as parameter.
Definition: ClosedTriangleMesh.cc:388
double rMin
Radius of the convex-hull circunscribed sphere.
Definition: ClosedTriangleMesh.h:58
void write(std::ofstream &)
Write the matrix in a binary file.
Definition: ClosedTriangleMesh.cc:366
int recvSelf(const CommParameters &)
Receives object through the channel being passed as parameter.
Definition: ClosedTriangleMesh.cc:424
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
Communication parameters between processes.
Definition: CommParameters.h:65
Matrix of floats.
Definition: Matrix.h:108
virtual ClosedTriangleMesh * clon(void) const
Virtual constructor.
Definition: ClosedTriangleMesh.cc:119
@ingroup MATSCCDiagInt
Definition: ClosedTriangleMesh.h:48
const Trihedron * findTrihedronPtr(const Pos3d &p) const
Search for the trihedron that contains the point being passed as parameter.
Definition: ClosedTriangleMesh.cc:221
ClosedTriangleMesh & operator=(const ClosedTriangleMesh &)
Assignment operator.
Definition: ClosedTriangleMesh.cc:84
int sendSelf(CommParameters &)
Send the object through the channel being passed as parameter.
Definition: ClosedTriangleMesh.cc:410