1 // SMESH DriverDAT : driver to read and write 'dat' files
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : DriverDAT_R_SMESHDS_Document.cxx
28 #include "DriverDAT_R_SMESHDS_Document.h"
29 #include "DriverDAT_R_SMESHDS_Mesh.h"
31 #include "utilities.h"
39 // Document_Reader* maker() {
40 DriverDAT_R_SMESHDS_Document* maker() {
41 fprintf(stdout,"here in maker\n");
42 return new DriverDAT_R_SMESHDS_Document;
46 DriverDAT_R_SMESHDS_Document::DriverDAT_R_SMESHDS_Document() {
50 DriverDAT_R_SMESHDS_Document::~DriverDAT_R_SMESHDS_Document() {
54 //void DriverDAT_R_SMESHDS_Document::SetFile(string aFile) {
58 //void DriverDAT_R_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDoc) {
62 void DriverDAT_R_SMESHDS_Document::Read() {
67 //Handle(SMESHDS_Document) myDocument = new SMESHDS_Document(1);
69 /****************************************************************************
70 * OUVERTURE DU FICHIER EN LECTURE *
71 ****************************************************************************/
72 char* file2Read = (char*)myFile.c_str();
73 FILE* fid = fopen(file2Read,"r");
76 fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
80 /****************************************************************************
81 * COMBIEN DE MAILLAGES ? *
82 ****************************************************************************/
85 /****************************************************************************
86 * FERMETURE DU FICHIER *
87 ****************************************************************************/
90 printf("Nombre de maillages = %d\n",nmaa);
92 string myClass = string("SMESHDS_Mesh");
93 string myExtension = string("DAT");
95 for (int meshIt=1;meshIt<=nmaa;meshIt++) {
96 myMeshId = myDocument->NewMesh();
98 Handle(SMDS_Mesh) myMesh = myDocument->GetMesh(myMeshId);
100 DriverDAT_R_SMESHDS_Mesh* myReader = new DriverDAT_R_SMESHDS_Mesh;
103 myReader->SetMesh(myMesh);
104 myReader->SetFile(myFile);
105 //myReader->SetFileId(fid);