1 // Copyright (C) 2007-2008 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 #include "ParaMESH.hxx"
20 #include "ProcessorGroup.hxx"
21 #include "MPIProcessorGroup.hxx"
22 #include "Topology.hxx"
23 #include "BlockTopology.hxx"
24 #include "MemArray.hxx"
29 //inclusion for the namespaces
34 ParaMESH::ParaMESH( MEDCouplingUMesh *subdomain_mesh, MEDCouplingUMesh *subdomain_face,
35 DataArrayInt *CorrespElt_local2global, DataArrayInt *CorrespFace_local2global,
36 DataArrayInt *CorrespNod_local2global, const ProcessorGroup& proc_group ):
37 _cell_mesh(subdomain_mesh),
38 _face_mesh(subdomain_face),
39 _my_domain_id(proc_group.myRank()),
40 _block_topology (new BlockTopology(proc_group, subdomain_mesh->getNumberOfCells())),
41 _explicit_topology(0),
42 _node_global(CorrespNod_local2global),
43 _face_global(CorrespFace_local2global),
44 _cell_global(CorrespElt_local2global)
47 _cell_mesh->incrRef();
49 _face_mesh->incrRef();
50 if(CorrespElt_local2global)
51 CorrespElt_local2global->incrRef();
52 if(CorrespFace_local2global)
53 CorrespFace_local2global->incrRef();
54 if(CorrespNod_local2global)
55 CorrespNod_local2global->incrRef();
58 ParaMESH::ParaMESH( MEDCouplingUMesh *mesh, const ProcessorGroup& proc_group, const std::string& name):
61 _my_domain_id(proc_group.myRank()),
62 _block_topology (new BlockTopology(proc_group, mesh->getNumberOfCells())),
67 _cell_mesh->incrRef();
68 int nb_elem=mesh->getNumberOfCells();
69 _explicit_topology=new BlockTopology(proc_group,nb_elem);
70 int nbOfCells=mesh->getNumberOfCells();
71 _cell_global = DataArrayInt::New();
72 _cell_global->alloc(nbOfCells,1);
73 int *cellglobal=_cell_global->getPointer();
74 int offset = _block_topology->localToGlobal(make_pair(_my_domain_id,0));
75 for (int i=0; i<nbOfCells; i++)
77 cellglobal[i]=offset+i;
84 _cell_mesh->decrRef();
86 _face_mesh->decrRef();
87 delete _block_topology;
89 _node_global->decrRef();
91 _cell_global->decrRef();
93 _face_global->decrRef();
95 _node_global->decrRef();
96 delete _explicit_topology;