/
FemMesh.h
executable file
·148 lines (124 loc) · 4.84 KB
/
FemMesh.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/***************************************************************************
* Copyright (c) Jürgen Riegel (juergen.riegel@web.de) 2009 *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef FEM_FEMMESH_H
#define FEM_FEMMESH_H
#include <App/ComplexGeoData.h>
#include <Base/Placement.h>
#include <Base/Quantity.h>
#include <vector>
#include <list>
#include <boost/shared_ptr.hpp>
class SMESH_Gen;
class SMESH_Mesh;
class SMESH_Hypothesis;
class TopoDS_Shape;
class TopoDS_Face;
namespace Fem
{
typedef boost::shared_ptr<SMESH_Hypothesis> SMESH_HypothesisPtr;
/** The representation of a FemMesh
*/
class AppFemExport FemMesh : public Data::ComplexGeoData
{
TYPESYSTEM_HEADER();
public:
FemMesh();
FemMesh(const FemMesh&);
~FemMesh();
FemMesh &operator=(const FemMesh&);
const SMESH_Mesh* getSMesh() const;
SMESH_Mesh* getSMesh();
SMESH_Gen * getGenerator();
void addHypothesis(const TopoDS_Shape & aSubShape, SMESH_HypothesisPtr hyp);
void setStanardHypotheses();
void compute();
// from base class
virtual unsigned int getMemSize (void) const;
virtual void Save (Base::Writer &/*writer*/) const;
virtual void Restore(Base::XMLReader &/*reader*/);
void SaveDocFile (Base::Writer &writer) const;
void RestoreDocFile(Base::Reader &reader);
/** @name Subelement management */
//@{
/** Sub type list
* List of different subelement types
* it is NOT a list of the subelements itself
*/
virtual std::vector<const char*> getElementTypes(void) const;
virtual unsigned long countSubElements(const char* Type) const;
/// get the subelement by type and number
virtual Data::Segment* getSubElement(const char* Type, unsigned long) const;
//@}
/** @name search and retraivel */
//@{
/// retriving by region growing
std::set<long> getSurfaceNodes(long ElemId,short FaceId, float Angle=360)const;
/// retrivinb by face
std::set<long> getSurfaceNodes(const TopoDS_Face &face)const;
//@}
/** @name Placement control */
//@{
/// set the transformation
void setTransform(const Base::Matrix4D& rclTrf);
/// get the transformation
Base::Matrix4D getTransform(void) const;
/// Bound box from the shape
Base::BoundBox3d getBoundBox(void)const;
/// get the volume (when there are volume elements)
Base::Quantity getVolume(void)const;
//@}
/** @name Modification */
//@{
/// Applies a transformation on the real geometric data type
void transformGeometry(const Base::Matrix4D &rclMat);
//@}
struct FemMeshInfo {
int numFaces;
int numNode;
int numTria;
int numQuad;
int numPoly;
int numVolu;
int numTetr;
int numHexa;
int numPyrd;
int numPris;
int numHedr;
};
///
struct FemMeshInfo getInfo(void) const;
/// import from files
void read(const char *FileName);
void write(const char *FileName) const;
void writeABAQUS(const std::string &Filename) const;
private:
void copyMeshData(const FemMesh&);
void readNastran(const std::string &Filename);
private:
/// positioning matrix
Base::Matrix4D _Mtrx;
SMESH_Gen *myGen;
SMESH_Mesh *myMesh;
std::list<SMESH_HypothesisPtr> hypoth;
};
} //namespace Part
#endif // FEM_FEMMESH_H