From 97cfaf2f77ecf5ca097db71e11af2a1c8866981f Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Thu, 23 Nov 2017 06:12:23 +0100 Subject: [PATCH] FEM: Abaqus writer, write FacesOnly and EdgesOnly for mixed FEM meshes, could be slow on non mixed meshes --- src/Mod/Fem/App/FemMesh.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/Mod/Fem/App/FemMesh.cpp b/src/Mod/Fem/App/FemMesh.cpp index 88bb626fd0..9e3db03e20 100644 --- a/src/Mod/Fem/App/FemMesh.cpp +++ b/src/Mod/Fem/App/FemMesh.cpp @@ -1363,23 +1363,37 @@ void FemMesh::writeABAQUS(const std::string &Filename) const anABAQUS_Output << std::endl; } + std::string elsetname = ""; if (!elementsMap.empty()) { + /* anABAQUS_Output << "** Define element set Eall" << std::endl; anABAQUS_Output << "*ELSET, ELSET=Eall" << std::endl; anABAQUS_Output << "Evolumes" << std::endl; anABAQUS_Output.close(); return; // done + */ + elsetname += "Evolumes, "; } // add faces // elementsMap.clear(); + /* SMDS_FaceIteratorPtr aFaceIter = myMesh->GetMeshDS()->facesIterator(); while (aFaceIter->more()) { const SMDS_MeshFace* aFace = aFaceIter->next(); std::pair > apair; apair.first = aFace->GetID(); + */ + // we gone fill the elementsMap with the facesOnly + std::set facesOnly = getFacesOnly(); + for (std::set::iterator itfa = facesOnly.begin(); itfa != facesOnly.end(); ++itfa) { + std::pair > apair; + apair.first = *itfa; + const SMDS_MeshElement* aFace = myMesh->GetMeshDS()->FindElement(*itfa); + + // from here same as above ... int numNodes = aFace->NbNodes(); std::map::iterator it = faceTypeMap.find(numNodes); if (it != faceTypeMap.end()) { @@ -1404,22 +1418,35 @@ void FemMesh::writeABAQUS(const std::string &Filename) const } if (!elementsMap.empty()) { + /* anABAQUS_Output << "** Define element set Eall" << std::endl; anABAQUS_Output << "*ELSET, ELSET=Eall" << std::endl; anABAQUS_Output << "Efaces" << std::endl; anABAQUS_Output.close(); return; // done + */ + elsetname += "Efaces, "; } // add edges // elementsMap.clear(); + /* SMDS_EdgeIteratorPtr aEdgeIter = myMesh->GetMeshDS()->edgesIterator(); while (aEdgeIter->more()) { const SMDS_MeshEdge* aEdge = aEdgeIter->next(); std::pair > apair; apair.first = aEdge->GetID(); + */ + // we gone fill the elementsMap with the edgesOnly + std::set edgesOnly = getEdgesOnly(); + for (std::set::iterator ited = edgesOnly.begin(); ited != edgesOnly.end(); ++ited) { + std::pair > apair; + apair.first = *ited; + const SMDS_MeshElement* aEdge = myMesh->GetMeshDS()->FindElement(*ited); + + // from here same as above ... int numNodes = aEdge->NbNodes(); std::map::iterator it = edgeTypeMap.find(numNodes); if (it != edgeTypeMap.end()) { @@ -1442,11 +1469,15 @@ void FemMesh::writeABAQUS(const std::string &Filename) const } anABAQUS_Output << std::endl; } + + if (!elementsMap.empty()) { + elsetname += "Eedges, "; + } elementsMap.clear(); anABAQUS_Output << "** Define element set Eall" << std::endl; anABAQUS_Output << "*ELSET, ELSET=Eall" << std::endl; - anABAQUS_Output << "Eedges" << std::endl; + anABAQUS_Output << elsetname << std::endl; anABAQUS_Output.close(); }