1 // Copyright (C) 2007-2015 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 "ParaGRID.hxx"
21 #include "Topology.hxx"
22 #include "BlockTopology.hxx"
23 #include "MEDCouplingMemArray.hxx"
24 #include "MEDCouplingCMesh.hxx"
25 #include "InterpKernelUtilities.hxx"
34 ParaGRID::ParaGRID(MEDCouplingCMesh* global_grid, Topology* topology) throw(INTERP_KERNEL::Exception)
37 _block_topology = dynamic_cast<BlockTopology*>(topology);
38 if(_block_topology==0)
39 throw INTERP_KERNEL::Exception(LOCALIZED("ParaGRID::ParaGRID topology must be block topology"));
41 if (!_block_topology->getProcGroup()->containsMyRank())
44 int dimension=_block_topology->getDimension() ;
45 if (dimension != global_grid->getSpaceDimension())
46 throw INTERP_KERNEL::Exception(LOCALIZED("ParaGrid::ParaGrid incompatible topology"));
49 /*vector<vector<double> > xyz_array(dimension);
50 vector<pair<int,int> > local_indices = _block_topology->getLocalArrayMinMax();
51 vector <string> coordinates_names;
52 vector <string> coordinates_units;
53 for (int idim=0; idim<dimension ; idim++)
55 DataArrayDouble *array=global_grid->getCoordsAt(idim);
56 double *arrayC=array->getPointer();
57 cout << " Indices "<< local_indices[idim].first <<" "<<local_indices[idim].second<<endl;
58 for (int i=(local_indices)[idim].first; i<(local_indices)[idim].second; i++)
59 xyz_array[idim].push_back(arrayC[i]);
60 coordinates_names.push_back(array->getName());
61 coordinates_units.push_back(array->getInfoOnComponentAt(0));
63 _grid=MEDCouplingCMesh::New();
64 _grid->set(xyz_array, coordinates_names,coordinates_units);
65 _grid->setName(global_grid->getName());
66 _grid->setDescription(global_grid->getDescription());*/