Back to index

salome-med  6.5.0
MEDMEMTest_VtkMeshDriver_fault.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #include "MEDMEMTest.hxx"
00021 
00022 #include <MEDMEM_VtkMeshDriver.hxx>
00023 #include <MEDMEM_Mesh.hxx>
00024 
00025 using namespace std;
00026 using namespace MEDMEM;
00027 
00028 int main (int argc, char** argv)
00029 {
00030   string meshname = "MyMesh";
00031   string filename = makeTmpFile( "my_pointe.vtk" );
00032 
00033   MEDMEMTest_TmpFilesRemover aRemover;
00034   aRemover.Register(filename);
00035 
00036   //Create an empty Mesh
00037   MESH * aMesh = new MESH();
00038 
00039   //Creation corect driver
00040   VTK_MESH_DRIVER *aVtkDriver = new VTK_MESH_DRIVER(filename, aMesh);
00041   aVtkDriver->setMeshName(meshname);
00042   aVtkDriver->open();
00043 
00044   // ? (BUG) ? In VTK_MESH_DRIVER::write() => Segmentation fault on attempt to write an empty mesh
00045   try
00046   {
00047     //Trying write an empty mesh
00048     aVtkDriver->write();
00049   }
00050   catch (MEDEXCEPTION & ex)
00051   {
00052     // good behaviour
00053   }
00054   catch (...)
00055   {
00056   }
00057 
00058   aVtkDriver->close();
00059 
00060   // (BUG) In copy constructor of VTK_MESH_DRIVER: Segmentation fault or Infinite loop
00061   VTK_MESH_DRIVER aVtkDriverCpy_2 (*aVtkDriver);
00062 
00063   delete aVtkDriver;
00064   delete aMesh;
00065 }