smesh/src/DriverUNV/DriverUNV_W_SMESHDS_Document.cxx

84 lines
2.0 KiB
C++
Raw Normal View History

2003-05-19 19:18:36 +06:00
using namespace std;
#include "DriverUNV_W_SMESHDS_Document.h"
#include "DriverUNV_W_SMESHDS_Mesh.h"
#include "utilities.h"
2003-09-04 18:03:27 +06:00
extern "C"
2003-05-19 19:18:36 +06:00
{
2003-09-04 18:03:27 +06:00
Document_Writer *Wmaker()
{
return new DriverUNV_W_SMESHDS_Document;
}
2003-05-19 19:18:36 +06:00
}
2003-09-04 18:03:27 +06:00
DriverUNV_W_SMESHDS_Document::DriverUNV_W_SMESHDS_Document()
{
;
2003-05-19 19:18:36 +06:00
}
2003-09-04 18:03:27 +06:00
DriverUNV_W_SMESHDS_Document::~DriverUNV_W_SMESHDS_Document()
{
;
2003-05-19 19:18:36 +06:00
}
//void DriverUNV_W_SMESHDS_Document::SetFile(string aFile) {
//myFile = aFile;
//}
//void DriverUNV_W_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDocument) {
//myDocument = aDocument;
//}
2003-09-04 18:03:27 +06:00
void DriverUNV_W_SMESHDS_Document::Write()
{
2003-05-19 19:18:36 +06:00
2003-09-04 18:03:27 +06:00
SMESHDS_Mesh * myMesh;
2003-05-19 19:18:36 +06:00
/****************************************************************************
* OUVERTURE DU FICHIER EN ECRITURE *
****************************************************************************/
2003-09-04 18:03:27 +06:00
char *file2Write = (char *)myFile.c_str();
FILE *fid = fopen(file2Write, "w+");
if (fid < 0)
{
fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Write);
exit(EXIT_FAILURE);
}
2003-05-19 19:18:36 +06:00
/****************************************************************************
* FERMETURE DU FICHIER *
****************************************************************************/
2003-09-04 18:03:27 +06:00
fclose(fid);
2003-05-19 19:18:36 +06:00
/******** Nombre de maillages ********/
2003-09-04 18:03:27 +06:00
int nb_of_meshes = myDocument->NbMeshes(); //voir avec Yves
//nb_of_meshes = 1;
int numero = 0;
string myClass = string("SMESHDS_Mesh");
string myExtension = string("UNV");
//while (numero<nb_of_meshes) {
//numero++;
//myMesh = myDocument->GetMesh(numero);
myDocument->InitMeshesIterator();
while(myDocument->MoreMesh())
{
numero++;
myMesh = myDocument->NextMesh();
DriverUNV_W_SMESHDS_Mesh *myWriter = new DriverUNV_W_SMESHDS_Mesh;
//Mesh_Writer* myWriter = Driver::GetMeshWriter(myExtension, myClass);
myWriter->SetMesh(myMesh);
myWriter->SetFile(myFile);
SCRUTE(myMesh);
//myWriter->SetFileId(fid);
myWriter->SetMeshId(numero);
myWriter->Write();
}
2003-05-19 19:18:36 +06:00
}