26CShellElementExport::CShellElementExport(
bool bWholeSurfaces,
bool bTrimSurface )
27: m_bWholeSurfaces( bWholeSurfaces )
28, m_bTrimSurface( bTrimSurface )
38 TGLOG(
"Replacing spaces in filename with underscore for ABAQUS compatibility");
47 TGERROR(
"Unable to create ABAQUS input file: No domain specified");
56 for (i=0; i<iNumYarns; ++i)
67 TGERROR(
"Unable to create ABAQUS input file: Failed to create surface mesh for yarn " << i );
74 for(i=0; i<iNumYarns; ++i)
89 ofstream Output(Filename.c_str(), ofstream::app );
97 map<string, vector<pair<int, int>> > SurfaceDefinitions;
100 TGLOG(
"Creating surfaces");
128 for (
int i=0; i<iNumYarns; ++i)
130 TGLOG(
"Creating yarn " << i <<
" surface definitions");
133 vector<pair<YarnNumber,int>> Elements;
135 SurfaceDefinitions[
"YarnSurf" +
stringify(i)] = Elements;
139 vector<pair<int,int>> UpperFaces, LowerFaces;
141 SurfaceDefinitions[
"Yarn" +
stringify(i) +
"Lower"] = LowerFaces;
142 SurfaceDefinitions[
"Yarn" +
stringify(i) +
"Upper"] = UpperFaces;
155 list<int>::iterator itIndex;
157 pair<int,int> Element;
158 Element.first = iYarn;
162 for (itIndex = Indices.begin(), ElementNum = 0; itIndex != Indices.end(); ++ElementNum)
164 vector<int> ElemIndices;
168 ElemIndices.push_back(*itIndex);
179 Element.second = ElementNum;
182 UpperFaces.push_back(Element);
186 LowerFaces.push_back(Element);
199 pair<int,int> Element;
200 Element.first = iYarn;
205 for ( ElementNum = 0; ElementNum < numElements ; ++ElementNum )
207 Element.second = ElementNum;
208 Elements.push_back(Element);
216 Output <<
"***************************" << endl;
217 Output <<
"*** SURFACE DEFINITIONS ***" << endl;
218 Output <<
"***************************" << endl;
219 vector<pair<YarnNumber,int>>::iterator itElements;
221 map<string, vector<pair<YarnNumber,int>> >::iterator itSurfDef;
223 for (itSurfDef = SurfaceDefinitions.begin(); itSurfDef != SurfaceDefinitions.end(); ++itSurfDef)
225 Output <<
"*Surface, Name=" << itSurfDef->first <<
", Type=Element" << endl;
226 for (itElements = itSurfDef->second.begin(); itElements != itSurfDef->second.end(); ++itElements)
242 TGLOG(
"Getting point information");
243 vector<POINT_INFO> YarnElementInfo;
248 YarnElementInfo.clear();
261 int iElemIndexOffset = 0;
264 for (i=0; i<iNumYarns; ++i)
271 int iNodeIndexOffset = 0;
272 for (i=0; i<iNumYarns; ++i)
281 Output <<
"***************************" << endl;
282 Output <<
"*** CONTACT DEFINITIONS ***" << endl;
283 Output <<
"***************************" << endl;
293 Output <<
"*** WARNING: Contacts are only created for upper and lower surfaces." << endl;
294 Output <<
"*** Any contacts between binder yarns and sides of warp and weft" << endl;
295 Output <<
"*** yarns must be specified manually" << endl;
300 Output <<
"*** WARNING: TexGen was unable to create contact definitions automatically" << endl;
301 Output <<
"*** because the textile is not of type CTextileWeave" << endl;
308 set<pair<int, int> > Contacts;
314 const vector<PATTERN2D> &Cell = Weave.
GetCell(i, j);
315 for (k=1; k<(int)Cell.size(); ++k)
326 set<pair<int, int> > Contacts;
332 const vector<PATTERN3D> &Cell = Weave.
GetCell(i, j);
333 for (k=1; k<(int)Cell.size(); ++k)
345 set<pair<int, int> >::iterator itContact;
346 for (itContact = Contacts.begin(); itContact != Contacts.end(); ++itContact)
350 "YarnSurf" +
stringify(itContact->second) ,
"Yarn");
353 "Yarn" +
stringify(itContact->second) +
"Lower",
"Yarn");
359 Output <<
"*Contact Pair, Interaction=" << InteractionName << endl;
360 Output << Name1 <<
", " << Name2 << endl;
365 Output <<
"************" << endl;
366 Output <<
"*** INTERACTION PROPERTIES ***" << endl;
367 Output <<
"************" << endl;
368 Output <<
"*Surface Interaction, name=YARN" << endl;
369 Output <<
"*Friction" << endl;
370 Output <<
"0.112," << endl;
371 Output <<
"*Surface Behavior, pressure-overclosure=HARD" << endl;
#define TGERROR(MESSAGE)
Macros used to report the file name and line number to the TexGenError and TexGenLog functions.
Abstract base class representing the domain in which a textile cell may lie.
Defines the nodes and elements of a surface or volume mesh.
int GetNumNodes() const
Return the number of nodes.
void InsertMesh(const CMesh &Mesh, XYZ Offset=XYZ(0, 0, 0))
Add the contents of Mesh to this mesh.
bool SaveToABAQUS(string Filename, const vector< POINT_INFO > *pElementInfo=NULL, bool bCreateStep=true, bool bCreateMaterial=true, int iElementType=0)
Save the mesh to ABAQUS input file format with information such as yarn tangents.
const XYZ & GetNode(int iIndex) const
Get the node with given ID.
int RemoveUnreferencedNodes()
Remove nodes that are not referenced by any elements.
void RemoveElementType(ELEMENT_TYPE Type)
Remove elements of given type.
const list< int > & GetIndices(ELEMENT_TYPE ElemType) const
Get the element indices of a given element type.
void CreateSurfaceDefinitions(int iNumYarns, const vector< XYZ > &Repeats, map< string, vector< pair< int, int > > > &SurfaceDefinitions)
void OutputContacts(ostream &Output, set< pair< int, int > > &Contacts)
void GetElementInfo(CTextile &Textile)
Get the element info for centre points of surface mesh elements.
vector< CMesh > m_YarnMeshes
void BuildIndexOffsets()
Generate node and element offsets for merging individual yarn nodes and elements into one ABAQUS file...
void CreateInteractions(ostream &Output)
~CShellElementExport(void)
void GetYarnSurfaces(int iYarn, const vector< XYZ > &Repeats, vector< pair< int, int > > &UpperFaces, vector< pair< int, int > > &LowerFaces)
void CreateSurfaces(ostream &Output, map< string, vector< pair< YarnNumber, int > > > &SurfaceDefinitions)
void CreateContact(ostream &Output, string Name1, string Name2, string InteractionName)
int GetGlobalElementIndex(pair< YarnNumber, int > Element)
void CreateContacts(ostream &Output, const CTextile &Textile)
map< YarnNumber, int > m_NodeIndexOffsets
CTextileMaterials * m_Materials
Class for export of material properties.
bool m_bTrimSurface
True if surfaces to be trimmed to domain.
map< YarnNumber, int > m_ElementIndexOffsets
bool SaveShellElementToABAQUS(string Filename, CTextile &Textile)
Save surface mesh to ABAQUS input file.
void GetYarnSurface(int iYarn, vector< pair< int, int > > &Elements)
vector< POINT_INFO > m_ElementInfo
Represents a 3D woven textile.
int GetYarnIndex(int x, int y, int z) const
const vector< PATTERN3D > & GetCell(int x, int y) const
Represents a textile cell containing yarns.
const CDomain * GetDomain() const
void GetPointInformation(const vector< XYZ > &Points, vector< POINT_INFO > &PointsInfo, double dTolerance=1e-9)
Get useful information of a list of points.
const CYarn * GetYarn(int iIndex) const
void OutputMaterials(ostream &Output, int iNumYarns, bool bMatrixOnly)
Output materials and assign to yarn element sets.
void SetupMaterials(CTextile &Textile)
Set up a material for each unique set of material constants.
Represents a woven textile.
int GetYarnIndex(int x, int y, int z) const
const vector< PATTERN2D > & GetCell(int x, int y) const
Represents a yarn consisting of master nodes, section and interpolation function.
bool AddSurfaceToMesh(CMesh &Mesh, bool bAddEndCaps=true) const
Create surface mesh for this yarn and add it to the surface mesh object.
const vector< XYZ > & GetRepeats() const
Namespace containing a series of customised math operations not found in the standard c++ library.
std::string ReplaceFilenameSpaces(std::string Filename)
Replaces spaces in filename with underscore.
std::string stringify(const T &x, int iPrecision=12, bool bScientific=true)
Function to convert a value (e.g. int, double, etc...) to a string.
XYZ CrossProduct(const XYZ &left, const XYZ &right)
Get the cross product of two vectors.
Struct for representing points in 3D space.