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 "MEDCouplingMeshServant.hxx"
21 #include "InterpKernelException.hxx"
22 #include "MEDCouplingMesh.hxx"
23 #include "MEDCouplingMemArray.hxx"
25 using namespace ParaMEDMEM;
27 MEDCouplingMeshServant::MEDCouplingMeshServant(const MEDCouplingMesh *cppPointerOfMesh):MEDCouplingRefCountServant(cppPointerOfMesh,cppPointerOfMesh)
31 char *MEDCouplingMeshServant::getName()
33 return CORBA::string_dup(getPointer()->getName());
36 void MEDCouplingMeshServant::getTinyInfo(SALOME_TYPES::ListOfDouble_out da, SALOME_TYPES::ListOfLong_out la, SALOME_TYPES::ListOfString_out sa)
38 da=new SALOME_TYPES::ListOfDouble;
39 la=new SALOME_TYPES::ListOfLong;
40 std::vector<double> tinyInfoD;
41 std::vector<int> tinyInfoI;
42 std::vector<std::string> tinyInfoS;
43 getPointer()->getTinySerializationInformation(tinyInfoD,tinyInfoI,tinyInfoS);
44 da->length(tinyInfoD.size());
45 la->length(tinyInfoI.size());
46 for(int i=0;i<(int)tinyInfoD.size();i++)
47 (*da)[i]=tinyInfoD[i];
48 for(int i=0;i<(int)tinyInfoI.size();i++)
49 (*la)[i]=tinyInfoI[i];
51 sa=new SALOME_TYPES::ListOfString;
52 int nbOfSts=tinyInfoS.size();
54 for(int i=0;i<nbOfSts;i++)
55 (*sa)[i]=CORBA::string_dup(tinyInfoS[i].c_str());
58 void MEDCouplingMeshServant::getSerialisationData(SALOME_TYPES::ListOfLong_out la, SALOME_TYPES::ListOfDouble_out da)
61 DataArrayDouble *array2;
62 getPointer()->serialize(array1,array2);
63 la=new SALOME_TYPES::ListOfLong;
66 int lgth=array1->getNbOfElems();
67 const int *data=array1->getConstPointer();
69 for(int i=0;i<lgth;i++)
74 da=new SALOME_TYPES::ListOfDouble;
77 int lgth=array2->getNbOfElems();
78 const double *data2=array2->getConstPointer();
80 for(int i=0;i<lgth;i++)
87 CORBA::Boolean MEDCouplingMeshServant::ExportDataAs(const char *format, SALOME::GenericObj_out exporter)
89 std::string frmCpp(format);
90 if(frmCpp=="MEDCorba")
92 SALOME_MED::MEDCouplingMeshCorbaInterface_ptr cPtr=_this();
97 exporter=SALOME::GenericObj::_nil();