smesh/src/DriverUNV/DriverUNV_R_SMESHDS_Document.cxx

91 lines
2.2 KiB
C++
Raw Normal View History

2003-05-19 19:18:36 +06:00
using namespace std;
#include "DriverUNV_R_SMESHDS_Document.h"
#include "DriverUNV_R_SMESHDS_Mesh.h"
#include "utilities.h"
2003-09-04 18:03:27 +06:00
int getOne()
{
printf("in getOne");
return (1);
2003-05-19 19:18:36 +06:00
}
2003-09-04 18:03:27 +06:00
extern "C"
{
// Document_Reader* maker() {
DriverUNV_R_SMESHDS_Document *maker()
{
fprintf(stdout, "here in maker\n");
return new DriverUNV_R_SMESHDS_Document;
}
2003-05-19 19:18:36 +06:00
}
2003-09-04 18:03:27 +06:00
DriverUNV_R_SMESHDS_Document::DriverUNV_R_SMESHDS_Document()
{
myFile = string("");
2003-05-19 19:18:36 +06:00
}
2003-09-04 18:03:27 +06:00
DriverUNV_R_SMESHDS_Document::~DriverUNV_R_SMESHDS_Document()
{
;
2003-05-19 19:18:36 +06:00
}
//void DriverUNV_R_SMESHDS_Document::SetFile(string aFile) {
//myFile = aFile;
//}
//void DriverUNV_R_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDoc) {
//myDocument = aDoc;
//}
2003-09-04 18:03:27 +06:00
void DriverUNV_R_SMESHDS_Document::Read()
{
2003-05-19 19:18:36 +06:00
2003-09-04 18:03:27 +06:00
int myMeshId;
SCRUTE(myFile);
//Handle(SMESHDS_Document) myDocument = new SMESHDS_Document(1);
2003-05-19 19:18:36 +06:00
/****************************************************************************
* OUVERTURE DU FICHIER EN LECTURE *
****************************************************************************/
2003-09-04 18:03:27 +06:00
char *file2Read = (char *)myFile.c_str();
FILE *fid = fopen(file2Read, "r");
if (fid < 0)
{
fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
exit(EXIT_FAILURE);
}
2003-05-19 19:18:36 +06:00
/****************************************************************************
* COMBIEN DE MAILLAGES ? *
****************************************************************************/
2003-09-04 18:03:27 +06:00
int nmaa = 1;
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
2003-09-04 18:03:27 +06:00
printf("Nombre de maillages = %d\n", nmaa);
2003-05-19 19:18:36 +06:00
2003-09-04 18:03:27 +06:00
string myClass = string("SMESHDS_Mesh");
string myExtension = string("UNV");
2003-05-19 19:18:36 +06:00
2003-09-04 18:03:27 +06:00
for (int meshIt = 1; meshIt <= nmaa; meshIt++)
{
myMeshId = myDocument->NewMesh();
2003-05-19 19:18:36 +06:00
2003-09-04 18:03:27 +06:00
SMDS_Mesh * myMesh = myDocument->GetMesh(myMeshId);
2003-05-19 19:18:36 +06:00
2003-09-04 18:03:27 +06:00
DriverUNV_R_SMESHDS_Mesh *myReader = new DriverUNV_R_SMESHDS_Mesh;
2003-05-19 19:18:36 +06:00
2003-09-04 18:03:27 +06:00
myReader->SetMesh(myMesh);
myReader->SetFile(myFile);
//myReader->SetFileId(fid);
2003-05-19 19:18:36 +06:00
2003-09-04 18:03:27 +06:00
myReader->Read();
2003-05-19 19:18:36 +06:00
2003-09-04 18:03:27 +06:00
}
2003-05-19 19:18:36 +06:00
}