From 337a36ceb89ce29dcbcc288257c37f34546a534e Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 18 Oct 2015 12:32:09 +0200 Subject: [PATCH] + write out nodes sorted by id to abaqus file --- src/Mod/Fem/App/FemMesh.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Mod/Fem/App/FemMesh.cpp b/src/Mod/Fem/App/FemMesh.cpp index b4432b18a..4f2314b28 100644 --- a/src/Mod/Fem/App/FemMesh.cpp +++ b/src/Mod/Fem/App/FemMesh.cpp @@ -911,7 +911,12 @@ void FemMesh::writeABAQUS(const std::string &Filename) const std::ofstream anABAQUS_Output; anABAQUS_Output.open(Filename.c_str()); + + // add nodes + // anABAQUS_Output << "*Node, NSET=Nall" << std::endl; + typedef std::map VertexMap; + VertexMap vertexMap; //Extract Nodes and Elements of the current SMESH datastructure SMDS_NodeIteratorPtr aNodeIter = myMesh->GetMeshDS()->nodesIterator(); @@ -921,10 +926,16 @@ void FemMesh::writeABAQUS(const std::string &Filename) const const SMDS_MeshNode* aNode = aNodeIter->next(); current_node.Set(aNode->X(),aNode->Y(),aNode->Z()); current_node = _Mtrx * current_node; - anABAQUS_Output << aNode->GetID() << ", " - << current_node.x << ", " - << current_node.y << ", " - << current_node.z << std::endl; + vertexMap[aNode->GetID()] = current_node; + } + + // This way we get sorted output. + // See http://forum.freecadweb.org/viewtopic.php?f=18&t=12646&start=40#p103004 + for (VertexMap::iterator it = vertexMap.begin(); it != vertexMap.end(); ++it) { + anABAQUS_Output << it->first << ", " + << it->second.x << ", " + << it->second.y << ", " + << it->second.z << std::endl; } typedef std::map > NodesMap;