From 4a166bed4cc6474cfe0e2d1af6a47bffb000e91f Mon Sep 17 00:00:00 2001 From: nge Date: Mon, 1 Feb 2010 14:08:25 +0000 Subject: [PATCH] Add a new log file with nodes and elements ids mapping between SMDS and GHS3D (SMDS id <=> GHS3D id). The file extension is .ids --- src/GHS3DPlugin_GHS3D.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin_GHS3D.cxx index d34070c..c340c3d 100644 --- a/src/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin_GHS3D.cxx @@ -1205,13 +1205,31 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, Ok = writePoints( aPointsFile, helper, aSmdsToGhs3dIdMap, aGhs3dIdToNodeMap, enforcedVertices) && writeFaces ( aFacesFile, meshDS, aSmdsToGhs3dIdMap ); + // Write aSmdsToGhs3dIdMap to temp file + TCollection_AsciiString aSmdsToGhs3dIdMapFileName; + aSmdsToGhs3dIdMapFileName = aGenericName + ".ids"; // ids relation + ofstream aIdsFile ( aSmdsToGhs3dIdMapFileName.ToCString() , ios::out); + Ok = + aIdsFile.rdbuf()->is_open(); + if (!Ok) { + INFOS( "Can't write into " << aSmdsToGhs3dIdMapFileName); + return error(SMESH_Comment("Can't write into ") << aSmdsToGhs3dIdMapFileName); + } + aIdsFile << "Smds Ghs3d" << std::endl; + map ::const_iterator myit; + for (myit=aSmdsToGhs3dIdMap.begin() ; myit != aSmdsToGhs3dIdMap.end() ; ++myit) { + aIdsFile << myit->first << " " << myit->second << std::endl; + } + aFacesFile.close(); aPointsFile.close(); + aIdsFile.close(); if ( ! Ok ) { if ( !_keepFiles ) { removeFile( aFacesFileName ); removeFile( aPointsFileName ); + removeFile( aSmdsToGhs3dIdMapFileName ); } return error(COMPERR_BAD_INPUT_MESH); } @@ -1288,6 +1306,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, removeFile( aResultFileName ); removeFile( aBadResFileName ); removeFile( aBbResFileName ); + removeFile( aSmdsToGhs3dIdMapFileName ); } std::cout << "<" << aResultFileName.ToCString() << "> GHS3D output file "; if ( !Ok ) -- 2.39.2