]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM/MEDMEM_TopLevel.cxx
Salome HOME
Join modifications from branch CEAFor_V3_2_0
[modules/med.git] / src / MEDMEM / MEDMEM_TopLevel.cxx
1 #include "MEDMEM_TopLevel.hxx"
2 #include "MEDMEM_Med.hxx"
3 #include "MEDMEM_Mesh.hxx"
4 #include "MEDMEM_Field.hxx"
5 #include "MEDMEM_DriverFactory.hxx"
6 #include "MEDMEM_MedMedDriver.hxx"
7
8 using namespace MED_EN;
9 using namespace MEDMEM;
10
11 MED *::MEDMEM::readMedInFile(const std::string& fileName) throw(MEDEXCEPTION)
12 {
13   MED *myMedObj=new MED;
14   driverTypes type=DRIVERFACTORY::deduceDriverTypeFromFileName(fileName);
15   int id=myMedObj->addDriver(type,fileName,MED_REMP);
16   myMedObj->read(id);
17   return myMedObj;
18 }
19
20 MESH *::MEDMEM::readMeshInFile(const std::string& fileName, const std::string& meshName)
21 {
22   MESH *mesh=new MESH;
23   driverTypes type=DRIVERFACTORY::deduceDriverTypeFromFileName(fileName);
24   int id=mesh->addDriver(type,fileName,mesh->getName(),MED_REMP);
25   mesh->read(id);
26   return mesh;
27 }
28
29 void ::MEDMEM::writeMedToFile(const MED *medObj, const std::string& fileName)
30
31   MED *medObjNoC=(MED *)medObj;//MED::write should be a const method ... As it's not the case
32   driverTypes type=DRIVERFACTORY::deduceDriverTypeFromFileName(fileName);
33   int id=medObjNoC->addDriver(type,fileName,MED_REMP);
34   medObjNoC->write(id);
35 }
36
37 void ::MEDMEM::writeMeshToFile(const MESH *meshObj, const std::string& fileName)
38 {
39   MESH *meshObjNoC=(MESH *)meshObj;//MED::write should be a const method ... As it's not the case
40   driverTypes type=DRIVERFACTORY::deduceDriverTypeFromFileName(fileName);
41   int id=meshObjNoC->addDriver(type,fileName,meshObjNoC->getName(),MED_REMP);
42   meshObjNoC->write(id);
43 }