TexGen
Textile.h
Go to the documentation of this file.
1/*=============================================================================
2TexGen: Geometric textile modeller.
3Copyright (C) 2006 Martin Sherburn
4
5This program is free software; you can redistribute it and/or
6modify it under the terms of the GNU General Public License
7as published by the Free Software Foundation; either version 2
8of the License, or (at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18=============================================================================*/
19
20#pragma once
21#include "Yarn.h"
22#include "PropertiesTextile.h"
23namespace TexGen
24{
25 class CDomain;
26 class CTextileWeave;
27 class CTextile3DWeave;
28 class CTextileLayered;
29 class CTextileOrthogonal;
30 class CTextileLayerToLayer;
31 class CTextileDecoupledLToL;
32 class CTextileAngleInterlock;
33 class CTextileWeave2D;
34
35 using namespace std;
36
39 {
40 public:
41 CTextile(void);
42 CTextile(const vector<CYarn> &Yarns);
43 CTextile(const CTextile &CopyMe);
44 CTextile(TiXmlElement &Element);
45 virtual ~CTextile(void);
46
47 // NOTE: IF DERIVING FROM THIS CLASS BE SURE TO IMPLEMENT THIS FUNCTION
48 virtual CTextile* Copy() const { return new CTextile(*this); }
49
51 virtual string GetType() const { return "CTextile"; }
52
53 CTextile &operator=(const CTextile& CopyMe);
54
56 virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType);
57
59 int AddYarn(const CYarn &Yarn);
60
62
66 bool DeleteYarn(int iIndex);
67
69 void DeleteYarns();
70
72 void AddNodesToMesh(CMesh &Mesh);
73
75 void AddPathToMesh(CMesh &Mesh);
76
78
82 void AddSurfaceToMesh(CMesh &Mesh, bool bTrimToDomain = false);
83
86
91 bool AddSurfaceToMesh(CMesh &Mesh, vector<CMesh> &DomainMeshes, bool bTrimToDomain = false);
92
94
98 void AddVolumeToMesh(vector<CMesh> &YarnMeshes, bool bTrimToDomain = false);
99
101
106 void AddVolumeToMesh(CMesh &Mesh, bool bTrimToDomain = false);
107
109
113 void AddCentrePlaneToMesh(CMesh &Mesh, bool bTrimToDomain = false);
114
115/* /// Create Mesh and output to abaqus file format
116 bool OutputAbaqus(string FileName, double dInitialStrains = 0);*/
117
119
128 void GetPointInformation(const vector<XYZ> &Points, vector<POINT_INFO> &PointsInfo, double dTolerance = 1e-9);
129
131
134 void GetPointInformation(const vector<XYZ> &Points, vector<POINT_INFO> &PointsInfo, int iYarn, double dTolerance = 1e-9, bool bSurface = false);
135
137
140 void SavePointInformationToVTK(string Filename, const CMesh &Mesh, double dTolerance = 1e-9);
141
143
147 double GetApproximateSize();
148
150 int DetectInterference(vector<float> &DistanceToSurface, vector<int> &YarnIndex, bool bTrimToDomain, CMesh *pInterferingPoints = NULL );
151
153 void Rotate(WXYZ Rotation, XYZ Origin = XYZ(0,0,0));
154
156 void Translate(XYZ Vector);
157
159
162 virtual string GetDefaultName() const { return "Textile"; }
163
165 string GetName() const;
166
168 void AssignDomain(const CDomain &Domain);
169
171 void RemoveDomain();
172
174 bool SetResolution(int Resolution);
175
176
177
179
184 double GetYarnLength(string Units = "m");
185
187
192 double GetYarnLengthPerUnitArea(string Units = "/m");
193
195
200 double GetYarnVolume(string Units = "m^3");
201
203
210 double GetYarnVolumePerUnitArea(string Units = "m");
211
213
217 double GetFibreVolume(string Units = "m^3");
218
220
225 double GetFibreVolumePerUnitArea(string Units = "m");
226
228
232 double GetFibreYarnVolumeFraction();
233
235
239 double GetQuickDomainVolumeFraction();
240
242 double GetDomainVolumeFraction();
243
245 void SetAllYarnsYoungsModulusX( double dValue, string Units = "MPa");
246 void SetAllYarnsYoungsModulusY( double dValue, string Units = "MPa");
247 void SetAllYarnsYoungsModulusZ( double dValue, string Units = "MPa");
249 void SetAllYarnsShearModulusXY(double dValue, string Units = "MPa");
250 void SetAllYarnsShearModulusXZ(double dValue, string Units = "MPa");
251 void SetAllYarnsShearModulusYZ(double dValue, string Units = "MPa");
253 void SetAllYarnsAlphaX( double dValue, string Units = "/K");
254 void SetAllYarnsAlphaY( double dValue, string Units = "/K");
255 void SetAllYarnsAlphaZ( double dValue, string Units = "/K");
257 void SetAllYarnsPoissonsRatioX(double dValue);
258 void SetAllYarnsPoissonsRatioY(double dValue);
259 void SetAllYarnsPoissonsRatioZ(double dValue);
260
263 bool ConvertToInterpNodes() const;
264
265
267
272 CTextileWeave* GetWeave();
273 CTextileWeave2D* GetWeave2D();
274 CTextile3DWeave* Get3DWeave();
275 CTextileOrthogonal* GetOrthogonalWeave();
276 CTextileLayered* GetLayeredTextile();
277 CTextileLayerToLayer* GetLayerToLayerWeave();
278 CTextileDecoupledLToL * GetDecoupledLToLWeave();
279 CTextileAngleInterlock* GetAngleInterlockWeave();
280
281 // Accessor methods
282 int GetNumYarns() const;
283 const CYarn *GetYarn(int iIndex) const;
284 CYarn *GetYarn(int iIndex);
285 const vector<CYarn> &GetYarns() const;
286 vector<CYarn> &GetYarns();
287 const CDomain* GetDomain() const {return m_pDomain;}
288 CDomain* GetDomain() {return m_pDomain;}
289
290 protected:
292
298 bool BuildTextileIfNeeded() const;
299
301
307 virtual bool BuildTextile() const { return true; }
308
311 void CleanUp();
312
313 int AddYarn(const CYarn &Yarn) const;
314
316
323 mutable vector<CYarn> m_Yarns;
324
326
330 mutable bool m_bNeedsBuilding;
331
333 };
334}; // namespace TexGen
#define CLASS_DECLSPEC
Definition: Misc.h:35
#define NULL
Definition: ShinyConfig.h:50
Abstract base class representing the domain in which a textile cell may lie.
Definition: Domain.h:34
Defines the nodes and elements of a surface or volume mesh.
Definition: Mesh.h:58
Object container to help handle memory management issues.
Class to store properties related to a textile.
Represents a 3D woven textile.
Represents a 3D angle interlock woven textile.
Represents a textile cell containing yarns.
Definition: Textile.h:39
virtual bool BuildTextile() const
Build the textile even if it is already built (virtual function which does nothing by default)
Definition: Textile.h:307
const CDomain * GetDomain() const
Definition: Textile.h:287
vector< CYarn > m_Yarns
Vector of yarns contained within this cell.
Definition: Textile.h:323
CDomain * GetDomain()
Definition: Textile.h:288
virtual string GetType() const
Derived class should return the class name.
Definition: Textile.h:51
virtual string GetDefaultName() const
Get the default name to assign to a textile.
Definition: Textile.h:162
bool m_bNeedsBuilding
Variable which keeps track of wether the textile needs building or not.
Definition: Textile.h:330
CObjectContainer< CDomain > m_pDomain
Definition: Textile.h:332
virtual CTextile * Copy() const
Definition: Textile.h:48
Represents a textile made up from several layers of weaves.
Represents a 3D orthogonal woven textile.
Respresents a 2d woven textile.
Represents a woven textile.
Definition: TextileWeave.h:41
Represents a yarn consisting of master nodes, section and interpolation function.
Definition: Yarn.h:49
Namespace containing a series of customised math operations not found in the standard c++ library.
OUTPUT_TYPE
Definition: Misc.h:105
Struct for representing a quaternion.
Definition: mymath.h:38
Struct for representing points in 3D space.
Definition: mymath.h:56