-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016 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
#include "MEDPARTITIONER_ConnectZone.hxx"
+#include "MEDCouplingSkyLineArray.hxx"
+
#include <map>
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
MEDPARTITIONER::ConnectZone::ConnectZone():
_name("")
,_distant_domain_number(0)
,_node_corresp(0)
,_face_corresp(0)
+ ,_local_mesh(0)
+ ,_distant_mesh(0)
{
}
MEDPARTITIONER::ConnectZone::~ConnectZone()
{
- delete _node_corresp;
- delete _face_corresp;
for(std::map < std::pair <int, int>,MEDCouplingSkyLineArray * >::iterator iter=_entity_corresp.begin(); iter!=_entity_corresp.end();iter++)
{
- delete iter->second;
+ iter->second->decrRef();
}
}
,_node_corresp(myConnectZone._node_corresp)
,_face_corresp(myConnectZone._face_corresp)
,_entity_corresp(myConnectZone._entity_corresp)
+ ,_local_mesh(0)
+ ,_distant_mesh(0)
{
}
return _local_domain_number;
}
-ParaMEDMEM::MEDCouplingUMesh *MEDPARTITIONER::ConnectZone::getLocalMesh() const
+MEDCouplingUMesh *MEDPARTITIONER::ConnectZone::getLocalMesh() const
{
return _local_mesh;
}
-ParaMEDMEM::MEDCouplingUMesh *MEDPARTITIONER::ConnectZone::getDistantMesh() const
+MEDCouplingUMesh *MEDPARTITIONER::ConnectZone::getDistantMesh() const
{
return _distant_mesh;
}
const int *MEDPARTITIONER::ConnectZone::getNodeCorrespValue() const
{
- return _node_corresp->getValue();
+ return _node_corresp->getValues();
}
int MEDPARTITIONER::ConnectZone::getNodeNumber() const
return _node_corresp->getNumberOf();
}
-const ParaMEDMEM::MEDCouplingSkyLineArray * MEDPARTITIONER::ConnectZone::getNodeCorresp() const
+const MEDCouplingSkyLineArray * MEDPARTITIONER::ConnectZone::getNodeCorresp() const
{
- return _node_corresp;
+ return (const MEDCouplingSkyLineArray *)_node_corresp;
}
const int *MEDPARTITIONER::ConnectZone::getFaceCorrespIndex() const
const int *MEDPARTITIONER::ConnectZone::getFaceCorrespValue() const
{
- return _face_corresp->getValue();
+ return _face_corresp->getValues();
}
int MEDPARTITIONER::ConnectZone::getFaceNumber() const
return _face_corresp->getNumberOf();
}
-const ParaMEDMEM::MEDCouplingSkyLineArray * MEDPARTITIONER::ConnectZone::getFaceCorresp() const
+const MEDCouplingSkyLineArray * MEDPARTITIONER::ConnectZone::getFaceCorresp() const
{
return _face_corresp;
}
for (map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++)
{
if ((iter->first).first==localEntity && (iter->first).second==distantEntity)
- return iter->second->getValue();
+ return iter->second->getValues();
}
return 0;
}
return 0;
}
-const ParaMEDMEM::MEDCouplingSkyLineArray *
+const MEDCouplingSkyLineArray *
MEDPARTITIONER::ConnectZone::getEntityCorresp(int localEntity, int distantEntity) const
{
typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
_local_domain_number=localDomainNumber;
}
-void MEDPARTITIONER::ConnectZone::setLocalMesh(ParaMEDMEM::MEDCouplingUMesh * localMesh)
+void MEDPARTITIONER::ConnectZone::setLocalMesh(MEDCouplingUMesh * localMesh)
{
_local_mesh=localMesh;
}
-void MEDPARTITIONER::ConnectZone::setDistantMesh(ParaMEDMEM::MEDCouplingUMesh * distantMesh)
+void MEDPARTITIONER::ConnectZone::setDistantMesh(MEDCouplingUMesh * distantMesh)
{
_distant_mesh=distantMesh;
}
*/
void MEDPARTITIONER::ConnectZone::setNodeCorresp(const int * nodeCorresp, int nbnode)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> indexArr( DataArrayInt::New() );
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> valueArr( DataArrayInt::New() );
+ MCAuto<DataArrayInt> indexArr( DataArrayInt::New() );
+ MCAuto<DataArrayInt> valueArr( DataArrayInt::New() );
indexArr->alloc( nbnode+1 );
valueArr->alloc( 2*nbnode );
int * index = indexArr->getPointer();
value[2*i+1]=nodeCorresp[2*i+1];
}
index[nbnode]=2*nbnode;
- setNodeCorresp( new MEDCouplingSkyLineArray( indexArr, valueArr ));
+ setNodeCorresp( MEDCouplingSkyLineArray::New( indexArr, valueArr ));
}
void MEDPARTITIONER::ConnectZone::setNodeCorresp(MEDCouplingSkyLineArray* array)
{
- if ( _node_corresp ) delete _node_corresp;
- _node_corresp = array;
+ MCAuto<MEDCouplingSkyLineArray> arr(array);
+ _node_corresp = arr;
}
/*! transforms an int array containing
*/
void MEDPARTITIONER::ConnectZone::setFaceCorresp(const int * faceCorresp, int nbface)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> indexArr( DataArrayInt::New() );
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> valueArr( DataArrayInt::New() );
+ MCAuto<DataArrayInt> indexArr( DataArrayInt::New() );
+ MCAuto<DataArrayInt> valueArr( DataArrayInt::New() );
indexArr->alloc( nbface+1 );
valueArr->alloc( 2*nbface );
int * index = indexArr->getPointer();
value[2*i+1]=faceCorresp[2*i+1];
}
index[nbface]=2*nbface;
- setFaceCorresp( new MEDCouplingSkyLineArray( indexArr, valueArr ));
+ setFaceCorresp( MEDCouplingSkyLineArray::New( indexArr, valueArr ));
}
void MEDPARTITIONER::ConnectZone::setFaceCorresp(MEDCouplingSkyLineArray* array)
{
- if ( _face_corresp ) delete _face_corresp;
- _face_corresp = array;
+ MCAuto<MEDCouplingSkyLineArray> arr (array);
+ _face_corresp = arr;
}
/*! transforms an int array containing
void MEDPARTITIONER::ConnectZone::setEntityCorresp(int localEntity, int distantEntity,
const int *entityCorresp, int nbentity)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> indexArr( DataArrayInt::New() );
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> valueArr( DataArrayInt::New() );
+ MCAuto<DataArrayInt> indexArr( DataArrayInt::New() );
+ MCAuto<DataArrayInt> valueArr( DataArrayInt::New() );
indexArr->alloc( nbentity+1 );
valueArr->alloc( 2*nbentity );
int * index = indexArr->getPointer();
value[2*i+1]=entityCorresp[2*i+1];
}
index[nbentity]=2*nbentity;
- setEntityCorresp( localEntity, distantEntity, new MEDCouplingSkyLineArray(indexArr,valueArr));
+ setEntityCorresp( localEntity, distantEntity, MEDCouplingSkyLineArray::New(indexArr,valueArr));
}
void MEDPARTITIONER::ConnectZone::setEntityCorresp(int localEntity, int distantEntity,
MEDCouplingSkyLineArray *array)
{
- ParaMEDMEM::MEDCouplingSkyLineArray * nullArray = 0;
- std::map < std::pair <int,int>, ParaMEDMEM::MEDCouplingSkyLineArray * >::iterator it;
+ MEDCouplingSkyLineArray * nullArray = 0;
+ std::map < std::pair <int,int>, MEDCouplingSkyLineArray * >::iterator it;
it = _entity_corresp.insert
( std::make_pair( std::make_pair(localEntity,distantEntity), nullArray )).first;
- if ( it->second != nullArray ) delete it->second;
+ if ( it->second != nullArray ) it->second->decrRef();
it->second = array;
}