1 // Copyright (C) 2010-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 "VTKMEDCouplingCMeshClient.hxx"
22 #include "vtkErrorCode.h"
23 #include "vtkDoubleArray.h"
24 #include "vtkRectilinearGrid.h"
29 void ParaMEDMEM2VTK::FillMEDCouplingCMeshInstanceFrom(SALOME_MED::MEDCouplingCMeshCorbaInterface_ptr meshPtr, vtkRectilinearGrid *ret)
32 SALOME_TYPES::ListOfDouble *tinyD;
33 SALOME_TYPES::ListOfLong *tinyI;
34 SALOME_TYPES::ListOfString *tinyS;
35 meshPtr->getTinyInfo(tinyD,tinyI,tinyS);
37 sizePerAxe[0]=(*tinyI)[0];
38 sizePerAxe[1]=(*tinyI)[1];
39 sizePerAxe[2]=(*tinyI)[2];
40 ret->SetDimensions(sizePerAxe[0],sizePerAxe[1],sizePerAxe[2]);
43 SALOME_TYPES::ListOfDouble *bigD;
44 meshPtr->getSerialisationData(tinyI,bigD);
50 da=vtkDoubleArray::New();
51 da->SetNumberOfTuples(sizePerAxe[0]);
52 da->SetNumberOfComponents(1);
53 double *pt=da->GetPointer(0);
54 for(int i=0;i<sizePerAxe[0];i++)
56 ret->SetXCoordinates(da);
58 offset+=sizePerAxe[0];
62 da=vtkDoubleArray::New();
63 da->SetNumberOfTuples(sizePerAxe[1]);
64 da->SetNumberOfComponents(1);
65 double *pt=da->GetPointer(0);
66 for(int i=0;i<sizePerAxe[1];i++)
67 pt[i]=(*bigD)[offset+i];
68 ret->SetYCoordinates(da);
70 offset+=sizePerAxe[1];
74 da=vtkDoubleArray::New();
75 da->SetNumberOfTuples(sizePerAxe[2]);
76 da->SetNumberOfComponents(1);
77 double *pt=da->GetPointer(0);
78 for(int i=0;i<sizePerAxe[2];i++)
79 pt[i]=(*bigD)[offset+i];
80 ret->SetZCoordinates(da);
84 meshPtr->UnRegister();