1 // Copyright (C) 2010-2016 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, or (at your option) any later version.
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 "VTKParaMEDFieldClient.hxx"
21 #include "VTKMEDCouplingFieldClient.hxx"
23 #include "vtkDataSet.h"
24 #include "vtkUnstructuredGrid.h"
25 #include "vtkMultiBlockDataSet.h"
26 #include "vtkMultiBlockDataGroupFilter.h"
27 #include "vtkCompositeDataToUnstructuredGridFilter.h"
29 std::vector<double> ParaMEDMEM2VTK::FillMEDCouplingParaFieldDoubleInstanceFrom(SALOME_MED::ParaMEDCouplingFieldDoubleCorbaInterface_ptr fieldPtr, int begin, int end,
30 vtkMultiBlockDataSet *ret)
32 std::vector<double> ret2;
33 int nbOfParts=end-begin;
34 Engines::IORTab *allSlices=fieldPtr->tior();
35 vtkMultiBlockDataGroupFilter *tmp=vtkMultiBlockDataGroupFilter::New();
36 for(int i=0;i<nbOfParts;i++)
38 CORBA::Object_ptr obj=(*allSlices)[i+begin];
39 SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_var fieldCorba=SALOME_MED::MEDCouplingFieldDoubleCorbaInterface::_narrow(obj);
40 std::vector<double> times;
41 vtkDataSet *part=ParaMEDMEM2VTK::BuildFullyFilledFromMEDCouplingFieldDoubleInstance(fieldCorba,times);
42 tmp->AddInputData(part);
46 vtkCompositeDataToUnstructuredGridFilter *tmp2=vtkCompositeDataToUnstructuredGridFilter::New();
47 tmp2->SetInputData(tmp->GetOutput());
50 vtkUnstructuredGrid *ret3=tmp2->GetOutput();
51 ret->SetBlock(0,ret3);