X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FDriverMED%2FDriverMED_W_SMESHDS_Mesh.cxx;h=8b1567f0255be142c71db66be2b12da2be7cc0c2;hb=99dfb73d48eceb6f96ec5c7e93f4eddc7d4edc79;hp=8459854360677b869d95fb1416372f2de5478849;hpb=faa1c8f2bc27c5244a34fe03584826de59cb17b3;p=modules%2Fsmesh.git diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx index 845985436..8b1567f02 100644 --- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx @@ -33,6 +33,18 @@ using namespace std; #include #include "utilities.h" +extern "C" +{ +/** + * Factory function which will be called by SMESHDriver + */ +void * SMESH_createMEDMeshWriter() +{ + return new DriverMED_W_SMESHDS_Mesh(); +} + +} + DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh() { ; @@ -65,19 +77,7 @@ void DriverMED_W_SMESHDS_Mesh::SetMeshId(int aMeshId) void DriverMED_W_SMESHDS_Mesh::Write() { - - string myClass = string("SMDS_Mesh"); - string myExtension = string("MED"); - - DriverMED_W_SMDS_Mesh *myWriter = new DriverMED_W_SMDS_Mesh; - - myWriter->SetMesh(myMesh); - // myWriter->SetFile(myFile); - myWriter->SetMeshId(myMeshId); - myWriter->SetFileId(myFileId); - - myWriter->Write(); - + Add(); } void DriverMED_W_SMESHDS_Mesh::Add() @@ -520,40 +520,45 @@ void DriverMED_W_SMESHDS_Mesh::Add() { int nbFamillesElts = 0; SMESHDS_Mesh * mySMESHDSMesh = dynamic_cast(myMesh); - TopTools_IndexedMapOfShape myIndexToShape; - TopExp::MapShapes(mySMESHDSMesh->ShapeToMesh(), myIndexToShape); - map mapFamille; - if (besoinfamilledemaille == 1) + if(!mySMESHDSMesh->ShapeToMesh().IsNull()) { - int t; - for (t = 1; t <= myIndexToShape.Extent(); t++) + TopTools_IndexedMapOfShape myIndexToShape; + TopExp::MapShapes(mySMESHDSMesh->ShapeToMesh(), myIndexToShape); + + + if (besoinfamilledemaille == 1) { - const TopoDS_Shape S = myIndexToShape(t); - if (mySMESHDSMesh->HasMeshElements(S)) + int t; + for (t = 1; t <= myIndexToShape.Extent(); t++) { - //MESSAGE ("********* Traitement de la Famille "<<-t); - - SMESHDS_SubMesh * SM = mySMESHDSMesh->MeshElements(S); - SMDS_Iterator * ite=SM->GetElements(); - bool plein = false; - while(ite->more()) - { - mapFamille[ite->next()->GetID()] = -t; - plein = true; - } - if (plein) + const TopoDS_Shape S = myIndexToShape(t); + if (mySMESHDSMesh->HasMeshElements(S)) { - nbFamillesElts++; - char famille[MED_TAILLE_NOM + 1]; - sprintf(famille, "E%d", t); - CreateFamily(strdup(nommaa), strdup(famille), -t, - attvalabs++); + //MESSAGE ("********* Traitement de la Famille "<<-t); + + SMESHDS_SubMesh * SM = mySMESHDSMesh->MeshElements(S); + SMDS_Iterator * ite=SM->GetElements(); + bool plein = false; + while(ite->more()) + { + mapFamille[ite->next()->GetID()] = -t; + plein = true; + } + if (plein) + { + nbFamillesElts++; + char famille[MED_TAILLE_NOM + 1]; + sprintf(famille, "E%d", t); + CreateFamily(strdup(nommaa), strdup(famille), -t, + attvalabs++); + } } } } } + else besoinfamilledemaille = 0; int indice = 1; for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)