TexGen
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
TexGen::CMesh Class Reference

Defines the nodes and elements of a surface or volume mesh. More...

#include <Mesh.h>

Public Types

enum  ELEMENT_TYPE {
  TRI , QUAD , TET , PYRAMID ,
  WEDGE , HEX , LINE , POLYLINE ,
  QUADRATIC_TET , POLYGON , NUM_ELEMENT_TYPES
}
 Each element type is represented by a unique integer value. More...
 

Public Member Functions

 CMesh (void)
 
 CMesh (TiXmlElement &Element)
 
 ~CMesh (void)
 
void PopulateTiXmlElement (TiXmlElement &Element, OUTPUT_TYPE OutputType) const
 Used for saving data to XML. More...
 
list< int >::iterator ConvertQuadtoTriangles (list< int >::iterator itQuad)
 Convert a specific quad element to two triangles. More...
 
void ConvertTrianglestoSegments ()
 Convert triangle elements to segments. More...
 
void ConvertQuadstoTriangles (bool bQuality=true)
 Convert the quad elements to triangles. More...
 
void ConvertHextoQuad ()
 Convert Hex elements to Quad elements representing their surface. More...
 
void ConvertWedgeto2D ()
 Convert Wedge elements to Quad and Triangle elements representing their surface. More...
 
void ConvertTettoTriangle ()
 Convert Tet elements to Triangle elements representing their surface. More...
 
void ConvertHextoWedge (bool bQuality=true)
 Convert Hexahedral elements to Wedge elements. More...
 
void ConvertWedgetoTetandPyramid (bool bQuality=true)
 Convert Wedge elements to a combination of Tetrahedral and Pyramid elements. More...
 
void ConvertPyramidtoTet (bool bQuality=true)
 Convert Pyramid elements to Tetrahedral elements. More...
 
void ConvertWedgetoTet (bool bQuality=true)
 Convert Wedge elements to Tetrahedral elements. More...
 
void ConvertHextoTet (bool bQuality=true)
 Convert Hexahedral elements to Tetrahedral elements. More...
 
void ConvertPyramidto2D ()
 Convert Pyramid elements to Quad and Triangle elements representing their surface. More...
 
void Convert3Dto2D ()
 Convert all 3D elements to 2D elements representing their surface. More...
 
void ConvertToSurfaceMesh ()
 Convert a volume mesh into a surface mesh (interior surfaces are elliminated) More...
 
void ConvertToTetMesh ()
 
void ConvertToTriangleMesh ()
 
void ConvertToSegmentMesh ()
 Convert all elements to segments. More...
 
void ConvertTriToQuad (double Tolerance=1e-6)
 Convert Triangel elements to Quads. More...
 
pair< XYZ, XYZGetAABB (double dGrowDistance=0) const
 Get an axis aligned bounding box for the mesh. More...
 
int MergeNodes (const double Tolerance=1e-8)
 If any nodes share the same coordinates merge the nodes together and adjust indices accordingly. More...
 
int RemoveUnreferencedNodes ()
 Remove nodes that are not referenced by any elements. More...
 
void RemoveAllElementsExcept (ELEMENT_TYPE Type)
 Remove all elements except those of given type. More...
 
void RemoveElementType (ELEMENT_TYPE Type)
 Remove elements of given type. More...
 
int DeleteNodes (const set< int > &Nodes)
 Delete nodes and adjust node indices. More...
 
void ChangeNodeIndices (int iChangeTo, int iChangeFrom)
 Change all the indices from one number to another. More...
 
void ChangeNodeIndices (int iChangeTo, int iChangeFrom, vector< vector< int * > > &References)
 Change all the indices from one number to another. More...
 
void RemoveOpposingTriangles ()
 Remove triangles that have the same indices but opposite normals. More...
 
void RemoveOpposingQuads ()
 Remove quads that have the same indices but opposite normals. More...
 
void RemoveDegenerateTriangles ()
 Remove triangles which have two equal corner indices. More...
 
void RemoveDuplicateTriangles ()
 
void RemoveDuplicateSegments ()
 Remove segments which have the same indices. More...
 
void RemoveDuplicateElements (CMesh::ELEMENT_TYPE ElementType)
 Remove duplicate elements which have the same indices (leaves one copy of element) More...
 
void GetNodeElementReferences (vector< vector< int * > > &References)
 Get a list of elements which reference each node. More...
 
int InsertNodes (const CMesh &Mesh, XYZ Offset=XYZ(0, 0, 0))
 Add the nodes of Mesh to this mesh. More...
 
void InsertMesh (const CMesh &Mesh, XYZ Offset=XYZ(0, 0, 0))
 Add the contents of Mesh to this mesh. More...
 
void Rotate (WXYZ Rotation, XYZ Origin=XYZ(0, 0, 0))
 Rotate the whole mesh by given quaternion. More...
 
void Translate (XYZ Vector)
 Translate whole mesh by given vector. More...
 
void FlipNormals ()
 Flip the normals of the mesh for triangles and quads. More...
 
void MeshClosedLoop (const XYZ &Normal, const vector< int > &ClosedLoopVector, bool bQuality=false)
 
void MeshConvexHull ()
 Create a triangular convex hull of the nodes contained within the mesh. More...
 
void Clear ()
 Empty mesh nodes and indices. More...
 
void CopySelfToRange (XYZ Vector, int iLowerLimit, int iUpperLimit)
 Copy the mesh to the range given by the lower limit and upper limit with the given repeat vector. More...
 
int OutputNodes (ostream &Output, int iStartIndex=1, string Seperator=", ", bool bSCIRun=false) const
 Output the node coordinates in the mesh each on a new line, components seperated by commas. More...
 
int OutputElements (ostream &Output, ELEMENT_TYPE ElementType, int iStartIndex=1, int iIndexOffset=1, string Seperator=", ", bool bSCIRun=false) const
 Output the element indices in the mesh each on a new line, indices seperated by commas. More...
 
double CalculateVolume () const
 Calculate the volume of the mesh. More...
 
vector< XYZGetElementCenters () const
 Get a vector of element centers, one entry for each element. More...
 
vector< XYZGetElementCenters (ELEMENT_TYPE type)
 Get a vector of element centres of a given element type. More...
 
int CountInvertedElements () const
 Check and count if any of the elements are inverted. More...
 
int CountInvertedElements (ELEMENT_TYPE ElementType) const
 Check and count if the elements of given type are inverted. More...
 
int IntersectLine (const XYZ &P1, const XYZ &P2, vector< pair< double, XYZ > > &IntersectionPoints, pair< bool, bool > TrimResults=make_pair(false, false), bool bForceFind=false) const
 Find the points where a line intersects the mesh. More...
 
void BuildGrid (XYZ Min, XYZ Max, int iNumX, int iNumY, int iNumZ)
 Build grid of points. More...
 
void BuildGrid (XYZ Min, XYZ Max, double dPointsPerUnit)
 Build grid of points. More...
 
vector< pair< int, int > > GetNodePairs (XYZ Vector, const double Tolerance=1e-6) const
 Return a list of node pairs (A, B) where A == B + Vector. More...
 
void GetNodePairs (XYZ Vector, vector< pair< int, int > > &NodePairs, const double Tolerance=1e-6) const
 
int GetClosestNode (XYZ Position) const
 Get the index of the node closest to the given position space. More...
 
int GetClosestNodeDistance (XYZ Position, double dTol) const
 Get the index of the node within a given tolerance distance to the given position space. More...
 
void ConvertElementListToVector (ELEMENT_TYPE ElementType, vector< int > &Indices)
 Convert element index list to vector so can access by index. More...
 
bool SaveToSTL (string Filename, bool bBinary=true) const
 Save the mesh to STL file. More...
 
bool SaveToVTK (string Filename, const vector< CMeshDataBase * > *pMeshData=NULL) const
 Save the mesh to VTK unstructured grid file format (.vtu) More...
 
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. More...
 
bool SaveToSMESH (string Filename) const
 Save the mesh to a .smesh file to be used in conjunction with tetgen. More...
 
bool SaveToSCIRun (string Filename)
 Save the mesh to SCIRun format. More...
 
bool AddElement (ELEMENT_TYPE Type, const vector< int > &Indices)
 Add an element to the mesh of given type with node number checking. More...
 
int GetNumElements (ELEMENT_TYPE Type) const
 Get the number of elements of a given type. More...
 
int GetNumElements () const
 Get the total number of elements in the mesh. More...
 
vector< XYZ >::const_iterator NodesBegin () const
 
vector< XYZ >::const_iterator NodesEnd () const
 
vector< XYZ >::iterator NodesBegin ()
 
vector< XYZ >::iterator NodesEnd ()
 
const int AddNode (XYZ Node)
 Append a node to the list of nodes, the integer returns the index of the node
More...
 
void SetNode (int iIndex, XYZ Node)
 Set the node at given index. More...
 
const XYZGetNode (int iIndex) const
 Get the node with given ID. More...
 
vector< XYZ >::iterator DeleteNode (vector< XYZ >::iterator it)
 Delete a node given iterator. More...
 
int GetNumNodes () const
 Return the number of nodes. More...
 
const bool NodesEmpty () const
 Returns true if the nodes array is empty. More...
 
const vector< XYZ > & GetNodes () const
 Get a const reference to the nodes. More...
 
vector< XYZ > & GetNodes ()
 
void SetNumNodes (int NumNodes)
 Resize the vector size. More...
 
const list< int > & GetIndices (ELEMENT_TYPE ElemType) const
 Get the element indices of a given element type. More...
 
list< int > & GetIndices (ELEMENT_TYPE ElemType)
 

Static Public Member Functions

static int GetNumNodes (ELEMENT_TYPE Type)
 Get the number of nodes a particular element type contains. More...
 

Protected Member Functions

int FillVTKPointData (TiXmlElement &Points) const
 
int FillVTKCellData (TiXmlElement &Cells) const
 

Static Protected Member Functions

static void AddOrCancel (list< pair< int, int > > &EdgeStack, pair< int, int > Edge)
 Add an edge to the stack of edges if it doesn't already exist otherwise if it exists delete it. More...
 
static void WriteBinaryXYZ (ostream &Output, XYZ Vector)
 

Protected Attributes

vector< XYZm_Nodes
 List of nodes. More...
 
list< int > m_Indices [NUM_ELEMENT_TYPES]
 Map of indices into the nodes. More...
 

Detailed Description

Defines the nodes and elements of a surface or volume mesh.

CMesh is a data structure that represents a mesh whith some additional functions to perform basic tasks and output to various file formats. As such, direct access to the data is provided. m_Nodes is a vector of nodes contained within the mesh. m_Indices is a list of indices into the nodes. The element types supported are listed in the ELEMENT_TYPE enum, this can be easily be extended. If this is done the GetNumNodes function must be updated to specify the number of nodes the element type uses.

Sample code to create a triangle mesh with two elements and save to STL is shown below: CMesh Mesh; Mesh.AddNode(XYZ(0,0,0)); Mesh.AddNode(XYZ(1,0,0)); Mesh.AddNode(XYZ(0,1,0)); Mesh.AddNode(XYZ(1,1,0)); vector<int> Tri1, Tri2; Tri1.push_back(0); Tri1.push_back(1); Tri1.push_back(2); Tri2.push_back(1); Tri2.push_back(3); Tri2.push_back(2); Mesh.AddElement(CMesh::TRI, Tri1); Mesh.AddElement(CMesh::TRI, Tri2); Mesh.SaveToSTL("sample.stl");

Definition at line 57 of file Mesh.h.

Member Enumeration Documentation

◆ ELEMENT_TYPE

Each element type is represented by a unique integer value.

Enumerator
TRI 
QUAD 
TET 
PYRAMID 
WEDGE 
HEX 
LINE 
POLYLINE 
QUADRATIC_TET 
POLYGON 
NUM_ELEMENT_TYPES 

Definition at line 65 of file Mesh.h.

Constructor & Destructor Documentation

◆ CMesh() [1/2]

CMesh::CMesh ( void  )

Definition at line 33 of file Mesh.cpp.

◆ CMesh() [2/2]

CMesh::CMesh ( TiXmlElement &  Element)

Definition at line 41 of file Mesh.cpp.

References FOR_EACH_TIXMLELEMENT, m_Indices, and m_Nodes.

◆ ~CMesh()

CMesh::~CMesh ( void  )

Definition at line 37 of file Mesh.cpp.

Member Function Documentation

◆ AddElement()

bool CMesh::AddElement ( ELEMENT_TYPE  Type,
const vector< int > &  Indices 
)

◆ AddNode()

const int CMesh::AddNode ( XYZ  Node)

Append a node to the list of nodes, the integer returns the index of the node

Definition at line 2624 of file Mesh.cpp.

References m_Nodes.

Referenced by TexGen::CYarn::AddAABBToMesh(), TexGen::CYarn::AddCentrePlaneToMesh(), TexGen::CYarn::AddNodesToMesh(), TexGen::CYarn::AddPathToMesh(), TexGen::CYarn::AddSurfaceToMesh(), TexGen::CTextile::AddSurfaceToMesh(), TexGen::CDomainPlanes::BuildMesh(), TexGen::CDomainPrism::ClipIntersectMeshToDomain(), TexGen::CDomainPlanes::ClipMeshToDomain(), TexGen::CDomainPrism::ClipMeshToDomain(), TexGen::CMesher::ConvertMeshToQuadratic(), TexGen::CGeometrySolver::CreateDebugSystem(), TexGen::CSectionMeshTriangulate::CreateMesh(), TexGen::CSectionMeshRectangular::CreateSingleLayerMesh(), TexGen::CGeometrySolver::CreateSystem(), TexGen::CShearedTextileWeave2D::CreateTopAndBottomMeshes(), TexGen::CMesher::CreateVolumeMesh(), TexGen::CTextile::DetectInterference(), TexGen::CYarnSectionInterp::GetInterpedSectionMesh(), TexGen::CSectionMeshTriangulate::GetSimpleMesh(), TexGen::CSectionMeshTriangulate::GetTriangleMesh(), TexGen::CMesher::MeshDifficultRegion(), TexGen::CBasicVolumes::MeshProjectedAreas(), TexGen::CPrismVoxelMesh::OutputNodes(), TexGen::CRectangularVoxelMesh::OutputNodes(), TexGen::CRotatedVoxelMesh::OutputNodes(), TexGen::CShearedVoxelMesh::OutputNodes(), TexGen::CTetgenMesh::SaveMesh(), TexGen::CBasicVolumes::SaveProjectedContoursToVTK(), TexGen::CTetgenMesh::SaveTetgenMesh(), TexGen::CBasicVolumes::SeedOuterBoundary(), TexGen::CBasicVolumes::SplitLinesByLines(), TexGen::CMeshDomainPlane::Triangulate(), and TexGen::CSlaveNode::UpdateSectionMesh().

◆ AddOrCancel()

void CMesh::AddOrCancel ( list< pair< int, int > > &  EdgeStack,
pair< int, int >  Edge 
)
staticprotected

Add an edge to the stack of edges if it doesn't already exist otherwise if it exists delete it.

This function is used in conjunction with MeshConvexHull.

Definition at line 1740 of file Mesh.cpp.

Referenced by MeshConvexHull().

◆ BuildGrid() [1/2]

void CMesh::BuildGrid ( XYZ  Min,
XYZ  Max,
double  dPointsPerUnit 
)

Build grid of points.

Builds a structured grid of points

Parameters
MinThe lower bound for the set of points
MaxThe upper bound for the set of points
dPointsPerUnitNumber of points to per unit length

Definition at line 1913 of file Mesh.cpp.

References BuildGrid(), TexGen::Max(), TexGen::Min(), TexGen::Round(), TexGen::XYZ::x, TexGen::XYZ::y, and TexGen::XYZ::z.

◆ BuildGrid() [2/2]

void CMesh::BuildGrid ( XYZ  Min,
XYZ  Max,
int  iNumX,
int  iNumY,
int  iNumZ 
)

Build grid of points.

Builds a structured grid of points

Parameters
MinThe lower bound for the set of points
MaxThe upper bound for the set of points
iNumXNumber of points along the x axis
iNumYNumber of points along the y axis
iNumZNumber of points along the z axis

Definition at line 1881 of file Mesh.cpp.

References HEX, m_Indices, m_Nodes, TexGen::Max(), TexGen::Min(), TexGen::XYZ::x, TexGen::XYZ::y, and TexGen::XYZ::z.

Referenced by BuildGrid().

◆ CalculateVolume()

double CMesh::CalculateVolume ( ) const

Calculate the volume of the mesh.

If the mesh is a surface mesh, the surface must be completely closed and have triangle normals facing outside the volume. If the mesh contains quads, a copy of the mesh will be created and then the quads will be converted to triangles for volume calculation. Similarly if the mesh contains any 3d elements, these will be converted to 2d elements which will in turn be converted to triangles. The original mesh will not be affected.

Definition at line 1519 of file Mesh.cpp.

References CalculateVolume(), ConvertToTriangleMesh(), m_Indices, m_Nodes, NUM_ELEMENT_TYPES, TRI, TexGen::XYZ::x, TexGen::XYZ::y, and TexGen::XYZ::z.

Referenced by CalculateVolume(), CountInvertedElements(), TexGen::CTextile::GetQuickDomainVolumeFraction(), TexGen::CYarn::GetRawYarnVolume(), and TexGen::CDomain::GetVolume().

◆ ChangeNodeIndices() [1/2]

void CMesh::ChangeNodeIndices ( int  iChangeTo,
int  iChangeFrom 
)

Change all the indices from one number to another.

Definition at line 107 of file Mesh.cpp.

References m_Indices, and NUM_ELEMENT_TYPES.

Referenced by TexGen::COctreeVisitorMergeNodes::visitLeaf().

◆ ChangeNodeIndices() [2/2]

void CMesh::ChangeNodeIndices ( int  iChangeTo,
int  iChangeFrom,
vector< vector< int * > > &  References 
)

Change all the indices from one number to another.

This function is far more efficient than the function where the references are not given. References can be obtained with GetNodeElementReferences function which itself is rather time consuming. However GetNodeElementReferences need only be called once for multiple calls to ChangeNodeIndices. References will be updated reflecting the change in node indices.

Definition at line 123 of file Mesh.cpp.

◆ Clear()

void CMesh::Clear ( )

◆ Convert3Dto2D()

void CMesh::Convert3Dto2D ( )

◆ ConvertElementListToVector()

void CMesh::ConvertElementListToVector ( ELEMENT_TYPE  ElementType,
vector< int > &  Indices 
)

Convert element index list to vector so can access by index.

Parameters
ElementTypeThe element type of the list to be converted
IndicesArray to add list to

Definition at line 2683 of file Mesh.cpp.

References m_Indices, and NUM_ELEMENT_TYPES.

Referenced by TexGen::CYarn::PointInsideYarn().

◆ ConvertHextoQuad()

void CMesh::ConvertHextoQuad ( )

Convert Hex elements to Quad elements representing their surface.

Definition at line 765 of file Mesh.cpp.

References HEX, m_Indices, and QUAD.

Referenced by Convert3Dto2D().

◆ ConvertHextoTet()

void CMesh::ConvertHextoTet ( bool  bQuality = true)

Convert Hexahedral elements to Tetrahedral elements.

This is done by converting hexes to wedge and then to tets

Definition at line 1002 of file Mesh.cpp.

References ConvertHextoWedge(), and ConvertWedgetoTet().

Referenced by ConvertToTetMesh().

◆ ConvertHextoWedge()

void CMesh::ConvertHextoWedge ( bool  bQuality = true)

Convert Hexahedral elements to Wedge elements.

Definition at line 882 of file Mesh.cpp.

References HEX, m_Indices, and WEDGE.

Referenced by ConvertHextoTet().

◆ ConvertPyramidto2D()

void CMesh::ConvertPyramidto2D ( )

Convert Pyramid elements to Quad and Triangle elements representing their surface.

Definition at line 1008 of file Mesh.cpp.

References m_Indices, PYRAMID, QUAD, and TRI.

Referenced by Convert3Dto2D().

◆ ConvertPyramidtoTet()

void CMesh::ConvertPyramidtoTet ( bool  bQuality = true)

Convert Pyramid elements to Tetrahedral elements.

Definition at line 949 of file Mesh.cpp.

References TexGen::GetLengthSquared(), m_Indices, m_Nodes, PYRAMID, and TET.

Referenced by ConvertToTetMesh(), and ConvertWedgetoTet().

◆ ConvertQuadstoTriangles()

void CMesh::ConvertQuadstoTriangles ( bool  bQuality = true)

◆ ConvertQuadtoTriangles()

list< int >::iterator CMesh::ConvertQuadtoTriangles ( list< int >::iterator  itQuad)

Convert a specific quad element to two triangles.

Definition at line 1044 of file Mesh.cpp.

References m_Indices, QUAD, and TRI.

Referenced by TexGen::CDomainPrism::ClipIntersectMeshToDomain(), and TexGen::CDomainPlanes::ClipMeshToDomain().

◆ ConvertTettoTriangle()

void CMesh::ConvertTettoTriangle ( )

Convert Tet elements to Triangle elements representing their surface.

Definition at line 852 of file Mesh.cpp.

References m_Indices, TET, and TRI.

Referenced by Convert3Dto2D().

◆ ConvertToSegmentMesh()

void CMesh::ConvertToSegmentMesh ( )

Convert all elements to segments.

Definition at line 599 of file Mesh.cpp.

References ConvertToTriangleMesh(), ConvertTrianglestoSegments(), and RemoveDuplicateSegments().

Referenced by TexGen::CGeometrySolver::CreateSystem().

◆ ConvertToSurfaceMesh()

void CMesh::ConvertToSurfaceMesh ( )

Convert a volume mesh into a surface mesh (interior surfaces are elliminated)

Definition at line 569 of file Mesh.cpp.

References Convert3Dto2D(), RemoveOpposingQuads(), and RemoveOpposingTriangles().

Referenced by TexGen::CSimulationAbaqus::GetYarnSurface(), and TexGen::CSimulationAbaqus::GetYarnSurfaces().

◆ ConvertToTetMesh()

void CMesh::ConvertToTetMesh ( )

Convert all elements to tetrahedrons where possible and remove those that cannot be converted

Definition at line 584 of file Mesh.cpp.

References ConvertHextoTet(), ConvertPyramidtoTet(), ConvertWedgetoTet(), RemoveAllElementsExcept(), and TET.

Referenced by TexGen::CTextile::GetDomainVolumeFraction().

◆ ConvertToTriangleMesh()

void CMesh::ConvertToTriangleMesh ( )

Convert all elements to triangles where possible and remove those that cannot be converted

Definition at line 592 of file Mesh.cpp.

References Convert3Dto2D(), ConvertQuadstoTriangles(), RemoveAllElementsExcept(), and TRI.

Referenced by CalculateVolume(), ConvertToSegmentMesh(), and SaveToSTL().

◆ ConvertTrianglestoSegments()

void CMesh::ConvertTrianglestoSegments ( )

Convert triangle elements to segments.

Definition at line 1066 of file Mesh.cpp.

References LINE, m_Indices, and TRI.

Referenced by ConvertToSegmentMesh().

◆ ConvertTriToQuad()

void CMesh::ConvertTriToQuad ( double  Tolerance = 1e-6)

Convert Triangel elements to Quads.

This requires there to be two common nodes and for the normals of the two elements to be equal

Definition at line 606 of file Mesh.cpp.

References AddElement(), TexGen::CrossProduct(), TexGen::GetLength(), GetNumNodes(), m_Indices, m_Nodes, QUAD, and TRI.

Referenced by TexGen::CTextile::AddSurfaceToMesh().

◆ ConvertWedgeto2D()

void CMesh::ConvertWedgeto2D ( )

Convert Wedge elements to Quad and Triangle elements representing their surface.

Definition at line 813 of file Mesh.cpp.

References m_Indices, QUAD, TRI, and WEDGE.

Referenced by Convert3Dto2D().

◆ ConvertWedgetoTet()

void CMesh::ConvertWedgetoTet ( bool  bQuality = true)

Convert Wedge elements to Tetrahedral elements.

This is done by converting wedge element to tets and pyramids then to tets alone

Definition at line 996 of file Mesh.cpp.

References ConvertPyramidtoTet(), and ConvertWedgetoTetandPyramid().

Referenced by ConvertHextoTet(), and ConvertToTetMesh().

◆ ConvertWedgetoTetandPyramid()

void CMesh::ConvertWedgetoTetandPyramid ( bool  bQuality = true)

Convert Wedge elements to a combination of Tetrahedral and Pyramid elements.

Definition at line 918 of file Mesh.cpp.

References m_Indices, PYRAMID, TET, and WEDGE.

Referenced by ConvertWedgetoTet().

◆ CopySelfToRange()

void CMesh::CopySelfToRange ( XYZ  Vector,
int  iLowerLimit,
int  iUpperLimit 
)

Copy the mesh to the range given by the lower limit and upper limit with the given repeat vector.

Definition at line 1437 of file Mesh.cpp.

References Clear(), and InsertMesh().

Referenced by TexGen::CYarn::AddAABBToMesh(), TexGen::CYarn::AddSurfaceToMesh(), and TexGen::CYarn::AddVolumeToMesh().

◆ CountInvertedElements() [1/2]

int CMesh::CountInvertedElements ( ) const

Check and count if any of the elements are inverted.

This function is not efficient

Definition at line 1595 of file Mesh.cpp.

References CountInvertedElements(), and NUM_ELEMENT_TYPES.

Referenced by CountInvertedElements().

◆ CountInvertedElements() [2/2]

int CMesh::CountInvertedElements ( ELEMENT_TYPE  ElementType) const

Check and count if the elements of given type are inverted.

This function is not efficient

Definition at line 1606 of file Mesh.cpp.

References CalculateVolume(), GetNumNodes(), m_Indices, m_Nodes, PYRAMID, TET, and WEDGE.

◆ DeleteNode()

vector< XYZ >::iterator CMesh::DeleteNode ( vector< XYZ >::iterator  it)

Delete a node given iterator.

Definition at line 2641 of file Mesh.cpp.

References m_Nodes.

Referenced by TexGen::CDomainPlanes::BuildMesh().

◆ DeleteNodes()

int CMesh::DeleteNodes ( const set< int > &  Nodes)

Delete nodes and adjust node indices.

Definition at line 728 of file Mesh.cpp.

References m_Indices, m_Nodes, and NUM_ELEMENT_TYPES.

Referenced by RemoveUnreferencedNodes(), and TexGen::COctreeVisitorMergeNodes::visitRoot().

◆ FillVTKCellData()

int CMesh::FillVTKCellData ( TiXmlElement &  Cells) const
protected

Definition at line 2469 of file Mesh.cpp.

References GetNumNodes(), HEX, LINE, m_Indices, NUM_ELEMENT_TYPES, POLYLINE, PYRAMID, QUAD, QUADRATIC_TET, TET, TGLOG, TRI, and WEDGE.

Referenced by SaveToVTK().

◆ FillVTKPointData()

int CMesh::FillVTKPointData ( TiXmlElement &  Points) const
protected

Definition at line 2447 of file Mesh.cpp.

References m_Nodes, and TGLOG.

Referenced by SaveToVTK().

◆ FlipNormals()

void CMesh::FlipNormals ( )

Flip the normals of the mesh for triangles and quads.

Definition at line 1166 of file Mesh.cpp.

References m_Indices, QUAD, and TRI.

Referenced by TexGen::CYarn::AddEndCapsToMesh().

◆ GetAABB()

pair< XYZ, XYZ > CMesh::GetAABB ( double  dGrowDistance = 0) const

◆ GetClosestNode()

int CMesh::GetClosestNode ( XYZ  Position) const

Get the index of the node closest to the given position space.

Parameters
PositionThe position to which the closest node should be found
Returns
The index of the closest node or -1 if no nodes exist in this mesh

Definition at line 532 of file Mesh.cpp.

References TexGen::GetLengthSquared(), and m_Nodes.

Referenced by TexGen::CSimulationAbaqus::GetCenterNode().

◆ GetClosestNodeDistance()

int CMesh::GetClosestNodeDistance ( XYZ  Position,
double  dTol 
) const

Get the index of the node within a given tolerance distance to the given position space.

Parameters
PositionThe position to which the closest node should be found
dTolThe tolerance for the distance from the node to the point
Returns
The index of the closest node or -1 if no nodes exist in this mesh

Definition at line 550 of file Mesh.cpp.

References TexGen::GetLengthSquared(), and m_Nodes.

Referenced by TexGen::CTetgenMesh::SaveTetgenMesh().

◆ GetElementCenters() [1/2]

vector< XYZ > CMesh::GetElementCenters ( ) const

Get a vector of element centers, one entry for each element.

Definition at line 1549 of file Mesh.cpp.

References GetNumNodes(), m_Indices, m_Nodes, NUM_ELEMENT_TYPES, and TGLOG.

Referenced by TexGen::CTextile::GetDomainVolumeFraction(), and TexGen::CTetgenMesh::SaveMesh().

◆ GetElementCenters() [2/2]

vector< XYZ > CMesh::GetElementCenters ( ELEMENT_TYPE  type)

Get a vector of element centres of a given element type.

Definition at line 1576 of file Mesh.cpp.

References GetNumNodes(), m_Indices, and m_Nodes.

◆ GetIndices() [1/2]

list< int > & CMesh::GetIndices ( ELEMENT_TYPE  ElemType)

Definition at line 2677 of file Mesh.cpp.

References m_Indices, and NUM_ELEMENT_TYPES.

◆ GetIndices() [2/2]

const list< int > & CMesh::GetIndices ( ELEMENT_TYPE  ElemType) const

Get the element indices of a given element type.

Definition at line 2671 of file Mesh.cpp.

References m_Indices, and NUM_ELEMENT_TYPES.

Referenced by TexGen::CYarn::AddCentrePlaneToMesh(), TexGen::CMesher::AddQuadraticNodesToSets(), TexGen::CTextile::AddSurfaceToMesh(), TexGen::CYarn::AddVolumeToMesh(), TexGen::CDomainPrism::ClipIntersectMeshToDomain(), TexGen::CDomainPlanes::ClipMeshToDomain(), TexGen::CDomainPrism::ClipMeshToDomain(), TexGen::CMesher::ConvertMeshToQuadratic(), TexGen::CGeometrySolver::CreateDebugSystem(), TexGen::CSectionMeshRectangleSection::CreateMesh(), TexGen::CSectionMeshRectangular::CreateMesh(), TexGen::CSectionMeshTriangulate::CreateMesh(), TexGen::CGeometrySolver::CreatePlateElements(), TexGen::CBasicVolumes::CreateProjectedAreas(), TexGen::CBasicVolumes::CreateProjectedCenters(), TexGen::CGeometrySolver::CreateSurfaceMesh(), TexGen::CMesher::CreateVolumeMesh(), TexGen::CDomainPlanes::FillGaps(), TexGen::CDomainPrism::FillGaps(), TexGen::CMesher::FillYarnTangentsData(), TexGen::CSimulationAbaqus::FindFaceIndex(), TexGen::CDomainPrism::GeneratePlanes(), TexGen::CGeometrySolver::GetAverageLength(), TexGen::CMesher::GetBestSeed(), TexGen::CGeometrySolver::GetDisplacement(), TexGen::CTextileDeformerVolumeMesh::GetDisplacement(), TexGen::CTextile::GetDomainVolumeFraction(), TexGen::CSimulationAbaqus::GetElementVolumeFractions(), TexGen::CYarnSectionInterp::GetInterpedSectionMesh(), TexGen::CYarn::GetMeshPoint(), TexGen::CTexGenRenderer::GetPolyData(), TexGen::CBasicVolumes::GetProjectedMesh(), TexGen::CBasicVolumes::GetRegionArea(), TexGen::CSectionMeshTriangulate::GetTriangleMesh(), TexGen::CSimulationAbaqus::GetYarnSurface(), TexGen::CSimulationAbaqus::GetYarnSurfaces(), TexGen::CShellElementExport::GetYarnSurfaces(), TexGen::CBasicVolumes::MergeStraightLines(), TexGen::CMeshDomainPlane::MeshDomainPlanes(), TexGen::CBasicVolumes::MeshProjectedAreas(), TexGen::CGeometrySolver::RaiseNodes(), TexGen::CMesher::RaiseNodes(), TexGen::CBasicVolumes::RemoveDegenerateSegments(), TexGen::CBasicVolumes::RemoveDuplicateSegments(), TexGen::CBasicVolumes::SaveProjectedContoursToVTK(), TexGen::CTetgenMesh::SaveTetgenMesh(), TexGen::CGeometrySolver::SaveToVTK(), TexGen::CBasicVolumes::SeedOuterBoundary(), TexGen::CBasicVolumes::SplitLinesByLines(), TexGen::CBasicVolumes::SplitLinesByNodes(), TexGen::CMeshDomainPlane::Triangulate(), TexGen::CSlaveNode::UpdateSectionMesh(), and TexGen::CBasicVolumes::ValidProjectedMesh().

◆ GetNode()

const XYZ & CMesh::GetNode ( int  iIndex) const

Get the node with given ID.

Definition at line 2636 of file Mesh.cpp.

References m_Nodes.

Referenced by TexGen::CAdjustMeshInterference::AddIntersectElementsToMesh(), TexGen::CTextile::AddSurfaceToMesh(), TexGen::CMeshIntersectionData::AdjustInterpolationNode(), TexGen::CGeometrySolver::AssignFibreDirectionToElements(), TexGen::CMesher::BuildMidSideNode(), TexGen::CRotatedVoxelMesh::CalculateVoxelSizes(), TexGen::CShearedVoxelMesh::CalculateVoxelSizes(), TexGen::CAdjustMeshInterference::CheckInitialIntersections(), TexGen::CDomainPrism::ClipIntersectMeshToDomain(), TexGen::CDomainPlanes::ClipMeshToDomain(), TexGen::CDomainPrism::ClipMeshToDomain(), TexGen::CMeshDomainPlane::ConvertDomainPointsTo2D(), TexGen::CSimulationAbaqus::CreateBoundary(), TexGen::CGeometrySolver::CreateDebugSystem(), TexGen::CGeometrySolver::CreatePlateElements(), TexGen::CBasicVolumes::CreateProjectedAreas(), TexGen::CBasicVolumes::CreateProjectedCenters(), TexGen::CGeometrySolver::CreateSystem(), TexGen::CMesher::CreateVolumeMesh(), TexGen::CDomainPlanes::FillGaps(), TexGen::CDomainPrism::FillGaps(), TexGen::CMesher::FillYarnTangentsData(), TexGen::CMeshIntersectionData::FindInterpolationNode(), TexGen::CAdjustMeshInterference::FindMeshPolygonSection(), TexGen::CDomainPrism::GeneratePlanes(), TexGen::CGeometrySolver::GetAverageLength(), TexGen::CMesher::GetBestSeed(), TexGen::CTextileDeformerVolumeMesh::GetDisplacement(), TexGen::CTextile::GetDomainVolumeFraction(), TexGen::CYarnSectionInterp::GetInterpedSectionMesh(), TexGen::CYarn::GetMeshPoint(), TexGen::CMesher::GetMidSideNode(), TexGen::CBasicVolumes::GetProjectedMesh(), TexGen::CBasicVolumes::GetRegionArea(), TexGen::CSimulationAbaqus::GetSectionArea(), TexGen::COctreeAgentElement::getSubcellOverlaps(), TexGen::CSimulationAbaqus::GetYarnSurfaces(), TexGen::CShellElementExport::GetYarnSurfaces(), TexGen::COctreeAgentElement::isOverlappingCell(), TexGen::CBasicVolumes::MergeStraightLines(), TexGen::CMesher::MeshDifficultRegion(), TexGen::CBasicVolumes::MeshProjectedAreas(), TexGen::CMeshIntersectionData::MoveNode(), TexGen::CMeshDomainPlane::OffsetMeshPoints(), TexGen::CBasicVolumes::PointInsideRegion(), TexGen::CYarn::PointInsideYarn(), TexGen::CGeometrySolver::RaiseNodes(), TexGen::CMesher::RaiseNodes(), TexGen::CBasicVolumes::SaveProjectedContoursToVTK(), TexGen::CBasicVolumes::SeedOuterBoundary(), TexGen::CRotatedPeriodicBoundaries::SetDomainSize(), TexGen::CShearedPeriodicBoundaries::SetDomainSize(), TexGen::CMesher::SortPairs(), TexGen::CBasicVolumes::SplitLinesByLines(), and TexGen::CBasicVolumes::SplitLinesByNodes().

◆ GetNodeElementReferences()

void CMesh::GetNodeElementReferences ( vector< vector< int * > > &  References)

Get a list of elements which reference each node.

To be used in conjunction with ChangeNodeIndices function

Definition at line 1504 of file Mesh.cpp.

References m_Indices, m_Nodes, and NUM_ELEMENT_TYPES.

Referenced by TexGen::COctreeVisitorMergeNodes::visitRoot().

◆ GetNodePairs() [1/2]

vector< pair< int, int > > CMesh::GetNodePairs ( XYZ  Vector,
const double  Tolerance = 1e-6 
) const

Return a list of node pairs (A, B) where A == B + Vector.

This is usefull for applying boundary conditions. For example given a block width w and height h, all node pairs given by vector XYZ(w, 0, 0) should be tied together and all node pairs given by vector XYZ(0, h, 0) should be tied

Definition at line 463 of file Mesh.cpp.

References TexGen::GetLengthSquared(), m_Nodes, and TOL.

Referenced by TexGen::CGeometrySolver::ApplyPeriodicBoundaryConditions(), TexGen::CSimulationAbaqus::CreatePeriodicBoundaries(), TexGen::CMesher::CreateVolumeMesh(), TexGen::CSimulationAbaqus::GetYarnSurface(), and TexGen::CSimulationAbaqus::GetYarnSurfaces().

◆ GetNodePairs() [2/2]

void CMesh::GetNodePairs ( XYZ  Vector,
vector< pair< int, int > > &  NodePairs,
const double  Tolerance = 1e-6 
) const

Definition at line 484 of file Mesh.cpp.

References TexGen::GetLengthSquared(), m_Nodes, TGLOG, and TOL.

◆ GetNodes() [1/2]

vector< XYZ > & CMesh::GetNodes ( )

Definition at line 2661 of file Mesh.cpp.

References m_Nodes.

◆ GetNodes() [2/2]

const vector< XYZ > & CMesh::GetNodes ( ) const

◆ GetNumElements() [1/2]

int CMesh::GetNumElements ( ) const

Get the total number of elements in the mesh.

Definition at line 2592 of file Mesh.cpp.

References GetNumElements(), NUM_ELEMENT_TYPES, and POLYGON.

Referenced by GetNumElements(), and SaveToABAQUS().

◆ GetNumElements() [2/2]

int CMesh::GetNumElements ( ELEMENT_TYPE  Type) const

Get the number of elements of a given type.

Definition at line 2586 of file Mesh.cpp.

References GetNumNodes(), m_Indices, and NUM_ELEMENT_TYPES.

Referenced by TexGen::CMesher::CreateMesh(), and TexGen::CTetgenMesh::SaveTetgenMesh().

◆ GetNumNodes() [1/2]

int CMesh::GetNumNodes ( ) const

◆ GetNumNodes() [2/2]

static int TexGen::CMesh::GetNumNodes ( ELEMENT_TYPE  Type)
inlinestatic

◆ InsertMesh()

void CMesh::InsertMesh ( const CMesh Mesh,
XYZ  Offset = XYZ(0, 0, 0) 
)

◆ InsertNodes()

int CMesh::InsertNodes ( const CMesh Mesh,
XYZ  Offset = XYZ(0, 0, 0) 
)

Add the nodes of Mesh to this mesh.

Parameters
MeshMesh whose nodes should be added to this mesh
OffsetThe inserted mesh can be translated by a given factor before instering
Returns
The index of the first node added

Definition at line 82 of file Mesh.cpp.

References m_Nodes.

Referenced by TexGen::CYarn::AddCentrePlaneToMesh(), TexGen::CYarn::AddVolumeToMesh(), and InsertMesh().

◆ IntersectLine()

int CMesh::IntersectLine ( const XYZ P1,
const XYZ P2,
vector< pair< double, XYZ > > &  IntersectionPoints,
pair< bool, bool >  TrimResults = make_pair(false, false),
bool  bForceFind = false 
) const

Find the points where a line intersects the mesh.

Given a line defined by points P1 and P2, a list of intersection points Pi are calculated such that $P_i = P1 + (P2-P1) \mu_i $. The values of $\mu_i$ are returned in IntersectionPoints along with the normal of the surface it intersects with. The list is sorted in ascending order of $\mu_i$. This operation only works for triangular meshes! If you want to perform it for other mesh types it must be converted to triangles first using Convert3Dto2D and/or ConvertQuadstoTriangles.

Parameters
P1Origin of the line
P2End of the line
IntersectionPointsInformation about where the intersections occured
TrimResultsIf true then only intersections found where $ 0 \le \mu_i \le 1 $ are returned
bForceFindForce the algorithm to find the closest intersection if no exact intersections can be found
Returns
Number of intersections found

Definition at line 1633 of file Mesh.cpp.

References TexGen::CrossProduct(), TexGen::GetIntersectionLinePlane(), m_Indices, m_Nodes, TexGen::Normalise(), NUM_ELEMENT_TYPES, TexGen::PointInsideTriangleAccuracy(), TGERROR, and TRI.

Referenced by TexGen::CShearedTextileWeave2D::CalculateModifiers(), TexGen::CTextileOrthogonal::CorrectCrimpInterference(), TexGen::CTextileWeave::CorrectInterference(), TexGen::CTextileWeave::CorrectYarnWidths(), and TexGen::CBasicVolumes::GetMeshVerticalBounds().

◆ MergeNodes()

int CMesh::MergeNodes ( const double  Tolerance = 1e-8)

If any nodes share the same coordinates merge the nodes together and adjust indices accordingly.

Parameters
ToleranceNodes within Tolerance distance of each other will be assumed to be at the same position and merged together
Returns
Number of nodes merged together

Definition at line 382 of file Mesh.cpp.

References GetAABB(), TexGen::COctreeVisitorMergeNodes::GetNumMerged(), m_Nodes, TOL, TexGen::XYZ::x, TexGen::XYZ::y, and TexGen::XYZ::z.

Referenced by TexGen::CYarn::AddCentrePlaneToMesh(), TexGen::CYarn::AddSurfaceToMesh(), TexGen::CYarn::AddVolumeToMesh(), TexGen::CDomainPrism::BuildMesh(), TexGen::CMesher::ConvertMeshToQuadratic(), TexGen::CBasicVolumes::CreateBasicVolumes(), TexGen::CDomainPlanes::FillGaps(), TexGen::CDomainPrism::FillGaps(), and MeshConvexHull().

◆ MeshClosedLoop()

void CMesh::MeshClosedLoop ( const XYZ Normal,
const vector< int > &  ClosedLoopVector,
bool  bQuality = false 
)

Given a list of indices which form a counter-clockwise closed loop and lie on the same plane, this function will mesh the interior with triangle elements.

Parameters
NormalNormal of the plane on which the points lie
ClosedLoopVectorCounter-clockwise list of points forming a closed loop
bQualityDetermines if the mesh should be of high quality (this will increase processing time)

Definition at line 1200 of file Mesh.cpp.

References TexGen::CrossProduct(), TexGen::PLANE::d, TexGen::DotProduct(), TexGen::GetLength(), m_Indices, m_Nodes, TexGen::PLANE::Normal, TexGen::Normalise(), TGERROR, TOL, and TRI.

Referenced by TexGen::CDomainPlanes::FillGaps(), TexGen::CDomainPrism::FillGaps(), and TexGen::CSectionMeshTriangulate::GetSimpleMesh().

◆ MeshConvexHull()

void CMesh::MeshConvexHull ( )

Create a triangular convex hull of the nodes contained within the mesh.

All elements will be removed before the hull is created. The incremental convex hull method is implemented, it is one of the simplest and more robust techniques however it can be slow for a large number of nodes. If this becomes a problem, an alternate method should be implemented. This function is only implemented for creating a convex hull of 3d points. A 2d equivalent should be fairly easy to implement, however is not necessary at this point.

Definition at line 1758 of file Mesh.cpp.

References AddOrCancel(), TexGen::CrossProduct(), TexGen::PLANE::d, TexGen::DotProduct(), TexGen::GetLengthSquared(), m_Indices, m_Nodes, MergeNodes(), TexGen::PLANE::Normal, TexGen::Normalise(), NUM_ELEMENT_TYPES, TGERROR, TOL, and TRI.

Referenced by TexGen::CDomainPlanes::BuildMesh().

◆ NodesBegin() [1/2]

vector< XYZ >::iterator CMesh::NodesBegin ( )

Definition at line 2614 of file Mesh.cpp.

References m_Nodes.

◆ NodesBegin() [2/2]

vector< XYZ >::const_iterator CMesh::NodesBegin ( ) const

◆ NodesEmpty()

const bool CMesh::NodesEmpty ( ) const

Returns true if the nodes array is empty.

Definition at line 2651 of file Mesh.cpp.

References m_Nodes.

Referenced by TexGen::CTexGenRenderer::RenderDomain(), TexGen::CTexGenRenderer::RenderYarn(), and TexGen::CTexGenRenderer::RenderYarnMesh().

◆ NodesEnd() [1/2]

vector< XYZ >::iterator CMesh::NodesEnd ( )

Definition at line 2619 of file Mesh.cpp.

References m_Nodes.

◆ NodesEnd() [2/2]

vector< XYZ >::const_iterator CMesh::NodesEnd ( ) const

◆ OutputElements()

int CMesh::OutputElements ( ostream &  Output,
CMesh::ELEMENT_TYPE  ElementType,
int  iStartIndex = 1,
int  iIndexOffset = 1,
string  Seperator = ", ",
bool  bSCIRun = false 
) const

Output the element indices in the mesh each on a new line, indices seperated by commas.

Parameters
OutputOutput stream to output the nodes to
ElementTypeThe type of elements to output
iStartIndexIndex to start numbering the elements at, if less than zero then no index used
iIndexOffsetThis value will be added to each of the zero based node indices forming the element
SeperatorThe string to use to seperate values
bSCIRunSet to false for all mesh output other than SCIRun

Definition at line 1480 of file Mesh.cpp.

References GetNumNodes(), m_Indices, and NUM_ELEMENT_TYPES.

Referenced by SaveToABAQUS(), and SaveToSCIRun().

◆ OutputNodes()

int CMesh::OutputNodes ( ostream &  Output,
int  iStartIndex = 1,
string  Seperator = ", ",
bool  bSCIRun = false 
) const

Output the node coordinates in the mesh each on a new line, components seperated by commas.

Parameters
OutputOutput stream to output the nodes to
iStartIndexIndex to start numbering the nodes at, if less than zero then no index used
SeperatorThe string to use to seperate values
bSCIRuntrue if outputting to SCIRun format. In all other cases, false

Definition at line 1463 of file Mesh.cpp.

References m_Nodes.

Referenced by SaveToABAQUS(), and SaveToSCIRun().

◆ PopulateTiXmlElement()

void CMesh::PopulateTiXmlElement ( TiXmlElement &  Element,
OUTPUT_TYPE  OutputType 
) const

Used for saving data to XML.

Definition at line 57 of file Mesh.cpp.

References m_Indices, m_Nodes, NUM_ELEMENT_TYPES, and TexGen::stringify().

Referenced by TexGen::CDomain::PopulateTiXmlElement().

◆ RemoveAllElementsExcept()

void CMesh::RemoveAllElementsExcept ( ELEMENT_TYPE  Type)

Remove all elements except those of given type.

Definition at line 711 of file Mesh.cpp.

References m_Indices, and NUM_ELEMENT_TYPES.

Referenced by ConvertToTetMesh(), ConvertToTriangleMesh(), and TexGen::CBasicVolumes::GetProjectedMesh().

◆ RemoveDegenerateTriangles()

void CMesh::RemoveDegenerateTriangles ( )

Remove triangles which have two equal corner indices.

Definition at line 214 of file Mesh.cpp.

References m_Indices, and TRI.

Referenced by TexGen::CDomainPlanes::FillGaps(), and TexGen::CDomainPrism::FillGaps().

◆ RemoveDuplicateElements()

void CMesh::RemoveDuplicateElements ( CMesh::ELEMENT_TYPE  ElementType)

Remove duplicate elements which have the same indices (leaves one copy of element)

Parameters
ElementTypeType of elements to be removed

Definition at line 234 of file Mesh.cpp.

References GetNumNodes(), and m_Indices.

◆ RemoveDuplicateSegments()

void CMesh::RemoveDuplicateSegments ( )

Remove segments which have the same indices.

Definition at line 314 of file Mesh.cpp.

References LINE, and m_Indices.

Referenced by ConvertToSegmentMesh().

◆ RemoveDuplicateTriangles()

void CMesh::RemoveDuplicateTriangles ( )

Definition at line 276 of file Mesh.cpp.

References m_Indices, and TRI.

◆ RemoveElementType()

void CMesh::RemoveElementType ( ELEMENT_TYPE  Type)

◆ RemoveOpposingQuads()

void CMesh::RemoveOpposingQuads ( )

Remove quads that have the same indices but opposite normals.

Definition at line 174 of file Mesh.cpp.

References m_Indices, and QUAD.

Referenced by ConvertToSurfaceMesh().

◆ RemoveOpposingTriangles()

void CMesh::RemoveOpposingTriangles ( )

Remove triangles that have the same indices but opposite normals.

Definition at line 136 of file Mesh.cpp.

References m_Indices, and TRI.

Referenced by TexGen::CYarn::AddSurfaceToMesh(), TexGen::CYarn::AddVolumeToMesh(), and ConvertToSurfaceMesh().

◆ RemoveUnreferencedNodes()

int CMesh::RemoveUnreferencedNodes ( )

◆ Rotate()

void CMesh::Rotate ( WXYZ  Rotation,
XYZ  Origin = XYZ(0,0,0) 
)

Rotate the whole mesh by given quaternion.

Definition at line 1148 of file Mesh.cpp.

References m_Nodes.

Referenced by TexGen::CYarn::AddEndCapsToMesh(), and TexGen::CSlaveNode::Rotate().

◆ SaveToABAQUS()

bool CMesh::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.

Note: The created input file makes use of the "Distribution Table" keyword which is only supported in ABAQUS version 6.7 and above. Therefore meshes will not be readable with previous version of ABAQUS.

Parameters
FilenameName of the .inp filename (extension will be automatically appended if ommited)
pElementInfoContains a vector of additional data attached to nodes or elements that should be saved (if specified additional .ori and .eld files will be generated)
bCreateStepCreate a step definition in the ABAQUS input deck, it may be desirable to ommit this and create step definitions manually, mainly because after a step definition is created any lines after this which affect the model definition are ignored.
bCreateMaterialCreate a material definition? Set this to false if you plan to create your own material definition.
iElementTypeC3D8R if 0, C3D8 if 1

Definition at line 2089 of file Mesh.cpp.

References TexGen::AddExtensionIfMissing(), TexGen::CrossProduct(), TexGen::GetLength(), GetNumElements(), HEX, m_Indices, TexGen::Normalise(), OutputElements(), OutputNodes(), QUAD, QUADRATIC_TET, TexGen::StripPath(), TET, TEXGEN, TGERROR, TGLOG, WEDGE, TexGen::WriteElementsHeader(), and TexGen::WriteOrientationsHeader().

Referenced by TexGen::CSimulationAbaqus::CreateAbaqusInputFile(), TexGen::CShellElementExport::SaveShellElementToABAQUS(), TexGen::CTetgenMesh::SaveToAbaqus(), and TexGen::CMesher::SaveVolumeMeshToABAQUS().

◆ SaveToSCIRun()

bool CMesh::SaveToSCIRun ( string  Filename)

Save the mesh to SCIRun format.

At the moment only saves nodes and tri elements

Definition at line 2690 of file Mesh.cpp.

References TexGen::AddExtensionIfMissing(), ConvertQuadstoTriangles(), m_Indices, OutputElements(), OutputNodes(), TexGen::RemoveExtension(), TGERROR, TGLOG, and TRI.

Referenced by TexGen::CSurfaceMesh::SaveToSCIRun().

◆ SaveToSMESH()

bool CMesh::SaveToSMESH ( string  Filename) const

Save the mesh to a .smesh file to be used in conjunction with tetgen.

Definition at line 2009 of file Mesh.cpp.

References TexGen::AddExtensionIfMissing(), GetNumNodes(), m_Indices, m_Nodes, QUAD, and TRI.

◆ SaveToSTL()

bool CMesh::SaveToSTL ( string  Filename,
bool  bBinary = true 
) const

Save the mesh to STL file.

This operation only works for triangular meshes, however if the mesh contains other element types they are automatically converted to triangles. The file should have a .stl extension, if not it will be appended to the filename.

Definition at line 1933 of file Mesh.cpp.

References TexGen::AddExtensionIfMissing(), ConvertToTriangleMesh(), TexGen::CrossProduct(), m_Indices, m_Nodes, TexGen::Normalise(), NUM_ELEMENT_TYPES, SaveToSTL(), TRI, WriteBinaryXYZ(), TexGen::XYZ::x, TexGen::XYZ::y, and TexGen::XYZ::z.

Referenced by TexGen::CSurfaceMesh::SaveToSTL(), and SaveToSTL().

◆ SaveToVTK()

bool CMesh::SaveToVTK ( string  Filename,
const vector< CMeshDataBase * > *  pMeshData = NULL 
) const

◆ SetNode()

void CMesh::SetNode ( int  iIndex,
XYZ  Node 
)

◆ SetNumNodes()

void CMesh::SetNumNodes ( int  NumNodes)

Resize the vector size.

Definition at line 2666 of file Mesh.cpp.

References m_Nodes.

Referenced by TexGen::CSectionMeshRectangleSection::CreateMesh(), and TexGen::CSectionMeshRectangular::CreateMesh().

◆ Translate()

void CMesh::Translate ( XYZ  Vector)

Translate whole mesh by given vector.

Definition at line 1139 of file Mesh.cpp.

References m_Nodes.

Referenced by TexGen::CDomain::GetTranslations(), and TexGen::CSlaveNode::Translate().

◆ WriteBinaryXYZ()

void CMesh::WriteBinaryXYZ ( ostream &  Output,
XYZ  Vector 
)
staticprotected

Definition at line 1922 of file Mesh.cpp.

Referenced by SaveToSTL().

Member Data Documentation

◆ m_Indices

list<int> TexGen::CMesh::m_Indices[NUM_ELEMENT_TYPES]
protected

◆ m_Nodes

vector<XYZ> TexGen::CMesh::m_Nodes
protected

The documentation for this class was generated from the following files: