From 75d62f4ea4642bd6e08760e8eb9dbe70c807d218 Mon Sep 17 00:00:00 2001 From: vbd Date: Tue, 26 Jul 2011 09:28:59 +0000 Subject: [PATCH] *** empty log message *** --- .../MEDPARTITIONER_ConnectZone.cxx | 288 ++++++++++++++++++ .../MEDPARTITIONER_ConnectZone.hxx | 103 +++++++ 2 files changed, 391 insertions(+) create mode 100644 src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx create mode 100644 src/MEDPartitioner/MEDPARTITIONER_ConnectZone.hxx diff --git a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx new file mode 100644 index 000000000..91e267ad6 --- /dev/null +++ b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx @@ -0,0 +1,288 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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 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 +// + +// few STL include files +// +#include + +// few Med Memory include files +#include "MEDMEM_define.hxx" +#include "MEDCouplingUMesh.hxx" +#include "MEDPARTITIONER_SkyLineArray.hxx" +#include "MEDPARTITIONER_ConnectZone.hxx" + +using namespace MEDPARTITIONER; + +CONNECTZONE::CONNECTZONE(): + _name("") + ,_description("") + ,_distantDomainNumber(0) + ,_localDomainNumber(0) + ,_nodeCorresp(0) + ,_faceCorresp(0) +{ + _entityCorresp.clear(); +} + +CONNECTZONE::~CONNECTZONE(){ + if (_nodeCorresp !=0) delete _nodeCorresp; + if (_faceCorresp !=0) delete _faceCorresp; + for (std::map < std::pair ,MEDPARTITIONER::MEDSKYLINEARRAY * >::iterator + iter = _entityCorresp.begin(); iter != _entityCorresp.end(); iter++) + { + delete iter->second; + } +} + +CONNECTZONE::CONNECTZONE(const CONNECTZONE & myConnectZone): + _name(myConnectZone._name) + ,_description(myConnectZone._description) + ,_distantDomainNumber(myConnectZone._distantDomainNumber) + ,_localDomainNumber(myConnectZone._localDomainNumber) + ,_nodeCorresp(myConnectZone._nodeCorresp) + ,_faceCorresp(myConnectZone._faceCorresp) + ,_entityCorresp(myConnectZone._entityCorresp) +{ +} +std::string CONNECTZONE::getName() const +{ + return _name; +} +std::string CONNECTZONE::getDescription() const +{ + return _description; +} +int CONNECTZONE::getDistantDomainNumber() const +{ + return _distantDomainNumber; +} +int CONNECTZONE::getLocalDomainNumber() const +{ + return _localDomainNumber; +} + +ParaMEDMEM::MEDCouplingUMesh* CONNECTZONE::getLocalMesh() const +{ + return _localMesh; +} + +ParaMEDMEM::MEDCouplingUMesh * CONNECTZONE::getDistantMesh() const +{ + return _distantMesh; +} + +bool CONNECTZONE::isEntityCorrespPresent(int localEntity, + int distantEntity) const +{ + typedef std::map, MEDPARTITIONER::MEDSKYLINEARRAY*>::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 +{ + return _nodeCorresp->getIndex(); +} + +const int * CONNECTZONE::getNodeCorrespValue() const +{ + return _nodeCorresp->getValue(); +} +int CONNECTZONE::getNodeNumber() const +{ + return _nodeCorresp->getNumberOf(); +} +const int * CONNECTZONE::getFaceCorrespIndex() const +{ + return _faceCorresp->getIndex(); +} + +const int * CONNECTZONE::getFaceCorrespValue() const +{ + return _faceCorresp->getValue(); +} +int CONNECTZONE::getFaceNumber() const +{ + return _faceCorresp->getNumberOf(); +} +const int * CONNECTZONE::getEntityCorrespIndex(int localEntity, + int distantEntity) const +{ + typedef std::map, MEDPARTITIONER::MEDSKYLINEARRAY*>::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; +} + +const int * CONNECTZONE::getEntityCorrespValue(int localEntity, + int distantEntity) const +{ + typedef std::map, MEDPARTITIONER::MEDSKYLINEARRAY*>::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; +} + +int CONNECTZONE::getEntityCorrespNumber(int localEntity, + int distantEntity) const +{ + typedef std::map, MEDPARTITIONER::MEDSKYLINEARRAY*>::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; +} + + +int CONNECTZONE::getEntityCorrespLength(int localEntity, + int distantEntity) const +{ + typedef std::map, MEDPARTITIONER::MEDSKYLINEARRAY*>::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; +} + +void CONNECTZONE::setName(std::string name) +{ + _name=name; +} +void CONNECTZONE::setDescription(std::string description) +{ + _description=description; +} +void CONNECTZONE::setDistantDomainNumber(int distantDomainNumber) +{ + _distantDomainNumber=distantDomainNumber; +} +void CONNECTZONE::setLocalDomainNumber(int localDomainNumber) +{ + _localDomainNumber=localDomainNumber; +} +void CONNECTZONE::setLocalMesh(ParaMEDMEM::MEDCouplingUMesh * localMesh) +{ + _localMesh=localMesh; +} + +void CONNECTZONE::setDistantMesh(ParaMEDMEM::MEDCouplingUMesh * distantMesh) +{ + _distantMesh=distantMesh; +} + +/*! transforms an int array containing + * the node-node connections + * to a MEDSKYLINEARRAY + */ +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 index(nbentity+1),value(2*nbentity); + for (int i=0; i +#include + +// few Med Memory include files +// #include "MEDMEM_STRING.hxx" +// #include "MEDMEM_define.hxx" +// #include "MEDMEM_Mesh.hxx" +#include "MEDPARTITIONER_SkyLineArray.hxx" + +namespace MEDPARTITIONER { +class MEDPARTITIONER_EXPORT CONNECTZONE +{ +private : + std::string _name; + std::string _description; + int _localDomainNumber; + int _distantDomainNumber; + + ParaMEDMEM::MEDCouplingUMesh * _localMesh; + ParaMEDMEM::MEDCouplingUMesh * _distantMesh; + + MEDPARTITIONER::MEDSKYLINEARRAY * _nodeCorresp; + MEDPARTITIONER::MEDSKYLINEARRAY * _faceCorresp; + + std::map < std::pair , MEDPARTITIONER::MEDSKYLINEARRAY * > _entityCorresp; + +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 ; + + 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); +}; +} +# endif -- 2.39.2