Salome HOME
Updated copyright comment
[modules/med.git] / src / MEDCouplingCorba / MEDCouplingFieldServant.cxx
1 // Copyright (C) 2007-2024  CEA, EDF
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20
21 #include "MEDCouplingFieldServant.hxx"
22 #include "MEDCouplingMeshServant.hxx"
23 #include "MEDCouplingUMeshServant.hxx"
24 #include "MEDCouplingCMeshServant.hxx"
25 #include "MEDCouplingIMeshServant.hxx"
26 #include "MEDCouplingCurveLinearMeshServant.hxx"
27 #include "MEDCouplingExtrudedMeshServant.hxx"
28 #include "MEDCoupling1SGTUMeshServant.hxx"
29 #include "MEDCoupling1DGTUMeshServant.hxx"
30 #include "MEDCouplingField.hxx"
31 #include "MEDCouplingUMesh.hxx"
32 #include "MEDCouplingCMesh.hxx"
33 #include "MEDCouplingIMesh.hxx"
34 #include "MEDCouplingCurveLinearMesh.hxx"
35 #include "MEDCouplingMappedExtrudedMesh.hxx"
36 #include "MEDCoupling1GTUMesh.hxx"
37
38 using namespace MEDCoupling;
39
40 MEDCouplingFieldServant::MEDCouplingFieldServant(const MEDCouplingField *cppPointerOfMesh):MEDCouplingRefCountServant(cppPointerOfMesh,cppPointerOfMesh)
41 {
42 }
43
44 SALOME_MED::MEDCouplingMeshCorbaInterface_ptr MEDCouplingFieldServant::BuildCorbaRefFromCppPointer(const MEDCouplingMesh *mesh)
45 {
46   const MEDCouplingUMesh *uMesh=dynamic_cast<const MEDCouplingUMesh *>(mesh);
47   if(uMesh)
48     {
49       MEDCouplingUMeshServant *retServ=new MEDCouplingUMeshServant(uMesh);
50       SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr ret=retServ->_this();//let this line even if it seems fool
51       return ret;
52     }
53   const MEDCouplingCMesh *cMesh=dynamic_cast<const MEDCouplingCMesh *>(mesh);
54   if(cMesh)
55     {
56       MEDCouplingCMeshServant *retServ=new MEDCouplingCMeshServant(cMesh);
57       SALOME_MED::MEDCouplingCMeshCorbaInterface_ptr ret=retServ->_this();//let this line even if it seems fool
58       return ret;
59     }
60   const MEDCouplingIMesh *iMesh=dynamic_cast<const MEDCouplingIMesh *>(mesh);
61   if(iMesh)
62     {
63       MEDCouplingIMeshServant *retServ=new MEDCouplingIMeshServant(iMesh);
64       SALOME_MED::MEDCouplingIMeshCorbaInterface_ptr ret=retServ->_this();//let this line even if it seems fool
65       return ret;
66     }
67   const MEDCouplingMappedExtrudedMesh *eMesh=dynamic_cast<const MEDCouplingMappedExtrudedMesh *>(mesh);
68   if(eMesh)
69     {
70       MEDCouplingExtrudedMeshServant *retServ=new MEDCouplingExtrudedMeshServant(eMesh);
71       return retServ->_this();
72     }
73   const MEDCouplingCurveLinearMesh *clMesh=dynamic_cast<const MEDCouplingCurveLinearMesh *>(mesh);
74   if(clMesh)
75     {
76       MEDCouplingCurveLinearMeshServant *retServ=new MEDCouplingCurveLinearMeshServant(clMesh);
77       SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface_ptr ret=retServ->_this();//let this line even if it seems fool
78       return ret;
79     }
80   const MEDCoupling1SGTUMesh *u0Mesh=dynamic_cast<const MEDCoupling1SGTUMesh *>(mesh);
81   if(u0Mesh)
82     {
83       MEDCoupling1SGTUMeshServant *retServ=new MEDCoupling1SGTUMeshServant(u0Mesh);
84       SALOME_MED::MEDCoupling1SGTUMeshCorbaInterface_ptr ret=retServ->_this();//let this line even if it seems fool
85       return ret;
86     }
87   const MEDCoupling1DGTUMesh *u1Mesh=dynamic_cast<const MEDCoupling1DGTUMesh *>(mesh);
88   if(u1Mesh)
89     {
90       MEDCoupling1DGTUMeshServant *retServ=new MEDCoupling1DGTUMeshServant(u1Mesh);
91       SALOME_MED::MEDCoupling1DGTUMeshCorbaInterface_ptr ret=retServ->_this();//let this line even if it seems fool
92       return ret;
93     }
94   throw INTERP_KERNEL::Exception("Not dealt mesh type !");
95 }
96
97 SALOME_MED::MEDCouplingMeshCorbaInterface_ptr MEDCouplingFieldServant::getMesh()
98 {
99   const MEDCouplingMesh *mesh(getPointer()->getMesh());
100   return BuildCorbaRefFromCppPointer(mesh);
101 }