Back to index

salome-med  6.5.0
Functions
MEDMEM_InvokingDriverByAttachingItToAnObject.cxx File Reference
#include "MEDMEM_Exception.hxx"
#include "MEDMEM_define.hxx"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_Mesh.hxx"
#include "MEDMEM_MedMeshDriver.hxx"

Go to the source code of this file.

Functions

 main ()

Function Documentation

main ( void  )

Definition at line 33 of file MEDMEM_InvokingDriverByAttachingItToAnObject.cxx.

        {
  
  const char * fileName   = "pointe.med";
  const char * fileName2  = "Field&MeshGeneratedPointe.med";
  const char * fileName3  = "MedGeneratedPointe.med";
  const char * fieldName  = "fieldcelldoublescalar";
  const char * meshName   = "maa1";

  try {
    // Test creation of drivers from the standard driver method of an object
    {  
      FIELD<double> * myField = new FIELD<double>();
      MED_FIELD_RDONLY_DRIVER<double> myRdOnlyDriver(fileName,myField);
      myRdOnlyDriver.setFieldName(fieldName);
      myRdOnlyDriver.open(); 
      myRdOnlyDriver.read();
      // try  { myRdOnlyDriver.write(); } catch  (MEDEXCEPTION& ex) 
      //   { MESSAGE(ex.what()); }
      MED_FIELD_WRONLY_DRIVER<double> myWrOnlyDriver(fileName2,myField);
      myWrOnlyDriver.open(); 
      myWrOnlyDriver.write(); 
      // try  myWrOnlyDriver.read(); catch  (MEDEXCEPTION& ex) 
      //   { MESSAGE(ex.what()); }
      myRdOnlyDriver.close();
      myWrOnlyDriver.close();
      delete myField;
    }

    {
      MESH * myMesh = new MESH();
      MED_MESH_RDONLY_DRIVER myRdOnlyDriver(fileName,myMesh);
      myRdOnlyDriver.setMeshName(meshName);
      myRdOnlyDriver.open(); 
      myRdOnlyDriver.read();
      myRdOnlyDriver.close(); 
      // try  { myRdOnlyDriver.write(); } catch  (MEDEXCEPTION& ex)
      //   { MESSAGE(ex.what()); }
      MED_MESH_WRONLY_DRIVER myWrOnlyDriver(fileName2,myMesh);
      myWrOnlyDriver.setMeshName(meshName);
      myWrOnlyDriver.open(); 
      myWrOnlyDriver.write(); 
      // try  myWrOnlyDriver.read(); catch  (MEDEXCEPTION& ex)
      //   { MESSAGE(ex.what()); }
      myRdOnlyDriver.close(); 
      myWrOnlyDriver.close();
      delete myMesh;
    }


  } catch (MEDEXCEPTION& ex){
    cout << "MAIN BLOCK EXCEPTION" << endl;
    MESSAGE_MED(ex.what()) ;
  }
}

Here is the call graph for this function: