1 // Copyright (C) 2007-2012 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.
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 "MEDCouplingFieldServant.hxx"
21 #include "MEDCouplingMeshServant.hxx"
22 #include "MEDCouplingUMeshServant.hxx"
23 #include "MEDCouplingCMeshServant.hxx"
24 #include "MEDCouplingExtrudedMeshServant.hxx"
25 #include "MEDCouplingField.hxx"
26 #include "MEDCouplingUMesh.hxx"
27 #include "MEDCouplingCMesh.hxx"
28 #include "MEDCouplingExtrudedMesh.hxx"
30 using namespace ParaMEDMEM;
32 MEDCouplingFieldServant::MEDCouplingFieldServant(const MEDCouplingField *cppPointerOfMesh):MEDCouplingRefCountServant(cppPointerOfMesh,cppPointerOfMesh)
36 SALOME_MED::MEDCouplingMeshCorbaInterface_ptr MEDCouplingFieldServant::BuildCorbaRefFromCppPointer(const MEDCouplingMesh *mesh)
38 const MEDCouplingUMesh *uMesh=dynamic_cast<const MEDCouplingUMesh *>(mesh);
41 MEDCouplingUMeshServant *retServ=new MEDCouplingUMeshServant(uMesh);
42 SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr ret=retServ->_this();//let this line even if it seems fool
45 const MEDCouplingCMesh *cMesh=dynamic_cast<const MEDCouplingCMesh *>(mesh);
48 MEDCouplingCMeshServant *retServ=new MEDCouplingCMeshServant(cMesh);
49 SALOME_MED::MEDCouplingCMeshCorbaInterface_ptr ret=retServ->_this();//let this line even if it seems fool
52 const MEDCouplingExtrudedMesh *eMesh=dynamic_cast<const MEDCouplingExtrudedMesh *>(mesh);
55 MEDCouplingExtrudedMeshServant *retServ=new MEDCouplingExtrudedMeshServant(eMesh);
56 return retServ->_this();
58 throw INTERP_KERNEL::Exception("Not dealt mesh type !");
61 SALOME_MED::MEDCouplingMeshCorbaInterface_ptr MEDCouplingFieldServant::getMesh()
63 const MEDCouplingMesh *mesh=getPointer()->getMesh();
64 return BuildCorbaRefFromCppPointer(mesh);