1 // Copyright (C) 2010-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "VTKMEDCouplingMeshClient.hxx"
21 #include "VTKMEDCouplingUMeshClient.hxx"
22 #include "VTKMEDCouplingCMeshClient.hxx"
23 #include "VTKMEDCouplingCurveLinearMeshClient.hxx"
25 #include "vtkErrorCode.h"
26 #include "vtkUnstructuredGrid.h"
27 #include "vtkRectilinearGrid.h"
28 #include "vtkStructuredGrid.h"
33 //vtkErrorMacro("Cannot call Start() twice before calling Finish().");
34 void ParaMEDMEM2VTK::FillMEDCouplingMeshInstanceFrom(SALOME_MED::MEDCouplingMeshCorbaInterface_ptr meshPtr, vtkDataSet *ret)
36 SALOME_MED::MEDCouplingUMeshCorbaInterface_var umeshPtr=SALOME_MED::MEDCouplingUMeshCorbaInterface::_narrow(meshPtr);
37 if(!CORBA::is_nil(umeshPtr))
39 vtkUnstructuredGrid *ret1=vtkUnstructuredGrid::SafeDownCast(ret);
42 vtkErrorWithObjectMacro(ret,"Internal error in ParaMEDCorba plugin : mismatch between VTK type and CORBA type UMesh !");
46 ParaMEDMEM2VTK::FillMEDCouplingUMeshInstanceFrom(umeshPtr,ret1,dummy);//VTK bug
49 SALOME_MED::MEDCouplingCMeshCorbaInterface_var cmeshPtr=SALOME_MED::MEDCouplingCMeshCorbaInterface::_narrow(meshPtr);
50 if(!CORBA::is_nil(cmeshPtr))
52 vtkRectilinearGrid *ret1=vtkRectilinearGrid::SafeDownCast(ret);
55 vtkErrorWithObjectMacro(ret,"Internal error in ParaMEDCorba plugin : mismatch between VTK type and CORBA type CMesh !");
58 ParaMEDMEM2VTK::FillMEDCouplingCMeshInstanceFrom(cmeshPtr,ret1);
61 SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface_var clmeshPtr=SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface::_narrow(meshPtr);
62 if(!CORBA::is_nil(clmeshPtr))
64 vtkStructuredGrid *ret1=vtkStructuredGrid::SafeDownCast(ret);
67 vtkErrorWithObjectMacro(ret,"Internal error in ParaMEDCorba plugin : mismatch between VTK type and CORBA type CurveLinearMesh !");
70 ParaMEDMEM2VTK::FillMEDCouplingCurveLinearMeshInstanceFrom(clmeshPtr,ret1);
73 vtkErrorWithObjectMacro(ret,"Error : CORBA mesh type ! Mesh type not managed !");
76 vtkDataSet *ParaMEDMEM2VTK::BuildFromMEDCouplingMeshInstance(SALOME_MED::MEDCouplingMeshCorbaInterface_ptr meshPtr, bool& isPolyh)
78 SALOME_MED::MEDCouplingUMeshCorbaInterface_var umeshPtr=SALOME_MED::MEDCouplingUMeshCorbaInterface::_narrow(meshPtr);
79 if(!CORBA::is_nil(umeshPtr))
81 vtkUnstructuredGrid *ret1=vtkUnstructuredGrid::New();
82 ParaMEDMEM2VTK::FillMEDCouplingUMeshInstanceFrom(umeshPtr,ret1,isPolyh);
85 SALOME_MED::MEDCouplingCMeshCorbaInterface_var cmeshPtr=SALOME_MED::MEDCouplingCMeshCorbaInterface::_narrow(meshPtr);
86 if(!CORBA::is_nil(cmeshPtr))
88 vtkRectilinearGrid *ret1=vtkRectilinearGrid::New();
89 ParaMEDMEM2VTK::FillMEDCouplingCMeshInstanceFrom(cmeshPtr,ret1);
92 SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface_var clmeshPtr=SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface::_narrow(meshPtr);
93 if(!CORBA::is_nil(clmeshPtr))
95 vtkStructuredGrid *ret1=vtkStructuredGrid::New();
96 ParaMEDMEM2VTK::FillMEDCouplingCurveLinearMeshInstanceFrom(clmeshPtr,ret1);
99 vtkOutputWindowDisplayErrorText("Error : CORBA mesh type ! Mesh type not managed #2 !");