From: cvw Date: Tue, 6 Mar 2012 09:55:20 +0000 (+0000) Subject: gnu indent and rules X-Git-Tag: V6_main_FINAL~804 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6eb794d7f89237efcee8dc3c06e2aca4be04e9de;p=tools%2Fmedcoupling.git gnu indent and rules --- diff --git a/src/MEDPartitioner/MEDPARTITIONER.hxx b/src/MEDPartitioner/MEDPARTITIONER.hxx index e18a0da3a..64d457b4e 100755 --- a/src/MEDPartitioner/MEDPARTITIONER.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER.hxx @@ -1,29 +1,24 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File : MEDPARTITIONER.hxx -// Author : Alexander A. BORODIN -// Module : MED -// Exporting/Importing defines for Windows Platform -// -#ifndef MEDPARTITIONER_HXX_ -#define MEDPARTITIONER_HXX_ +#ifndef __MEDPARTITIONER_HXX__ +#define __MEDPARTITIONER_HXX__ #ifdef WNT # if defined MEDPARTITIONER_EXPORTS || defined medsplitter_EXPORTS @@ -35,4 +30,4 @@ # define MEDPARTITIONER_EXPORT #endif -#endif //MEDPARTITIONER_HXX_ +#endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx index 040410714..aafa7bfe1 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx @@ -1,36 +1,29 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D // -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// few Med Memory include files -#include "MEDCouplingUMesh.hxx" -#include "MEDPARTITIONER_SkyLineArray.hxx" #include "MEDPARTITIONER_ConnectZone.hxx" -// few STL include files #include using namespace MEDPARTITIONER; -CONNECTZONE::CONNECTZONE(): +ConnectZone::ConnectZone(): _name("") ,_description("") ,_distantDomainNumber(0) @@ -41,17 +34,17 @@ CONNECTZONE::CONNECTZONE(): _entityCorresp.clear(); } -CONNECTZONE::~CONNECTZONE(){ +ConnectZone::~ConnectZone(){ if (_nodeCorresp !=0) delete _nodeCorresp; if (_faceCorresp !=0) delete _faceCorresp; - for (std::map < std::pair ,MEDPARTITIONER::MEDSKYLINEARRAY * >::iterator + for (std::map < std::pair ,MEDPARTITIONER::SkyLineArray * >::iterator iter = _entityCorresp.begin(); iter != _entityCorresp.end(); iter++) { delete iter->second; } } -CONNECTZONE::CONNECTZONE(const CONNECTZONE & myConnectZone): +ConnectZone::ConnectZone(const ConnectZone & myConnectZone): _name(myConnectZone._name) ,_description(myConnectZone._description) ,_distantDomainNumber(myConnectZone._distantDomainNumber) @@ -61,156 +54,167 @@ CONNECTZONE::CONNECTZONE(const CONNECTZONE & myConnectZone): ,_entityCorresp(myConnectZone._entityCorresp) { } -std::string CONNECTZONE::getName() const + +std::string ConnectZone::getName() const { return _name; } -std::string CONNECTZONE::getDescription() const + +std::string ConnectZone::getDescription() const { return _description; } -int CONNECTZONE::getDistantDomainNumber() const + +int ConnectZone::getDistantDomainNumber() const { return _distantDomainNumber; } -int CONNECTZONE::getLocalDomainNumber() const + +int ConnectZone::getLocalDomainNumber() const { return _localDomainNumber; } -ParaMEDMEM::MEDCouplingUMesh* CONNECTZONE::getLocalMesh() const +ParaMEDMEM::MEDCouplingUMesh* ConnectZone::getLocalMesh() const { return _localMesh; } -ParaMEDMEM::MEDCouplingUMesh * CONNECTZONE::getDistantMesh() const +ParaMEDMEM::MEDCouplingUMesh * ConnectZone::getDistantMesh() const { return _distantMesh; } -bool CONNECTZONE::isEntityCorrespPresent(int localEntity, +bool ConnectZone::isEntityCorrespPresent(int localEntity, int distantEntity) const { - typedef std::map, MEDPARTITIONER::MEDSKYLINEARRAY*>::const_iterator map_iter; - + typedef std::map, MEDPARTITIONER::SkyLineArray*>::const_iterator map_iter; + for (map_iter iter=_entityCorresp.begin(); iter != _entityCorresp.end(); iter++) { if ((iter->first).first==localEntity && (iter->first).second==distantEntity) return true; } return false; -} +} -const int * CONNECTZONE::getNodeCorrespIndex() const +const int * ConnectZone::getNodeCorrespIndex() const { return _nodeCorresp->getIndex(); } -const int * CONNECTZONE::getNodeCorrespValue() const +const int * ConnectZone::getNodeCorrespValue() const { return _nodeCorresp->getValue(); } -int CONNECTZONE::getNodeNumber() const + +int ConnectZone::getNodeNumber() const { return _nodeCorresp->getNumberOf(); } -const int * CONNECTZONE::getFaceCorrespIndex() const + +const int * ConnectZone::getFaceCorrespIndex() const { return _faceCorresp->getIndex(); } -const int * CONNECTZONE::getFaceCorrespValue() const +const int * ConnectZone::getFaceCorrespValue() const { return _faceCorresp->getValue(); } -int CONNECTZONE::getFaceNumber() const + +int ConnectZone::getFaceNumber() const { return _faceCorresp->getNumberOf(); } -const int * CONNECTZONE::getEntityCorrespIndex(int localEntity, + +const int * ConnectZone::getEntityCorrespIndex(int localEntity, int distantEntity) const { - typedef std::map, MEDPARTITIONER::MEDSKYLINEARRAY*>::const_iterator map_iter; - + typedef std::map, MEDPARTITIONER::SkyLineArray*>::const_iterator map_iter; + for (map_iter iter=_entityCorresp.begin(); iter != _entityCorresp.end(); iter++) { if ((iter->first).first==localEntity && (iter->first).second==distantEntity) return iter->second->getIndex(); } - return 0; + return 0; } -const int * CONNECTZONE::getEntityCorrespValue(int localEntity, +const int * ConnectZone::getEntityCorrespValue(int localEntity, int distantEntity) const { - typedef std::map, MEDPARTITIONER::MEDSKYLINEARRAY*>::const_iterator map_iter; - + typedef std::map, MEDPARTITIONER::SkyLineArray*>::const_iterator map_iter; + for (map_iter iter=_entityCorresp.begin(); iter != _entityCorresp.end(); iter++) { if ((iter->first).first==localEntity && (iter->first).second==distantEntity) return iter->second->getValue(); } - return 0; + return 0; } -int CONNECTZONE::getEntityCorrespNumber(int localEntity, +int ConnectZone::getEntityCorrespNumber(int localEntity, int distantEntity) const { - typedef std::map, MEDPARTITIONER::MEDSKYLINEARRAY*>::const_iterator map_iter; - + typedef std::map, MEDPARTITIONER::SkyLineArray*>::const_iterator map_iter; + for (map_iter iter=_entityCorresp.begin(); iter != _entityCorresp.end(); iter++) { if ((iter->first).first==localEntity && (iter->first).second==distantEntity) return iter->second->getNumberOf(); } - return 0; + return 0; } - -int CONNECTZONE::getEntityCorrespLength(int localEntity, +int ConnectZone::getEntityCorrespLength(int localEntity, int distantEntity) const { - typedef std::map, MEDPARTITIONER::MEDSKYLINEARRAY*>::const_iterator map_iter; + typedef std::map, MEDPARTITIONER::SkyLineArray*>::const_iterator map_iter; for (map_iter iter=_entityCorresp.begin(); iter != _entityCorresp.end(); iter++) { if ((iter->first).first==localEntity && (iter->first).second==distantEntity) return iter->second->getLength(); } - return 0; + return 0; } -void CONNECTZONE::setName(std::string name) +void ConnectZone::setName(std::string name) { _name=name; } -void CONNECTZONE::setDescription(std::string description) + +void ConnectZone::setDescription(std::string description) { _description=description; } -void CONNECTZONE::setDistantDomainNumber(int distantDomainNumber) + +void ConnectZone::setDistantDomainNumber(int distantDomainNumber) { _distantDomainNumber=distantDomainNumber; } -void CONNECTZONE::setLocalDomainNumber(int localDomainNumber) + +void ConnectZone::setLocalDomainNumber(int localDomainNumber) { _localDomainNumber=localDomainNumber; } -void CONNECTZONE::setLocalMesh(ParaMEDMEM::MEDCouplingUMesh * localMesh) + +void ConnectZone::setLocalMesh(ParaMEDMEM::MEDCouplingUMesh * localMesh) { _localMesh=localMesh; } -void CONNECTZONE::setDistantMesh(ParaMEDMEM::MEDCouplingUMesh * distantMesh) +void ConnectZone::setDistantMesh(ParaMEDMEM::MEDCouplingUMesh * distantMesh) { _distantMesh=distantMesh; } /*! transforms an int array containing * the node-node connections - * to a MEDSKYLINEARRAY + * to a SkyLineArray */ -void CONNECTZONE::setNodeCorresp(int * nodeCorresp, int nbnode) +void ConnectZone::setNodeCorresp(int * nodeCorresp, int nbnode) { std::vector index(nbnode+1),value(2*nbnode); for (int i=0; i index(nbface+1),value(2*nbface); for (int i=0; i #include -namespace MEDPARTITIONER { -class MEDPARTITIONER_EXPORT CONNECTZONE +namespace MEDPARTITIONER { -private : - std::string _name; - std::string _description; - int _localDomainNumber; - int _distantDomainNumber; + class MEDPARTITIONER_EXPORT ConnectZone + { + private : + std::string _name; + std::string _description; + int _localDomainNumber; + int _distantDomainNumber; - ParaMEDMEM::MEDCouplingUMesh * _localMesh; - ParaMEDMEM::MEDCouplingUMesh * _distantMesh; + ParaMEDMEM::MEDCouplingUMesh * _localMesh; + ParaMEDMEM::MEDCouplingUMesh * _distantMesh; - MEDPARTITIONER::MEDSKYLINEARRAY * _nodeCorresp; - MEDPARTITIONER::MEDSKYLINEARRAY * _faceCorresp; + MEDPARTITIONER::SkyLineArray * _nodeCorresp; + MEDPARTITIONER::SkyLineArray * _faceCorresp; - std::map < std::pair , MEDPARTITIONER::MEDSKYLINEARRAY * > _entityCorresp; + std::map < std::pair , MEDPARTITIONER::SkyLineArray * > _entityCorresp; -public : - CONNECTZONE(); - ~CONNECTZONE(); - CONNECTZONE(const CONNECTZONE & myConnectZone); + public : + ConnectZone(); + ~ConnectZone(); + ConnectZone(const ConnectZone & myConnectZone); - std::string getName() const ; - std::string getDescription() const ; - int getDistantDomainNumber() const ; - int getLocalDomainNumber() const ; - ParaMEDMEM::MEDCouplingUMesh * getLocalMesh() const ; - ParaMEDMEM::MEDCouplingUMesh * getDistantMesh() const ; + std::string getName() const ; + std::string getDescription() const ; + int getDistantDomainNumber() const ; + int getLocalDomainNumber() const ; + ParaMEDMEM::MEDCouplingUMesh * getLocalMesh() const ; + ParaMEDMEM::MEDCouplingUMesh * getDistantMesh() const ; - bool isEntityCorrespPresent(int localEntity,int distantEntity) const; - const int * getNodeCorrespIndex() const; - const int * getNodeCorrespValue() const; - int getNodeNumber() const; - const int * getFaceCorrespIndex() const; - const int * getFaceCorrespValue() const; - int getFaceNumber() const; - const int * getEntityCorrespIndex(int localEntity, - int distantEntity) const; - const int * getEntityCorrespValue(int localEntity, - int distantEntity) const; - int getEntityCorrespNumber(int localEntity, - int distantEntity) const; - int getEntityCorrespLength(int localEntity, - int distantEntity) const; - void setName(std::string name) ; - void setDescription(std::string description) ; - void setDistantDomainNumber(int distantDomainNumber) ; - void setLocalDomainNumber(int distantDomainNumber) ; - void setLocalMesh(ParaMEDMEM::MEDCouplingUMesh * localMesh) ; - void setDistantMesh(ParaMEDMEM::MEDCouplingUMesh * distantMesh) ; + bool isEntityCorrespPresent(int localEntity,int distantEntity) const; + const int * getNodeCorrespIndex() const; + const int * getNodeCorrespValue() const; + int getNodeNumber() const; + const int * getFaceCorrespIndex() const; + const int * getFaceCorrespValue() const; + int getFaceNumber() const; + const int * getEntityCorrespIndex(int localEntity, + int distantEntity) const; + const int * getEntityCorrespValue(int localEntity, + int distantEntity) const; + int getEntityCorrespNumber(int localEntity, + int distantEntity) const; + int getEntityCorrespLength(int localEntity, + int distantEntity) const; + void setName(std::string name) ; + void setDescription(std::string description) ; + void setDistantDomainNumber(int distantDomainNumber) ; + void setLocalDomainNumber(int distantDomainNumber) ; + void setLocalMesh(ParaMEDMEM::MEDCouplingUMesh * localMesh) ; + void setDistantMesh(ParaMEDMEM::MEDCouplingUMesh * distantMesh) ; - void setNodeCorresp(int * nodeCorresp, int nbnode); - void setNodeCorresp(MEDPARTITIONER::MEDSKYLINEARRAY* array); - void setFaceCorresp(int * faceCorresp, int nbface); - void setFaceCorresp(MEDPARTITIONER::MEDSKYLINEARRAY* array); - void setEntityCorresp(int localEntity, - int distantEntity, - int * entityCorresp, int nbentity); - void setEntityCorresp(int localEntity, - int distantEntity, - MEDPARTITIONER::MEDSKYLINEARRAY* array); -}; + void setNodeCorresp(int * nodeCorresp, int nbnode); + void setNodeCorresp(MEDPARTITIONER::SkyLineArray* array); + void setFaceCorresp(int * faceCorresp, int nbface); + void setFaceCorresp(MEDPARTITIONER::SkyLineArray* array); + void setEntityCorresp(int localEntity, + int distantEntity, + int * entityCorresp, int nbentity); + void setEntityCorresp(int localEntity, + int distantEntity, + MEDPARTITIONER::SkyLineArray* array); + }; } # endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx index 66fd5497d..b94e531b2 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx @@ -1,27 +1,27 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "MEDPARTITIONER_Graph.hxx" using namespace MEDPARTITIONER; -Graph::Graph(MEDPARTITIONER::MEDSKYLINEARRAY* array, int* edgeweight):_graph(array),_partition(0),_edgeweight(edgeweight),_cellweight(0) +Graph::Graph(MEDPARTITIONER::SkyLineArray* array, int* edgeweight):_graph(array),_partition(0),_edgeweight(edgeweight),_cellweight(0) { } @@ -34,14 +34,14 @@ Graph::Graph(MEDPARTITIONER::MEDSKYLINEARRAY* array, int* edgeweight):_graph(arr Graph::~Graph() { if (_partition) - { - delete _partition; - _partition=0; - } + { + delete _partition; + _partition=0; + } if (_graph) - { - delete _graph; - _graph=0; - } + { + delete _graph; + _graph=0; + } } diff --git a/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx b/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx index a1967a176..2aa4f81fd 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx @@ -1,67 +1,64 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#ifndef MEDPARTITIONER_GRAPH_HXX_ -#define MEDPARTITIONER_GRAPH_HXX_ +#ifndef __MEDPARTITIONER_GRAPH_HXX__ +#define __MEDPARTITIONER_GRAPH_HXX__ #include "MEDPARTITIONER.hxx" #include "MEDPARTITIONER_SkyLineArray.hxx" + #include -namespace MEDPARTITIONER { - -class ParaDomainSelector; -class MEDPARTITIONER_EXPORT Graph + +namespace MEDPARTITIONER { + class ParaDomainSelector; + class MEDPARTITIONER_EXPORT Graph + { public: typedef enum {METIS,SCOTCH} splitter_type; - Graph(){}; - + Graph() + { + } //creates a graph from a SKYLINEARRAY - Graph(MEDPARTITIONER::MEDSKYLINEARRAY* graph, int* edgeweight=0); - + Graph(MEDPARTITIONER::SkyLineArray* graph, int* edgeweight=0); virtual ~Graph(); void setEdgesWeights(int* edgeweight){_edgeweight=edgeweight;} void setVerticesWeights(int* cellweight){_cellweight=cellweight;} - + //computes partitioning of the graph - virtual void partGraph(int ndomain, const std::string&, ParaDomainSelector* sel=0)=0; - - //! returns the partitioning + virtual void partGraph(int ndomain, const std::string&, ParaDomainSelector* sel=0) = 0; + + //returns the partitioning const int* getPart() const {return _partition->getValue();} - - //! returns the number of graph vertices (which can correspond to the cells in the mesh!) + + //returns the number of graph vertices (which can correspond to the cells in the mesh!) int nbVertices() const {return _graph->getNumberOf();} - - const MEDPARTITIONER::MEDSKYLINEARRAY* getGraph() const {return _graph;} + + const MEDPARTITIONER::SkyLineArray* getGraph() const {return _graph;} protected: - - MEDPARTITIONER::MEDSKYLINEARRAY* _graph; - - MEDPARTITIONER::MEDSKYLINEARRAY* _partition; - + MEDPARTITIONER::SkyLineArray* _graph; + MEDPARTITIONER::SkyLineArray* _partition; int* _edgeweight; - int* _cellweight; }; - } -#endif /*GRAPH_HXX_*/ +#endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx b/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx index 348764b84..79a222461 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx @@ -1,23 +1,45 @@ +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + #include "MEDPARTITIONER_JointFinder.hxx" -#include "MEDPARTITIONER_MESHCollection.hxx" +#include "MEDPARTITIONER_MeshCollection.hxx" #include "MEDPARTITIONER_Topology.hxx" #include "MEDPARTITIONER_ParaDomainSelector.hxx" +#include "MEDPARTITIONER_Utils.hxx" + #include "MEDCouplingUMesh.hxx" -#include "MEDPARTITIONER_utils.hxx" #include "BBTree.txx" +using namespace std; +using namespace ParaMEDMEM; +using namespace MEDPARTITIONER; /*! Method contributing to the distant cell graph */ -using namespace MEDPARTITIONER; -JointFinder::JointFinder(const MESHCollection& mc):_mesh_collection(mc), _topology(mc.getTopology()),_domain_selector(mc.getParaDomainSelector()) +JointFinder::JointFinder(const MeshCollection& mc):_mesh_collection(mc), _topology(mc.getTopology()),_domain_selector(mc.getParaDomainSelector()) { } JointFinder::~JointFinder() { - //if (MyGlobals::_is0verbose>100) cout<<"TODO ~JointFinder"<100) cout<<"TODO ~JointFinder"<nbProcs(); std::vector* > bbtree(nbdomain,(BBTree<3>*) 0); std::vector rev(nbdomain,(DataArrayInt*) 0); @@ -39,111 +61,111 @@ void JointFinder::findCommonDistantNodes() //init rev and revIndx and bbtree for my domain (of me:proc n) for (int mydomain=0; mydomainisMyDomain(mydomain)) continue; - const ParaMEDMEM::MEDCouplingUMesh* myMesh=_mesh_collection.getMesh(mydomain); - meshDim=myMesh->getMeshDimension(); - spaceDim= myMesh->getSpaceDimension(); - rev[mydomain] = ParaMEDMEM::DataArrayInt::New(); - revIndx[mydomain] = ParaMEDMEM::DataArrayInt::New(); - myMesh->getReverseNodalConnectivity(rev[mydomain],revIndx[mydomain]); - double* bbx=new double[2*spaceDim*myMesh->getNumberOfNodes()]; - for (int i=0; igetNumberOfNodes()*spaceDim; i++) { - const double* coords=myMesh->getCoords()->getConstPointer(); - bbx[2*i]=(coords[i])-1e-12; - bbx[2*i+1]=bbx[2*i]+2e-12; + if(!_domain_selector->isMyDomain(mydomain)) continue; + const ParaMEDMEM::MEDCouplingUMesh* myMesh=_mesh_collection.getMesh(mydomain); + meshDim=myMesh->getMeshDimension(); + spaceDim= myMesh->getSpaceDimension(); + rev[mydomain] = ParaMEDMEM::DataArrayInt::New(); + revIndx[mydomain] = ParaMEDMEM::DataArrayInt::New(); + myMesh->getReverseNodalConnectivity(rev[mydomain],revIndx[mydomain]); + double* bbx=new double[2*spaceDim*myMesh->getNumberOfNodes()]; + for (int i=0; igetNumberOfNodes()*spaceDim; i++) + { + const double* coords=myMesh->getCoords()->getConstPointer(); + bbx[2*i]=(coords[i])-1e-12; + bbx[2*i+1]=bbx[2*i]+2e-12; + } + bbtree[mydomain]=new BBTree<3> (bbx,0,0,myMesh->getNumberOfNodes(),-1e-12); + delete[] bbx; } - bbtree[mydomain]=new BBTree<3> (bbx,0,0,myMesh->getNumberOfNodes(),-1e-12); - delete[] bbx; - } //send my domains to other proc an receive other domains from other proc for (int isource=0; isourceisMyDomain(isource)&&_domain_selector->isMyDomain(itarget)) continue; - if (_domain_selector->isMyDomain(isource)) - { - //preparing data for treatment on target proc - int targetProc = _domain_selector->getProcessorID(itarget); + for (int itarget=0; itargetisMyDomain(isource)&&_domain_selector->isMyDomain(itarget)) continue; + if (_domain_selector->isMyDomain(isource)) + { + //preparing data for treatment on target proc + int targetProc = _domain_selector->getProcessorID(itarget); - std::vector vec(spaceDim*sourceMesh->getNumberOfNodes()); - //cvw cout<<"\nproc "<<_domain_selector->rank()<<" : numberOfNodes "<getNumberOfNodes()<getCoords()->getConstPointer(),sourceMesh->getCoords()->getConstPointer()+sourceMesh->getNumberOfNodes()*spaceDim,&vec[0]); - sendDoubleVec(vec,targetProc); + std::vector vec(spaceDim*sourceMesh->getNumberOfNodes()); + //cvw cout<<"\nproc "<<_domain_selector->rank()<<" : numberOfNodes "<getNumberOfNodes()<getCoords()->getConstPointer(),sourceMesh->getCoords()->getConstPointer()+sourceMesh->getNumberOfNodes()*spaceDim,&vec[0]); + SendDoubleVec(vec,targetProc); - //retrieving target data for storage in commonDistantNodes array - std::vector localCorrespondency; - recvIntVec(localCorrespondency, targetProc); - //cvw cout<<"\nproc "<<_domain_selector->rank()<<" : nodeCellCorrespondency "; - for (int i=0; i localCorrespondency; + RecvIntVec(localCorrespondency, targetProc); + //cvw cout<<"\nproc "<<_domain_selector->rank()<<" : nodeCellCorrespondency "; + for (int i=0; iisMyDomain(itarget)) - { - //receiving data from source proc - int sourceProc = isource%nbproc; - std::vector recvVec; - recvDoubleVec(recvVec,sourceProc); - std::map commonNodes; // (local nodes, distant nodes) list - //cvw cout<<"\nproc "<<_domain_selector->rank()<<" : commonNodes "; - for (int inode=0; inode<(recvVec.size()/meshDim); inode++) - { - double* bbox=new double[2*spaceDim]; - for (int i=0; i inodes; - bbtree[itarget]->getIntersectingElems(bbox,inodes); - delete[] bbox; + } + if (_domain_selector->isMyDomain(itarget)) + { + //receiving data from source proc + int sourceProc = isource%nbproc; + std::vector recvVec; + RecvDoubleVec(recvVec,sourceProc); + std::map commonNodes; // (local nodes, distant nodes) list + //cvw cout<<"\nproc "<<_domain_selector->rank()<<" : commonNodes "; + for (int inode=0; inode<(recvVec.size()/meshDim); inode++) + { + double* bbox=new double[2*spaceDim]; + for (int i=0; i inodes; + bbtree[itarget]->getIntersectingElems(bbox,inodes); + delete[] bbox; - if (inodes.size()>0) - { - commonNodes.insert(std::make_pair(inodes[0],inode)); - //cvw cout<<" "<0) + { + commonNodes.insert(std::make_pair(inodes[0],inode)); + //cvw cout<<" "< nodeCellCorrespondency; + for (std::map::iterator iter=commonNodes.begin(); iter!=commonNodes.end(); iter++) + { + _node_node[itarget][isource].push_back(std::make_pair(iter->first, iter->second));//storing node pairs in a vector + const int* revIndxPtr=revIndx[itarget]->getConstPointer(); + const int* revPtr=rev[itarget]->getConstPointer(); + for (int icell=revIndxPtr[iter->first]; icellfirst+1]; icell++) + { + nodeCellCorrespondency.push_back(iter->second); // + int globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]); + nodeCellCorrespondency.push_back(globalCell); + //nodeCellCorrespondency.push_back(revPtr[icell]); //need to set at global numerotation + //cout<<"processor "<second<<" cellLoc "<rank()<<" : JointFinder SendIntVec "<<_domain_selector->rank()< nodeCellCorrespondency; - for (std::map::iterator iter=commonNodes.begin(); iter!=commonNodes.end(); iter++) - { - _node_node[itarget][isource].push_back(std::make_pair(iter->first, iter->second));//storing node pairs in a vector - const int* revIndxPtr=revIndx[itarget]->getConstPointer(); - const int* revPtr=rev[itarget]->getConstPointer(); - for (int icell=revIndxPtr[iter->first]; icellfirst+1]; icell++) - { - nodeCellCorrespondency.push_back(iter->second); // - int globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]); - nodeCellCorrespondency.push_back(globalCell); - //nodeCellCorrespondency.push_back(revPtr[icell]); //need to set at global numerotation - //cout<<"processor "<second<<" cellLoc "<rank()<<" : JointFinder sendIntVec "<<_domain_selector->rank()<decrRef(); if (revIndx[i]!=0) revIndx[i]->decrRef(); if (bbtree[i]!=0) delete bbtree[i]; } - if (MyGlobals::_verbose>100) - std::cout<<"proc "<<_domain_selector->rank()<<" : end JointFinder::findCommonDistantNodes"<100) + std::cout<<"proc "<<_domain_selector->rank()<<" : end JointFinder::findCommonDistantNodes"< > > & JointFinder::getDistantNodeCell() @@ -159,36 +181,36 @@ std::vector > > >& JointFinder::getNo void JointFinder::print() //it is for debug on small arrays under mpi 2,3 cpus { - int nbdomain=_topology->nbDomain(); - //MPI_Barrier(MPI_COMM_WORLD); - if (MyGlobals::_is0verbose>0) - cout<<"\nJointFinder print node-node (nn)iproc|itarget|isource|i|inodefirst-inodesecond\n\n"<< - "JointFinder print distantNode=cell (nc)iproc|itarget|isource|inode=icell\n\n"; - for (int isource=0; isourcerank()<nbDomain(); + //MPI_Barrier(MPI_COMM_WORLD); + if (MyGlobals::_Is0verbose>0) + cout<<"\nJointFinder print node-node (nn)iproc|itarget|isource|i|inodefirst-inodesecond\n\n"<< + "JointFinder print distantNode=cell (nc)iproc|itarget|isource|inode=icell\n\n"; + for (int isource=0; isourcerank()<rank()<<" : JointFinder _distant_node_cell itarget/isource/inode=icell"<::iterator it; - for (it=_distant_node_cell[isource][itarget].begin() ; it!=_distant_node_cell[isource][itarget].end(); it++) - { - cout<<" nc"<<_domain_selector->rank()<<"|"<rank()<<" : JointFinder _distant_node_cell itarget/isource/inode=icell"<::iterator it; + for (it=_distant_node_cell[isource][itarget].begin() ; it!=_distant_node_cell[isource][itarget].end(); it++) + { + cout<<" nc"<<_domain_selector->rank()<<"|"< +#include #include + namespace MEDPARTITIONER { - class MESHCollection; + class MeshCollection; class ParaDomainSelector; class Topology; -class JointFinder -{ -public: - JointFinder(const MESHCollection& mc); - ~JointFinder(); - void findCommonDistantNodes(); - void print(); - std::vector > >& getDistantNodeCell(); - std::vector > > >& getNodeNode(); - std::vector > > _distant_node_cell; -private: - const MESHCollection& _mesh_collection; - const ParaDomainSelector* _domain_selector; - const Topology* _topology; - //std::vector > > _distant_node_cell; - std::vector > > > _node_node; -}; -}; + class JointFinder + { + public: + JointFinder(const MeshCollection& mc); + ~JointFinder(); + void findCommonDistantNodes(); + void print(); + std::vector > >& getDistantNodeCell(); + std::vector > > >& getNodeNode(); + + std::vector > > _distant_node_cell; + private: + const MeshCollection& _mesh_collection; + const ParaDomainSelector* _domain_selector; + const Topology* _topology; + std::vector > > > _node_node; + }; +} #endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx index 199d545e2..0ba2eb254 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx @@ -1,29 +1,27 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File : MEDSPLITTER_ParaDomainSelector.cxx -// Created : Wed Jun 24 12:39:59 2009 -// Author : Edward AGAPOV (eap) -#include "MEDCouplingUMesh.hxx" #include "MEDPARTITIONER_ParaDomainSelector.hxx" #include "MEDPARTITIONER_UserGraph.hxx" -#include "MEDPARTITIONER_utils.hxx" +#include "MEDPARTITIONER_Utils.hxx" + +#include "MEDCouplingUMesh.hxx" #include #include @@ -36,16 +34,12 @@ #include #endif -//using namespace MED_EN; using namespace std; using namespace MEDPARTITIONER; -//================================================================================ /*! * \brief Constructor. Find out my rank and world size */ -//================================================================================ - ParaDomainSelector::ParaDomainSelector(bool mesure_memory) :_rank(0),_world_size(1), _nb_result_domains(-1), _mesure_memory(mesure_memory), _init_time(0.0), _init_memory(0), _max_memory(0) @@ -58,22 +52,13 @@ ParaDomainSelector::ParaDomainSelector(bool mesure_memory) evaluateMemory(); } -//================================================================================ -/*! - * \brief Destructor - */ -//================================================================================ - ParaDomainSelector::~ParaDomainSelector() { } -//================================================================================ /*! * \brief Return true if is running on different hosts */ -//================================================================================ - bool ParaDomainSelector::isOnDifferentHosts() const { evaluateMemory(); @@ -97,8 +82,8 @@ bool ParaDomainSelector::isOnDifferentHosts() const //bug: (isOnDifferentHosts here and there) is not (isOnDifferentHosts somewhere) //return string(name_here) != string(name_there); - int sum_same=-1; - int same=1; + int sum_same = -1; + int same = 1; if (string(name_here) != string(name_there)) same=0; MPI_Allreduce( &same, &sum_same, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); //cout<<"proc "<& domain_meshes) { evaluateMemory(); // get nb of elems of each domain mesh int nb_domains=domain_meshes.size(); - //cout<<"proc "< nb_elems(nb_domains*2, 0); //NumberOfCells & NumberOfNodes for (int i=0; igetNumberOfCells(); - nb_elems[i*2+1] = domain_meshes[i]->getNumberOfNodes(); - } + { + nb_elems[i*2] = domain_meshes[i]->getNumberOfCells(); + nb_elems[i*2+1] = domain_meshes[i]->getNumberOfNodes(); + } // receive nb of elems from other procs vector all_nb_elems( nb_domains*2 ); #ifdef HAVE_MPI2 @@ -166,12 +142,12 @@ void ParaDomainSelector::gatherNbOf(const vector& #endif int total_nb_cells=0, total_nb_nodes=0; for (int i=0; i10) + if (MyGlobals::_Is0verbose>10) cout<<"totalNbCells "<& cell_shift_by_domain=_cell_shift_by_domain; @@ -184,54 +160,53 @@ void ParaDomainSelector::gatherNbOf(const vector& for (int iproc=0; iproc300) - { - cout<<"proc "<300) + { + cout<<"proc "<200) - { - cout<<"proc "<200) + { + cout<<"proc "<& * The result array is to be used as the first arg of ParMETIS_V3_PartKway() and * is freed by ParaDomainSelector. */ -//================================================================================ - int* ParaDomainSelector::getProcVtxdist() const { evaluateMemory(); if (_nb_vert_of_procs.empty()) throw INTERP_KERNEL::Exception(LOCALIZED("_nb_vert_of_procs not set")); return (int*) & _nb_vert_of_procs[0]; } -//================================================================================ + /*! * \brief Return nb of cells in domains with lower index. * * gatherNbOf() must be called before. * Result added to local id on given domain gives id in the whole distributed mesh */ -//================================================================================ - int ParaDomainSelector::getDomainCellShift(int domainIndex) const { evaluateMemory(); @@ -271,15 +242,12 @@ int ParaDomainSelector::getDomainNodeShift(int domainIndex) const return _node_shift_by_domain[domainIndex]; } -//================================================================================ /*! * \brief Return nb of nodes on processors with lower rank. * * gatherNbOf() must be called before. * Result added to global id on this processor gives id in the whole distributed mesh */ -//================================================================================ - int ParaDomainSelector::getProcNodeShift() const { evaluateMemory(); @@ -288,12 +256,9 @@ int ParaDomainSelector::getProcNodeShift() const return _nb_vert_of_procs[_rank]; } -//================================================================================ /*! * \brief Gather graphs from all processors into one */ -//================================================================================ - auto_ptr ParaDomainSelector::gatherGraph(const Graph* graph) const { Graph* glob_graph = 0; @@ -327,21 +292,21 @@ auto_ptr ParaDomainSelector::gatherGraph(const Graph* graph) const // get sizes of graph values on each proc by the got indices of graphs vector< int > value_size_of_proc( nbProcs() ), proc_value_displacement(1,0); for ( int i = 0; i < nbProcs(); ++i ) - { - if ( index_size_of_proc[i] > 0 ) - value_size_of_proc[i] = graph_index[ proc_index_displacement[ i+1 ]-1 ] - graph_index[0]; - else - value_size_of_proc[i] = 0; - proc_value_displacement.push_back( proc_value_displacement.back() + value_size_of_proc[i] ); - } + { + if ( index_size_of_proc[i] > 0 ) + value_size_of_proc[i] = graph_index[ proc_index_displacement[ i+1 ]-1 ] - graph_index[0]; + else + value_size_of_proc[i] = 0; + proc_value_displacement.push_back( proc_value_displacement.back() + value_size_of_proc[i] ); + } // update graph_index for ( int i = 1; i < nbProcs(); ++i ) - { - int shift = graph_index[ proc_index_displacement[i]-1 ]-graph_index[0]; - for ( int j = proc_index_displacement[i]; j < proc_index_displacement[i+1]; ++j ) - graph_index[ j ] += shift; - } + { + int shift = graph_index[ proc_index_displacement[i]-1 ]-graph_index[0]; + for ( int j = proc_index_displacement[i]; j < proc_index_displacement[i+1]; ++j ) + graph_index[ j ] += shift; + } // -------------- // Gather values @@ -380,10 +345,10 @@ auto_ptr ParaDomainSelector::gatherGraph(const Graph* graph) const // Make graph // ----------- -// MEDPARTITIONER::MEDSKYLINEARRAY* array = -// new MEDPARTITIONER::MEDSKYLINEARRAY( index_size-1, value_size, graph_index, graph_value, true ); + // MEDPARTITIONER::SkyLineArray* array = + // new MEDPARTITIONER::SkyLineArray( index_size-1, value_size, graph_index, graph_value, true ); -// glob_graph = new UserGraph( array, partition, index_size-1 ); + // glob_graph = new UserGraph( array, partition, index_size-1 ); evaluateMemory(); @@ -395,24 +360,21 @@ auto_ptr ParaDomainSelector::gatherGraph(const Graph* graph) const } -//================================================================================ /*! * \brief Set nb of cell/cell pairs in a joint between domains */ -//================================================================================ - void ParaDomainSelector::setNbCellPairs( int nb_cell_pairs, int dist_domain, int loc_domain ) { // This method is needed for further computing global numbers of faces in joint. // Store if both domains are on this proc else on one of procs only if ( isMyDomain( dist_domain ) || dist_domain < loc_domain ) - { - if ( _nb_cell_pairs_by_joint.empty() ) - _nb_cell_pairs_by_joint.resize( _nb_result_domains*(_nb_result_domains+1), 0); + { + if ( _nb_cell_pairs_by_joint.empty() ) + _nb_cell_pairs_by_joint.resize( _nb_result_domains*(_nb_result_domains+1), 0); - int joint_id = jointId( loc_domain, dist_domain ); - _nb_cell_pairs_by_joint[ joint_id ] = nb_cell_pairs; - } + int joint_id = jointId( loc_domain, dist_domain ); + _nb_cell_pairs_by_joint[ joint_id ] = nb_cell_pairs; + } evaluateMemory(); } @@ -536,61 +498,58 @@ double ParaDomainSelector::getPassedTime() const #endif } -//================================================================================ /*! * \brief Evaluate current memory usage and return the maximal one in KB */ -//================================================================================ - int ParaDomainSelector::evaluateMemory() const { if ( _mesure_memory ) - { - int used_memory = 0; + { + int used_memory = 0; #ifndef WIN32 - struct sysinfo si; - int err = sysinfo( &si ); - if ( !err ) - used_memory = - (( si.totalram - si.freeram + si.totalswap - si.freeswap ) * si.mem_unit ) / 1024; + struct sysinfo si; + int err = sysinfo( &si ); + if ( !err ) + used_memory = + (( si.totalram - si.freeram + si.totalswap - si.freeswap ) * si.mem_unit ) / 1024; #endif - if ( used_memory > _max_memory ) - ((ParaDomainSelector*) this)->_max_memory = used_memory; + if ( used_memory > _max_memory ) + ((ParaDomainSelector*) this)->_max_memory = used_memory; - if ( !_init_memory ) - ((ParaDomainSelector*) this)->_init_memory = used_memory; - } + if ( !_init_memory ) + ((ParaDomainSelector*) this)->_init_memory = used_memory; + } return _max_memory - _init_memory; } /*! -Sends content of \a mesh to processor \a target. To be used with \a recvMesh method. -\param mesh mesh to be sent -\param target processor id of the target + Sends content of \a mesh to processor \a target. To be used with \a recvMesh method. + \param mesh mesh to be sent + \param target processor id of the target */ void ParaDomainSelector::sendMesh(const ParaMEDMEM::MEDCouplingUMesh& mesh, int target) const { - if (MyGlobals::_verbose>600) cout<<"proc "<<_rank<<" : sendMesh '"< tinyInfoLocal; - vector tinyInfoLocalS; - vector tinyInfoLocalD; - //Getting tiny info of local mesh to allow the distant proc to initialize and allocate - //the transmitted mesh. - mesh.getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS); - //cout<<"sendMesh getTinySerializationInformation "<600) cout<<"proc "<<_rank<<" : sendMesh '"< tinyInfoLocal; + vector tinyInfoLocalS; + vector tinyInfoLocalD; + //Getting tiny info of local mesh to allow the distant proc to initialize and allocate + //the transmitted mesh. + mesh.getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS); + //cout<<"sendMesh getTinySerializationInformation "<0) //no sends if empty + if (mesh.getNumberOfCells()>0) //no sends if empty { ParaMEDMEM::DataArrayInt *v1Local=0; ParaMEDMEM::DataArrayDouble *v2Local=0; @@ -599,69 +558,69 @@ void ParaDomainSelector::sendMesh(const ParaMEDMEM::MEDCouplingUMesh& mesh, int int nbLocalElems=0; int* ptLocal=0; if(v1Local) //cvw if empty getNbOfElems() is 1! - { - nbLocalElems=v1Local->getNbOfElems(); //cvw if empty be 1! - ptLocal=v1Local->getPointer(); - } + { + nbLocalElems=v1Local->getNbOfElems(); //cvw if empty be 1! + ptLocal=v1Local->getPointer(); + } #ifdef HAVE_MPI2 MPI_Send(ptLocal, nbLocalElems, MPI_INT, target, 1111, MPI_COMM_WORLD); #endif int nbLocalElems2=0; double *ptLocal2=0; if(v2Local) //cvw if empty be 0! - { - nbLocalElems2=v2Local->getNbOfElems(); - ptLocal2=v2Local->getPointer(); - } + { + nbLocalElems2=v2Local->getNbOfElems(); + ptLocal2=v2Local->getPointer(); + } #ifdef HAVE_MPI2 MPI_Send(ptLocal2, nbLocalElems2, MPI_DOUBLE, target, 1110, MPI_COMM_WORLD); #endif if(v1Local) v1Local->decrRef(); if(v2Local) v2Local->decrRef(); } - else + else { //cout<<"sendMesh empty Mesh cvw3344 "< tinyInfoDistant; - vector tinyInfoLocalS; - vector tinyInfoDistantD(1); - //Getting tiny info of local mesh to allow the distant proc to initialize and allocate - //the transmitted mesh. + // First stage : exchanging sizes + // ------------------------------ + vector tinyInfoDistant; + vector tinyInfoLocalS; + vector tinyInfoDistantD(1); + //Getting tiny info of local mesh to allow the distant proc to initialize and allocate + //the transmitted mesh. #ifdef HAVE_MPI2 - MPI_Status status; - int tinyVecSize; - MPI_Recv(&tinyVecSize, 1, MPI_INT, source, 1113, MPI_COMM_WORLD, &status); - tinyInfoDistant.resize(tinyVecSize); + MPI_Status status; + int tinyVecSize; + MPI_Recv(&tinyVecSize, 1, MPI_INT, source, 1113, MPI_COMM_WORLD, &status); + tinyInfoDistant.resize(tinyVecSize); #endif - std::fill(tinyInfoDistant.begin(),tinyInfoDistant.end(),0); + std::fill(tinyInfoDistant.begin(),tinyInfoDistant.end(),0); #ifdef HAVE_MPI2 - MPI_Recv(&tinyInfoDistant[0], tinyVecSize, MPI_INT,source,1112,MPI_COMM_WORLD, &status); + MPI_Recv(&tinyInfoDistant[0], tinyVecSize, MPI_INT,source,1112,MPI_COMM_WORLD, &status); #endif - //there was tinyInfoLocal.push_back(mesh.getNumberOfCells()); - int NumberOfCells=tinyInfoDistant[tinyVecSize-1]; - //cout<<"recvMesh NumberOfCells "<0) + //there was tinyInfoLocal.push_back(mesh.getNumberOfCells()); + int NumberOfCells=tinyInfoDistant[tinyVecSize-1]; + //cout<<"recvMesh NumberOfCells "<0) { ParaMEDMEM::DataArrayInt *v1Distant=ParaMEDMEM::DataArrayInt::New(); ParaMEDMEM::DataArrayDouble *v2Distant=ParaMEDMEM::DataArrayDouble::New(); //Building the right instance of copy of distant mesh. ParaMEDMEM::MEDCouplingPointSet *distant_mesh_tmp= ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType( - (ParaMEDMEM::MEDCouplingMeshType) tinyInfoDistant[0]); + (ParaMEDMEM::MEDCouplingMeshType) tinyInfoDistant[0]); std::vector unusedTinyDistantSts; mesh=dynamic_cast (distant_mesh_tmp); @@ -669,20 +628,20 @@ void ParaDomainSelector::recvMesh(ParaMEDMEM::MEDCouplingUMesh*& mesh, int sourc int nbDistElem=0; int *ptDist=0; if(v1Distant) - { - nbDistElem=v1Distant->getNbOfElems(); - ptDist=v1Distant->getPointer(); - } + { + nbDistElem=v1Distant->getNbOfElems(); + ptDist=v1Distant->getPointer(); + } #ifdef HAVE_MPI2 MPI_Recv(ptDist, nbDistElem, MPI_INT, source,1111, MPI_COMM_WORLD, &status); #endif double *ptDist2=0; nbDistElem=0; if(v2Distant) - { - nbDistElem=v2Distant->getNbOfElems(); - ptDist2=v2Distant->getPointer(); - } + { + nbDistElem=v2Distant->getNbOfElems(); + ptDist2=v2Distant->getPointer(); + } #ifdef HAVE_MPI2 MPI_Recv(ptDist2, nbDistElem, MPI_DOUBLE,source, 1110, MPI_COMM_WORLD, &status); #endif @@ -691,10 +650,10 @@ void ParaDomainSelector::recvMesh(ParaMEDMEM::MEDCouplingUMesh*& mesh, int sourc if(v1Distant) v1Distant->decrRef(); if(v2Distant) v2Distant->decrRef(); } - else + else { - mesh=createEmptyMEDCouplingUMesh(); + mesh=CreateEmptyMEDCouplingUMesh(); } - if (MyGlobals::_verbose>600) cout<<"proc "<<_rank<<" : recvMesh '"<getName()<<"' size "<getNumberOfCells()<<" from "<600) cout<<"proc "<<_rank<<" : recvMesh '"<getName()<<"' size "<getNumberOfCells()<<" from "<& domain_meshes); + //Collect nb of entities on procs + void gatherNbOf(const std::vector& domain_meshes); - // Return distribution of the graph vertices among the processors - int* getProcVtxdist() const; - - // Return nb of nodes on processors with lower rank - int getProcNodeShift() const; - // Return nb of cells in domains with lower index - int getDomainCellShift(int domainIndex) const; - // Return nb of nodes in domains with lower index - int getDomainNodeShift(int domainIndex) const; - - // Gather graphs from all processors into one - std::auto_ptr gatherGraph(const Graph* graph) const; - - // Set nb of cell/cell pairs in a joint between domains - void setNbCellPairs( int nb_cell_pairs, int dist_domain, int loc_domain ); - // Gather size of each proc/proc joint - void gatherNbCellPairs(); - // Return nb of cell/cell pairs in a joint between domains on different procs - int getNbCellPairs( int dist_domain, int loc_domain ) const; - - // Send-receive joint data - // void exchangeJoint( JointExchangeData* joint ) const; - - // Return the first global id of sub-entity for the joint - int getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const; - // Send-receive local ids of joint faces - int* exchangeSubentityIds( int loc_domain, int dist_domain, - const std::vector& loc_ids_here ) const; - // Return time passed from construction in seconds - double getPassedTime() const; - - // Evaluate current memory usage and return the maximal one in KB - int evaluateMemory() const; - - void sendMesh(const ParaMEDMEM::MEDCouplingUMesh& mesh, int target) const; - void recvMesh(ParaMEDMEM::MEDCouplingUMesh*& mesh, int source) const; + //distribution of the graph vertices among the processors + int* getProcVtxdist() const; + + //nb of nodes on processors with lower rank + int getProcNodeShift() const; + //nb of cells in domains with lower index + int getDomainCellShift(int domainIndex) const; + //nb of nodes in domains with lower index + int getDomainNodeShift(int domainIndex) const; + + //Gather graphs from all processors into one + std::auto_ptr gatherGraph(const Graph* graph) const; + + //Set nb of cell/cell pairs in a joint between domains + void setNbCellPairs( int nb_cell_pairs, int dist_domain, int loc_domain ); + //Gather size of each proc/proc joint + void gatherNbCellPairs(); + //nb of cell/cell pairs in a joint between domains on different procs + int getNbCellPairs( int dist_domain, int loc_domain ) const; + + //get the first global id of sub-entity for the joint + int getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const; + //Send-receive local ids of joint faces + int* exchangeSubentityIds( int loc_domain, int dist_domain, + const std::vector& loc_ids_here ) const; + //time passed from construction in seconds + double getPassedTime() const; + + //Evaluate current memory usage and return the maximal one in KB + int evaluateMemory() const; + + void sendMesh(const ParaMEDMEM::MEDCouplingUMesh& mesh, int target) const; + void recvMesh(ParaMEDMEM::MEDCouplingUMesh*& mesh, int source) const; -private: - - int _rank, _world_size; // my rank and nb of processors - int _nb_result_domains; // required nb of domains - - //int _total_nb_faces; // nb of faces in the whole mesh without proc/proc joint faces - - std::vector< int > _nb_cell_pairs_by_joint; - std::vector< int > _nb_vert_of_procs; // graph vertices - std::vector< int > _cell_shift_by_domain; - std::vector< int > _node_shift_by_domain; - std::vector< int > _face_shift_by_domain; - - double _init_time; - bool _mesure_memory; - int _init_memory, _max_memory; -}; + private: + int _rank, _world_size; //my rank and nb of processors + int _nb_result_domains; //required nb of domains + + std::vector< int > _nb_cell_pairs_by_joint; + std::vector< int > _nb_vert_of_procs; //graph vertices + std::vector< int > _cell_shift_by_domain; + std::vector< int > _node_shift_by_domain; + std::vector< int > _face_shift_by_domain; + + double _init_time; + bool _mesure_memory; + int _init_memory, _max_memory; + }; } - #endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx b/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx index 42055958f..1c4a67c15 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx @@ -1,35 +1,36 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include -#include -#include -#include -#include "InterpKernelHashMap.hxx" -#include "MEDPARTITIONER_MESHCollection.hxx" +#include "MEDPARTITIONER_MeshCollection.hxx" #include "MEDPARTITIONER_Topology.hxx" #include "MEDPARTITIONER_Graph.hxx" #include "MEDPARTITIONER_ParallelTopology.hxx" #include "MEDPARTITIONER_ConnectZone.hxx" +#include "MEDPARTITIONER_Utils.hxx" #include "MEDCouplingUMesh.hxx" -#include "MEDPARTITIONER_utils.hxx" +#include "InterpKernelHashMap.hxx" + +#include +#include +#include +#include #ifdef HAVE_MPI2 #include @@ -38,11 +39,11 @@ using namespace MEDPARTITIONER; using namespace std; -//empty constructor ParallelTopology::ParallelTopology():_nb_domain(0),_mesh_dimension(0) -{} +{ +} -//!constructing topology according to mesh collection without global numerotation (use setGlobalNumerotation later) +//constructing topology according to mesh collection without global numerotation (use setGlobalNumerotation later) ParallelTopology::ParallelTopology(const vector& meshes) { _nb_domain=meshes.size(); @@ -50,7 +51,7 @@ ParallelTopology::ParallelTopology(const vector& _nb_nodes.resize(_nb_domain); // _nb_faces.resize(_nb_domain); - if (MyGlobals::_is0verbose>100) cout<<"new ParallelTopology\n"; + if (MyGlobals::_Is0verbose>100) cout<<"new ParallelTopology\n"; _loc_to_glob.resize(0); //precaution, need gatherNbOf() setGlobalNumerotation() _node_loc_to_glob.resize(0); //precaution, need gatherNbOf() setGlobalNumerotation() //_face_loc_to_glob.resize(_nb_domain); @@ -59,76 +60,76 @@ ParallelTopology::ParallelTopology(const vector& for (int idomain=0; !parallel_mode && idomain<_nb_domain; idomain++) parallel_mode = (!meshes[idomain]); - if (MyGlobals::_is0verbose>20 && !parallel_mode) cout<<"WARNING : ParallelTopology contructor without parallel_mode"<20 && !parallel_mode) cout<<"WARNING : ParallelTopology contructor without parallel_mode"<getMeshDimension(); - } - else - { - if (_mesh_dimension!=meshes[idomain]->getMeshDimension()) - throw INTERP_KERNEL::Exception(LOCALIZED("meshes dimensions incompatible")); + if ( !meshes[idomain] ) continue; + if (_mesh_dimension==-1) + { + _mesh_dimension = meshes[idomain]->getMeshDimension(); + } + else + { + if (_mesh_dimension!=meshes[idomain]->getMeshDimension()) + throw INTERP_KERNEL::Exception(LOCALIZED("meshes dimensions incompatible")); + } + _nb_cells[idomain]=meshes[idomain]->getNumberOfCells(); + _nb_nodes[idomain]=meshes[idomain]->getNumberOfNodes(); + //note: in parallel mode _nb_cells and _nb_nodes are not complete now, needs gatherNbOf() } - _nb_cells[idomain]=meshes[idomain]->getNumberOfCells(); - _nb_nodes[idomain]=meshes[idomain]->getNumberOfNodes(); - //note: in parallel mode _nb_cells and _nb_nodes are not complete now, needs gatherNbOf() - } } -//!constructing _loc_to_glob etc by default, needs gatherNbOf() done +//constructing _loc_to_glob etc by default, needs gatherNbOf() done void ParallelTopology::setGlobalNumerotationDefault(ParaDomainSelector* domainSelector) { - if (MyGlobals::_is0verbose>100) cout<<"setGlobalNumerotationDefault on "<<_nb_domain<<" domains\n"; + if (MyGlobals::_Is0verbose>100) cout<<"setGlobalNumerotationDefault on "<<_nb_domain<<" domains\n"; if (_loc_to_glob.size()!=0) throw INTERP_KERNEL::Exception(LOCALIZED("a global numerotation is done yet")); _loc_to_glob.resize(_nb_domain); _node_loc_to_glob.resize(_nb_domain); //warning because _nb_cells[idomain] is 0 if not my domain(s) //we set loc_to_glob etc.. only for my domain(s) - if (MyGlobals::_is0verbose>500) cout<<"(c)idomain|ilocalCell|iglobalCell"<500) cout<<"(c)idomain|ilocalCell|iglobalCell"<getDomainCellShift(idomain); - for (int i=0; i<_nb_cells[idomain]; i++) { - int global=domainCellShift+i ; - _glob_to_loc.insert(make_pair(global,make_pair(idomain,i))); - _loc_to_glob[idomain][i]=global; - if (MyGlobals::_verbose>500) cout<<"c"<getDomainCellShift(idomain); + for (int i=0; i<_nb_cells[idomain]; i++) + { + int global=domainCellShift+i ; + _glob_to_loc.insert(make_pair(global,make_pair(idomain,i))); + _loc_to_glob[idomain][i]=global; + if (MyGlobals::_Verbose>500) cout<<"c"<500) MPI_Barrier(MPI_COMM_WORLD); - if (MyGlobals::_is0verbose>500) cout<500) MPI_Barrier(MPI_COMM_WORLD); + if (MyGlobals::_Is0verbose>500) cout<500) cout<<"(n)idomain|ilocalNode|iglobalNode"<500) cout<<"(n)idomain|ilocalNode|iglobalNode"<getDomainNodeShift(idomain); - for (int i=0; i<_nb_nodes[idomain]; i++) { - int global=domainNodeShift+i ; - _node_glob_to_loc.insert(make_pair(global,make_pair(idomain,i))); - _node_loc_to_glob[idomain][i]=global; - if (MyGlobals::_verbose>500) cout<<"n"<getDomainNodeShift(idomain); + for (int i=0; i<_nb_nodes[idomain]; i++) + { + int global=domainNodeShift+i ; + _node_glob_to_loc.insert(make_pair(global,make_pair(idomain,i))); + _node_loc_to_glob[idomain][i]=global; + if (MyGlobals::_Verbose>500) cout<<"n"<500) MPI_Barrier(MPI_COMM_WORLD); - if (MyGlobals::_is0verbose>500) cout<500) MPI_Barrier(MPI_COMM_WORLD); + if (MyGlobals::_Is0verbose>500) cout<getNbTotalCells(); _nb_total_nodes=domainSelector->getNbTotalNodes(); _nb_total_faces=domainSelector->getNbTotalFaces(); - if (MyGlobals::_is0verbose>200) cout<<"globalNumerotation default done meshDimension "<<_mesh_dimension<<" nbTotalCells "<<_nb_total_cells<<" nbTotalNodes "<<_nb_total_nodes<200) cout<<"globalNumerotation default done meshDimension "<<_mesh_dimension<<" nbTotalCells "<<_nb_total_cells<<" nbTotalNodes "<<_nb_total_nodes<& meshes, - const vector& cz, + const vector& cz, vector& cellglobal, vector& nodeglobal, vector& faceglobal) @@ -151,111 +152,111 @@ ParallelTopology::ParallelTopology(const vector& parallel_mode = (!meshes[idomain]); for (int idomain=0; idomain<_nb_domain; idomain++) - { - if ( !meshes[idomain] ) continue; - _mesh_dimension = meshes[idomain]->getMeshDimension(); + { + if ( !meshes[idomain] ) continue; + _mesh_dimension = meshes[idomain]->getMeshDimension(); - //creating cell maps - _nb_cells[idomain]=meshes[idomain]->getNumberOfCells(); - // cout << "Nb cells (domain "<getNumberOfCells(); + // cout << "Nb cells (domain "< ("< ("<getNumberOfNodes()); - for (int i=0; igetNumberOfNodes(); i++) - { - _node_glob_to_loc.insert(make_pair(i,make_pair(0,i))); - _node_loc_to_glob[0][i]=i; - } - _nb_total_nodes=meshes[idomain]->getNumberOfNodes(); - _nb_nodes[0]=_nb_total_nodes; - return; - } + //cas sequentiel + if (_nb_domain==1) + { + _nb_total_cells=index_global; + _nb_cells[0]=index_global; + _node_loc_to_glob[idomain].resize(meshes[idomain]->getNumberOfNodes()); + for (int i=0; igetNumberOfNodes(); i++) + { + _node_glob_to_loc.insert(make_pair(i,make_pair(0,i))); + _node_loc_to_glob[0][i]=i; + } + _nb_total_nodes=meshes[idomain]->getNumberOfNodes(); + _nb_nodes[0]=_nb_total_nodes; + return; + } - //creating node maps - _nb_nodes[idomain]=meshes[idomain]->getNumberOfNodes(); - INTERP_KERNEL::HashMap > local2distant; - _node_loc_to_glob[idomain].resize(_nb_nodes[idomain]); - for (int icz=0; iczgetLocalDomainNumber() == idomain && - cz[icz]->getLocalDomainNumber()>cz[icz]->getDistantDomainNumber()) - { - int nb_node= cz[icz]->getNodeNumber(); - const int* node_corresp=cz[icz]->getNodeCorrespValue(); - int distant_ip = cz[icz]->getDistantDomainNumber(); - for (int i=0; i< nb_node; i++) + //creating node maps + _nb_nodes[idomain]=meshes[idomain]->getNumberOfNodes(); + INTERP_KERNEL::HashMap > local2distant; + _node_loc_to_glob[idomain].resize(_nb_nodes[idomain]); + for (int icz=0; iczgetLocalDomainNumber() == idomain && + cz[icz]->getLocalDomainNumber()>cz[icz]->getDistantDomainNumber()) + { + int nb_node= cz[icz]->getNodeNumber(); + const int* node_corresp=cz[icz]->getNodeCorrespValue(); + int distant_ip = cz[icz]->getDistantDomainNumber(); + for (int i=0; i< nb_node; i++) + { + int local= node_corresp[i*2]; + int distant = node_corresp[i*2+1]; + local2distant.insert(make_pair(local, make_pair(distant_ip,distant))); + } + } } - } - } - // setting mappings for all nodes - if (nodeglobal[idomain]==0) - { - for (int inode=0; inode<_nb_nodes[idomain]; inode++) - { - if (local2distant.find(inode)==local2distant.end()) + // setting mappings for all nodes + if (nodeglobal[idomain]==0) { - index_node_global++; - _node_glob_to_loc.insert(make_pair(index_node_global,make_pair(idomain,inode))); - //_node_loc_to_glob[make_pair(idomain,inode+1)]=index_node_global; - _node_loc_to_glob[idomain][inode]=index_node_global; - } - else + for (int inode=0; inode<_nb_nodes[idomain]; inode++) + { + if (local2distant.find(inode)==local2distant.end()) + { + index_node_global++; + _node_glob_to_loc.insert(make_pair(index_node_global,make_pair(idomain,inode))); + //_node_loc_to_glob[make_pair(idomain,inode+1)]=index_node_global; + _node_loc_to_glob[idomain][inode]=index_node_global; + } + else + { + int ip = (local2distant.find(inode)->second).first; + int distant = (local2distant.find(inode)->second).second; + int global_number=_loc_to_glob[ip][distant]; + _node_glob_to_loc.insert(make_pair(global_number,make_pair(idomain,inode))); + _node_loc_to_glob[idomain][inode]=global_number; + } + } + } + //using former node numbering + else { - int ip = (local2distant.find(inode)->second).first; - int distant = (local2distant.find(inode)->second).second; - int global_number=_loc_to_glob[ip][distant]; - _node_glob_to_loc.insert(make_pair(global_number,make_pair(idomain,inode))); - _node_loc_to_glob[idomain][inode]=global_number; - } - } - } - //using former node numbering - else - { - for (int inode=0; inode<_nb_nodes[idomain]; inode++) - { - int global_number=nodeglobal[idomain][inode]; - _node_glob_to_loc.insert(make_pair(global_number,make_pair(idomain,inode))); - _node_loc_to_glob[idomain][inode]=global_number; - } + for (int inode=0; inode<_nb_nodes[idomain]; inode++) + { + int global_number=nodeglobal[idomain][inode]; + _node_glob_to_loc.insert(make_pair(global_number,make_pair(idomain,inode))); + _node_loc_to_glob[idomain][inode]=global_number; + } + } } - } _nb_total_cells=index_global; _nb_total_nodes=index_node_global; @@ -263,7 +264,7 @@ ParallelTopology::ParallelTopology(const vector& } -//!constructing ParallelTopology from an old topology and a graph +//constructing ParallelTopology from an old topology and a graph ParallelTopology::ParallelTopology(Graph* graph, Topology* oldTopology, int nb_domain, int mesh_dimension) { @@ -271,9 +272,9 @@ ParallelTopology::ParallelTopology(Graph* graph, Topology* oldTopology, int nb_d //cvw !!whatisit! _nb_cells=graph->nbVertices(); _mesh_dimension=mesh_dimension; - if (MyGlobals::_verbose>200) - cout<<"proc "<nbDomain()<<" newNbDomain "<<_nb_domain<200) + cout<<"proc "<nbDomain()<<" newNbDomain "<<_nb_domain<getPart(); //all cells for this proc (may be more domains) _nb_total_cells=graph->nbVertices(); //all cells for this proc (may be more domains) - if (MyGlobals::_verbose>300) - cout<<"proc "<300) + cout<<"proc "<nbDomain(); iold++) - { - int ioldNbCell=oldTopology->getCellNumber(iold); - //cout<<"proc "< globalids(ioldNbCell); - oldTopology->getCellList(iold, &globalids[0]); //unique global numerotation - for (int icell=0; icellgetCellNumber(iold); + //cout<<"proc "< globalids(ioldNbCell); + oldTopology->getCellList(iold, &globalids[0]); //unique global numerotation + for (int icell=0; icell300) + if (MyGlobals::_Verbose>300) for (int idomain=0; idomain<_nb_domain; idomain++) - cout<<"proc "<nbVertices(); - _mesh_dimension=mesh_dimension; - - cout<<"proc "<nbDomain()<<" new nbDomain "<<_nb_domain<getPart(); - _nb_total_cells=graph->nbVertices(); - - cout<<"proc "< local_node = _node_glob_to_loc.find(node_list[i])->second; - ip[i]=local_node.first; - local[i]=local_node.second; - } + { + pair local_node = _node_glob_to_loc.find(node_list[i])->second; + ip[i]=local_node.first; + local[i]=local_node.second; + } } /*!Converts a list of global node numbers on domain ip @@ -391,16 +347,16 @@ void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, i throw INTERP_KERNEL::Exception(LOCALIZED("Node mapping has not yet been built")); for (int i=0; i< nbnode; i++) - { - typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; - pair range=_node_glob_to_loc.equal_range(node_list[i]); - for (mmiter it=range.first; it !=range.second; it++) - { - int ipfound=(it->second).first; - if (ipfound==ip) - local[i]=(it->second).second; + { + typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; + pair range=_node_glob_to_loc.equal_range(node_list[i]); + for (mmiter it=range.first; it !=range.second; it++) + { + int ipfound=(it->second).first; + if (ipfound==ip) + local[i]=(it->second).second; + } } - } } /*!Converts a list of global node numbers @@ -416,29 +372,29 @@ void ParallelTopology::convertGlobalNodeListWithTwins(const int* node_list, int size=0; for (int i=0; i< nbnode; i++) - { - int count= _node_glob_to_loc.count(node_list[i]); - // if (count > 1) - // cout << "noeud " << node_list[i]<< " doublon d'ordre " << count< 1) + // cout << "noeud " << node_list[i]<< " doublon d'ordre " << count< >::iterator mmiter; - pair range=_node_glob_to_loc.equal_range(node_list[i]); - for (mmiter it=range.first; it !=range.second; it++) - { - ip[index]=(it->second).first; - local[index]=(it->second).second; - full_array [index]=node_list[i]; - index++; - } + { + typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; + pair range=_node_glob_to_loc.equal_range(node_list[i]); + for (mmiter it=range.first; it !=range.second; it++) + { + ip[index]=(it->second).first; + local[index]=(it->second).second; + full_array [index]=node_list[i]; + index++; + } - } + } } /*!Converts a list of global face numbers @@ -451,28 +407,28 @@ void ParallelTopology::convertGlobalFaceListWithTwins(const int* face_list, int { size=0; for (int i=0; i< nbface; i++) - { - //int count = _face_glob_to_loc.count(face_list[i]); - //if (count >1) MESSAGE_MED("face en doublon "<1) MESSAGE_MED("face en doublon "< >::iterator mmiter; - pair range=_face_glob_to_loc.equal_range(face_list[i]); - for (mmiter it=range.first; it !=range.second; it++) - { - ip[index]=(it->second).first; - local[index]=(it->second).second; - full_array[index]=face_list[i]; - index++; - } + { + typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; + pair range=_face_glob_to_loc.equal_range(face_list[i]); + for (mmiter it=range.first; it !=range.second; it++) + { + ip[index]=(it->second).first; + local[index]=(it->second).second; + full_array[index]=face_list[i]; + index++; + } - } + } } //!converts a list of global cell numbers @@ -480,21 +436,21 @@ void ParallelTopology::convertGlobalFaceListWithTwins(const int* face_list, int void ParallelTopology::convertGlobalCellList(const int* cell_list, int nbcell, int* local, int* ip) { for (int i=0; i >::const_iterator iter = _glob_to_loc.find(cell_list[i]); - INTERP_KERNEL::HashMap >::const_iterator iter = _glob_to_loc.find(cell_list[i]); - if (iter == _glob_to_loc.end()) - { - cerr<<"proc "<second).first; //no domain - local[i]=(iter->second).second; //no local cell - //cout<<"proc "< >::const_iterator iter = _glob_to_loc.find(cell_list[i]); + INTERP_KERNEL::HashMap >::const_iterator iter = _glob_to_loc.find(cell_list[i]); + if (iter == _glob_to_loc.end()) + { + cerr<<"proc "<second).first; //no domain + local[i]=(iter->second).second; //no local cell + //cout<<"proc "< >::const_iterator iter = _face_glob_to_loc.find(face_list[i]); - if (iter == _face_glob_to_loc.end()) { - throw INTERP_KERNEL::Exception(LOCALIZED("ParallelTopology::convertGlobalFaceList : Face not found")); + INTERP_KERNEL::HashMap >::const_iterator iter = _face_glob_to_loc.find(face_list[i]); + if (iter == _face_glob_to_loc.end()) + { + throw INTERP_KERNEL::Exception(LOCALIZED("ParallelTopology::convertGlobalFaceList : Face not found")); + } + ip[i]=(iter->second).first; + local[i]=(iter->second).second; + // cout << " in convertGlobalFAceList face global "< ("<second).first; - local[i]=(iter->second).second; - // cout << " in convertGlobalFAceList face global "< ("< >::iterator mmiter; - pair range=_face_glob_to_loc.equal_range(face_list[i]); - for (mmiter it=range.first; it !=range.second; it++) - { - int ipfound=(it->second).first; - if (ipfound==ip) - local[i]=(it->second).second; + { + typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; + pair range=_face_glob_to_loc.equal_range(face_list[i]); + for (mmiter it=range.first; it !=range.second; it++) + { + int ipfound=(it->second).first; + if (ipfound==ip) + local[i]=(it->second).second; + } } - } } //replacing a table of global numbering with a table with local numberings @@ -544,24 +500,22 @@ void ParallelTopology::convertGlobalFaceList(const int* face_list, int nbface, i void ParallelTopology::convertToLocal2ndVersion(int* nodes, int nbnodes, int idomain) { for (int inode=0; inode struct hash< std::pair > - { - size_t operator()( const std::pair& x ) const - { - return hash< int >()( x.first*1000000+x.second ); - } - }; -}*/ +#include "InterpKernelHashMap.hxx" + +#include +#include namespace MEDPARTITIONER { class Graph; - class MESHCollection; + class MeshCollection; class MEDPARTITIONER_FaceModel; - class ParallelTopology:public Topology + class ParallelTopology : public Topology { public: ParallelTopology(); - ParallelTopology(const std::vector&); ParallelTopology(const std::vector&, - const std::vector&, + const std::vector&, std::vector&, std::vector&, std::vector&); - ParallelTopology(Graph* graph, Topology* oldTopology, int nbdomain, int mesh_dimension); - ~ParallelTopology(); void setGlobalNumerotationDefault(ParaDomainSelector* domainSelector); - //!converts a list of global cell numbers - //!to a distributed array with local cell numbers + //converts a list of global cell numbers + //to a distributed array with local cell numbers void convertGlobalNodeList(const int*, int,int*,int*); void convertGlobalNodeList(const int*, int,int*,int); void convertGlobalNodeListWithTwins(const int* face_list, int nbnode, int*& local, int*& ip, int*& full_array, int& size); - //!converts a list of global node numbers - //!to a distributed array with local cell numbers + //converts a list of global node numbers + //to a distributed array with local cell numbers void convertGlobalCellList(const int*, int , int*, int *); - //!converts a list of global face numbers - //!to a distributed array with local face numbers + //converts a list of global face numbers + //to a distributed array with local face numbers void convertGlobalFaceList(const int*, int , int*, int *); void convertGlobalFaceList(const int*, int , int*, int); void convertGlobalFaceListWithTwins(const int* face_list, int nbface, int*& local, int*& ip, int*& full_array,int& size); -// //!converting node global numberings to local numberings + //converting node global numberings to local numberings void convertToLocal2ndVersion(int* nodes, int nbnodes, int idomain); - //!converting node local numbering to global - inline int convertNodeToGlobal(int ip,int icell) const + //converting node local numbering to global + inline int convertNodeToGlobal(int ip,int icell) const { //return _node_loc_to_glob.find(make_pair(ip,icell))->second; return _node_loc_to_glob[ip][icell]; } - //!converting face local numbering to global - inline int convertFaceToGlobal(int ip,int iface) const + //converting face local numbering to global + inline int convertFaceToGlobal(int ip,int iface) const { // if (_face_loc_to_glob.find(make_pair(ip,icell))==_face_loc_to_glob.end()) // return -1; @@ -101,7 +88,7 @@ namespace MEDPARTITIONER { } //converting cell global numbering to local - inline int convertCellToGlobal(int ip,int icell) const + inline int convertCellToGlobal(int ip,int icell) const { // if (_loc_to_glob.find(make_pair(ip,icell))==_loc_to_glob.end()) // return -1; @@ -110,25 +97,25 @@ namespace MEDPARTITIONER { return _loc_to_glob[ip][icell]; } - inline void convertNodeToGlobal(int ip, const int* local, int n, int* global)const + inline void convertNodeToGlobal(int ip, const int* local, int n, int* global)const { for (int i=0; i keys; @@ -166,14 +153,14 @@ namespace MEDPARTITIONER { return keys.size(); } - //!retrieving list of nodes in global numbers - inline void getNodeList(int idomain, int* list) const + //retrieving list of nodes in global numbers + inline void getNodeList(int idomain, int* list) const { for (int i=0; i<_nb_nodes[idomain]; i++) list[i]=_node_loc_to_glob[idomain][i]; } - //!< retrieving cell numbers after fusing in parallel mode + //retrieving cell numbers after merging in parallel mode std::vector & getFusedCellNumbers(int idomain) { return _cell_loc_to_glob_fuse[idomain]; @@ -184,7 +171,7 @@ namespace MEDPARTITIONER { return _cell_loc_to_glob_fuse[idomain]; } - //!< retrieving face numbers after fusing in parallel mode + //retrieving face numbers after merging in parallel mode std::vector & getFusedFaceNumbers(int idomain) { return _face_loc_to_glob_fuse[idomain]; @@ -195,7 +182,7 @@ namespace MEDPARTITIONER { } - //!retrieving number of nodes + //retrieving number of nodes inline int getCellNumber(int idomain) const { return _nb_cells[idomain]; @@ -206,7 +193,7 @@ namespace MEDPARTITIONER { return (_glob_to_loc.find(global)->second).first; } - //!retrieving list of nodes in global numbers + //retrieving list of nodes in global numbers inline void getCellList(int idomain, int* list) const { for (int i=0; i<_nb_cells[idomain];i++) @@ -231,14 +218,14 @@ namespace MEDPARTITIONER { } - //!retrieving list of faces in global numbers + //retrieving list of faces in global numbers inline void getFaceList(int idomain, int* list) const { for (int i=0; i<_nb_faces[idomain];i++) list[i]=_face_loc_to_glob[idomain][i]; } - //! converting a global cell number to a local representation (domain + local number) + //converting a global cell number to a local representation (domain + local number) inline std::pair convertGlobalCell(int iglobal) const { return _glob_to_loc.find(iglobal)->second; @@ -258,13 +245,13 @@ namespace MEDPARTITIONER { typedef INTERP_KERNEL::HashMultiMap >::const_iterator MMiter; std::pair eq = _node_glob_to_loc.equal_range(iglobal); for (MMiter it=eq.first; it != eq.second; it++) - { - if (it->second.first == idomain) return it->second.second; - } + { + if (it->second.first == idomain) return it->second.second; + } return -1; } - //!adding a face to the topology + //adding a face to the topology inline void appendFace(int idomain, int ilocal, int iglobal) { _face_loc_to_glob[idomain].push_back(iglobal); @@ -275,30 +262,28 @@ namespace MEDPARTITIONER { int getMaxGlobalFace() const; private: - bool hasCellWithNodes( const MESHCollection&, int dom, const std::set& nodes ); + bool hasCellWithNodes( const MeshCollection&, int dom, const std::set& nodes ); private: - //!mapping global -> local + //mapping global -> local typedef INTERP_KERNEL::HashMultiMap > TGlob2DomainLoc; TGlob2DomainLoc _glob_to_loc; - std::vector > _loc_to_glob; - INTERP_KERNEL::HashMultiMap > _node_glob_to_loc; - //!mapping local -> global + //mapping local -> global std::vector > _node_loc_to_glob; // global numbers in parallel mode - std::vector > _cell_loc_to_glob_fuse; // glob nums after fusing - std::vector > _face_loc_to_glob_fuse; // glob nums after fusing + std::vector > _cell_loc_to_glob_fuse; // glob nums after merging + std::vector > _face_loc_to_glob_fuse; // glob nums after merging - //!mapping global -> local + //mapping global -> local typedef INTERP_KERNEL::HashMultiMap > TGlob2LocsMap; TGlob2LocsMap _face_glob_to_loc; - //!mapping local -> global + //mapping local -> global std::vector > _face_loc_to_glob; std::vector _nb_cells; std::vector _nb_nodes; @@ -309,7 +294,5 @@ namespace MEDPARTITIONER { int _nb_domain; int _mesh_dimension; }; - - } -#endif /*PARALLELTOPOLOGY_HXX_*/ +#endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_SkyLineArray.cxx b/src/MEDPartitioner/MEDPARTITIONER_SkyLineArray.cxx index 3f0cf14fd..aa5a386a7 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_SkyLineArray.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_SkyLineArray.cxx @@ -1,52 +1,44 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D // -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "MEDPARTITIONER_SkyLineArray.hxx" -#include +#include using namespace MEDPARTITIONER; -MEDSKYLINEARRAY::MEDSKYLINEARRAY() +SkyLineArray::SkyLineArray() { - //MESSAGE_MED("Constructeur MEDSKYLINEARRAY sans parametre"); } -MEDSKYLINEARRAY::MEDSKYLINEARRAY(const MEDSKYLINEARRAY &myArray) +SkyLineArray::SkyLineArray(const SkyLineArray &myArray) { _index=myArray._index; _value=myArray._value; } -MEDSKYLINEARRAY::~MEDSKYLINEARRAY() +SkyLineArray::~SkyLineArray() { - //MESSAGE_MED("Destructeur ~MEDSKYLINEARRAY"); - - //if (_index != NULL) delete [] _index; - //if (_value != NULL) delete [] _value; } -MEDSKYLINEARRAY::MEDSKYLINEARRAY(const std::vector& index, const std::vector& value) +SkyLineArray::SkyLineArray(const std::vector& index, const std::vector& value) { _value=value; _index=index; diff --git a/src/MEDPartitioner/MEDPARTITIONER_SkyLineArray.hxx b/src/MEDPartitioner/MEDPARTITIONER_SkyLineArray.hxx index d56fd94bb..ff765d88a 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_SkyLineArray.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_SkyLineArray.hxx @@ -1,81 +1,62 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D // -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -# ifndef __MEDPARTITIONER_MEDSKYLINEARRAY_H__ -# define __MEDPARTITIONER_MEDSKYLINEARRAY_H__ +#ifndef __MEDPARTITIONER_MEDSKYLINEARRAY_H__ +#define __MEDPARTITIONER_MEDSKYLINEARRAY_H__ #include "MEDPARTITIONER.hxx" #include -namespace MEDPARTITIONER { -class MEDPARTITIONER_EXPORT MEDSKYLINEARRAY -{ -private : - std::vector _index; - std::vector _value; - -public : - // Attention, avec ce constructeur, il n'est possible de remplir le MEDSKYLINEARRAY - MEDSKYLINEARRAY(); - - // Constructeur par recopie - MEDSKYLINEARRAY( const MEDSKYLINEARRAY &myArray ); - - // Avec ce constructeur la m�moire pour le tableau de valeur et le - // tableau d'index est r�serv�e. Il suffit d'effectuer les s�quences - // d'appels suivantes pour initialiser le MEDSKYLINEARRAY - // 1) setIndex(index) puis fois setI(i,&listValeurN�I) avec i dans 1..count - // rem : listValeurN�I est dupliqu�e - // 2) appeler fois setIJ(i,j,valeur) avec i dans 1..count et avec j dans 1..count - MEDSKYLINEARRAY( const std::vector& index, const std::vector& value ); - - ~MEDSKYLINEARRAY(); - //void setMEDSKYLINEARRAY( const int count, const int length, int* index , int* value ) ; - - inline int getNumberOf() const; - inline int getLength() const; - inline const int* getIndex() const; - inline const int* getValue() const; -}; - -// --------------------------------------- -// Methodes Inline -// --------------------------------------- -inline int MEDSKYLINEARRAY::getNumberOf() const -{ - return _index.size()-1; -} -inline int MEDSKYLINEARRAY::getLength() const -{ - return _value.size() ; -} -inline const int* MEDSKYLINEARRAY::getIndex() const -{ - return (const int*)(&_index[0]) ; -} -inline const int* MEDSKYLINEARRAY::getValue() const +namespace MEDPARTITIONER { - return (const int*)(&_value[0]) ; -} + class MEDPARTITIONER_EXPORT SkyLineArray + { + private : + std::vector _index; + std::vector _value; + + public : + SkyLineArray(); //if used SkyLineArray will keep empty + SkyLineArray( const SkyLineArray &myArray ); + SkyLineArray( const std::vector& index, const std::vector& value ); + ~SkyLineArray(); + + inline int getNumberOf() const + { + return _index.size()-1; + } + + inline int getLength() const + { + return _value.size() ; + } + + inline const int* getIndex() const + { + return (const int*)(&_index[0]) ; + } + + inline const int* getValue() const + { + return (const int*)(&_value[0]) ; + } + }; } # endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx b/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx index d0821e7af..d934643e4 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx @@ -1,171 +1,113 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#ifndef MEDPARTITIONER_TOPOLOGY_HXX_ -#define MEDPARTITIONER_TOPOLOGY_HXX_ -//#include "boost/shared_ptr.hpp" +#ifndef __MEDPARTITIONER_TOPOLOGY_HXX__ +#define __MEDPARTITIONER_TOPOLOGY_HXX__ -#include #include +#include namespace MEDPARTITIONER { - class CONNECTZONE; - class MEDSKYLINEARRAY; + class ConnectZone; + class SkyLineArray; } namespace ParaMEDMEM { class MEDCouplingUMesh; } namespace MEDPARTITIONER { - class Graph; - class MESHCollection; + class MeshCollection; class MEDPARTITIONER_FaceModel; - - // typedef std::map > TGeom2Faces; - // typedef std::vector< TGeom2Faces > TGeom2FacesByDomain; - + class Topology { public: - Topology(){} - Topology(std::vector, std::vector){} - - virtual ~Topology(){} - - //!converts a list of global cell numbers - //!to a distributed array with local cell numbers - virtual void convertGlobalNodeList(const int* list, int nb, int* local, int*ip)=0; - virtual void convertGlobalNodeList(const int* list, int nb, int* local, int ip)=0; - //!converts a list of global node numbers - //!to a distributed array with local cell numbers - virtual void convertGlobalCellList(const int*list , int nb, int* local, int*ip)=0; - - //!converts a list of global face numbers - //!to a distributed array with local face numbers - virtual void convertGlobalFaceList(const int*list , int nb, int* local, int*ip)=0; - virtual void convertGlobalFaceList(const int*list , int nb, int* local, int ip)=0; - virtual void convertGlobalFaceListWithTwins(const int* face_list, int nbface, int*& local, int*& ip, int*& full_array, int& size)=0; - virtual void convertGlobalNodeListWithTwins(const int* face_list, int nbnode, int*& local, int*& ip, int*& full_array, int& size)=0; - - + Topology() + { + } + Topology(std::vector, std::vector) + { + } + virtual ~Topology() + { + } + + //converts a list of global cell numbers + //to a distributed array with local cell numbers + virtual void convertGlobalNodeList(const int* list, int nb, int* local, int*ip) = 0; + virtual void convertGlobalNodeList(const int* list, int nb, int* local, int ip) = 0; + //converts a list of global node numbers + //to a distributed array with local cell numbers + virtual void convertGlobalCellList(const int*list , int nb, int* local, int*ip) = 0; + + //converts a list of global face numbers + //to a distributed array with local face numbers + virtual void convertGlobalFaceList(const int*list , int nb, int* local, int*ip) = 0; + virtual void convertGlobalFaceList(const int*list , int nb, int* local, int ip) = 0; + virtual void convertGlobalFaceListWithTwins(const int* face_list, int nbface, int*& local, int*& ip, int*& full_array, int& size) = 0; + virtual void convertGlobalNodeListWithTwins(const int* face_list, int nbnode, int*& local, int*& ip, int*& full_array, int& size) = 0; //number of doamins - virtual int nbDomain() const =0; - + virtual int nbDomain() const = 0; //number of cells - virtual int nbCells() const=0; - + virtual int nbCells() const = 0; //number of nodes - virtual int nbNodes() const=0; - + virtual int nbNodes() const = 0; //number of cells on a specific domain - virtual int nbCells(int idomain) const=0; - - // ////creating node mapping - // virtual void createNodeMapping(std::map& type_connectivity, - // std::map& present_type_numbers, - // std::vector& polygon_conn, -// std::vector& polygon_conn_index, -// std::vector& polyhedron_conn, -// std::vector& polyhedron_conn_index, -// std::vector& polyhedron_face_index, -// int domain)=0; - - ////creating face mapping - // virtual void createFaceMapping(std::map& type_connectivity, - // std::map& present_type_numbers,int domain)=0; - // - // virtual void createFaceMapping(const MESHCollection&,const MESHCollection&)=0; - - // //converting node global numberings to local numberings - // virtual void convertToLocal(std::map& type_connectivity, - // std::map& present_type_numbers, - // int idomain, - // MED_EN::medEntityMesh entity)=0; + virtual int nbCells(int idomain) const = 0; //converting node global numberings to local numberings - virtual void convertToLocal2ndVersion(int*,int,int)=0; - - virtual int convertNodeToGlobal(int ip,int icell)const=0; - virtual int convertFaceToGlobal(int ip,int icell)const=0; - virtual int convertCellToGlobal(int ip,int icell)const=0; - - virtual void convertNodeToGlobal(int ip,const int* local, int n, int* global)const=0 ; - virtual void convertCellToGlobal(int ip,const int* local, int n, int* global)const=0 ; - virtual void convertFaceToGlobal(int ip,const int* local, int n, int* global)const=0 ; - + virtual void convertToLocal2ndVersion(int*,int,int) = 0; + virtual int convertNodeToGlobal(int ip,int icell) const = 0; + virtual int convertFaceToGlobal(int ip,int icell) const = 0; + virtual int convertCellToGlobal(int ip,int icell) const = 0; + virtual void convertNodeToGlobal(int ip,const int* local, int n, int* global) const = 0 ; + virtual void convertCellToGlobal(int ip,const int* local, int n, int* global) const = 0 ; + virtual void convertFaceToGlobal(int ip,const int* local, int n, int* global) const = 0 ; //retrieving number of nodes - virtual int getNodeNumber(int idomain) const =0; - virtual int getNodeNumber() const=0; + virtual int getNodeNumber(int idomain) const = 0; + virtual int getNodeNumber() const = 0; //retrieving list of nodes - virtual void getNodeList(int idomain, int* list) const =0; - + virtual void getNodeList(int idomain, int* list) const = 0; virtual std::vector & getFusedCellNumbers(int idomain) = 0; virtual const std::vector & getFusedCellNumbers(int idomain) const = 0; - virtual std::vector & getFusedFaceNumbers(int idomain) = 0; virtual const std::vector & getFusedFaceNumbers(int idomain) const = 0; - //retrieving number of nodes - virtual int getCellNumber(int idomain) const =0; - + virtual int getCellNumber(int idomain) const = 0; //retrieving list of nodes - virtual void getCellList(int idomain, int* list) const =0; - + virtual void getCellList(int idomain, int* list) const = 0; //retrieving number of faces - virtual int getFaceNumber(int idomain) const =0; - virtual int getFaceNumber()const =0; - + virtual int getFaceNumber(int idomain) const = 0; + virtual int getFaceNumber()const = 0; //retrieving list of nodes - virtual void getFaceList(int idomain, int* list) const =0; - + virtual void getFaceList(int idomain, int* list) const = 0; //adding a face to the mapping - virtual void appendFace(int idomain, int ilocal, int iglobal)=0; - + virtual void appendFace(int idomain, int ilocal, int iglobal) = 0; //return max global face number - virtual int getMaxGlobalFace()const=0; - - //return next free global face number - //virtual int nextGlobalFace(int start_num) const=0; - - //!converting a global cell number to a local representation - virtual std::pair convertGlobalCell(int iglobal) const =0; - + virtual int getMaxGlobalFace() const = 0; + //converting a global cell number to a local representation + virtual std::pair convertGlobalCell(int iglobal) const = 0; //converting a global face number to a local representation - virtual int convertGlobalFace(int iglobal, int idomain)=0; - + virtual int convertGlobalFace(int iglobal, int idomain) = 0; //converting a global node number to a local representation - virtual int convertGlobalNode(int iglobal, int idomain)=0; - - //! computing arrays with node/node correspondencies - // virtual void computeNodeNodeCorrespondencies(int nbdomain, std::vector&) const =0; - - //! computing arrays with cell/cell correspondencies - // virtual void computeCellCellCorrespondencies(int nbdomain, std::vector&, const Graph*) const =0; - - - //!recreating a face mapping from scratch - // virtual void recreateFaceMapping(const TGeom2FacesByDomain& )=0; - - //!recreating cell and node mapping after send-reveive and fusion of domain meshes - // virtual void recreateMappingAfterFusion(const std::vector& ) = 0; + virtual int convertGlobalNode(int iglobal, int idomain) = 0; }; } - -#endif /*TOPOLOGY_HXX_*/ +#endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx index 948ec64cb..80d558a8a 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx @@ -1,25 +1,28 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "MEDPARTITIONER_Graph.hxx" #include "MEDPARTITIONER_UserGraph.hxx" + #include #include + using namespace MEDPARTITIONER; /*! constructor that allows to specify the desired partition @@ -27,19 +30,19 @@ using namespace MEDPARTITIONER; * (domain numbers range from 0 to ndomain-1 * \param n number of cells in the mesh */ -UserGraph::UserGraph(MEDPARTITIONER::MEDSKYLINEARRAY* array, const int* partition, int n):Graph(array,0) +UserGraph::UserGraph(MEDPARTITIONER::SkyLineArray* array, const int* partition, int n):Graph(array,0) { std::vector index(n+1),value(n); index[0]=0; for (int i=0; i + namespace MEDPARTITIONER { - class MEDSKYLINEARRAY; + class SkyLineArray; class ParaDomainSelector; class MEDPARTITIONER_EXPORT UserGraph : public Graph { public: - UserGraph(MEDPARTITIONER::MEDSKYLINEARRAY*, const int*, int); + UserGraph(MEDPARTITIONER::SkyLineArray*, const int*, int); virtual ~UserGraph(); void partGraph(int, const std::string& options=std::string(""), ParaDomainSelector* sel=0); }; } - -#endif /*MEDPARTITIONER_USERGRAPH_HXX_*/ +#endif diff --git a/src/MEDPartitioner/medpartitioner_para.cxx b/src/MEDPartitioner/medpartitioner_para.cxx index d597cbe6c..beacdca9a 100644 --- a/src/MEDPartitioner/medpartitioner_para.cxx +++ b/src/MEDPartitioner/medpartitioner_para.cxx @@ -1,57 +1,50 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// MED medsplitter : tool to split n MED files into p separate -// MED files with a partitioning specified -// by an external tool -// File : medsplitter.cxx -// Module : MED -// - /* -examples of launch -rm ttmp* tttmp* -export verb=11 -mpirun -np 2 medpartitioner_para --input-file=blade.med --output-file=ttmp1_ --ndomains=2 --dump-cpu-memory --verbose=$verb -mpirun -np 5 medpartitioner_para --input-file=blade.med --output-file=ttmp1_ --ndomains=2 --dump-cpu-memory --verbose=$verb -mpirun -np 4 medpartitioner_para --input-file=ttmp1_.xml --output-file=tttmp1_ --ndomains=4 --verbose=$verb + examples of launch + rm ttmp* tttmp* + export verb=11 + mpirun -np 2 medpartitioner_para --input-file=blade.med --output-file=ttmp1_ --ndomains=2 --dump-cpu-memory --verbose=$verb + mpirun -np 5 medpartitioner_para --input-file=blade.med --output-file=ttmp1_ --ndomains=2 --dump-cpu-memory --verbose=$verb + mpirun -np 4 medpartitioner_para --input-file=ttmp1_.xml --output-file=tttmp1_ --ndomains=4 --verbose=$verb -mpirun -np 2 medpartitioner_para --ndomains=2 --input-file=tmp_testMesh_20x30x50.med --output-file=ttmp2_ --verbose=$verb -mpirun -np 2 medpartitioner_para --ndomains=2 --input-file=ttmp2_.xml --output-file=ttmp3_ --verbose=$verb + mpirun -np 2 medpartitioner_para --ndomains=2 --input-file=tmp_testMesh_20x30x50.med --output-file=ttmp2_ --verbose=$verb + mpirun -np 2 medpartitioner_para --ndomains=2 --input-file=ttmp2_.xml --output-file=ttmp3_ --verbose=$verb -mpirun -np 2 medpartitioner_para --ndomains=2 --input-file=tmp_testMeshWithFaces_20x30x50.med --output-file=ttmp2_ --verbose=$verb -mpirun -np 2 medpartitioner_para --ndomains=2 --input-file=ttmp2_.xml --output-file=ttmp3_ --verbose=$verb + mpirun -np 2 medpartitioner_para --ndomains=2 --input-file=tmp_testMeshWithFaces_20x30x50.med --output-file=ttmp2_ --verbose=$verb + mpirun -np 2 medpartitioner_para --ndomains=2 --input-file=ttmp2_.xml --output-file=ttmp3_ --verbose=$verb -mpirun -np 2 medpartitioner_para --ndomains=2 --input-file=tmp_testMesh_20x30x50_WithVecFieldOnCells.med --output-file=ttmp2_ --verbose=$verb -mpirun -np 2 medpartitioner_para --ndomains=2 --input-file=tmp_testMesh_20x30x50_WithVecFieldOnNodes.med --output-file=ttmp2_ --verbose=$verb -mpirun -np 2 medpartitioner_para --ndomains=2 --input-file=ttmp2_.xml --output-file=ttmp3_ --verbose=$verb + mpirun -np 2 medpartitioner_para --ndomains=2 --input-file=tmp_testMesh_20x30x50_WithVecFieldOnCells.med --output-file=ttmp2_ --verbose=$verb + mpirun -np 2 medpartitioner_para --ndomains=2 --input-file=tmp_testMesh_20x30x50_WithVecFieldOnNodes.med --output-file=ttmp2_ --verbose=$verb + mpirun -np 2 medpartitioner_para --ndomains=2 --input-file=ttmp2_.xml --output-file=ttmp3_ --verbose=$verb -mpirun -np 4 medpartitioner_para --ndomains=4 --input-file=tmp_testMeshHuge_20x30x50_6.xml --output-file=ttmp3_ --verbose=1 + mpirun -np 4 medpartitioner_para --ndomains=4 --input-file=tmp_testMeshHuge_20x30x50_6.xml --output-file=ttmp3_ --verbose=1 */ -#include "MEDPARTITIONER_MESHCollection.hxx" -//#include "MEDPARTITIONER_Topology.hxx" +#include "MEDPARTITIONER_MeshCollection.hxx" #include "MEDPARTITIONER_ParallelTopology.hxx" #include "MEDPARTITIONER_ParaDomainSelector.hxx" +#include "MEDPARTITIONER_Utils.hxx" + #include "MEDLoader.hxx" -#include "MEDPARTITIONER_utils.hxx" #include #include @@ -63,11 +56,6 @@ mpirun -np 4 medpartitioner_para --ndomains=4 --input-file=tmp_testMeshHuge_20x3 #include #endif -#ifdef BOOST_PROGRAM_OPTIONS_LIB -#include -namespace po=boost::program_options; -#endif - using namespace std; using namespace MEDPARTITIONER; @@ -82,7 +70,7 @@ int main(int argc, char** argv) // Defining options // by parsing the command line - //bool xml_output_master=true; + bool split_family=false; bool empty_groups=false; bool mesure_memory=false; @@ -96,14 +84,15 @@ int main(int argc, char** argv) int help=0; int test=0; MPI_Init(&argc,&argv); - MPI_Comm_size(MPI_COMM_WORLD, &MyGlobals::_world_size); - MPI_Comm_rank(MPI_COMM_WORLD, &MyGlobals::_rank); - //cout<<"proc "< : name of the input .med file or .xml master file\n" @@ -115,7 +104,6 @@ int main(int argc, char** argv) #endif #endif "\t--creates-boundary-faces : creates boundary faces mesh in the output files\n" - //"\t--family-splitting : preserves the family names instead of focusing on the groups\n" "\t--dump-cpu-memory : dumps passed CPU time and maximal increase of used memory\n" //"\t--randomize= : random seed for other partitionning (only on one proc)\n" //"\t--atomize : do the opposite of a good partitionner (only on one proc)\n" @@ -124,43 +112,41 @@ int main(int argc, char** argv) if (argc<=1) help=1; string value; for (int i = 1; i < argc; i++) - { - if (strlen(argv[i]) < 3) { - if (MyGlobals::_rank==0) cerr << "bad argument : "<< argv[i] << endl; - MPI_Finalize(); return 1; - } + if (strlen(argv[i]) < 3) + { + if (MyGlobals::_Rank==0) cerr << "bad argument : "<< argv[i] << endl; + MPI_Finalize(); return 1; + } - if (testArg(argv[i],"--verbose",value)) - { - MyGlobals::_verbose=1; - if (value!="") MyGlobals::_verbose = atoi(value.c_str()); + if (TestArg(argv[i],"--verbose",value)) + { + MyGlobals::_Verbose=1; + if (value!="") MyGlobals::_Verbose = atoi(value.c_str()); + } + else if (TestArg(argv[i],"--help",value)) help=1; + else if (TestArg(argv[i],"--test",value)) test=1; + else if (TestArg(argv[i],"--input-file",value)) input=value; + else if (TestArg(argv[i],"--output-file",value)) output=value; + else if (TestArg(argv[i],"--split-method",value)) library=value; + else if (TestArg(argv[i],"--ndomains",value)) ndomains=atoi(value.c_str()); + else if (TestArg(argv[i],"--randomize",value)) MyGlobals::_Randomize=atoi(value.c_str()); + else if (TestArg(argv[i],"--atomize",value)) MyGlobals::_Atomize=atoi(value.c_str()); + else if (TestArg(argv[i],"--creates-boundary-faces",value)) MyGlobals::_Creates_Boundary_Faces=1; + else if (TestArg(argv[i],"--dump-cpu-memory",value)) mesure_memory=true; + else + { + if (MyGlobals::_Rank==0) cerr << "unknown argument : "<< argv[i] << endl; + MPI_Finalize(); return 1; + } } - else if (testArg(argv[i],"--help",value)) help=1; - else if (testArg(argv[i],"--test",value)) test=1; - else if (testArg(argv[i],"--input-file",value)) input=value; - else if (testArg(argv[i],"--output-file",value)) output=value; - else if (testArg(argv[i],"--split-method",value)) library=value; - //else if (testArg(argv[i],"--family-splitting",value)) split_family=true; - else if (testArg(argv[i],"--ndomains",value)) ndomains=atoi(value.c_str()); - else if (testArg(argv[i],"--randomize",value)) MyGlobals::_randomize=atoi(value.c_str()); - else if (testArg(argv[i],"--atomize",value)) MyGlobals::_atomize=atoi(value.c_str()); - else if (testArg(argv[i],"--creates-boundary-faces",value)) MyGlobals::_creates_boundary_faces=1; - //else if (testArg(argv[i],"--empty-groups",value)) empty_groups=true; - else if (testArg(argv[i],"--dump-cpu-memory",value)) mesure_memory=true; - else - { - if (MyGlobals::_rank==0) cerr << "unknown argument : "<< argv[i] << endl; - MPI_Finalize(); return 1; - } - } - if (MyGlobals::_randomize!=0 && MyGlobals::_world_size!=1) - { - if (MyGlobals::_rank==0) cerr << "randomize only available on 1 proc (mpirun -np 1)" << endl; - MyGlobals::_randomize=0; - } + if (MyGlobals::_Randomize!=0 && MyGlobals::_World_Size!=1) + { + if (MyGlobals::_Rank==0) cerr << "randomize only available on 1 proc (mpirun -np 1)" << endl; + MyGlobals::_Randomize=0; + } #ifdef ENABLE_PARMETIS #ifndef ENABLE_PTSCOTCH @@ -171,192 +157,184 @@ int main(int argc, char** argv) #endif if (help==1) - { - if (MyGlobals::_rank==0) cout<0) cout<<"tests on "<0) cout<<"tests on "<setGlobalNumerotationDefault(collection.getParaDomainSelector()); - //int nbfiles=MyGlobals::_fileMedNames->size(); //nb domains - //to have unique valid fields names/pointers/descriptions for partitionning - collection.prepareFieldDescriptions(); - //int nbfields=collection.getFieldDescriptions().size(); //on all domains - //cout<setGlobalNumerotationDefault(collection.getParaDomainSelector()); + //int nbfiles=MyGlobals::_fileMedNames->size(); //nb domains + //to have unique valid fields names/pointers/descriptions for partitionning + collection.prepareFieldDescriptions(); + //int nbfields=collection.getFieldDescriptions().size(); //on all domains + //cout< new_topo; - if (library == "metis") //cvwat06 - new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::METIS)); - else - new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::SCOTCH)); - parallelizer.evaluateMemory(); + auto_ptr< MEDPARTITIONER::Topology > new_topo; + if (library == "metis") //cvwat06 + new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::METIS)); + else + new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::SCOTCH)); + parallelizer.evaluateMemory(); - // Creating a new mesh collection from the partitioning - if (MyGlobals::_is0verbose) cout << "Creating new meshes"< finalInformations; - vector r1,r2; - r1=allgathervVectorOfString(MyGlobals::_generalInformations); - //if (MyGlobals::_is0verbose>1000) cout << "generalInformations : \n"< finalInformations; + vector r1,r2; + r1=AllgathervVectorOfString(MyGlobals::_General_Informations); + //if (MyGlobals::_Is0verbose>1000) cout << "generalInformations : \n"<0) cout<<"OK END"<< endl; - MPI_Finalize(); - return 0; - } + if ( mesure_memory ) + if ( parallelizer.isOnDifferentHosts() || MyGlobals::_Rank==0 ) + { + cout << "Elapsed time = " << parallelizer.getPassedTime() + << ", max memory usage = " << parallelizer.evaluateMemory() << " KB" + << endl; + } + MPI_Barrier(MPI_COMM_WORLD); + if (MyGlobals::_Is0verbose>0) cout<<"OK END"<< endl; + MPI_Finalize(); + return 0; + } catch(const char *mess) - { - cerr<<"proc "<