TexGen
|
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, XYZ > | GetAABB (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< XYZ > | GetElementCenters () const |
Get a vector of element centers, one entry for each element. More... | |
vector< XYZ > | GetElementCenters (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 XYZ & | GetNode (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< XYZ > | m_Nodes |
List of nodes. More... | |
list< int > | m_Indices [NUM_ELEMENT_TYPES] |
Map of indices into the nodes. More... | |
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");
CMesh::CMesh | ( | TiXmlElement & | Element | ) |
Definition at line 41 of file Mesh.cpp.
References FOR_EACH_TIXMLELEMENT, m_Indices, and m_Nodes.
bool CMesh::AddElement | ( | ELEMENT_TYPE | Type, |
const vector< int > & | Indices | ||
) |
Add an element to the mesh of given type with node number checking.
Definition at line 2565 of file Mesh.cpp.
References GetNumNodes(), m_Indices, NUM_ELEMENT_TYPES, POLYGON, and TGERROR.
Referenced by TexGen::CYarn::AddAABBToMesh(), TexGen::CMesher::AddElement(), TexGen::CYarn::AddPathToMesh(), TexGen::CYarn::AddSurfaceToMesh(), TexGen::CTextile::AddSurfaceToMesh(), TexGen::CMesher::ConvertMeshToQuadratic(), ConvertTriToQuad(), TexGen::CSectionMeshRectangleSection::CreateMesh(), TexGen::CSectionMeshRectangular::CreateMesh(), TexGen::CSectionMeshRectangular::CreateSingleLayerMesh(), TexGen::CShearedTextileWeave2D::CreateTopAndBottomMeshes(), TexGen::CDomainPrism::GetMeshWithPolygonEnd(), TexGen::CPrismVoxelMesh::OutputHexElements(), TexGen::CVoxelMesh::OutputHexElements(), and TexGen::CTetgenMesh::SaveMesh().
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().
|
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().
Build grid of points.
Builds a structured grid of points
Min | The lower bound for the set of points |
Max | The upper bound for the set of points |
dPointsPerUnit | Number 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.
Build grid of points.
Builds a structured grid of points
Min | The lower bound for the set of points |
Max | The upper bound for the set of points |
iNumX | Number of points along the x axis |
iNumY | Number of points along the y axis |
iNumZ | Number 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().
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().
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().
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.
void CMesh::Clear | ( | ) |
Empty mesh nodes and indices.
Definition at line 1448 of file Mesh.cpp.
References m_Indices, m_Nodes, and NUM_ELEMENT_TYPES.
Referenced by TexGen::CDomainPlanes::BuildMesh(), TexGen::CDomainPrism::BuildMesh(), CopySelfToRange(), TexGen::CTextileOrthogonal::CorrectCrimpInterference(), TexGen::CTextileWeave::CorrectInterference(), TexGen::CShearedTextileWeave2D::CorrectInterference(), TexGen::CTextileWeave::CorrectYarnWidths(), TexGen::CSimulationAbaqus::CreateAbaqusInputFile(), TexGen::CBasicVolumes::CreateBasicVolumes(), TexGen::CSectionMeshRectangleSection::CreateMesh(), TexGen::CSectionMeshRectangular::CreateMesh(), TexGen::CSectionMeshTriangulate::CreateMesh(), TexGen::CSectionMeshRectangular::CreateSingleLayerMesh(), TexGen::CGeometrySolver::CreateSystem(), TexGen::CMesher::CreateVolumeMesh(), TexGen::CTextile::DetectInterference(), TexGen::CYarnSectionInterp::GetInterpedSectionMesh(), TexGen::CBasicVolumes::MeshProjectedAreas(), TexGen::CTetgenMesh::SaveMesh(), TexGen::CSurfaceMesh::SaveSurfaceMesh(), and TexGen::CSlaveNode::UpdateSectionMesh().
void CMesh::Convert3Dto2D | ( | ) |
Convert all 3D elements to 2D elements representing their surface.
Definition at line 576 of file Mesh.cpp.
References ConvertHextoQuad(), ConvertPyramidto2D(), ConvertTettoTriangle(), and ConvertWedgeto2D().
Referenced by ConvertToSurfaceMesh(), ConvertToTriangleMesh(), TexGen::CTextileOrthogonal::CorrectCrimpInterference(), TexGen::CTextileWeave::CorrectInterference(), and TexGen::CTextileWeave::CorrectYarnWidths().
void CMesh::ConvertElementListToVector | ( | ELEMENT_TYPE | ElementType, |
vector< int > & | Indices | ||
) |
Convert element index list to vector so can access by index.
ElementType | The element type of the list to be converted |
Indices | Array to add list to |
Definition at line 2683 of file Mesh.cpp.
References m_Indices, and NUM_ELEMENT_TYPES.
Referenced by TexGen::CYarn::PointInsideYarn().
void CMesh::ConvertHextoQuad | ( | ) |
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().
void CMesh::ConvertHextoWedge | ( | bool | bQuality = true | ) |
void CMesh::ConvertPyramidto2D | ( | ) |
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().
void CMesh::ConvertQuadstoTriangles | ( | bool | bQuality = true | ) |
Convert the quad elements to triangles.
Definition at line 1088 of file Mesh.cpp.
References TexGen::GetLengthSquared(), m_Indices, m_Nodes, QUAD, and TRI.
Referenced by ConvertToTriangleMesh(), TexGen::CTextileOrthogonal::CorrectCrimpInterference(), TexGen::CTextileWeave::CorrectInterference(), TexGen::CShearedTextileWeave2D::CorrectInterference(), TexGen::CTextileWeave::CorrectYarnWidths(), TexGen::CBasicVolumes::CreateBasicVolumes(), TexGen::CTextileLayered::GetLayerMeshes(), TexGen::CSurfaceMesh::SaveSurfaceMesh(), TexGen::CTetgenMesh::SaveTetgenMesh(), and SaveToSCIRun().
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().
void CMesh::ConvertTettoTriangle | ( | ) |
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().
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().
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().
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().
void CMesh::ConvertTrianglestoSegments | ( | ) |
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().
void CMesh::ConvertWedgeto2D | ( | ) |
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().
void CMesh::ConvertWedgetoTetandPyramid | ( | bool | bQuality = true | ) |
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().
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().
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.
Delete a node given iterator.
Definition at line 2641 of file Mesh.cpp.
References m_Nodes.
Referenced by TexGen::CDomainPlanes::BuildMesh().
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().
|
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().
|
protected |
void CMesh::FlipNormals | ( | ) |
Get an axis aligned bounding box for the mesh.
Definition at line 340 of file Mesh.cpp.
References m_Nodes, TexGen::Max(), and TexGen::Min().
Referenced by TexGen::CRectangularVoxelMesh::CalculateVoxelSizes(), TexGen::CExporter::ConvertDomain(), TexGen::CSimulationAbaqus::CreatePeriodicBoundaries(), TexGen::CGeometrySolver::CreateSystem(), TexGen::CShearedTextileWeave2D::CreateTopAndBottomMeshes(), TexGen::CTextile::DetectInterference(), TexGen::CSimulationAbaqus::GetCenterNode(), MergeNodes(), TexGen::CDomain::MeshIntersectsDomain(), TexGen::CTexGenRenderer::RenderDomain(), TexGen::CTexGenRenderer::RenderDomainAxes(), TexGen::CTexGenRenderer::RenderGrid(), TexGen::COctreeVoxelMesh::SaveVoxelMesh(), and TexGen::CPeriodicBoundaries::SetDomainSize().
int CMesh::GetClosestNode | ( | XYZ | Position | ) | const |
Get the index of the node closest to the given position space.
Position | The position to which the closest node should be found |
Definition at line 532 of file Mesh.cpp.
References TexGen::GetLengthSquared(), and m_Nodes.
Referenced by TexGen::CSimulationAbaqus::GetCenterNode().
int CMesh::GetClosestNodeDistance | ( | XYZ | Position, |
double | dTol | ||
) | const |
Get the index of the node within a given tolerance distance to the given position space.
Position | The position to which the closest node should be found |
dTol | The tolerance for the distance from the node to the point |
Definition at line 550 of file Mesh.cpp.
References TexGen::GetLengthSquared(), and m_Nodes.
Referenced by TexGen::CTetgenMesh::SaveTetgenMesh().
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().
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.
list< int > & CMesh::GetIndices | ( | ELEMENT_TYPE | ElemType | ) |
Definition at line 2677 of file Mesh.cpp.
References m_Indices, and NUM_ELEMENT_TYPES.
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().
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().
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().
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().
void CMesh::GetNodePairs | ( | XYZ | Vector, |
vector< pair< int, int > > & | NodePairs, | ||
const double | Tolerance = 1e-6 |
||
) | const |
const vector< XYZ > & CMesh::GetNodes | ( | ) | const |
Get a const reference to the nodes.
Definition at line 2656 of file Mesh.cpp.
References m_Nodes.
Referenced by TexGen::CDomainPlanes::BuildMesh(), TexGen::CMesher::ConvertMeshToQuadratic(), TexGen::CDomain::GetLimits(), TexGen::CBasicVolumes::GetProjectedMesh(), TexGen::CTextile::SavePointInformationToVTK(), TexGen::CTextileDeformerVolumeMesh::SetYarnMeshDisplacements(), and TexGen::CSlaveNode::UpdateSectionMesh().
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().
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().
int CMesh::GetNumNodes | ( | ) | const |
Return the number of nodes.
Definition at line 2646 of file Mesh.cpp.
References m_Nodes.
Referenced by AddElement(), TexGen::CAdjustMeshInterference::AddIntersectElementsToMesh(), TexGen::CMesher::AddQuadraticNodesToSets(), TexGen::CTextile::AddSurfaceToMesh(), TexGen::CDomainPlanes::ClipMeshToDomain(), TexGen::CDomainPrism::ClipMeshToDomain(), ConvertTriToQuad(), CountInvertedElements(), FillVTKCellData(), TexGen::CMesher::FillYarnTangentsData(), TexGen::CMeshIntersectionData::FindElements(), TexGen::CSimulationAbaqus::FindFaceIndex(), TexGen::CMeshIntersectionData::FindInterpolationNode(), GetElementCenters(), TexGen::CSimulationAbaqus::GetElementVolumeFractions(), GetNumElements(), TexGen::CTexGenRenderer::GetPolyData(), TexGen::CSimulationAbaqus::GetYarnSurface(), TexGen::CSimulationAbaqus::GetYarnSurfaces(), TexGen::CShellElementExport::GetYarnSurfaces(), TexGen::CMeshDomainPlane::MeshDomainPlanes(), OutputElements(), TexGen::CYarn::PointInsideYarn(), RemoveDuplicateElements(), TexGen::CTetgenMesh::SaveTetgenMesh(), and SaveToSMESH().
|
inlinestatic |
Get the number of nodes a particular element type contains.
Definition at line 81 of file Mesh.h.
Referenced by TexGen::CYarn::AddPathToMesh(), TexGen::CMesher::AddQuadraticNodesToSets(), TexGen::CYarn::AddSurfaceToMesh(), TexGen::CYarn::AddVolumeToMesh(), TexGen::CYarn::BuildSectionMeshes(), TexGen::CDomainPlanes::CDomainPlanes(), TexGen::CDomainPrism::CDomainPrism(), TexGen::CDomainPrism::ClipIntersectMeshToDomain(), TexGen::CDomainPlanes::ClipMeshToDomain(), TexGen::CDomainPrism::ClipMeshToDomain(), TexGen::CSimulationAbaqus::CreateAbaqusInputFile(), TexGen::CGeometrySolver::CreateDebugSystem(), TexGen::CMesher::CreateMesh(), TexGen::CGeometrySolver::CreateSystem(), TexGen::CMesher::CreateVolumeMesh(), TexGen::CDomainPrism::GeneratePlanes(), TexGen::CYarnSectionInterp::GetInterpedSectionMesh(), TexGen::CDomainPrism::GetMeshWithPolygonEnd(), TexGen::CMesher::MeshDifficultRegion(), TexGen::CBasicVolumes::MeshProjectedAreas(), TexGen::CMeshDomainPlane::OffsetMeshPoints(), TexGen::CTetgenMesh::SaveTetgenMesh(), and TexGen::CMesher::SaveVolumeMeshToABAQUS().
Add the contents of Mesh to this mesh.
Mesh | Mesh to add to this mesh |
Offset | The inserted mesh can be translated by a given factor before instering |
Definition at line 93 of file Mesh.cpp.
References InsertNodes(), m_Indices, and NUM_ELEMENT_TYPES.
Referenced by TexGen::CYarn::AddAABBToMesh(), TexGen::CYarn::AddCentrePlaneToMesh(), TexGen::CYarn::AddEndCapsToMesh(), TexGen::CYarn::AddSurfaceToMesh(), TexGen::CYarn::AddVolumeToMesh(), TexGen::CDomainPrism::ClipMeshToDomain(), CopySelfToRange(), TexGen::CSimulationAbaqus::CreateAbaqusInputFile(), TexGen::CBasicVolumes::CreateBasicVolumes(), TexGen::CShellElementExport::SaveShellElementToABAQUS(), TexGen::CSurfaceMesh::SaveSurfaceMesh(), and TexGen::CTexGenRenderer::SaveTextileToVTK().
Add the nodes of Mesh to this mesh.
Mesh | Mesh whose nodes should be added to this mesh |
Offset | The inserted mesh can be translated by a given factor before instering |
Definition at line 82 of file Mesh.cpp.
References m_Nodes.
Referenced by TexGen::CYarn::AddCentrePlaneToMesh(), TexGen::CYarn::AddVolumeToMesh(), and InsertMesh().
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 . The values of are returned in IntersectionPoints along with the normal of the surface it intersects with. The list is sorted in ascending order of . 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.
P1 | Origin of the line |
P2 | End of the line |
IntersectionPoints | Information about where the intersections occured |
TrimResults | If true then only intersections found where are returned |
bForceFind | Force the algorithm to find the closest intersection if no exact intersections can be 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().
int CMesh::MergeNodes | ( | const double | Tolerance = 1e-8 | ) |
If any nodes share the same coordinates merge the nodes together and adjust indices accordingly.
Tolerance | Nodes within Tolerance distance of each other will be assumed to be at the same position and 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().
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.
Normal | Normal of the plane on which the points lie |
ClosedLoopVector | Counter-clockwise list of points forming a closed loop |
bQuality | Determines 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().
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().
vector< XYZ >::iterator CMesh::NodesBegin | ( | ) |
vector< XYZ >::const_iterator CMesh::NodesBegin | ( | ) | const |
Definition at line 2604 of file Mesh.cpp.
References m_Nodes.
Referenced by TexGen::CDomain::GetLimits(), TexGen::CTexGenRenderer::GetPolyData(), and TexGen::CBasicVolumes::SplitLinesByNodes().
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().
vector< XYZ >::iterator CMesh::NodesEnd | ( | ) |
vector< XYZ >::const_iterator CMesh::NodesEnd | ( | ) | const |
Definition at line 2609 of file Mesh.cpp.
References m_Nodes.
Referenced by TexGen::CDomain::GetLimits(), TexGen::CTexGenRenderer::GetPolyData(), and TexGen::CBasicVolumes::SplitLinesByNodes().
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.
Output | Output stream to output the nodes to |
ElementType | The type of elements to output |
iStartIndex | Index to start numbering the elements at, if less than zero then no index used |
iIndexOffset | This value will be added to each of the zero based node indices forming the element |
Seperator | The string to use to seperate values |
bSCIRun | Set 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().
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.
Output | Output stream to output the nodes to |
iStartIndex | Index to start numbering the nodes at, if less than zero then no index used |
Seperator | The string to use to seperate values |
bSCIRun | true 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().
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().
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().
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().
void CMesh::RemoveDuplicateElements | ( | CMesh::ELEMENT_TYPE | ElementType | ) |
Remove duplicate elements which have the same indices (leaves one copy of element)
ElementType | Type of elements to be removed |
Definition at line 234 of file Mesh.cpp.
References GetNumNodes(), and m_Indices.
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().
void CMesh::RemoveDuplicateTriangles | ( | ) |
void CMesh::RemoveElementType | ( | ELEMENT_TYPE | Type | ) |
Remove elements of given type.
Definition at line 723 of file Mesh.cpp.
References m_Indices.
Referenced by TexGen::CSimulationAbaqus::FindFaceIndex(), TexGen::CDomainPrism::GetMeshWithPolygonEnd(), TexGen::CSimulationAbaqus::GetYarnSurface(), TexGen::CSimulationAbaqus::GetYarnSurfaces(), and TexGen::CShellElementExport::GetYarnSurfaces().
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().
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().
int CMesh::RemoveUnreferencedNodes | ( | ) |
Remove nodes that are not referenced by any elements.
Definition at line 687 of file Mesh.cpp.
References DeleteNodes(), m_Indices, m_Nodes, and NUM_ELEMENT_TYPES.
Referenced by TexGen::CDomainPrism::ClipIntersectMeshToDomain(), TexGen::CDomainPlanes::ClipMeshToDomain(), TexGen::CSectionMeshRectangular::CreateMesh(), TexGen::CSimulationAbaqus::FindFaceIndex(), TexGen::CBasicVolumes::GetProjectedMesh(), TexGen::CSimulationAbaqus::GetYarnSurface(), TexGen::CSimulationAbaqus::GetYarnSurfaces(), TexGen::CShellElementExport::GetYarnSurfaces(), and TexGen::CBasicVolumes::MergeStraightLines().
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().
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.
Filename | Name of the .inp filename (extension will be automatically appended if ommited) |
pElementInfo | Contains a vector of additional data attached to nodes or elements that should be saved (if specified additional .ori and .eld files will be generated) |
bCreateStep | Create 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. |
bCreateMaterial | Create a material definition? Set this to false if you plan to create your own material definition. |
iElementType | C3D8R 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().
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().
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.
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().
bool CMesh::SaveToVTK | ( | string | Filename, |
const vector< CMeshDataBase * > * | pMeshData = NULL |
||
) | const |
Save the mesh to VTK unstructured grid file format (.vtu)
Filename | Name of the .vtu filename (extension will be automatically appended if ommited) |
pMeshData | Contains a vector of additional data attached to nodes or elements that should be saved |
Definition at line 2348 of file Mesh.cpp.
References TexGen::AddExtensionIfMissing(), FillVTKCellData(), FillVTKPointData(), TexGen::CMeshDataBase::NODE, TexGen::stringify(), and TGLOG.
Referenced by TexGen::CDomainPrism::ClipMeshToDomain(), TexGen::CBasicVolumes::CreateBasicVolumes(), TexGen::CTextile::SavePointInformationToVTK(), TexGen::CBasicVolumes::SaveProjectedAreasToVTK(), TexGen::CBasicVolumes::SaveProjectedContoursToVTK(), TexGen::CGeometrySolver::SaveToVTK(), TexGen::CSurfaceMesh::SaveToVTK(), TexGen::CTetgenMesh::SaveToVTK(), TexGen::CMesher::SaveVolumeMeshToVTK(), and TexGen::CVoxelMesh::SaveVoxelMeshToVTK().
void CMesh::SetNode | ( | int | iIndex, |
XYZ | Node | ||
) |
Set the node at given index.
Definition at line 2630 of file Mesh.cpp.
References m_Nodes.
Referenced by TexGen::CMeshIntersectionData::AdjustInterpolationNode(), TexGen::CSectionMeshRectangleSection::CreateMesh(), TexGen::CSectionMeshRectangular::CreateMesh(), TexGen::CMeshIntersectionData::MoveNode(), and TexGen::CMeshDomainPlane::OffsetMeshPoints().
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().
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().
|
staticprotected |
Definition at line 1922 of file Mesh.cpp.
Referenced by SaveToSTL().
|
protected |
Map of indices into the nodes.
Definition at line 515 of file Mesh.h.
Referenced by AddElement(), BuildGrid(), CalculateVolume(), ChangeNodeIndices(), Clear(), CMesh(), ConvertElementListToVector(), ConvertHextoQuad(), ConvertHextoWedge(), ConvertPyramidto2D(), ConvertPyramidtoTet(), ConvertQuadstoTriangles(), ConvertQuadtoTriangles(), ConvertTettoTriangle(), ConvertTrianglestoSegments(), ConvertTriToQuad(), ConvertWedgeto2D(), ConvertWedgetoTetandPyramid(), CountInvertedElements(), DeleteNodes(), FillVTKCellData(), FlipNormals(), GetElementCenters(), GetIndices(), GetNodeElementReferences(), GetNumElements(), InsertMesh(), IntersectLine(), MeshClosedLoop(), MeshConvexHull(), OutputElements(), PopulateTiXmlElement(), RemoveAllElementsExcept(), RemoveDegenerateTriangles(), RemoveDuplicateElements(), RemoveDuplicateSegments(), RemoveDuplicateTriangles(), RemoveElementType(), RemoveOpposingQuads(), RemoveOpposingTriangles(), RemoveUnreferencedNodes(), SaveToABAQUS(), SaveToSCIRun(), SaveToSMESH(), and SaveToSTL().
|
protected |
List of nodes.
Definition at line 513 of file Mesh.h.
Referenced by AddNode(), BuildGrid(), CalculateVolume(), Clear(), CMesh(), ConvertPyramidtoTet(), ConvertQuadstoTriangles(), ConvertTriToQuad(), CountInvertedElements(), DeleteNode(), DeleteNodes(), FillVTKPointData(), GetAABB(), GetClosestNode(), GetClosestNodeDistance(), GetElementCenters(), GetNode(), GetNodeElementReferences(), GetNodePairs(), GetNodes(), GetNumNodes(), InsertNodes(), IntersectLine(), MergeNodes(), MeshClosedLoop(), MeshConvexHull(), NodesBegin(), NodesEmpty(), NodesEnd(), OutputNodes(), PopulateTiXmlElement(), RemoveUnreferencedNodes(), Rotate(), SaveToSMESH(), SaveToSTL(), SetNode(), SetNumNodes(), and Translate().