TexGen
GeometrySolver.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
22#include "BasicVolumes.h"
23#include "TextileDeformer.h"
24#include "Elements.h"
25
26namespace TexGen
27{
28 using namespace std;
29
31
36 {
37 public:
38 CGeometrySolver(void);
39 ~CGeometrySolver(void);
40
42 bool CreateSystem(CTextile &Textile);
44 bool CreateSystem(string TextileName);
45/* void OutputSystem(string Filename);*/
47
50 int SolveSystem();
52 void SaveToVTK(string Filename);
54 void DeformTextile();
56 CTextile* GetDeformedCopyOfTextile();
57
58 // Get and set the various mechanical properties
59 void SetTensileStress(double dTensileStress);
60 void SetLongitudinalBendingModulus(double dBendingModulus);
61 void SetTransverseBendingModulus(double dBendingModulus);
62 void SetContactStiffness(double dContactStiffness);
63 void SetDisabledStiffness(double dDisabledStiffness);
64 double GetTensileStress() { return m_dTensileStress; }
65 double GetLongitudinalBendingModulus() { return m_dLongitudinalBendingModulus; }
66 double GetTransverseBendingModulus() { return m_dTransverseBendingModulus; }
67 double GetContactStiffness() { return m_dContactStiffness; }
68 double GetDisabledStiffness() { return m_dDisabledStiffness; }
69
70 private:
71 void CreateDebugSystem();
72
73 protected:
75 {
78 double dHeight;
79 double dThickness;
80 bool operator < (const RAISED_NODE &right) const
81 {
82 return dHeight < right.dHeight;
83 }
84 RAISED_NODE():iGlobalIndex(0), iYarnIndex(0), dHeight(0), dThickness(0) {}
85 };
86
88 {
89 vector<RAISED_NODE> RaisedNodes;
91 };
92
93 struct NODE
94 {
96 double dThickness;
98 double dThetaX;
99 double dThetaY;
102 {
103 return dThickness*sqrt(1+dThetaX*dThetaX+dThetaY*dThetaY);
104 }
105 NODE():dThickness(0), dDisplacement(0), iYarnIndex(0), dThetaX(0), dThetaY(0) {}
106 };
107
108 struct SPRING
109 {
110 int iNode1, iNode2;
111 double dArea;
113 SPRING():iNode1(0), iNode2(0), dArea(0), bEnabled(false) {}
114 };
115
116 struct PLATE
117 {
120 int iNode1, iNode2, iNode3;
122 PLATE():iNode1(0), iNode2(0), iNode3(0), iYarnIndex(-1) {}
123 };
124
125
126 void RaiseNodes(int iIndex);
127 double GetAverageLength(int iIndex);
128 double GetArea(int iIndex);
129 void CreateSurfaceMesh();
130 void CreatePlateElements();
131 void AssignFibreDirectionToElements();
132 void ApplyPeriodicBoundaryConditions(vector<XYZ> Repeats);
133 double GetDisplacement(XYZ Pos, int iYarn, XYZ &Disp) const;
134// void DeformTextile(CTextile* pTextile);
135
136 vector<SPRING> m_Springs;
137 vector<PLATE> m_PlateElements;
138 vector<NODE> m_Nodes;
139 vector<PROJECTED_NODE> m_ProjectedNodes;
140 vector<pair<int, double> > m_DOFConstraints;
141 vector<pair<int, int> > m_DOFLinks;
150 };
151
152
153}; // namespace TexGen
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#define CLASS_DECLSPEC
Definition: Misc.h:35
Class for meshing fabric unit cells.
Definition: BasicVolumes.h:33
Triangular element which represents yarn bending.
Definition: Elements.h:99
Triangular element which represents fibre tension.
Definition: Elements.h:141
Class for creating realistic fabric geometry using FE.
vector< pair< int, double > > m_DOFConstraints
vector< pair< int, int > > m_DOFLinks
vector< SPRING > m_Springs
vector< PLATE > m_PlateElements
vector< PROJECTED_NODE > m_ProjectedNodes
double GetLongitudinalBendingModulus()
double GetTransverseBendingModulus()
Defines the nodes and elements of a surface or volume mesh.
Definition: Mesh.h:58
A virtual base class which can be used to deform textiles.
Represents a textile cell containing yarns.
Definition: Textile.h:39
Namespace containing a series of customised math operations not found in the standard c++ library.
bool operator<(const PROP_YARN_INFO &left, const PROP_YARN_INFO &right)
Used for sorting algorithms.
double GetArea(XYZ Points[], int iNumPoints)
Definition: mymath.h:1245
CElementTriBending BendingElement
CElementTriTension TensionElement
Struct for representing points in 3D space.
Definition: mymath.h:56