1 // Copyright (C) 2007-2013 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
19 // Author : Anthony Geay (CEA/DEN)
21 #include "MEDCouplingMeshServant.hxx"
22 #include "InterpKernelException.hxx"
23 #include "MEDCouplingMesh.hxx"
24 #include "MEDCouplingMemArray.hxx"
26 using namespace ParaMEDMEM;
28 MEDCouplingMeshServant::MEDCouplingMeshServant(const MEDCouplingMesh *cppPointerOfMesh):MEDCouplingRefCountServant(cppPointerOfMesh,cppPointerOfMesh)
32 char *MEDCouplingMeshServant::getName()
34 return CORBA::string_dup(getPointer()->getName().c_str());
37 void MEDCouplingMeshServant::getTinyInfo(SALOME_TYPES::ListOfDouble_out da, SALOME_TYPES::ListOfLong_out la, SALOME_TYPES::ListOfString_out sa)
39 da=new SALOME_TYPES::ListOfDouble;
40 la=new SALOME_TYPES::ListOfLong;
41 std::vector<double> tinyInfoD;
42 std::vector<int> tinyInfoI;
43 std::vector<std::string> tinyInfoS;
44 getPointer()->getTinySerializationInformation(tinyInfoD,tinyInfoI,tinyInfoS);
45 da->length(tinyInfoD.size());
46 la->length(tinyInfoI.size());
47 for(int i=0;i<(int)tinyInfoD.size();i++)
48 (*da)[i]=tinyInfoD[i];
49 for(int i=0;i<(int)tinyInfoI.size();i++)
50 (*la)[i]=tinyInfoI[i];
52 sa=new SALOME_TYPES::ListOfString;
53 int nbOfSts=tinyInfoS.size();
55 for(int i=0;i<nbOfSts;i++)
56 (*sa)[i]=CORBA::string_dup(tinyInfoS[i].c_str());
59 void MEDCouplingMeshServant::getSerialisationData(SALOME_TYPES::ListOfLong_out la, SALOME_TYPES::ListOfDouble_out da)
62 DataArrayDouble *array2;
63 getPointer()->serialize(array1,array2);
64 la=new SALOME_TYPES::ListOfLong;
67 int lgth=array1->getNbOfElems();
68 const int *data=array1->getConstPointer();
70 for(int i=0;i<lgth;i++)
75 da=new SALOME_TYPES::ListOfDouble;
78 int lgth=array2->getNbOfElems();
79 const double *data2=array2->getConstPointer();
81 for(int i=0;i<lgth;i++)
88 CORBA::Boolean MEDCouplingMeshServant::ExportDataAs(const char *format, SALOME::GenericObj_out exporter)
90 std::string frmCpp(format);
91 if(frmCpp=="MEDCorba")
93 SALOME_MED::MEDCouplingMeshCorbaInterface_ptr cPtr=_this();
98 exporter=SALOME::GenericObj::_nil();