#include <vector>
#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()
{
;
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()
{
int nbFamillesElts = 0;
SMESHDS_Mesh * mySMESHDSMesh = dynamic_cast<SMESHDS_Mesh *>(myMesh);
- TopTools_IndexedMapOfShape myIndexToShape;
- TopExp::MapShapes(mySMESHDSMesh->ShapeToMesh(), myIndexToShape);
-
map<int,int> 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<const SMDS_MeshElement*> * 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<const SMDS_MeshElement*> * 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++)