SET(MEDCOUPLING_BUILD_DOC @MEDCOUPLING_BUILD_DOC@)
SET(MEDCOUPLING_BUILD_TESTS @MEDCOUPLING_BUILD_TESTS@)
SET(MEDCOUPLING_BUILD_GUI @MEDCOUPLING_BUILD_GUI@)
+SET(MEDCOUPLING_USE_64BIT_IDS @MEDCOUPLING_USE_64BIT_IDS@)
# Advanced options
new_elems_right.reserve(nbelems/2+1);
double max_left = -std::numeric_limits<double>::max();
double min_right= std::numeric_limits<double>::max();
- for (int i=0; i<nbelems;i++)
+ for (ConnType i=0; i<nbelems;i++)
{
- int elem;
+ ConnType elem;
if (elems!=0)
elem= elems[i];
else
tmp=0;
if(!new_elems_left.empty())
tmp=&(new_elems_left[0]);
- _left=new BBTree(bbs, tmp, level+1, (int)new_elems_left.size(),_epsilon);
+ _left=new BBTree(bbs, tmp, level+1, (ConnType)new_elems_left.size(),_epsilon);
tmp=0;
if(!new_elems_right.empty())
tmp=&(new_elems_right[0]);
- _right=new BBTree(bbs, tmp, level+1, (int)new_elems_right.size(),_epsilon);
+ _right=new BBTree(bbs, tmp, level+1, (ConnType)new_elems_right.size(),_epsilon);
}
// terminal node : return list of elements intersecting bb
if (_terminal)
{
- for (int i=0; i<_nbelems; i++)
+ for (ConnType i=0; i<_nbelems; i++)
{
const double* const bb_ptr=_bb+_elems[i]*2*dim;
bool intersects = true;
/*!
* This method is very close to getIntersectingElems except that it returns number of elems instead of elems themselves.
*/
- int getNbOfIntersectingElems(const double* bb)
+ ConnType getNbOfIntersectingElems(const double* bb)
{
// terminal node : return list of elements intersecting bb
- int ret(0);
+ ConnType ret(0);
if (_terminal)
{
- for (int i=0; i<_nbelems; i++)
+ for (ConnType i=0; i<_nbelems; i++)
{
const double* const bb_ptr=_bb+_elems[i]*2*dim;
bool intersects = true;
- int size()
+ ConnType size()
{
if (_terminal) return _nbelems;
return _left->size()+_right->size();
double _max_left;
double _min_right;
const double *_bb;
- std::vector<int> _elems;
+ std::vector<mcIdType> _elems;
double *_terminal;
- int _nbelems;
+ mcIdType _nbelems;
static const int MIN_NB_ELEMS=15;
static const int MAX_LEVEL=20;
public:
- BBTreeDst(const double* bbs, int* elems, int level, int nbelems):
+ BBTreeDst(const double* bbs, mcIdType* elems, int level, mcIdType nbelems):
_left(0),_right(0),_level(level),_bb(bbs),_terminal(0),_nbelems(nbelems)
{
if((nbelems < MIN_NB_ELEMS || level> MAX_LEVEL))
_terminal=new double[2*dim];
_elems.resize(nbelems);
- for (int i=0; i<nbelems; i++)
+ for (mcIdType i=0; i<nbelems; i++)
_elems[i]=elems?elems[i]:i;
if(_terminal)
{
return ;
}
double *nodes=new double[nbelems];
- for (int i=0; i<nbelems; i++)
+ for (mcIdType i=0; i<nbelems; i++)
nodes[i]=bbs[_elems[i]*dim*2+(level%dim)*2];
std::nth_element<double*>(nodes, nodes+nbelems/2, nodes+nbelems);
double median = *(nodes+nbelems/2);
delete [] nodes;
- std::vector<int> new_elems_left;
- std::vector<int> new_elems_right;
+ std::vector<mcIdType> new_elems_left;
+ std::vector<mcIdType> new_elems_right;
new_elems_left.reserve(nbelems/2+1);
new_elems_right.reserve(nbelems/2+1);
double max_left = -std::numeric_limits<double>::max();
double min_right= std::numeric_limits<double>::max();
- for(int i=0; i<nbelems;i++)
+ for(mcIdType i=0; i<nbelems;i++)
{
- int elem;
+ mcIdType elem;
if (elems!=0)
elem= elems[i];
else
}
_max_left=max_left;
_min_right=min_right;
- int *tmp;
+ mcIdType *tmp;
tmp=0;
if(!new_elems_left.empty())
tmp=&(new_elems_left[0]);
- _left=new BBTreeDst(bbs, tmp, level+1, (int)new_elems_left.size());
+ _left=new BBTreeDst(bbs, tmp, level+1, ToIdType(new_elems_left.size()));
tmp=0;
if(!new_elems_right.empty())
tmp=&(new_elems_right[0]);
- _right=new BBTreeDst(bbs, tmp, level+1, (int)new_elems_right.size());
+ _right=new BBTreeDst(bbs, tmp, level+1, ToIdType(new_elems_right.size()));
}
~BBTreeDst()
delete [] _terminal;
}
- void getElemsWhoseMinDistanceToPtSmallerThan(const double *pt, double minOfMaxDstsSq, std::vector<int>& elems) const
+ void getElemsWhoseMinDistanceToPtSmallerThan(const double *pt, double minOfMaxDstsSq, std::vector<mcIdType>& elems) const
{
if(_terminal)
{
- for(int i=0; i<_nbelems; i++)
+ for(mcIdType i=0; i<_nbelems; i++)
{
if(GetMinDistanceFromBBoxToPt(_bb+_elems[i]*2*dim,pt)<minOfMaxDstsSq)
elems.push_back(_elems[i]);
{
if(GetMinDistanceFromBBoxToPt(_terminal,pt)>minOfMaxDstsSq)//min it is not a bug
return ;
- for(int i=0; i<_nbelems; i++)
+ for(mcIdType i=0; i<_nbelems; i++)
{
minOfMaxDstsSq=std::min(minOfMaxDstsSq,GetMaxDistanceFromBBoxToPt(_bb+_elems[i]*2*dim,pt));
}
_terminal[2*j]=std::numeric_limits<double>::max();
_terminal[2*j+1]=-std::numeric_limits<double>::max();
}
- for(int i=0;i<_nbelems;i++)
+ for(mcIdType i=0;i<_nbelems;i++)
{
for(int j=0;j<dim;j++)
{
for (int idim=0; idim<dim; idim++)
{
double val1=pt[idim]-bbox[idim*2],val2=pt[idim]-bbox[idim*2+1];
- char pos=(( (0.<val1)-(val1<0.) )+( (0.<val2)-(val2<0.) ))/2;// sign(val) = (0.<val)-(val<0.)
+ char pos=static_cast<char>((( (0.<val1)-(val1<0.) )+( (0.<val2)-(val2<0.) ))/2);// sign(val) = (0.<val)-(val<0.)
if(pos!=0)
{
double x=pos==1?val2:val1;
new_elems_right.reserve(nbelems/2+1);
double max_left = -std::numeric_limits<double>::max();
double min_right= std::numeric_limits<double>::max();
- for(int i=0;i<nbelems;i++)
+ for(ConnType i=0;i<nbelems;i++)
{
- int elem;
+ ConnType elem;
if(elems!=0)
elem= elems[i];
else
tmp=0;
if(!new_elems_left.empty())
tmp=&(new_elems_left[0]);
- _left=new BBTreePts(pts, tmp, level+1, (int)new_elems_left.size(),_epsilon);
+ _left=new BBTreePts(pts, tmp, level+1, (ConnType)new_elems_left.size(),_epsilon);
tmp=0;
if(!new_elems_right.empty())
tmp=&(new_elems_right[0]);
- _right=new BBTreePts(pts, tmp, level+1, (int)new_elems_right.size(),_epsilon);
+ _right=new BBTreePts(pts, tmp, level+1, (ConnType)new_elems_right.size(),_epsilon);
}
return _left->getElementsAroundPoint2(xx,threshold,elem);
if(xx[_level%dim]-s>_max_left)
return _right->getElementsAroundPoint2(xx,threshold,elem);
- int eleml,elemr;
+ ConnType eleml,elemr;
double retl=_left->getElementsAroundPoint2(xx,threshold,eleml);
double retr=_right->getElementsAroundPoint2(xx,threshold,elemr);
if(retl<retr)
_right->getElementsAroundPoint(xx,elems);
}
- int size() const
+ ConnType size() const
{
if(_terminal)
return _nbelems;
std::vector<double> CoordsT;
const ConnType *startOfCellNodeConnT=Intersector3DP1P1<MyMeshType,MyMatrix>::getStartConnOfTargetCell(targetCell);
Intersector3DP1P1<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),CoordsT);
- int nbOfNodesT=CoordsT.size()/SPACEDIM;
+ std::size_t nbOfNodesT=CoordsT.size()/SPACEDIM;
const double *coordsS=Intersector3DP1P1<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
- for(int nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
+ for(std::size_t nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
{
typename MyMatrix::value_type& resRow=res[OTT<ConnType,numPol>::ind2C(startOfCellNodeConnT[nodeIdT])];
if(!resRow.empty())
//
std::vector<ConnType> connOfCurCellS;
Intersector3DP1P1<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
- if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) )
+ if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) )
{
double resLoc[4];
std::vector<double> localCoordsS;
// Note: assumes long is at least 32 bits.
enum { _S_num_primes = 28 };
- static const unsigned long __stl_prime_list[_S_num_primes] =
+ static const unsigned long long __stl_prime_list[_S_num_primes] =
{
- 53ul, 97ul, 193ul, 389ul, 769ul,
- 1543ul, 3079ul, 6151ul, 12289ul, 24593ul,
- 49157ul, 98317ul, 196613ul, 393241ul, 786433ul,
- 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul,
- 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,
- 1610612741ul, 3221225473ul, 4294967291ul
+ 53ull, 97ull, 193ull, 389ull, 769ull,
+ 1543ull, 3079ull, 6151ull, 12289ull, 24593ull,
+ 49157ull, 98317ull, 196613ull, 393241ull, 786433ull,
+ 1572869ull, 3145739ull, 6291469ull, 12582917ull, 25165843ull,
+ 50331653ull, 100663319ull, 201326611ull, 402653189ull, 805306457ull,
+ 1610612741ull, 3221225473ull, 4294967291ull
};
- inline unsigned long
- __stl_next_prime(unsigned long __n)
+ inline unsigned long long
+ __stl_next_prime(unsigned long long __n)
{
- const unsigned long* __first = __stl_prime_list;
- const unsigned long* __last = __stl_prime_list + (int)_S_num_primes;
- const unsigned long* pos = std::lower_bound(__first, __last, __n);
+ const unsigned long long* __first = __stl_prime_list;
+ const unsigned long long* __last = __stl_prime_list + (int)_S_num_primes;
+ const unsigned long long* pos = std::lower_bound(__first, __last, __n);
return pos == __last ? *(__last - 1) : *pos;
}
void clear();
private:
- size_type _M_next_size(size_type __n) const { return __stl_next_prime(__n); }
+ size_type _M_next_size(size_type __n) const { return static_cast<size_type>(__stl_next_prime(__n)); }
void _M_initialize_buckets(size_type __n)
{
${CMAKE_CURRENT_SOURCE_DIR}/GaussPoints
)
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
SET(PLATFORM_MMAP)
IF(NOT WIN32)
SET(PLATFORM_MMAP "-D_POSIX_MAPPED_FILES")
/*!
* Equivalent to getNumberOfSons except that this method deals with dynamic type.
*/
- unsigned CellModel::getNumberOfSons2(const int *conn, int lgth) const
+ unsigned CellModel::getNumberOfSons2(const mcIdType *conn, mcIdType lgth) const
{
if(!isDynamic())
return getNumberOfSons();
if(_dim==2)
{
if(_type==NORM_POLYGON)
- return lgth;
+ return FromIdType<unsigned>(lgth);
else
- return lgth/2;
+ return FromIdType<unsigned>(lgth/2);
}
else if(_dim==1)
- return lgth;//NORM_POLYL
+ return FromIdType<unsigned>(lgth);//NORM_POLYL
else
- return std::count(conn,conn+lgth,-1)+1;
+ return (unsigned)std::count(conn,conn+lgth,-1)+1;
}
- unsigned CellModel::getNumberOfEdgesIn3D(const int *conn, int lgth) const
+ unsigned CellModel::getNumberOfEdgesIn3D(const mcIdType *conn, mcIdType lgth) const
{
if(!isDynamic())
return _nb_of_little_sons;
else//polyhedron
- return (lgth-std::count(conn,conn+lgth,-1))/2;
+ return FromIdType<unsigned>(lgth-ToIdType(std::count(conn,conn+lgth,-1)/2));
}
/*!
/*!
* \b WARNING this method do not manage correctly types that return true at the call of isDynamic. Use fillSonCellNodalConnectivity2 instead.
*/
- unsigned CellModel::fillSonCellNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn) const
+ unsigned CellModel::fillSonCellNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn) const
{
unsigned nbOfTurnLoop=_nb_of_sons_con[sonId];
const unsigned *sonConn=_sons_con[sonId];
return nbOfTurnLoop;
}
- unsigned CellModel::fillSonCellNodalConnectivity2(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const
+ unsigned CellModel::fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const
{
typeOfSon=getSonType2(sonId);
if(!isDynamic())
}
else if(_dim==3)
{//polyedron
- const int *where=nodalConn;
+ const mcIdType *where=nodalConn;
for(int i=0;i<sonId;i++)
{
where=std::find(where,nodalConn+lgth,-1);
where++;
}
- const int *where2=std::find(where,nodalConn+lgth,-1);
+ const mcIdType *where2=std::find(where,nodalConn+lgth,-1);
std::copy(where,where2,sonNodalConn);
- return where2-where;
+ return (unsigned)(where2-where);
}
else
throw INTERP_KERNEL::Exception("CellModel::fillSonCellNodalConnectivity2 : no sons on NORM_POLYL !");
/*!
* Equivalent to CellModel::fillSonCellNodalConnectivity2 except for HEXA8 where the order of sub faces is not has MED file numbering for transformation HEXA8->HEXA27
*/
- unsigned CellModel::fillSonCellNodalConnectivity4(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const
+ unsigned CellModel::fillSonCellNodalConnectivity4(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const
{
if(_type==NORM_HEXA8)
{
return fillSonCellNodalConnectivity2(sonId,nodalConn,lgth,sonNodalConn,typeOfSon);
}
- unsigned CellModel::fillSonEdgesNodalConnectivity3D(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const
+ unsigned CellModel::fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const
{
if(!isDynamic())
{
/*!
* \sa getNumberOfMicroEdges
*/
- unsigned CellModel::fillMicroEdgeNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn, NormalizedCellType& typeOfSon) const
+ unsigned CellModel::fillMicroEdgeNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const
{
if(isQuadratic())
{
}
}
- void CellModel::changeOrientationOf2D(int *nodalConn, unsigned int sz) const
+ void CellModel::changeOrientationOf2D(mcIdType *nodalConn, unsigned int sz) const
{
if(sz<1)
return ;
if(!isQuadratic())
{
- std::vector<int> tmp(sz-1);
+ std::vector<mcIdType> tmp(sz-1);
std::copy(nodalConn+1,nodalConn+sz,tmp.rbegin());
std::copy(tmp.begin(),tmp.end(),nodalConn+1);
}
else
{
unsigned int sz2(sz/2);
- std::vector<int> tmp0(sz2-1),tmp1(sz2);
+ std::vector<mcIdType> tmp0(sz2-1),tmp1(sz2);
std::copy(nodalConn+1,nodalConn+sz2,tmp0.rbegin());
std::copy(nodalConn+sz2,nodalConn+sz,tmp1.rbegin());
std::copy(tmp0.begin(),tmp0.end(),nodalConn+1);
}
}
- void CellModel::changeOrientationOf1D(int *nodalConn, unsigned int sz) const
+ void CellModel::changeOrientationOf1D(mcIdType *nodalConn, unsigned int sz) const
{
if(!isDynamic())
{
}
else
{
- std::vector<int> tmp(sz-1);
+ std::vector<mcIdType> tmp(sz-1);
std::copy(nodalConn+1,nodalConn+sz,tmp.rbegin());
std::copy(tmp.begin(),tmp.end(),nodalConn+1);
}
*/
//================================================================================
- unsigned CellModel::getNumberOfNodesConstituentTheSon2(unsigned sonId, const int *nodalConn, int lgth) const
+ unsigned CellModel::getNumberOfNodesConstituentTheSon2(unsigned sonId, const mcIdType *nodalConn, mcIdType lgth) const
{
if(!isDynamic())
return getNumberOfNodesConstituentTheSon(sonId);
}
else if(_dim==3)
{//polyedron
- const int *where=nodalConn;
+ const mcIdType *where=nodalConn;
for(unsigned int i=0;i<sonId;i++)
{
where=std::find(where,nodalConn+lgth,-1);
where++;
}
- const int *where2=std::find(where,nodalConn+lgth,-1);
- return where2-where;
+ const mcIdType *where2=std::find(where,nodalConn+lgth,-1);
+ return (unsigned)(where2-where);
}
else
throw INTERP_KERNEL::Exception("CellModel::getNumberOfNodesConstituentTheSon2 : no sons on NORM_POLYL !");
* If not an exception will be thrown.
* @return True if two cells have same orientation, false if not.
*/
- bool CellModel::getOrientationStatus(unsigned lgth, const int *conn1, const int *conn2) const
+ bool CellModel::getOrientationStatus(mcIdType lgth, const mcIdType *conn1, const mcIdType *conn2) const
{
if(_dim!=1 && _dim!=2)
throw INTERP_KERNEL::Exception("CellModel::getOrientationStatus : invalid dimension ! Must be 1 or 2 !");
if(!_quadratic)
{
- std::vector<int> tmp(2*lgth);
- std::vector<int>::iterator it=std::copy(conn1,conn1+lgth,tmp.begin());
+ std::vector<mcIdType> tmp(2*lgth);
+ std::vector<mcIdType>::iterator it=std::copy(conn1,conn1+lgth,tmp.begin());
std::copy(conn1,conn1+lgth,it);
it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth);
if(it==tmp.begin())
return true;
if(it!=tmp.end())
return _dim!=1;
- std::vector<int>::reverse_iterator it2=std::search(tmp.rbegin(),tmp.rend(),conn2,conn2+lgth);
+ std::vector<mcIdType>::reverse_iterator it2=std::search(tmp.rbegin(),tmp.rend(),conn2,conn2+lgth);
if(it2!=tmp.rend())
return false;
throw INTERP_KERNEL::Exception("CellModel::getOrientationStatus : Request of orientation status of non equal connectively cells !");
{
if(_dim!=1)
{
- std::vector<int> tmp(lgth);
- std::vector<int>::iterator it=std::copy(conn1,conn1+lgth/2,tmp.begin());
+ std::vector<mcIdType> tmp(lgth);
+ std::vector<mcIdType>::iterator it=std::copy(conn1,conn1+lgth/2,tmp.begin());
std::copy(conn1,conn1+lgth/2,it);
it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth/2);
- int d=std::distance(tmp.begin(),it);
+ std::size_t d=std::distance(tmp.begin(),it);
if(it==tmp.end())
return false;
it=std::copy(conn1+lgth/2,conn1+lgth,tmp.begin());
it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth);
if(it==tmp.end())
return false;
- int d2=std::distance(tmp.begin(),it);
+ std::size_t d2=std::distance(tmp.begin(),it);
return d==d2;
}
else
{
- int p=(lgth+1)/2;
- std::vector<int> tmp(2*p);
- std::vector<int>::iterator it=std::copy(conn1,conn1+p,tmp.begin());
+ mcIdType p=(lgth+1)/2;
+ std::vector<mcIdType> tmp(2*p);
+ std::vector<mcIdType>::iterator it=std::copy(conn1,conn1+p,tmp.begin());
std::copy(conn1,conn1+p,it);
it=std::search(tmp.begin(),tmp.end(),conn2,conn2+p);
- int d=std::distance(tmp.begin(),it);
+ std::size_t d=std::distance(tmp.begin(),it);
if(it==tmp.end())
return false;
tmp.resize(2*p-2);
it=std::search(tmp.begin(),tmp.end(),conn2+p,conn2+lgth);
if(it==tmp.end())
return false;
- int d2=std::distance(tmp.begin(),it);
+ std::size_t d2=std::distance(tmp.begin(),it);
return d==d2;
}
}
#include "INTERPKERNELDefines.hxx"
#include "NormalizedUnstructuredMesh.hxx"
+#include "MCIdType.hxx"
#include <map>
//! sonId is in C format.
INTERPKERNEL_EXPORT const unsigned *getNodesConstituentTheSon(unsigned sonId) const { return _sons_con[sonId]; }
INTERPKERNEL_EXPORT const unsigned *getNodesConstituentTheLittleSon(unsigned littleSonId) const { return _little_sons_con[littleSonId]; }
- INTERPKERNEL_EXPORT bool getOrientationStatus(unsigned lgth, const int *conn1, const int *conn2) const;
+ INTERPKERNEL_EXPORT bool getOrientationStatus(mcIdType lgth, const mcIdType *conn1, const mcIdType *conn2) const;
INTERPKERNEL_EXPORT unsigned getNumberOfNodes() const { return _nb_of_pts; }
INTERPKERNEL_EXPORT unsigned getNumberOfSons() const { return _nb_of_sons; }
- INTERPKERNEL_EXPORT unsigned getNumberOfSons2(const int *conn, int lgth) const;
- INTERPKERNEL_EXPORT unsigned getNumberOfEdgesIn3D(const int *conn, int lgth) const;
+ INTERPKERNEL_EXPORT unsigned getNumberOfSons2(const mcIdType *conn, mcIdType lgth) const;
+ INTERPKERNEL_EXPORT unsigned getNumberOfEdgesIn3D(const mcIdType *conn, mcIdType lgth) const;
INTERPKERNEL_EXPORT unsigned getNumberOfMicroEdges() const;
INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon(unsigned sonId) const { return _nb_of_sons_con[sonId]; }
- INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon2(unsigned sonId, const int *nodalConn, int lgth) const;
+ INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon2(unsigned sonId, const mcIdType *nodalConn, mcIdType lgth) const;
INTERPKERNEL_EXPORT NormalizedCellType getExtrudedType() const { return _extruded_type; }
INTERPKERNEL_EXPORT NormalizedCellType getCorrespondingPolyType() const;
INTERPKERNEL_EXPORT NormalizedCellType getReverseExtrudedType() const { return _reverse_extruded_type; }
INTERPKERNEL_EXPORT NormalizedCellType getQuadraticType2() const { return _quadratic_type2; }
INTERPKERNEL_EXPORT NormalizedCellType getSonType(unsigned sonId) const { return _sons_type[sonId]; }
INTERPKERNEL_EXPORT NormalizedCellType getSonType2(unsigned sonId) const;
- INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn) const;
- INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity2(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const;
- INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity4(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const;
- INTERPKERNEL_EXPORT unsigned fillSonEdgesNodalConnectivity3D(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const;
- INTERPKERNEL_EXPORT unsigned fillMicroEdgeNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn, NormalizedCellType& typeOfSon) const;
- INTERPKERNEL_EXPORT void changeOrientationOf2D(int *nodalConn, unsigned int sz) const;
- INTERPKERNEL_EXPORT void changeOrientationOf1D(int *nodalConn, unsigned int sz) const;
+ INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn) const;
+ INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const;
+ INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity4(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const;
+ INTERPKERNEL_EXPORT unsigned fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const;
+ INTERPKERNEL_EXPORT unsigned fillMicroEdgeNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const;
+ INTERPKERNEL_EXPORT void changeOrientationOf2D(mcIdType *nodalConn, unsigned int sz) const;
+ INTERPKERNEL_EXPORT void changeOrientationOf1D(mcIdType *nodalConn, unsigned int sz) const;
INTERPKERNEL_EXPORT DiameterCalculator *buildInstanceOfDiameterCalulator(int spaceDim) const;
INTERPKERNEL_EXPORT OrientationInverter *buildOrientationInverter() const;
private:
/*** Compute the intersection area ***/
INTERP_KERNEL::PolygonAlgorithms<SPACEDIM> P(_epsilon, PlanarIntersector<MyMeshType,MyMatrix>::_precision);
std::deque<double> inter = P.intersectConvexPolygons(&CoordsT[0], &CoordsS[0],
- CoordsT.size()/SPACEDIM, CoordsS.size()/SPACEDIM);
+ int(CoordsT.size())/SPACEDIM, int(CoordsS.size())/SPACEDIM);
double area[SPACEDIM];
int nb_inter =((int)inter.size())/SPACEDIM;
for(int i = 1; i<nb_inter-1; i++)
bool isSourceQuad)
{
double result = 0;
- int nbOfNodesS=sourceCoords.size()/SPACEDIM;
+ int nbOfNodesS=int(sourceCoords.size())/SPACEDIM;
/*** Compute the intersection area ***/
INTERP_KERNEL::PolygonAlgorithms<SPACEDIM> P(_epsilon, PlanarIntersector<MyMeshType,MyMatrix>::_precision);
std::deque<double> inter = P.intersectConvexPolygons(quadrangle, &sourceCoords[0],
- 4, nbOfNodesS);
+ 4, nbOfNodesS);
double area[SPACEDIM];
int nb_inter =((int)inter.size())/SPACEDIM;
for(int i = 1; i<nb_inter-1; i++)
const std::vector<double>& sourceCoords)
{
double result = 0;
- int nbOfNodesS=sourceCoords.size()/SPACEDIM;
- int nbOfNodesT=targetCoords.size()/SPACEDIM;
+ int nbOfNodesS=int(sourceCoords.size())/SPACEDIM;
+ int nbOfNodesT=int(targetCoords.size())/SPACEDIM;
/*** Compute the intersection area ***/
INTERP_KERNEL::PolygonAlgorithms<SPACEDIM> P(_epsilon, PlanarIntersector<MyMeshType,MyMatrix>::_precision);
std::deque<double> inter = P.intersectConvexPolygons(&targetCoords[0], &sourceCoords[0],
struct TDualSegment
{
std::vector<double> _coords;
- int _nodeId; // in mesh mode
+ ConnType _nodeId; // in mesh mode
};
static void getDualSegments(ConnType icell,
const MyMeshType& mesh,
int ibox=0;
for(long icell=0; icell<nbelems; icell++)
{
- int nb_nodes_per_elem = conn_index[icell+1]-conn_index[icell];
+ ConnType nb_nodes_per_elem = conn_index[icell+1]-conn_index[icell];
//initializing bounding box limits
for(int idim=0; idim<SPACEDIM; idim++)
{
bbox[2*SPACEDIM*ibox+2*idim+1] = -std::numeric_limits<double>::max();
}
//updating the bounding box with each node of the element
- for (int j=0; j<nb_nodes_per_elem; j++)
+ for (ConnType j=0; j<nb_nodes_per_elem; j++)
{
const double* coord_node = coords +
SPACEDIM*OTT<ConnType,numPol>
void CurveIntersector<MyMeshType,MyMatrix>::adjustBoundingBoxes (std::vector<double>& bbox,
double adjustmentEpsAbs)
{
- long size = bbox.size()/(2*SPACEDIM);
- for (int i=0; i<size; i++)
+ std::size_t size = bbox.size()/(2*SPACEDIM);
+ for (std::size_t i=0; i<size; i++)
{
for(int idim=0; idim<SPACEDIM; idim++)
{
template<class MyMeshType, class MyMatrix>
bool CurveIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT) const
{
- int nbNodesT(_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1] - _connIndexT[OTT<ConnType,numPol>::ind2C(icellT)]);
+ ConnType nbNodesT(_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1] - _connIndexT[OTT<ConnType,numPol>::ind2C(icellT)]);
coordsT.resize(SPACEDIM*nbNodesT);
for (ConnType iT=0; iT<nbNodesT; iT++)
{
template<class MyMeshType, class MyMatrix>
typename MyMeshType::MyConnType CurveIntersector<MyMeshType,MyMatrix>::getNodeIdOfTargetCellAt(ConnType icellT, ConnType nodeIdInCellT) const
{
- int nbNodesT(_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1] - _connIndexT[OTT<ConnType,numPol>::ind2C(icellT)]);
+ ConnType nbNodesT(_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1] - _connIndexT[OTT<ConnType,numPol>::ind2C(icellT)]);
if(nodeIdInCellT>=0 && nodeIdInCellT<nbNodesT)
return OTT<ConnType,numPol>::coo2C(_connectT[OTT<ConnType,numPol>::conn2C(_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)]+nodeIdInCellT)]);
else
template<class MyMeshType, class MyMatrix>
bool CurveIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(ConnType icellS, std::vector<double>& coordsS) const
{
- int nbNodesS = _connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1] - _connIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
+ ConnType nbNodesS = _connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1] - _connIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
coordsS.resize(SPACEDIM*nbNodesS);
for(ConnType iS=0; iS<nbNodesS; iS++)
{
template<class MyMeshType, class MyMatrix>
typename MyMeshType::MyConnType CurveIntersector<MyMeshType,MyMatrix>::getNodeIdOfSourceCellAt(ConnType icellS, ConnType nodeIdInCellS) const
{
- int nbNodesS(_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1] - _connIndexS[OTT<ConnType,numPol>::ind2C(icellS)]);
+ ConnType nbNodesS(_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1] - _connIndexS[OTT<ConnType,numPol>::ind2C(icellS)]);
if(nodeIdInCellS>=0 && nodeIdInCellS<nbNodesS)
return OTT<ConnType,numPol>::coo2C(_connectS[OTT<ConnType,numPol>::conn2C(_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)]+nodeIdInCellS)]);
else
std::vector<TDualSegment>& segments)
{
// get coordinates of cell nodes
- int nbNodes;
- std::vector<double> ncoords;
- std::vector<int> nodeIds;
+ ConnType nbNodes;
+ std::vector<double> ncoords;
+ std::vector<ConnType> nodeIds;
{
const ConnType *connect = mesh.getConnectivityPtr();
const ConnType *connIndex = mesh.getConnectivityIndexPtr();
ncoords.resize(SPACEDIM*nbNodes);
nodeIds.resize(nbNodes);
- for(int i=0; i<nbNodes; i++)
+ for(ConnType i=0; i<nbNodes; i++)
for(int idim=0; idim<SPACEDIM; idim++)
{
nodeIds[i] = connect[OTT<ConnType,numPol>::conn2C(connIndex[OTT<ConnType,numPol>::ind2C(icell)]+i)];
// fill segments
segments.clear();
segments.reserve( 2*nbNodes );
- for(int i=0; i<nbNodes-1; i++)
+ for(ConnType i=0; i<nbNodes-1; i++)
{
segments.push_back(TDualSegment());
TDualSegment& seg1 = segments.back();
double precision, double tolerance,
double medianLine, int printLevel);
public:
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
void intersectCells(ConnType icellT,
const std::vector<ConnType>& icellsS, MyMatrix& res);
};
}
template<class MyMeshType, class MyMatrix>
- int CurveIntersectorP0P0<MyMeshType,MyMatrix>
+ typename MyMeshType::MyConnType CurveIntersectorP0P0<MyMeshType,MyMatrix>
::getNumberOfRowsOfResMatrix() const
{
return BASE_INTERSECTOR::_meshT.getNumberOfElements();
}
template<class MyMeshType, class MyMatrix>
- int CurveIntersectorP0P0<MyMeshType,MyMatrix>
+ typename MyMeshType::MyConnType CurveIntersectorP0P0<MyMeshType,MyMatrix>
::getNumberOfColsOfResMatrix() const
{
return BASE_INTERSECTOR::_meshS.getNumberOfElements();
{
typename MyMatrix::value_type& resRow = res[icellT];
std::vector<double> coordsT;
- int t, nbSegT = 1 + BASE_INTERSECTOR::getRealTargetCoordinates(icellT,coordsT);
+ ConnType t, nbSegT = 1 + BASE_INTERSECTOR::getRealTargetCoordinates(icellT,coordsT);
for ( t = 0; t < nbSegT; ++t )
for(typename std::vector<ConnType>::const_iterator
iter=icellsS.begin(); iter!=icellsS.end(); iter++)
{
- int iS = *iter;
+ ConnType iS = *iter;
std::vector<double> coordsS;
- int s, nbSegS = 1 + BASE_INTERSECTOR::getRealSourceCoordinates(iS,coordsS);
+ ConnType s, nbSegS = 1 + BASE_INTERSECTOR::getRealSourceCoordinates(iS,coordsS);
for ( s = 0; s < nbSegS; ++s )
{
double surf = BASE_INTERSECTOR::intersectSegments(&coordsT[0] + t*SPACEDIM,
public:
void intersectCells(ConnType icellT,
const std::vector<ConnType>& icellsS, MyMatrix& res);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
};
}
}
template<class MyMeshType, class MyMatrix>
- int CurveIntersectorP0P1<MyMeshType,MyMatrix>
+ typename MyMeshType::MyConnType CurveIntersectorP0P1<MyMeshType,MyMatrix>
::getNumberOfRowsOfResMatrix() const
{
return BASE_INTERSECTOR::_meshT.getNumberOfNodes();
}
template<class MyMeshType, class MyMatrix>
- int CurveIntersectorP0P1<MyMeshType,MyMatrix>
+ typename MyMeshType::MyConnType CurveIntersectorP0P1<MyMeshType,MyMatrix>
::getNumberOfColsOfResMatrix() const
{
return BASE_INTERSECTOR::_meshS.getNumberOfElements();
{
std::vector<typename BASE_INTERSECTOR::TDualSegment> segmentsT;
BASE_INTERSECTOR::getDualSegments( icellT, BASE_INTERSECTOR::_meshT, segmentsT);
- for ( int t = 0; t < (int)segmentsT.size(); ++t )
+ for ( ConnType t = 0; t < (ConnType)segmentsT.size(); ++t )
{
typename MyMatrix::value_type& resRow = res[ OTT<ConnType,numPol>::ind2C( segmentsT[t]._nodeId )];
for(typename std::vector<ConnType>::const_iterator
iter=icellsS.begin(); iter!=icellsS.end(); iter++)
{
- int iS = *iter;
+ ConnType iS = *iter;
std::vector<double> coordsS;
- int s, nbSegS = 1 + BASE_INTERSECTOR::getRealSourceCoordinates(iS,coordsS);
+ ConnType s, nbSegS = 1 + BASE_INTERSECTOR::getRealSourceCoordinates(iS,coordsS);
for ( s = 0; s < nbSegS; ++s )
{
double surf = BASE_INTERSECTOR::intersectSegments(&segmentsT[t]._coords[0],
double precision, double tolerance, double medianLine, int printLevel);
public:
void intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
};
}
}
template<class MyMeshType, class MyMatrix>
- int CurveIntersectorP1P0<MyMeshType,MyMatrix>
+ typename MyMeshType::MyConnType CurveIntersectorP1P0<MyMeshType,MyMatrix>
::getNumberOfRowsOfResMatrix() const
{
return BASE_INTERSECTOR::_meshT.getNumberOfElements();
}
template<class MyMeshType, class MyMatrix>
- int CurveIntersectorP1P0<MyMeshType,MyMatrix>
+ typename MyMeshType::MyConnType CurveIntersectorP1P0<MyMeshType,MyMatrix>
::getNumberOfColsOfResMatrix() const
{
return BASE_INTERSECTOR::_meshS.getNumberOfNodes();
typename MyMatrix::value_type& resRow = res[ icellT ];
std::vector<typename BASE_INTERSECTOR::TDualSegment> segmentsS;
std::vector<double> coordsT;
- int t, nbSegT = 1 + BASE_INTERSECTOR::getRealTargetCoordinates(icellT,coordsT);
+ ConnType t, nbSegT = 1 + BASE_INTERSECTOR::getRealTargetCoordinates(icellT,coordsT);
for ( t = 0; t < nbSegT; ++t )
for(typename std::vector<ConnType>::const_iterator
iter=icellsS.begin(); iter!=icellsS.end(); iter++)
{
- int iS = *iter;
+ ConnType iS = *iter;
BASE_INTERSECTOR::getDualSegments( OTT<ConnType,numPol>::ind2C(iS),
BASE_INTERSECTOR::_meshS, segmentsS);
- for ( int s = 0; s < (int)segmentsS.size(); ++s )
+ for ( ConnType s = 0; s < (ConnType)segmentsS.size(); ++s )
{
double surf = BASE_INTERSECTOR::intersectSegments(&segmentsS[s]._coords[0],
&coordsT[0] + t*SPACEDIM);
if(surf!=0.)
{
- int nS = segmentsS[s]._nodeId;
+ ConnType nS = segmentsS[s]._nodeId;
typename MyMatrix::value_type::const_iterator iterRes=resRow.find(nS);
if(iterRes==resRow.end())
resRow.insert(std::make_pair(nS,surf));
public:
void intersectCells(ConnType icellT,
const std::vector<ConnType>& icellsS, MyMatrix& res);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
};
}
}
template<class MyMeshType, class MyMatrix>
- int CurveIntersectorP1P1<MyMeshType,MyMatrix>
+ typename MyMeshType::MyConnType CurveIntersectorP1P1<MyMeshType,MyMatrix>
::getNumberOfRowsOfResMatrix() const
{
return BASE_INTERSECTOR::_meshT.getNumberOfNodes();
}
template<class MyMeshType, class MyMatrix>
- int CurveIntersectorP1P1<MyMeshType,MyMatrix>
+ typename MyMeshType::MyConnType CurveIntersectorP1P1<MyMeshType,MyMatrix>
::getNumberOfColsOfResMatrix() const
{
return BASE_INTERSECTOR::_meshS.getNumberOfNodes();
{
std::vector<typename BASE_INTERSECTOR::TDualSegment> segmentsT, segmentsS;
BASE_INTERSECTOR::getDualSegments( icellT, BASE_INTERSECTOR::_meshT, segmentsT);
- for ( int t = 0; t < (int)segmentsT.size(); ++t )
+ for ( ConnType t = 0; t < (ConnType)segmentsT.size(); ++t )
{
typename MyMatrix::value_type& resRow = res[ OTT<ConnType,numPol>::ind2C( segmentsT[t]._nodeId )];
for(typename std::vector<ConnType>::const_iterator
iter=icellsS.begin(); iter!=icellsS.end(); iter++)
{
- int iS = *iter;
+ ConnType iS = *iter;
BASE_INTERSECTOR::getDualSegments( OTT<ConnType,numPol>::ind2C(iS),
BASE_INTERSECTOR::_meshS, segmentsS);
- for ( int s = 0; s < (int)segmentsS.size(); ++s )
+ for ( ConnType s = 0; s < (ConnType)segmentsS.size(); ++s )
{
double surf = BASE_INTERSECTOR::intersectSegments(&segmentsT[t]._coords[0],
&segmentsS[s]._coords[0]);
if(surf!=0.)
{
- int nS = segmentsS[s]._nodeId;
+ ConnType nS = segmentsS[s]._nodeId;
typename MyMatrix::value_type::const_iterator iterRes=resRow.find(nS);
if(iterRes==resRow.end())
resRow.insert(std::make_pair(nS,surf));
double medianLine, int printLevel);
public:
void intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
private:
static void AppendValueInMatrix(MyMatrix& res, ConnType nodeIdT, ConnType nodeIdS0, double val0, ConnType nodeIdS1, double val1);
static void AppendValueInMatrix2(typename MyMatrix::value_type& resRow, ConnType nodeIdS0, double val0);
}
template<class MyMeshType, class MyMatrix>
- int CurveIntersectorP1P1PL<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType CurveIntersectorP1P1PL<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
{
return CurveIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfNodes();
}
template<class MyMeshType, class MyMatrix>
- int CurveIntersectorP1P1PL<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType CurveIntersectorP1P1PL<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
{
return CurveIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfNodes();
}
}
template<class Evaluator>
-void ComputeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr)
+void ComputeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr)
{
Evaluator evtor;
NormalizedCellType ct(Evaluator::TYPE);
int cti((int) ct);
- for(const int *it=bgIds;it!=endIds;it++)
+ for(const mcIdType *it=bgIds;it!=endIds;it++)
{
- int offset(indPtr[*it]);
+ mcIdType offset(indPtr[*it]);
if(connPtr[offset]==cti)
resPtr[*it]=evtor.ComputeForOneCellInternal(connPtr+offset+1,connPtr+indPtr[(*it)+1],coordsPtr);
else
}
template<class Evaluator>
-void ComputeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr)
+void ComputeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr)
{
Evaluator evtor;
NormalizedCellType ct(Evaluator::TYPE);
int cti((int) ct);
- for(int it=bgId;it<endId;it++)
+ for(mcIdType it=bgId;it<endId;it++)
{
- int offset(indPtr[it]);
+ mcIdType offset(indPtr[it]);
if(connPtr[offset]==cti)
resPtr[it]=evtor.ComputeForOneCellInternal(connPtr+offset+1,connPtr+indPtr[it+1],coordsPtr);
else
}
template<class Evaluator>
-void ComputeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr)
+void ComputeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr)
{
Evaluator evtor;
NormalizedCellType ct(Evaluator::TYPE);
const CellModel& cm(CellModel::GetCellModel(ct));
unsigned nbNodes(cm.getNumberOfNodes());
- const int *ptr(connPtr);
- for(int i=0;i<nbOfCells;i++,ptr+=nbNodes,resPtr++)
+ const mcIdType *ptr(connPtr);
+ for(mcIdType i=0;i<nbOfCells;i++,ptr+=nbNodes,resPtr++)
*resPtr=evtor.ComputeForOneCellInternal(ptr,ptr+nbNodes,coordsPtr);
}
//=================================================================
-double DiameterCalulatorTRI3S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorTRI3S2::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==3)
{
throw Exception("DiameterCalulatorTRI3S2::ComputeForOneCellInternal : input connectivity must be of size 3 !");
}
-void DiameterCalulatorTRI3S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI3S2::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorTRI3S2>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTRI3S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI3S2::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorTRI3S2>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTRI3S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI3S2::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorTRI3S2>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorTRI3S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorTRI3S3::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==3)
{
throw Exception("DiameterCalulatorTRI3S2::ComputeForOneCellInternal : input connectivity must be of size 3 !");
}
-void DiameterCalulatorTRI3S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI3S3::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorTRI3S3>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTRI3S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI3S3::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorTRI3S3>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTRI3S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI3S3::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorTRI3S3>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorTRI6S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorTRI6S2::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==6)
return DiameterCalulatorTRI3S2::ComputeForOneCellInternal(bg,bg+3,coordsPtr);
throw Exception("DiameterCalulatorTRI6S2::ComputeForOneCellInternal : input connectivity must be of size 6 !");
}
-void DiameterCalulatorTRI6S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI6S2::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorTRI6S2>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTRI6S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI6S2::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorTRI6S2>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTRI6S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI6S2::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorTRI6S2>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorTRI6S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorTRI6S3::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==6)
return DiameterCalulatorTRI3S3::ComputeForOneCellInternal(bg,bg+3,coordsPtr);
throw Exception("DiameterCalulatorTRI6S3::ComputeForOneCellInternal : input connectivity must be of size 6 !");
}
-void DiameterCalulatorTRI6S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI6S3::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorTRI6S3>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTRI6S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI6S3::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorTRI6S3>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTRI6S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI6S3::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorTRI6S3>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorTRI7S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorTRI7S2::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==7)
return DiameterCalulatorTRI3S2::ComputeForOneCellInternal(bg,bg+3,coordsPtr);
throw Exception("DiameterCalulatorTRI7S2::ComputeForOneCellInternal : input connectivity must be of size 7 !");
}
-void DiameterCalulatorTRI7S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI7S2::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorTRI7S2>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTRI7S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI7S2::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorTRI7S2>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTRI7S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI7S2::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorTRI7S2>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorTRI7S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorTRI7S3::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==7)
return DiameterCalulatorTRI3S3::ComputeForOneCellInternal(bg,bg+3,coordsPtr);
throw Exception("DiameterCalulatorTRI7S3::ComputeForOneCellInternal : input connectivity must be of size 7 !");
}
-void DiameterCalulatorTRI7S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI7S3::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorTRI7S3>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTRI7S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI7S3::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorTRI7S3>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTRI7S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTRI7S3::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorTRI7S3>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorQUAD4S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorQUAD4S2::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==4)
{
throw Exception("DiameterCalulatorQUAD4S2::ComputeForOneCellInternal : input connectivity must be of size 4 !");
}
-void DiameterCalulatorQUAD4S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD4S2::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorQUAD4S2>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorQUAD4S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD4S2::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorQUAD4S2>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorQUAD4S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD4S2::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorQUAD4S2>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorQUAD4S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorQUAD4S3::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==4)
{
throw Exception("DiameterCalulatorQUAD4S3::ComputeForOneCellInternal : input connectivity must be of size 4 !");
}
-void DiameterCalulatorQUAD4S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD4S3::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorQUAD4S3>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorQUAD4S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD4S3::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorQUAD4S3>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorQUAD4S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD4S3::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorQUAD4S3>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorQUAD8S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorQUAD8S2::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==8)
return DiameterCalulatorQUAD4S2::ComputeForOneCellInternal(bg,bg+4,coordsPtr);
throw Exception("DiameterCalulatorQUAD8S2::ComputeForOneCellInternal : input connectivity must be of size 8 !");
}
-void DiameterCalulatorQUAD8S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD8S2::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorQUAD8S2>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorQUAD8S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD8S2::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorQUAD8S2>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorQUAD8S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD8S2::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorQUAD8S2>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorQUAD8S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorQUAD8S3::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==8)
return DiameterCalulatorQUAD4S3::ComputeForOneCellInternal(bg,bg+4,coordsPtr);
throw Exception("DiameterCalulatorQUAD8S3::ComputeForOneCellInternal : input connectivity must be of size 8 !");
}
-void DiameterCalulatorQUAD8S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD8S3::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorQUAD8S3>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorQUAD8S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD8S3::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorQUAD8S3>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorQUAD8S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD8S3::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorQUAD8S3>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorQUAD9S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorQUAD9S2::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==9)
return DiameterCalulatorQUAD4S2::ComputeForOneCellInternal(bg,bg+4,coordsPtr);
throw Exception("DiameterCalulatorQUAD9S2::ComputeForOneCellInternal : input connectivity must be of size 9 !");
}
-void DiameterCalulatorQUAD9S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD9S2::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorQUAD9S2>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorQUAD9S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD9S2::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorQUAD9S2>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorQUAD9S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD9S2::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorQUAD9S2>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorQUAD9S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorQUAD9S3::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==9)
return DiameterCalulatorQUAD4S3::ComputeForOneCellInternal(bg,bg+4,coordsPtr);
throw Exception("DiameterCalulatorQUAD8S3::ComputeForOneCellInternal : input connectivity must be of size 9 !");
}
-void DiameterCalulatorQUAD9S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD9S3::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorQUAD9S3>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorQUAD9S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD9S3::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorQUAD9S3>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorQUAD9S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorQUAD9S3::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorQUAD9S3>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorTETRA4::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorTETRA4::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==4)
{
throw Exception("DiameterCalulatorTETRA4::ComputeForOneCellInternal : input connectivity must be of size 4 !");
}
-void DiameterCalulatorTETRA4::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTETRA4::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorTETRA4>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTETRA4::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTETRA4::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorTETRA4>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTETRA4::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTETRA4::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorTETRA4>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorTETRA10::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorTETRA10::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==10)
return DiameterCalulatorTETRA4::ComputeForOneCellInternal(bg,bg+4,coordsPtr);
throw Exception("DiameterCalulatorTETRA10::ComputeForOneCellInternal : input connectivity must be of size 10 !");
}
-void DiameterCalulatorTETRA10::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTETRA10::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorTETRA10>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTETRA10::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTETRA10::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorTETRA10>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorTETRA10::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorTETRA10::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorTETRA10>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorHEXA8::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorHEXA8::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==8)
{
throw Exception("DiameterCalulatorHEXA8::ComputeForOneCellInternal : input connectivity must be of size 8 !");
}
-void DiameterCalulatorHEXA8::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorHEXA8::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorHEXA8>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorHEXA8::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorHEXA8::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorHEXA8>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorHEXA8::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorHEXA8::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorHEXA8>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorHEXA20::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorHEXA20::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==20)
return DiameterCalulatorHEXA8::ComputeForOneCellInternal(bg,bg+8,coordsPtr);
throw Exception("DiameterCalulatorHEXA20::ComputeForOneCellInternal : input connectivity must be of size 20 !");
}
-void DiameterCalulatorHEXA20::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorHEXA20::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorHEXA20>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorHEXA20::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorHEXA20::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorHEXA20>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorHEXA20::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorHEXA20::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorHEXA20>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorHEXA27::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorHEXA27::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==27)
return DiameterCalulatorHEXA8::ComputeForOneCellInternal(bg,bg+8,coordsPtr);
throw Exception("DiameterCalulatorHEXA27::ComputeForOneCellInternal : input connectivity must be of size 27 !");
}
-void DiameterCalulatorHEXA27::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorHEXA27::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorHEXA27>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorHEXA27::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorHEXA27::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorHEXA27>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorHEXA27::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorHEXA27::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorHEXA27>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorPENTA6::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorPENTA6::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==6)
{
throw Exception("DiameterCalulatorPENTA6::ComputeForOneCellInternal : input connectivity must be of size 6 !");
}
-void DiameterCalulatorPENTA6::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorPENTA6::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorPENTA6>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorPENTA6::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorPENTA6::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorPENTA6>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorPENTA6::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorPENTA6::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorPENTA6>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorPENTA15::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorPENTA15::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==15)
return DiameterCalulatorPENTA6::ComputeForOneCellInternal(bg,bg+6,coordsPtr);
throw Exception("DiameterCalulatorPENTA15::ComputeForOneCellInternal : input connectivity must be of size 15 !");
}
-void DiameterCalulatorPENTA15::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorPENTA15::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorPENTA15>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorPENTA15::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorPENTA15::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorPENTA15>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorPENTA15::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorPENTA15::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorPENTA15>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorPYRA5::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorPYRA5::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==5)
{
throw Exception("DiameterCalulatorPYRA5::ComputeForOneCellInternal : input connectivity must be of size 5 !");
}
-void DiameterCalulatorPYRA5::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorPYRA5::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorPYRA5>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorPYRA5::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorPYRA5::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorPYRA5>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorPYRA5::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorPYRA5::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorPYRA5>(nbOfCells,connPtr,coordsPtr,resPtr);
}
//=================================================================
-double DiameterCalulatorPYRA13::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr)
+double DiameterCalulatorPYRA13::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr)
{
if(std::distance(bg,endd)==13)
return DiameterCalulatorPYRA5::ComputeForOneCellInternal(bg,bg+5,coordsPtr);
throw Exception("DiameterCalulatorPYRA13::ComputeForOneCellInternal : input connectivity must be of size 13 !");
}
-void DiameterCalulatorPYRA13::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorPYRA13::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForListOfCellIdsUMeshFrmt<DiameterCalulatorPYRA13>(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorPYRA13::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorPYRA13::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeForRangeOfCellIdsUMeshFrmt<DiameterCalulatorPYRA13>(bgId,endId,indPtr,connPtr,coordsPtr,resPtr);
}
-void DiameterCalulatorPYRA13::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const
+void DiameterCalulatorPYRA13::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const
{
ComputeFor1SGTUMeshFrmt<DiameterCalulatorPYRA13>(nbOfCells,connPtr,coordsPtr,resPtr);
}
#include "INTERPKERNELDefines.hxx"
#include "NormalizedGeometricTypes"
+#include "MCIdType.hxx"
namespace INTERP_KERNEL
{
public:
INTERPKERNEL_EXPORT virtual ~DiameterCalculator() { }
INTERPKERNEL_EXPORT virtual NormalizedCellType getType() const = 0;
- INTERPKERNEL_EXPORT virtual double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const = 0;
- INTERPKERNEL_EXPORT virtual void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const = 0;
- INTERPKERNEL_EXPORT virtual void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const = 0;
- INTERPKERNEL_EXPORT virtual void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const = 0;
+ INTERPKERNEL_EXPORT virtual double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const = 0;
+ INTERPKERNEL_EXPORT virtual void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const = 0;
+ INTERPKERNEL_EXPORT virtual void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const = 0;
+ INTERPKERNEL_EXPORT virtual void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const = 0;
};
class DiameterCalulatorTRI3S2 : public DiameterCalculator
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
{
public:
NormalizedCellType getType() const { return TYPE; }
- double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
- static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const;
- void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const;
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
getCorners( corners, &cornerBox->_minmax[0] );
double globCorner[3];
- for ( int iC = 0, nC = corners.size()/_dim; iC < nC; ++iC)
+ for ( std::size_t iC = 0, nC = corners.size()/_dim; iC < nC; ++iC)
{
cornerBox->fromLocalCS( &corners[iC*_dim], globCorner );
mmBox.addPointToBox( globCorner );
getCorners( cornersOther, box );
DirectedBoundingBox mmBox((double*)0,0,_dim); //!< empty box with CS == this->_axes
mmBox._axes = this->_axes;
- for ( int iC = 0, nC = cornersOther.size()/_dim; iC < nC; ++iC)
+ for ( std::size_t iC = 0, nC = cornersOther.size()/_dim; iC < nC; ++iC)
mmBox.addPointToBox( &cornersOther[iC*_dim] );
if ( isMinMaxOut( &mmBox._minmax[0], &this->_minmax[0], _dim ))
getCorners( cornersThis, &_minmax[0] );
DirectedBoundingBox mmBox((double*)0,0,_dim); //!< initailized _minmax
double globCorner[3];
- for ( int iC = 0, nC = cornersThis.size()/_dim; iC < nC; ++iC)
+ for ( std::size_t iC = 0, nC = cornersThis.size()/_dim; iC < nC; ++iC)
{
fromLocalCS( &cornersThis[iC*_dim], globCorner );
for ( int i = 0; i < (int)_dim; ++i )
char *INTERP_KERNEL::AsmX86::copyToExecMemZone(const std::vector<char>& ml, unsigned& offset) const
{
char *ret=0;
- int lgth=ml.size();
+ std::size_t lgth=ml.size();
#ifdef _POSIX_MAPPED_FILES
# ifdef __APPLE__
ret=(char *)mmap(0,lgth,PROT_EXEC | PROT_WRITE,MAP_ANON | MAP_PRIVATE,-1,0);
for(int k=0;k<nbOfByte;k++)
{
j=i&255;
- v=j;
+ v=(char)j;
ml.push_back(v);
i>>=8;
}
DecompositionInUnitBase &DecompositionInUnitBase::operator*(const DecompositionInUnitBase& other)
{
- _value[0]+=other._value[0]; _value[1]+=other._value[1]; _value[2]+=other._value[2]; _value[3]+=other._value[3]; _value[4]+=other._value[4];
+ // += causes ' conversion to 'short int' from 'int' may alter its value [-Wconversion]'
+ _value[0]=(short)(_value[0]+other._value[0]); _value[1]=(short)(_value[1]+other._value[1]); _value[2]=(short)(_value[2]+other._value[2]); _value[3]=(short)(_value[3]+other._value[3]); _value[4]=(short)(_value[4]+other._value[4]);
_mult_fact_to_base*=other._mult_fact_to_base;
_add_to_base=0.;
return *this;
DecompositionInUnitBase &DecompositionInUnitBase::operator/(const DecompositionInUnitBase& other)
{
- _value[0]-=other._value[0]; _value[1]-=other._value[1]; _value[2]-=other._value[2]; _value[3]-=other._value[3]; _value[4]-=other._value[4];
+ // -= causes ' conversion to 'short int' from 'int' may alter its value [-Wconversion]'
+ _value[0]=(short)(_value[0]-other._value[0]); _value[1]=(short)(_value[1]-other._value[1]); _value[2]=(short)(_value[2]-other._value[2]); _value[3]=(short)(_value[3]-other._value[3]); _value[4]=(short)(_value[4]-other._value[4]);
_mult_fact_to_base/=other._mult_fact_to_base;
_add_to_base=0.;
return *this;
if(!other.isAdimensional())
throw INTERP_KERNEL::Exception("Trying to execute operator ^ with a second member not adimensionnal");
int exp=couldItBeConsideredAsInt(other._mult_fact_to_base);
- _value[0]*=exp; _value[1]*=exp; _value[2]*=exp; _value[3]*=exp; _value[4]*=exp;
+ // *= causes ' conversion to 'short int' from 'int' may alter its value [-Wconversion]'
+ _value[0]=(short)(_value[0]*exp); _value[1]=(short)(_value[1]*exp); _value[2]=(short)(_value[2]*exp); _value[3]=(short)(_value[3]*exp); _value[4]=(short)(_value[4]*exp);
_mult_fact_to_base=powInt(_mult_fact_to_base,exp);
_add_to_base=0.;
return *this;
{
if( _my_nb_gauss )
{
- return _my_gauss_coord.size()/_my_nb_gauss;
+ return (int)_my_gauss_coord.size()/_my_nb_gauss;
}
else
{
{
if( _my_nb_ref )
{
- return _my_reference_coord.size()/_my_nb_ref;
+ return (int)(_my_reference_coord.size()/_my_nb_ref);
}
else
{
void GaussCoords::addGaussInfo( NormalizedCellType theGeometry,
int coordDim,
const double* theGaussCoord,
- int theNbGauss,
+ mcIdType theNbGauss,
const double* theReferenceCoord,
- int theNbRef)
+ mcIdType theNbRef)
{
GaussInfoVector::iterator it = _my_gauss_info.begin();
for( ; it != _my_gauss_info.end(); it++ )
aReferenceCoord.push_back(theReferenceCoord[i]);
- GaussInfo* info = new GaussInfo( theGeometry, aGaussCoord, theNbGauss, aReferenceCoord, theNbRef);
+ GaussInfo* info = new GaussInfo( theGeometry, aGaussCoord, FromIdType<int>(theNbGauss), aReferenceCoord, FromIdType<int>(theNbRef));
info->initLocalInfo();
//If info with cell type doesn't exist add it
}
else
{
- int index = std::distance(_my_gauss_info.begin(),it);
+ std::size_t index = std::distance(_my_gauss_info.begin(),it);
delete (*it);
_my_gauss_info[index] = info;
}
double* GaussCoords::calculateCoords( NormalizedCellType theGeometry,
const double *theNodeCoords,
const int theSpaceDim,
- const int *theIndex)
+ const mcIdType *theIndex)
{
const GaussInfo *info = getInfoGivenCellType(theGeometry);
int nbCoords = theSpaceDim * info->getNbGauss();
}
-void GaussCoords::calculateCoords( NormalizedCellType theGeometry, const double *theNodeCoords, const int theSpaceDim, const int *theIndex, double *result)
+void GaussCoords::calculateCoords( NormalizedCellType theGeometry, const double *theNodeCoords, const int theSpaceDim, const mcIdType *theIndex, double *result)
{
const GaussInfo *info = getInfoGivenCellType(theGeometry);
calculateCoordsAlg(info,theNodeCoords,theSpaceDim,theIndex,result);
}
-void GaussCoords::calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const int *theIndex, double *result)
+void GaussCoords::calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const mcIdType *theIndex, double *result)
{
int aConn = info->getNbRef();
#include "INTERPKERNELDefines.hxx"
#include "NormalizedUnstructuredMesh.hxx"
#include "InterpKernelException.hxx"
+#include "MCIdType.hxx"
#include <vector>
INTERPKERNEL_EXPORT void addGaussInfo( NormalizedCellType theGeometry,
int coordDim,
const double* theGaussCoord,
- int theNbGauss,
+ mcIdType theNbGauss,
const double* theReferenceCoord,
- int theNbRef);
+ mcIdType theNbRef);
INTERPKERNEL_EXPORT double* calculateCoords( NormalizedCellType theGeometry,
const double* theNodeCoords,
const int theSpaceDim,
- const int* theIndex);
+ const mcIdType* theIndex);
INTERPKERNEL_EXPORT void calculateCoords( NormalizedCellType theGeometry,
const double* theNodeCoords,
const int theSpaceDim,
- const int* theIndex,
+ const mcIdType* theIndex,
double *result);
private:
const GaussInfo *getInfoGivenCellType(NormalizedCellType cellType);
- void calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const int *theIndex,
+ void calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const mcIdType *theIndex,
double *result);
private:
typedef std::vector<GaussInfo*> GaussInfoVector;
*_deep_it=*iter;
_deep_it++;
iter++;
- int sizeOfMyList=myListToInsert->size();
+ std::size_t sizeOfMyList=myListToInsert->size();
_list_handle->insert(_deep_it,iter,myListToInsert->end());
if(!changeMySelf)
{
- for(int i=0;i<sizeOfMyList;i++)
+ for(std::size_t i=0;i<sizeOfMyList;i++)
_deep_it--;
}
}
std::vector<double> radialDistrib3(radialDistrib.size());
std::transform(radialDistrib2.begin(),radialDistrib2.end(),radialDistrib.begin(),radialDistrib3.begin(),std::minus<double>());
std::vector<double>::iterator iter3=max_element(radialDistrib3.begin(),radialDistrib3.end());
- int i=iter3-radialDistrib3.begin();
+ std::size_t i=iter3-radialDistrib3.begin();
// ok for e1 - Let's go.
EdgeInfLin *e1=new EdgeInfLin(nodeToTest,radialDistrib[i]+radialDistrib3[i]/2.);
double ref=e1->getCharactValue(*nodeToTest);
return ret;
}
-void MergePoints::PushInMap(int key, int value, std::map<int,int>& mergedNodes)
+void MergePoints::PushInMap(mcIdType key, mcIdType value, std::map<mcIdType,mcIdType>& mergedNodes)
{
if(key!=-1 && value!=-1)
mergedNodes[key]=value;
}
-void MergePoints::updateMergedNodes(int e1Start, int e1End, int e2Start, int e2End, std::map<int,int>& mergedNodes)
+void MergePoints::updateMergedNodes(mcIdType e1Start, mcIdType e1End, mcIdType e2Start, mcIdType e2End, std::map<mcIdType,mcIdType>& mergedNodes)
{
unsigned subTot(_ass1Start1+_ass1End1+_ass1Start2+_ass1End2);
if(subTot!=0)
*/
void Edge::Interpolate1DLin(const std::vector<double>& distrib1, const std::vector<double>& distrib2, std::map<int, std::map<int,double> >& result)
{
- int nbOfV1=distrib1.size()-1;
- int nbOfV2=distrib2.size()-1;
+ std::size_t nbOfV1=distrib1.size()-1;
+ std::size_t nbOfV2=distrib2.size()-1;
Node *n1=new Node(0.,0.); Node *n3=new Node(0.,0.);
Node *n2=new Node(0.,0.); Node *n4=new Node(0.,0.);
MergePoints commonNode;
- for(int i=0;i<nbOfV1;i++)
+ for(unsigned int i=0;i<nbOfV1;i++)
{
std::vector<double>::const_iterator iter=find_if(distrib2.begin()+1,distrib2.end(),bind2nd(std::greater_equal<double>(),distrib1[i]));
if(iter!=distrib2.end())
{
- for(int j=(iter-1)-distrib2.begin();j<nbOfV2;j++)
+ for(unsigned int j=(unsigned)((iter-1)-distrib2.begin());j<nbOfV2;j++)
{
if(distrib2[j]<=distrib1[i+1])
{
* \param [in,out] subNodes to be sorted
* \return true if a reordering was necessary false if not.
*/
-bool Edge::sortSubNodesAbs(const double *coo, std::vector<int>& subNodes)
+bool Edge::sortSubNodesAbs(const double *coo, std::vector<mcIdType>& subNodes)
{
Bounds b;
b.prepareForAggregation();
//
std::size_t sz(subNodes.size()),i(0);
std::vector< std::pair<double,Node *> > an2(sz);
- std::map<Node *, int> m;
- for(std::vector<int>::const_iterator it=subNodes.begin();it!=subNodes.end();it++,i++)
+ std::map<Node *, mcIdType> m;
+ for(std::vector<mcIdType>::const_iterator it=subNodes.begin();it!=subNodes.end();it++,i++)
{
Node *n(new Node(coo[2*(*it)],coo[2*(*it)+1]));
n->applySimilarity(xBary,yBary,dimChar);
bool ret(false);
for(i=0;i<sz;i++)
{
- int id(m[an2[i].second]);
+ mcIdType id(m[an2[i].second]);
if(id!=subNodes[i])
{ subNodes[i]=id; ret=true; }
}
//
- for(std::map<INTERP_KERNEL::Node *,int>::const_iterator it2=m.begin();it2!=m.end();it2++)
+ for(std::map<INTERP_KERNEL::Node *,mcIdType>::const_iterator it2=m.begin();it2!=m.end();it2++)
(*it2).first->decrRef();
return ret;
}
/**
* Sort nodes so that they all lie consecutively on the edge that has been cut.
*/
-void Edge::sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, int>& mapp1,
- const std::map<INTERP_KERNEL::Node *, int>& mapp2, std::vector<int>& edgesThis)
+void Edge::sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, mcIdType>& mapp1,
+ const std::map<INTERP_KERNEL::Node *, mcIdType>& mapp2, std::vector<mcIdType>& edgesThis)
{
- int startId=(*mapp1.find(_start)).second;
- int endId=(*mapp1.find(_end)).second;
+ mcIdType startId=(*mapp1.find(_start)).second;
+ mcIdType endId=(*mapp1.find(_end)).second;
if (! addNodes.size()) // quick way out, no new node to add.
{
edgesThis.push_back(startId);
for(std::size_t i=0;i<sz;i++)
an2[i]=std::pair<double,Node *>(getCharactValueBtw0And1(*addNodes[i]),addNodes[i]);
std::sort(an2.begin(),an2.end());
- std::vector<int> tmpp;
+ std::vector<mcIdType> tmpp;
for(std::vector< std::pair<double,Node *> >::const_iterator it=an2.begin();it!=an2.end();it++)
{
- int idd=(*mapp2.find((*it).second)).second;
+ mcIdType idd=(*mapp2.find((*it).second)).second;
tmpp.push_back(idd);
}
- std::vector<int> tmpp2(tmpp.size()+2);
+ std::vector<mcIdType> tmpp2(tmpp.size()+2);
tmpp2[0]=startId;
std::copy(tmpp.begin(),tmpp.end(),tmpp2.begin()+1);
tmpp2[tmpp.size()+1]=endId;
- std::vector<int>::iterator itt=std::unique(tmpp2.begin(),tmpp2.end());
+ std::vector<mcIdType>::iterator itt=std::unique(tmpp2.begin(),tmpp2.end());
tmpp2.resize(std::distance(tmpp2.begin(),itt));
- int nbOfEdges=tmpp2.size()-1;
- for(int i=0;i<nbOfEdges;i++)
+ std::size_t nbOfEdges=tmpp2.size()-1;
+ for(std::size_t i=0;i<nbOfEdges;i++)
{
edgesThis.push_back(tmpp2[i]);
edgesThis.push_back(tmpp2[i+1]);
}
}
-void Edge::fillGlobalInfoAbs(bool direction, const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
- std::vector<int>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo) const
+void Edge::fillGlobalInfoAbs(bool direction, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<mcIdType>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType> mapAddCoo) const
{
- int tmp[2];
+ mcIdType tmp[2];
_start->fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,tmp);
_end->fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,tmp+1);
if(direction)
}
}
-void Edge::fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
+void Edge::fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
short skipStartOrEnd,
- std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const
+ std::vector<mcIdType>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo) const
{
if (skipStartOrEnd != -1) // see meaning in splitAbs()
_start->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther);
#include "InterpKernelException.hxx"
#include "InterpKernelGeo2DBounds.hxx"
#include "InterpKernelGeo2DNode.hxx"
+#include "MCIdType.hxx"
#include <iostream>
#include <vector>
bool isEnd2(unsigned rk) const;
void clear();
unsigned getNumberOfAssociations() const;
- void updateMergedNodes(int e1Start, int e1End, int e2Start, int e2End, std::map<int,int>& mergedNodes);
+ void updateMergedNodes(mcIdType e1Start, mcIdType e1End, mcIdType e2Start, mcIdType e2End, std::map<mcIdType,mcIdType>& mergedNodes);
private:
- static void PushInMap(int key, int value, std::map<int,int>& mergedNodes);
+ static void PushInMap(mcIdType key, mcIdType value, std::map<mcIdType,mcIdType>& mergedNodes);
private:
unsigned _ass1Start1 : 1;
unsigned _ass1End1 : 1;
void dumpToCout(const std::map<INTERP_KERNEL::Node *,int>& mapp, int index) const;
bool isEqual(const Edge& other) const;
public:
- bool sortSubNodesAbs(const double *coo, std::vector<int>& subNodes);
- void sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, int>& mapp1, const std::map<INTERP_KERNEL::Node *, int>& mapp2, std::vector<int>& edgesThis);
+ bool sortSubNodesAbs(const double *coo, std::vector<mcIdType>& subNodes);
+ void sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, mcIdType>& mapp1, const std::map<INTERP_KERNEL::Node *, mcIdType>& mapp2, std::vector<mcIdType>& edgesThis);
virtual Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction=true) const = 0;
- void fillGlobalInfoAbs(bool direction, const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
- std::vector<int>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo) const;
- void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
+ void fillGlobalInfoAbs(bool direction, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<mcIdType>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType> mapAddCoo) const;
+ void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
short skipStartOrEnd,
- std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const;
+ std::vector<mcIdType>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo) const;
protected:
Edge():_cnt(1),_loc(FULL_UNKNOWN),_start(0),_end(0) { }
* @param angle0 in ]-Pi;Pi[
* @param deltaAngle in ]-2.*Pi;2.*Pi[
*/
-EdgeArcCircle::EdgeArcCircle(Node *start, Node *end, const double *center, double radius, double angle0, double deltaAngle, bool direction):Edge(start,end,direction),_angle(deltaAngle),
- _angle0(angle0),_radius(radius)
+EdgeArcCircle::EdgeArcCircle(Node *start, Node *end, const double *center, double radius, double angle0, double deltaAngle, bool direction):Edge(start,end,direction),_angle0(angle0),_angle(deltaAngle),
+ _radius(radius)
{
_center[0]=center[0];
_center[1]=center[1];
* 'conn' is of size 3. conn[0] is start id, conn[1] is end id and conn[2] is middle id.
* 'offset' is typically the number of nodes already existing in global 2D curve mesh. Additional coords 'addCoo' ids will be put after the already existing.
*/
-void EdgeArcCircle::tesselate(const int *conn, int offset, double eps, std::vector<int>& newConn, std::vector<double>& addCoo) const
+void EdgeArcCircle::tesselate(const mcIdType *conn, mcIdType offset, double eps, std::vector<mcIdType>& newConn, std::vector<double>& addCoo) const
{
newConn.push_back(INTERP_KERNEL::NORM_POLYL);
int nbOfSubDiv=(int)(fabs(_angle)/eps);
return ;
}
double signOfAngle=_angle>0.?1.:-1.;
- int offset2=offset+((int)addCoo.size())/2;
+ mcIdType offset2=offset+(ToIdType(addCoo.size()))/2;
newConn.push_back(conn[0]);
for(int i=1;i<nbOfSubDiv;i++,offset2++)
{
#include "INTERPKERNELDefines.hxx"
#include "InterpKernelGeo2DEdge.hxx"
+#include "MCIdType.hxx"
namespace INTERP_KERNEL
{
double getAngle0() const { return _angle0; }
double getRadius() const { return _radius; }
double getAngle() const { return _angle; }
- void tesselate(const int *conn, int offset, double eps, std::vector<int>& newConn, std::vector<double>& addCoo) const;
+ void tesselate(const mcIdType *conn, mcIdType offset, double eps, std::vector<mcIdType>& newConn, std::vector<double>& addCoo) const;
static EdgeArcCircle *BuildFromNodes(Node *start, Node *middle, Node *end);
static double GetAbsoluteAngle(const double *vect, double& normVect);
static double GetAbsoluteAngleOfNormalizedVect(double ux, double uy);
/*!
* Called by QuadraticPolygon::splitAbs method.
*/
-void ElementaryEdge::fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
- std::vector<int>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo) const
+void ElementaryEdge::fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<mcIdType>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType> mapAddCoo) const
{
_ptr->fillGlobalInfoAbs(_direction,mapThis,mapOther,offset1,offset2,fact,baryX,baryY,edgesThis,addCoo,mapAddCoo);
}
* Called by QuadraticPolygon::splitAbs method. Close to ElementaryEdge::fillGlobalInfoAbs method expect that here edgesOther (that replace edgesThis) is here an in/out parameter that only contains nodes
* unsorted because the "other" mesh is not subdivided yet.
*/
-void ElementaryEdge::fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
+void ElementaryEdge::fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
short skipStartOrEnd,
- std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const
+ std::vector<mcIdType>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo) const
{
if (!_direction)
- skipStartOrEnd *= -1; // invert value - see QuadraticPolygon::splitAbs()
+ skipStartOrEnd = (short)(-skipStartOrEnd); // invert value - see QuadraticPolygon::splitAbs()
_ptr->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,skipStartOrEnd,edgesOther,addCoo,mapAddCoo);
}
INTERPKERNEL_EXPORT bool intresincEqCoarse(const Edge *other) const;
INTERPKERNEL_EXPORT bool isEqual(const ElementaryEdge& other) const;
public:
- INTERPKERNEL_EXPORT void fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
- std::vector<int>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo) const;
- INTERPKERNEL_EXPORT void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
+ INTERPKERNEL_EXPORT void fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<mcIdType>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType> mapAddCoo) const;
+ INTERPKERNEL_EXPORT void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
short skipStartOrEnd,
- std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const;
+ std::vector<mcIdType>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo) const;
INTERPKERNEL_EXPORT static ElementaryEdge *BuildEdgeFromStartEndDir(bool direction, INTERP_KERNEL::Node *start, INTERP_KERNEL::Node *end);
private:
bool _direction;
/*!
* Called by QuadraticPolygon::splitAbs method.
*/
-void Node::fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
- std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo, int *nodeId) const
+void Node::fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo, mcIdType *nodeId) const
{
- std::map<INTERP_KERNEL::Node *,int>::const_iterator it=mapOther.find(const_cast<Node *>(this));
+ std::map<INTERP_KERNEL::Node *,mcIdType>::const_iterator it=mapOther.find(const_cast<Node *>(this));
if(it!=mapOther.end()) // order matters, try in mapOther first.
{
*nodeId=(*it).second+offset1;
/*!
* Called by QuadraticPolygon::splitAbs method.
*/
-void Node::fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
- std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo, std::vector<int>& pointsOther) const
+void Node::fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo, std::vector<mcIdType>& pointsOther) const
{
- int tmp;
+ mcIdType tmp;
std::size_t sz1=addCoo.size();
fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,&tmp);
if(sz1!=addCoo.size() // newly created point
pointsOther.push_back(tmp);
return ;
}
- std::vector<int>::const_iterator it=std::find(pointsOther.begin(),pointsOther.end(),tmp);
+ std::vector<mcIdType>::const_iterator it=std::find(pointsOther.begin(),pointsOther.end(),tmp);
if(it!=pointsOther.end())
return ;
pointsOther.push_back(tmp);
#include "InterpKernelGeo2DPrecision.hxx"
#include "INTERPKERNELDefines.hxx"
+#include "MCIdType.hxx"
#include <map>
#include <cmath>
static double distanceBtw2Pt(const double *a, const double *b) { return sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])); }
static double distanceBtw2PtSq(const double *a, const double *b) { return (a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]); }
//
- void fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
- std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo, int *nodeId) const;
- void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
- std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo, std::vector<int>& pointsOther) const;
+ void fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo, mcIdType *nodeId) const;
+ void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo, std::vector<mcIdType>& pointsOther) const;
protected:
~Node();
protected:
* the cell id in global other mesh.
*/
void QuadraticPolygon::splitAbs(QuadraticPolygon& other,
- const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther,
- int offset1, int offset2 ,
- const std::vector<int>& otherEdgeIds,
- std::vector<int>& edgesThis, int cellIdThis,
- std::vector< std::vector<int> >& edgesInOtherColinearWithThis, std::vector< std::vector<int> >& subDivOther,
- std::vector<double>& addCoo, std::map<int,int>& mergedNodes)
+ const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther,
+ mcIdType offset1, mcIdType offset2 ,
+ const std::vector<mcIdType>& otherEdgeIds,
+ std::vector<mcIdType>& edgesThis, mcIdType cellIdThis,
+ std::vector< std::vector<mcIdType> >& edgesInOtherColinearWithThis, std::vector< std::vector<mcIdType> >& subDivOther,
+ std::vector<double>& addCoo, std::map<mcIdType,mcIdType>& mergedNodes)
{
double xBaryBB, yBaryBB;
double fact=normalizeExt(&other, xBaryBB, yBaryBB);
ComposedEdge *cThis=new ComposedEdge;
ComposedEdge *cOther=new ComposedEdge;
int i=0;
- std::map<INTERP_KERNEL::Node *,int> mapAddCoo;
+ std::map<INTERP_KERNEL::Node *,mcIdType> mapAddCoo;
for(itOther.first();!itOther.finished();itOther.next(),i++)
{
// For each edge of 'other', proceed with intersections: the edge might split into sub-edges, 'otherTmp' will hold the final split result.
ElementaryEdge* curThis=itThis.current();
merge.clear();
//
- std::map<INTERP_KERNEL::Node *,int>::const_iterator thisStart(mapThis.find(curThis->getStartNode())),thisEnd(mapThis.find(curThis->getEndNode())),
+ std::map<INTERP_KERNEL::Node *,mcIdType>::const_iterator thisStart(mapThis.find(curThis->getStartNode())),thisEnd(mapThis.find(curThis->getEndNode())),
otherStart(mapOther.find(curOtherTmp->getStartNode())),otherEnd(mapOther.find(curOtherTmp->getEndNode()));
- int thisStart2(thisStart==mapThis.end()?-1:(*thisStart).second), thisEnd2(thisEnd==mapThis.end()?-1:(*thisEnd).second),
+ mcIdType thisStart2(thisStart==mapThis.end()?-1:(*thisStart).second), thisEnd2(thisEnd==mapThis.end()?-1:(*thisEnd).second),
otherStart2(otherStart==mapOther.end()?-1:(*otherStart).second+offset1),otherEnd2(otherEnd==mapOther.end()?-1:(*otherEnd).second+offset1);
//
if(curThis->getPtr()->intersectWith(curOtherTmp->getPtr(),merge,*cThis,*cOther))
// Converting back to integer connectivity:
if(otherTmp._sub_edges.size()>1) // only if a new point has been added (i.e. an actual intersection was done)
{
- int jj = 0, sz(otherTmp._sub_edges.size());
+ std::size_t jj = 0, sz(otherTmp._sub_edges.size());
for(std::list<ElementaryEdge *>::const_iterator it=otherTmp._sub_edges.begin();it!=otherTmp._sub_edges.end();it++, jj++)
{
short skipStartOrEnd = jj == 0 ? -1 : (jj == sz-1 ? 1 : 0); // -1 means START, 1 means END, 0 other
* orientation of edge (see buildDescendingConnectivity2() method).
* See appendEdgeFromCrudeDataArray() for params description.
*/
-void QuadraticPolygon::buildFromCrudeDataArray(const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *nodalBg, const double *coords,
- const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges)
+void QuadraticPolygon::buildFromCrudeDataArray(const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords,
+ const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges)
{
std::size_t nbOfSeg=std::distance(descBg,descEnd);
for(std::size_t i=0;i<nbOfSeg;i++)
}
}
-void QuadraticPolygon::appendEdgeFromCrudeDataArray(std::size_t edgePos, const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad,
- const int *nodalBg, const double *coords,
- const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges)
+void QuadraticPolygon::appendEdgeFromCrudeDataArray(std::size_t edgePos, const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp, bool isQuad,
+ const mcIdType *nodalBg, const double *coords,
+ const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges)
{
if(!isQuad)
{
bool direct=descBg[edgePos]>0;
- int edgeId=abs(descBg[edgePos])-1; // back to C indexing mode
- const std::vector<int>& subEdge=intersectEdges[edgeId];
+ mcIdType edgeId=std::abs(descBg[edgePos])-1; // back to C indexing mode
+ const std::vector<mcIdType>& subEdge=intersectEdges[edgeId];
std::size_t nbOfSubEdges=subEdge.size()/2;
for(std::size_t j=0;j<nbOfSubEdges;j++)
appendSubEdgeFromCrudeDataArray(0,j,direct,edgeId,subEdge,mapp);
delete e1; delete e2;
//
bool direct=descBg[edgePos]>0;
- int edgeId=abs(descBg[edgePos])-1;
- const std::vector<int>& subEdge=intersectEdges[edgeId];
+ mcIdType edgeId=std::abs(descBg[edgePos])-1;
+ const std::vector<mcIdType>& subEdge=intersectEdges[edgeId];
std::size_t nbOfSubEdges=subEdge.size()/2;
if(colinearity)
{
}
}
-void QuadraticPolygon::appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, int edgeId, const std::vector<int>& subEdge, const std::map<int,INTERP_KERNEL::Node *>& mapp)
+void QuadraticPolygon::appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, mcIdType edgeId, const std::vector<mcIdType>& subEdge, const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp)
{
std::size_t nbOfSubEdges=subEdge.size()/2;
if(!baseEdge)
* This method builds from descending conn of a quadratic polygon stored in crude mode (MEDCoupling). Descending conn is in FORTRAN relative mode in order to give the
* orientation of edge.
*/
-void QuadraticPolygon::buildFromCrudeDataArray2(const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *nodalBg, const double *coords, const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges2,
- const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, const std::vector<std::vector<int> >& intersectEdges1,
- const std::vector< std::vector<int> >& colinear1,
- std::map<int,std::vector<INTERP_KERNEL::ElementaryEdge *> >& alreadyExistingIn2)
+void QuadraticPolygon::buildFromCrudeDataArray2(const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords, const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges2,
+ const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1, const std::vector<std::vector<mcIdType> >& intersectEdges1,
+ const std::vector< std::vector<mcIdType> >& colinear1,
+ std::map<mcIdType,std::vector<INTERP_KERNEL::ElementaryEdge *> >& alreadyExistingIn2)
{
std::size_t nbOfSeg=std::distance(descBg,descEnd);
for(std::size_t i=0;i<nbOfSeg;i++)//loop over all edges of pol2
{
bool direct=descBg[i]>0;
- int edgeId=abs(descBg[i])-1;//current edge id of pol2
- std::map<int,std::vector<INTERP_KERNEL::ElementaryEdge *> >::const_iterator it1=alreadyExistingIn2.find(descBg[i]),it2=alreadyExistingIn2.find(-descBg[i]);
+ mcIdType edgeId=std::abs(descBg[i])-1;//current edge id of pol2
+ std::map<mcIdType,std::vector<INTERP_KERNEL::ElementaryEdge *> >::const_iterator it1=alreadyExistingIn2.find(descBg[i]),it2=alreadyExistingIn2.find(-descBg[i]);
if(it1!=alreadyExistingIn2.end() || it2!=alreadyExistingIn2.end())
{
bool sameDir=(it1!=alreadyExistingIn2.end());
continue;
}
bool directos=colinear1[edgeId].empty();
- std::vector<std::pair<int,std::pair<bool,int> > > idIns1;
- int offset1=0;
+ std::vector<std::pair<mcIdType,std::pair<bool,mcIdType> > > idIns1;
+ mcIdType offset1=0;
if(!directos)
{// if the current edge of pol2 has one or more colinear edges part into pol1
- const std::vector<int>& c=colinear1[edgeId];
+ const std::vector<mcIdType>& c=colinear1[edgeId];
std::size_t nbOfEdgesIn1=std::distance(descBg1,descEnd1);
for(std::size_t j=0;j<nbOfEdgesIn1;j++)
{
- int edgeId1=abs(descBg1[j])-1;
+ mcIdType edgeId1=std::abs(descBg1[j])-1;
if(std::find(c.begin(),c.end(),edgeId1)!=c.end())
{
- idIns1.push_back(std::pair<int,std::pair<bool,int> >(edgeId1,std::pair<bool,int>(descBg1[j]>0,offset1)));// it exists an edge into pol1 given by tuple (idIn1,direct1) that is colinear at edge 'edgeId' in pol2
+ idIns1.push_back(std::pair<mcIdType,std::pair<bool,mcIdType> >(edgeId1,std::pair<bool,mcIdType>(descBg1[j]>0,offset1)));// it exists an edge into pol1 given by tuple (idIn1,direct1) that is colinear at edge 'edgeId' in pol2
//std::pair<edgeId1); direct1=descBg1[j]>0;
}
- offset1+=intersectEdges1[edgeId1].size()/2;//offset1 is used to find the INTERP_KERNEL::Edge * instance into pol1 that will be part of edge into pol2
+ offset1+=ToIdType(intersectEdges1[edgeId1].size()/2);//offset1 is used to find the INTERP_KERNEL::Edge * instance into pol1 that will be part of edge into pol2
}
directos=idIns1.empty();
}
}
else
{//there is subpart of edge 'edgeId' of pol2 inside pol1
- const std::vector<int>& subEdge=intersectEdges2[edgeId];
+ const std::vector<mcIdType>& subEdge=intersectEdges2[edgeId];
std::size_t nbOfSubEdges=subEdge.size()/2;
for(std::size_t j=0;j<nbOfSubEdges;j++)
{
- int idBg=direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1];
- int idEnd=direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2];
+ mcIdType idBg=direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1];
+ mcIdType idEnd=direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2];
bool direction11,found=false;
bool direct1;//store if needed the direction in 1
- int offset2;
- std::size_t nbOfSubEdges1;
- for(std::vector<std::pair<int,std::pair<bool,int> > >::const_iterator it=idIns1.begin();it!=idIns1.end() && !found;it++)
+ mcIdType offset2;
+ mcIdType nbOfSubEdges1;
+ for(std::vector<std::pair<mcIdType,std::pair<bool,mcIdType> > >::const_iterator it=idIns1.begin();it!=idIns1.end() && !found;it++)
{
- int idIn1=(*it).first;//store if needed the cell id in 1
+ mcIdType idIn1=(*it).first;//store if needed the cell id in 1
direct1=(*it).second.first;
offset1=(*it).second.second;
- const std::vector<int>& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1];
- nbOfSubEdges1=subEdge1PossiblyAlreadyIn1.size()/2;
+ const std::vector<mcIdType>& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1];
+ nbOfSubEdges1=ToIdType(subEdge1PossiblyAlreadyIn1.size()/2);
offset2=0;
- for(std::size_t k=0;k<nbOfSubEdges1 && !found;k++)
+ for(mcIdType k=0;k<nbOfSubEdges1 && !found;k++)
{//perform a loop on all subedges of pol1 that includes edge 'edgeId' of pol2. For the moment we iterate only on subedges of ['idIn1']... To improve
if(subEdge1PossiblyAlreadyIn1[2*k]==idBg && subEdge1PossiblyAlreadyIn1[2*k+1]==idEnd)
{ direction11=true; found=true; }
}
else
{//the current subedge of edge 'edgeId' of pol2 is part of the colinear edge 'idIn1' of pol1 -> reuse Edge instance of pol1
- ElementaryEdge *e=pol1[offset1+(direct1?offset2:nbOfSubEdges1-offset2-1)];
+ ElementaryEdge *e=pol1[FromIdType<int>(offset1+(direct1?offset2:nbOfSubEdges1-offset2-1))];
Edge *ee=e->getPtr();
ee->incrRef();
ElementaryEdge *e2=new ElementaryEdge(ee,!(direct1^direction11));
* Method expected to be called on pol2. Every params not suffixed by numbered are supposed to refer to pol2 (this).
* Method to find edges that are ON.
*/
-void QuadraticPolygon::updateLocOfEdgeFromCrudeDataArray2(const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges,
- const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1,
- const std::vector<std::vector<int> >& intersectEdges1, const std::vector< std::vector<int> >& colinear1) const
+void QuadraticPolygon::updateLocOfEdgeFromCrudeDataArray2(const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges,
+ const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1,
+ const std::vector<std::vector<mcIdType> >& intersectEdges1, const std::vector< std::vector<mcIdType> >& colinear1) const
{
std::size_t nbOfSeg=std::distance(descBg,descEnd);
for(std::size_t i=0;i<nbOfSeg;i++)//loop over all edges of pol2
{
bool direct=descBg[i]>0;
- int edgeId=abs(descBg[i])-1;//current edge id of pol2
- const std::vector<int>& c=colinear1[edgeId];
+ mcIdType edgeId=std::abs(descBg[i])-1;//current edge id of pol2
+ const std::vector<mcIdType>& c=colinear1[edgeId];
if(c.empty())
continue;
- const std::vector<int>& subEdge=intersectEdges[edgeId];
+ const std::vector<mcIdType>& subEdge=intersectEdges[edgeId];
std::size_t nbOfSubEdges=subEdge.size()/2;
//
std::size_t nbOfEdgesIn1=std::distance(descBg1,descEnd1);
- int offset1=0;
+ mcIdType offset1=0;
for(std::size_t j=0;j<nbOfEdgesIn1;j++)
{
- int edgeId1=abs(descBg1[j])-1;
+ mcIdType edgeId1=std::abs(descBg1[j])-1;
if(std::find(c.begin(),c.end(),edgeId1)!=c.end())
{
for(std::size_t k=0;k<nbOfSubEdges;k++)
{
- int idBg=direct?subEdge[2*k]:subEdge[2*nbOfSubEdges-2*k-1];
- int idEnd=direct?subEdge[2*k+1]:subEdge[2*nbOfSubEdges-2*k-2];
- int idIn1=edgeId1;
+ mcIdType idBg=direct?subEdge[2*k]:subEdge[2*nbOfSubEdges-2*k-1];
+ mcIdType idEnd=direct?subEdge[2*k+1]:subEdge[2*nbOfSubEdges-2*k-2];
+ mcIdType idIn1=edgeId1;
bool direct1=descBg1[j]>0;
- const std::vector<int>& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1];
- std::size_t nbOfSubEdges1=subEdge1PossiblyAlreadyIn1.size()/2;
- int offset2=0;
+ const std::vector<mcIdType>& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1];
+ mcIdType nbOfSubEdges1=ToIdType(subEdge1PossiblyAlreadyIn1.size()/2);
+ mcIdType offset2=0;
bool found=false;
- for(std::size_t kk=0;kk<nbOfSubEdges1 && !found;kk++)
+ for(mcIdType kk=0;kk<nbOfSubEdges1 && !found;kk++)
{
found=(subEdge1PossiblyAlreadyIn1[2*kk]==idBg && subEdge1PossiblyAlreadyIn1[2*kk+1]==idEnd) || (subEdge1PossiblyAlreadyIn1[2*kk]==idEnd && subEdge1PossiblyAlreadyIn1[2*kk+1]==idBg);
if(!found)
}
if(found)
{
- ElementaryEdge *e=pol1[offset1+(direct1?offset2:nbOfSubEdges1-offset2-1)];
+ ElementaryEdge *e=pol1[(int)(offset1+(direct1?offset2:nbOfSubEdges1-offset2-1))];
e->getPtr()->declareOn();
}
}
}
- offset1+=intersectEdges1[edgeId1].size()/2;//offset1 is used to find the INTERP_KERNEL::Edge * instance into pol1 that will be part of edge into pol2
+ offset1+=ToIdType(intersectEdges1[edgeId1].size()/2);//offset1 is used to find the INTERP_KERNEL::Edge * instance into pol1 that will be part of edge into pol2
}
}
}
-void QuadraticPolygon::appendCrudeData(const std::map<INTERP_KERNEL::Node *,int>& mapp, double xBary, double yBary, double fact, int offset, std::vector<double>& addCoordsQuadratic, std::vector<int>& conn, std::vector<int>& connI) const
+void QuadraticPolygon::appendCrudeData(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapp, double xBary, double yBary, double fact, mcIdType offset, std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& conn, std::vector<mcIdType>& connI) const
{
int nbOfNodesInPg=0;
bool presenceOfQuadratic=presenceOfQuadraticEdge();
{
Node *tmp=0;
tmp=(*it)->getStartNode();
- std::map<INTERP_KERNEL::Node *,int>::const_iterator it1=mapp.find(tmp);
+ std::map<INTERP_KERNEL::Node *,mcIdType>::const_iterator it1=mapp.find(tmp);
conn.push_back((*it1).second);
nbOfNodesInPg++;
}
if(presenceOfQuadratic)
{
int j=0;
- int off=offset+((int)addCoordsQuadratic.size())/2;
+ mcIdType off=offset+ToIdType(addCoordsQuadratic.size())/2;
for(std::list<ElementaryEdge *>::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++,j++,nbOfNodesInPg++)
{
INTERP_KERNEL::Node *node=(*it)->getPtr()->buildRepresentantOfMySelf();
* @param [in,out] edgesBoundaryOther, parameter that stores all edges in result of intersection that are not
*/
void QuadraticPolygon::buildPartitionsAbs(QuadraticPolygon& other, std::set<INTERP_KERNEL::Edge *>& edgesThis, std::set<INTERP_KERNEL::Edge *>& edgesBoundaryOther,
- const std::map<INTERP_KERNEL::Node *,int>& mapp, int idThis, int idOther, int offset,
- std::vector<double>& addCoordsQuadratic, std::vector<int>& conn, std::vector<int>& connI,
- std::vector<int>& nbThis, std::vector<int>& nbOther)
+ const std::map<INTERP_KERNEL::Node *,mcIdType>& mapp, mcIdType idThis, mcIdType idOther, mcIdType offset,
+ std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& conn, std::vector<mcIdType>& connI,
+ std::vector<mcIdType>& nbThis, std::vector<mcIdType>& nbOther)
{
double xBaryBB, yBaryBB;
double fact=normalizeExt(&other, xBaryBB, yBaryBB);
* intersecting cells
*/
void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std::set<Edge *>& notUsedInPol1, const std::set<Edge *>& edgesInPol2OnBoundary,
- const std::map<INTERP_KERNEL::Node *,int>& mapp, int offset, int idThis,
- std::vector<double>& addCoordsQuadratic, std::vector<int>& conn,
- std::vector<int>& connI, std::vector<int>& nb1, std::vector<int>& nb2)
+ const std::map<INTERP_KERNEL::Node *,mcIdType>& mapp, mcIdType offset, mcIdType idThis,
+ std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& conn,
+ std::vector<mcIdType>& connI, std::vector<mcIdType>& nb1, std::vector<mcIdType>& nb2)
{
// Initialise locations on pol1. Remember that edges found in 'notUsedInPol1' are also part of the edges forming pol1.
pol1.initLocations();
INTERPKERNEL_EXPORT double intersectWithAbs1D(QuadraticPolygon& other, bool& isColinear);
//! Before intersecting as intersectWith a normalization is done.
INTERPKERNEL_EXPORT double intersectWithAbs(QuadraticPolygon& other, double* barycenter);
- INTERPKERNEL_EXPORT void splitAbs(QuadraticPolygon& other, const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, const std::vector<int>& otherEdgeIds,
- std::vector<int>& edgesThis, int cellIdThis, std::vector< std::vector<int> >& edgesInOtherColinearWithThis, std::vector< std::vector<int> >& subDivOther, std::vector<double>& addCoo, std::map<int,int>& mergedNodes);
- INTERPKERNEL_EXPORT void buildFromCrudeDataArray(const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *nodalBg, const double *coords,
- const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges);
- INTERPKERNEL_EXPORT void buildFromCrudeDataArray2(const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *nodalBg, const double *coords, const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges,
- const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, const std::vector<std::vector<int> >& intersectEdges1,
- const std::vector< std::vector<int> >& colinear1,
- std::map<int,std::vector<INTERP_KERNEL::ElementaryEdge *> >& alreadyExistingIn2);
- INTERPKERNEL_EXPORT void updateLocOfEdgeFromCrudeDataArray2(const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges, const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, const std::vector<std::vector<int> >& intersectEdges1, const std::vector< std::vector<int> >& colinear1) const;
- INTERPKERNEL_EXPORT void appendEdgeFromCrudeDataArray(std::size_t edgeId, const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *nodalBg, const double *coords,
- const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges);
- INTERPKERNEL_EXPORT void appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, int edgeId, const std::vector<int>& subEdge, const std::map<int,INTERP_KERNEL::Node *>& mapp);
- INTERPKERNEL_EXPORT void appendCrudeData(const std::map<INTERP_KERNEL::Node *,int>& mapp, double xBary, double yBary, double fact, int offset, std::vector<double>& addCoordsQuadratic, std::vector<int>& conn, std::vector<int>& connI) const;
- INTERPKERNEL_EXPORT void buildPartitionsAbs(QuadraticPolygon& other, std::set<INTERP_KERNEL::Edge *>& edgesThis, std::set<INTERP_KERNEL::Edge *>& edgesBoundaryOther, const std::map<INTERP_KERNEL::Node *,int>& mapp, int idThis, int idOther, int offset,
- std::vector<double>& addCoordsQuadratic, std::vector<int>& conn, std::vector<int>& connI, std::vector<int>& nb1, std::vector<int>& nb2);
+ INTERPKERNEL_EXPORT void splitAbs(QuadraticPolygon& other, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, const std::vector<mcIdType>& otherEdgeIds,
+ std::vector<mcIdType>& edgesThis, mcIdType cellIdThis, std::vector< std::vector<mcIdType> >& edgesInOtherColinearWithThis, std::vector< std::vector<mcIdType> >& subDivOther, std::vector<double>& addCoo, std::map<mcIdType,mcIdType>& mergedNodes);
+ INTERPKERNEL_EXPORT void buildFromCrudeDataArray(const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords,
+ const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges);
+ INTERPKERNEL_EXPORT void buildFromCrudeDataArray2(const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords, const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges,
+ const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1, const std::vector<std::vector<mcIdType> >& intersectEdges1,
+ const std::vector< std::vector<mcIdType> >& colinear1,
+ std::map<mcIdType,std::vector<INTERP_KERNEL::ElementaryEdge *> >& alreadyExistingIn2);
+ INTERPKERNEL_EXPORT void updateLocOfEdgeFromCrudeDataArray2(const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges, const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1, const std::vector<std::vector<mcIdType> >& intersectEdges1, const std::vector< std::vector<mcIdType> >& colinear1) const;
+ INTERPKERNEL_EXPORT void appendEdgeFromCrudeDataArray(std::size_t edgeId, const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords,
+ const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges);
+ INTERPKERNEL_EXPORT void appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, mcIdType edgeId, const std::vector<mcIdType>& subEdge, const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp);
+ INTERPKERNEL_EXPORT void appendCrudeData(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapp, double xBary, double yBary, double fact, mcIdType offset, std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& conn, std::vector<mcIdType>& connI) const;
+ INTERPKERNEL_EXPORT void buildPartitionsAbs(QuadraticPolygon& other, std::set<INTERP_KERNEL::Edge *>& edgesThis, std::set<INTERP_KERNEL::Edge *>& edgesBoundaryOther, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapp, mcIdType idThis, mcIdType idOther, mcIdType offset,
+ std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& conn, std::vector<mcIdType>& connI, std::vector<mcIdType>& nb1, std::vector<mcIdType>& nb2);
//
INTERPKERNEL_EXPORT double intersectWith(const QuadraticPolygon& other) const;
INTERPKERNEL_EXPORT double intersectWith(const QuadraticPolygon& other, double* barycenter) const;
INTERPKERNEL_EXPORT std::vector<QuadraticPolygon *> buildIntersectionPolygons(const QuadraticPolygon& pol1, const QuadraticPolygon& pol2) const;
INTERPKERNEL_EXPORT bool haveIAChanceToBeCompletedBy(const QuadraticPolygon& pol1NotSplitted, const QuadraticPolygon& pol2Splitted,
bool& direction, bool& needCleaning) const;
- INTERPKERNEL_EXPORT static void ComputeResidual(const QuadraticPolygon& pol1, const std::set<Edge *>& notUsedInPol1, const std::set<Edge *>& edgesInPol2OnBoundary, const std::map<INTERP_KERNEL::Node *,int>& mapp, int offset, int idThis,
- std::vector<double>& addCoordsQuadratic, std::vector<int>& conn, std::vector<int>& connI, std::vector<int>& nb1, std::vector<int>& nb2);
+ INTERPKERNEL_EXPORT static void ComputeResidual(const QuadraticPolygon& pol1, const std::set<Edge *>& notUsedInPol1, const std::set<Edge *>& edgesInPol2OnBoundary, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapp, mcIdType offset, mcIdType idThis,
+ std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& conn, std::vector<mcIdType>& connI, std::vector<mcIdType>& nb1, std::vector<mcIdType>& nb2);
INTERPKERNEL_EXPORT void cleanDegeneratedConsecutiveEdges();
protected:
std::list<QuadraticPolygon *> zipConsecutiveInSegments() const;
nodes[1]=new Node(quadrangle[SPACEDIM],quadrangle[SPACEDIM+1]);
nodes[2]=new Node(quadrangle[2*SPACEDIM],quadrangle[2*SPACEDIM+1]);
nodes[3]=new Node(quadrangle[3*SPACEDIM],quadrangle[3*SPACEDIM+1]);
- int nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
+ std::size_t nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
std::vector<Node *> nodes2(nbOfSourceNodes);
- for(int i=0;i<nbOfSourceNodes;i++)
+ for(std::size_t i=0;i<nbOfSourceNodes;i++)
nodes2[i]=new Node(sourceCoords[i*SPACEDIM],sourceCoords[i*SPACEDIM+1]);
QuadraticPolygon *p1=QuadraticPolygon::BuildLinearPolygon(nodes);
QuadraticPolygon *p2;
double GEO2D_INTERSECTOR::intersectGeometryGeneral(const std::vector<double>& targetCoords,
const std::vector<double>& sourceCoords)
{
- int nbOfTargetNodes=targetCoords.size()/SPACEDIM;
+ std::size_t nbOfTargetNodes=targetCoords.size()/SPACEDIM;
std::vector<Node *> nodes(nbOfTargetNodes);
- for(int i=0;i<nbOfTargetNodes;i++)
+ for(std::size_t i=0;i<nbOfTargetNodes;i++)
nodes[i]=new Node(targetCoords[i*SPACEDIM],targetCoords[i*SPACEDIM+1]);
- int nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
+ std::size_t nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
std::vector<Node *> nodes2(nbOfSourceNodes);
- for(int i=0;i<nbOfSourceNodes;i++)
+ for(std::size_t i=0;i<nbOfSourceNodes;i++)
nodes2[i]=new Node(sourceCoords[i*SPACEDIM],sourceCoords[i*SPACEDIM+1]);
QuadraticPolygon *p1=QuadraticPolygon::BuildLinearPolygon(nodes);
QuadraticPolygon *p2=QuadraticPolygon::BuildLinearPolygon(nodes2);
nodes[0]=new Node(sourceTria[0*SPACEDIM],sourceTria[0*SPACEDIM+1]);
nodes[1]=new Node(sourceTria[1*SPACEDIM],sourceTria[1*SPACEDIM+1]);
nodes[2]=new Node(sourceTria[2*SPACEDIM],sourceTria[2*SPACEDIM+1]);
- int nbOfTargetNodes=targetCell.size()/SPACEDIM;
+ std::size_t nbOfTargetNodes=targetCell.size()/SPACEDIM;
std::vector<Node *> nodes2(nbOfTargetNodes);
- for(int i=0;i<nbOfTargetNodes;i++)
+ for(std::size_t i=0;i<nbOfTargetNodes;i++)
nodes2[i]=new Node(targetCell[i*SPACEDIM],targetCell[i*SPACEDIM+1]);
QuadraticPolygon *p1=QuadraticPolygon::BuildLinearPolygon(nodes);
QuadraticPolygon *p2;
INTERSECTOR_TEMPLATE
QuadraticPolygon *GEO2D_INTERSECTOR::buildPolygonFrom(const std::vector<double>& coords, NormalizedCellType type)
{
- int nbNodes=coords.size()/SPACEDIM;
+ std::size_t nbNodes=coords.size()/SPACEDIM;
std::vector<Node *> nodes(nbNodes);
- for(int i=0;i<nbNodes;i++)
+ for(std::size_t i=0;i<nbNodes;i++)
nodes[i]=new Node(coords[i*SPACEDIM],coords[i*SPACEDIM+1]);
if(!CellModel::GetCellModel(type).isQuadratic())
return QuadraticPolygon::BuildLinearPolygon(nodes);
typedef typename MyMeshType::MyConnType ConnType;
public:
IntegralUniformIntersectorP0(const MyMeshType& mesh, bool isAbs);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
void intersectCells(ConnType targetCell, const std::vector<ConnType>& srcCells, MyMatrix& res);
};
typedef typename MyMeshType::MyConnType ConnType;
public:
IntegralUniformIntersectorP1(const MyMeshType& mesh, bool isAbs);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
void intersectCells(ConnType targetCell, const std::vector<ConnType>& srcCells, MyMatrix& res);
};
}
}
template<class MyMeshType, class MyMatrix>
- int IntegralUniformIntersectorP0<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType IntegralUniformIntersectorP0<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
{
if(IntegralUniformIntersector<MyMeshType,MyMatrix>::_from_to)
return 1;
}
template<class MyMeshType, class MyMatrix>
- int IntegralUniformIntersectorP0<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType IntegralUniformIntersectorP0<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
{
if(IntegralUniformIntersector<MyMeshType,MyMatrix>::_from_to)
return IntegralUniformIntersector<MyMeshType,MyMatrix>::_mesh.getNumberOfElements();
{
static const NumberingPolicy numPol=MyMeshType::My_numPol;
res.resize(getNumberOfRowsOfResMatrix());
- unsigned long nbelem=IntegralUniformIntersector<MyMeshType,MyMatrix>::_mesh.getNumberOfElements();
+ ConnType nbelem=IntegralUniformIntersector<MyMeshType,MyMatrix>::_mesh.getNumberOfElements();
const ConnType *connIndx=IntegralUniformIntersector<MyMeshType,MyMatrix>::_mesh.getConnectivityIndexPtr();
const ConnType *conn=IntegralUniformIntersector<MyMeshType,MyMatrix>::_mesh.getConnectivityPtr();
const double *coords=IntegralUniformIntersector<MyMeshType,MyMatrix>::_mesh.getCoordinatesPtr();
- for(unsigned long i=0;i<nbelem;i++)
+ for(ConnType i=0;i<nbelem;i++)
{
INTERP_KERNEL::NormalizedCellType t=IntegralUniformIntersector<MyMeshType,MyMatrix>::_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(i));
double val=computeVolSurfOfCell<ConnType,numPol,MyMeshType::MY_SPACEDIM>(t,conn+OTT<ConnType,numPol>::ind2C(connIndx[i]),connIndx[i+1]-connIndx[i],coords);
}
template<class MyMeshType, class MyMatrix>
- int IntegralUniformIntersectorP1<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType IntegralUniformIntersectorP1<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
{
if(IntegralUniformIntersector<MyMeshType,MyMatrix>::_from_to)
return 1;
}
template<class MyMeshType, class MyMatrix>
- int IntegralUniformIntersectorP1<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType IntegralUniformIntersectorP1<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
{
if(IntegralUniformIntersector<MyMeshType,MyMatrix>::_from_to)
return IntegralUniformIntersector<MyMeshType,MyMatrix>::_mesh.getNumberOfNodes();
{
static const NumberingPolicy numPol=MyMeshType::My_numPol;
res.resize(getNumberOfRowsOfResMatrix());
- unsigned long nbelem=IntegralUniformIntersector<MyMeshType,MyMatrix>::_mesh.getNumberOfElements();
+ ConnType nbelem=IntegralUniformIntersector<MyMeshType,MyMatrix>::_mesh.getNumberOfElements();
const ConnType *connIndx=IntegralUniformIntersector<MyMeshType,MyMatrix>::_mesh.getConnectivityIndexPtr();
const ConnType *conn=IntegralUniformIntersector<MyMeshType,MyMatrix>::_mesh.getConnectivityPtr();
const double *coords=IntegralUniformIntersector<MyMeshType,MyMatrix>::_mesh.getCoordinatesPtr();
- for(unsigned long i=0;i<nbelem;i++)
+ for(ConnType i=0;i<nbelem;i++)
{
INTERP_KERNEL::NormalizedCellType t=IntegralUniformIntersector<MyMeshType,MyMatrix>::_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(i));
- int lgth=connIndx[i+1]-connIndx[i];
+ ConnType lgth=connIndx[i+1]-connIndx[i];
const ConnType *locConn=conn+OTT<ConnType,numPol>::ind2C(connIndx[i]);
double val=computeVolSurfOfCell<ConnType,numPol,MyMeshType::MY_SPACEDIM>(t,locConn,lgth,coords);
if(t==NORM_TRI3)
val/=4.;
else
throw INTERP_KERNEL::Exception("Invalid cell type detected : must be TRI3 or TETRA4 ! ");
- for(int j=0;j<lgth;j++)
+ for(ConnType j=0;j<lgth;j++)
IntegralUniformIntersector<MyMeshType,MyMatrix>::putValueIn(OTT<ConnType,numPol>::coo2C(locConn[j]),val,res);
}
}
* It retrieves the same cell with a potentially different type (in return) whose connectivity is defined by (retConn,retLgth)
* \b WARNING for optimization reason the arrays 'retConn' and 'conn' can overlapped !
*/
-INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const int *conn, int lgth, int *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
- std::set<int> c(conn,conn+lgth);
+ std::set<mcIdType> c(conn,conn+lgth);
c.erase(-1);
- bool isObviousNonDegeneratedCell=((int)c.size()==lgth);
+ bool isObviousNonDegeneratedCell=(ToIdType(c.size())==lgth);
if((cm.getDimension()==3 && cm.isQuadratic()) || isObviousNonDegeneratedCell)
{//quadratic 3D, do nothing for the moment.
retLgth=lgth;
- int *tmp=new int[lgth];//no direct std::copy ! overlapping of conn and retConn !
+ mcIdType *tmp=new mcIdType[lgth];//no direct std::copy ! overlapping of conn and retConn !
std::copy(conn,conn+lgth,tmp);
std::copy(tmp,tmp+lgth,retConn);
delete [] tmp;
}
if(cm.getDimension()==2)
{
- int *tmp=new int[lgth];
+ mcIdType *tmp=new mcIdType[lgth];
int newPos=0;
if(!cm.isQuadratic())
{
}
else
{
- int quadOff = lgth/2;
- int *tmpQuad = new int[quadOff];
+ mcIdType quadOff = lgth/2;
+ mcIdType *tmpQuad = new mcIdType[quadOff];
for(int i = 0; i < quadOff; i++)
if(conn[i] != conn[(i+1)%quadOff] || conn[i] != conn[i+quadOff]) // zip nul segments/arcs (quad point must match too)
{
}
if(cm.getDimension()==3)
{
- int nbOfFaces,lgthOfPolyhConn;
- int *zipFullReprOfPolyh=getFullPolyh3DCell(type,conn,lgth,nbOfFaces,lgthOfPolyhConn);
+ mcIdType nbOfFaces,lgthOfPolyhConn;
+ mcIdType *zipFullReprOfPolyh=getFullPolyh3DCell(type,conn,lgth,nbOfFaces,lgthOfPolyhConn);
INTERP_KERNEL::NormalizedCellType ret=tryToUnPoly3D(zipFullReprOfPolyh,nbOfFaces,lgthOfPolyhConn,retConn,retLgth);
delete [] zipFullReprOfPolyh;
return ret;
* This static method tries to unpolygonize a cell whose connectivity is given by 'conn' and 'lgth'.
* Contrary to INTERP_KERNEL::CellSimplify::simplifyDegeneratedCell method 'conn' and 'retConn' do not overlap.
*/
-INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly2D(bool isQuad, const int *conn, int lgth, int *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly2D(bool isQuad, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
retLgth=lgth;
std::copy(conn,conn+lgth,retConn);
* The format of output array is the following :
* 1,2,3,-1,3,4,2,-1,3,4,1,-1,1,2,4,NORM_TRI3,NORM_TRI3,NORM_TRI3 (faces type at the end of classical polyhedron nodal description)
*/
-int *CellSimplify::getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const int *conn, int lgth,
- int& retNbOfFaces, int& retLgth)
+mcIdType *CellSimplify::getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth,
+ mcIdType& retNbOfFaces, mcIdType& retLgth)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
unsigned nbOfFaces=cm.getNumberOfSons2(conn,lgth);
- int *tmp=new int[nbOfFaces*(lgth+1)];
- int *work=tmp;
- std::vector<int> faces;
+ mcIdType *tmp=new mcIdType[nbOfFaces*(lgth+1)];
+ mcIdType *work=tmp;
+ std::vector<mcIdType> faces;
for(unsigned j=0;j<nbOfFaces;j++)
{
INTERP_KERNEL::NormalizedCellType type2;
unsigned offset=cm.fillSonCellNodalConnectivity2(j,conn,lgth,work,type2);
//
- int *tmp2=new int[offset];
+ mcIdType *tmp2=new mcIdType[offset];
tmp2[0]=work[0];
- int newPos=1;
+ mcIdType newPos=1;
for(unsigned k=1;k<offset;k++)
if(std::find(tmp2,tmp2+newPos,work[k])==tmp2+newPos)
tmp2[newPos++]=work[k];
delete [] tmp2;
continue;
}
- int tmp3;
+ mcIdType tmp3;
faces.push_back(tryToUnPoly2D(CellModel::GetCellModel(type2).isQuadratic(),tmp2,newPos,work,tmp3));
delete [] tmp2;
//
* method INTERP_KERNEL::CellSimplify::getFullPolyh3DCell ) and 'lgth'+'nbOfFaces'.
* Contrary to INTERP_KERNEL::CellSimplify::simplifyDegeneratedCell method 'conn' and 'retConn' do not overlap.
*/
-INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly3D(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly3D(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
- std::set<int> nodes(conn,conn+lgth);
+ std::set<mcIdType> nodes(conn,conn+lgth);
nodes.erase(-1);
- int nbOfNodes=(int)nodes.size();
- int magicNumber=100*nbOfNodes+nbOfFaces;
+ std::size_t nbOfNodes=nodes.size();
+ std::size_t magicNumber=100*nbOfNodes+nbOfFaces;
switch(magicNumber)
{
case 806:
}
}
-bool CellSimplify::orientOppositeFace(const int *baseFace, int *retConn, const int *sideFace, int lgthBaseFace)
+bool CellSimplify::orientOppositeFace(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace)
{
- std::vector<int> tmp2;
- std::set<int> bases(baseFace,baseFace+lgthBaseFace);
- std::set<int> sides(sideFace,sideFace+4);
- std::set_intersection(bases.begin(),bases.end(),sides.begin(),sides.end(),std::back_insert_iterator< std::vector<int> >(tmp2));
+ std::vector<mcIdType> tmp2;
+ std::set<mcIdType> bases(baseFace,baseFace+lgthBaseFace);
+ std::set<mcIdType> sides(sideFace,sideFace+4);
+ std::set_intersection(bases.begin(),bases.end(),sides.begin(),sides.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp2));
if(tmp2.size()!=2)
return false;
- std::vector< std::pair<int,int> > baseEdges(lgthBaseFace);
- std::vector< std::pair<int,int> > oppEdges(lgthBaseFace);
- std::vector< std::pair<int,int> > sideEdges(4);
- for(int i=0;i<lgthBaseFace;i++)
+ std::vector< std::pair<mcIdType,mcIdType> > baseEdges(lgthBaseFace);
+ std::vector< std::pair<mcIdType,mcIdType> > oppEdges(lgthBaseFace);
+ std::vector< std::pair<mcIdType,mcIdType> > sideEdges(4);
+ for(mcIdType i=0;i<lgthBaseFace;i++)
{
- baseEdges[i]=std::pair<int,int>(baseFace[i],baseFace[(i+1)%lgthBaseFace]);
- oppEdges[i]=std::pair<int,int>(retConn[i],retConn[(i+1)%lgthBaseFace]);
+ baseEdges[i]=std::pair<mcIdType,mcIdType>(baseFace[i],baseFace[(i+1)%lgthBaseFace]);
+ oppEdges[i]=std::pair<mcIdType,mcIdType>(retConn[i],retConn[(i+1)%lgthBaseFace]);
}
for(int i=0;i<4;i++)
- sideEdges[i]=std::pair<int,int>(sideFace[i],sideFace[(i+1)%4]);
- std::vector< std::pair<int,int> > tmp;
- std::set< std::pair<int,int> > baseEdgesS(baseEdges.begin(),baseEdges.end());
- std::set< std::pair<int,int> > sideEdgesS(sideEdges.begin(),sideEdges.end());
- std::set_intersection(baseEdgesS.begin(),baseEdgesS.end(),sideEdgesS.begin(),sideEdgesS.end(),std::back_insert_iterator< std::vector< std::pair<int,int> > >(tmp));
+ sideEdges[i]=std::pair<mcIdType,mcIdType>(sideFace[i],sideFace[(i+1)%4]);
+ std::vector< std::pair<mcIdType,mcIdType> > tmp;
+ std::set< std::pair<mcIdType,mcIdType> > baseEdgesS(baseEdges.begin(),baseEdges.end());
+ std::set< std::pair<mcIdType,mcIdType> > sideEdgesS(sideEdges.begin(),sideEdges.end());
+ std::set_intersection(baseEdgesS.begin(),baseEdgesS.end(),sideEdgesS.begin(),sideEdgesS.end(),std::back_insert_iterator< std::vector< std::pair<mcIdType,mcIdType> > >(tmp));
if(tmp.empty())
{
//reverse sideFace
for(int i=0;i<4;i++)
{
- std::pair<int,int> p=sideEdges[i];
- std::pair<int,int> r(p.second,p.first);
+ std::pair<mcIdType,mcIdType> p=sideEdges[i];
+ std::pair<mcIdType,mcIdType> r(p.second,p.first);
sideEdges[i]=r;
}
//end reverse sideFace
- std::set< std::pair<int,int> > baseEdgesS2(baseEdges.begin(),baseEdges.end());
- std::set< std::pair<int,int> > sideEdgesS2(sideEdges.begin(),sideEdges.end());
- std::set_intersection(baseEdgesS2.begin(),baseEdgesS2.end(),sideEdgesS2.begin(),sideEdgesS2.end(),std::back_insert_iterator< std::vector< std::pair<int,int> > >(tmp));
+ std::set< std::pair<mcIdType,mcIdType> > baseEdgesS2(baseEdges.begin(),baseEdges.end());
+ std::set< std::pair<mcIdType,mcIdType> > sideEdgesS2(sideEdges.begin(),sideEdges.end());
+ std::set_intersection(baseEdgesS2.begin(),baseEdgesS2.end(),sideEdgesS2.begin(),sideEdgesS2.end(),std::back_insert_iterator< std::vector< std::pair<mcIdType,mcIdType> > >(tmp));
if(tmp.empty())
return false;
}
if(tmp.size()!=1)
return false;
bool found=false;
- std::pair<int,int> pInOpp;
+ std::pair<mcIdType,mcIdType> pInOpp;
for(int i=0;i<4 && !found;i++)
{//finding the pair(edge) in sideFace that do not include any node of tmp[0] edge
found=(tmp[0].first!=sideEdges[i].first && tmp[0].first!=sideEdges[i].second &&
if(!found)
return false;
int pos=(int)std::distance(baseEdges.begin(),std::find(baseEdges.begin(),baseEdges.end(),tmp[0]));
- std::vector< std::pair<int,int> >::iterator it=std::find(oppEdges.begin(),oppEdges.end(),pInOpp);
+ std::vector< std::pair<mcIdType,mcIdType> >::iterator it=std::find(oppEdges.begin(),oppEdges.end(),pInOpp);
if(it==oppEdges.end())//the opposite edge of side face is not found opposite face ... maybe problem of orientation of polyhedron
return false;
- int pos2=(int)std::distance(oppEdges.begin(),it);
- int offset=pos-pos2;
+ mcIdType pos2=ToIdType(std::distance(oppEdges.begin(),it));
+ mcIdType offset=pos-pos2;
if(offset<0)
offset+=lgthBaseFace;
//this is the end copy the result
- int *tmp3=new int[lgthBaseFace];
+ mcIdType *tmp3=new mcIdType[lgthBaseFace];
for(int i=0;i<lgthBaseFace;i++)
tmp3[(offset+i)%lgthBaseFace]=oppEdges[i].first;
std::copy(tmp3,tmp3+lgthBaseFace,retConn);
return true;
}
-bool CellSimplify::isWellOriented(const int *baseFace, int *retConn, const int *sideFace, int lgthBaseFace)
+bool CellSimplify::isWellOriented(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace)
{
return true;
}
* k_th node in retConnOfOppFace. Excluded faces 'baseFace' and 'oppFace' all the other faces in 'conn' must be QUAD4 faces.
* If the arrangement process succeeds true is returned and retConnOfOppFace is filled.
*/
-bool CellSimplify::tryToArrangeOppositeFace(const int *conn, int lgth, int lgthBaseFace, const int *baseFace, const int *oppFace, int nbOfFaces, int *retConnOfOppFace)
+bool CellSimplify::tryToArrangeOppositeFace(const mcIdType *conn, mcIdType lgth, mcIdType lgthBaseFace, const mcIdType *baseFace, const mcIdType *oppFace, mcIdType nbOfFaces, mcIdType *retConnOfOppFace)
{
retConnOfOppFace[0]=oppFace[0];
- for(int j=1;j<lgthBaseFace;j++)
+ for(mcIdType j=1;j<lgthBaseFace;j++)
retConnOfOppFace[j]=oppFace[lgthBaseFace-j];
- const int *curFace=conn;
+ const mcIdType *curFace=conn;
int sideFace=0;
bool ret=true;
for(int i=0;i<nbOfFaces && ret;i++)
* This method is only callable if in 'conn' there is 8 nodes and 6 faces.
* If fails a POLYHED is returned.
*/
-INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHex8(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHex8(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
- if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to<int>(),(int)INTERP_KERNEL::NORM_QUAD4))==conn+lgth+nbOfFaces)
+ if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to<mcIdType>(),ToIdType(INTERP_KERNEL::NORM_QUAD4)))==conn+lgth+nbOfFaces)
{//6 faces are QUAD4.
int oppositeFace=-1;
- std::set<int> conn1(conn,conn+4);
+ std::set<mcIdType> conn1(conn,conn+4);
for(int i=1;i<6 && oppositeFace<0;i++)
{
- std::vector<int> tmp;
- std::set<int> conn2(conn+5*i,conn+5*i+4);
- std::set_intersection(conn1.begin(),conn1.end(),conn2.begin(),conn2.end(),std::back_insert_iterator< std::vector<int> >(tmp));
+ std::vector<mcIdType> tmp;
+ std::set<mcIdType> conn2(conn+5*i,conn+5*i+4);
+ std::set_intersection(conn1.begin(),conn1.end(),conn2.begin(),conn2.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
if(tmp.empty())
oppositeFace=i;
}
if(oppositeFace>=1)
{//oppositeFace of face#0 found.
- int tmp2[4];
+ mcIdType tmp2[4];
if(tryToArrangeOppositeFace(conn,lgth,4,conn,conn+5*oppositeFace,6,tmp2))
{
std::copy(conn,conn+4,retConn);
return INTERP_KERNEL::NORM_POLYHED;
}
-INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
- std::size_t nbOfHexagon=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_POLYGON);
- std::size_t nbOfQuad=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_QUAD4);
+ std::size_t nbOfHexagon=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON));
+ std::size_t nbOfQuad=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4));
if(nbOfQuad==6 && nbOfHexagon==2)
{
- const int *hexag0=std::find(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_POLYGON);
+ const mcIdType *hexag0=std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON));
std::size_t hexg0Id=std::distance(conn+lgth,hexag0);
- const int *hexag1=std::find(hexag0+1,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_POLYGON);
+ const mcIdType *hexag1=std::find(hexag0+1,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON));
std::size_t hexg1Id=std::distance(conn+lgth,hexag1);
- const int *connHexag0=conn+5*hexg0Id;
+ const mcIdType *connHexag0=conn+5*hexg0Id;
std::size_t lgthH0=std::distance(connHexag0,std::find(connHexag0,conn+lgth,-1));
if(lgthH0==6)
{
- const int *connHexag1=conn+5*hexg0Id+7+(hexg1Id-hexg0Id-1)*5;
+ const mcIdType *connHexag1=conn+5*hexg0Id+7+(hexg1Id-hexg0Id-1)*5;
std::size_t lgthH1=std::distance(connHexag1,std::find(connHexag1,conn+lgth,-1));
if(lgthH1==6)
{
- std::vector<int> tmp;
- std::set<int> conn1(connHexag0,connHexag0+6);
- std::set<int> conn2(connHexag1,connHexag1+6);
- std::set_intersection(conn1.begin(),conn1.end(),conn2.begin(),conn2.end(),std::back_insert_iterator< std::vector<int> >(tmp));
+ std::vector<mcIdType> tmp;
+ std::set<mcIdType> conn1(connHexag0,connHexag0+6);
+ std::set<mcIdType> conn2(connHexag1,connHexag1+6);
+ std::set_intersection(conn1.begin(),conn1.end(),conn2.begin(),conn2.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
if(tmp.empty())
{
- int tmp2[6];
+ mcIdType tmp2[6];
if(tryToArrangeOppositeFace(conn,lgth,6,connHexag0,connHexag1,8,tmp2))
{
std::copy(connHexag0,connHexag0+6,retConn);
* Cell with 'conn' connectivity has been detected as a good candidate. Full check of this. If yes NORM_PENTA6 is returned.
* If fails a POLYHED is returned.
*/
-INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
- std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3);
- std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_QUAD4);
+ std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3));
+ std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4));
if(nbOfTriFace==2 && nbOfQuadFace==3)
{
- std::size_t tri3_0=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3));
- std::size_t tri3_1=std::distance(conn+lgth,std::find(conn+lgth+tri3_0+1,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3));
- const int *tri_0=0,*tri_1=0;
- const int *w=conn;
+ std::size_t tri3_0=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3)));
+ std::size_t tri3_1=std::distance(conn+lgth,std::find(conn+lgth+tri3_0+1,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3)));
+ const mcIdType *tri_0=0,*tri_1=0;
+ const mcIdType *w=conn;
for(std::size_t i=0;i<5;i++)
{
if(i==tri3_0)
w=std::find(w,conn+lgth,-1);
w++;
}
- std::vector<int> tmp;
- std::set<int> conn1(tri_0,tri_0+3);
- std::set<int> conn2(tri_1,tri_1+3);
- std::set_intersection(conn1.begin(),conn1.end(),conn2.begin(),conn2.end(),std::back_insert_iterator< std::vector<int> >(tmp));
+ std::vector<mcIdType> tmp;
+ std::set<mcIdType> conn1(tri_0,tri_0+3);
+ std::set<mcIdType> conn2(tri_1,tri_1+3);
+ std::set_intersection(conn1.begin(),conn1.end(),conn2.begin(),conn2.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
if(tmp.empty())
{
- int tmp2[3];
+ mcIdType tmp2[3];
if(tryToArrangeOppositeFace(conn,lgth,3,tri_0,tri_1,5,tmp2))
{
std::copy(tri_0,tri_0+3,retConn);
* Cell with 'conn' connectivity has been detected as a good candidate. Full check of this. If yes NORM_PYRA5 is returned.
* If fails a POLYHED is returned.
*/
-INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
- std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3);
- std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_QUAD4);
+ std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3));
+ std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4));
if(nbOfTriFace==4 && nbOfQuadFace==1)
{
- std::size_t quad4_pos=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_QUAD4));
- const int *quad4=0;
- const int *w=conn;
+ std::size_t quad4_pos=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4)));
+ const mcIdType *quad4=0;
+ const mcIdType *w=conn;
for(std::size_t i=0;i<5 && quad4==0;i++)
{
if(i==quad4_pos)
w=std::find(w,conn+lgth,-1);
w++;
}
- std::set<int> quad4S(quad4,quad4+4);
+ std::set<mcIdType> quad4S(quad4,quad4+4);
w=conn;
bool ok=true;
- int point=-1;
+ mcIdType point=-1;
for(std::size_t i=0;i<5 && ok;i++)
{
if(i!=quad4_pos)
{
- std::vector<int> tmp;
- std::set<int> conn2(w,w+3);
- std::set_intersection(conn2.begin(),conn2.end(),quad4S.begin(),quad4S.end(),std::back_insert_iterator< std::vector<int> >(tmp));
+ std::vector<mcIdType> tmp;
+ std::set<mcIdType> conn2(w,w+3);
+ std::set_intersection(conn2.begin(),conn2.end(),quad4S.begin(),quad4S.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
ok=tmp.size()==2;
tmp.clear();
- std::set_difference(conn2.begin(),conn2.end(),quad4S.begin(),quad4S.end(),std::back_insert_iterator< std::vector<int> >(tmp));
+ std::set_difference(conn2.begin(),conn2.end(),quad4S.begin(),quad4S.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
ok=ok && tmp.size()==1;
if(ok)
{
* Cell with 'conn' connectivity has been detected as a good candidate. Full check of this. If yes NORM_TETRA4 is returned.
* If fails a POLYHED is returned.
*/
-INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyTetra4(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyTetra4(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
- if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to<int>(),(int)INTERP_KERNEL::NORM_TRI3))==conn+lgth+nbOfFaces)
+ if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to<mcIdType>(),ToIdType(INTERP_KERNEL::NORM_TRI3)))==conn+lgth+nbOfFaces)
{
- std::set<int> tribase(conn,conn+3);
- int point=-1;
+ std::set<mcIdType> tribase(conn,conn+3);
+ mcIdType point=-1;
bool ok=true;
for(int i=1;i<4 && ok;i++)
{
- std::vector<int> tmp;
- std::set<int> conn2(conn+i*4,conn+4*i+3);
- std::set_intersection(conn2.begin(),conn2.end(),tribase.begin(),tribase.end(),std::back_insert_iterator< std::vector<int> >(tmp));
+ std::vector<mcIdType> tmp;
+ std::set<mcIdType> conn2(conn+i*4,conn+4*i+3);
+ std::set_intersection(conn2.begin(),conn2.end(),tribase.begin(),tribase.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
ok=tmp.size()==2;
tmp.clear();
- std::set_difference(conn2.begin(),conn2.end(),tribase.begin(),tribase.end(),std::back_insert_iterator< std::vector<int> >(tmp));
+ std::set_difference(conn2.begin(),conn2.end(),tribase.begin(),tribase.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
ok=ok && tmp.size()==1;
if(ok)
{
* - fully degenerated polygons (polygon with 1 point, or 2 if quadratic)
* - quad polygon with 2 points and two identical quad points
*/
-bool CellSimplify::isFlatCell(const int* conn, int pos, int lgth, NormalizedCellType type)
+bool CellSimplify::isFlatCell(const mcIdType* conn, mcIdType pos, mcIdType lgth, NormalizedCellType type)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if ( lgth <= 2 ) // a polygon with a single, or two points has been returned. This check also captures degenerated quadratics
#include "INTERPKERNELDefines.hxx"
#include "NormalizedUnstructuredMesh.hxx"
#include "InterpKernelException.hxx"
+#include "MCIdType.hxx"
namespace INTERP_KERNEL
{
class INTERPKERNEL_EXPORT CellSimplify
{
public:
- static INTERP_KERNEL::NormalizedCellType simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const int *conn, int lgth, int *retConn, int& retLgth);
- static int *getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const int *conn, int lgth,
- int& retNbOfFaces, int& retLgth);
- static INTERP_KERNEL::NormalizedCellType tryToUnPoly2D(bool isQuad, const int *conn, int lgth, int *retConn, int& retLgth);
- static INTERP_KERNEL::NormalizedCellType tryToUnPoly3D(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth);
- static INTERP_KERNEL::NormalizedCellType tryToUnPolyHex8(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth);
- static INTERP_KERNEL::NormalizedCellType tryToUnPolyHexp12(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth);
- static INTERP_KERNEL::NormalizedCellType tryToUnPolyPenta6(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth);
- static INTERP_KERNEL::NormalizedCellType tryToUnPolyPyra5(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth);
- static INTERP_KERNEL::NormalizedCellType tryToUnPolyTetra4(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth);
- static bool tryToArrangeOppositeFace(const int *conn, int lgth, int lgthBaseFace, const int *baseFace, const int *oppFaceId, int nbOfFaces, int *retConnOfOppFace);
- static bool isWellOriented(const int *baseFace, int *retConn, const int *sideFace, int lgthBaseFace);
- static bool orientOppositeFace(const int *baseFace, int *retConn, const int *sideFace, int lgthBaseFace);
- static bool isFlatCell(const int* conn, int pos, int lgth, NormalizedCellType type);
+ static INTERP_KERNEL::NormalizedCellType simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static mcIdType *getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth,
+ mcIdType& retNbOfFaces, mcIdType& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPoly2D(bool isQuad, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPoly3D(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPolyHex8(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPolyHexp12(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPolyPenta6(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPolyPyra5(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPolyTetra4(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static bool tryToArrangeOppositeFace(const mcIdType *conn, mcIdType lgth, mcIdType lgthBaseFace, const mcIdType *baseFace, const mcIdType *oppFaceId, mcIdType nbOfFaces, mcIdType *retConnOfOppFace);
+ static bool isWellOriented(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace);
+ static bool orientOppositeFace(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace);
+ static bool isFlatCell(const mcIdType* conn, mcIdType pos, mcIdType lgth, NormalizedCellType type);
};
}
* \param [in] incy the increment between successive entries in \a dy.
* \return the sum of the product of the corresponding entries of \a dx and \a dy.
*/
- double ddot(int n, const double *dx, int incx, const double *dy, int incy)
+ double ddot(mcIdType n, const double *dx, mcIdType incx, const double *dy, mcIdType incy)
{
double dtemp=0.0;
- int i,ix,iy,m;
+ mcIdType i,ix,iy,m;
if(n<=0)
return dtemp;
// Code for unequal increments or equal increments not equal to 1.
}
- void dscal(int n, double sa, double *x, int incx)
+ void dscal(mcIdType n, double sa, double *x, mcIdType incx)
{
- int i,ix,m;
+ mcIdType i,ix,m;
if(n<=0) { }
else if(incx==1)
}
}
- void daxpy(int n, double da, const double *dx, int incx, double *dy, int incy)
+ void daxpy(mcIdType n, double da, const double *dx, mcIdType incx, double *dy, mcIdType incy)
{
- int i,ix,iy,m;
+ mcIdType i,ix,iy,m;
if (n<=0)
return;
if (da==0.0)
return -x;
}
- void dswap(int n, double *x, int incx, double *y, int incy)
+ void dswap(mcIdType n, double *x, mcIdType incx, double *y, mcIdType incy)
{
- int i,ix,iy,m;
+ mcIdType i,ix,iy,m;
double temp;
if(n<=0) { }
* \param [in] incx the increment between successive entries of SX.
* \return the index of the element of maximum absolute value (in C convention).
*/
- int idamax(int n, const double *dx, int incx)
+ mcIdType idamax(mcIdType n, const double *dx, mcIdType incx)
{
double dmax;
- int i,ix,value;
+ mcIdType i,ix,value;
value=-1;
if ( n < 1 || incx <= 0 )
return value;
* - K, if U(K-1,K-1) == 0. This is not an error condition for this subroutine,
* but it does indicate that DGESL or DGEDI will divide by zero if called.
*/
- int dgefa(double *a, int lda, int n, int *ipvt)
+ mcIdType dgefa(double *a, mcIdType lda, mcIdType n, mcIdType *ipvt)
{
- int info=0;
- int l;
+ mcIdType info=0;
+ mcIdType l;
double t;
// Gaussian elimination with partial pivoting.
- for(int k=0;k<n-1;k++)
+ for(mcIdType k=0;k<n-1;k++)
{
// Find L=pivot index.
l=idamax(n-k,a+k+k*lda,1)+k;
t=-1.0/a[k+k*lda];
dscal(n-k-1,t,a+k+1+k*lda,1);
// Row elimination with column indexing.
- for(int j=k+1;j<n;j++)
+ for(mcIdType j=k+1;j<n;j++)
{
t=a[l+j*lda];
if(l!=k)
* \param [in] ipvt, the pivot vector from dgfa.
* \param [in,out] work a work array of size at least equal to \a n.
*/
- void dgedi(double *a, int lda, int n, const int *ipvt, double *work)
+ void dgedi(double *a, mcIdType lda, mcIdType n, const mcIdType *ipvt, double *work)
{
double t;
- for(int k=0;k<n;k++)
+ for(mcIdType k=0;k<n;k++)
{
a[k+k*lda]=1.0/a[k+k*lda];
t=-a[k+k*lda];
dscal(k,t,a+0+k*lda,1);
- for(int j=k+1;j<n;j++)
+ for(mcIdType j=k+1;j<n;j++)
{
t=a[k+j*lda];
a[k+j*lda]=0.0;
}
}
// Form inverse(U) * inverse(L).
- for(int k=n-2;k>=0;k--)
+ for(mcIdType k=n-2;k>=0;k--)
{
- for(int i=k+1;i<n;i++)
+ for(mcIdType i=k+1;i<n;i++)
{
work[i]=a[i+k*lda];
a[i+k*lda]=0.0;
}
- for(int j=k+1;j<n;j++)
+ for(mcIdType j=k+1;j<n;j++)
{
t=work[j];
daxpy(n,t,a+0+j*lda,1,a+0+k*lda,1);
}
- int l=ipvt[k];
+ mcIdType l=ipvt[k];
if(l!=k-1)
dswap(n,a+0+k*lda,1,a+0+l*lda,1);
}
}
- void matrixProduct(const double *A, int n1, int p1, const double *B, int n2, int p2, double *C)
+ void matrixProduct(const double *A, mcIdType n1, mcIdType p1, const double *B, mcIdType n2, mcIdType p2, double *C)
{
if(p1!=n2)
{
std::ostringstream oss; oss << "matrixProduct : the size of input matrix are not coherent the nb of cols of input matrix #0 is " << p1 << " whereas the number of rows of input matrix #1 is " << n2 << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- for(int i=0;i<n1;i++)
+ for(mcIdType i=0;i<n1;i++)
{
- for(int j=0;j<p2;j++)
+ for(mcIdType j=0;j<p2;j++)
{
C[i*p2+j] = 0.;
- for(int k=0;k<p1;k++)
+ for(mcIdType k=0;k<p1;k++)
C[i*p2+j]+=A[i*p1+k]*B[k*p2+j];
}
}
}
- void inverseMatrix(const double *A, int n, double *iA)
+ void inverseMatrix(const double *A, mcIdType n, double *iA)
{
- INTERP_KERNEL::AutoPtr<int> ipvt=new int[n];
+ INTERP_KERNEL::AutoPtr<mcIdType> ipvt=new mcIdType[n];
INTERP_KERNEL::AutoPtr<double> work=new double[n*n];
std::copy(A,A+n*n,iA);
dgefa(iA,n,n,ipvt);
#define __INTERPKERNELMATRIXTOOLS_HXX__
#include "INTERPKERNELDefines.hxx"
+#include "MCIdType.hxx"
namespace INTERP_KERNEL
{
- void INTERPKERNEL_EXPORT matrixProduct(const double *A, int n1, int p1, const double *B, int n2, int p2, double *C);
- void INTERPKERNEL_EXPORT inverseMatrix(const double *A, int n, double *iA);
- void INTERPKERNEL_EXPORT daxpy(int n, double da, const double *dx, int incx, double *dy, int incy);
+ void INTERPKERNEL_EXPORT matrixProduct(const double *A, mcIdType n1, mcIdType p1, const double *B, mcIdType n2, mcIdType p2, double *C);
+ void INTERPKERNEL_EXPORT inverseMatrix(const double *A, mcIdType n, double *iA);
+ void INTERPKERNEL_EXPORT daxpy(mcIdType n, double da, const double *dx, mcIdType incx, double *dy, mcIdType incy);
}
#endif
#define LOCALIZED(message) static_cast<const char *> (message) , __FILE__ , __LINE__
+// conversion to mesh connection type
+#define ToConnType(x) static_cast<typename MyMeshType::MyConnType>(x)
+
#endif
Interpolation(const InterpolationOptions& io) :InterpolationOptions(io){}
//interpolation of two triangular meshes.
template<class MatrixType, class MyMeshType>
- int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result)
+ typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result)
{ return asLeaf().interpolateMeshes(meshS,meshT,result); }
template<class MyMeshType, class MatrixType>
- int fromIntegralUniform(const MyMeshType& meshT, MatrixType& result, const std::string& method) { return fromToIntegralUniform(false,meshT,result,method); }
+ typename MyMeshType::MyConnType fromIntegralUniform(const MyMeshType& meshT, MatrixType& result, const std::string& method) { return fromToIntegralUniform(false,meshT,result,method); }
template<class MyMeshType, class MatrixType>
- int toIntegralUniform(const MyMeshType& meshS, MatrixType& result, const std::string& method) { return fromToIntegralUniform(true,meshS,result,method); }
+ typename MyMeshType::MyConnType toIntegralUniform(const MyMeshType& meshS, MatrixType& result, const std::string& method) { return fromToIntegralUniform(true,meshS,result,method); }
template<class MyMeshType>
static double CalculateCharacteristicSizeOfMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, const int printLevel);
protected:
template<class MyMeshType, class MatrixType>
- int fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const std::string& method);
+ typename MyMeshType::MyConnType fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const std::string& method);
protected:
TrueMainInterpolator& asLeaf() { return static_cast<TrueMainInterpolator&>(*this); }
};
{
template<class TrueMainInterpolator>
template<class MyMeshType, class MatrixType>
- int Interpolation<TrueMainInterpolator>::fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const std::string& method)
+ typename MyMeshType::MyConnType Interpolation<TrueMainInterpolator>::fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const std::string& method)
{
typedef typename MyMeshType::MyConnType ConnType;
- int ret=-1;
+ ConnType ret=-1;
if(method=="P0")
{
IntegralUniformIntersectorP0<MyMeshType,MatrixType> intersector(mesh,InterpolationOptions::getMeasureAbsStatus());
double Interpolation<TrueMainInterpolator>::CalculateCharacteristicSizeOfMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, const int printLevel)
{
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
+ typedef typename MyMeshType::MyConnType ConnType;
- long nbMailleS=myMeshS.getNumberOfElements();
- long nbMailleT=myMeshT.getNumberOfElements();
+ ConnType nbMailleS=myMeshS.getNumberOfElements();
+ ConnType nbMailleT=myMeshT.getNumberOfElements();
/**************************************************/
/* Search the characteristic size of the meshes */
if(nbMailleS!=0)
{
diagonalS=getDistanceBtw2Pts<SPACEDIM>(BoxS+SPACEDIM,BoxS);
- dimCaracteristicS=diagonalS/nbMailleS;
+ dimCaracteristicS=diagonalS/(double)nbMailleS;
}
double diagonalT,dimCaracteristicT=std::numeric_limits<double>::max();
if(nbMailleT!=0)
{
diagonalT=getDistanceBtw2Pts<SPACEDIM>(BoxT+SPACEDIM,BoxT);
- dimCaracteristicT=diagonalT/nbMailleT;
+ dimCaracteristicT=diagonalT/(double)nbMailleT;
}
if (printLevel>=1)
{
const int SPACE_DIM = 3;
const double adj(getPrecision());// here precision is used instead of getBoundingBoxAdjustment and getBoundingBoxAdjustmentAbs because in the context only precision is relevant
- long size = bbox.size()/(2*SPACE_DIM);
- for (int i=0; i<size; i++)
+ std::size_t size = bbox.size()/(2*SPACE_DIM);
+ for (std::size_t i=0; i<size; i++)
{
for(int idim=0; idim<SPACE_DIM; idim++)
{
Interpolation1D0D();
Interpolation1D0D(const InterpolationOptions& io);
template<class MyMeshType, class MatrixType>
- int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method);
+ typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method);
private:
void adjustBoundingBoxes(std::vector<double>& bbox);
};
* adjusted in a similar fashion as in InterpolationPlanar::performAdjustmentOfBB()
**/
template<class MyMeshType, class MatrixType>
- int Interpolation1D0D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method)
+ typename MyMeshType::MyConnType Interpolation1D0D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method)
{
constexpr int SPACEDIM=MyMeshType::MY_SPACEDIM;
using ConnType=typename MyMeshType::MyConnType;
const double epsilon(getPrecision());
// create MeshElement objects corresponding to each element of the two meshes
- const unsigned long numSrcElems(srcMesh.getNumberOfElements()), numTargetElems(targetMesh.getNumberOfElements());
+ const ConnType numSrcElems(srcMesh.getNumberOfElements()), numTargetElems(targetMesh.getNumberOfElements());
LOG(2, "Source mesh has " << numSrcElems << " elements and target mesh has " << numTargetElems << " elements ");
std::map<MeshElement<ConnType>*, int> indices;
- for(unsigned long i = 0 ; i < numSrcElems ; ++i)
+ for(ConnType i = 0 ; i < numSrcElems ; ++i)
srcElems[i] = new MeshElement<ConnType>(i, srcMesh);
// create empty maps for all source elements
// create BBTree structure
// - get bounding boxes
std::vector<double> bboxes(2*SPACEDIM*numSrcElems);
- int* srcElemIdx = new int[numSrcElems];
- for(unsigned long i = 0; i < numSrcElems ; ++i)
+ ConnType* srcElemIdx = new ConnType[numSrcElems];
+ for(ConnType i = 0; i < numSrcElems ; ++i)
{
// get source bboxes in right order
srcElems[i]->getBoundingBox()->toCompactData(bboxes.data()+6*i);
const ConnType *trgConnPtr(targetMesh.getConnectivityPtr()),*trgConnIPtr(targetMesh.getConnectivityIndexPtr());
const ConnType *srcConnPtr(srcMesh.getConnectivityPtr()),*srcConnIPtr(srcMesh.getConnectivityIndexPtr());
const double *trgCooPtr(targetMesh.getCoordinatesPtr()),*srcCooPtr(srcMesh.getCoordinatesPtr());
- for(unsigned long i = 0; i < numTargetElems; ++i)
+ for(ConnType i = 0; i < numTargetElems; ++i)
{
IKAssert(trgConnIPtr[i+1]==i+1 && trgConnIPtr[i]==i);
std::vector<ConnType> srcSegCondidates;
}
}
delete [] srcElemIdx;
- for(unsigned long i = 0 ; i < numSrcElems ; ++i)
+ for(ConnType i = 0 ; i < numSrcElems ; ++i)
delete srcElems[i];
return srcMesh.getNumberOfNodes();
}
class Interpolation2D1D : public Interpolation<Interpolation2D1D>
{
public:
- typedef std::map<int,std::set<int> > DuplicateFacesType;
+ typedef std::map<mcIdType,std::set<mcIdType> > DuplicateFacesType;
Interpolation2D1D() { setOrientation(2); }
Interpolation2D1D(const InterpolationOptions& io):Interpolation<Interpolation2D1D>(io) { }
// Main function to interpolate triangular and quadratic meshes
template<class MyMeshType, class MatrixType>
- int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method);
+ typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method);
DuplicateFacesType retrieveDuplicateFaces() const
{
return _duplicate_faces;
*
*/
template<class MyMeshType, class MatrixType>
- int Interpolation2D1D::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method)
+ typename MyMeshType::MyConnType Interpolation2D1D::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method)
{
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
long global_start =clock();
- int counter=0;
+ std::size_t counter=0;
/***********************************************************/
/* Check both meshes are made of triangles and quadrangles */
/***********************************************************/
- long nbMailleS=myMeshS.getNumberOfElements();
+ ConnType nbMailleS=myMeshS.getNumberOfElements();
/**************************************************/
/* Search the characteristic size of the meshes */
/* Loop on the target cells - core of the algorithm */
/****************************************************/
long start_intersection=clock();
- long nbelem_type=myMeshT.getNumberOfElements();
+ ConnType nbelem_type=myMeshT.getNumberOfElements();
const ConnType *connIndxT=myMeshT.getConnectivityIndexPtr();
- for(int iT=0; iT<nbelem_type; iT++)
+ for(ConnType iT=0; iT<nbelem_type; iT++)
{
- int nb_nodesT=connIndxT[iT+1]-connIndxT[iT];
- std::vector<int> intersecting_elems;
+ ConnType nb_nodesT=connIndxT[iT+1]-connIndxT[iT];
+ std::vector<ConnType> intersecting_elems;
double bb[2*SPACEDIM];
intersector->getElemBB(bb,myMeshT,OTT<ConnType,numPol>::indFC(iT),nb_nodesT);
my_tree.getIntersectingElems(bb, intersecting_elems);
counter+=intersecting_elems.size();
intersecting_elems.clear();
}
- int ret=intersector->getNumberOfColsOfResMatrix();
+ ConnType ret=intersector->getNumberOfColsOfResMatrix();
const DuplicateFacesType& intersectFaces = *intersector->getIntersectFaces();
DuplicateFacesType::const_iterator iter;
#include "Interpolation.hxx"
#include "NormalizedUnstructuredMesh.hxx"
#include "InterpolationOptions.hxx"
+#include "MCIdType.hxx"
namespace INTERP_KERNEL
{
class Interpolation2D3D : public Interpolation<Interpolation2D3D>
{
public:
- typedef std::map<int,std::set<int> > DuplicateFacesType;
+ typedef std::map<mcIdType,std::set<mcIdType> > DuplicateFacesType;
INTERPKERNEL_EXPORT Interpolation2D3D();
INTERPKERNEL_EXPORT Interpolation2D3D(const InterpolationOptions& io);
template<class MyMeshType, class MyMatrixType>
- int interpolateMeshes(const MyMeshType& srcMesh,
+ typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh,
const MyMeshType& targetMesh,
MyMatrixType& matrix,
const std::string& method);
*
*/
template<class MyMeshType, class MyMatrixType>
- int Interpolation2D3D::interpolateMeshes(const MyMeshType& srcMesh,
+ typename MyMeshType::MyConnType Interpolation2D3D::interpolateMeshes(const MyMeshType& srcMesh,
const MyMeshType& targetMesh,
MyMatrixType& matrix,
const std::string& method)
{
typedef typename MyMeshType::MyConnType ConnType;
// create MeshElement objects corresponding to each element of the two meshes
- const unsigned long numSrcElems = srcMesh.getNumberOfElements();
- const unsigned long numTargetElems = targetMesh.getNumberOfElements();
+ const ConnType numSrcElems = srcMesh.getNumberOfElements();
+ const ConnType numTargetElems = targetMesh.getNumberOfElements();
LOG(2, "Source mesh has " << numSrcElems << " elements and target mesh has " << numTargetElems << " elements ");
std::vector<MeshElement<ConnType>*> srcElems(numSrcElems);
std::vector<MeshElement<ConnType>*> targetElems(numTargetElems);
- std::map<MeshElement<ConnType>*, int> indices;
+ std::map<MeshElement<ConnType>*, ConnType> indices;
DuplicateFacesType intersectFaces;
- for(unsigned long i = 0 ; i < numSrcElems ; ++i)
+ for(ConnType i = 0 ; i < numSrcElems ; ++i)
srcElems[i] = new MeshElement<ConnType>(i, srcMesh);
- for(unsigned long i = 0 ; i < numTargetElems ; ++i)
+ for(ConnType i = 0 ; i < numTargetElems ; ++i)
targetElems[i] = new MeshElement<ConnType>(i, targetMesh);
Intersector3D<MyMeshType,MyMatrixType>* intersector=0;
// create BBTree structure
// - get bounding boxes
double* bboxes = new double[6 * numSrcElems];
- int* srcElemIdx = new int[numSrcElems];
- for(unsigned long i = 0; i < numSrcElems ; ++i)
+ ConnType* srcElemIdx = new ConnType[numSrcElems];
+ for(ConnType i = 0; i < numSrcElems ; ++i)
{
// get source bboxes in right order
const BoundingBox* box = srcElems[i]->getBoundingBox();
// for each target element, get source elements with which to calculate intersection
// - calculate intersection by calling intersectCells
- for(unsigned long i = 0; i < numTargetElems; ++i)
+ for(ConnType i = 0; i < numTargetElems; ++i)
{
const BoundingBox* box = targetElems[i]->getBoundingBox();
- const int targetIdx = targetElems[i]->getIndex();
+ const ConnType targetIdx = targetElems[i]->getIndex();
// get target bbox in right order
double targetBox[6];
}
// free allocated memory
- int ret=intersector->getNumberOfColsOfResMatrix();
+ ConnType ret=intersector->getNumberOfColsOfResMatrix();
delete intersector;
- for(unsigned long i = 0 ; i < numSrcElems ; ++i)
+ for(ConnType i = 0 ; i < numSrcElems ; ++i)
{
delete srcElems[i];
}
- for(unsigned long i = 0 ; i < numTargetElems ; ++i)
+ for(ConnType i = 0 ; i < numTargetElems ; ++i)
{
delete targetElems[i];
}
-// Copyright (C) 2007-2019 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, or (at your option) any later version.
-//
-// 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
-//
-// Author : Anthony Geay (CEA/DEN)
-
-#ifndef __INTERPOLATION3D_HXX__
-#define __INTERPOLATION3D_HXX__
-
-#include "INTERPKERNELDefines.hxx"
-#include "Interpolation.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "InterpolationOptions.hxx"
-
-namespace INTERP_KERNEL
-{
- class INTERPKERNEL_EXPORT Interpolation3D : public Interpolation<Interpolation3D>
- {
- public:
- Interpolation3D();
- Interpolation3D(const InterpolationOptions& io);
- template<class MyMeshType, class MatrixType>
- int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method);
- private:
- SplittingPolicy _splitting_policy;
- };
-}
-
-#endif
+// Copyright (C) 2007-2019 CEA/DEN, EDF R&D\r
+//\r
+// This library is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU Lesser General Public\r
+// License as published by the Free Software Foundation; either\r
+// version 2.1 of the License, or (at your option) any later version.\r
+//\r
+// This library is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+// Lesser General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU Lesser General Public\r
+// License along with this library; if not, write to the Free Software\r
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+//\r
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
+//\r
+// Author : Anthony Geay (CEA/DEN)\r
+\r
+#ifndef __INTERPOLATION3D_HXX__\r
+#define __INTERPOLATION3D_HXX__\r
+\r
+#include "INTERPKERNELDefines.hxx"\r
+#include "Interpolation.hxx"\r
+#include "NormalizedUnstructuredMesh.hxx"\r
+#include "InterpolationOptions.hxx"\r
+\r
+namespace INTERP_KERNEL\r
+{\r
+ class INTERPKERNEL_EXPORT Interpolation3D : public Interpolation<Interpolation3D>\r
+ {\r
+ public:\r
+ Interpolation3D();\r
+ Interpolation3D(const InterpolationOptions& io);\r
+ template<class MyMeshType, class MatrixType>\r
+ typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method);\r
+ private:\r
+ SplittingPolicy _splitting_policy;\r
+ };\r
+}\r
+\r
+#endif\r
*
*/
template<class MyMeshType, class MatrixType>
- int Interpolation3D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method)
+ typename MyMeshType::MyConnType Interpolation3D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method)
{
typedef typename MyMeshType::MyConnType ConnType;
// create MeshElement objects corresponding to each element of the two meshes
- const unsigned long numSrcElems = srcMesh.getNumberOfElements();
- const unsigned long numTargetElems = targetMesh.getNumberOfElements();
+ const ConnType numSrcElems = srcMesh.getNumberOfElements();
+ const ConnType numTargetElems = targetMesh.getNumberOfElements();
LOG(2, "Source mesh has " << numSrcElems << " elements and target mesh has " << numTargetElems << " elements ");
std::vector<MeshElement<ConnType>*> srcElems(numSrcElems);
std::vector<MeshElement<ConnType>*> targetElems(numTargetElems);
- std::map<MeshElement<ConnType>*, int> indices;
+ std::map<MeshElement<ConnType>*, ConnType> indices;
- for(unsigned long i = 0 ; i < numSrcElems ; ++i)
+ for(ConnType i = 0 ; i < numSrcElems ; ++i)
srcElems[i] = new MeshElement<ConnType>(i, srcMesh);
- for(unsigned long i = 0 ; i < numTargetElems ; ++i)
+ for(ConnType i = 0 ; i < numTargetElems ; ++i)
targetElems[i] = new MeshElement<ConnType>(i, targetMesh);
Intersector3D<MyMeshType,MatrixType>* intersector=0;
MeshRegion<ConnType>& srcRegion = firstNode->getSrcRegion();
- for(unsigned long i = 0 ; i < numSrcElems ; ++i)
+ for(ConnType i = 0 ; i < numSrcElems ; ++i)
{
srcRegion.addElement(srcElems[i], srcMesh);
}
MeshRegion<ConnType>& targetRegion = firstNode->getTargetRegion();
- for(unsigned long i = 0 ; i < numTargetElems ; ++i)
+ for(ConnType i = 0 ; i < numTargetElems ; ++i)
{
if(!srcRegion.isDisjointWithElementBoundingBox( *(targetElems[i]) ))
{
// add source elements of current node that overlap the target regions of the new nodes
LOG(5, " -- Adding source elements");
- int numLeftElements = 0;
- int numRightElements = 0;
+ ConnType numLeftElements = 0;
+ ConnType numRightElements = 0;
for(typename std::vector<MeshElement<ConnType>*>::const_iterator iter = currNode->getSrcRegion().getBeginElements() ;
iter != currNode->getSrcRegion().getEndElements() ; ++iter)
{
// create BBTree structure
// - get bounding boxes
double* bboxes = new double[6 * numSrcElems];
- int* srcElemIdx = new int[numSrcElems];
- for(unsigned long i = 0; i < numSrcElems ; ++i)
+ ConnType* srcElemIdx = new ConnType[numSrcElems];
+ for(ConnType i = 0; i < numSrcElems ; ++i)
{
// get source bboxes in right order
const BoundingBox* box = srcElems[i]->getBoundingBox();
// for each target element, get source elements with which to calculate intersection
// - calculate intersection by calling intersectCells
- for(unsigned long i = 0; i < numTargetElems; ++i)
+ for(ConnType i = 0; i < numTargetElems; ++i)
{
const BoundingBox* box = targetElems[i]->getBoundingBox();
- const int targetIdx = targetElems[i]->getIndex();
+ const ConnType targetIdx = targetElems[i]->getIndex();
// get target bbox in right order
double targetBox[6];
#endif
// free allocated memory
- int ret=intersector->getNumberOfColsOfResMatrix();
+ ConnType ret=intersector->getNumberOfColsOfResMatrix();
delete intersector;
- for(unsigned long i = 0 ; i < numSrcElems ; ++i)
+ for(ConnType i = 0 ; i < numSrcElems ; ++i)
{
delete srcElems[i];
}
- for(unsigned long i = 0 ; i < numTargetElems ; ++i)
+ for(ConnType i = 0 ; i < numTargetElems ; ++i)
{
delete targetElems[i];
}
const double adj = getBoundingBoxAdjustmentAbs();
const double adjRel = getBoundingBoxAdjustment();
- long size = bbox.size()/(2*SPACE_DIM);
- for (int i=0; i<size; i++)
+ std::size_t size = bbox.size()/(2*SPACE_DIM);
+ for (std::size_t i=0; i<size; i++)
{
double max=- std::numeric_limits<double>::max();
for(int idim=0; idim<SPACE_DIM; idim++)
-// Copyright (C) 2007-2019 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, or (at your option) any later version.
-//
-// 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
-//
-// Author : A Bruneton (CEA/DEN)
-
-#ifndef __INTERPOLATION3D1D_HXX__
-#define __INTERPOLATION3D1D_HXX__
-
-#include "INTERPKERNELDefines.hxx"
-#include "Interpolation.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "InterpolationOptions.hxx"
-
-#include <vector>
-
-namespace INTERP_KERNEL
-{
- class INTERPKERNEL_EXPORT Interpolation3D1D : public Interpolation<Interpolation3D1D>
- {
- public:
- Interpolation3D1D();
- Interpolation3D1D(const InterpolationOptions& io);
- template<class MyMeshType, class MatrixType>
- int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method);
- private:
- void adjustBoundingBoxes(std::vector<double>& bbox);
- };
-}
-
-#endif
+// Copyright (C) 2007-2019 CEA/DEN, EDF R&D\r
+//\r
+// This library is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU Lesser General Public\r
+// License as published by the Free Software Foundation; either\r
+// version 2.1 of the License, or (at your option) any later version.\r
+//\r
+// This library is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+// Lesser General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU Lesser General Public\r
+// License along with this library; if not, write to the Free Software\r
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+//\r
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
+//\r
+// Author : A Bruneton (CEA/DEN)\r
+\r
+#ifndef __INTERPOLATION3D1D_HXX__\r
+#define __INTERPOLATION3D1D_HXX__\r
+\r
+#include "INTERPKERNELDefines.hxx"\r
+#include "Interpolation.hxx"\r
+#include "NormalizedUnstructuredMesh.hxx"\r
+#include "InterpolationOptions.hxx"\r
+\r
+#include <vector>\r
+\r
+namespace INTERP_KERNEL\r
+{\r
+ class INTERPKERNEL_EXPORT Interpolation3D1D : public Interpolation<Interpolation3D1D>\r
+ {\r
+ public:\r
+ Interpolation3D1D();\r
+ Interpolation3D1D(const InterpolationOptions& io);\r
+ template<class MyMeshType, class MatrixType>\r
+ typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method);\r
+ private:\r
+ void adjustBoundingBoxes(std::vector<double>& bbox);\r
+ };\r
+}\r
+\r
+#endif\r
* adjusted in a similar fashion as in InterpolationPlanar::performAdjustmentOfBB()
**/
template<class MyMeshType, class MatrixType>
- int Interpolation3D1D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method)
+ typename MyMeshType::MyConnType Interpolation3D1D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method)
{
if(InterpolationOptions::getIntersectionType() != PointLocator)
INTERP_KERNEL::Exception("Invalid 3D/1D intersection type specified : must be PointLocator.");
typedef typename MyMeshType::MyConnType ConnType;
// create MeshElement objects corresponding to each element of the two meshes
- const unsigned long numSrcElems = srcMesh.getNumberOfElements();
- const unsigned long numTargetElems = targetMesh.getNumberOfElements();
+ const ConnType numSrcElems = srcMesh.getNumberOfElements();
+ const ConnType numTargetElems = targetMesh.getNumberOfElements();
LOG(2, "Source mesh has " << numSrcElems << " elements and target mesh has " << numTargetElems << " elements ");
std::vector<MeshElement<ConnType>*> srcElems(numSrcElems);
std::vector<MeshElement<ConnType>*> targetElems(numTargetElems);
- std::map<MeshElement<ConnType>*, int> indices;
+ std::map<MeshElement<ConnType>*, ConnType> indices;
- for(unsigned long i = 0 ; i < numSrcElems ; ++i)
+ for(ConnType i = 0 ; i < numSrcElems ; ++i)
srcElems[i] = new MeshElement<ConnType>(i, srcMesh);
- for(unsigned long i = 0 ; i < numTargetElems ; ++i)
+ for(ConnType i = 0 ; i < numTargetElems ; ++i)
targetElems[i] = new MeshElement<ConnType>(i, targetMesh);
Intersector3D<MyMeshType,MatrixType>* intersector=0;
// create BBTree structure
// - get bounding boxes
std::vector<double> bboxes(6*numSrcElems);
- int* srcElemIdx = new int[numSrcElems];
- for(unsigned long i = 0; i < numSrcElems ; ++i)
+ ConnType* srcElemIdx = new ConnType[numSrcElems];
+ for(ConnType i = 0; i < numSrcElems ; ++i)
{
// get source bboxes in right order
const BoundingBox* box = srcElems[i]->getBoundingBox();
// for each target element, get source elements with which to calculate intersection
// - calculate intersection by calling intersectCells
- for(unsigned long i = 0; i < numTargetElems; ++i)
+ for(ConnType i = 0; i < numTargetElems; ++i)
{
const BoundingBox* box = targetElems[i]->getBoundingBox();
- const int targetIdx = targetElems[i]->getIndex();
+ const ConnType targetIdx = targetElems[i]->getIndex();
// get target bbox in right order
double targetBox[6];
// free allocated memory
delete [] srcElemIdx;
- int ret=intersector->getNumberOfColsOfResMatrix();
+ ConnType ret=intersector->getNumberOfColsOfResMatrix();
delete intersector;
- for(unsigned long i = 0 ; i < numSrcElems ; ++i)
+ for(ConnType i = 0 ; i < numSrcElems ; ++i)
{
delete srcElems[i];
}
- for(unsigned long i = 0 ; i < numTargetElems ; ++i)
+ for(ConnType i = 0 ; i < numTargetElems ; ++i)
{
delete targetElems[i];
}
InterpolationCC();
InterpolationCC(const InterpolationOptions& io);
template<class MyMeshType, class MatrixType>
- int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const char *method);
+ typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const char *method);
private:
};
*/
//================================================================================
- template <class MyMeshType, class MatrixType, int dim>
+ template <class MyMeshType, int dim, class MatrixType, class ConnType>
void fillMatrix(const std::list< Interference > inter_of_axis[dim],
MatrixType& result,
- const int src_nb_cells[dim],
- const int tgt_nb_cells[dim],
- const int src_i_cell = 0,
- const int tgt_i_cell = 0,
- const int src_prev_area = 1,
- const int tgt_prev_area = 1,
+ const ConnType src_nb_cells[dim],
+ const ConnType tgt_nb_cells[dim],
+ const ConnType src_i_cell = 0,
+ const ConnType tgt_i_cell = 0,
+ const ConnType src_prev_area = 1,
+ const ConnType tgt_prev_area = 1,
const int axis = 0,
const double prev_value = 1.0)
{
{
for ( TIntIterator i = inter_of_axis[axis].begin(); i != inter_of_axis[axis].end(); ++i )
{
- double value = i->_length * prev_value;
- int src_i = i->_src_index * src_prev_area + src_i_cell;
- int tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell;
+ double value = i->_length * prev_value;
+ ConnType src_i = i->_src_index * src_prev_area + src_i_cell;
+ ConnType tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell;
result[ tgt_i ].insert( std::make_pair( _TMI( src_i ), value ));
}
}
else
{
- int src_prev_area_next = src_prev_area * src_nb_cells[ axis ];
- int tgt_prev_area_next = tgt_prev_area * tgt_nb_cells[ axis ];
+ ConnType src_prev_area_next = src_prev_area * src_nb_cells[ axis ];
+ ConnType tgt_prev_area_next = tgt_prev_area * tgt_nb_cells[ axis ];
for ( TIntIterator i = inter_of_axis[axis].begin(); i != inter_of_axis[axis].end(); ++i )
{
- double value = i->_length * prev_value;
- int src_i = i->_src_index * src_prev_area + src_i_cell;
- int tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell;
+ double value = i->_length * prev_value;
+ ConnType src_i = i->_src_index * src_prev_area + src_i_cell;
+ ConnType tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell;
// call for the next axis
- fillMatrix<MyMeshType, MatrixType, dim>(inter_of_axis, result,
- src_nb_cells, tgt_nb_cells, src_i, tgt_i,
- src_prev_area_next, tgt_prev_area_next,
- axis+1, value );
+ fillMatrix<MyMeshType, dim>(inter_of_axis, result,
+ src_nb_cells, tgt_nb_cells, src_i, tgt_i,
+ src_prev_area_next, tgt_prev_area_next,
+ axis+1, value );
}
}
}
//================================================================================
template<class MyMeshType, class MatrixType>
- int InterpolationCC::interpolateMeshes(const MyMeshType& src_mesh,
+ typename MyMeshType::MyConnType InterpolationCC::interpolateMeshes(const MyMeshType& src_mesh,
const MyMeshType& tgt_mesh,
MatrixType& result,
const char * method)
// create empty maps for all target elements
result.resize( tgt_mesh.getNumberOfElements() );
- const int ret = src_mesh.getNumberOfElements();
+ typedef typename MyMeshType::MyConnType ConnType;
+ const ConnType ret = src_mesh.getNumberOfElements();
const double eps = getPrecision();
const int dim = MyMeshType::MY_MESHDIM;
const double* src_coords[ dim ];
const double* tgt_coords[ dim ];
- int src_nb_cells[ dim ];
- int tgt_nb_cells[ dim ];
+ ConnType src_nb_cells[ dim ];
+ ConnType tgt_nb_cells[ dim ];
for ( int j = 0; j < dim; ++j )
{
- src_coords[ j ] = src_mesh.getCoordsAlongAxis( _TMI( j ));
- tgt_coords[ j ] = tgt_mesh.getCoordsAlongAxis( _TMI( j ));
- src_nb_cells[ j ] = src_mesh.nbCellsAlongAxis( _TMI( j ));
- tgt_nb_cells[ j ] = tgt_mesh.nbCellsAlongAxis( _TMI( j ));
+ int axis = static_cast<int>( _TMI( j ));
+ src_coords[ j ] = src_mesh.getCoordsAlongAxis( axis );
+ tgt_coords[ j ] = tgt_mesh.getCoordsAlongAxis( axis );
+ src_nb_cells[ j ] = src_mesh.nbCellsAlongAxis( axis );
+ tgt_nb_cells[ j ] = tgt_mesh.nbCellsAlongAxis( axis );
}
// ============================================
switch ( dim )
{
case 3:
- fillMatrix<MyMeshType,MatrixType,3>( interferences, result, src_nb_cells,tgt_nb_cells );
+ fillMatrix<MyMeshType,3>( interferences, result, src_nb_cells,tgt_nb_cells );
break;
case 2:
- fillMatrix<MyMeshType,MatrixType,2>( interferences, result, src_nb_cells,tgt_nb_cells );
+ fillMatrix<MyMeshType,2>( interferences, result, src_nb_cells,tgt_nb_cells );
break;
case 1:
- fillMatrix<MyMeshType,MatrixType,1>( interferences, result, src_nb_cells,tgt_nb_cells );
+ fillMatrix<MyMeshType,1>( interferences, result, src_nb_cells,tgt_nb_cells );
break;
}
#include "Interpolation.hxx"
#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpKernelUtilities.hxx"
namespace INTERP_KERNEL
{
InterpolationCU(const InterpolationOptions & io);
template<class MyCMeshType, class MyUMeshType, class MatrixType>
- int interpolateMeshes(const MyCMeshType& meshS, const MyUMeshType& meshT, MatrixType& result, const char *method);
+ typename MyCMeshType::MyConnType interpolateMeshes(const MyCMeshType& meshS, const MyUMeshType& meshT, MatrixType& result, const char *method);
template<class MyUMeshType, class MyCMeshType, class MatrixType>
- int interpolateMeshesRev(const MyUMeshType& meshS, const MyCMeshType& meshT, MatrixType& result, const char *method);
+ typename MyUMeshType::MyConnType interpolateMeshesRev(const MyUMeshType& meshS, const MyCMeshType& meshT, MatrixType& result, const char *method);
};
}
//================================================================================
template<class MyCMeshType, class MyUMeshType, class MatrixType>
- int InterpolationCU::interpolateMeshes(const MyCMeshType& src_mesh,
+ typename MyCMeshType::MyConnType InterpolationCU::interpolateMeshes(const MyCMeshType& src_mesh,
const MyUMeshType& tgt_mesh,
MatrixType& result,
const char * method)
{
typedef typename MyCMeshType::MyConnType CConnType;
+ typedef typename MyUMeshType::MyConnType UConnType;
if ( std::string("P0P0") != method )
throw Exception("Only P0P0 method is implemented so far");
}
// create empty maps for all target elements
result.resize( intersector->getNumberOfRowsOfResMatrix() );
- const int ret = intersector->getNumberOfColsOfResMatrix();
+ const CConnType ret = intersector->getNumberOfColsOfResMatrix();
const double* src_coords[ dim ];
- int src_nb_coords[ dim ];
- std::map< double, int> src_coord_to_index[ dim ];
+ CConnType src_nb_coords[ dim ];
+ std::map< double, CConnType> src_coord_to_index[ dim ];
for ( int j = 0; j < dim; ++j )
{
- src_coords [j] = src_mesh.getCoordsAlongAxis( _TMIC( j ));
- src_nb_coords[j] = src_mesh.nbCellsAlongAxis ( _TMIC( j )) + 1;
- for (int i = 0; i < src_nb_coords[j]; ++i )
+ int axis = static_cast<int>( _TMIC( j ));
+ src_coords [j] = src_mesh.getCoordsAlongAxis( axis );
+ src_nb_coords[j] = static_cast<CConnType>(src_mesh.nbCellsAlongAxis( axis )) + 1;
+ for (CConnType i = 0; i < src_nb_coords[j]; ++i )
src_coord_to_index[j].insert( std::make_pair( src_coords[j][i], i ));
}
- const unsigned long tgtu_nb_cells = tgt_mesh.getNumberOfElements();
+ const UConnType tgtu_nb_cells = tgt_mesh.getNumberOfElements();
IntersectorCU<MyCMeshType, MyUMeshType, MatrixType> bbHelper(src_mesh, tgt_mesh);
double bb[2*dim];
// loop on unstructured tgt cells
- for(unsigned int iT=0; iT<tgtu_nb_cells; iT++)
+ for(UConnType iT=0; iT<tgtu_nb_cells; iT++)
{
result[ iT ].clear();
// find structured src cells intersecting iT cell
std::vector< std::vector< CConnType > > structIndices(1);
- std::map< double, int>::iterator coo_ind;
+ typename std::map< double, CConnType>::iterator coo_ind;
for ( int j = 0; j < dim; ++j )
{
coo_ind = src_coord_to_index[j].lower_bound( bb[2*j+1] - eps );
if ( coo_ind == src_coord_to_index[j].end() )
--coo_ind;
- int max_i = coo_ind->second;
+ CConnType max_i = coo_ind->second;
coo_ind = src_coord_to_index[j].upper_bound( bb[2*j ] + eps );
if ( coo_ind != src_coord_to_index[j].begin() )
--coo_ind;
- int min_i = coo_ind->second;
+ CConnType min_i = coo_ind->second;
std::vector< std::vector< CConnType > > newStructIndices;
for ( unsigned int iInd = 0; iInd < structIndices.size(); ++iInd )
{
- for ( int i = min_i; i < max_i; ++i )
+ for ( CConnType i = min_i; i < max_i; ++i )
{
std::vector< CConnType > index = structIndices[iInd];
index.push_back( i );
//================================================================================
template<class MyUMeshType, class MyCMeshType, class MatrixType>
- int InterpolationCU::interpolateMeshesRev(const MyUMeshType& meshS, const MyCMeshType& meshT, MatrixType& result, const char *method)
+ typename MyUMeshType::MyConnType InterpolationCU::interpolateMeshesRev(const MyUMeshType& meshS, const MyCMeshType& meshT, MatrixType& result, const char *method)
{
+ typedef typename MyCMeshType::MyConnType CConnType;
+ typedef typename MyUMeshType::MyConnType UConnType;
+
MatrixType revResult;
- int sizeT = interpolateMeshes( meshT, meshS, revResult, method );
- int sizeS = revResult.size();
+ CConnType sizeT = interpolateMeshes( meshT, meshS, revResult, method );
+ UConnType sizeS = revResult.size();
result.resize( sizeT );
- for ( int iS = 0; iS < sizeS; ++iS )
+ for ( CConnType iS = 0; iS < sizeS; ++iS )
{
typename MatrixType::value_type & row = revResult[iS];
typename MatrixType::value_type::iterator iT_surf = row.begin();
-// Copyright (C) 2007-2019 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, or (at your option) any later version.
-//
-// 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
-//
-// Author : Anthony Geay (CEA/DEN)
-
-#ifndef __INTERPOLATIONCURVE_HXX__
-#define __INTERPOLATIONCURVE_HXX__
-
-#include "Interpolation.hxx"
-#include "InterpolationOptions.hxx"
-
-namespace INTERP_KERNEL
-{
- template<class RealCurve>
- class InterpolationCurve : public Interpolation< InterpolationCurve<RealCurve> >
- {
- public:
- InterpolationCurve();
- InterpolationCurve(const InterpolationOptions & io);
-
- // Main function to interpolate
- template<class MyMeshType, class MatrixType>
- int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT,
- MatrixType& result, const std::string& method);
-
- };
-}
-
-#endif
+// Copyright (C) 2007-2019 CEA/DEN, EDF R&D\r
+//\r
+// This library is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU Lesser General Public\r
+// License as published by the Free Software Foundation; either\r
+// version 2.1 of the License, or (at your option) any later version.\r
+//\r
+// This library is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+// Lesser General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU Lesser General Public\r
+// License along with this library; if not, write to the Free Software\r
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+//\r
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
+//\r
+// Author : Anthony Geay (CEA/DEN)\r
+\r
+#ifndef __INTERPOLATIONCURVE_HXX__\r
+#define __INTERPOLATIONCURVE_HXX__\r
+\r
+#include "Interpolation.hxx"\r
+#include "InterpolationOptions.hxx"\r
+\r
+namespace INTERP_KERNEL\r
+{\r
+ template<class RealCurve>\r
+ class InterpolationCurve : public Interpolation< InterpolationCurve<RealCurve> >\r
+ {\r
+ public:\r
+ InterpolationCurve();\r
+ InterpolationCurve(const InterpolationOptions & io);\r
+\r
+ // Main function to interpolate\r
+ template<class MyMeshType, class MatrixType>\r
+ typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT,\r
+ MatrixType& result, const std::string& method);\r
+ \r
+ };\r
+}\r
+\r
+#endif\r
*/
template<class RealCurve>
template<class MyMeshType, class MatrixType>
- int InterpolationCurve<RealCurve>::interpolateMeshes (const MyMeshType& myMeshS,
+ typename MyMeshType::MyConnType InterpolationCurve<RealCurve>::interpolateMeshes (const MyMeshType& myMeshS,
const MyMeshType& myMeshT,
MatrixType& result,
const std::string& method)
static const NumberingPolicy numPol = MyMeshType::My_numPol;
long global_start = clock();
- int counter=0;
+ std::size_t counter=0;
- long nbMailleS = myMeshS.getNumberOfElements();
- long nbMailleT = myMeshT.getNumberOfElements();
+ ConnType nbMailleS = myMeshS.getNumberOfElements();
+ ConnType nbMailleT = myMeshT.getNumberOfElements();
CurveIntersector<MyMeshType,MatrixType>* intersector=0;
if(method=="P0P0")
/****************************************************/
long start_intersection = clock();
const ConnType *connIndxT = myMeshT.getConnectivityIndexPtr();
- for(int iT=0; iT<nbMailleT; iT++)
+ for(ConnType iT=0; iT<nbMailleT; iT++)
{
- int nb_nodesT = connIndxT[iT+1] - connIndxT[iT];
- std::vector<int> intersecting_elems;
+ ConnType nb_nodesT = connIndxT[iT+1] - connIndxT[iT];
+ std::vector<ConnType> intersecting_elems;
double bb[2*SPACEDIM];
intersector->getElemBB(bb,myMeshT,OTT<ConnType,numPol>::indFC(iT),nb_nodesT);
my_tree.getIntersectingElems(bb, intersecting_elems);
intersector->intersectCells(iT,intersecting_elems,result);
counter += intersecting_elems.size();
}
- int ret = intersector->getNumberOfColsOfResMatrix();
+ ConnType ret = intersector->getNumberOfColsOfResMatrix();
delete intersector;
if (InterpolationOptions::getPrintLevel() >= 1)
return std::string(meth);
}
-bool INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(long print_level,
+bool INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(int print_level,
std::string intersection_type,
double precision,
double median_plane,
double bounding_box_adjustment,
double bounding_box_adjustment_abs,
double max_distance_for_3Dsurf_intersect,
- long orientation,
+ int orientation,
bool measure_abs,
std::string splitting_policy)
{
void init();
- bool setInterpolationOptions(long print_level,
+ bool setInterpolationOptions(int print_level,
std::string intersection_type,
double precision,
double median_plane,
double bounding_box_adjustment,
double bounding_box_adjustment_abs,
double max_distance_for_3Dsurf_intersect,
- long orientation,
+ int orientation,
bool measure_abs,
std::string splitting_policy);
void copyOptions(const InterpolationOptions & other) { *this = other; }
-// Copyright (C) 2007-2019 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, or (at your option) any later version.
-//
-// 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
-//
-// Author : Anthony Geay (CEA/DEN)
-
-#ifndef __INTERPOLATIONPLANAR_HXX__
-#define __INTERPOLATIONPLANAR_HXX__
-
-#include "Interpolation.hxx"
-#include "PlanarIntersector.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "InterpolationOptions.hxx"
-
-namespace INTERP_KERNEL
-{
- template<class RealPlanar>
- class InterpolationPlanar : public Interpolation< InterpolationPlanar<RealPlanar> >
- {
- private:
- double _dim_caracteristic;
- public:
- InterpolationPlanar();
- InterpolationPlanar(const InterpolationOptions & io);
-
- // geometric precision, debug print level, choice of the median plane, intersection etc ...
- void setOptions(double precision, int printLevel,
- IntersectionType intersectionType, int orientation=0);
-
- // Main function to interpolate triangular and quadratic meshes
- template<class MyMeshType, class MatrixType>
- int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method);
- public:
- bool doRotate() const { return asLeafInterpPlanar().doRotate(); }
- double medianPlane() const { return asLeafInterpPlanar().medianPlane(); }
- template<class MyMeshType, class MyMatrixRow>
- void performAdjustmentOfBB(PlanarIntersector<MyMeshType,MyMatrixRow>* intersector, std::vector<double>& bbox) const
- { return asLeafInterpPlanar().performAdjustmentOfBB(intersector,bbox); }
- protected:
- RealPlanar& asLeafInterpPlanar() { return static_cast<RealPlanar&>(*this); }
- const RealPlanar& asLeafInterpPlanar() const { return static_cast< const RealPlanar& >(*this); }
- };
-}
-
-#endif
+// Copyright (C) 2007-2019 CEA/DEN, EDF R&D\r
+//\r
+// This library is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU Lesser General Public\r
+// License as published by the Free Software Foundation; either\r
+// version 2.1 of the License, or (at your option) any later version.\r
+//\r
+// This library is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+// Lesser General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU Lesser General Public\r
+// License along with this library; if not, write to the Free Software\r
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+//\r
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
+//\r
+// Author : Anthony Geay (CEA/DEN)\r
+\r
+#ifndef __INTERPOLATIONPLANAR_HXX__\r
+#define __INTERPOLATIONPLANAR_HXX__\r
+\r
+#include "Interpolation.hxx"\r
+#include "PlanarIntersector.hxx"\r
+#include "NormalizedUnstructuredMesh.hxx"\r
+#include "InterpolationOptions.hxx"\r
+\r
+namespace INTERP_KERNEL\r
+{\r
+ template<class RealPlanar>\r
+ class InterpolationPlanar : public Interpolation< InterpolationPlanar<RealPlanar> >\r
+ {\r
+ private:\r
+ double _dim_caracteristic;\r
+ public:\r
+ InterpolationPlanar();\r
+ InterpolationPlanar(const InterpolationOptions & io);\r
+\r
+ // geometric precision, debug print level, choice of the median plane, intersection etc ...\r
+ void setOptions(double precision, int printLevel,\r
+ IntersectionType intersectionType, int orientation=0);\r
+\r
+ // Main function to interpolate triangular and quadratic meshes\r
+ template<class MyMeshType, class MatrixType>\r
+ typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method);\r
+ public:\r
+ bool doRotate() const { return asLeafInterpPlanar().doRotate(); }\r
+ double medianPlane() const { return asLeafInterpPlanar().medianPlane(); }\r
+ template<class MyMeshType, class MyMatrixRow>\r
+ void performAdjustmentOfBB(PlanarIntersector<MyMeshType,MyMatrixRow>* intersector, std::vector<double>& bbox) const\r
+ { return asLeafInterpPlanar().performAdjustmentOfBB(intersector,bbox); }\r
+ protected:\r
+ RealPlanar& asLeafInterpPlanar() { return static_cast<RealPlanar&>(*this); }\r
+ const RealPlanar& asLeafInterpPlanar() const { return static_cast< const RealPlanar& >(*this); }\r
+ };\r
+}\r
+\r
+#endif\r
*/
template<class RealPlanar>
template<class MyMeshType, class MatrixType>
- int InterpolationPlanar<RealPlanar>::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method)
+ typename MyMeshType::MyConnType InterpolationPlanar<RealPlanar>::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method)
{
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
long global_start =clock();
- int counter=0;
+ std::size_t counter=0;
/***********************************************************/
/* Check both meshes are made of triangles and quadrangles */
/***********************************************************/
- long nbMailleS=myMeshS.getNumberOfElements();
- long nbMailleT=myMeshT.getNumberOfElements();
+ ConnType nbMailleS=myMeshS.getNumberOfElements();
+ ConnType nbMailleT=myMeshT.getNumberOfElements();
/**************************************************/
/* Search the characteristic size of the meshes */
if(nbMailleS!=0)
{
diagonalS=getDistanceBtw2Pts<SPACEDIM>(BoxS+SPACEDIM,BoxS);
- dimCaracteristicS=diagonalS/nbMailleS;
+ dimCaracteristicS=diagonalS/(double)(nbMailleS);
}
double diagonalT,dimCaracteristicT=std::numeric_limits<double>::max();
if(nbMailleT!=0)
{
diagonalT=getDistanceBtw2Pts<SPACEDIM>(BoxT+SPACEDIM,BoxT);
- dimCaracteristicT=diagonalT/nbMailleT;
+ dimCaracteristicT=diagonalT/(double)(nbMailleT);
}
_dim_caracteristic=std::min(dimCaracteristicS, dimCaracteristicT);
/* Loop on the target cells - core of the algorithm */
/****************************************************/
long start_intersection=clock();
- long nbelem_type=myMeshT.getNumberOfElements();
+ ConnType nbelem_type=myMeshT.getNumberOfElements();
const ConnType *connIndxT=myMeshT.getConnectivityIndexPtr();
- for(int iT=0; iT<nbelem_type; iT++)
+ for(ConnType iT=0; iT<nbelem_type; iT++)
{
- int nb_nodesT=connIndxT[iT+1]-connIndxT[iT];
- std::vector<int> intersecting_elems;
+ ConnType nb_nodesT=connIndxT[iT+1]-connIndxT[iT];
+ std::vector<ConnType> intersecting_elems;
double bb[2*SPACEDIM];
intersector->getElemBB(bb,myMeshT,OTT<ConnType,numPol>::indFC(iT),nb_nodesT);
my_tree.getIntersectingElems(bb, intersecting_elems);
counter+=intersecting_elems.size();
intersecting_elems.clear();
}
- int ret=intersector->getNumberOfColsOfResMatrix();
+ ConnType ret=intersector->getNumberOfColsOfResMatrix();
delete intersector;
if (InterpolationOptions::getPrintLevel() >=1)
* @param quadOut is a 8 doubles array filled after the following call.
*/
template<int SPACEDIM>
- inline void fillDualCellOfPolyg(const double *polygIn, int nPtsPolygonIn, double *polygOut)
+ inline void fillDualCellOfPolyg(const double *polygIn, mcIdType nPtsPolygonIn, double *polygOut)
{
//1st point
std::copy(polygIn,polygIn+SPACEDIM,polygOut);
std::transform(polygOut+SPACEDIM,polygOut+2*SPACEDIM,polygOut+SPACEDIM,std::bind2nd(std::multiplies<double>(),0.5));
double tmp[SPACEDIM];
//
- for(int i=0;i<nPtsPolygonIn-2;i++)
+ for(mcIdType i=0;i<nPtsPolygonIn-2;i++)
{
std::transform(polygIn,polygIn+SPACEDIM,polygIn+(i+2)*SPACEDIM,tmp,std::plus<double>());
std::transform(tmp,tmp+SPACEDIM,polygOut+(2*i+3)*SPACEDIM,std::bind2nd(std::multiplies<double>(),0.5));
inline std::vector<double> bary_poly(const std::vector<double>& V)
{
std::vector<double> Bary;
- long taille=V.size();
+ std::size_t taille=V.size();
double x=0;
double y=0;
- for(long i=0;i<taille/2;i++)
+ for(std::size_t i=0;i<taille/2;i++)
{
x=x+V[2*i];
y=y+V[2*i+1];
}
- double A=2*x/((double)taille);
- double B=2*y/((double)taille);
+ double A=2*x/(static_cast<double>(taille));
+ double B=2*y/(static_cast<double>(taille));
Bary.push_back(A);//taille vecteur=2*nb de points.
Bary.push_back(B);
inline void verif_point_dans_vect(const double* P, std::vector<double>& V, double absolute_precision )
{
- long taille=V.size();
+ std::size_t taille=V.size();
bool isPresent=false;
- for(long i=0;i<taille/2;i++)
+ for(std::size_t i=0;i<taille/2;i++)
{
if (sqrt(((P[0]-V[2*i])*(P[0]-V[2*i])+(P[1]-V[2*i+1])*(P[1]-V[2*i+1])))<absolute_precision)
isPresent=true;
inline void verif_maill_dans_vect(int Num, std::vector<int>& V)
{
- long taille=V.size();
+ std::size_t taille=V.size();
int A=0;
- for(long i=0;i<taille;i++)
+ for(std::size_t i=0;i<taille;i++)
{
if(Num==V[i])
{
}
template<int DIM, NumberingPolicy numPol, class MyMeshType>
- inline void getElemBB(double* bb, const double *coordsOfMesh, int iP, int nb_nodes)
+ inline void getElemBB(double* bb, const double *coordsOfMesh, mcIdType iP, int nb_nodes)
{
bb[0]=std::numeric_limits<double>::max();
bb[1]=-std::numeric_limits<double>::max();
template<class MyMeshType, class MyMatrix>
void Intersector3D<MyMeshType,MyMatrix>::getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT) const
{
- int nbNodesT=_target_mesh.getNumberOfNodesOfElement(icellT);
+ ConnType nbNodesT=_target_mesh.getNumberOfNodesOfElement(icellT);
coordsT.resize(SPACEDIM*nbNodesT);
std::vector<double>::iterator iter=coordsT.begin();
for (ConnType iT=0; iT<nbNodesT; iT++)
template<class MyMeshType, class MyMatrix>
void Intersector3D<MyMeshType,MyMatrix>::getRealSourceCoordinates(ConnType icellS, std::vector<double>& coordsS) const
{
- int nbNodesS=_src_mesh.getNumberOfNodesOfElement(icellS);
+ ConnType nbNodesS=_src_mesh.getNumberOfNodesOfElement(icellS);
coordsS.resize(SPACEDIM*nbNodesS);
std::vector<double>::iterator iter=coordsS.begin();
for (ConnType iS=0; iS<nbNodesS; iS++)
const ConnType *myConIndexS=_src_mesh.getConnectivityIndexPtr();
ConnType start=myConIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
ConnType end=myConIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1];
- int nbNodesS=end-start;
+ ConnType nbNodesS=end-start;
res.resize(nbNodesS);
std::copy(myConectS+OTT<ConnType,numPol>::conn2C(start),myConectS+OTT<ConnType,numPol>::conn2C(end),res.begin());
}
{
public:
Intersector3DP0P0(const MyMeshType& targetMesh, const MyMeshType& srcMesh);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ typename MyMeshType::MyConnType getNumberOfRowsOfResMatrix() const;
+ typename MyMeshType::MyConnType getNumberOfColsOfResMatrix() const;
};
}
}
template<class MyMeshType, class MyMatrix>
- int Intersector3DP0P0<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType Intersector3DP0P0<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
{
return Intersector3D<MyMeshType,MyMatrix>::_target_mesh.getNumberOfElements();
}
template<class MyMeshType, class MyMatrix>
- int Intersector3DP0P0<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType Intersector3DP0P0<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
{
return Intersector3D<MyMeshType,MyMatrix>::_src_mesh.getNumberOfElements();
}
{
public:
Intersector3DP0P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ typename MyMeshType::MyConnType getNumberOfRowsOfResMatrix() const;
+ typename MyMeshType::MyConnType getNumberOfColsOfResMatrix() const;
};
}
}
template<class MyMeshType, class MyMatrix>
- int Intersector3DP0P1<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType Intersector3DP0P1<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
{
return Intersector3D<MyMeshType,MyMatrix>::_target_mesh.getNumberOfNodes();
}
template<class MyMeshType, class MyMatrix>
- int Intersector3DP0P1<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType Intersector3DP0P1<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
{
return Intersector3D<MyMeshType,MyMatrix>::_src_mesh.getNumberOfElements();
}
{
public:
Intersector3DP1P0(const MyMeshType& targetMesh, const MyMeshType& srcMesh);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ typename MyMeshType::MyConnType getNumberOfRowsOfResMatrix() const;
+ typename MyMeshType::MyConnType getNumberOfColsOfResMatrix() const;
};
}
}
template<class MyMeshType, class MyMatrix>
- int Intersector3DP1P0<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType Intersector3DP1P0<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
{
return Intersector3D<MyMeshType,MyMatrix>::_target_mesh.getNumberOfElements();
}
template<class MyMeshType, class MyMatrix>
- int Intersector3DP1P0<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType Intersector3DP1P0<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
{
return Intersector3D<MyMeshType,MyMatrix>::_src_mesh.getNumberOfNodes();
}
{
public:
Intersector3DP1P0Bary(const MyMeshType& targetMesh, const MyMeshType& srcMesh);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ typename MyMeshType::MyConnType getNumberOfRowsOfResMatrix() const;
+ typename MyMeshType::MyConnType getNumberOfColsOfResMatrix() const;
};
}
}
template<class MyMeshType, class MyMatrix>
- int Intersector3DP1P0Bary<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType Intersector3DP1P0Bary<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
{
return Intersector3D<MyMeshType,MyMatrix>::_target_mesh.getNumberOfElements();
}
template<class MyMeshType, class MyMatrix>
- int Intersector3DP1P0Bary<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType Intersector3DP1P0Bary<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
{
return Intersector3D<MyMeshType,MyMatrix>::_src_mesh.getNumberOfNodes();
}
{
public:
Intersector3DP1P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ typename MyMeshType::MyConnType getNumberOfRowsOfResMatrix() const;
+ typename MyMeshType::MyConnType getNumberOfColsOfResMatrix() const;
};
}
}
template<class MyMeshType, class MyMatrix>
- int Intersector3DP1P1<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType Intersector3DP1P1<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
{
return Intersector3D<MyMeshType,MyMatrix>::_target_mesh.getNumberOfNodes();
}
template<class MyMeshType, class MyMatrix>
- int Intersector3DP1P1<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType Intersector3DP1P1<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
{
return Intersector3D<MyMeshType,MyMatrix>::_src_mesh.getNumberOfNodes();
}
void getUElemBB(double* bb, UConnType iP);
void getUCoordinates(UConnType icell, std::vector<double>& coords);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ CConnType getNumberOfRowsOfResMatrix() const;
+ CConnType getNumberOfColsOfResMatrix() const;
void intersectCells(CConnType icellU, const std::vector<CConnType>& icellC, MyMatrix& res);
double intersectGeometry(CConnType icellT, const std::vector<CConnType>& icellC) { return asLeaf().intersectGeometry(icellT,icellC); }
protected:
const MyUMeshType& _meshU;
const double * _coordsC[SPACEDIM];
- int _nbCellsC[SPACEDIM];
+ CConnType _nbCellsC[SPACEDIM];
const MyCMeshType& _meshC;
};
for ( int j = 0; j < SPACEDIM; ++j )
{
- _coordsC [ j ] = _meshC.getCoordsAlongAxis( _TMIC( j ));
- _nbCellsC[ j ] = _meshC.nbCellsAlongAxis ( _TMIC( j ));
+ int axis = static_cast<int>( _TMIC( j ));
+ _coordsC [ j ] = _meshC.getCoordsAlongAxis( axis );
+ _nbCellsC[ j ] = static_cast<CConnType>(_meshC.nbCellsAlongAxis( axis ));
}
}
}
_CU_TEMPLATE
- int _INTERSECTOR_CU_::getNumberOfRowsOfResMatrix() const
+ typename MyCMeshType::MyConnType _INTERSECTOR_CU_::getNumberOfRowsOfResMatrix() const
{
return _meshU.getNumberOfElements();
}
_CU_TEMPLATE
- int _INTERSECTOR_CU_::getNumberOfColsOfResMatrix() const
+ typename MyCMeshType::MyConnType _INTERSECTOR_CU_::getNumberOfColsOfResMatrix() const
{
- return _meshC.getNumberOfElements();
+ return static_cast<CConnType>(_meshC.getNumberOfElements());
}
//================================================================================
public:
static const int MY_SPACEDIM=3;
static const int MY_MESHDIM=3;
- typedef int MyConnType;
+ typedef mcIdType MyConnType;
static const NumberingPolicy My_numPol=ALL_C_MODE;
_Cartesian3D2UnstructHexMesh(const double * coords[3]): _coordsC(coords) {}
- void setHexa(int I, int J, int K) // indices in C mode
+ void setHexa(mcIdType I, mcIdType J, mcIdType K) // indices in C mode
{
double* pCoord = _coordsU;
- for ( int k = K; k < K+2; ++k )
- for ( int j = J; j < J+2; ++j )
- for ( int i = I; i < I+2; ++i )
+ for ( mcIdType k = K; k < K+2; ++k )
+ for ( mcIdType j = J; j < J+2; ++j )
+ for ( mcIdType i = I; i < I+2; ++i )
{
*pCoord++ = _coordsC[0][i];
*pCoord++ = _coordsC[1][j];
*pCoord++ = _coordsC[2][k];
}
}
- const int *getConnectivityPtr() const
+ const mcIdType *getConnectivityPtr() const
{
- static int conn[] = { 1,0,2,3,5,4,6,7 };
+ static mcIdType conn[] = { 1,0,2,3,5,4,6,7 };
return conn;
}
- const int *getConnectivityIndexPtr() const
+ const mcIdType *getConnectivityIndexPtr() const
{
- static int conInd[] = { 0,8 };
+ static mcIdType conInd[] = { 0,8 };
return conInd;
}
void getBoundingBox(double *boundingBox) const
boundingBox[BoundingBox::ZMIN] = _coordsU[2];
boundingBox[BoundingBox::ZMAX] = _coordsU[2+4*MY_SPACEDIM];
}
- NormalizedCellType getTypeOfElement(int eltId) const { return NORM_HEXA8; }
- unsigned char getNumberOfNodesOfElement(int eltId) const { return 8; }
- unsigned long getNumberOfElements() const { return 1; }
- unsigned long getNumberOfNodes() const { return 8; }
+ NormalizedCellType getTypeOfElement(mcIdType eltId) const { return NORM_HEXA8; }
+ mcIdType getNumberOfNodesOfElement(mcIdType eltId) const { return 8; }
+ mcIdType getNumberOfElements() const { return 1; }
+ mcIdType getNumberOfNodes() const { return 8; }
const double *getCoordinatesPtr() const { return _coordsU; }
void releaseTempArrays() {}
private:
--- /dev/null
+// Copyright (C) 2017-2019 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, or (at your option) any later version.
+//
+// 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
+//
+// Author : Anthony Geay (EDF R&D)
+
+#ifndef __IK_MCIDTYPE_HXX__
+#define __IK_MCIDTYPE_HXX__
+
+#include <cstdint>
+#include <stddef.h>
+#include <cstddef>
+
+#ifndef MEDCOUPLING_USE_64BIT_IDS
+
+typedef std::int32_t mcIdType;
+
+#else
+
+typedef std::int64_t mcIdType;
+
+#endif
+
+template <class T> inline mcIdType ToIdType(T val)
+{
+ return static_cast<mcIdType>(val);
+}
+template <class T> inline T FromIdType(mcIdType val)
+{
+ return static_cast<T>(val);
+}
+
+
+#endif
public:
MappedBarycentric2DIntersectorP1P1(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane, double precision, int orientation);
void intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
};
}
{
std::vector<double> CoordsT;
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),CoordsT);
- int nbOfNodesT=CoordsT.size()/SPACEDIM;
+ ConnType nbOfNodesT=ToConnType(CoordsT.size())/SPACEDIM;
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
NormalizedCellType tS=PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iter));
PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(OTT<ConnType,numPol>::indFC(*iter),CoordsS);
std::vector<double> CoordsTTmp(CoordsT);
if(SPACEDIM==3)
- PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&CoordsS[0],&CoordsTTmp[0],CoordsS.size()/SPACEDIM,nbOfNodesT);
+ PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&CoordsS[0],&CoordsTTmp[0],ToConnType(CoordsS.size())/SPACEDIM,nbOfNodesT);
const ConnType *startOfCellNodeConnT=PlanarIntersector<MyMeshType,MyMatrix>::_connectT+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT]);
- for(int nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
+ for(ConnType nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
{
typename MyMatrix::value_type& resRow=res[OTT<ConnType,numPol>::ind2C(startOfCellNodeConnT[nodeIdT])];
if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg2D(&CoordsTTmp[nodeIdT*SPACEDIM],&CoordsS[0],4,PlanarIntersector<MyMeshType,MyMatrix>::_precision) )
resLoc[3] = mco[0] * (1.-mco[1]);
const ConnType *startOfCellNodeConnS=PlanarIntersector<MyMeshType,MyMatrix>::_connectS+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[*iter]);
- for(int nodeIdS=0;nodeIdS<4;nodeIdS++)
+ for(ConnType nodeIdS=0;nodeIdS<4;nodeIdS++)
{
if(fabs(resLoc[nodeIdS])>PlanarIntersector<MyMeshType,MyMatrix>::_precision)
{
}
template<class MyMeshType, class MyMatrix>
- int MappedBarycentric2DIntersectorP1P1<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType MappedBarycentric2DIntersectorP1P1<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfNodes();
}
template<class MyMeshType, class MyMatrix>
- int MappedBarycentric2DIntersectorP1P1<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType MappedBarycentric2DIntersectorP1P1<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfNodes();
}
#include "Intersector3DP1P1.hxx"
#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpKernelUtilities.hxx"
namespace INTERP_KERNEL
{
std::vector<double> CoordsT;
const ConnType *startOfCellNodeConnT=Intersector3DP1P1<MyMeshType,MyMatrix>::getStartConnOfTargetCell(targetCell);
Intersector3DP1P1<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),CoordsT);
- int nbOfNodesT=CoordsT.size()/SPACEDIM;
+ std::size_t nbOfNodesT=CoordsT.size()/SPACEDIM;
const double *coordsS=Intersector3DP1P1<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
- for(int nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
+ for(std::size_t nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
{
typename MyMatrix::value_type& resRow=res[OTT<ConnType,numPol>::ind2C(startOfCellNodeConnT[nodeIdT])];
if(!resRow.empty())
//
std::vector<ConnType> connOfCurCellS;
Intersector3DP1P1<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
- if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) )
+ if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) )
{
double mco[3]; // mapped coordinates in the hexa8
std::vector<double> localCoordsS;
template<class ConnType>
template<class MyMeshType>
MeshElement<ConnType>::MeshElement(const ConnType index, const MyMeshType& mesh)
- : _index(index), _number(mesh.getNumberOfNodesOfElement(OTT<typename MyMeshType::MyConnType,MyMeshType::My_numPol>::indFC(index))), _box(0)
+ : _index(index), _number((unsigned char)mesh.getNumberOfNodesOfElement(OTT<typename MyMeshType::MyConnType,MyMeshType::My_numPol>::indFC(index))), _box(0)
{
const double**vertices = new const double*[_number];
}
}
-void OrientationInverterChecker::check(int *beginPt, int *endPt) const
+void OrientationInverterChecker::check(mcIdType *beginPt, mcIdType *endPt) const
{
if(std::distance(beginPt,endPt)!=getNbNodes())
{
}
}
-void OrientationInverterSEG2::operateAndShutUp(int *beginPt) const
+void OrientationInverterSEG2::operateAndShutUp(mcIdType *beginPt) const
{
std::swap(beginPt[0],beginPt[1]);
}
-void OrientationInverterSEG3::operateAndShutUp(int *beginPt) const
+void OrientationInverterSEG3::operateAndShutUp(mcIdType *beginPt) const
{
std::swap(beginPt[0],beginPt[2]);
}
-void OrientationInverter2DLinear::operateAndShutUp(int *beginPt) const
+void OrientationInverter2DLinear::operateAndShutUp(mcIdType *beginPt) const
{
std::reverse(beginPt+1,beginPt+getNbNodes());
}
-void OrientationInverter2DQuadratic::operateAndShutUp(int *beginPt) const
+void OrientationInverter2DQuadratic::operateAndShutUp(mcIdType *beginPt) const
{
int nbNodes(getNbNodes());
std::reverse(beginPt+1,beginPt+nbNodes/2);
std::reverse(beginPt+nbNodes/2,beginPt+nbNodes);
}
-void OrientationInverterPolygon::operate(int *beginPt, int *endPt) const
+void OrientationInverterPolygon::operate(mcIdType *beginPt, mcIdType *endPt) const
{
std::reverse(beginPt+1,endPt);
}
-void OrientationInverterQPolygon::operate(int *beginPt, int *endPt) const
+void OrientationInverterQPolygon::operate(mcIdType *beginPt, mcIdType *endPt) const
{
std::size_t sz(std::distance(beginPt,endPt));
std::reverse(beginPt+1,beginPt+sz/2);
std::reverse(beginPt+sz/2,endPt);
}
-void OrientationInverterTetra4::operateAndShutUp(int *beginPt) const
+void OrientationInverterTetra4::operateAndShutUp(mcIdType *beginPt) const
{
std::swap(beginPt[1],beginPt[2]);
}
-void OrientationInverterTetra10::operateAndShutUp(int *beginPt) const
+void OrientationInverterTetra10::operateAndShutUp(mcIdType *beginPt) const
{
std::swap(beginPt[1],beginPt[2]);
std::swap(beginPt[4],beginPt[6]);
std::swap(beginPt[8],beginPt[9]);
}
-void OrientationInverterPyra5::operateAndShutUp(int *beginPt) const
+void OrientationInverterPyra5::operateAndShutUp(mcIdType *beginPt) const
{
std::reverse(beginPt+1,beginPt+4);
}
-void OrientationInverterPyra13::operateAndShutUp(int *beginPt) const
+void OrientationInverterPyra13::operateAndShutUp(mcIdType *beginPt) const
{
std::reverse(beginPt+1,beginPt+4);
std::reverse(beginPt+5,beginPt+9);
std::swap(beginPt[10],beginPt[12]);
}
-void OrientationInverter3DExtrusionLinear::operateAndShutUp(int *beginPt) const
+void OrientationInverter3DExtrusionLinear::operateAndShutUp(mcIdType *beginPt) const
{
int nbNodes(getNbNodes());
std::reverse(beginPt+1,beginPt+nbNodes/2);
std::reverse(beginPt+nbNodes/2+1,beginPt+nbNodes);
}
-void OrientationInverter3DExtrusionQuadratic::operateAndShutUp(int *beginPt) const
+void OrientationInverter3DExtrusionQuadratic::operateAndShutUp(mcIdType *beginPt) const
{
int nbNodes(getNbNodes()),nbNodesLinearBase(nbNodes/5);
std::reverse(beginPt+1,beginPt+nbNodesLinearBase);
#include "INTERPKERNELDefines.hxx"
#include "NormalizedGeometricTypes"
+#include "MCIdType.hxx"
namespace INTERP_KERNEL
{
public:
INTERPKERNEL_EXPORT static OrientationInverter *BuildInstanceFrom(NormalizedCellType gt);
INTERPKERNEL_EXPORT virtual ~OrientationInverter() { }
- INTERPKERNEL_EXPORT virtual void operate(int *beginPt, int *endPt) const = 0;
+ INTERPKERNEL_EXPORT virtual void operate(mcIdType *beginPt, mcIdType *endPt) const = 0;
};
class OrientationInverterChecker : public OrientationInverter
{
public:
OrientationInverterChecker(unsigned nbNodes):_nb_nodes(nbNodes) { }
- void operate(int *beginPt, int *endPt) const { check(beginPt,endPt); operateAndShutUp(beginPt); }
- virtual void operateAndShutUp(int *beginPt) const = 0;
+ void operate(mcIdType *beginPt, mcIdType *endPt) const { check(beginPt,endPt); operateAndShutUp(beginPt); }
+ virtual void operateAndShutUp(mcIdType *beginPt) const = 0;
protected:
unsigned getNbNodes() const { return _nb_nodes; }
private:
- void check(int *beginPt, int *endPt) const;
+ void check(mcIdType *beginPt, mcIdType *endPt) const;
private:
unsigned _nb_nodes;
};
{
public:
OrientationInverterSEG2():OrientationInverterChecker(2u) { }
- void operateAndShutUp(int *beginPt) const;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverterSEG3 : public OrientationInverterChecker
{
public:
OrientationInverterSEG3():OrientationInverterChecker(3u) { }
- void operateAndShutUp(int *beginPt) const;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverter2DLinear : public OrientationInverterChecker
{
public:
OrientationInverter2DLinear(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
- void operateAndShutUp(int *beginPt) const;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverter2DQuadratic : public OrientationInverterChecker
{
public:
OrientationInverter2DQuadratic(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
- void operateAndShutUp(int *beginPt) const;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverterPolygon : public OrientationInverter
{
public:
- void operate(int *beginPt, int *endPt) const;
+ void operate(mcIdType *beginPt, mcIdType *endPt) const;
};
class OrientationInverterQPolygon : public OrientationInverter
{
public:
- void operate(int *beginPt, int *endPt) const;
+ void operate(mcIdType *beginPt, mcIdType *endPt) const;
};
class OrientationInverterTetra4 : public OrientationInverterChecker
{
public:
OrientationInverterTetra4():OrientationInverterChecker(4u) { }
- void operateAndShutUp(int *beginPt) const;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverterTetra10 : public OrientationInverterChecker
{
public:
OrientationInverterTetra10():OrientationInverterChecker(10u) { }
- void operateAndShutUp(int *beginPt) const;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverterPyra5 : public OrientationInverterChecker
{
public:
OrientationInverterPyra5():OrientationInverterChecker(5u) { }
- void operateAndShutUp(int *beginPt) const;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverterPyra13 : public OrientationInverterChecker
{
public:
OrientationInverterPyra13():OrientationInverterChecker(13u) { }
- void operateAndShutUp(int *beginPt) const;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverter3DExtrusionLinear : public OrientationInverterChecker
{
public:
OrientationInverter3DExtrusionLinear(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
- void operateAndShutUp(int *beginPt) const;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverter3DExtrusionQuadratic : public OrientationInverterChecker
{
public:
OrientationInverter3DExtrusionQuadratic(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
- void operateAndShutUp(int *beginPt) const;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
}
Planar2D1DIntersectorP0P0(const MyMeshType& meshT, const MyMeshType& meshS,
double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel);
public:
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
const typename PlanarIntersector<MyMeshType,MyMatrix>::DuplicateFacesType* getIntersectFaces() const
{
return &_intersect_faces;
}
template<class MyMeshType, class MyMatrix, class ConcreteP0P0Intersector>
- int Planar2D1DIntersectorP0P0<MyMeshType,MyMatrix,ConcreteP0P0Intersector>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType Planar2D1DIntersectorP0P0<MyMeshType,MyMatrix,ConcreteP0P0Intersector>::getNumberOfRowsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfElements();
}
template<class MyMeshType, class MyMatrix, class ConcreteP0P0Intersector>
- int Planar2D1DIntersectorP0P0<MyMeshType,MyMatrix,ConcreteP0P0Intersector>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType Planar2D1DIntersectorP0P0<MyMeshType,MyMatrix,ConcreteP0P0Intersector>::getNumberOfColsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfElements();
}
template<class MyMeshType, class MyMatrix, class ConcreteP0P0Intersector>
void Planar2D1DIntersectorP0P0<MyMeshType,MyMatrix,ConcreteP0P0Intersector>::intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res)
{
- int nbNodesT=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT];
+ ConnType nbNodesT=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT];
typename MyMatrix::value_type& resRow=res[icellT];
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
- int iS=*iter;
- int nbNodesS=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS];
+ ConnType iS=*iter;
+ ConnType nbNodesS=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS];
bool isColinear = false;
double surf=intersectGeometry1D(OTT<ConnType,numPol>::indFC(icellT),OTT<ConnType,numPol>::indFC(iS),
nbNodesT,nbNodesS, isColinear);
}
else
{
- std::set<int> targetCellSet;
+ std::set<ConnType> targetCellSet;
targetCellSet.insert(icellT);
_intersect_faces.insert(std::make_pair(iS, targetCellSet));
}
static const int MESHDIM=MyMeshType::MY_MESHDIM;
typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
- typedef typename std::map<int,std::set<int> > DuplicateFacesType;
+ typedef typename std::map<ConnType,std::set<ConnType> > DuplicateFacesType;
public:
PlanarIntersector(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel);
virtual ~PlanarIntersector();
void adjustBoundingBoxes(std::vector<double>& bbox, double surf3DAdjustmentEps, double surf3DAdjustmentEpsAbs);
inline void getElemBB(double* bb, const MyMeshType& mesh, ConnType iP, ConnType nb_nodes);
static int Projection(double *Coords_A, double *Coords_B,
- int nb_NodesA, int nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate);
+ ConnType nb_NodesA, ConnType nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate);
virtual const DuplicateFacesType* getIntersectFaces() const
{
return NULL;
}
protected :
- int projectionThis(double *Coords_A, double *Coords_B, int nb_NodesA, int nb_NodesB);
+ int projectionThis(double *Coords_A, double *Coords_B, ConnType nb_NodesA, ConnType nb_NodesB);
void getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT);
void getRealSourceCoordinates(ConnType icellS, std::vector<double>& coordsS);
- void getRealTargetCoordinatesPermute(ConnType icellT, int offset, std::vector<double>& coordsT);
- void getRealSourceCoordinatesPermute(ConnType icellS, int offset, std::vector<double>& coordsS);
+ void getRealTargetCoordinatesPermute(ConnType icellT, ConnType offset, std::vector<double>& coordsT);
+ void getRealSourceCoordinatesPermute(ConnType icellS, ConnType offset, std::vector<double>& coordsS);
void getRealCoordinates(ConnType icellT, ConnType icellS, ConnType nbNodesT, ConnType nbNodesS, std::vector<double>& coordsT, std::vector<double>& coordsS, int& orientation);
double getValueRegardingOption(double val) const;
static void Rotate3DTriangle( double* PP1, double*PP2, double*PP3,
int ibox=0;
for(long icell=0; icell<nbelems; icell++)
{
- int nb_nodes_per_elem =conn_index[icell+1]-conn_index[icell];
+ ConnType nb_nodes_per_elem =conn_index[icell+1]-conn_index[icell];
//initializing bounding box limits
for(int idim=0; idim<SPACEDIM; idim++)
{
bbox[2*SPACEDIM*ibox+2*idim+1] = -std::numeric_limits<double>::max();
}
//updating the bounding box with each node of the element
- for (int j=0; j<nb_nodes_per_elem; j++)
+ for (ConnType j=0; j<nb_nodes_per_elem; j++)
{
const double* coord_node=coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(conn[OTT<ConnType,numPol>::conn2C(conn_index[icell]+j)]);
for(int idim=0; idim<SPACEDIM; idim++)
{
/* We build the segment tree for locating possible matching intersections*/
- long size = bbox.size()/(2*SPACEDIM);
- for (int i=0; i<size; i++)
+ std::size_t size = bbox.size()/(2*SPACEDIM);
+ for (std::size_t i=0; i<size; i++)
{
double max=- std::numeric_limits<double>::max();
for(int idim=0; idim<SPACEDIM; idim++)
template<class MyMeshType, class MyMatrix>
void PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT)
{
- int nbNodesT=_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1]-_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)];
+ ConnType nbNodesT=_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1]-_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)];
coordsT.resize(SPACEDIM*nbNodesT);
for (ConnType iT=0; iT<nbNodesT; iT++)
for(int idim=0; idim<SPACEDIM; idim++)
template<class MyMeshType, class MyMatrix>
void PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(ConnType icellS, std::vector<double>& coordsS)
{
- int nbNodesS=_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1]-_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
+ ConnType nbNodesS=_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1]-_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
coordsS.resize(SPACEDIM*nbNodesS);
for (ConnType iS=0; iS<nbNodesS; iS++)
for(int idim=0; idim<SPACEDIM; idim++)
* @param coordsT output val that stores coordinates of the target cell automatically resized to the right length.
*/
template<class MyMeshType, class MyMatrix>
- void PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinatesPermute(ConnType icellT, int offset, std::vector<double>& coordsT)
+ void PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinatesPermute(ConnType icellT, ConnType offset, std::vector<double>& coordsT)
{
- int nbNodesT=_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1]-_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)];
+ ConnType nbNodesT=_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1]-_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)];
coordsT.resize(SPACEDIM*nbNodesT);
for (ConnType iTTmp=0; iTTmp<nbNodesT; iTTmp++)
{
* @param coordsS output val that stores coordinates of the source cell automatically resized to the right length.
*/
template<class MyMeshType, class MyMatrix>
- void PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinatesPermute(ConnType icellS, int offset, std::vector<double>& coordsS)
+ void PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinatesPermute(ConnType icellS, ConnType offset, std::vector<double>& coordsS)
{
- int nbNodesS=_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1]-_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
+ ConnType nbNodesS=_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1]-_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
coordsS.resize(SPACEDIM*nbNodesS);
for (ConnType iSTmp=0; iSTmp<nbNodesS; iSTmp++)
{
}
template<class MyMeshType, class MyMatrix>
- int PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(double *Coords_A, double *Coords_B, int nb_NodesA, int nb_NodesB)
+ int PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(double *Coords_A, double *Coords_B, ConnType nb_NodesA, ConnType nb_NodesB)
{
return Projection(Coords_A,Coords_B,nb_NodesA,nb_NodesB,_dim_caracteristic*_precision,_max_distance_3Dsurf_intersect,_min_dot_btw_3Dsurf_intersect,_median_plane,_do_rotate);
}
template<class MyMeshType, class MyMatrix>
int PlanarIntersector<MyMeshType,MyMatrix>::Projection(double *Coords_A, double *Coords_B,
- int nb_NodesA, int nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate)
+ ConnType nb_NodesA, ConnType nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate)
{
double normal_A[3]={0,0,0};
double normal_B[3]={0,0,0};
bool same_orientation;
//Find the normal to cells A and B
- int i_A1(1);
+ ConnType i_A1(1);
while(i_A1<nb_NodesA && distance2<SPACEDIM>(Coords_A,&Coords_A[SPACEDIM*i_A1])< epsilon)
i_A1++;
- int i_A2(i_A1+1);
+ ConnType i_A2(i_A1+1);
crossprod<SPACEDIM>(Coords_A, &Coords_A[SPACEDIM*i_A1], &Coords_A[SPACEDIM*i_A2],normal_A);
double normA(sqrt(dotprod<SPACEDIM>(normal_A,normal_A)));
while(i_A2<nb_NodesA && normA < epsilon)
normA = sqrt(dotprod<SPACEDIM>(normal_A,normal_A));
}
- int i_B1(1);
+ ConnType i_B1(1);
while(i_B1<nb_NodesB && distance2<SPACEDIM>(Coords_B,Coords_B+SPACEDIM*i_B1)< epsilon)
i_B1++;
- int i_B2(i_B1+1);
+ ConnType i_B2(i_B1+1);
crossprod<SPACEDIM>(Coords_B, Coords_B+SPACEDIM*i_B1, Coords_B+SPACEDIM*i_B2,normal_B);
double normB(sqrt(dotprod<SPACEDIM>(normal_B,normal_B)));
while(i_B2<nb_NodesB && normB < epsilon)
coords_GA[i]=0.;
for (int j=0;j<nb_NodesA;j++)
coords_GA[i]+=Coords_A[3*j+i];
- coords_GA[i]/=nb_NodesA;
+ coords_GA[i]/=(double)nb_NodesA;
}
double G1[3],G2[3],G3[3];
for(int i=0;i<3;i++)
linear_comb[idim]/=norm;
//Project the nodes of A and B on the median plane
- for(int i_A=0; i_A<nb_NodesA; i_A++)
+ for(ConnType i_A=0; i_A<nb_NodesA; i_A++)
{
proj = dotprod<SPACEDIM>(&Coords_A[SPACEDIM*i_A],linear_comb);
for(int idim =0; idim< SPACEDIM; idim++)
Coords_A[SPACEDIM*i_A+idim] -= proj*linear_comb[idim];
}
- for(int i_B=0; i_B<nb_NodesB; i_B++)
+ for(ConnType i_B=0; i_B<nb_NodesB; i_B++)
{
proj = dotprod<SPACEDIM>(Coords_B+SPACEDIM*i_B,linear_comb);
for(int idim =0; idim< SPACEDIM; idim++)
protected:
PlanarIntersectorP0P0(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel);
public:
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
void intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res);
/*!
* Contrary to intersectCells method here icellS and icellT are \b not in \b C mode but in mode of MyMeshType.
}
template<class MyMeshType, class MyMatrix, class ConcreteP0P0Intersector>
- int PlanarIntersectorP0P0<MyMeshType,MyMatrix,ConcreteP0P0Intersector>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP0P0<MyMeshType,MyMatrix,ConcreteP0P0Intersector>::getNumberOfRowsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfElements();
}
template<class MyMeshType, class MyMatrix, class ConcreteP0P0Intersector>
- int PlanarIntersectorP0P0<MyMeshType,MyMatrix,ConcreteP0P0Intersector>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP0P0<MyMeshType,MyMatrix,ConcreteP0P0Intersector>::getNumberOfColsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfElements();
}
template<class MyMeshType, class MyMatrix, class ConcreteP0P0Intersector>
void PlanarIntersectorP0P0<MyMeshType,MyMatrix,ConcreteP0P0Intersector>::intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res)
{
- int nbNodesT=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT];
+ ConnType nbNodesT=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT];
typename MyMatrix::value_type& resRow=res[icellT];
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
- int iS=*iter;
- int nbNodesS=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS];
+ ConnType iS=*iter;
+ ConnType nbNodesS=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS];
double surf=intersectGeometry(OTT<ConnType,numPol>::indFC(icellT),OTT<ConnType,numPol>::indFC(iS),nbNodesT,nbNodesS);
surf=PlanarIntersector<MyMeshType,MyMatrix>::getValueRegardingOption(surf);
if(surf!=0.)
#define __PLANARINTERSECTORP0P1_HXX__
#include "PlanarIntersector.hxx"
+#include "InterpKernelUtilities.hxx"
namespace INTERP_KERNEL
{
PlanarIntersectorP0P1(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel);
public:
void intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
/*!
* Contrary to intersectCells method here icellS and icellT are \b not in \b C mode but in mode of MyMeshType.
*/
}
template<class MyMeshType, class MyMatrix, class ConcreteP0P1Intersector>
- int PlanarIntersectorP0P1<MyMeshType,MyMatrix,ConcreteP0P1Intersector>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP0P1<MyMeshType,MyMatrix,ConcreteP0P1Intersector>::getNumberOfRowsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfNodes();
}
template<class MyMeshType, class MyMatrix, class ConcreteP0P1Intersector>
- int PlanarIntersectorP0P1<MyMeshType,MyMatrix,ConcreteP0P1Intersector>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP0P1<MyMeshType,MyMatrix,ConcreteP0P1Intersector>::getNumberOfColsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfElements();
}
template<class MyMeshType, class MyMatrix, class ConcreteP0P1Intersector>
void PlanarIntersectorP0P1<MyMeshType,MyMatrix,ConcreteP0P1Intersector>::intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res)
{
- int nbNodesT=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT];
+ ConnType nbNodesT=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT];
double triangle[9];
double quadrangle[12];
std::vector<double> sourceCellCoords;
int orientation=1;
const ConnType *startOfCellNodeConn=PlanarIntersector<MyMeshType,MyMatrix>::_connectT+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT]);
- for(int nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
+ for(ConnType nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
{
ConnType curNodeTInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConn[nodeIdT]);
std::copy(PlanarIntersector<MyMeshType,MyMatrix>::_coordsT+curNodeTInCmode*SPACEDIM,
typename MyMatrix::value_type& resRow=res[curNodeTInCmode];
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
- int iS=*iter;
+ ConnType iS=*iter;
PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(OTT<ConnType,numPol>::indFC(iS),sourceCellCoords);
- for(int subTriT=1;subTriT<=nbNodesT-2;subTriT++)
+ for(ConnType subTriT=1;subTriT<=nbNodesT-2;subTriT++)
{
std::copy(PlanarIntersector<MyMeshType,MyMatrix>::_coordsT+OTT<ConnType,numPol>::coo2C(startOfCellNodeConn[(nodeIdT+subTriT)%nbNodesT])*SPACEDIM,
PlanarIntersector<MyMeshType,MyMatrix>::_coordsT+OTT<ConnType,numPol>::coo2C(startOfCellNodeConn[(nodeIdT+subTriT)%nbNodesT])*SPACEDIM+SPACEDIM,
fillDualCellOfTri<SPACEDIM>(triangle,quadrangle);
std::vector<double> sourceCellCoordsTmp(sourceCellCoords);
if(SPACEDIM==3)
- orientation=PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&sourceCellCoordsTmp[0],quadrangle,sourceCellCoords.size()/SPACEDIM,4);
+ orientation=PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&sourceCellCoordsTmp[0],quadrangle,ToConnType(sourceCellCoords.size())/SPACEDIM,4);
NormalizedCellType tS=PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getTypeOfElement(OTT<ConnType,numPol>::indFC(iS));
double surf=orientation*intersectGeometryWithQuadrangle(quadrangle,sourceCellCoordsTmp,CellModel::GetCellModel(tS).isQuadratic());
surf=PlanarIntersector<MyMeshType,MyMatrix>::getValueRegardingOption(surf);
PlanarIntersectorP0P1Bary(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel);
public:
void intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
/*!
* Contrary to intersectCells method here icellS and icellT are \b not in \b C mode but in mode of MyMeshType.
*/
// Check types of source elements here rather than in intersectCells() since a wrong type can be
// found late after a long time of calculation.
- const unsigned long numTrgElems = meshT.getNumberOfElements();
- for(unsigned long i = 0 ; i < numTrgElems ; ++i)
+ const ConnType numTrgElems = meshT.getNumberOfElements();
+ for(ConnType i = 0 ; i < numTrgElems ; ++i)
if ( meshT.getTypeOfElement( OTT<ConnType,numPol>::indFC( i )) != NORM_TRI3 )
throw INTERP_KERNEL::Exception("P0P1 barycentric algorithm works only with triangular target meshes");
}
template<class MyMeshType, class MyMatrix, class ConcreteP0P1Intersector>
- int PlanarIntersectorP0P1Bary<MyMeshType,MyMatrix,ConcreteP0P1Intersector>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP0P1Bary<MyMeshType,MyMatrix,ConcreteP0P1Intersector>::getNumberOfRowsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfNodes();
}
template<class MyMeshType, class MyMatrix, class ConcreteP0P1Intersector>
- int PlanarIntersectorP0P1Bary<MyMeshType,MyMatrix,ConcreteP0P1Intersector>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP0P1Bary<MyMeshType,MyMatrix,ConcreteP0P1Intersector>::getNumberOfColsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfElements();
}
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
std::vector<double> srcCellCoords,srcCellCoordsTmp,nodeCeffs;
- int iS=*iter;
+ ConnType iS=*iter;
NormalizedCellType tS=PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getTypeOfElement(OTT<ConnType,numPol>::indFC(iS));
bool isSourceQuad=CellModel::GetCellModel(tS).isQuadratic();
PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(OTT<ConnType,numPol>::indFC(iS),srcCellCoords);
std::vector<double> *srcCoords(&srcCellCoords);
- int srcNbNodes = srcCellCoords.size()/SPACEDIM;
+ ConnType srcNbNodes = ToConnType(srcCellCoords.size())/SPACEDIM;
if(SPACEDIM==3)
{
srcCellCoordsTmp=srcCellCoords;
public:
PlanarIntersectorP0P1PL(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane, double precision, int orientation);
void intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
};
}
const ConnType *startOfCellNodeConnT=PlanarIntersector<MyMeshType,MyMatrix>::_connectT+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT]);
std::vector<double> coordsTarget;
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),coordsTarget);
- int nbNodesT=coordsTarget.size()/SPACEDIM;
+ ConnType nbNodesT=ToConnType(coordsTarget.size())/SPACEDIM;
ii=0;
for(typename std::vector<ConnType>::const_iterator iter2=icellsS.begin();iter2!=icellsS.end();iter2++,ii++)
{
std::vector<double> tmpSource(coordsOfSources[ii]);
std::vector<double> tmpTarget(coordsTarget);
if(SPACEDIM==3)
- PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&tmpSource[0],&tmpTarget[0],tmpSource.size()/SPACEDIM,nbNodesT);
- for(int nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
+ PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&tmpSource[0],&tmpTarget[0],ToConnType(tmpSource.size())/SPACEDIM,nbNodesT);
+ for(ConnType nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
{
- if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg2D(&tmpTarget[0]+nodeIdT*SPACEDIM,&tmpSource[0],tmpSource.size()/SPACEDIM,PlanarIntersector<MyMeshType,MyMatrix>::_precision))
+ if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg2D(&tmpTarget[0]+nodeIdT*SPACEDIM,&tmpSource[0],ToConnType(tmpSource.size())/SPACEDIM,PlanarIntersector<MyMeshType,MyMatrix>::_precision))
{
ConnType curNodeTInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConnT[nodeIdT]);
typename MyMatrix::value_type& resRow=res[curNodeTInCmode];
}
template<class MyMeshType, class MyMatrix>
- int PlanarIntersectorP0P1PL<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP0P1PL<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfNodes();
}
template<class MyMeshType, class MyMatrix>
- int PlanarIntersectorP0P1PL<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP0P1PL<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfElements();
}
PlanarIntersectorP1P0(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel);
public:
void intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
/*!
* Contrary to intersectCells method here icellS and icellT are \b not in \b C mode but in mode of MyMeshType.
*/
}
template<class MyMeshType, class MyMatrix, class ConcreteP1P0Intersector>
- int PlanarIntersectorP1P0<MyMeshType,MyMatrix,ConcreteP1P0Intersector>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP1P0<MyMeshType,MyMatrix,ConcreteP1P0Intersector>::getNumberOfRowsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfElements();
}
template<class MyMeshType, class MyMatrix, class ConcreteP1P0Intersector>
- int PlanarIntersectorP1P0<MyMeshType,MyMatrix,ConcreteP1P0Intersector>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP1P0<MyMeshType,MyMatrix,ConcreteP1P0Intersector>::getNumberOfColsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfNodes();
}
typename MyMatrix::value_type& resRow=res[icellT];
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
- int iS=*iter;
- int nbNodesS=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS];
+ ConnType iS=*iter;
+ ConnType nbNodesS=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS];
const ConnType *startOfCellNodeConn=PlanarIntersector<MyMeshType,MyMatrix>::_connectS+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS]);
- for(int nodeIdS=0;nodeIdS<nbNodesS;nodeIdS++)
+ for(ConnType nodeIdS=0;nodeIdS<nbNodesS;nodeIdS++)
{
ConnType curNodeSInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConn[nodeIdS]);
std::copy(PlanarIntersector<MyMeshType,MyMatrix>::_coordsS+curNodeSInCmode*SPACEDIM,
PlanarIntersector<MyMeshType,MyMatrix>::_coordsS+curNodeSInCmode*SPACEDIM+SPACEDIM,triangle);
- for(int subTriS=1;subTriS<=nbNodesS-2;subTriS++)
+ for(ConnType subTriS=1;subTriS<=nbNodesS-2;subTriS++)
{
std::copy(PlanarIntersector<MyMeshType,MyMatrix>::_coordsS+OTT<ConnType,numPol>::coo2C(startOfCellNodeConn[(nodeIdS+subTriS)%nbNodesS])*SPACEDIM,
PlanarIntersector<MyMeshType,MyMatrix>::_coordsS+OTT<ConnType,numPol>::coo2C(startOfCellNodeConn[(nodeIdS+subTriS)%nbNodesS])*SPACEDIM+SPACEDIM,
fillDualCellOfTri<SPACEDIM>(triangle,quadrangle);
std::vector<double> targetCellCoordsTmp(targetCellCoords);
if(SPACEDIM==3)
- orientation=PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&targetCellCoordsTmp[0],quadrangle,targetCellCoords.size()/SPACEDIM,4);
+ orientation=PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&targetCellCoordsTmp[0],quadrangle,ToConnType(targetCellCoords.size())/SPACEDIM,4);
double surf=orientation*intersectGeometryWithQuadrangle(quadrangle,targetCellCoordsTmp,isTargetQuad);
surf=PlanarIntersector<MyMeshType,MyMatrix>::getValueRegardingOption(surf);
if(surf!=0.)
PlanarIntersectorP1P0Bary(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel);
public:
void intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
/*!
* Contrary to intersectCells method here icellS and icellT are \b not in \b C mode but in mode of MyMeshType.
*/
// Check types of source elements here rather than in intersectCells() since a wrong type can be
// found late after a long time of calculation.
- const unsigned long numSrcElems = meshS.getNumberOfElements();
- for(unsigned long i = 0 ; i < numSrcElems ; ++i)
+ const ConnType numSrcElems = meshS.getNumberOfElements();
+ for(ConnType i = 0 ; i < numSrcElems ; ++i)
if ( meshS.getTypeOfElement( OTT<ConnType,numPol>::indFC( i )) != NORM_TRI3 )
throw INTERP_KERNEL::Exception("P1P0 barycentric algorithm works only with triangular source meshes");
}
PLAN_INTER_TEMPLATE
- int PLAN_INTERSECTOR::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType PLAN_INTERSECTOR::getNumberOfRowsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfElements();
}
PLAN_INTER_TEMPLATE
- int PLAN_INTERSECTOR::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType PLAN_INTERSECTOR::getNumberOfColsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfNodes();
}
// target cell data
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),tgtCellCoords);
std::vector<double> * tgtCoords = & tgtCellCoords;
- int tgtNbNodes = tgtCellCoords.size()/SPACEDIM;
+ ConnType tgtNbNodes = ToConnType(tgtCellCoords.size())/SPACEDIM;
NormalizedCellType tT=PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getTypeOfElement(OTT<ConnType,numPol>::indFC(icellT));
bool isTargetQuad=CellModel::GetCellModel(tT).isQuadratic();
// treat each source triangle
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
- int iS=*iter;
+ ConnType iS=*iter;
PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(OTT<ConnType,numPol>::indFC(iS),srcTriaCoords);
const ConnType *startOfCellNodeConn=PlanarIntersector<MyMeshType,MyMatrix>::_connectS+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS]);
if(SPACEDIM==3)
public:
PlanarIntersectorP1P0PL(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane, double precision, int orientation);
void intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
};
}
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),CoordsT);
double baryT[SPACEDIM];
double baryTTmp[SPACEDIM];
- calculateBarycenterDyn2<SPACEDIM>(&CoordsT[0],CoordsT.size()/SPACEDIM,baryT);
+ calculateBarycenterDyn2<SPACEDIM>(&CoordsT[0],ToConnType(CoordsT.size())/SPACEDIM,baryT);
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
NormalizedCellType tS=PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iter));
}
template<class MyMeshType, class MyMatrix>
- int PlanarIntersectorP1P0PL<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP1P0PL<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfElements();
}
template<class MyMeshType, class MyMatrix>
- int PlanarIntersectorP1P0PL<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP1P0PL<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfNodes();
}
PlanarIntersectorP1P1(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel);
public:
void intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
double intersectGeometryGeneral(const std::vector<double>& targetCoords, const std::vector<double>& sourceCoords) { return asLeaf().intersectGeometryGeneral(targetCoords,sourceCoords); }
protected:
}
template<class MyMeshType, class MyMatrix, class ConcreteP1P1Intersector>
- int PlanarIntersectorP1P1<MyMeshType,MyMatrix,ConcreteP1P1Intersector>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP1P1<MyMeshType,MyMatrix,ConcreteP1P1Intersector>::getNumberOfRowsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfNodes();
}
template<class MyMeshType, class MyMatrix, class ConcreteP1P1Intersector>
- int PlanarIntersectorP1P1<MyMeshType,MyMatrix,ConcreteP1P1Intersector>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP1P1<MyMeshType,MyMatrix,ConcreteP1P1Intersector>::getNumberOfColsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfNodes();
}
template<class MyMeshType, class MyMatrix, class ConcreteP1P1Intersector>
void PlanarIntersectorP1P1<MyMeshType,MyMatrix,ConcreteP1P1Intersector>::intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res)
{
- int nbNodesT=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT];
+ ConnType nbNodesT=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT];
int orientation=1;
const ConnType *startOfCellNodeConn=PlanarIntersector<MyMeshType,MyMatrix>::_connectT+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT]);
std::vector<double> polygT;
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),polygT);
- for(int nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
+ for(ConnType nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
{
ConnType curNodeTInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConn[nodeIdT]);
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinatesPermute(OTT<ConnType,numPol>::indFC(icellT),nodeIdT,polygT);
std::vector<double> polygDualT(SPACEDIM*2*(nbNodesT-1));
- fillDualCellOfPolyg<SPACEDIM>(&polygT[0],polygT.size()/SPACEDIM,&polygDualT[0]);
+ fillDualCellOfPolyg<SPACEDIM>(&polygT[0],ToConnType(polygT.size())/SPACEDIM,&polygDualT[0]);
typename MyMatrix::value_type& resRow=res[curNodeTInCmode];
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
- int iS=*iter;
- int nbNodesS=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS];
+ ConnType iS=*iter;
+ ConnType nbNodesS=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS];
const ConnType *startOfCellNodeConnS=PlanarIntersector<MyMeshType,MyMatrix>::_connectS+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS]);
- for(int nodeIdS=0;nodeIdS<nbNodesS;nodeIdS++)
+ for(ConnType nodeIdS=0;nodeIdS<nbNodesS;nodeIdS++)
{
ConnType curNodeSInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConnS[nodeIdS]);
std::vector<double> polygS;
PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinatesPermute(OTT<ConnType,numPol>::indFC(iS),nodeIdS,polygS);
std::vector<double> polygDualS(SPACEDIM*2*(nbNodesS-1));
- fillDualCellOfPolyg<SPACEDIM>(&polygS[0],polygS.size()/SPACEDIM,&polygDualS[0]);
+ fillDualCellOfPolyg<SPACEDIM>(&polygS[0],ToConnType(polygS.size())/SPACEDIM,&polygDualS[0]);
std::vector<double> polygDualTTmp(polygDualT);
if(SPACEDIM==3)
- orientation=PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&polygDualS[0],&polygDualTTmp[0],polygDualS.size()/SPACEDIM,polygDualT.size()/SPACEDIM);
+ orientation=PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&polygDualS[0],&polygDualTTmp[0],ToConnType(polygDualS.size())/SPACEDIM,ToConnType(polygDualT.size())/SPACEDIM);
double surf=orientation*intersectGeometryGeneral(polygDualTTmp,polygDualS);
surf=PlanarIntersector<MyMeshType,MyMatrix>::getValueRegardingOption(surf);
if(surf!=0.)
public:
PlanarIntersectorP1P1PL(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane, double precision, int orientation);
void intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res);
- int getNumberOfRowsOfResMatrix() const;
- int getNumberOfColsOfResMatrix() const;
+ ConnType getNumberOfRowsOfResMatrix() const;
+ ConnType getNumberOfColsOfResMatrix() const;
};
}
{
std::vector<double> CoordsT;
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),CoordsT);
- int nbOfNodesT=CoordsT.size()/SPACEDIM;
+ ConnType nbOfNodesT=ToConnType(CoordsT.size())/SPACEDIM;
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
NormalizedCellType tS=PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iter));
PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(OTT<ConnType,numPol>::indFC(*iter),CoordsS);
std::vector<double> CoordsTTmp(CoordsT);
if(SPACEDIM==3)
- PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&CoordsS[0],&CoordsTTmp[0],CoordsS.size()/SPACEDIM,nbOfNodesT);
+ PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&CoordsS[0],&CoordsTTmp[0],ToConnType(CoordsS.size())/SPACEDIM,nbOfNodesT);
const ConnType *startOfCellNodeConnT=PlanarIntersector<MyMeshType,MyMatrix>::_connectT+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT]);
for(int nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
{
}
template<class MyMeshType, class MyMatrix>
- int PlanarIntersectorP1P1PL<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP1P1PL<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfNodes();
}
template<class MyMeshType, class MyMatrix>
- int PlanarIntersectorP1P1PL<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
+ typename MyMeshType::MyConnType PlanarIntersectorP1P1PL<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
{
return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfNodes();
}
INTERSECTOR_TEMPLATE
QuadraticPolygon *PTLOC2D_INTERSECTOR::buildPolygonFrom(const std::vector<double>& coords, NormalizedCellType type)
{
- int nbNodes=coords.size()/SPACEDIM;
+ std::size_t nbNodes=coords.size()/SPACEDIM;
std::vector<Node *> nodes(nbNodes);
- for(int i=0;i<nbNodes;i++)
+ for(std::size_t i=0;i<nbNodes;i++)
nodes[i]=new Node(coords[i*SPACEDIM],coords[i*SPACEDIM+1]);
if(!CellModel::GetCellModel(type).isQuadratic())
return QuadraticPolygon::BuildLinearPolygon(nodes);
#include "Intersector3DP0P0.hxx"
#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpKernelUtilities.hxx"
namespace INTERP_KERNEL
{
std::vector<double> CoordsT;
Intersector3DP0P0<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),CoordsT);
double bary[SPACEDIM];
- calculateBarycenterDyn2<SPACEDIM>(&CoordsT[0],CoordsT.size()/SPACEDIM,bary);
+ calculateBarycenterDyn2<SPACEDIM>(&CoordsT[0],ToConnType(CoordsT.size())/SPACEDIM,bary);
typename MyMatrix::value_type& resRow=res[targetCell];
const double *coordsS=Intersector3DP0P0<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
const CellModel& cmTypeS=CellModel::GetCellModel(tS);
std::vector<ConnType> connOfCurCellS;
Intersector3DP0P0<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
- if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(bary,&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision))
+ if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(bary,&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision))
{
resRow.insert(std::make_pair(OTT<ConnType,numPol>::indFC(*iterCellS),1));
}
#include "Intersector3DP0P1.hxx"
#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpKernelUtilities.hxx"
namespace INTERP_KERNEL
{
{
std::vector<double> coordsTarget;
Intersector3DP0P1<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),coordsTarget);
- int nbNodesT=coordsTarget.size()/SPACEDIM;
+ std::size_t nbNodesT=coordsTarget.size()/SPACEDIM;
const double *coordsS=Intersector3DP0P1<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
const ConnType *startOfCellNodeConnT=Intersector3DP0P1<MyMeshType,MyMatrix>::getStartConnOfTargetCell(targetCell);
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
const CellModel& cmTypeS=CellModel::GetCellModel(tS);
std::vector<ConnType> connOfCurCellS;
Intersector3DP0P1<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
- for(int nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
+ for(std::size_t nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
{
- if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&coordsTarget[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision))
+ if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&coordsTarget[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision))
{
ConnType curNodeTInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConnT[nodeIdT]);
typename MyMatrix::value_type& resRow=res[curNodeTInCmode];
#include "Intersector3DP1P0.hxx"
#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpKernelUtilities.hxx"
namespace INTERP_KERNEL
{
const double *coordsS=Intersector3DP1P0<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
Intersector3DP1P0<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),CoordsT);
double baryT[SPACEDIM];
- calculateBarycenterDyn2<SPACEDIM>(&CoordsT[0],CoordsT.size()/SPACEDIM,baryT);
+ calculateBarycenterDyn2<SPACEDIM>(&CoordsT[0],ToConnType(CoordsT.size())/SPACEDIM,baryT);
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
{
NormalizedCellType tS=Intersector3DP1P0<MyMeshType,MyMatrix>::_src_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iterCellS));
const CellModel& cmTypeS=CellModel::GetCellModel(tS);
std::vector<ConnType> connOfCurCellS;
Intersector3DP1P0<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
- if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(baryT,&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) )
+ if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(baryT,&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) )
{
double resLoc[4];
std::vector<double> srcCell;
#include "Intersector3DP1P1.hxx"
#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpKernelUtilities.hxx"
namespace INTERP_KERNEL
{
{
std::vector<double> CoordsT;
Intersector3DP1P1<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),CoordsT);
- int nbOfNodesT=CoordsT.size()/SPACEDIM;
+ std::size_t nbOfNodesT=CoordsT.size()/SPACEDIM;
const double *coordsS=Intersector3DP1P1<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
{
throw INTERP_KERNEL::Exception("Invalid source cell detected for meshdim==3. Only TETRA4 supported !");
const CellModel& cmTypeS=CellModel::GetCellModel(tS);
const ConnType *startOfCellNodeConnT=Intersector3DP1P1<MyMeshType,MyMatrix>::getStartConnOfTargetCell(targetCell);
- for(int nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
+ for(std::size_t nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
{
typename MyMatrix::value_type& resRow=res[OTT<ConnType,numPol>::ind2C(startOfCellNodeConnT[nodeIdT])];
std::vector<ConnType> connOfCurCellS;
Intersector3DP1P1<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
- if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) )
+ if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) )
{
double resLoc[4];
std::vector<double> localCoordsS;
{
public:
virtual ~GenericPointLocatorAlgos() { }
- virtual std::list<int> locates(const double* x, double eps) = 0;
+ virtual std::list<mcIdType> locates(const double* x, double eps) = 0;
};
template<class MyMeshType>
typedef typename MyMeshType::MyConnType ConnType;
const int SPACEDIM=MyMeshType::MY_SPACEDIM;
const NumberingPolicy numPol=MyMeshType::My_numPol;
- int nelem = _mesh.getNumberOfElements();
+ ConnType nelem = _mesh.getNumberOfElements();
_bb = new double[SPACEDIM*2*nelem];
const ConnType* conn = _mesh.getConnectivityPtr();
const ConnType* conn_index = _mesh.getConnectivityIndexPtr();
const double* coords=_mesh.getCoordinatesPtr();
- for (int i=0; i<nelem; i++)
+ for (ConnType i=0; i<nelem; i++)
{
for (int idim=0; idim<SPACEDIM; idim++)
{
_bb[2*(i*SPACEDIM+idim)]=std::numeric_limits<double>::max();
_bb[2*(i*SPACEDIM+idim)+1]=-std::numeric_limits<double>::max();
}
- for (int index= conn_index[i]; index < conn_index[i+1];index++)
+ for (ConnType index= conn_index[i]; index < conn_index[i+1];index++)
{
//coordelem points to the coordinates of the current node of the i-th element
const double* coordelem = coords+OTT<ConnType,numPol>::ind2C(conn[OTT<ConnType,numPol>::ind2C(index)])*SPACEDIM;
std::list<ConnType> retlist;
for(unsigned int i=0; i< candidates.size(); i++)
{
- int ielem=candidates[i];
+ ConnType ielem=candidates[i];
if (elementContainsPoint(ielem,x,eps))
retlist.push_back(OTT<ConnType,numPol>::indFC(ielem));
}
return retlist;
}
- static bool isElementContainsPointAlg2D(const double *ptToTest, const double *cellPts, int nbEdges, double eps)
+ static bool isElementContainsPointAlg2D(const double *ptToTest, const double *cellPts, mcIdType nbEdges, double eps)
{
/* with dimension 2, it suffices to check all the edges
and see if the sign of double products from the point
here XA^XC and XC^XB have different signs*/
const int SPACEDIM=MyMeshType::MY_SPACEDIM;
int* sign = new int[nbEdges];
- for (int iedge=0; iedge<nbEdges; iedge++)
+ for (mcIdType iedge=0; iedge<nbEdges; iedge++)
{
const double* A=cellPts+SPACEDIM*iedge;
const double* B=cellPts+SPACEDIM*((iedge+1)%nbEdges);
return ret;
}
- static bool isElementContainsPointAlg3D(const double *ptToTest, const typename MyMeshType::MyConnType *conn_elem, int conn_elem_sz, const double *coords, const CellModel& cmType, double eps)
+ static bool isElementContainsPointAlg3D(const double *ptToTest, const typename MyMeshType::MyConnType *conn_elem, typename MyMeshType::MyConnType conn_elem_sz, const double *coords, const CellModel& cmType, double eps)
{
const int SPACEDIM=MyMeshType::MY_SPACEDIM;
typedef typename MyMeshType::MyConnType ConnType;
int nbfaces = cmType.getNumberOfSons2(conn_elem,conn_elem_sz);
int *sign = new int[nbfaces];
- int *connOfSon = new int[conn_elem_sz];
+ ConnType *connOfSon = new ConnType[conn_elem_sz];
for (int iface=0; iface<nbfaces; iface++)
{
NormalizedCellType typeOfSon;
/*!
* Precondition : spacedim==meshdim. To be checked upstream to this call.
*/
- static bool isElementContainsPoint(const double *ptToTest, NormalizedCellType type, const double *coords, const typename MyMeshType::MyConnType *conn_elem, int conn_elem_sz, double eps)
+ static bool isElementContainsPoint(const double *ptToTest, NormalizedCellType type, const double *coords, const typename MyMeshType::MyConnType *conn_elem, typename MyMeshType::MyConnType conn_elem_sz, double eps)
{
const int SPACEDIM=MyMeshType::MY_SPACEDIM;
typedef typename MyMeshType::MyConnType ConnType;
return isElementContainsPoint(x,type,coords,conn_elem,conn_elem_sz,eps);
}
- static bool decideFromSign(const int* sign, int nbelem)
+ static bool decideFromSign(const int* sign, mcIdType nbelem)
{
int min_sign = 1;
int max_sign = -1;
*/
//================================================================================
- virtual std::list<int> locates(const double* x, double eps)
+ virtual std::list<typename MyMeshType::MyConnType> locates(const double* x, double eps)
{
typedef typename MyMeshType::MyConnType ConnType;
const NumberingPolicy numPol=MyMeshType::My_numPol;
- std::list<int> simplexNodes;
- std::list<int> candidates = PointLocatorAlgos<MyMeshType>::locates(x,eps);
- std::list<int>::iterator eIt = candidates.begin();
+ std::list<ConnType> simplexNodes;
+ std::list<ConnType> candidates = PointLocatorAlgos<MyMeshType>::locates(x,eps);
+ typename std::list<ConnType>::iterator eIt = candidates.begin();
for ( ; eIt != candidates.end(); ++eIt )
{
- const int i = OTT<ConnType,numPol>::ind2C( *eIt );
+ const ConnType i = OTT<ConnType,numPol>::ind2C( *eIt );
const double* coords= _mesh.getCoordinatesPtr();
const ConnType* conn=_mesh.getConnectivityPtr();
const ConnType* conn_index= _mesh.getConnectivityIndexPtr();
else
{
NormalizedCellType simlexType = cell.getDimension()==3 ? NORM_TETRA4 : NORM_TRI3;
- std::vector<int> sonNodes;
+ std::vector<mcIdType> sonNodes;
NormalizedCellType sonType;
const unsigned nbSons = cell.getNumberOfSons2( conn_elem, conn_elem_sz );
for ( unsigned s = 0; s < nbSons; ++s )
{
sonNodes.resize( cell.getNumberOfNodesConstituentTheSon2( s, conn_elem, conn_elem_sz ));
cell.fillSonCellNodalConnectivity2( s, conn_elem, conn_elem_sz, &sonNodes[0], sonType );
- std::set<int> sonNodesSet( sonNodes.begin(), sonNodes.end() );
+ std::set<mcIdType> sonNodesSet( sonNodes.begin(), sonNodes.end() );
std::set< std::set< ConnType > > checkedSonSimplex;
for ( unsigned sn = 0; sn < sonNodes.size(); ++sn )
while( !four_neighbours)
{
i_glob=(* mi1).second;//global index of vertex i
- nb_prev = _Status.count(i_glob);//counts the number of segments ending at i
+ nb_prev = static_cast<int>(_Status.count(i_glob));//counts the number of segments ending at i
//std::cout<< "nb_prev= "<< nb_prev << " i_glob= " << i_glob << std::endl;
switch (nb_prev)
}
mi1++;
i_glob=(* mi1).second;//global index of vertex i
- nb_prev = _Status.count(i_glob);
+ nb_prev = static_cast<int>(_Status.count(i_glob));
}
}
return _Inter;
template<class MyMeshType, class MyMatrixType>
class Polyhedron3D2DIntersectorP0P0 : public Intersector3DP0P0<MyMeshType,MyMatrixType>
{
- typedef typename std::map<int,std::set<int> > DuplicateFacesType;
+ typedef typename std::map<mcIdType,std::set<mcIdType> > DuplicateFacesType;
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
const std::vector<ConnType>& srcCells,
MyMatrixType& matrix)
{
- int nbOfNodesT=Intersector3D<MyMeshType,MyMatrixType>::_target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(targetCell));
+ ConnType nbOfNodesT=Intersector3D<MyMeshType,MyMatrixType>::_target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(targetCell));
releaseArrays();
_split.splitTargetCell(targetCell,nbOfNodesT,_tetra);
// calculate the coordinates of the nodes
typename MyMeshType::MyConnType cellSrc = *iterCellS;
- int cellSrcIdx = OTT<ConnType,numPol>::indFC(cellSrc);
+ ConnType cellSrcIdx = OTT<ConnType,numPol>::indFC(cellSrc);
NormalizedCellType normCellType=Intersector3D<MyMeshType,MyMatrixType>::_src_mesh.getTypeOfElement(cellSrcIdx);
const CellModel& cellModelCell=CellModel::GetCellModel(normCellType);
const MyMeshType& src_mesh = Intersector3D<MyMeshType,MyMatrixType>::_src_mesh;
- unsigned nbOfNodes4Type=cellModelCell.isDynamic() ? src_mesh.getNumberOfNodesOfElement(cellSrcIdx) : cellModelCell.getNumberOfNodes();
- int *polyNodes=new int[nbOfNodes4Type];
+ ConnType nbOfNodes4Type=cellModelCell.isDynamic() ? src_mesh.getNumberOfNodesOfElement(cellSrcIdx) : cellModelCell.getNumberOfNodes();
+ mcIdType *polyNodes=new mcIdType[nbOfNodes4Type];
double **polyCoords = new double*[nbOfNodes4Type];
for(int i = 0;i<(int)nbOfNodes4Type;++i)
{
// we could store mapping local -> global numbers too, but not sure it is worth it
- const int globalNodeNum = getGlobalNumberOfNode(i, OTT<ConnType,numPol>::indFC(*iterCellS), src_mesh);
- polyNodes[i] = globalNodeNum;
+ const ConnType globalNodeNum = getGlobalNumberOfNode(i, OTT<ConnType,numPol>::indFC(*iterCellS), src_mesh);
+ polyNodes[i] = ToIdType( globalNodeNum );
polyCoords[i] = const_cast<double*>(src_mesh.getCoordinatesPtr()+MyMeshType::MY_SPACEDIM*globalNodeNum);
}
}
else
{
- std::set<int> targetCellSet;
+ std::set<ConnType> targetCellSet;
targetCellSet.insert(targetCell);
_intersect_faces.insert(std::make_pair(cellSrcIdx, targetCellSet));
}
double volume = tmp->intersectSourceCell(*iterCellS);
if(volume!=0.)
{
- int targetNodeId(tmp->getId(0));
+ ConnType targetNodeId(tmp->getId(0));
if(targetNodeId<0)
{
std::ostringstream oss; oss << "PolyhedronIntersectorP0P1::intersectCells : On target cell #" << targetCell << " the splitting into tetra4 leads to the creation of an additional point that interacts with source cell Id #" << *iterCellS << " !";
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
{
releaseArrays();
- int nbOfNodesS=Intersector3D<MyMeshType,MyMatrix>::_src_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(*iterCellS));
+ ConnType nbOfNodesS=Intersector3D<MyMeshType,MyMatrix>::_src_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(*iterCellS));
_split.splitTargetCell(*iterCellS,nbOfNodesS,_tetra);
for(typename std::vector<SplitterTetra<MyMeshType>*>::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
{
// Check types of source elements here rather than in intersectCells() since a wrong type can be
// found late after a long time of calculation.
- const unsigned long numSrcElems = srcMesh.getNumberOfElements();
- for(unsigned long i = 0 ; i < numSrcElems ; ++i)
+ const ConnType numSrcElems = srcMesh.getNumberOfElements();
+ for(ConnType i = 0 ; i < numSrcElems ; ++i)
if ( srcMesh.getTypeOfElement( OTT<ConnType,numPol>::indFC(i) ) != NORM_TETRA4 )
throw INTERP_KERNEL::Exception("P1P0 barycentric algorithm works only with tetrahedral source meshes");
}
{
typename MyMatrix::value_type& resRow=res[tgtCell];
- int nbOfNodesT=Intersector3D<MyMeshType,MyMatrix>::_target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(tgtCell));
+ ConnType nbOfNodesT=Intersector3D<MyMeshType,MyMatrix>::_target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(tgtCell));
releaseArrays();
_split.splitTargetCell(tgtCell,nbOfNodesT,_tetra);
// Check types of elements here rather than in intersectCells() since a wrong type can be
// found late after a long time of calculation.
- const unsigned long numSrcElems = srcMesh.getNumberOfElements();
- for(unsigned long i = 0 ; i < numSrcElems ; ++i)
+ const ConnType numSrcElems = srcMesh.getNumberOfElements();
+ for(ConnType i = 0 ; i < numSrcElems ; ++i)
if ( srcMesh.getTypeOfElement( OTT<ConnType,numPol>::indFC( i )) != NORM_TETRA4 )
throw INTERP_KERNEL::Exception("P1P1 3D algorithm works only with tetrahedral meshes");
- const unsigned long numTgtElems = targetMesh.getNumberOfElements();
- for(unsigned long i = 0 ; i < numTgtElems ; ++i)
+ const ConnType numTgtElems = targetMesh.getNumberOfElements();
+ for(ConnType i = 0 ; i < numTgtElems ; ++i)
if ( targetMesh.getTypeOfElement( OTT<ConnType,numPol>::indFC( i )) != NORM_TETRA4 )
throw INTERP_KERNEL::Exception("P1P1 3D algorithm works only with tetrahedral meshes");
}
UnitTetraIntersectionBary b; b.init();
#endif
// split the targetCell into dual cells
- std::pair< int, std::vector<double> > subTetraNodes[24]; // a node of sub tetra and its coordinates
- const double* nodes[4]; int conn[4];
+ std::pair< ConnType, std::vector<double> > subTetraNodes[24]; // a node of sub tetra and its coordinates
+ const double* nodes[4]; ConnType conn[4];
for(int node = 0; node < 4 ; ++node)
nodes[node]=getCoordsOfNode2(node, OTT<ConnType,numPol>::indFC(targetCell),
Intersector3D<MyMeshType,MyMatrix>::_target_mesh,conn[node]);
namespace INTERP_KERNEL
{
- void SplitHexa8IntoTetras(SplittingPolicy policy, const int *nodalConnBg, const int *nodalConnEnd, const double *coords,
- std::vector<int>& tetrasNodalConn, std::vector<double>& addCoords)
+ void SplitHexa8IntoTetras(SplittingPolicy policy, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, const double *coords,
+ std::vector<mcIdType>& tetrasNodalConn, std::vector<double>& addCoords)
{
if(std::distance(nodalConnBg,nodalConnEnd)!=8)
throw INTERP_KERNEL::Exception("SplitHexa8IntoTetras : input hexa do not have 8 nodes !");
case PLANAR_FACE_5:
{
tetrasNodalConn.resize(20);
- int *conn(&tetrasNodalConn[0]);
+ mcIdType *conn(&tetrasNodalConn[0]);
conn[0]=nodalConnBg[SPLIT_NODES_5_WO[0]]; conn[1]=nodalConnBg[SPLIT_NODES_5_WO[1]]; conn[2]=nodalConnBg[SPLIT_NODES_5_WO[2]]; conn[3]=nodalConnBg[SPLIT_NODES_5_WO[3]];
conn[4]=nodalConnBg[SPLIT_NODES_5_WO[4]]; conn[5]=nodalConnBg[SPLIT_NODES_5_WO[5]]; conn[6]=nodalConnBg[SPLIT_NODES_5_WO[6]]; conn[7]=nodalConnBg[SPLIT_NODES_5_WO[7]];
conn[8]=nodalConnBg[SPLIT_NODES_5_WO[8]]; conn[9]=nodalConnBg[SPLIT_NODES_5_WO[9]]; conn[10]=nodalConnBg[SPLIT_NODES_5_WO[10]]; conn[11]=nodalConnBg[SPLIT_NODES_5_WO[11]];
case PLANAR_FACE_6:
{
tetrasNodalConn.resize(24);
- int *conn(&tetrasNodalConn[0]);
+ mcIdType *conn(&tetrasNodalConn[0]);
conn[0]=nodalConnBg[SPLIT_NODES_6_WO[0]]; conn[1]=nodalConnBg[SPLIT_NODES_6_WO[1]]; conn[2]=nodalConnBg[SPLIT_NODES_6_WO[2]]; conn[3]=nodalConnBg[SPLIT_NODES_6_WO[3]];
conn[4]=nodalConnBg[SPLIT_NODES_6_WO[4]]; conn[5]=nodalConnBg[SPLIT_NODES_6_WO[5]]; conn[6]=nodalConnBg[SPLIT_NODES_6_WO[6]]; conn[7]=nodalConnBg[SPLIT_NODES_6_WO[7]];
conn[8]=nodalConnBg[SPLIT_NODES_6_WO[8]]; conn[9]=nodalConnBg[SPLIT_NODES_6_WO[9]]; conn[10]=nodalConnBg[SPLIT_NODES_6_WO[10]]; conn[11]=nodalConnBg[SPLIT_NODES_6_WO[11]];
{
addCoords.resize(7*3);
tetrasNodalConn.resize(24*4);
- int *conn(&tetrasNodalConn[0]);
+ mcIdType *conn(&tetrasNodalConn[0]);
double *tmp(&addCoords[18]);
tmp[0]=0.; tmp[1]=0.; tmp[2]=0.;
double *tmp2(&addCoords[0]);
tmp2[0]=0.; tmp2[1]=0.; tmp2[2]=0.;
for(int j=0;j<4;j++,conn+=4)
{
- int tmp3(nodalConnBg[GENERAL_24_SUB_NODES_WO[4*i+j]]);
+ mcIdType tmp3(nodalConnBg[GENERAL_24_SUB_NODES_WO[4*i+j]]);
tmp2[0]+=coords[3*tmp3+0];
tmp2[1]+=coords[3*tmp3+1];
tmp2[2]+=coords[3*tmp3+2];
tmp2[1]=(tmp[3*(GENERAL_48_SUB_NODES[2*i+24]-8)+1]+tmp[3*(GENERAL_48_SUB_NODES[2*i+25]-8)+1])/2.;
tmp2[2]=(tmp[3*(GENERAL_48_SUB_NODES[2*i+24]-8)+2]+tmp[3*(GENERAL_48_SUB_NODES[2*i+25]-8)+2])/2.;
}
- int *conn(&tetrasNodalConn[0]);
+ mcIdType *conn(&tetrasNodalConn[0]);
std::vector<double> dummy;
for(int i=0;i<8;i++)
{
- std::vector<int> c;
+ std::vector<mcIdType> c;
SplitHexa8IntoTetras(PLANAR_FACE_6,GENERAL_48_SUBZONES_2+i*8,GENERAL_48_SUBZONES_2+(i+1)*8,coords,c,dummy);
- int *conn2(&c[0]);
+ mcIdType *conn2(&c[0]);
for(int j=0;j<6;j++,conn+=4,conn2+=4)
{
conn[0]=conn2[0]>=0?nodalConnBg[conn2[0]]:conn2[0];
}
}
- void SplitIntoTetras(SplittingPolicy policy, NormalizedCellType gt, const int *nodalConnBg, const int *nodalConnEnd, const double *coords,
- std::vector<int>& tetrasNodalConn, std::vector<double>& addCoords)
+ void SplitIntoTetras(SplittingPolicy policy, NormalizedCellType gt, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, const double *coords,
+ std::vector<mcIdType>& tetrasNodalConn, std::vector<double>& addCoords)
{
switch(gt)
{
if(sz!=5)
throw INTERP_KERNEL::Exception("SplitIntoTetras : input pyra5 do not have 5 nodes !");
tetrasNodalConn.resize(8);
- int *conn(&tetrasNodalConn[0]);
+ mcIdType *conn(&tetrasNodalConn[0]);
conn[0]=nodalConnBg[0]; conn[1]=nodalConnBg[1]; conn[2]=nodalConnBg[2]; conn[3]=nodalConnBg[4];
conn[4]=nodalConnBg[0]; conn[5]=nodalConnBg[2]; conn[6]=nodalConnBg[3]; conn[7]=nodalConnBg[4];
return ;
if(sz!=6)
throw INTERP_KERNEL::Exception("SplitIntoTetras : input penta6 do not have 6 nodes !");
tetrasNodalConn.resize(12);
- int *conn(&tetrasNodalConn[0]);
+ mcIdType *conn(&tetrasNodalConn[0]);
conn[0]=nodalConnBg[0]; conn[1]=nodalConnBg[1]; conn[2]=nodalConnBg[2]; conn[3]=nodalConnBg[3];
conn[4]=nodalConnBg[3]; conn[5]=nodalConnBg[5]; conn[6]=nodalConnBg[4]; conn[7]=nodalConnBg[2];
conn[8]=nodalConnBg[4]; conn[9]=nodalConnBg[2]; conn[10]=nodalConnBg[1]; conn[11]=nodalConnBg[3];
if(sz!=12)
throw INTERP_KERNEL::Exception("SplitIntoTetras : input octa12 (hexagone prism) do not have 12 nodes !");
tetrasNodalConn.resize(48);
- int *conn(&tetrasNodalConn[0]);
+ mcIdType *conn(&tetrasNodalConn[0]);
conn[0]=nodalConnBg[0]; conn[1]=nodalConnBg[1]; conn[2]=nodalConnBg[5]; conn[3]=nodalConnBg[6];
conn[4]=nodalConnBg[6]; conn[5]=nodalConnBg[11]; conn[6]=nodalConnBg[7]; conn[7]=nodalConnBg[5];
conn[8]=nodalConnBg[7]; conn[9]=nodalConnBg[5]; conn[10]=nodalConnBg[1]; conn[11]=nodalConnBg[6];
}
case NORM_POLYHED:
{
- std::size_t nbOfFaces(std::count(nodalConnBg,nodalConnEnd,-1)+1);
- std::size_t nbOfTetra(std::distance(nodalConnBg,nodalConnEnd)-nbOfFaces+1);
+ mcIdType nbOfFaces(ToIdType(std::count(nodalConnBg,nodalConnEnd,-1)+1));
+ mcIdType nbOfTetra(ToIdType(std::distance(nodalConnBg,nodalConnEnd)-nbOfFaces+1));
addCoords.resize((nbOfFaces+1)*3);
tetrasNodalConn.resize(nbOfTetra*4);
- int *conn(&tetrasNodalConn[0]);
- const int *work(nodalConnBg);
+ mcIdType *conn(&tetrasNodalConn[0]);
+ const mcIdType *work(nodalConnBg);
double *tmp(&addCoords[0]),*tmp2(&addCoords[3*nbOfFaces]);
tmp2[0]=0.; tmp2[1]=0.; tmp2[2]=0.;
- for(std::size_t i=0;i<nbOfFaces;i++,tmp+=3)
+ for(int i=0;i<nbOfFaces;i++,tmp+=3)
{
tmp[0]=0.; tmp[1]=0.; tmp[2]=0.;
std::size_t nbOfNodesOfFace(std::distance(work,std::find(work,nodalConnEnd,-1)));
for(std::size_t j=0;j<nbOfNodesOfFace;j++,conn+=4)
{
- conn[0]=work[j]; conn[1]=work[(j+1)%nbOfNodesOfFace]; conn[2]=-((int)i+1); conn[3]=-((int)nbOfFaces+1);
+ conn[0]=work[j]; conn[1]=work[(j+1)%nbOfNodesOfFace]; conn[2]=-(i+1); conn[3]=ToIdType(-(nbOfFaces+1));
tmp[0]+=coords[3*work[j]+0]; tmp[1]+=coords[3*work[j]+1]; tmp[2]+=coords[3*work[j]+2];
}
- tmp[0]/=(int)nbOfNodesOfFace; tmp[1]/=(int)nbOfNodesOfFace; tmp[2]/=(int)nbOfNodesOfFace;
+ double nbNF = (double)nbOfNodesOfFace;
+ tmp[0]/=nbNF; tmp[1]/=nbNF; tmp[2]/=nbNF;
tmp2[0]+=tmp[0]; tmp2[1]+=tmp[1]; tmp2[2]+=tmp[2];
work+=nbOfNodesOfFace+1;
}
- tmp2[0]/=(int)nbOfFaces; tmp2[1]/=(int)nbOfFaces; tmp2[2]/=(int)nbOfFaces;
+ double nbF = (double)nbOfFaces;
+ tmp2[0]/=nbF; tmp2[1]/=nbF; tmp2[2]/=nbF;
return ;
}
default:
#include "InterpKernelException.hxx"
#include "InterpKernelHashMap.hxx"
#include "VectorUtils.hxx"
+#include "MCIdType.hxx"
#include <functional>
#include <vector>
26,23,18,25,24,15,6,19
};
- static const int GENERAL_48_SUBZONES_2[64] =
+ static const mcIdType GENERAL_48_SUBZONES_2[64] =
{
0,-1,-14,-5,-2,-13,-19,-15,
-1,1,-6,-14,-13,-3,-16,-19,
-15,-19,-18,-10,-7,-17,-12,7,
-19,-16,-11,-18,-17,-8,6,-12};
- void SplitHexa8IntoTetras(SplittingPolicy policy, const int *nodalConnBg, const int *nodalConnEnd, const double *coords,
- std::vector<int>& tetrasNodalConn, std::vector<double>& addCoords);
+ void SplitHexa8IntoTetras(SplittingPolicy policy, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, const double *coords,
+ std::vector<mcIdType>& tetrasNodalConn, std::vector<double>& addCoords);
- INTERPKERNEL_EXPORT void SplitIntoTetras(SplittingPolicy policy, NormalizedCellType gt, const int *nodalConnBg, const int *nodalConnEnd, const double *coords,
- std::vector<int>& tetrasNodalConn, std::vector<double>& addCoords);
+ INTERPKERNEL_EXPORT void SplitIntoTetras(SplittingPolicy policy, NormalizedCellType gt, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, const double *coords,
+ std::vector<mcIdType>& tetrasNodalConn, std::vector<double>& addCoords);
/**
* \brief Class representing a triangular face, used as key in caching hash map in SplitterTetra.
* @param node2 global number of the second node of the face
* @param node3 global number of the third node of the face
*/
- TriangleFaceKey(int node1, int node2, int node3)
+ TriangleFaceKey(mcIdType node1, mcIdType node2, mcIdType node3)
{
Sort3Ints(_nodes, node1, node2, node3);
_hashVal = ( _nodes[0] + _nodes[1] + _nodes[2] ) % 29;
*
* @return a hash value for the object
*/
- int hashVal() const
+ mcIdType hashVal() const
{
return _hashVal;
}
- inline static void Sort3Ints(int* sorted, int node1, int node2, int node3);
+ inline static void Sort3Ints(mcIdType* sorted, mcIdType node1, mcIdType node2, mcIdType node3);
private:
/// global numbers of the three nodes, sorted in ascending order
- int _nodes[3];
+ mcIdType _nodes[3];
/// hash value for the object, calculated in the constructor
- int _hashVal;
+ mcIdType _hashVal;
};
/**
* Method to sort three integers in ascending order
*
- * @param sorted int[3] array in which to store the result
+ * @param sorted mcIdType[3] array in which to store the result
* @param x1 first integer
* @param x2 second integer
* @param x3 third integer
*/
- inline void TriangleFaceKey::Sort3Ints(int* sorted, int x1, int x2, int x3)
+ inline void TriangleFaceKey::Sort3Ints(mcIdType* sorted, mcIdType x1, mcIdType x2, mcIdType x3)
{
if(x1 < x2)
{
* @param key a TriangleFaceKey object
* @return an integer hash value for key
*/
- int operator()(const INTERP_KERNEL::TriangleFaceKey& key) const
+ mcIdType operator()(const INTERP_KERNEL::TriangleFaceKey& key) const
{
return key.hashVal();
}
template<class MyMeshType>
class SplitterTetra
{
- public:
+ public:
+ typedef typename MyMeshType::MyConnType ConnType;
SplitterTetra(const MyMeshType& srcMesh, const double** tetraCorners, const typename MyMeshType::MyConnType *nodesId);
- SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const int *conn = 0);
+ SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const ConnType *conn = 0);
~SplitterTetra();
double intersectSourceCell(typename MyMeshType::MyConnType srcCell, double* baryCentre=0);
double intersectSourceFace(const NormalizedCellType polyType,
- const int polyNodesNbr,
- const int *const polyNodes,
+ const ConnType polyNodesNbr,
+ const ConnType *const polyNodes,
const double *const *const polyCoords,
const double dimCaracteristic,
const double precision,
double intersectTetra(const double** tetraCorners);
- typename MyMeshType::MyConnType getId(int id) { return _conn[id]; }
+ ConnType getId(mcIdType id) { return _conn[id]; }
void splitIntoDualCells(SplitterTetra<MyMeshType> **output);
- void splitMySelfForDual(double* output, int i, typename MyMeshType::MyConnType& nodeId);
+ void splitMySelfForDual(double* output, int i, ConnType& nodeId);
void clearVolumesCache();
private:
inline static void CheckIsOutside(const double* pt, bool* isOutside, const double errTol = DEFAULT_ABS_TOL);
inline static void CheckIsStrictlyOutside(const double* pt, bool* isStrictlyOutside, const double errTol = DEFAULT_ABS_TOL);
- inline void calculateNode(typename MyMeshType::MyConnType globalNodeNum);
- inline void calculateNode2(typename MyMeshType::MyConnType globalNodeNum, const double* node);
+ inline void calculateNode(ConnType globalNodeNum);
+ inline void calculateNode2(ConnType globalNodeNum, const double* node);
inline void calculateVolume(TransformedTriangle& tri, const TriangleFaceKey& key);
inline void calculateSurface(TransformedTriangle& tri, const TriangleFaceKey& key);
TetraAffineTransform* _t;
/// HashMap relating node numbers to transformed nodes, used for caching
- HashMap< int , double* > _nodes;
+ HashMap< ConnType , double* > _nodes;
/// HashMap relating triangular faces to calculated volume contributions, used for caching
HashMap< TriangleFaceKey, double > _volumes;
const MyMeshType& _src_mesh;
// node id of the first node in target mesh in C mode.
- typename MyMeshType::MyConnType _conn[4];
+ ConnType _conn[4];
double _coords[12];
inline const double* getCoordsOfSubNode(typename MyMeshTypeT::MyConnType node);//to suppress
inline const double* getCoordsOfSubNode2(typename MyMeshTypeT::MyConnType node, typename MyMeshTypeT::MyConnType& nodeId);//to suppress
//template<int n>
- inline void calcBarycenter(int n, double* barycenter, const typename MyMeshTypeT::MyConnType* pts);//to suppress
+ inline void calcBarycenter(typename MyMeshTypeT::MyConnType n, double* barycenter, const int* pts);//to suppress
private:
const MyMeshTypeT& _target_mesh;
const MyMeshTypeS& _src_mesh;
*/
template<class MyMeshTypeT, class MyMeshTypeS>
//template<int n>
- inline void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::calcBarycenter(int n, double* barycenter, const typename MyMeshTypeT::MyConnType* pts)
+ inline void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::calcBarycenter(typename MyMeshTypeT::MyConnType n, double* barycenter, const int* pts)
{
barycenter[0] = barycenter[1] = barycenter[2] = 0.0;
for(int i = 0; i < n ; ++i)
barycenter[2] += pt[2];
}
- barycenter[0] /= n;
- barycenter[1] /= n;
- barycenter[2] /= n;
+ barycenter[0] /= (double)n;
+ barycenter[1] /= (double)n;
+ barycenter[2] /= (double)n;
}
/**
* \param [in] tetraCorners array 4*3 doubles containing corners of input tetrahedron (P0X,P0Y,P0Y,P1X,P1Y,P1Z,P2X,P2Y,P2Z,P3X,P3Y,P3Z).
*/
template<class MyMeshType>
- SplitterTetra<MyMeshType>::SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const int *conn): _t(0),_src_mesh(srcMesh)
+ SplitterTetra<MyMeshType>::SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const ConnType *conn): _t(0),_src_mesh(srcMesh)
{
if(!conn)
{ _conn[0]=0; _conn[1]=1; _conn[2]=2; _conn[3]=3; }
SplitterTetra<MyMeshType>::~SplitterTetra()
{
delete _t;
- for(HashMap< int, double* >::iterator iter = _nodes.begin(); iter != _nodes.end() ; ++iter)
+ for(typename HashMap< ConnType, double* >::iterator iter = _nodes.begin(); iter != _nodes.end() ; ++iter)
delete[] iter->second;
}
// get type of cell
NormalizedCellType normCellType=_src_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(element));
const CellModel& cellModelCell=CellModel::GetCellModel(normCellType);
- unsigned nbOfNodes4Type=cellModelCell.isDynamic() ? _src_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(element)) : cellModelCell.getNumberOfNodes();
+ ConnType nbOfNodes4Type=cellModelCell.isDynamic() ? _src_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(element)) : cellModelCell.getNumberOfNodes();
// halfspace filtering
bool isOutside[8] = {true, true, true, true, true, true, true, true};
bool isTargetOutside = false;
// calculate the coordinates of the nodes
- int *cellNodes=new int[nbOfNodes4Type];
- for(int i = 0;i<(int)nbOfNodes4Type;++i)
+ ConnType *cellNodes=new ConnType[nbOfNodes4Type];
+ for(ConnType i = 0;i<nbOfNodes4Type;++i)
{
// we could store mapping local -> global numbers too, but not sure it is worth it
- const int globalNodeNum = getGlobalNumberOfNode(i, OTT<ConnType,numPol>::indFC(element), _src_mesh);
+ const ConnType globalNodeNum = getGlobalNumberOfNode(i, OTT<ConnType,numPol>::indFC(element), _src_mesh);
cellNodes[i]=globalNodeNum;
if(_nodes.find(globalNodeNum) == _nodes.end())
{
// get nb of sons of a cell
const ConnType* rawCellConn = _src_mesh.getConnectivityPtr() + OTT<ConnType,numPol>::conn2C( _src_mesh.getConnectivityIndexPtr()[ element ]);
- const int rawNbCellNodes = _src_mesh.getConnectivityIndexPtr()[ element+1 ] - _src_mesh.getConnectivityIndexPtr()[ element ];
+ const ConnType rawNbCellNodes = _src_mesh.getConnectivityIndexPtr()[ element+1 ] - _src_mesh.getConnectivityIndexPtr()[ element ];
unsigned nbOfSons = cellModelCell.getNumberOfSons2(rawCellConn, rawNbCellNodes);
for(unsigned ii = 0 ; ii < nbOfSons; ++ii)
{
// get sons connectivity
NormalizedCellType faceType;
- int *faceNodes, nbFaceNodes=-1;
+ ConnType *faceNodes, nbFaceNodes=-1;
if ( cellModelCell.isDynamic() )
{
- faceNodes=new int[nbOfNodes4Type];
+ faceNodes=new ConnType[nbOfNodes4Type];
nbFaceNodes = cellModelCell.fillSonCellNodalConnectivity2(ii,rawCellConn,rawNbCellNodes,faceNodes,faceType);
- for ( int i = 0; i < nbFaceNodes; ++i )
+ for ( ConnType i = 0; i < nbFaceNodes; ++i )
faceNodes[i] = OTT<ConnType,numPol>::coo2C(faceNodes[i]);
}
else
const CellModel& faceModel=CellModel::GetCellModel(faceType);
assert(faceModel.getDimension() == 2);
nbFaceNodes = cellModelCell.getNumberOfNodesConstituentTheSon(ii);
- faceNodes = new int[nbFaceNodes];
+ faceNodes = new ConnType[nbFaceNodes];
cellModelCell.fillSonCellNodalConnectivity(ii,cellNodes,faceNodes);
}
// intersect a son with the unit tetra
case NORM_POLYGON:
{
- int nbTria = nbFaceNodes - 2; // split polygon into nbTria triangles
- for ( int iTri = 0; iTri < nbTria; ++iTri )
+ ConnType nbTria = nbFaceNodes - 2; // split polygon into nbTria triangles
+ for ( ConnType iTri = 0; iTri < nbTria; ++iTri )
{
TriangleFaceKey key = TriangleFaceKey(faceNodes[0], faceNodes[1+iTri], faceNodes[2+iTri]);
if(_volumes.find(key) == _volumes.end())
*/
template<class MyMeshType>
double SplitterTetra<MyMeshType>::intersectSourceFace(const NormalizedCellType polyType,
- const int polyNodesNbr,
- const int *const polyNodes,
+ const ConnType polyNodesNbr,
+ const ConnType *const polyNodes,
const double *const *const polyCoords,
const double dimCaracteristic,
const double precision,
bool isTargetOutside = false;
// calculate the coordinates of the nodes
- for(int i = 0;i<(int)polyNodesNbr;++i)
+ for(ConnType i = 0;i<polyNodesNbr;++i)
{
- const int globalNodeNum = polyNodes[i];
+ const ConnType globalNodeNum = polyNodes[i];
if(_nodes.find(globalNodeNum) == _nodes.end())
{
calculateNode2(globalNodeNum, polyCoords[i]);
double planeConstant = dot(planeNormal, coordsTetraTriNode1);
if (IsFacesCoplanar(planeNormal, planeConstant, polyCoords, precision))
{
- int nbrPolyTri = polyNodesNbr - 2; // split polygon into nbrPolyTri triangles
- for (int iTri = 0; iTri < nbrPolyTri; ++iTri)
+ ConnType nbrPolyTri = polyNodesNbr - 2; // split polygon into nbrPolyTri triangles
+ for (ConnType iTri = 0; iTri < nbrPolyTri; ++iTri)
{
double volume = CalculateIntersectionSurfaceOfCoplanarTriangles(planeNormal,
planeConstant,
case NORM_POLYGON:
{
- int nbrPolyTri = polyNodesNbr - 2; // split polygon into nbrPolyTri triangles
- for (int iTri = 0; iTri < nbrPolyTri; ++iTri)
+ ConnType nbrPolyTri = polyNodesNbr - 2; // split polygon into nbrPolyTri triangles
+ for (ConnType iTri = 0; iTri < nbrPolyTri; ++iTri)
{
TriangleFaceKey key = TriangleFaceKey(polyNodes[0], polyNodes[1 + iTri], polyNodes[2 + iTri]);
if (_volumes.find(key) == _volumes.end())
if(!isTargetOutside)
{
const CellModel& cellModelCell=CellModel::GetCellModel(NORM_TETRA4);
- int cellNodes[4] = { 0, 1, 2, 3 }, faceNodes[3];
+ ConnType cellNodes[4] = { 0, 1, 2, 3 }, faceNodes[3];
for(unsigned ii = 0 ; ii < 4 ; ++ii)
{
void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::releaseArrays()
{
// free potential sub-mesh nodes that have been allocated
- typename MyMeshTypeT::MyConnType nbOfNodesT = _node_ids.size();// Issue 0020634.
- if((int)_nodes.size()>=/*8*/nbOfNodesT)
+ if(_nodes.size()>=/*8*/_node_ids.size())
{
+ typename MyMeshTypeT::MyConnType nbOfNodesT = static_cast<typename MyMeshTypeT::MyConnType>(_node_ids.size());
std::vector<const double*>::iterator iter = _nodes.begin() + /*8*/nbOfNodesT;
while(iter != _nodes.end())
{
template<class MyMeshTypeT, class MyMeshTypeS>
void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::splitTargetCell2(typename MyMeshTypeT::MyConnType targetCell, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra)
{
- const int *refConn(_target_mesh.getConnectivityPtr());
- const int *cellConn(refConn+_target_mesh.getConnectivityIndexPtr()[targetCell]);
+ typedef typename MyMeshTypeT::MyConnType TConnType;
+ const TConnType *refConn(_target_mesh.getConnectivityPtr());
+ const TConnType *cellConn(refConn+_target_mesh.getConnectivityIndexPtr()[targetCell]);
INTERP_KERNEL::NormalizedCellType gt(_target_mesh.getTypeOfElement(targetCell));
- std::vector<int> tetrasNodalConn;
+ std::vector<TConnType> tetrasNodalConn;
std::vector<double> addCoords;
const double *coords(_target_mesh.getCoordinatesPtr());
SplitIntoTetras(_splitting_pol,gt,cellConn,refConn+_target_mesh.getConnectivityIndexPtr()[targetCell+1],coords,tetrasNodalConn,addCoords);
std::size_t nbTetras(tetrasNodalConn.size()/4); tetra.resize(nbTetras);
double tmp[12];
- int tmp2[4];
+ typename MyMeshTypeS::MyConnType tmp2[4];
for(std::size_t i=0;i<nbTetras;i++)
{
for(int j=0;j<4;j++)
{
- int cellId(tetrasNodalConn[4*i+j]);
+ TConnType cellId(tetrasNodalConn[4*i+j]);
tmp2[j]=cellId;
if(cellId>=0)
{
_node_ids.resize(8);
tetra.reserve(1);
const double *nodes[4];
- int conn[4];
+ ConnType conn[4];
for(int node = 0; node < 4 ; ++node)
{
nodes[node]=getCoordsOfNode2(node, OTT<ConnType,numPol>::indFC(targetCell),_target_mesh,conn[node]);
for(int i = 0; i < 5; ++i)
{
const double* nodes[4];
- int conn[4];
+ typename MyMeshTypeS::MyConnType conn[4];
for(int j = 0; j < 4; ++j)
{
conn[j] = subZone[ SPLIT_NODES_5[4*i+j] ];
for(int i = 0; i < 6; ++i)
{
const double* nodes[4];
- int conn[4];
+ typename MyMeshTypeS::MyConnType conn[4];
for(int j = 0; j < 4; ++j)
{
conn[j] = subZone[SPLIT_NODES_6[4*i+j]];
// nodes to use for tetrahedron
const double* nodes[4];
- int conn[4];
+ typename MyMeshTypeS::MyConnType conn[4];
// get the cell center
conn[0] = 14;
nodes[0] = getCoordsOfSubNode(conn[0]);
// create tetrahedra
const double* nodes[4];
- int conn[4];
+ typename MyMeshTypeS::MyConnType conn[4];
for(int i = 0; i < 2; ++i)
{
for(int j = 0; j < 4; ++j)
// get type of cell and nb of cell nodes
NormalizedCellType normCellType=_target_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(targetCell));
const CellModel& cellModelCell=CellModel::GetCellModel(normCellType);
- unsigned nbOfCellNodes=cellModelCell.isDynamic() ? _target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(targetCell)) : cellModelCell.getNumberOfNodes();
+ ConnType nbOfCellNodes=cellModelCell.isDynamic() ? _target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(targetCell)) : cellModelCell.getNumberOfNodes();
// get nb of cell sons (faces)
const ConnType* rawCellConn = _target_mesh.getConnectivityPtr() + OTT<ConnType,numPol>::conn2C( _target_mesh.getConnectivityIndexPtr()[ targetCell ]);
- const int rawNbCellNodes = _target_mesh.getConnectivityIndexPtr()[ targetCell+1 ] - _target_mesh.getConnectivityIndexPtr()[ targetCell ];
+ const ConnType rawNbCellNodes = _target_mesh.getConnectivityIndexPtr()[ targetCell+1 ] - _target_mesh.getConnectivityIndexPtr()[ targetCell ];
unsigned nbOfSons = cellModelCell.getNumberOfSons2(rawCellConn, rawNbCellNodes);
// indices of nodes of a son
- static std::vector<int> allNodeIndices; // == 0,1,2,...,nbOfCellNodes-1
- while ( allNodeIndices.size() < nbOfCellNodes )
- allNodeIndices.push_back( allNodeIndices.size() );
- std::vector<int> classicFaceNodes(4);
+ static std::vector<ConnType> allNodeIndices; // == 0,1,2,...,nbOfCellNodes-1
+ while ( allNodeIndices.size() < (std::size_t)nbOfCellNodes )
+ allNodeIndices.push_back( static_cast<ConnType>(allNodeIndices.size()) );
+ std::vector<ConnType> classicFaceNodes(4);
if(cellModelCell.isQuadratic())
throw INTERP_KERNEL::Exception("SplitterTetra2::splitConvex : quadratic 3D cells are not implemented yet !");
- int* faceNodes = cellModelCell.isDynamic() ? &allNodeIndices[0] : &classicFaceNodes[0];
+ ConnType* faceNodes = cellModelCell.isDynamic() ? &allNodeIndices[0] : &classicFaceNodes[0];
// nodes of tetrahedron
- int conn[4];
+ typename MyMeshTypeS::MyConnType conn[4];
const double* nodes[4];
nodes[3] = getCoordsOfSubNode2( nbOfCellNodes,conn[3]); // barycenter
{
// retrieve real mesh nodes
- typename MyMeshTypeT::MyConnType nbOfNodesT = _node_ids.size();// Issue 0020634. _node_ids.resize(8);
+ typename MyMeshTypeT::MyConnType nbOfNodesT = static_cast<typename MyMeshTypeT::MyConnType>(_node_ids.size());// Issue 0020634. _node_ids.resize(8);
for(int node = 0; node < nbOfNodesT ; ++node)
{
// calculate only normal nodes
*/
virtual void intersectCells(ConnType targetCell, const std::vector<ConnType>& srcCells, MyMatrix& res) = 0;
- virtual int getNumberOfRowsOfResMatrix() const = 0;
- virtual int getNumberOfColsOfResMatrix() const = 0;
+ virtual ConnType getNumberOfRowsOfResMatrix() const = 0;
+ virtual ConnType getNumberOfColsOfResMatrix() const = 0;
virtual ~TargetIntersector() { }
};
}
const long double delta = MULT_PREC_F * ( std::fabs(term1) + std::fabs(term2) );
- if( epsilonEqual(_doubleProducts[8*seg + dp], 0.0, THRESHOLD_F * delta))
+ if( epsilonEqual(_doubleProducts[8*seg + dp], 0.0, (double)(THRESHOLD_F * delta)))
{
// debug output
#if LOG_LEVEL >= 5
const long double delta = MULT_PREC_F * (std::fabs(p_term) + std::fabs(q_term) + std::fabs(r_term));
#endif
- if( epsilonEqual( p_term + q_term + r_term, 0.0, THRESHOLD_F * delta) )
+ if( epsilonEqual( p_term + q_term + r_term, 0.0, (double)(THRESHOLD_F * delta)) )
{
LOG(4, "Reset imprecise triple product for corner " << corner << " to zero" );
return 0.0;
&CoordsS[0],&CoordsS[SPACEDIM*iS],&CoordsS[SPACEDIM*(iS+1)],
inter, PlanarIntersector<MyMeshType,MyMatrix>::_dim_caracteristic,
PlanarIntersector<MyMeshType,MyMatrix>::_precision);
- ConnType nb_inter=((ConnType)inter.size())/2;
+ ConnType nb_inter=ToConnType(inter.size())/2;
if(nb_inter >3) inter=reconstruct_polygon(inter);
for(ConnType i = 1; i<nb_inter-1; i++)
{
bool isSourceQuad)
{
double result = 0.;
- ConnType nbNodesS=sourceCoords.size()/SPACEDIM;
+ ConnType nbNodesS=ToConnType(sourceCoords.size())/SPACEDIM;
//Compute the intersection area
double area[SPACEDIM];
for(ConnType iT = 1; iT<3; iT++)
&sourceCoords[0],&sourceCoords[SPACEDIM*iS],&sourceCoords[SPACEDIM*(iS+1)],
inter, PlanarIntersector<MyMeshType,MyMatrix>::_dim_caracteristic,
PlanarIntersector<MyMeshType,MyMatrix>::_precision);
- ConnType nb_inter=((ConnType)inter.size())/2;
+ ConnType nb_inter=ToConnType(inter.size())/2;
if(nb_inter >3) inter=reconstruct_polygon(inter);
for(ConnType i = 1; i<nb_inter-1; i++)
{
const std::vector<double>& sourceCoords)
{
double result = 0.;
- ConnType nbNodesS=sourceCoords.size()/SPACEDIM;
- ConnType nbNodesT=targetCoords.size()/SPACEDIM;
+ ConnType nbNodesS=ToConnType(sourceCoords.size())/SPACEDIM;
+ ConnType nbNodesT=ToConnType(targetCoords.size())/SPACEDIM;
//Compute the intersection area
double area[SPACEDIM];
for(ConnType iT = 1; iT<nbNodesT-1; iT++)
&sourceCoords[0],&sourceCoords[SPACEDIM*iS],&sourceCoords[SPACEDIM*(iS+1)],
inter, PlanarIntersector<MyMeshType,MyMatrix>::_dim_caracteristic,
PlanarIntersector<MyMeshType,MyMatrix>::_precision);
- ConnType nb_inter=((ConnType)inter.size())/2;
+ ConnType nb_inter=ToConnType(inter.size())/2;
if(nb_inter >3) inter=reconstruct_polygon(inter);
for(ConnType i = 1; i<nb_inter-1; i++)
{
double inter_area[SPACEDIM], total_area = 0.;
double total_barycenter[SPACEDIM]={0.,0.};
- const ConnType nbNodesT=targetCell.size()/SPACEDIM;
+ const ConnType nbNodesT=ToConnType(targetCell.size())/SPACEDIM;
for(ConnType iT = 1; iT<nbNodesT-1; iT++)
{
std::vector<double> inter;
sourceCell[0], sourceCell[1], sourceCell[2],
inter, PlanarIntersector<MyMeshType,MyMatrix>::_dim_caracteristic,
PlanarIntersector<MyMeshType,MyMatrix>::_precision);
- ConnType nb_inter=((ConnType)inter.size())/2;
+ ConnType nb_inter=ToConnType(inter.size())/2;
if(nb_inter >3) inter=reconstruct_polygon(inter);
for(ConnType i = 1; i<nb_inter-1; i++)
{
#include "InterpKernelGeo2DEdgeLin.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
+#include "MCIdType.hxx"
#include <sstream>
#include <cmath>
namespace INTERP_KERNEL
{
- inline void calculateBarycenterDyn(const double **pts, int nbPts,
+ inline void calculateBarycenterDyn(const double **pts, mcIdType nbPts,
int dim, double *bary);
- inline double calculateAreaForPolyg(const double **coords, int nbOfPtsInPolygs,
+ inline double calculateAreaForPolyg(const double **coords, mcIdType nbOfPtsInPolygs,
int spaceDim);
- inline double calculateAreaForQPolyg(const double **coords, int nbOfPtsInPolygs,
+ inline double calculateAreaForQPolyg(const double **coords, mcIdType nbOfPtsInPolygs,
int spaceDim);
inline double calculateLgthForSeg2(const double *p1, const double *p2, int spaceDim)
// ===================================
// Calculate Normal Vector for Polygon
// ===================================
- inline void calculateNormalForPolyg(const double **coords, int nbOfPtsInPolygs,
+ inline void calculateNormalForPolyg(const double **coords, mcIdType nbOfPtsInPolygs,
double *normal)
{
double coordOfBary[3];
// ==========================
// Calculate Area for Polygon
// ==========================
- inline double calculateAreaForPolyg(const double **coords, int nbOfPtsInPolygs,
+ inline double calculateAreaForPolyg(const double **coords, mcIdType nbOfPtsInPolygs,
int spaceDim)
{
double ret=0.;
double coordOfBary[3];
calculateBarycenterDyn(coords,nbOfPtsInPolygs,spaceDim,coordOfBary);
- for ( int i=0; i<nbOfPtsInPolygs; i++ )
+ for ( mcIdType i=0; i<nbOfPtsInPolygs; i++ )
{
double tmp = calculateAreaForTria(coords[i],coords[(i+1)%nbOfPtsInPolygs],
coordOfBary,spaceDim);
return ret;
}
- double calculateAreaForQPolyg(const double **coords, int nbOfPtsInPolygs, int spaceDim)
+ double calculateAreaForQPolyg(const double **coords, mcIdType nbOfPtsInPolygs, int spaceDim)
{
if(nbOfPtsInPolygs%2==0)
if(spaceDim==2)
{
std::vector<Node *> nodes(nbOfPtsInPolygs);
- for(int i=0;i<nbOfPtsInPolygs;i++)
+ for(mcIdType i=0;i<nbOfPtsInPolygs;i++)
nodes[i]=new Node(coords[i][0],coords[i][1]);
QuadraticPolygon *pol=QuadraticPolygon::BuildArcCirclePolygon(nodes);
double ret=pol->getArea();
* polyhedron
*/
template<class ConnType, NumberingPolicy numPol>
- inline double calculateVolumeForPolyh2(const ConnType *connec, int lgth, const double *coords)
+ inline double calculateVolumeForPolyh2(const ConnType *connec, mcIdType lgth, const double *coords)
{
std::size_t nbOfFaces=std::count(connec,connec+lgth,-1)+1;
double volume=0.;
- const int *work=connec;
+ const ConnType *work=connec;
for(std::size_t iFace=0;iFace<nbOfFaces;iFace++)
{
- const int *work2=std::find(work+1,connec+lgth,-1);
+ const ConnType *work2=std::find(work+1,connec+lgth,-1);
std::size_t nbOfNodesOfCurFace=std::distance(work,work2);
double areaVector[3]={0.,0.,0.};
for(std::size_t ptId=0;ptId<nbOfNodesOfCurFace;ptId++)
* @param res must be of size at least 3 to store the result.
*/
template<class ConnType, NumberingPolicy numPol>
- inline void areaVectorOfPolygon(const ConnType *connec, int lgth, const double *coords, double *res)
+ inline void areaVectorOfPolygon(const ConnType *connec, mcIdType lgth, const double *coords, double *res)
{
res[0]=0.; res[1]=0.; res[2]=0.;
- for(int ptId=0;ptId<lgth;ptId++)
+ for(mcIdType ptId=0;ptId<lgth;ptId++)
{
const double *pti=coords+3*OTT<ConnType,numPol>::coo2C(connec[ptId]);
const double *pti1=coords+3*OTT<ConnType,numPol>::coo2C(connec[(ptId+1)%lgth]);
}
template<class ConnType, NumberingPolicy numPol>
- inline void computePolygonBarycenter3D(const ConnType *connec, int lgth, const double *coords, double *res)
+ inline void computePolygonBarycenter3D(const ConnType *connec, mcIdType lgth, const double *coords, double *res)
{
double area[3];
areaVectorOfPolygon<ConnType,numPol>(connec,lgth,coords,area);
{
area[0]/=norm; area[1]/=norm; area[2]/=norm;
res[0]=0.; res[1]=0.; res[2]=0.;
- for(int i=1;i<lgth-1;i++)
+ for(mcIdType i=1;i<lgth-1;i++)
{
double v[3];
double tmpArea[3];
throw INTERP_KERNEL::Exception("computePolygonBarycenter3D : lgth of polygon is < 1 !");
norm=0.;
double v[3];
- for(int i=0;i<lgth;i++)
+ for(mcIdType i=0;i<lgth;i++)
{
v[0]=coords[3*OTT<ConnType,numPol>::coo2C(connec[(i+1)%lgth])]-coords[3*OTT<ConnType,numPol>::coo2C(connec[i])];
v[1]=coords[3*OTT<ConnType,numPol>::coo2C(connec[(i+1)%lgth])+1]-coords[3*OTT<ConnType,numPol>::coo2C(connec[i])+1];
else
{
res[0]=0.; res[1]=0.; res[2]=0.;
- for(int i=0;i<lgth;i++)
+ for(mcIdType i=0;i<lgth;i++)
{
res[0]+=coords[3*OTT<ConnType,numPol>::coo2C(connec[i])];
res[1]+=coords[3*OTT<ConnType,numPol>::coo2C(connec[i])+1];
res[2]+=coords[3*OTT<ConnType,numPol>::coo2C(connec[i])+2];
}
- res[0]/=lgth; res[1]/=lgth; res[2]/=lgth;
+ res[0]/=FromIdType<double>(lgth); res[1]/=FromIdType<double>(lgth); res[2]/=FromIdType<double>(lgth);
return;
}
}
}
template<class ConnType, NumberingPolicy numPol>
- inline void barycenterOfPolyhedron(const ConnType *connec, int lgth, const double *coords, double *res)
+ inline void barycenterOfPolyhedron(const ConnType *connec, mcIdType lgth, const double *coords, double *res)
{
std::size_t nbOfFaces=std::count(connec,connec+lgth,-1)+1;
res[0]=0.; res[1]=0.; res[2]=0.;
- const int *work=connec;
+ const ConnType *work=connec;
for(std::size_t i=0;i<nbOfFaces;i++)
{
- const int *work2=std::find(work+1,connec+lgth,-1);
+ const ConnType *work2=std::find(work+1,connec+lgth,-1);
int nbOfNodesOfCurFace=(int)std::distance(work,work2);
// projection to (u,v) of each faces of polyh to compute integral(x^2/2) on each faces.
double normal[3];
work=connec;
for(std::size_t i=0;i<nbOfFaces;i++)
{
- const int *work2=std::find(work+1,connec+lgth,-1);
+ const ConnType *work2=std::find(work+1,connec+lgth,-1);
int nbOfNodesOfCurFace=(int)std::distance(work,work2);
double normal[3];
areaVectorOfPolygon<ConnType,numPol>(work,nbOfNodesOfCurFace,coords,normal);
{
}
- inline void calculateBarycenterDyn(const double **pts, int nbPts,
+ inline void calculateBarycenterDyn(const double **pts, mcIdType nbPts,
int dim, double *bary)
{
for(int i=0;i<dim;i++)
{
double temp=0.;
- for(int j=0;j<nbPts;j++)
+ for(mcIdType j=0;j<nbPts;j++)
{
temp+=pts[j][i];
}
- bary[i]=temp/nbPts;
+ bary[i]=temp/FromIdType<double>(nbPts);
}
}
template<int SPACEDIM>
- inline void calculateBarycenterDyn2(const double *pts, int nbPts, double *bary)
+ inline void calculateBarycenterDyn2(const double *pts, mcIdType nbPts, double *bary)
{
for(int i=0;i<SPACEDIM;i++)
{
double temp=0.;
- for(int j=0;j<nbPts;j++)
+ for(mcIdType j=0;j<nbPts;j++)
{
temp+=pts[j*SPACEDIM+i];
}
- bary[i]=temp/nbPts;
+ bary[i]=temp/FromIdType<double>(nbPts);
}
}
- inline void computePolygonBarycenter2DEngine(double **coords, int lgth, double *res)
+ inline void computePolygonBarycenter2DEngine(double **coords, mcIdType lgth, double *res)
{
double area=0.;
res[0]=0.; res[1]=0.;
- for(int i=0;i<lgth;i++)
+ for(mcIdType i=0;i<lgth;i++)
{
double cp=coords[i][0]*coords[(i+1)%lgth][1]-coords[i][1]*coords[(i+1)%lgth][0];
area+=cp;
}
template<class ConnType, NumberingPolicy numPol>
- inline void computePolygonBarycenter2D(const ConnType *connec, int lgth, const double *coords, double *res)
+ inline void computePolygonBarycenter2D(const ConnType *connec, mcIdType lgth, const double *coords, double *res)
{
double **coords2=new double *[lgth];
- for(int i=0;i<lgth;i++)
+ for(mcIdType i=0;i<lgth;i++)
coords2[i]=const_cast<double *>(coords+2*OTT<ConnType,numPol>::coo2C(connec[i]));
computePolygonBarycenter2DEngine(coords2,lgth,res);
delete [] coords2;
}
- inline void computeQPolygonBarycenter2D(double **coords, int nbOfPtsInPolygs, int spaceDim, double *res)
+ inline void computeQPolygonBarycenter2D(double **coords, mcIdType nbOfPtsInPolygs, int spaceDim, double *res)
{
if(nbOfPtsInPolygs%2==0)
{
if(spaceDim==2)
{
std::vector<Node *> nodes(nbOfPtsInPolygs);
- for(int i=0;i<nbOfPtsInPolygs;i++)
+ for(mcIdType i=0;i<nbOfPtsInPolygs;i++)
nodes[i]=new Node(coords[i][0],coords[i][1]);
QuadraticPolygon *pol=QuadraticPolygon::BuildArcCirclePolygon(nodes);
pol->getBarycenter(res);
return sqrt(sDist);
}
- double DistanceFromPtToPolygonInSpaceDim3(const double *pt, const int *connOfPolygonBg, const int *connOfPolygonEnd, const double *coords)
+ double DistanceFromPtToPolygonInSpaceDim3(const double *pt, const mcIdType *connOfPolygonBg, const mcIdType *connOfPolygonEnd, const double *coords)
{
std::size_t nbOfEdges=std::distance(connOfPolygonBg,connOfPolygonEnd);
if(nbOfEdges<3)
#include "INTERPKERNELDefines.hxx"
#include "InterpKernelException.hxx"
#include "NormalizedUnstructuredMesh.hxx"
+#include "MCIdType.hxx"
namespace INTERP_KERNEL
{
template<class ConnType, NumberingPolicy numPolConn, int SPACEDIM>
- double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords);
+ double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords);
template<class ConnType, NumberingPolicy numPolConn>
- double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim);
+ double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim);
template<class ConnType, NumberingPolicy numPolConn, int SPACEDIM>
- void computeBarycenter(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, double *res);
+ void computeBarycenter(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, double *res);
template<class ConnType, NumberingPolicy numPolConn>
- void computeBarycenter2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim, double *res);
+ void computeBarycenter2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim, double *res);
double INTERPKERNEL_EXPORT OrthoDistanceFromPtToPlaneInSpaceDim3(const double *p, const double *p1, const double *p2, const double *p3);
double INTERPKERNEL_EXPORT DistanceFromPtToTriInSpaceDim3(const double *pt, const double *pt0Tri3, const double *pt1Tri3, const double *pt2Tri3);
- double INTERPKERNEL_EXPORT DistanceFromPtToPolygonInSpaceDim3(const double *pt, const int *connOfPolygonBg, const int *connOfPolygonEnd, const double *coords);
+ double INTERPKERNEL_EXPORT DistanceFromPtToPolygonInSpaceDim3(const double *pt, const mcIdType *connOfPolygonBg, const mcIdType *connOfPolygonEnd, const double *coords);
bool ComputeRotTranslationMatrixToPut3PointsOnOXY(const double *pt0Tri3, const double *pt1Tri3, const double *pt2Tri3, double *matrix);
}
namespace INTERP_KERNEL
{
template<class ConnType, NumberingPolicy numPol, int SPACEDIM>
- double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords)
+ double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords)
{
switch(type)
{
case INTERP_KERNEL::NORM_SEG2 :
case INTERP_KERNEL::NORM_SEG4 :
{
- int N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
- int N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
+ ConnType N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
+ ConnType N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
return INTERP_KERNEL::calculateLgthForSeg2(coords+(SPACEDIM*N1),coords+(SPACEDIM*N2),SPACEDIM);
}
case INTERP_KERNEL::NORM_SEG3 :
{
- int beginNode = OTT<ConnType,numPol>::coo2C(connec[0]);
- int endNode = OTT<ConnType,numPol>::coo2C(connec[1]);
- int middleNode = OTT<ConnType,numPol>::coo2C(connec[2]);
+ ConnType beginNode = OTT<ConnType,numPol>::coo2C(connec[0]);
+ ConnType endNode = OTT<ConnType,numPol>::coo2C(connec[1]);
+ ConnType middleNode = OTT<ConnType,numPol>::coo2C(connec[2]);
return INTERP_KERNEL::calculateLgthForSeg3(coords+(SPACEDIM*beginNode),coords+(SPACEDIM*endNode),coords+(SPACEDIM*middleNode),SPACEDIM);
}
case INTERP_KERNEL::NORM_TRI3 :
{
- int N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
- int N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
- int N3 = OTT<ConnType,numPol>::coo2C(connec[2]);
+ ConnType N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
+ ConnType N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
+ ConnType N3 = OTT<ConnType,numPol>::coo2C(connec[2]);
return INTERP_KERNEL::calculateAreaForTria(coords+(SPACEDIM*N1),
coords+(SPACEDIM*N2),
break;
case INTERP_KERNEL::NORM_QUAD4 :
{
- int N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
- int N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
- int N3 = OTT<ConnType,numPol>::coo2C(connec[2]);
- int N4 = OTT<ConnType,numPol>::coo2C(connec[3]);
+ ConnType N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
+ ConnType N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
+ ConnType N3 = OTT<ConnType,numPol>::coo2C(connec[2]);
+ ConnType N4 = OTT<ConnType,numPol>::coo2C(connec[3]);
return INTERP_KERNEL::calculateAreaForQuad(coords+SPACEDIM*N1,
coords+SPACEDIM*N2,
case INTERP_KERNEL::NORM_TETRA4 :
case INTERP_KERNEL::NORM_TETRA10 :
{
- int N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
- int N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
- int N3 = OTT<ConnType,numPol>::coo2C(connec[2]);
- int N4 = OTT<ConnType,numPol>::coo2C(connec[3]);
+ ConnType N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
+ ConnType N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
+ ConnType N3 = OTT<ConnType,numPol>::coo2C(connec[2]);
+ ConnType N4 = OTT<ConnType,numPol>::coo2C(connec[3]);
return INTERP_KERNEL::calculateVolumeForTetra(coords+SPACEDIM*N1,
coords+SPACEDIM*N2,
case INTERP_KERNEL::NORM_PYRA5 :
case INTERP_KERNEL::NORM_PYRA13 :
{
- int N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
- int N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
- int N3 = OTT<ConnType,numPol>::coo2C(connec[2]);
- int N4 = OTT<ConnType,numPol>::coo2C(connec[3]);
- int N5 = OTT<ConnType,numPol>::coo2C(connec[4]);
+ ConnType N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
+ ConnType N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
+ ConnType N3 = OTT<ConnType,numPol>::coo2C(connec[2]);
+ ConnType N4 = OTT<ConnType,numPol>::coo2C(connec[3]);
+ ConnType N5 = OTT<ConnType,numPol>::coo2C(connec[4]);
return INTERP_KERNEL::calculateVolumeForPyra(coords+SPACEDIM*N1,
coords+SPACEDIM*N2,
case INTERP_KERNEL::NORM_PENTA15 :
case INTERP_KERNEL::NORM_PENTA18 :
{
- int N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
- int N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
- int N3 = OTT<ConnType,numPol>::coo2C(connec[2]);
- int N4 = OTT<ConnType,numPol>::coo2C(connec[3]);
- int N5 = OTT<ConnType,numPol>::coo2C(connec[4]);
- int N6 = OTT<ConnType,numPol>::coo2C(connec[5]);
+ ConnType N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
+ ConnType N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
+ ConnType N3 = OTT<ConnType,numPol>::coo2C(connec[2]);
+ ConnType N4 = OTT<ConnType,numPol>::coo2C(connec[3]);
+ ConnType N5 = OTT<ConnType,numPol>::coo2C(connec[4]);
+ ConnType N6 = OTT<ConnType,numPol>::coo2C(connec[5]);
return INTERP_KERNEL::calculateVolumeForPenta(coords+SPACEDIM*N1,
coords+SPACEDIM*N2,
case INTERP_KERNEL::NORM_HEXA20 :
case INTERP_KERNEL::NORM_HEXA27 :
{
- int N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
- int N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
- int N3 = OTT<ConnType,numPol>::coo2C(connec[2]);
- int N4 = OTT<ConnType,numPol>::coo2C(connec[3]);
- int N5 = OTT<ConnType,numPol>::coo2C(connec[4]);
- int N6 = OTT<ConnType,numPol>::coo2C(connec[5]);
- int N7 = OTT<ConnType,numPol>::coo2C(connec[6]);
- int N8 = OTT<ConnType,numPol>::coo2C(connec[7]);
+ ConnType N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
+ ConnType N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
+ ConnType N3 = OTT<ConnType,numPol>::coo2C(connec[2]);
+ ConnType N4 = OTT<ConnType,numPol>::coo2C(connec[3]);
+ ConnType N5 = OTT<ConnType,numPol>::coo2C(connec[4]);
+ ConnType N6 = OTT<ConnType,numPol>::coo2C(connec[5]);
+ ConnType N7 = OTT<ConnType,numPol>::coo2C(connec[6]);
+ ConnType N8 = OTT<ConnType,numPol>::coo2C(connec[7]);
return INTERP_KERNEL::calculateVolumeForHexa(coords+SPACEDIM*N1,
coords+SPACEDIM*N2,
break;
case INTERP_KERNEL::NORM_HEXGP12:
{
- const int connecHexa12[43]={
+ const ConnType connecHexa12[43]={
OTT<ConnType,numPol>::coo2C(connec[0]),OTT<ConnType,numPol>::coo2C(connec[1]),OTT<ConnType,numPol>::coo2C(connec[2]),OTT<ConnType,numPol>::coo2C(connec[3]),OTT<ConnType,numPol>::coo2C(connec[4]),OTT<ConnType,numPol>::coo2C(connec[5]),-1,
OTT<ConnType,numPol>::coo2C(connec[6]),OTT<ConnType,numPol>::coo2C(connec[11]),OTT<ConnType,numPol>::coo2C(connec[10]),OTT<ConnType,numPol>::coo2C(connec[9]),OTT<ConnType,numPol>::coo2C(connec[8]),OTT<ConnType,numPol>::coo2C(connec[7]),-1,
OTT<ConnType,numPol>::coo2C(connec[0]),OTT<ConnType,numPol>::coo2C(connec[6]),OTT<ConnType,numPol>::coo2C(connec[7]),OTT<ConnType,numPol>::coo2C(connec[1]),-1,
}
template<class ConnType, NumberingPolicy numPolConn>
- double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim)
+ double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim)
{
if(spaceDim==3)
return computeVolSurfOfCell<ConnType,numPolConn,3>(type,connec,lgth,coords);
template<class ConnType, NumberingPolicy numPol,int SPACEDIM>
- void computeBarycenter(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, double *res)
+ void computeBarycenter(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, double *res)
{
switch(type)
{
}
case NORM_HEXA8:
{
- const int conn[29]={
+ const ConnType conn[29]={
OTT<ConnType,numPol>::coo2C(connec[0]),OTT<ConnType,numPol>::coo2C(connec[1]),OTT<ConnType,numPol>::coo2C(connec[2]),OTT<ConnType,numPol>::coo2C(connec[3]),-1,
OTT<ConnType,numPol>::coo2C(connec[4]),OTT<ConnType,numPol>::coo2C(connec[7]),OTT<ConnType,numPol>::coo2C(connec[6]),OTT<ConnType,numPol>::coo2C(connec[5]),-1,
OTT<ConnType,numPol>::coo2C(connec[0]),OTT<ConnType,numPol>::coo2C(connec[3]),OTT<ConnType,numPol>::coo2C(connec[7]),OTT<ConnType,numPol>::coo2C(connec[4]),-1,
}
case NORM_PENTA6:
{
- const int conn[22]={
+ const ConnType conn[22]={
OTT<ConnType,numPol>::coo2C(connec[0]),OTT<ConnType,numPol>::coo2C(connec[1]),OTT<ConnType,numPol>::coo2C(connec[2]),-1,
OTT<ConnType,numPol>::coo2C(connec[3]),OTT<ConnType,numPol>::coo2C(connec[5]),OTT<ConnType,numPol>::coo2C(connec[4]),-1,
OTT<ConnType,numPol>::coo2C(connec[0]),OTT<ConnType,numPol>::coo2C(connec[2]),OTT<ConnType,numPol>::coo2C(connec[5]),OTT<ConnType,numPol>::coo2C(connec[3]),-1,
}
case INTERP_KERNEL::NORM_HEXGP12:
{
- const int connecHexa12[43]={
+ const ConnType connecHexa12[43]={
OTT<ConnType,numPol>::coo2C(connec[0]),OTT<ConnType,numPol>::coo2C(connec[1]),OTT<ConnType,numPol>::coo2C(connec[2]),OTT<ConnType,numPol>::coo2C(connec[3]),OTT<ConnType,numPol>::coo2C(connec[4]),OTT<ConnType,numPol>::coo2C(connec[5]),-1,
OTT<ConnType,numPol>::coo2C(connec[6]),OTT<ConnType,numPol>::coo2C(connec[11]),OTT<ConnType,numPol>::coo2C(connec[10]),OTT<ConnType,numPol>::coo2C(connec[9]),OTT<ConnType,numPol>::coo2C(connec[8]),OTT<ConnType,numPol>::coo2C(connec[7]),-1,
OTT<ConnType,numPol>::coo2C(connec[0]),OTT<ConnType,numPol>::coo2C(connec[6]),OTT<ConnType,numPol>::coo2C(connec[7]),OTT<ConnType,numPol>::coo2C(connec[1]),-1,
}
template<class ConnType, NumberingPolicy numPolConn>
- void computeBarycenter2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim, double *res)
+ void computeBarycenter2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim, double *res)
{
if(spaceDim==3)
return computeBarycenter<ConnType,numPolConn,3>(type,connec,lgth,coords,res);
bool checkDequesEqual(std::deque< double > deque1,
std::deque< double > deque2, double epsilon)
{
- int size1 = deque1.size();
- int size2 = deque2.size();
+ std::size_t size1 = deque1.size();
+ std::size_t size2 = deque2.size();
bool are_equal = size1 == size2;
if(are_equal)
- for(int i = 0; i < size1 && are_equal; i++)
+ for(std::size_t i = 0; i < size1 && are_equal; i++)
are_equal = fabs(deque1[i] - deque2[i]) < epsilon;
return are_equal;
bool checkVectorsEqual(std::vector< double > vect1,
std::vector< double > vect2, double epsilon)
{
- int size1 = vect1.size();
- int size2 = vect2.size();
+ std::size_t size1 = vect1.size();
+ std::size_t size2 = vect2.size();
bool are_equal = size1 == size2;
if(are_equal)
- for(int i = 0; i < size1 && are_equal; i++)
+ for(std::size_t i = 0; i < size1 && are_equal; i++)
are_equal = fabs(vect1[i] - vect2[i]) < epsilon;
return are_equal;
}
void dequePrintOut(std::deque< double > deque1)
{
- for(int i = 0; i< (int)deque1.size(); i++)
+ for(std::size_t i = 0; i< deque1.size(); i++)
{
std::cerr << deque1[i] << " ";
}
}
void vectPrintOut(std::vector< double > vect)
{
- for(int i = 0; i< (int)vect.size(); i++)
+ for(std::size_t i = 0; i< vect.size(); i++)
{
std::cerr << vect[i] << " ";
}
#define ERR_TOL 1.0e-8
-typedef std::vector<std::map<int,double> > IntersectionMatrix;
+typedef std::vector<std::map<mcIdType,double> > IntersectionMatrix;
namespace INTERP_KERNEL
{
{
if(iter->count(i) != 0.0)
{
- std::map<int, double>::const_iterator iter2 = iter->find(i);
+ std::map<mcIdType, double>::const_iterator iter2 = iter->find(i);
vol += fabs(iter2->second);
}
}
double MeshTestToolkit<SPACEDIM,MESHDIM>::sumCol(const IntersectionMatrix& m, int i) const
{
double vol = 0.0;
- const std::map<int, double>& col = m[i];
- for(std::map<int, double>::const_iterator iter = col.begin() ; iter != col.end() ; ++iter)
+ const std::map<mcIdType, double>& col = m[i];
+ for(std::map<mcIdType, double>::const_iterator iter = col.begin() ; iter != col.end() ; ++iter)
{
vol += fabs(iter->second);
}
std::vector<double> volumes;
for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
{
- for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
volumes.push_back(fabs(iter2->second));
}
int i = 0;
for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter)
{
- for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
- int j = iter2->first;
+ mcIdType j = iter2->first;
if(m2.at(j).count(i) == 0)
{
if(!epsilonEqual(iter2->second, 0.0, _precision))
for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter)
{
- for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
- int j = iter2->first;
+ mcIdType j = iter2->first;
const double v1 = fabs(iter2->second);
//if(m2[j - 1].count(i+1) > 0)
// {
- std::map<int, double> theMap = m2.at(j);
+ std::map<mcIdType, double> theMap = m2.at(j);
const double v2 = fabs(theMap[i]);
if(v1 != v2)
{
bool isDiagonal = true;
for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
{
- for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
- int j = iter2->first;
+ mcIdType j = iter2->first;
const double vol = iter2->second;
if(vol != 0.0 && (i != j))
{
std::cout << "Intersection matrix is " << std::endl;
for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
{
- for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
std::cout << "V(" << i << ", " << iter2->first << ") = " << iter2->second << std::endl;
}
for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
{
numElems += iter->size();
- for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
if(!INTERP_KERNEL::epsilonEqual(iter2->second, 0.0, VOL_PREC))
{
#include "ThreeDSurfProjectionTest.hxx"
#include "PlanarIntersector.txx"
+#include "MCIdType.hxx"
class MyMeshType
{
static const int MY_SPACEDIM=3;
static const int MY_MESHDIM=3;
static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
- typedef int MyConnType;
+ typedef mcIdType MyConnType;
};
class MyMatrixType
#include "TetraAffineTransform.hxx"
#include "InterpolationUtils.hxx"
#include "SplitterTetra.txx"
+#include "MCIdType.hxx"
#include <iostream>
{
struct __MESH_DUMMY
{
- typedef int MyConnType;
+ typedef mcIdType MyConnType;
static const int MY_SPACEDIM=3;
};
static SplitterTetra<__MESH_DUMMY>* buildSplitterTetra()
{
- const int conn[4] = { 0,1,2,3 };
+ const mcIdType conn[4] = { 0,1,2,3 };
const double targetCoords[] = { -20., 0.,10.,
-20.,10.,10.,
void UnitTetra3D2DIntersectionTest::test_UnitTetra3D2DIntersection_1()
{
- const int conn[4] = { 0,1,2 };
+ const mcIdType conn[4] = { 0,1,2 };
const double sourceCoords[] = { -20., 0., 10.,
-12., 0., 10.,
void UnitTetra3D2DIntersectionTest::test_UnitTetra3D2DIntersection_2()
{
- const int conn[4] = { 0,1,2,3 };
+ const mcIdType conn[4] = { 0,1,2,3 };
const double sourceCoords[] = { -20., 0., 10.,
-12., 0., 10.,
void UnitTetra3D2DIntersectionTest::test_UnitTetra3D2DIntersection_3()
{
- const int conn[4] = { 0,1,2 };
+ const mcIdType conn[4] = { 0,1,2 };
const double sourceCoords[] = { -20., 0., 16.,
-18., 0., 16.,
#include "TetraAffineTransform.hxx"
#include "InterpolationUtils.hxx"
#include "SplitterTetra.txx"
+#include "MCIdType.hxx"
#include <iostream>
struct __MESH_DUMMY
{
- typedef int MyConnType;
+ typedef mcIdType MyConnType;
};
void UnitTetraIntersectionBaryTest::test_UnitTetraIntersectionBary_13()
75,150,75,
100,100,100};
- int conn[4] = { 0,1,2,3 };
+ mcIdType conn[4] = { 0,1,2,3 };
const double* tnodes[4]={ T, T+3, T+6, T+9 };
const double* snodes[4]={ S, S+3, S+6, S+9 };
### KILLER WARNINGS TO HELP INT64 MANAGEMENT
#ADD_DEFINITIONS(-Wextra -Wsynth -Wno-unused-parameter -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wreturn-type -Wno-endif-labels -Wsign-compare -Wmissing-format-attribute -Wno-multichar -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wlong-long -Wdisabled-optimization -Wunknown-pragmas -Wundef -Wreorder)
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}/../..
${CMAKE_CURRENT_SOURCE_DIR}
#ifndef __MEDCOUPLING_MCTYPE_HXX__
#define __MEDCOUPLING_MCTYPE_HXX__
+#include "MCIdType.hxx"
+
#include <cstdint>
#include <stddef.h>
#include <cstddef>
namespace MEDCoupling
{
+ using mcIdType = ::mcIdType;
using Int64 = std::int64_t;
using Int32 = std::int32_t;
+
+ class DataArrayInt32;
+ class DataArrayInt32Iterator;
+ class DataArrayInt32Tuple;
+ class DataArrayInt64;
+ class DataArrayInt64Tuple;
+
#ifndef MEDCOUPLING_USE_64BIT_IDS
- using mcIdType = std::int32_t;
+
+#define DataArrayIdType DataArrayInt32
+#define DataArrayIdTypeTuple DataArrayInt32Tuple
+
#else
- using mcIdType = std::int64_t;
+
+#define DataArrayIdType DataArrayInt64
+#define DataArrayIdTypeTuple DataArrayInt64Tuple
+
#endif
- inline mcIdType ToIdType(std::size_t val) { return mcIdType(val); }
-}
#define DataArrayInt DataArrayInt32
-#define DataArrayIdType DataArrayInt32
-
#define DataArrayIntIterator DataArrayInt32Iterator
+}
#endif
* \param [in] type the geometric type
* \return cell ids in this having geometric type \a type.
*/
-DataArrayInt *MEDCoupling1GTUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
+DataArrayIdType *MEDCoupling1GTUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
if(type==getCellModelEnum())
ret->alloc(getNumberOfCells(),1);
else
/*!
* Returns nb of cells having the geometric type \a type. No throw if no cells in \a this has the geometric type \a type.
*/
-std::size_t MEDCoupling1GTUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
+mcIdType MEDCoupling1GTUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
return type==getCellModelEnum()?getNumberOfCells():0;
}
* \return INTERP_KERNEL::NormalizedCellType - enumeration item describing the cell type.
* \throw If \a cellId is invalid. Valid range is [0, \a this->getNumberOfCells() ).
*/
-INTERP_KERNEL::NormalizedCellType MEDCoupling1GTUMesh::getTypeOfCell(std::size_t cellId) const
+INTERP_KERNEL::NormalizedCellType MEDCoupling1GTUMesh::getTypeOfCell(mcIdType cellId) const
{
if(cellId<getNumberOfCells())
return getCellModelEnum();
* For every k in [0,n] ret[3*k+2]==-1 because it has no sense here.
* This parameter is kept only for compatibility with other method listed above.
*/
-std::vector<int> MEDCoupling1GTUMesh::getDistributionOfTypes() const
+std::vector<mcIdType> MEDCoupling1GTUMesh::getDistributionOfTypes() const
{
- std::vector<int> ret(3);
- ret[0]=(int)getCellModelEnum(); ret[1]=getNumberOfCells(); ret[2]=-1;
+ std::vector<mcIdType> ret(3);
+ ret[0]=ToIdType(getCellModelEnum()); ret[1]=getNumberOfCells(); ret[2]=-1;
return ret;
}
* - After \a code contains [NORM_...,nbCells,0], \a idsInPflPerType [[0,1]] and \a idsPerType is [[1,2]] <br>
*/
-void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType, bool smartPflKiller) const
+void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller) const
{
if(!profile)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::splitProfilePerType : input profile is NULL !");
if(profile->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::splitProfilePerType : input profile should have exactly one component !");
- int nbTuples(profile->getNumberOfTuples()),nbOfCells(getNumberOfCells());
+ mcIdType nbTuples=profile->getNumberOfTuples(),nbOfCells=getNumberOfCells();
code.resize(3); idsInPflPerType.resize(1);
- code[0]=(int)getCellModelEnum(); code[1]=nbTuples;
+ code[0]=ToIdType(getCellModelEnum()); code[1]=nbTuples;
idsInPflPerType.resize(1);
if(smartPflKiller && profile->isIota(nbOfCells))
{
code[2]=-1;
- idsInPflPerType[0]=const_cast<DataArrayInt *>(profile); idsInPflPerType[0]->incrRef();
+ idsInPflPerType[0]=const_cast<DataArrayIdType *>(profile); idsInPflPerType[0]->incrRef();
idsPerType.clear();
return ;
}
code[2]=0;
profile->checkAllIdsInRange(0,nbOfCells);
idsPerType.resize(1);
- idsPerType[0]=const_cast<DataArrayInt *>(profile); idsPerType[0]->incrRef();
- idsInPflPerType[0]=DataArrayInt::Range(0,nbTuples,1);
+ idsPerType[0]=const_cast<DataArrayIdType *>(profile); idsPerType[0]->incrRef();
+ idsInPflPerType[0]=DataArrayIdType::Range(0,nbTuples,1);
}
/*!
*
* \sa MEDCouplingUMesh::checkTypeConsistencyAndContig
*/
-DataArrayInt *MEDCoupling1GTUMesh::checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
+DataArrayIdType *MEDCoupling1GTUMesh::checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(code.size()!=3)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : invalid input code should be exactly of size 3 !");
- if(code[0]!=(int)getCellModelEnum())
+ if(code[0]!=ToIdType(getCellModelEnum()))
{
std::ostringstream oss; oss << "MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : Mismatch of geometric type ! Asking for " << code[0] << " whereas the geometric type is \a this is " << getCellModelEnum() << " (" << _cm->getRepr() << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
if(code[2]!=0)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : single geo type mesh ! 0 or -1 is expected at pos #2 of input code !");
if(idsPerType.size()!=1)
- throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : input code points to DataArrayInt #0 whereas the size of idsPerType is not equal to 1 !");
- const DataArrayInt *pfl=idsPerType[0];
+ throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : input code points to DataArrayIdType #0 whereas the size of idsPerType is not equal to 1 !");
+ const DataArrayIdType *pfl=idsPerType[0];
if(!pfl)
- throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : the input code points to a NULL DataArrayInt at rank 0 !");
+ throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : the input code points to a NULL DataArrayIdType at rank 0 !");
if(pfl->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : input profile should have exactly one component !");
pfl->checkAllIdsInRange(0,nbOfCells);
pfl->incrRef();
- return const_cast<DataArrayInt *>(pfl);
+ return const_cast<DataArrayIdType *>(pfl);
}
void MEDCoupling1GTUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const
/*!
* to improve perf !
*/
-int MEDCoupling1GTUMesh::getCellContainingPoint(const double *pos, double eps) const
+mcIdType MEDCoupling1GTUMesh::getCellContainingPoint(const double *pos, double eps) const
{
MCAuto<MEDCouplingUMesh> m(buildUnstructured());
return m->getCellContainingPoint(pos,eps);
/*!
* to improve perf !
*/
-void MEDCoupling1GTUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const
+void MEDCoupling1GTUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const
{
MCAuto<MEDCouplingUMesh> m(buildUnstructured());
return m->getCellsContainingPoint(pos,eps,elts);
return ret.retn();
}
-DataArrayInt *MEDCoupling1GTUMesh::getCellsInBoundingBox(const double *bbox, double eps) const
+DataArrayIdType *MEDCoupling1GTUMesh::getCellsInBoundingBox(const double *bbox, double eps) const
{
MCAuto<MEDCouplingUMesh> m=buildUnstructured();
return m->getCellsInBoundingBox(bbox,eps);
}
-DataArrayInt *MEDCoupling1GTUMesh::getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps)
+DataArrayIdType *MEDCoupling1GTUMesh::getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps)
{
MCAuto<MEDCouplingUMesh> m=buildUnstructured();
return m->getCellsInBoundingBox(bbox,eps);
}
-MEDCouplingPointSet *MEDCoupling1GTUMesh::buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const
+MEDCouplingPointSet *MEDCoupling1GTUMesh::buildFacePartOfMySelfNode(const mcIdType *start, const mcIdType *end, bool fullyIn) const
{
MCAuto<MEDCouplingUMesh> m=buildUnstructured();
return m->buildFacePartOfMySelfNode(start,end,fullyIn);
}
-DataArrayInt *MEDCoupling1GTUMesh::findBoundaryNodes() const
+DataArrayIdType *MEDCoupling1GTUMesh::findBoundaryNodes() const
{
MCAuto<MEDCouplingUMesh> m=buildUnstructured();
return m->findBoundaryNodes();
return m->buildBoundaryMesh(keepCoords);
}
-void MEDCoupling1GTUMesh::findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const
+void MEDCoupling1GTUMesh::findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const
{
MCAuto<MEDCouplingUMesh> m=buildUnstructured();
m->findCommonCells(compType,startCellId,commonCellsArr,commonCellsIArr);
}
-std::size_t MEDCoupling1GTUMesh::getNodalConnectivityLength() const
+mcIdType MEDCoupling1GTUMesh::getNodalConnectivityLength() const
{
- const DataArrayInt *c1(getNodalConnectivity());
+ const DataArrayIdType *c1(getNodalConnectivity());
if(!c1)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::getNodalConnectivityLength : no connectivity set !");
if(c1->getNumberOfComponents()!=1)
int meshDim(firstPart->getMeshDimension());
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New(firstPart->getName(),meshDim)); ret->setDescription(firstPart->getDescription());
ret->setCoords(coords);
- int nbOfCells(0),connSize(0);
+ mcIdType nbOfCells(0),connSize(0);
for(std::vector< const MEDCoupling1GTUMesh *>::const_iterator it=parts.begin();it!=parts.end();it++)
{
if(!(*it))
nbOfCells+=(*it)->getNumberOfCells();
connSize+=(*it)->getNodalConnectivityLength();
}
- MCAuto<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New()),connI(DataArrayIdType::New());
connI->alloc(nbOfCells+1,1); conn->alloc(connSize+nbOfCells,1);
- int *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0;
+ mcIdType *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0;
for(std::vector< const MEDCoupling1GTUMesh *>::const_iterator it=parts.begin();it!=parts.end();it++)
{
- int curNbCells((*it)->getNumberOfCells());
- int geoType((int)(*it)->getCellModelEnum());
- const int *cinPtr((*it)->getNodalConnectivity()->begin());
+ mcIdType curNbCells=(*it)->getNumberOfCells();
+ mcIdType geoType(ToIdType((*it)->getCellModelEnum()));
+ const mcIdType *cinPtr((*it)->getNodalConnectivity()->begin());
const MEDCoupling1SGTUMesh *ps(dynamic_cast<const MEDCoupling1SGTUMesh *>(*it));
const MEDCoupling1DGTUMesh *pd(dynamic_cast<const MEDCoupling1DGTUMesh *>(*it));
if(ps && !pd)
{
- int nNodesPerCell(ps->getNumberOfNodesPerCell());
+ mcIdType nNodesPerCell(ps->getNumberOfNodesPerCell());
for(int i=0;i<curNbCells;i++,ci++,cinPtr+=nNodesPerCell)
{
*c++=geoType;
}
else if(!ps && pd)
{
- const int *ciinPtr(pd->getNodalConnectivityIndex()->begin());
+ const mcIdType *ciinPtr(pd->getNodalConnectivityIndex()->begin());
for(int i=0;i<curNbCells;i++,ci++,ciinPtr++)
{
*c++=geoType;
{
if(recDeepCpy)
{
- const DataArrayInt *c(other._conn);
+ const DataArrayIdType *c(other._conn);
if(c)
_conn=c->deepCopy();
}
std::set<INTERP_KERNEL::NormalizedCellType> gts(m->getAllGeoTypes());
if(gts.size()!=1)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::New : input mesh must have exactly one geometric type !");
- int geoType((int)*gts.begin());
+ mcIdType geoType(ToIdType(*gts.begin()));
MCAuto<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(m->getName(),*gts.begin()));
ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription());
- int nbCells(m->getNumberOfCells());
- int nbOfNodesPerCell(ret->getNumberOfNodesPerCell());
- MCAuto<DataArrayInt> conn(DataArrayInt::New()); conn->alloc(nbCells*nbOfNodesPerCell,1);
- int *c(conn->getPointer());
- const int *cin(m->getNodalConnectivity()->begin()),*ciin(m->getNodalConnectivityIndex()->begin());
- for(int i=0;i<nbCells;i++,ciin++)
+ mcIdType nbCells=m->getNumberOfCells();
+ mcIdType nbOfNodesPerCell(ret->getNumberOfNodesPerCell());
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New()); conn->alloc(nbCells*nbOfNodesPerCell,1);
+ mcIdType *c(conn->getPointer());
+ const mcIdType *cin(m->getNodalConnectivity()->begin()),*ciin(m->getNodalConnectivityIndex()->begin());
+ for(mcIdType i=0;i<nbCells;i++,ciin++)
{
if(cin[ciin[0]]==geoType)
{
{
checkConsistencyLight();
MCAuto<MEDCoupling1SGTUMesh> ret(clone(false));
- MCAuto<DataArrayInt> c(_conn->deepCopy());
+ MCAuto<DataArrayIdType> c(_conn->deepCopy());
ret->setNodalConnectivity(c);
return ret.retn();
}
void MEDCoupling1SGTUMesh::updateTime() const
{
MEDCoupling1GTUMesh::updateTime();
- const DataArrayInt *c(_conn);
+ const DataArrayIdType *c(_conn);
if(c)
updateTimeWith(*c);
}
std::vector<const BigMemoryObject *> MEDCoupling1SGTUMesh::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret(MEDCoupling1GTUMesh::getDirectChildrenWithNull());
- ret.push_back((const DataArrayInt *)_conn);
+ ret.push_back((const DataArrayIdType *)_conn);
return ret;
}
}
if(!MEDCoupling1GTUMesh::isEqualIfNotWhy(other,prec,reason))
return false;
- const DataArrayInt *c1(_conn),*c2(otherC->_conn);
+ const DataArrayIdType *c1(_conn),*c2(otherC->_conn);
if(c1==c2)
return true;
if(!c1 || !c2)
}
if(!c1->isEqualIfNotWhy(*c2,reason))
{
- reason.insert(0,"Nodal connectivity DataArrayInt differ : ");
+ reason.insert(0,"Nodal connectivity DataArrayIdType differ : ");
return false;
}
return true;
return false;
if(!MEDCoupling1GTUMesh::isEqualWithoutConsideringStr(other,prec))
return false;
- const DataArrayInt *c1(_conn),*c2(otherC->_conn);
+ const DataArrayIdType *c1(_conn),*c2(otherC->_conn);
if(c1==c2)
return true;
if(!c1 || !c2)
void MEDCoupling1SGTUMesh::checkConsistencyOfConnectivity() const
{
- const DataArrayInt *c1(_conn);
+ const DataArrayIdType *c1(_conn);
if(c1)
{
if(c1->getNumberOfComponents()!=1)
void MEDCoupling1SGTUMesh::checkConsistency(double eps) const
{
checkConsistencyLight();
- const DataArrayInt *c1(_conn);
- int nbOfTuples=c1->getNumberOfTuples();
- int nbOfNodesPerCell=(int)_cm->getNumberOfNodes();
+ const DataArrayIdType *c1(_conn);
+ mcIdType nbOfTuples(c1->getNumberOfTuples());
+ mcIdType nbOfNodesPerCell=_cm->getNumberOfNodes();
if(nbOfTuples%nbOfNodesPerCell!=0)
{
std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::checkConsistency : the nb of tuples in conn is " << nbOfTuples << " and number of nodes per cell is " << nbOfNodesPerCell << ". But " << nbOfTuples << "%" << nbOfNodesPerCell << " !=0 !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbOfNodes=getNumberOfNodes();
- int nbOfCells=nbOfTuples/nbOfNodesPerCell;
- const int *w(c1->begin());
- for(int i=0;i<nbOfCells;i++)
+ mcIdType nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfCells=nbOfTuples/nbOfNodesPerCell;
+ const mcIdType *w(c1->begin());
+ for(mcIdType i=0;i<nbOfCells;i++)
for(int j=0;j<nbOfNodesPerCell;j++,w++)
{
if(*w<0 || *w>=nbOfNodes)
}
}
-std::size_t MEDCoupling1SGTUMesh::getNumberOfCells() const
+mcIdType MEDCoupling1SGTUMesh::getNumberOfCells() const
{
- std::size_t nbOfTuples(getNodalConnectivityLength());
- int nbOfNodesPerCell(getNumberOfNodesPerCell());
+ mcIdType nbOfTuples(getNodalConnectivityLength());
+ mcIdType nbOfNodesPerCell(getNumberOfNodesPerCell());
if(nbOfTuples%nbOfNodesPerCell!=0)
{
std::ostringstream oss; oss << "MEDCoupling1SGTUMesh:getNumberOfCells: : the nb of tuples in conn is " << nbOfTuples << " and number of nodes per cell is " << nbOfNodesPerCell << ". But " << nbOfTuples << "%" << nbOfNodesPerCell << " !=0 !";
return nbOfTuples/nbOfNodesPerCell;
}
-int MEDCoupling1SGTUMesh::getNumberOfNodesInCell(int cellId) const
+mcIdType MEDCoupling1SGTUMesh::getNumberOfNodesInCell(mcIdType cellId) const
{
return getNumberOfNodesPerCell();
}
-int MEDCoupling1SGTUMesh::getNumberOfNodesPerCell() const
+mcIdType MEDCoupling1SGTUMesh::getNumberOfNodesPerCell() const
{
checkNonDynamicGeoType();
- return (int)_cm->getNumberOfNodes();
+ return _cm->getNumberOfNodes();
}
-DataArrayInt *MEDCoupling1SGTUMesh::computeNbOfNodesPerCell() const
+DataArrayIdType *MEDCoupling1SGTUMesh::computeNbOfNodesPerCell() const
{
checkNonDynamicGeoType();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(getNumberOfCells(),1);
- ret->fillWithValue((int)_cm->getNumberOfNodes());
+ ret->fillWithValue(_cm->getNumberOfNodes());
return ret.retn();
}
-DataArrayInt *MEDCoupling1SGTUMesh::computeNbOfFacesPerCell() const
+DataArrayIdType *MEDCoupling1SGTUMesh::computeNbOfFacesPerCell() const
{
checkNonDynamicGeoType();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(getNumberOfCells(),1);
- ret->fillWithValue((int)_cm->getNumberOfSons());
+ ret->fillWithValue(ToIdType(_cm->getNumberOfSons()));
return ret.retn();
}
-DataArrayInt *MEDCoupling1SGTUMesh::computeEffectiveNbOfNodesPerCell() const
+DataArrayIdType *MEDCoupling1SGTUMesh::computeEffectiveNbOfNodesPerCell() const
{
checkNonDynamicGeoType();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- int nbCells(getNumberOfCells());
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ mcIdType nbCells=getNumberOfCells();
ret->alloc(nbCells,1);
- int *retPtr(ret->getPointer());
- int nbNodesPerCell(getNumberOfNodesPerCell());
- const int *conn(_conn->begin());
- for(int i=0;i<nbCells;i++,conn+=nbNodesPerCell,retPtr++)
+ mcIdType *retPtr(ret->getPointer());
+ mcIdType nbNodesPerCell(getNumberOfNodesPerCell());
+ const mcIdType *conn(_conn->begin());
+ for(mcIdType i=0;i<nbCells;i++,conn+=nbNodesPerCell,retPtr++)
{
- std::set<int> s(conn,conn+nbNodesPerCell);
- *retPtr=(int)s.size();
+ std::set<mcIdType> s(conn,conn+nbNodesPerCell);
+ *retPtr=ToIdType(s.size());
}
return ret.retn();
}
-void MEDCoupling1SGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const
+void MEDCoupling1SGTUMesh::getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const
{
- int sz=getNumberOfNodesPerCell();
+ mcIdType sz=getNumberOfNodesPerCell();
conn.resize(sz);
if(cellId<getNumberOfCells())
std::copy(_conn->begin()+cellId*sz,_conn->begin()+(cellId+1)*sz,conn.begin());
else
ret << msg0 << "\n";
ret << "Number of cells : ";
- if((const DataArrayInt *)_conn)
+ if((const DataArrayIdType *)_conn)
{
if(_conn->isAllocated())
{
ret << "No array set !\n";
ret << "\n\nConnectivity array : \n____________________\n\n";
//
- if((const DataArrayInt *)_conn)
+ if((const DataArrayIdType *)_conn)
{
if(_conn->isAllocated())
{
if(_conn->getNumberOfComponents()==1)
{
- int nbOfCells=getNumberOfCells();
- int sz=getNumberOfNodesPerCell();
- const int *connPtr=_conn->begin();
- for(int i=0;i<nbOfCells;i++,connPtr+=sz)
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType sz=getNumberOfNodesPerCell();
+ const mcIdType *connPtr=_conn->begin();
+ for(mcIdType i=0;i<nbOfCells;i++,connPtr+=sz)
{
ret << "Cell #" << i << " : ";
- std::copy(connPtr,connPtr+sz,std::ostream_iterator<int>(ret," "));
+ std::copy(connPtr,connPtr+sz,std::ostream_iterator<mcIdType>(ret," "));
ret << "\n";
}
}
{
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
- int nbOfCells=getNumberOfCells();//checkConsistencyLight()
- int nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfCells=getNumberOfCells();//checkConsistencyLight()
+ mcIdType nbOfNodes=getNumberOfNodes();
ret->alloc(nbOfCells,spaceDim);
double *ptToFill=ret->getPointer();
const double *coor=_coords->begin();
- const int *nodal=_conn->begin();
- int sz=getNumberOfNodesPerCell();
- double coeff=1./(double)sz;
- for(int i=0;i<nbOfCells;i++,ptToFill+=spaceDim)
+ const mcIdType *nodal=_conn->begin();
+ mcIdType sz=getNumberOfNodesPerCell();
+ double coeff=1./FromIdType<double>(sz);
+ for(mcIdType i=0;i<nbOfCells;i++,ptToFill+=spaceDim)
{
std::fill(ptToFill,ptToFill+spaceDim,0.);
- for(int j=0;j<sz;j++,nodal++)
+ for(mcIdType j=0;j<sz;j++,nodal++)
if(*nodal>=0 && *nodal<nbOfNodes)
std::transform(coor+spaceDim*nodal[0],coor+spaceDim*(nodal[0]+1),ptToFill,ptToFill,std::plus<double>());
else
return ret.retn();
}
-void MEDCoupling1SGTUMesh::renumberCells(const int *old2NewBg, bool check)
+void MEDCoupling1SGTUMesh::renumberCells(const mcIdType *old2NewBg, bool check)
{
- int nbCells=getNumberOfCells();
- MCAuto<DataArrayInt> o2n=DataArrayInt::New();
+ mcIdType nbCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> o2n=DataArrayIdType::New();
o2n->useArray(old2NewBg,false,DeallocType::C_DEALLOC,nbCells,1);
if(check)
o2n=o2n->checkAndPreparePermutation();
//
- const int *conn=_conn->begin();
- MCAuto<DataArrayInt> n2o=o2n->invertArrayO2N2N2O(nbCells);
- const int *n2oPtr=n2o->begin();
- MCAuto<DataArrayInt> newConn=DataArrayInt::New();
+ const mcIdType *conn=_conn->begin();
+ MCAuto<DataArrayIdType> n2o=o2n->invertArrayO2N2N2O(nbCells);
+ const mcIdType *n2oPtr=n2o->begin();
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New();
newConn->alloc(_conn->getNumberOfTuples(),1);
newConn->copyStringInfoFrom(*_conn);
- int sz=getNumberOfNodesPerCell();
+ mcIdType sz=getNumberOfNodesPerCell();
//
- int *newC=newConn->getPointer();
- for(int i=0;i<nbCells;i++,newC+=sz)
+ mcIdType *newC=newConn->getPointer();
+ for(mcIdType i=0;i<nbCells;i++,newC+=sz)
{
- int pos=n2oPtr[i];
+ mcIdType pos=n2oPtr[i];
std::copy(conn+pos*sz,conn+(pos+1)*sz,newC);
}
_conn=newConn;
* \param [in] fullyIn input that specifies if all node ids must be in [\a begin,\a end) array to consider cell to be in.
* \param [in,out] cellIdsKeptArr array where all candidate cell ids are put at the end.
*/
-void MEDCoupling1SGTUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const
+void MEDCoupling1SGTUMesh::fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const
{
- int nbOfCells=getNumberOfCells();
- MCAuto<DataArrayInt> cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1);
- int tmp=-1;
- int sz=_conn->getMaxValue(tmp); sz=std::max(sz,0)+1;
+ mcIdType nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> cellIdsKept=DataArrayIdType::New(); cellIdsKept->alloc(0,1);
+ mcIdType tmp=-1;
+ mcIdType sz=_conn->getMaxValue(tmp); sz=std::max(sz,ToIdType(0))+1;
std::vector<bool> fastFinder(sz,false);
- for(const int *work=begin;work!=end;work++)
+ for(const mcIdType *work=begin;work!=end;work++)
if(*work>=0 && *work<sz)
fastFinder[*work]=true;
- const int *conn=_conn->begin();
- int nbNodesPerCell=getNumberOfNodesPerCell();
- for(int i=0;i<nbOfCells;i++,conn+=nbNodesPerCell)
+ const mcIdType *conn=_conn->begin();
+ mcIdType nbNodesPerCell=getNumberOfNodesPerCell();
+ for(mcIdType i=0;i<nbOfCells;i++,conn+=nbNodesPerCell)
{
int ref=0,nbOfHit=0;
- for(int j=0;j<nbNodesPerCell;j++)
+ for(mcIdType j=0;j<nbNodesPerCell;j++)
if(conn[j]>=0)
{
ref++;
{
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),getMeshDimension());
ret->setCoords(getCoords());
- const int *nodalConn=_conn->begin();
- int nbCells=getNumberOfCells();
- int nbNodesPerCell=getNumberOfNodesPerCell();
- int geoType=(int)getCellModelEnum();
- MCAuto<DataArrayInt> c=DataArrayInt::New(); c->alloc(nbCells*(nbNodesPerCell+1),1);
- int *cPtr=c->getPointer();
- for(int i=0;i<nbCells;i++,nodalConn+=nbNodesPerCell)
+ const mcIdType *nodalConn=_conn->begin();
+ mcIdType nbCells=getNumberOfCells();
+ mcIdType nbNodesPerCell=getNumberOfNodesPerCell();
+ mcIdType geoType=ToIdType(getCellModelEnum());
+ MCAuto<DataArrayIdType> c=DataArrayIdType::New(); c->alloc(nbCells*(nbNodesPerCell+1),1);
+ mcIdType *cPtr=c->getPointer();
+ for(mcIdType i=0;i<nbCells;i++,nodalConn+=nbNodesPerCell)
{
*cPtr++=geoType;
cPtr=std::copy(nodalConn,nodalConn+nbNodesPerCell,cPtr);
}
- MCAuto<DataArrayInt> cI=DataArrayInt::Range(0,(nbCells+1)*(nbNodesPerCell+1),nbNodesPerCell+1);
+ MCAuto<DataArrayIdType> cI=DataArrayIdType::Range(0,(nbCells+1)*(nbNodesPerCell+1),nbNodesPerCell+1);
ret->setConnectivity(c,cI,true);
try
{ ret->copyTinyInfoFrom(this); }
return ret.retn();
}
-DataArrayInt *MEDCoupling1SGTUMesh::simplexize(int policy)
+DataArrayIdType *MEDCoupling1SGTUMesh::simplexize(int policy)
{
switch(policy)
{
return simplexizePol0();
case 1:
return simplexizePol1();
- case (int) INTERP_KERNEL::PLANAR_FACE_5:
+ case INTERP_KERNEL::PLANAR_FACE_5:
return simplexizePlanarFace5();
- case (int) INTERP_KERNEL::PLANAR_FACE_6:
+ case INTERP_KERNEL::PLANAR_FACE_6:
return simplexizePlanarFace6();
default:
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::simplexize : unrecognized policy ! Must be :\n - 0 or 1 (only available for meshdim=2) \n - PLANAR_FACE_5, PLANAR_FACE_6 (only for meshdim=3)");
struct MEDCouplingAccVisit
{
MEDCouplingAccVisit():_new_nb_of_nodes(0) { }
- int operator()(int val) { if(val!=-1) return _new_nb_of_nodes++; else return -1; }
- int _new_nb_of_nodes;
+ mcIdType operator()(mcIdType val) { if(val!=-1) return _new_nb_of_nodes++; else return -1; }
+ mcIdType _new_nb_of_nodes;
};
/// @endcond
/*!
* This method returns all node ids used in \b this. The data array returned has to be dealt by the caller.
* The returned node ids are sortes ascendingly. This method is closed to MEDCoupling1SGTUMesh::getNodeIdsInUse except
- * the format of returned DataArrayInt instance.
+ * the format of returned DataArrayIdType instance.
*
- * \return a newly allocated DataArrayInt sorted ascendingly of fetched node ids.
+ * \return a newly allocated DataArrayIdType sorted ascendingly of fetched node ids.
* \sa MEDCoupling1SGTUMesh::getNodeIdsInUse, areAllNodesFetched
*/
-DataArrayInt *MEDCoupling1SGTUMesh::computeFetchedNodeIds() const
+DataArrayIdType *MEDCoupling1SGTUMesh::computeFetchedNodeIds() const
{
checkConsistencyOfConnectivity();
- int nbNodes(getNumberOfNodes());
+ mcIdType nbNodes(getNumberOfNodes());
std::vector<bool> fetchedNodes(nbNodes,false);
computeNodeIdsAlg(fetchedNodes);
- int sz((int)std::count(fetchedNodes.begin(),fetchedNodes.end(),true));
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
- int *retPtr(ret->getPointer());
- for(int i=0;i<nbNodes;i++)
+ mcIdType sz(ToIdType(std::count(fetchedNodes.begin(),fetchedNodes.end(),true)));
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(sz,1);
+ mcIdType *retPtr(ret->getPointer());
+ for(mcIdType i=0;i<nbNodes;i++)
if(fetchedNodes[i])
*retPtr++=i;
return ret.retn();
* by excluding the unused nodes, for which the array holds -1. The result array is
* a mapping in "Old to New" mode.
* \param [out] nbrOfNodesInUse - number of node ids present in the nodal connectivity.
- * \return DataArrayInt * - a new instance of DataArrayInt. Its length is \a
+ * \return DataArrayIdType * - a new instance of DataArrayIdType. Its length is \a
* this->getNumberOfNodes(). It holds for each node of \a this mesh either -1
* if the node is unused or a new id else. The caller is to delete this
* array using decrRef() as it is no more needed.
* \throw If the nodal connectivity includes an invalid id.
* \sa MEDCoupling1SGTUMesh::computeFetchedNodeIds, areAllNodesFetched
*/
-DataArrayInt *MEDCoupling1SGTUMesh::getNodeIdsInUse(int& nbrOfNodesInUse) const
+DataArrayIdType *MEDCoupling1SGTUMesh::getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const
{
nbrOfNodesInUse=-1;
- int nbOfNodes=getNumberOfNodes();
- int nbOfCells=getNumberOfCells();
- MCAuto<DataArrayInt> ret(DataArrayInt::New());
+ mcIdType nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
ret->alloc(nbOfNodes,1);
- int *traducer=ret->getPointer();
+ mcIdType *traducer=ret->getPointer();
std::fill(traducer,traducer+nbOfNodes,-1);
- const int *conn=_conn->begin();
- int nbNodesPerCell=getNumberOfNodesPerCell();
- for(int i=0;i<nbOfCells;i++)
+ const mcIdType *conn=_conn->begin();
+ mcIdType nbNodesPerCell=getNumberOfNodesPerCell();
+ for(mcIdType i=0;i<nbOfCells;i++)
for(int j=0;j<nbNodesPerCell;j++,conn++)
if(*conn>=0 && *conn<nbOfNodes)
traducer[*conn]=1;
std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::getNodeIdsInUse : In cell #" << i << " presence of node id " << conn[j] << " not in [0," << nbOfNodes << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- nbrOfNodesInUse=(int)std::count(traducer,traducer+nbOfNodes,1);
+ nbrOfNodesInUse=ToIdType(std::count(traducer,traducer+nbOfNodes,1));
std::transform(traducer,traducer+nbOfNodes,traducer,MEDCouplingAccVisit());
return ret.retn();
}
*
* \sa renumberNodesInConn
*/
-void MEDCoupling1SGTUMesh::renumberNodesWithOffsetInConn(int offset)
+void MEDCoupling1SGTUMesh::renumberNodesWithOffsetInConn(mcIdType offset)
{
getNumberOfCells();//only to check that all is well defined.
_conn->applyLin(1,offset);
}
/*!
- * Same than renumberNodesInConn(const int *) except that here the format of old-to-new traducer is using map instead
+ * Same than renumberNodesInConn(const mcIdType *) except that here the format of old-to-new traducer is using map instead
* of array. This method is dedicated for renumbering from a big set of nodes the a tiny set of nodes which is the case during extraction
* of a big mesh.
*/
-void MEDCoupling1SGTUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap<int,int>& newNodeNumbersO2N)
+void MEDCoupling1SGTUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap<mcIdType,mcIdType>& newNodeNumbersO2N)
{
- this->renumberNodesInConnT< INTERP_KERNEL::HashMap<int,int> >(newNodeNumbersO2N);
+ this->renumberNodesInConnT< INTERP_KERNEL::HashMap<mcIdType,mcIdType> >(newNodeNumbersO2N);
}
/*!
- * Same than renumberNodesInConn(const int *) except that here the format of old-to-new traducer is using map instead
+ * Same than renumberNodesInConn(const mcIdType *) except that here the format of old-to-new traducer is using map instead
* of array. This method is dedicated for renumbering from a big set of nodes the a tiny set of nodes which is the case during extraction
* of a big mesh.
*/
-void MEDCoupling1SGTUMesh::renumberNodesInConn(const std::map<int,int>& newNodeNumbersO2N)
+void MEDCoupling1SGTUMesh::renumberNodesInConn(const std::map<mcIdType,mcIdType>& newNodeNumbersO2N)
{
- this->renumberNodesInConnT< std::map<int,int> >(newNodeNumbersO2N);
+ this->renumberNodesInConnT< std::map<mcIdType,mcIdType> >(newNodeNumbersO2N);
}
/*!
* See \ref numbering for more info on renumbering modes.
* \throw If the nodal connectivity of cells is not defined.
*/
-void MEDCoupling1SGTUMesh::renumberNodesInConn(const int *newNodeNumbersO2N)
+void MEDCoupling1SGTUMesh::renumberNodesInConn(const mcIdType *newNodeNumbersO2N)
{
getNumberOfCells();//only to check that all is well defined.
_conn->transformWithIndArr(newNodeNumbersO2N,newNodeNumbersO2N+getNumberOfNodes());
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshes : all items must have the same geo type !");
std::vector< MCAuto<MEDCoupling1SGTUMesh> > bb(sz);
std::vector< const MEDCoupling1SGTUMesh * > aa(sz);
- int spaceDim=-3;
- for(std::size_t i=0;i<sz && spaceDim==-3;i++)
+ std::size_t spaceDimUndef=-3, spaceDim=spaceDimUndef;
+ for(std::size_t i=0;i<sz && spaceDim==spaceDimUndef;i++)
{
const MEDCoupling1SGTUMesh *cur=a[i];
const DataArrayDouble *coo=cur->getCoords();
if(coo)
spaceDim=coo->getNumberOfComponents();
}
- if(spaceDim==-3)
+ if(spaceDim==spaceDimUndef)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshes : no spaceDim specified ! unable to perform merge !");
for(std::size_t i=0;i<sz;i++)
{
std::vector<const MEDCoupling1SGTUMesh *>::const_iterator it=a.begin();
if(!(*it))
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords : null instance in the first element of input vector !");
- std::vector<const DataArrayInt *> ncs(a.size());
+ std::vector<const DataArrayIdType *> ncs(a.size());
(*it)->getNumberOfCells();//to check that all is OK
const DataArrayDouble *coords=(*it)->getCoords();
const INTERP_KERNEL::CellModel *cm=&((*it)->getCellModel());
}
MCAuto<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh("merge",*cm));
ret->setCoords(coords);
- ret->_conn=DataArrayInt::Aggregate(ncs);
+ ret->_conn=DataArrayIdType::Aggregate(ncs);
return ret.retn();
}
if(a.empty())
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshes : input array must be NON EMPTY !");
std::vector<const MEDCoupling1SGTUMesh *>::const_iterator it=a.begin();
- int nbOfCells=(*it)->getNumberOfCells();
+ mcIdType nbOfCells=(*it)->getNumberOfCells();
const INTERP_KERNEL::CellModel *cm=&((*it)->getCellModel());
- int nbNodesPerCell=(*it)->getNumberOfNodesPerCell();
+ mcIdType nbNodesPerCell=(*it)->getNumberOfNodesPerCell();
it++;
for(;it!=a.end();it++)
{
MCAuto<DataArrayDouble> pts=MergeNodesArray(aps);
MCAuto<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh("merge",*cm));
ret->setCoords(pts);
- MCAuto<DataArrayInt> c=DataArrayInt::New();
+ MCAuto<DataArrayIdType> c=DataArrayIdType::New();
c->alloc(nbOfCells*nbNodesPerCell,1);
- int *cPtr=c->getPointer();
- int offset=0;
+ mcIdType *cPtr=c->getPointer();
+ mcIdType offset=0;
for(it=a.begin();it!=a.end();it++)
{
- int curConnLgth=(*it)->getNodalConnectivityLength();
- const int *curC=(*it)->_conn->begin();
- cPtr=std::transform(curC,curC+curConnLgth,cPtr,std::bind2nd(std::plus<int>(),offset));
+ mcIdType curConnLgth=(*it)->getNodalConnectivityLength();
+ const mcIdType *curC=(*it)->_conn->begin();
+ cPtr=std::transform(curC,curC+curConnLgth,cPtr,std::bind2nd(std::plus<mcIdType>(),offset));
offset+=(*it)->getNumberOfNodes();
}
//
return ret.retn();
}
-MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const
+MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const
{
- int ncell=getNumberOfCells();
+ mcIdType ncell=getNumberOfCells();
MCAuto<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
ret->setCoords(_coords);
std::size_t nbOfElemsRet=std::distance(begin,end);
- const int *inConn=_conn->getConstPointer();
- int sz=getNumberOfNodesPerCell();
- MCAuto<DataArrayInt> connRet=DataArrayInt::New(); connRet->alloc((int)nbOfElemsRet*sz,1);
- int *connPtr=connRet->getPointer();
- for(const int *work=begin;work!=end;work++,connPtr+=sz)
+ const mcIdType *inConn=_conn->getConstPointer();
+ mcIdType sz=getNumberOfNodesPerCell();
+ MCAuto<DataArrayIdType> connRet=DataArrayIdType::New(); connRet->alloc(nbOfElemsRet*sz,1);
+ mcIdType *connPtr=connRet->getPointer();
+ for(const mcIdType *work=begin;work!=end;work++,connPtr+=sz)
{
if(*work>=0 && *work<ncell)
std::copy(inConn+(work[0])*sz,inConn+(work[0]+1)*sz,connPtr);
return ret.retn();
}
-MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const
+MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
{
- int ncell=getNumberOfCells();
- int nbOfElemsRet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice : ");
+ mcIdType ncell=getNumberOfCells();
+ mcIdType nbOfElemsRet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice : ");
MCAuto<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
ret->setCoords(_coords);
- const int *inConn=_conn->getConstPointer();
- int sz=getNumberOfNodesPerCell();
- MCAuto<DataArrayInt> connRet=DataArrayInt::New(); connRet->alloc((int)nbOfElemsRet*sz,1);
- int *connPtr=connRet->getPointer();
- int curId=start;
- for(int i=0;i<nbOfElemsRet;i++,connPtr+=sz,curId+=step)
+ const mcIdType *inConn=_conn->getConstPointer();
+ mcIdType sz=getNumberOfNodesPerCell();
+ MCAuto<DataArrayIdType> connRet=DataArrayIdType::New(); connRet->alloc(nbOfElemsRet*sz,1);
+ mcIdType *connPtr=connRet->getPointer();
+ mcIdType curId=start;
+ for(mcIdType i=0;i<nbOfElemsRet;i++,connPtr+=sz,curId+=step)
{
if(curId>=0 && curId<ncell)
std::copy(inConn+curId*sz,inConn+(curId+1)*sz,connPtr);
void MEDCoupling1SGTUMesh::computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const
{
- int sz((int)nodeIdsInUse.size());
- for(const int *conn=_conn->begin();conn!=_conn->end();conn++)
+ mcIdType sz(ToIdType(nodeIdsInUse.size()));
+ for(const mcIdType *conn=_conn->begin();conn!=_conn->end();conn++)
{
if(*conn>=0 && *conn<sz)
nodeIdsInUse[*conn]=true;
}
}
-MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(int spaceDim) const
+MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(std::size_t spaceDim) const
{
MCAuto<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
- MCAuto<DataArrayInt> tmp1;
- const DataArrayInt *nodalConn(_conn);
+ MCAuto<DataArrayIdType> tmp1;
+ const DataArrayIdType *nodalConn(_conn);
if(!nodalConn)
{
- tmp1=DataArrayInt::New(); tmp1->alloc(0,1);
+ tmp1=DataArrayIdType::New(); tmp1->alloc(0,1);
}
else
tmp1=_conn;
return ret.retn();
}
-DataArrayInt *MEDCoupling1SGTUMesh::simplexizePol0()
+DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePol0()
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(getCellModelEnum()!=INTERP_KERNEL::NORM_QUAD4)
- return DataArrayInt::Range(0,nbOfCells,1);
- MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1);
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(2*nbOfCells,1);
- const int *c(_conn->begin());
- int *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer());
- for(int i=0;i<nbOfCells;i++,c+=4,newConnPtr+=6,retPtr+=2)
+ return DataArrayIdType::Range(0,nbOfCells,1);
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(2*3*nbOfCells,1);
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(2*nbOfCells,1);
+ const mcIdType *c(_conn->begin());
+ mcIdType *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer());
+ for(mcIdType i=0;i<nbOfCells;i++,c+=4,newConnPtr+=6,retPtr+=2)
{
newConnPtr[0]=c[0]; newConnPtr[1]=c[1]; newConnPtr[2]=c[2];
newConnPtr[3]=c[0]; newConnPtr[4]=c[2]; newConnPtr[5]=c[3];
return ret.retn();
}
-DataArrayInt *MEDCoupling1SGTUMesh::simplexizePol1()
+DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePol1()
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(getCellModelEnum()!=INTERP_KERNEL::NORM_QUAD4)
- return DataArrayInt::Range(0,nbOfCells,1);
- MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1);
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(2*nbOfCells,1);
- const int *c(_conn->begin());
- int *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer());
- for(int i=0;i<nbOfCells;i++,c+=4,newConnPtr+=6,retPtr+=2)
+ return DataArrayIdType::Range(0,nbOfCells,1);
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(2*3*nbOfCells,1);
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(2*nbOfCells,1);
+ const mcIdType *c(_conn->begin());
+ mcIdType *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer());
+ for(mcIdType i=0;i<nbOfCells;i++,c+=4,newConnPtr+=6,retPtr+=2)
{
newConnPtr[0]=c[0]; newConnPtr[1]=c[1]; newConnPtr[2]=c[3];
newConnPtr[3]=c[1]; newConnPtr[4]=c[2]; newConnPtr[5]=c[3];
return ret.retn();
}
-DataArrayInt *MEDCoupling1SGTUMesh::simplexizePlanarFace5()
+DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePlanarFace5()
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA8)
- return DataArrayInt::Range(0,nbOfCells,1);
- MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(5*4*nbOfCells,1);
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(5*nbOfCells,1);
- const int *c(_conn->begin());
- int *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer());
- for(int i=0;i<nbOfCells;i++,c+=8,newConnPtr+=20,retPtr+=5)
+ return DataArrayIdType::Range(0,nbOfCells,1);
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(5*4*nbOfCells,1);
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(5*nbOfCells,1);
+ const mcIdType *c(_conn->begin());
+ mcIdType *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer());
+ for(mcIdType i=0;i<nbOfCells;i++,c+=8,newConnPtr+=20,retPtr+=5)
{
for(int j=0;j<20;j++)
newConnPtr[j]=c[INTERP_KERNEL::SPLIT_NODES_5_WO[j]];
return ret.retn();
}
-DataArrayInt *MEDCoupling1SGTUMesh::simplexizePlanarFace6()
+DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePlanarFace6()
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA8)
- return DataArrayInt::Range(0,nbOfCells,1);
- MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(6*4*nbOfCells,1);
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(6*nbOfCells,1);
- const int *c(_conn->begin());
- int *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer());
- for(int i=0;i<nbOfCells;i++,c+=8,newConnPtr+=24,retPtr+=6)
+ return DataArrayIdType::Range(0,nbOfCells,1);
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(6*4*nbOfCells,1);
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(6*nbOfCells,1);
+ const mcIdType *c(_conn->begin());
+ mcIdType *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer());
+ for(mcIdType i=0;i<nbOfCells;i++,c+=8,newConnPtr+=24,retPtr+=6)
{
for(int j=0;j<24;j++)
newConnPtr[j]=c[INTERP_KERNEL::SPLIT_NODES_6_WO[j]];
{ stream << " Coordinates set but not allocated !"; return ; }
stream << " Space dimension : " << _coords->getNumberOfComponents() << "." << std::endl;
stream << "Number of nodes : " << _coords->getNumberOfTuples() << ".";
- if(!(const DataArrayInt *)_conn)
+ if(!(const DataArrayIdType *)_conn)
{ stream << std::endl << "Nodal connectivity NOT set !"; return ; }
if(_conn->isAllocated())
{
void MEDCoupling1SGTUMesh::checkFullyDefined() const
{
- if(!((const DataArrayInt *)_conn) || !((const DataArrayDouble *)_coords))
+ if(!((const DataArrayIdType *)_conn) || !((const DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::checkFullyDefined : part of this is not fully defined.");
}
/*!
* First step of unserialization process.
*/
-bool MEDCoupling1SGTUMesh::isEmptyMesh(const std::vector<int>& tinyInfo) const
+bool MEDCoupling1SGTUMesh::isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const
{
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::isEmptyMesh : not implemented yet !");
}
-void MEDCoupling1SGTUMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+void MEDCoupling1SGTUMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
{
int it,order;
double time=getTime(it,order);
std::vector<std::string> littleStrings2,littleStrings3;
if((const DataArrayDouble *)_coords)
_coords->getTinySerializationStrInformation(littleStrings2);
- if((const DataArrayInt *)_conn)
+ if((const DataArrayIdType *)_conn)
_conn->getTinySerializationStrInformation(littleStrings3);
- int sz0((int)littleStrings2.size()),sz1((int)littleStrings3.size());
+ mcIdType sz0(ToIdType(littleStrings2.size())),sz1(ToIdType(littleStrings3.size()));
littleStrings.insert(littleStrings.end(),littleStrings2.begin(),littleStrings2.end());
littleStrings.insert(littleStrings.end(),littleStrings3.begin(),littleStrings3.end());
//
tinyInfo.push_back(getCellModelEnum());
tinyInfo.push_back(it);
tinyInfo.push_back(order);
- std::vector<int> tinyInfo2,tinyInfo3;
+ std::vector<mcIdType> tinyInfo2,tinyInfo3;
if((const DataArrayDouble *)_coords)
_coords->getTinySerializationIntInformation(tinyInfo2);
- if((const DataArrayInt *)_conn)
+ if((const DataArrayIdType *)_conn)
_conn->getTinySerializationIntInformation(tinyInfo3);
- int sz2((int)tinyInfo2.size()),sz3((int)tinyInfo3.size());
+ mcIdType sz2(ToIdType(tinyInfo2.size())),sz3(ToIdType(tinyInfo3.size()));
tinyInfo.push_back(sz0); tinyInfo.push_back(sz1); tinyInfo.push_back(sz2); tinyInfo.push_back(sz3);
tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end());
tinyInfo.insert(tinyInfo.end(),tinyInfo3.begin(),tinyInfo3.end());
tinyInfoD.push_back(time);
}
-void MEDCoupling1SGTUMesh::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
+void MEDCoupling1SGTUMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
- std::vector<int> tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+tinyInfo[5]);
- std::vector<int> tinyInfo1(tinyInfo.begin()+7+tinyInfo[5],tinyInfo.begin()+7+tinyInfo[5]+tinyInfo[6]);
+ std::vector<mcIdType> tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+tinyInfo[5]);
+ std::vector<mcIdType> tinyInfo1(tinyInfo.begin()+7+tinyInfo[5],tinyInfo.begin()+7+tinyInfo[5]+tinyInfo[6]);
a1->resizeForUnserialization(tinyInfo1);
a2->resizeForUnserialization(tinyInfo2);
}
-void MEDCoupling1SGTUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
+void MEDCoupling1SGTUMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const
{
- int sz(0);
- if((const DataArrayInt *)_conn)
+ mcIdType sz(0);
+ if((const DataArrayIdType *)_conn)
if(_conn->isAllocated())
sz=_conn->getNbOfElems();
- a1=DataArrayInt::New();
+ a1=DataArrayIdType::New();
a1->alloc(sz,1);
- if(sz!=0 && (const DataArrayInt *)_conn)
+ if(sz!=0 && (const DataArrayIdType *)_conn)
std::copy(_conn->begin(),_conn->end(),a1->getPointer());
sz=0;
if((const DataArrayDouble *)_coords)
std::copy(_coords->begin(),_coords->end(),a2->getPointer());
}
-void MEDCoupling1SGTUMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+void MEDCoupling1SGTUMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings)
{
INTERP_KERNEL::NormalizedCellType gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]);
setName(littleStrings[0]);
setDescription(littleStrings[1]);
setTimeUnit(littleStrings[2]);
- setTime(tinyInfoD[0],tinyInfo[1],tinyInfo[2]);
- int sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]);
+ setTime(tinyInfoD[0],FromIdType<int>(tinyInfo[1]),FromIdType<int>(tinyInfo[2]));
+ mcIdType sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]);
//
_coords=DataArrayDouble::New();
- std::vector<int> tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+sz2);
+ std::vector<mcIdType> tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+sz2);
_coords->resizeForUnserialization(tinyInfo2);
std::copy(a2->begin(),a2->end(),_coords->getPointer());
- _conn=DataArrayInt::New();
- std::vector<int> tinyInfo3(tinyInfo.begin()+7+sz2,tinyInfo.begin()+7+sz2+sz3);
+ _conn=DataArrayIdType::New();
+ std::vector<mcIdType> tinyInfo3(tinyInfo.begin()+7+sz2,tinyInfo.begin()+7+sz2+sz3);
_conn->resizeForUnserialization(tinyInfo3);
std::copy(a1->begin(),a1->end(),_conn->getPointer());
std::vector<std::string> littleStrings2(littleStrings.begin()+3,littleStrings.begin()+3+sz0);
const MEDCoupling1SGTUMesh *otherC=dynamic_cast<const MEDCoupling1SGTUMesh *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::checkFastEquivalWith : Two meshes are not unstructured with single static geometric type !");
- const DataArrayInt *c1(_conn),*c2(otherC->_conn);
+ const DataArrayIdType *c1(_conn),*c2(otherC->_conn);
if(c1==c2)
return;
if(!c1 || !c2)
return Merge1SGTUMeshesOnSameCoords(ms);
}
-void MEDCoupling1SGTUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const
+void MEDCoupling1SGTUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const
{
checkFullyDefined();
- int nbOfNodes=getNumberOfNodes();
- int *revNodalIndxPtr=(int *)malloc((nbOfNodes+1)*sizeof(int));
+ mcIdType nbOfNodes=getNumberOfNodes();
+ mcIdType *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType));
revNodalIndx->useArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1);
std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0);
- const int *conn=_conn->begin();
- int nbOfCells=getNumberOfCells();
- int nbOfEltsInRevNodal=0;
- int nbOfNodesPerCell=getNumberOfNodesPerCell();
- for(int eltId=0;eltId<nbOfCells;eltId++)
+ const mcIdType *conn=_conn->begin();
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType nbOfEltsInRevNodal=0;
+ mcIdType nbOfNodesPerCell=getNumberOfNodesPerCell();
+ for(mcIdType eltId=0;eltId<nbOfCells;eltId++)
{
for(int j=0;j<nbOfNodesPerCell;j++,conn++)
{
}
}
}
- std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus<int>());
+ std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus<mcIdType>());
conn=_conn->begin();
- int *revNodalPtr=(int *)malloc((nbOfEltsInRevNodal)*sizeof(int));
+ mcIdType *revNodalPtr=(mcIdType *)malloc(nbOfEltsInRevNodal*sizeof(mcIdType));
revNodal->useArray(revNodalPtr,true,DeallocType::C_DEALLOC,nbOfEltsInRevNodal,1);
std::fill(revNodalPtr,revNodalPtr+nbOfEltsInRevNodal,-1);
- for(int eltId=0;eltId<nbOfCells;eltId++)
+ for(mcIdType eltId=0;eltId<nbOfCells;eltId++)
{
for(int j=0;j<nbOfNodesPerCell;j++,conn++)
{
- *std::find_if(revNodalPtr+revNodalIndxPtr[*conn],revNodalPtr+revNodalIndxPtr[*conn+1],std::bind2nd(std::equal_to<int>(),-1))=eltId;
+ *std::find_if(revNodalPtr+revNodalIndxPtr[*conn],revNodalPtr+revNodalIndxPtr[*conn+1],std::bind2nd(std::equal_to<mcIdType>(),-1))=eltId;
}
}
}
/*!
* Use \a nodalConn array as nodal connectivity of \a this. The input \a nodalConn pointer can be null.
*/
-void MEDCoupling1SGTUMesh::setNodalConnectivity(DataArrayInt *nodalConn)
+void MEDCoupling1SGTUMesh::setNodalConnectivity(DataArrayIdType *nodalConn)
{
if(nodalConn)
nodalConn->incrRef();
}
/*!
- * \return DataArrayInt * - the internal reference to the nodal connectivity. The caller is not responsible to deallocate it.
+ * \return DataArrayIdType * - the internal reference to the nodal connectivity. The caller is not responsible to deallocate it.
*/
-DataArrayInt *MEDCoupling1SGTUMesh::getNodalConnectivity() const
+DataArrayIdType *MEDCoupling1SGTUMesh::getNodalConnectivity() const
{
- const DataArrayInt *ret(_conn);
- return const_cast<DataArrayInt *>(ret);
+ const DataArrayIdType *ret(_conn);
+ return const_cast<DataArrayIdType *>(ret);
}
/*!
*
* \param [in] nbOfCells - estimation of the number of cell \a this mesh will contain.
*/
-void MEDCoupling1SGTUMesh::allocateCells(int nbOfCells)
+void MEDCoupling1SGTUMesh::allocateCells(mcIdType nbOfCells)
{
if(nbOfCells<0)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::allocateCells : the input number of cells should be >= 0 !");
- _conn=DataArrayInt::New();
+ _conn=DataArrayIdType::New();
_conn->reserve(getNumberOfNodesPerCell()*nbOfCells);
declareAsNew();
}
* attached to \a this.
* \throw If the nodal connectivity array in \a this is null (call MEDCoupling1SGTUMesh::allocateCells before).
*/
-void MEDCoupling1SGTUMesh::insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd)
+void MEDCoupling1SGTUMesh::insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd)
{
- int sz=(int)std::distance(nodalConnOfCellBg,nodalConnOfCellEnd);
- int ref=getNumberOfNodesPerCell();
+ mcIdType sz=ToIdType(std::distance(nodalConnOfCellBg,nodalConnOfCellEnd));
+ mcIdType ref=getNumberOfNodesPerCell();
if(sz==ref)
{
- DataArrayInt *c(_conn);
+ DataArrayIdType *c(_conn);
if(c)
c->pushBackValsSilent(nodalConnOfCellBg,nodalConnOfCellEnd);
else
const INTERP_KERNEL::CellModel& cm(getCellModel());
if(cm.getEnum()!=INTERP_KERNEL::NORM_HEXA8)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4 : this method can be applied only on HEXA8 mesh !");
- int nbHexa8(getNumberOfCells());
- const int *inConnPtr(getNodalConnectivity()->begin());
+ mcIdType nbHexa8=getNumberOfCells();
+ const mcIdType *inConnPtr(getNodalConnectivity()->begin());
MCAuto<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_QUAD4));
- MCAuto<DataArrayInt> c(DataArrayInt::New()); c->alloc(nbHexa8*6*4,1);
- int *cPtr(c->getPointer());
- for(int i=0;i<nbHexa8;i++,inConnPtr+=8)
+ MCAuto<DataArrayIdType> c(DataArrayIdType::New()); c->alloc(nbHexa8*6*4,1);
+ mcIdType *cPtr(c->getPointer());
+ for(mcIdType i=0;i<nbHexa8;i++,inConnPtr+=8)
{
for(int j=0;j<6;j++,cPtr+=4)
cm.fillSonCellNodalConnectivity(j,inConnPtr,cPtr);
* \param [out] nodePerm the permutation array of size \c this->getNumberOfNodes()
* \return MEDCouplingCMesh * - a newly allocated mesh that is the result of the structurization of \a this.
*/
-MEDCouplingCMesh *MEDCoupling1SGTUMesh::structurizeMe(DataArrayInt *& cellPerm, DataArrayInt *& nodePerm, double eps) const
+MEDCouplingCMesh *MEDCoupling1SGTUMesh::structurizeMe(DataArrayIdType *& cellPerm, DataArrayIdType *& nodePerm, double eps) const
{
checkConsistencyLight();
- int spaceDim(getSpaceDimension()),meshDim(getMeshDimension()),nbNodes(getNumberOfNodes());
+ int spaceDim(getSpaceDimension()),meshDim(getMeshDimension()); mcIdType nbNodes(getNumberOfNodes());
if(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(meshDim)!=getCellModelEnum())
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::structurizeMe : the unique geo type in this is not compatible with the geometric type regarding mesh dimension !");
MCAuto<MEDCouplingCMesh> cm(MEDCouplingCMesh::New());
for(int i=0;i<spaceDim;i++)
{
- std::vector<int> tmp(1,i);
+ std::vector<std::size_t> tmp(1,i);
MCAuto<DataArrayDouble> elt(static_cast<DataArrayDouble*>(getCoords()->keepSelectedComponents(tmp)));
elt=elt->getDifferentValues(eps);
elt->sort(true);
/// @cond INTERNAL
-bool UpdateHexa8Cell(int validAxis, int neighId, const int *validConnQuad4NeighSide, int *allFacesNodalConn, int *myNeighbours)
+bool UpdateHexa8Cell(int validAxis, mcIdType neighId, const mcIdType *validConnQuad4NeighSide, mcIdType *allFacesNodalConn, mcIdType *myNeighbours)
{
static const int TAB[48]={
0,1,2,3,4,5,6,7,//0
static const int TAB2[6]={0,0,3,3,3,3};
if(myNeighbours[validAxis]==neighId && allFacesNodalConn[4*validAxis+0]==validConnQuad4NeighSide[TAB2[validAxis]])
return true;
- int oldAxis((int)std::distance(myNeighbours,std::find(myNeighbours,myNeighbours+6,neighId)));
+ mcIdType oldAxis(ToIdType(std::distance(myNeighbours,std::find(myNeighbours,myNeighbours+6,neighId))));
std::size_t pos(std::distance(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS,std::find(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS,MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS+6,oldAxis)));
std::size_t pos0(pos/2),pos1(pos%2);
int oldAxisOpp(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS[2*pos0+(pos1+1)%2]);
- int oldConn[8],myConn2[8]={-1,-1,-1,-1,-1,-1,-1,-1},myConn[8],edgeConn[2],allFacesTmp[24],neighTmp[6];
+ mcIdType oldConn[8],myConn2[8]={-1,-1,-1,-1,-1,-1,-1,-1},myConn[8],edgeConn[2],allFacesTmp[24],neighTmp[6];
oldConn[0]=allFacesNodalConn[0]; oldConn[1]=allFacesNodalConn[1]; oldConn[2]=allFacesNodalConn[2]; oldConn[3]=allFacesNodalConn[3];
oldConn[4]=allFacesNodalConn[4]; oldConn[5]=allFacesNodalConn[7]; oldConn[6]=allFacesNodalConn[6]; oldConn[7]=allFacesNodalConn[5];
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(INTERP_KERNEL::NORM_HEXA8));
myConn2[i]=validConnQuad4NeighSide[(4-i+TAB2[validAxis])%4];
for(int i=0;i<4;i++)
{
- int nodeId(myConn2[i]);//the node id for which the opposite one will be found
+ mcIdType nodeId(myConn2[i]);//the node id for which the opposite one will be found
bool found(false);
INTERP_KERNEL::NormalizedCellType typeOfSon;
for(int j=0;j<12 && !found;j++)
for(int i=0;i<6;i++)
{
cm.fillSonCellNodalConnectivity(i,myConn,allFacesTmp+4*i);
- std::set<int> s(allFacesTmp+4*i,allFacesTmp+4*i+4);
+ std::set<mcIdType> s(allFacesTmp+4*i,allFacesTmp+4*i+4);
bool found(false);
for(int j=0;j<6 && !found;j++)
{
- std::set<int> s1(allFacesNodalConn+4*j,allFacesNodalConn+4*j+4);
+ std::set<mcIdType> s1(allFacesNodalConn+4*j,allFacesNodalConn+4*j+4);
if(s==s1)
{
neighTmp[i]=myNeighbours[j];
* This method expects the \a this contains NORM_HEXA8 cells only. This method will sort each cells in \a this so that their numbering was
* homogeneous. If it succeeds the result of MEDCouplingUMesh::tetrahedrize will return a conform mesh.
*
- * \return DataArrayInt * - a newly allocated array (to be managed by the caller) containing renumbered cell ids.
+ * \return DataArrayIdType * - a newly allocated array (to be managed by the caller) containing renumbered cell ids.
*
* \throw If \a this is not a mesh containing only NORM_HEXA8 cells.
* \throw If \a this is not properly allocated.
* \sa MEDCouplingUMesh::tetrahedrize, MEDCouplingUMesh::simplexize.
*/
-DataArrayInt *MEDCoupling1SGTUMesh::sortHexa8EachOther()
+DataArrayIdType *MEDCoupling1SGTUMesh::sortHexa8EachOther()
{
MCAuto<MEDCoupling1SGTUMesh> quads(explodeEachHexa8To6Quad4());//checks that only hexa8
- int nbHexa8(getNumberOfCells()),*cQuads(quads->getNodalConnectivity()->getPointer());
- MCAuto<DataArrayInt> neighOfQuads(DataArrayInt::New()); neighOfQuads->alloc(nbHexa8*6,1); neighOfQuads->fillWithValue(-1);
- int *ptNeigh(neighOfQuads->getPointer());
+ mcIdType nbHexa8=getNumberOfCells();
+ mcIdType *cQuads(quads->getNodalConnectivity()->getPointer());
+ MCAuto<DataArrayIdType> neighOfQuads(DataArrayIdType::New()); neighOfQuads->alloc(nbHexa8*6,1); neighOfQuads->fillWithValue(-1);
+ mcIdType *ptNeigh(neighOfQuads->getPointer());
{//neighOfQuads tells for each face of each Quad8 which cell (if!=-1) is connected to this face.
MCAuto<MEDCouplingUMesh> quadsTmp(quads->buildUnstructured());
- MCAuto<DataArrayInt> ccSafe,cciSafe;
- DataArrayInt *cc(0),*cci(0);
+ MCAuto<DataArrayIdType> ccSafe,cciSafe;
+ DataArrayIdType *cc(0),*cci(0);
quadsTmp->findCommonCells(3,0,cc,cci);
ccSafe=cc; cciSafe=cci;
- const int *ccPtr(ccSafe->begin()),nbOfPair(cci->getNumberOfTuples()-1);
- for(int i=0;i<nbOfPair;i++)
+ const mcIdType *ccPtr(ccSafe->begin());
+ mcIdType nbOfPair=cci->getNumberOfTuples()-1;
+ for(mcIdType i=0;i<nbOfPair;i++)
{ ptNeigh[ccPtr[2*i+0]]=ccPtr[2*i+1]/6; ptNeigh[ccPtr[2*i+1]]=ccPtr[2*i+0]/6; }
}
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
std::vector<bool> fetched(nbHexa8,false);
std::vector<bool>::iterator it(std::find(fetched.begin(),fetched.end(),false));
while(it!=fetched.end())//it will turns as time as number of connected zones
{
- int cellId((int)std::distance(fetched.begin(),it));//it is the seed of the connected zone.
- std::set<int> s; s.insert(cellId);//s contains already organized.
+ mcIdType cellId(ToIdType(std::distance(fetched.begin(),it)));//it is the seed of the connected zone.
+ std::set<mcIdType> s; s.insert(cellId);//s contains already organized.
while(!s.empty())
{
- std::set<int> sNext;
- for(std::set<int>::const_iterator it0=s.begin();it0!=s.end();it0++)
+ std::set<mcIdType> sNext;
+ for(std::set<mcIdType>::const_iterator it0=s.begin();it0!=s.end();it0++)
{
fetched[*it0]=true;
- int *myNeighb(ptNeigh+6*(*it0));
+ mcIdType *myNeighb(ptNeigh+6*(*it0));
for(int i=0;i<6;i++)
{
if(myNeighb[i]!=-1 && !fetched[myNeighb[i]])
}
if(!ret->empty())
{
- int *conn(getNodalConnectivity()->getPointer());
- for(const int *pt=ret->begin();pt!=ret->end();pt++)
+ mcIdType *conn(getNodalConnectivity()->getPointer());
+ for(const mcIdType *pt=ret->begin();pt!=ret->end();pt++)
{
- int cellId(*pt);
+ mcIdType cellId(*pt);
conn[8*cellId+0]=cQuads[24*cellId+0]; conn[8*cellId+1]=cQuads[24*cellId+1]; conn[8*cellId+2]=cQuads[24*cellId+2]; conn[8*cellId+3]=cQuads[24*cellId+3];
conn[8*cellId+4]=cQuads[24*cellId+4]; conn[8*cellId+5]=cQuads[24*cellId+7]; conn[8*cellId+6]=cQuads[24*cellId+6]; conn[8*cellId+7]=cQuads[24*cellId+5];
}
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::computeDualMesh3D : only TETRA4 supported !");
checkFullyDefined();
MCAuto<MEDCouplingUMesh> thisu(buildUnstructured());
- MCAuto<DataArrayInt> revNodArr(DataArrayInt::New()),revNodIArr(DataArrayInt::New());
+ MCAuto<DataArrayIdType> revNodArr(DataArrayIdType::New()),revNodIArr(DataArrayIdType::New());
thisu->getReverseNodalConnectivity(revNodArr,revNodIArr);
- const int *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin());
- MCAuto<DataArrayInt> d1Arr(DataArrayInt::New()),di1Arr(DataArrayInt::New()),rd1Arr(DataArrayInt::New()),rdi1Arr(DataArrayInt::New());
+ const mcIdType *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin());
+ MCAuto<DataArrayIdType> d1Arr(DataArrayIdType::New()),di1Arr(DataArrayIdType::New()),rd1Arr(DataArrayIdType::New()),rdi1Arr(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> edges(thisu->explode3DMeshTo1D(d1Arr,di1Arr,rd1Arr,rdi1Arr));
- const int *d1(d1Arr->begin());
- MCAuto<DataArrayInt> d2Arr(DataArrayInt::New()),di2Arr(DataArrayInt::New()),rd2Arr(DataArrayInt::New()),rdi2Arr(DataArrayInt::New());
+ const mcIdType *d1(d1Arr->begin());
+ MCAuto<DataArrayIdType> d2Arr(DataArrayIdType::New()),di2Arr(DataArrayIdType::New()),rd2Arr(DataArrayIdType::New()),rdi2Arr(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> faces(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0;
- const int *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin());
+ const mcIdType *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin());
MCAuto<DataArrayDouble> edgesBaryArr(edges->computeCellCenterOfMass()),facesBaryArr(faces->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass());
- const int nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+faces->getNumberOfCells()),offset1(offset0+edges->getNumberOfCells());
+ const mcIdType nbOfNodes(getNumberOfNodes());
+ const mcIdType offset0=nbOfNodes+faces->getNumberOfCells();
+ const mcIdType offset1=offset0+edges->getNumberOfCells();
edges=0; faces=0;
std::vector<const DataArrayDouble *> v(4); v[0]=getCoords(); v[1]=facesBaryArr; v[2]=edgesBaryArr; v[3]=baryArr;
MCAuto<DataArrayDouble> zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; facesBaryArr=0;
std::string name("DualOf_"); name+=getName();
MCAuto<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYHED)); ret->setCoords(zeArr);
- MCAuto<DataArrayInt> cArr(DataArrayInt::New()),ciArr(DataArrayInt::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1);
- for(int i=0;i<nbOfNodes;i++,revNodI++)
+ MCAuto<DataArrayIdType> cArr(DataArrayIdType::New()),ciArr(DataArrayIdType::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1);
+ for(mcIdType i=0;i<nbOfNodes;i++,revNodI++)
{
- int nbOfCellsSharingNode(revNodI[1]-revNodI[0]);
+ mcIdType nbOfCellsSharingNode(revNodI[1]-revNodI[0]);
if(nbOfCellsSharingNode==0)
{
std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::computeDualMesh3D : Node #" << i << " is orphan !";
}
for(int j=0;j<nbOfCellsSharingNode;j++)
{
- int curCellId(revNod[revNodI[0]+j]);
- const int *connOfCurCell(nodal+4*curCellId);
+ mcIdType curCellId(revNod[revNodI[0]+j]);
+ const mcIdType *connOfCurCell(nodal+4*curCellId);
std::size_t nodePosInCurCell(std::distance(connOfCurCell,std::find(connOfCurCell,connOfCurCell+4,i)));
if(j!=0) cArr->pushBackSilent(-1);
- int tmp[14];
+ mcIdType tmp[14];
//
tmp[0]=d1[6*curCellId+DUAL_TETRA_0[nodePosInCurCell*9+0]-4]+offset0; tmp[1]=d2[4*curCellId+DUAL_TETRA_0[nodePosInCurCell*9+1]]+nbOfNodes;
tmp[2]=curCellId+offset1; tmp[3]=d2[4*curCellId+DUAL_TETRA_0[nodePosInCurCell*9+2]]+nbOfNodes;
{
if(FACEID_NOT_SH_NODE[nodePosInCurCell]!=k)
{
- const int *faceId(d2+4*curCellId+k);
+ const mcIdType *faceId(d2+4*curCellId+k);
if(rdi2[*faceId+1]-rdi2[*faceId]==1)
{
- int tmp2[5]; tmp2[0]=-1; tmp2[1]=i;
+ mcIdType tmp2[5]; tmp2[0]=-1; tmp2[1]=i;
tmp2[2]=d1[6*curCellId+DUAL_TETRA_1[9*nodePosInCurCell+3*kk+0]-8]+offset0;
tmp2[3]=d2[4*curCellId+DUAL_TETRA_1[9*nodePosInCurCell+3*kk+1]-4]+nbOfNodes;
tmp2[4]=d1[6*curCellId+DUAL_TETRA_1[9*nodePosInCurCell+3*kk+2]-8]+offset0;
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::computeDualMesh2D : only TRI3 supported !");
checkFullyDefined();
MCAuto<MEDCouplingUMesh> thisu(buildUnstructured());
- MCAuto<DataArrayInt> revNodArr(DataArrayInt::New()),revNodIArr(DataArrayInt::New());
+ MCAuto<DataArrayIdType> revNodArr(DataArrayIdType::New()),revNodIArr(DataArrayIdType::New());
thisu->getReverseNodalConnectivity(revNodArr,revNodIArr);
- const int *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin());
- MCAuto<DataArrayInt> d2Arr(DataArrayInt::New()),di2Arr(DataArrayInt::New()),rd2Arr(DataArrayInt::New()),rdi2Arr(DataArrayInt::New());
+ const mcIdType *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin());
+ MCAuto<DataArrayIdType> d2Arr(DataArrayIdType::New()),di2Arr(DataArrayIdType::New()),rd2Arr(DataArrayIdType::New()),rdi2Arr(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> edges(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0;
- const int *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin());
+ const mcIdType *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin());
MCAuto<DataArrayDouble> edgesBaryArr(edges->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass());
- const int nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+edges->getNumberOfCells());
+ const mcIdType nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+edges->getNumberOfCells());
edges=0;
std::vector<const DataArrayDouble *> v(3); v[0]=getCoords(); v[1]=edgesBaryArr; v[2]=baryArr;
MCAuto<DataArrayDouble> zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0;
std::string name("DualOf_"); name+=getName();
MCAuto<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYGON)); ret->setCoords(zeArr);
- MCAuto<DataArrayInt> cArr(DataArrayInt::New()),ciArr(DataArrayInt::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1);
- for(int i=0;i<nbOfNodes;i++,revNodI++)
+ MCAuto<DataArrayIdType> cArr(DataArrayIdType::New()),ciArr(DataArrayIdType::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1);
+ for(mcIdType i=0;i<nbOfNodes;i++,revNodI++)
{
- int nbOfCellsSharingNode(revNodI[1]-revNodI[0]);
+ mcIdType nbOfCellsSharingNode(revNodI[1]-revNodI[0]);
if(nbOfCellsSharingNode==0)
{
std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::computeDualMesh2D : Node #" << i << " is orphan !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::vector< std::vector<int> > polyg;
+ std::vector< std::vector<mcIdType> > polyg;
for(int j=0;j<nbOfCellsSharingNode;j++)
{
- int curCellId(revNod[revNodI[0]+j]);
- const int *connOfCurCell(nodal+3*curCellId);
+ mcIdType curCellId(revNod[revNodI[0]+j]);
+ const mcIdType *connOfCurCell(nodal+3*curCellId);
std::size_t nodePosInCurCell(std::distance(connOfCurCell,std::find(connOfCurCell,connOfCurCell+4,i)));
- std::vector<int> locV(3);
+ std::vector<mcIdType> locV(3);
locV[0]=d2[3*curCellId+DUAL_TRI_0[2*nodePosInCurCell+0]]+nbOfNodes; locV[1]=curCellId+offset0; locV[2]=d2[3*curCellId+DUAL_TRI_0[2*nodePosInCurCell+1]]+nbOfNodes;
polyg.push_back(locV);
int kk(0);
{
if(FACEID_NOT_SH_NODE[nodePosInCurCell]!=k)
{
- const int *edgeId(d2+3*curCellId+k);
+ const mcIdType *edgeId(d2+3*curCellId+k);
if(rdi2[*edgeId+1]-rdi2[*edgeId]==1)
{
- std::vector<int> locV2(2);
+ std::vector<mcIdType> locV2(2);
int zeLocEdgeIdRel(DUAL_TRI_1[2*nodePosInCurCell+kk]);
if(zeLocEdgeIdRel>0)
{ locV2[0]=d2[3*curCellId+zeLocEdgeIdRel-3]+nbOfNodes; locV2[1]=i; }
}
}
}
- std::vector<int> zePolyg(MEDCoupling1DGTUMesh::BuildAPolygonFromParts(polyg));
+ std::vector<mcIdType> zePolyg(MEDCoupling1DGTUMesh::BuildAPolygonFromParts(polyg));
cArr->insertAtTheEnd(zePolyg.begin(),zePolyg.end());
ciArr->setIJ(i+1,0,cArr->getNumberOfTuples());
}
*/
DataArrayDouble *MEDCoupling1SGTUMesh::getBoundingBoxForBBTree(double arcDetEps) const
{
- int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()),nbOfNodesPerCell(getNumberOfNodesPerCell());
+ mcIdType spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()),nbOfNodesPerCell(getNumberOfNodesPerCell());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
- for(int i=0;i<nbOfCells*spaceDim;i++)
+ for(mcIdType i=0;i<nbOfCells*spaceDim;i++)
{
bbox[2*i]=std::numeric_limits<double>::max();
bbox[2*i+1]=-std::numeric_limits<double>::max();
}
const double *coordsPtr(_coords->getConstPointer());
- const int *conn(_conn->getConstPointer());
- for(int i=0;i<nbOfCells;i++)
+ const mcIdType *conn(_conn->getConstPointer());
+ for(mcIdType i=0;i<nbOfCells;i++)
{
int kk(0);
for(int j=0;j<nbOfNodesPerCell;j++,conn++)
{
- int nodeId(*conn);
+ mcIdType nodeId(*conn);
if(nodeId>=0 && nodeId<nbOfNodes)
{
for(int k=0;k<spaceDim;k++)
{
checkFullyDefined();
MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME));
- int nbCells(getNumberOfCells());
+ mcIdType nbCells=getNumberOfCells();
MCAuto<DataArrayDouble> arr(DataArrayDouble::New());
arr->alloc(nbCells,1);
INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::DiameterCalculator> dc(_cm->buildInstanceOfDiameterCalulator(getSpaceDimension()));
{
checkConsistencyOfConnectivity();
INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::OrientationInverter> oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(getCellModelEnum()));
- int nbOfNodesPerCell((int)_cm->getNumberOfNodes()),nbCells(getNumberOfCells());
- int *conn(_conn->getPointer());
- for(int i=0;i<nbCells;i++)
+ mcIdType nbOfNodesPerCell=ToIdType(_cm->getNumberOfNodes()),nbCells=getNumberOfCells();
+ mcIdType *conn(_conn->getPointer());
+ for(mcIdType i=0;i<nbCells;i++)
oi->operate(conn+i*nbOfNodesPerCell,conn+(i+1)*nbOfNodesPerCell);
updateTime();
}
{
if(recDeepCpy)
{
- const DataArrayInt *c(other._conn);
+ const DataArrayIdType *c(other._conn);
if(c)
_conn=c->deepCopy();
c=other._conn_indx;
{
checkConsistencyLight();
MCAuto<MEDCoupling1DGTUMesh> ret(clone(false));
- MCAuto<DataArrayInt> c(_conn->deepCopy()),ci(_conn_indx->deepCopy());
+ MCAuto<DataArrayIdType> c(_conn->deepCopy()),ci(_conn_indx->deepCopy());
ret->setNodalConnectivity(c,ci);
return ret.retn();
}
void MEDCoupling1DGTUMesh::updateTime() const
{
MEDCoupling1GTUMesh::updateTime();
- const DataArrayInt *c(_conn);
+ const DataArrayIdType *c(_conn);
if(c)
updateTimeWith(*c);
c=_conn_indx;
std::vector<const BigMemoryObject *> MEDCoupling1DGTUMesh::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret(MEDCoupling1GTUMesh::getDirectChildrenWithNull());
- ret.push_back((const DataArrayInt *)_conn);
- ret.push_back((const DataArrayInt *)_conn_indx);
+ ret.push_back((const DataArrayIdType *)_conn);
+ ret.push_back((const DataArrayIdType *)_conn_indx);
return ret;
}
}
if(!MEDCoupling1GTUMesh::isEqualIfNotWhy(other,prec,reason))
return false;
- const DataArrayInt *c1(_conn),*c2(otherC->_conn);
+ const DataArrayIdType *c1(_conn),*c2(otherC->_conn);
if(c1==c2)
return true;
if(!c1 || !c2)
}
if(!c1->isEqualIfNotWhy(*c2,reason))
{
- reason.insert(0,"Nodal connectivity DataArrayInt differs : ");
+ reason.insert(0,"Nodal connectivity DataArrayIdType differs : ");
return false;
}
c1=_conn_indx; c2=otherC->_conn_indx;
}
if(!c1->isEqualIfNotWhy(*c2,reason))
{
- reason.insert(0,"Nodal connectivity index DataArrayInt differs : ");
+ reason.insert(0,"Nodal connectivity index DataArrayIdType differs : ");
return false;
}
return true;
return false;
if(!MEDCoupling1GTUMesh::isEqualWithoutConsideringStr(other,prec))
return false;
- const DataArrayInt *c1(_conn),*c2(otherC->_conn);
+ const DataArrayIdType *c1(_conn),*c2(otherC->_conn);
if(c1==c2)
return true;
if(!c1 || !c2)
const MEDCoupling1DGTUMesh *otherC=dynamic_cast<const MEDCoupling1DGTUMesh *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::checkFastEquivalWith : Two meshes are not unstructured with single dynamic geometric type !");
- const DataArrayInt *c1(_conn),*c2(otherC->_conn);
+ const DataArrayIdType *c1(_conn),*c2(otherC->_conn);
if(c1!=c2)
{
if(!c1 || !c2)
void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const
{
- const DataArrayInt *c1(_conn);
+ const DataArrayIdType *c1(_conn);
if(c1)
{
if(c1->getNumberOfComponents()!=1)
else
throw INTERP_KERNEL::Exception("Nodal connectivity array not defined !");
//
- int sz2=_conn->getNumberOfTuples();
+ mcIdType sz2(_conn->getNumberOfTuples());
c1=_conn_indx;
if(c1)
{
throw INTERP_KERNEL::Exception("Nodal connectivity index array is expected to have a a size of 1 at least !");
if(c1->getInfoOnComponent(0)!="")
throw INTERP_KERNEL::Exception("Nodal connectivity index array is expected to have no info on its single component !");
- int f=c1->front(),ll=c1->back();
+ mcIdType f=c1->front(),ll=c1->back();
if(f<0 || (sz2>0 && f>=sz2))
{
std::ostringstream oss; oss << "Nodal connectivity index array first value (" << f << ") is expected to be exactly in [0," << sz2 << ") !";
}
else
throw INTERP_KERNEL::Exception("Nodal connectivity index array not defined !");
- int szOfC1Exp=_conn_indx->back();
+ mcIdType szOfC1Exp=_conn_indx->back();
if(sz2<szOfC1Exp)
{
std::ostringstream oss; oss << "MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity : The expected length of nodal connectivity array regarding index is " << szOfC1Exp << " but the actual size of it is " << c1->getNumberOfTuples() << " !";
void MEDCoupling1DGTUMesh::checkConsistency(double eps) const
{
checkConsistencyLight();
- const DataArrayInt *c1(_conn),*c2(_conn_indx);
+ const DataArrayIdType *c1(_conn),*c2(_conn_indx);
if(!c2->isMonotonic(true))
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::checkConsistency : the nodal connectivity index is expected to be increasing monotinic !");
//
- int nbOfTuples=c1->getNumberOfTuples();
- int nbOfNodes=getNumberOfNodes();
- const int *w(c1->begin());
- for(int i=0;i<nbOfTuples;i++,w++)
+ mcIdType nbOfTuples(c1->getNumberOfTuples());
+ mcIdType nbOfNodes=getNumberOfNodes();
+ const mcIdType *w(c1->begin());
+ for(mcIdType i=0;i<nbOfTuples;i++,w++)
{
if(*w==-1) continue;
if(*w<0 || *w>=nbOfNodes)
}
}
-std::size_t MEDCoupling1DGTUMesh::getNumberOfCells() const
+mcIdType MEDCoupling1DGTUMesh::getNumberOfCells() const
{
checkConsistencyOfConnectivity();//do not remove
return _conn_indx->getNumberOfTuples()-1;
*
* \return a newly allocated array
*/
-DataArrayInt *MEDCoupling1DGTUMesh::computeNbOfNodesPerCell() const
+DataArrayIdType *MEDCoupling1DGTUMesh::computeNbOfNodesPerCell() const
{
checkConsistencyLight();
_conn_indx->checkMonotonic(true);
if(getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED)
return _conn_indx->deltaShiftIndex();
// for polyhedrons
- int nbOfCells=_conn_indx->getNumberOfTuples()-1;
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1;
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
- int *retPtr=ret->getPointer();
- const int *ci=_conn_indx->begin(),*c=_conn->begin();
- for(int i=0;i<nbOfCells;i++,retPtr++,ci++)
- *retPtr=ci[1]-ci[0]-std::count(c+ci[0],c+ci[1],-1);
+ mcIdType *retPtr=ret->getPointer();
+ const mcIdType *ci=_conn_indx->begin(),*c=_conn->begin();
+ for(mcIdType i=0;i<nbOfCells;i++,retPtr++,ci++)
+ *retPtr=int(ci[1]-ci[0]-ToIdType(std::count(c+ci[0],c+ci[1],-1)));
return ret.retn();
}
*
* \return a newly allocated array
*/
-DataArrayInt *MEDCoupling1DGTUMesh::computeNbOfFacesPerCell() const
+DataArrayIdType *MEDCoupling1DGTUMesh::computeNbOfFacesPerCell() const
{
checkConsistencyLight();
_conn_indx->checkMonotonic(true);
return _conn_indx->deltaShiftIndex();
if(getCellModelEnum()==INTERP_KERNEL::NORM_QPOLYG)
{
- MCAuto<DataArrayInt> ret=_conn_indx->deltaShiftIndex();
+ MCAuto<DataArrayIdType> ret=_conn_indx->deltaShiftIndex();
ret->applyDivideBy(2);
return ret.retn();
}
// for polyhedrons
- int nbOfCells=_conn_indx->getNumberOfTuples()-1;
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1;
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
- int *retPtr=ret->getPointer();
- const int *ci=_conn_indx->begin(),*c=_conn->begin();
- for(int i=0;i<nbOfCells;i++,retPtr++,ci++)
- *retPtr=std::count(c+ci[0],c+ci[1],-1)+1;
+ mcIdType *retPtr=ret->getPointer();
+ const mcIdType *ci=_conn_indx->begin(),*c=_conn->begin();
+ for(mcIdType i=0;i<nbOfCells;i++,retPtr++,ci++)
+ *retPtr=ToIdType(std::count(c+ci[0],c+ci[1],-1))+1;
return ret.retn();
}
* This method computes effective number of nodes per cell. That is to say nodes appearing several times in nodal connectivity of a cell,
* will be counted only once here whereas it will be counted several times in MEDCoupling1DGTUMesh::computeNbOfNodesPerCell method.
*
- * \return DataArrayInt * - new object to be deallocated by the caller.
+ * \return DataArrayIdType * - new object to be deallocated by the caller.
* \sa MEDCoupling1DGTUMesh::computeNbOfNodesPerCell
*/
-DataArrayInt *MEDCoupling1DGTUMesh::computeEffectiveNbOfNodesPerCell() const
+DataArrayIdType *MEDCoupling1DGTUMesh::computeEffectiveNbOfNodesPerCell() const
{
checkConsistencyLight();
_conn_indx->checkMonotonic(true);
- int nbOfCells(_conn_indx->getNumberOfTuples()-1);
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1;
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
- int *retPtr(ret->getPointer());
- const int *ci(_conn_indx->begin()),*c(_conn->begin());
+ mcIdType *retPtr(ret->getPointer());
+ const mcIdType *ci(_conn_indx->begin()),*c(_conn->begin());
if(getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED)
{
- for(int i=0;i<nbOfCells;i++,retPtr++,ci++)
+ for(mcIdType i=0;i<nbOfCells;i++,retPtr++,ci++)
{
- std::set<int> s(c+ci[0],c+ci[1]);
- *retPtr=(int)s.size();
+ std::set<mcIdType> s(c+ci[0],c+ci[1]);
+ *retPtr=ToIdType(s.size());
}
}
else
{
- for(int i=0;i<nbOfCells;i++,retPtr++,ci++)
+ for(mcIdType i=0;i<nbOfCells;i++,retPtr++,ci++)
{
- std::set<int> s(c+ci[0],c+ci[1]); s.erase(-1);
- *retPtr=(int)s.size();
+ std::set<mcIdType> s(c+ci[0],c+ci[1]); s.erase(-1);
+ *retPtr=ToIdType(s.size());
}
}
return ret.retn();
}
-void MEDCoupling1DGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const
+void MEDCoupling1DGTUMesh::getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const
{
- std::size_t nbOfCells(getNumberOfCells());//performs checks
+ mcIdType nbOfCells(getNumberOfCells());//performs checks
if(cellId<nbOfCells)
{
- int strt=_conn_indx->getIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0);
- int nbOfNodes=stp-strt;
+ mcIdType strt=_conn_indx->getIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0);
+ mcIdType nbOfNodes=stp-strt;
if(nbOfNodes<0)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::getNodeIdsOfCell : the index array is invalid ! Should be increasing monotonic !");
conn.resize(nbOfNodes);
}
}
-int MEDCoupling1DGTUMesh::getNumberOfNodesInCell(int cellId) const
+mcIdType MEDCoupling1DGTUMesh::getNumberOfNodesInCell(mcIdType cellId) const
{
- int nbOfCells(getNumberOfCells());//performs checks
+ mcIdType nbOfCells=getNumberOfCells();//performs checks
if(cellId>=0 && cellId<nbOfCells)
{
- const int *conn(_conn->begin());
- int strt=_conn_indx->getIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0);
- return stp-strt-std::count(conn+strt,conn+stp,-1);
+ const mcIdType *conn(_conn->begin());
+ mcIdType strt=_conn_indx->getIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0);
+ return stp-strt-ToIdType(std::count(conn+strt,conn+stp,-1));
}
else
{
}
if(!isOK)
return ret.str();
- int nbOfCells=getNumberOfCells();
- const int *ci=_conn_indx->begin(),*c=_conn->begin();
- for(int i=0;i<nbOfCells;i++,ci++)
+ mcIdType nbOfCells=getNumberOfCells();
+ const mcIdType *ci=_conn_indx->begin(),*c=_conn->begin();
+ for(mcIdType i=0;i<nbOfCells;i++,ci++)
{
ret << "Cell #" << i << " : ";
std::copy(c+ci[0],c+ci[1],std::ostream_iterator<int>(ret," "));
{
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
- int nbOfCells=getNumberOfCells();//checkConsistencyLight()
- int nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfCells=getNumberOfCells();//checkConsistencyLight()
+ mcIdType nbOfNodes=getNumberOfNodes();
ret->alloc(nbOfCells,spaceDim);
double *ptToFill=ret->getPointer();
const double *coor=_coords->begin();
- const int *nodal=_conn->begin(),*nodali=_conn_indx->begin();
+ const mcIdType *nodal=_conn->begin(),*nodali=_conn_indx->begin();
nodal+=nodali[0];
if(getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED)
{
- for(int i=0;i<nbOfCells;i++,ptToFill+=spaceDim,nodali++)
+ for(mcIdType i=0;i<nbOfCells;i++,ptToFill+=spaceDim,nodali++)
{
std::fill(ptToFill,ptToFill+spaceDim,0.);
if(nodali[0]<nodali[1])// >= to avoid division by 0.
{
- for(int j=nodali[0];j<nodali[1];j++,nodal++)
+ for(mcIdType j=nodali[0];j<nodali[1];j++,nodal++)
{
if(*nodal>=0 && *nodal<nbOfNodes)
std::transform(coor+spaceDim*nodal[0],coor+spaceDim*(nodal[0]+1),ptToFill,ptToFill,std::plus<double>());
std::ostringstream oss; oss << "MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell : on cell #" << i << " presence of nodeId #" << *nodal << " should be in [0," << nbOfNodes << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind2nd(std::multiplies<double>(),1./(nodali[1]-nodali[0])));
+ std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind2nd(std::multiplies<double>(),1./double(nodali[1]-nodali[0])));
}
}
else
}
else
{
- for(int i=0;i<nbOfCells;i++,ptToFill+=spaceDim,nodali++)
+ for(mcIdType i=0;i<nbOfCells;i++,ptToFill+=spaceDim,nodali++)
{
std::fill(ptToFill,ptToFill+spaceDim,0.);
if(nodali[0]<nodali[1])// >= to avoid division by 0.
{
int nbOfNod=0;
- for(int j=nodali[0];j<nodali[1];j++,nodal++)
+ for(mcIdType j=nodali[0];j<nodali[1];j++,nodal++)
{
if(*nodal==-1) continue;
if(*nodal>=0 && *nodal<nbOfNodes)
return ret.retn();
}
-void MEDCoupling1DGTUMesh::renumberCells(const int *old2NewBg, bool check)
+void MEDCoupling1DGTUMesh::renumberCells(const mcIdType *old2NewBg, bool check)
{
- int nbCells=getNumberOfCells();
- MCAuto<DataArrayInt> o2n=DataArrayInt::New();
+ mcIdType nbCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> o2n=DataArrayIdType::New();
o2n->useArray(old2NewBg,false,DeallocType::C_DEALLOC,nbCells,1);
if(check)
o2n=o2n->checkAndPreparePermutation();
//
- const int *o2nPtr=o2n->getPointer();
- const int *conn=_conn->begin(),*conni=_conn_indx->begin();
- MCAuto<DataArrayInt> newConn=DataArrayInt::New();
- MCAuto<DataArrayInt> newConnI=DataArrayInt::New();
+ const mcIdType *o2nPtr=o2n->getPointer();
+ const mcIdType *conn=_conn->begin(),*conni=_conn_indx->begin();
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New();
newConn->alloc(_conn->getNumberOfTuples(),1); newConnI->alloc(nbCells,1);
newConn->copyStringInfoFrom(*_conn); newConnI->copyStringInfoFrom(*_conn_indx);
//
- int *newC=newConn->getPointer(),*newCI=newConnI->getPointer();
- for(int i=0;i<nbCells;i++)
+ mcIdType *newC=newConn->getPointer(),*newCI=newConnI->getPointer();
+ for(mcIdType i=0;i<nbCells;i++)
{
- int newPos=o2nPtr[i];
- int sz=conni[i+1]-conni[i];
+ mcIdType newPos=o2nPtr[i];
+ mcIdType sz=conni[i+1]-conni[i];
if(sz>=0)
newCI[newPos]=sz;
else
}
newConnI->computeOffsetsFull(); newCI=newConnI->getPointer();
//
- for(int i=0;i<nbCells;i++,conni++)
+ for(mcIdType i=0;i<nbCells;i++,conni++)
{
- int newp=o2nPtr[i];
+ mcIdType newp=o2nPtr[i];
std::copy(conn+conni[0],conn+conni[1],newC+newCI[newp]);
}
_conn=newConn;
{
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),getMeshDimension());
ret->setCoords(getCoords());
- const int *nodalConn=_conn->begin(),*nodalConnI=_conn_indx->begin();
- int nbCells=getNumberOfCells();//checkConsistencyLight
- int geoType=(int)getCellModelEnum();
- MCAuto<DataArrayInt> c=DataArrayInt::New(); c->alloc(nbCells+_conn->getNumberOfTuples(),1);
- MCAuto<DataArrayInt> cI=DataArrayInt::New(); cI->alloc(nbCells+1);
- int *cPtr=c->getPointer(),*ciPtr=cI->getPointer();
+ const mcIdType *nodalConn=_conn->begin(),*nodalConnI=_conn_indx->begin();
+ mcIdType nbCells=getNumberOfCells();//checkConsistencyLight
+ mcIdType geoType=ToIdType(getCellModelEnum());
+ MCAuto<DataArrayIdType> c=DataArrayIdType::New(); c->alloc(nbCells+_conn->getNumberOfTuples(),1);
+ MCAuto<DataArrayIdType> cI=DataArrayIdType::New(); cI->alloc(nbCells+1);
+ mcIdType *cPtr=c->getPointer(),*ciPtr=cI->getPointer();
ciPtr[0]=0;
- for(int i=0;i<nbCells;i++,ciPtr++)
+ for(mcIdType i=0;i<nbCells;i++,ciPtr++)
{
- int sz=nodalConnI[i+1]-nodalConnI[i];
+ mcIdType sz=nodalConnI[i+1]-nodalConnI[i];
if(sz>=0)
{
*cPtr++=geoType;
/*!
* Do nothing for the moment, because there is no policy that allows to split polygons, polyhedrons ... into simplexes
*/
-DataArrayInt *MEDCoupling1DGTUMesh::simplexize(int policy)
+DataArrayIdType *MEDCoupling1DGTUMesh::simplexize(int policy)
{
- int nbOfCells=getNumberOfCells();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ mcIdType nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
ret->iota(0);
return ret.retn();
return Merge1DGTUMeshesOnSameCoords(ms);
}
-MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const
+MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const
{
checkConsistencyLight();
MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
ret->setCoords(_coords);
- DataArrayInt *c=0,*ci=0;
- DataArrayInt::ExtractFromIndexedArrays(begin,end,_conn,_conn_indx,c,ci);
- MCAuto<DataArrayInt> cSafe(c),ciSafe(ci);
+ DataArrayIdType *c=0,*ci=0;
+ DataArrayIdType::ExtractFromIndexedArrays(begin,end,_conn,_conn_indx,c,ci);
+ MCAuto<DataArrayIdType> cSafe(c),ciSafe(ci);
ret->setNodalConnectivity(c,ci);
return ret.retn();
}
-MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const
+MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
{
checkConsistencyLight();
MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
ret->setCoords(_coords);
- DataArrayInt *c=0,*ci=0;
- DataArrayInt::ExtractFromIndexedArraysSlice(start,end,step,_conn,_conn_indx,c,ci);
- MCAuto<DataArrayInt> cSafe(c),ciSafe(ci);
+ DataArrayIdType *c=0,*ci=0;
+ DataArrayIdType::ExtractFromIndexedArraysSlice(start,end,step,_conn,_conn_indx,c,ci);
+ MCAuto<DataArrayIdType> cSafe(c),ciSafe(ci);
ret->setNodalConnectivity(c,ci);
return ret.retn();
}
void MEDCoupling1DGTUMesh::computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const
{
checkConsistency();
- int sz((int)nodeIdsInUse.size());
- for(const int *conn=_conn->begin();conn!=_conn->end();conn++)
+ mcIdType sz(ToIdType(nodeIdsInUse.size()));
+ for(const mcIdType *conn=_conn->begin();conn!=_conn->end();conn++)
{
if(*conn>=0 && *conn<sz)
nodeIdsInUse[*conn]=true;
}
}
-void MEDCoupling1DGTUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const
+void MEDCoupling1DGTUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const
{
checkFullyDefined();
- int nbOfNodes=getNumberOfNodes();
- int *revNodalIndxPtr=(int *)malloc((nbOfNodes+1)*sizeof(int));
+ mcIdType nbOfNodes=getNumberOfNodes();
+ mcIdType *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType));
revNodalIndx->useArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1);
std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0);
- const int *conn=_conn->begin(),*conni=_conn_indx->begin();
- int nbOfCells=getNumberOfCells();
- int nbOfEltsInRevNodal=0;
- for(int eltId=0;eltId<nbOfCells;eltId++)
+ const mcIdType *conn=_conn->begin(),*conni=_conn_indx->begin();
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType nbOfEltsInRevNodal=0;
+ for(mcIdType eltId=0;eltId<nbOfCells;eltId++)
{
- int nbOfNodesPerCell=conni[eltId+1]-conni[eltId];
+ mcIdType nbOfNodesPerCell=conni[eltId+1]-conni[eltId];
if(nbOfNodesPerCell>=0)
{
- for(int j=0;j<nbOfNodesPerCell;j++)
+ for(mcIdType j=0;j<nbOfNodesPerCell;j++)
{
- int nodeId=conn[conni[eltId]+j];
+ mcIdType nodeId=conn[conni[eltId]+j];
if(nodeId==-1) continue;
if(nodeId>=0 && nodeId<nbOfNodes)
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus<int>());
+ std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus<mcIdType>());
conn=_conn->begin();
- int *revNodalPtr=(int *)malloc((nbOfEltsInRevNodal)*sizeof(int));
+ mcIdType *revNodalPtr=(mcIdType *)malloc((nbOfEltsInRevNodal)*sizeof(mcIdType));
revNodal->useArray(revNodalPtr,true,DeallocType::C_DEALLOC,nbOfEltsInRevNodal,1);
std::fill(revNodalPtr,revNodalPtr+nbOfEltsInRevNodal,-1);
- for(int eltId=0;eltId<nbOfCells;eltId++)
+ for(mcIdType eltId=0;eltId<nbOfCells;eltId++)
{
- int nbOfNodesPerCell=conni[eltId+1]-conni[eltId];
- for(int j=0;j<nbOfNodesPerCell;j++)
+ mcIdType nbOfNodesPerCell=conni[eltId+1]-conni[eltId];
+ for(mcIdType j=0;j<nbOfNodesPerCell;j++)
{
- int nodeId=conn[conni[eltId]+j];
+ mcIdType nodeId=conn[conni[eltId]+j];
if(nodeId!=-1)
- *std::find_if(revNodalPtr+revNodalIndxPtr[nodeId],revNodalPtr+revNodalIndxPtr[nodeId+1],std::bind2nd(std::equal_to<int>(),-1))=eltId;
+ *std::find_if(revNodalPtr+revNodalIndxPtr[nodeId],revNodalPtr+revNodalIndxPtr[nodeId+1],std::bind2nd(std::equal_to<mcIdType>(),-1))=eltId;
}
}
}
void MEDCoupling1DGTUMesh::checkFullyDefined() const
{
- if(!((const DataArrayInt *)_conn) || !((const DataArrayInt *)_conn_indx) || !((const DataArrayDouble *)_coords))
+ if(!((const DataArrayIdType *)_conn) || !((const DataArrayIdType *)_conn_indx) || !((const DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::checkFullyDefined : part of this is not fully defined.");
}
-bool MEDCoupling1DGTUMesh::isEmptyMesh(const std::vector<int>& tinyInfo) const
+bool MEDCoupling1DGTUMesh::isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const
{
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::isEmptyMesh : not implemented yet !");
}
-void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
{
int it,order;
double time=getTime(it,order);
std::vector<std::string> littleStrings2,littleStrings3,littleStrings4;
if((const DataArrayDouble *)_coords)
_coords->getTinySerializationStrInformation(littleStrings2);
- if((const DataArrayInt *)_conn)
+ if((const DataArrayIdType *)_conn)
_conn->getTinySerializationStrInformation(littleStrings3);
- if((const DataArrayInt *)_conn_indx)
+ if((const DataArrayIdType *)_conn_indx)
_conn_indx->getTinySerializationStrInformation(littleStrings4);
- int sz0((int)littleStrings2.size()),sz1((int)littleStrings3.size()),sz2((int)littleStrings4.size());
+ mcIdType sz0(ToIdType(littleStrings2.size())),sz1(ToIdType(littleStrings3.size())),sz2(ToIdType(littleStrings4.size()));
littleStrings.insert(littleStrings.end(),littleStrings2.begin(),littleStrings2.end());
littleStrings.insert(littleStrings.end(),littleStrings3.begin(),littleStrings3.end());
littleStrings.insert(littleStrings.end(),littleStrings4.begin(),littleStrings4.end());
tinyInfo.push_back(getCellModelEnum());
tinyInfo.push_back(it);
tinyInfo.push_back(order);
- std::vector<int> tinyInfo2,tinyInfo3,tinyInfo4;
+ std::vector<mcIdType> tinyInfo2,tinyInfo3,tinyInfo4;
if((const DataArrayDouble *)_coords)
_coords->getTinySerializationIntInformation(tinyInfo2);
- if((const DataArrayInt *)_conn)
+ if((const DataArrayIdType *)_conn)
_conn->getTinySerializationIntInformation(tinyInfo3);
- if((const DataArrayInt *)_conn_indx)
+ if((const DataArrayIdType *)_conn_indx)
_conn_indx->getTinySerializationIntInformation(tinyInfo4);
- int sz3((int)tinyInfo2.size()),sz4((int)tinyInfo3.size()),sz5((int)tinyInfo4.size());
+ mcIdType sz3(ToIdType(tinyInfo2.size())),sz4(ToIdType(tinyInfo3.size())),sz5(ToIdType(tinyInfo4.size()));
tinyInfo.push_back(sz0); tinyInfo.push_back(sz1); tinyInfo.push_back(sz2); tinyInfo.push_back(sz3); tinyInfo.push_back(sz4); tinyInfo.push_back(sz5);
tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end());
tinyInfo.insert(tinyInfo.end(),tinyInfo3.begin(),tinyInfo3.end());
tinyInfoD.push_back(time);
}
-void MEDCoupling1DGTUMesh::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
+void MEDCoupling1DGTUMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
- std::vector<int> tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+tinyInfo[6]);
- std::vector<int> tinyInfo1(tinyInfo.begin()+9+tinyInfo[6],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]);
- std::vector<int> tinyInfo12(tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]+tinyInfo[8]);
- MCAuto<DataArrayInt> p1(DataArrayInt::New()); p1->resizeForUnserialization(tinyInfo1);
- MCAuto<DataArrayInt> p2(DataArrayInt::New()); p2->resizeForUnserialization(tinyInfo12);
- std::vector<const DataArrayInt *> v(2); v[0]=p1; v[1]=p2;
- p2=DataArrayInt::Aggregate(v);
+ std::vector<mcIdType> tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+tinyInfo[6]);
+ std::vector<mcIdType> tinyInfo1(tinyInfo.begin()+9+tinyInfo[6],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]);
+ std::vector<mcIdType> tinyInfo12(tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]+tinyInfo[8]);
+ MCAuto<DataArrayIdType> p1(DataArrayIdType::New()); p1->resizeForUnserialization(tinyInfo1);
+ MCAuto<DataArrayIdType> p2(DataArrayIdType::New()); p2->resizeForUnserialization(tinyInfo12);
+ std::vector<const DataArrayIdType *> v(2); v[0]=p1; v[1]=p2;
+ p2=DataArrayIdType::Aggregate(v);
a2->resizeForUnserialization(tinyInfo2);
a1->alloc(p2->getNbOfElems(),1);
}
-void MEDCoupling1DGTUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
+void MEDCoupling1DGTUMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const
{
- int sz(0);
- if((const DataArrayInt *)_conn)
+ mcIdType sz(0);
+ if((const DataArrayIdType *)_conn)
if(_conn->isAllocated())
sz=_conn->getNbOfElems();
- if((const DataArrayInt *)_conn_indx)
+ if((const DataArrayIdType *)_conn_indx)
if(_conn_indx->isAllocated())
sz+=_conn_indx->getNbOfElems();
- a1=DataArrayInt::New();
+ a1=DataArrayIdType::New();
a1->alloc(sz,1);
- int *work(a1->getPointer());
- if(sz!=0 && (const DataArrayInt *)_conn)
+ mcIdType *work(a1->getPointer());
+ if(sz!=0 && (const DataArrayIdType *)_conn)
work=std::copy(_conn->begin(),_conn->end(),a1->getPointer());
- if(sz!=0 && (const DataArrayInt *)_conn_indx)
+ if(sz!=0 && (const DataArrayIdType *)_conn_indx)
std::copy(_conn_indx->begin(),_conn_indx->end(),work);
sz=0;
if((const DataArrayDouble *)_coords)
std::copy(_coords->begin(),_coords->end(),a2->getPointer());
}
-void MEDCoupling1DGTUMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+void MEDCoupling1DGTUMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings)
{
INTERP_KERNEL::NormalizedCellType gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]);
setName(littleStrings[0]);
setDescription(littleStrings[1]);
setTimeUnit(littleStrings[2]);
- setTime(tinyInfoD[0],tinyInfo[1],tinyInfo[2]);
- int sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]),sz4(tinyInfo[7]),sz5(tinyInfo[8]);
+ setTime(tinyInfoD[0],FromIdType<int>(tinyInfo[1]),FromIdType<int>(tinyInfo[2]));
+ mcIdType sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]),sz4(tinyInfo[7]),sz5(tinyInfo[8]);
//
_coords=DataArrayDouble::New();
- std::vector<int> tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+sz3);
+ std::vector<mcIdType> tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+sz3);
_coords->resizeForUnserialization(tinyInfo2);
std::copy(a2->begin(),a2->end(),_coords->getPointer());
- _conn=DataArrayInt::New();
- std::vector<int> tinyInfo3(tinyInfo.begin()+9+sz3,tinyInfo.begin()+9+sz3+sz4);
+ _conn=DataArrayIdType::New();
+ std::vector<mcIdType> tinyInfo3(tinyInfo.begin()+9+sz3,tinyInfo.begin()+9+sz3+sz4);
_conn->resizeForUnserialization(tinyInfo3);
std::copy(a1->begin(),a1->begin()+_conn->getNbOfElems(),_conn->getPointer());
- _conn_indx=DataArrayInt::New();
- std::vector<int> tinyInfo4(tinyInfo.begin()+9+sz3+sz4,tinyInfo.begin()+9+sz3+sz4+sz5);
+ _conn_indx=DataArrayIdType::New();
+ std::vector<mcIdType> tinyInfo4(tinyInfo.begin()+9+sz3+sz4,tinyInfo.begin()+9+sz3+sz4+sz5);
_conn_indx->resizeForUnserialization(tinyInfo4);
std::copy(a1->begin()+_conn->getNbOfElems(),a1->end(),_conn_indx->getPointer());
std::vector<std::string> littleStrings2(littleStrings.begin()+3,littleStrings.begin()+3+sz0);
* by excluding the unused nodes, for which the array holds -1. The result array is
* a mapping in "Old to New" mode.
* \param [out] nbrOfNodesInUse - number of node ids present in the nodal connectivity.
- * \return DataArrayInt * - a new instance of DataArrayInt. Its length is \a
+ * \return DataArrayIdType * - a new instance of DataArrayIdType. Its length is \a
* this->getNumberOfNodes(). It holds for each node of \a this mesh either -1
* if the node is unused or a new id else. The caller is to delete this
* array using decrRef() as it is no more needed.
* \throw If the nodal connectivity includes an invalid id.
* \sa MEDCoupling1DGTUMesh::getNodeIdsInUse, areAllNodesFetched
*/
-DataArrayInt *MEDCoupling1DGTUMesh::computeFetchedNodeIds() const
+DataArrayIdType *MEDCoupling1DGTUMesh::computeFetchedNodeIds() const
{
checkConsistency();
- int nbNodes(getNumberOfNodes());
+ mcIdType nbNodes(getNumberOfNodes());
std::vector<bool> fetchedNodes(nbNodes,false);
computeNodeIdsAlg(fetchedNodes);
- int sz((int)std::count(fetchedNodes.begin(),fetchedNodes.end(),true));
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
- int *retPtr(ret->getPointer());
- for(int i=0;i<nbNodes;i++)
+ mcIdType sz(ToIdType(std::count(fetchedNodes.begin(),fetchedNodes.end(),true)));
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(sz,1);
+ mcIdType *retPtr(ret->getPointer());
+ for(mcIdType i=0;i<nbNodes;i++)
if(fetchedNodes[i])
*retPtr++=i;
return ret.retn();
* by excluding the unused nodes, for which the array holds -1. The result array is
* a mapping in "Old to New" mode.
* \param [out] nbrOfNodesInUse - number of node ids present in the nodal connectivity.
- * \return DataArrayInt * - a new instance of DataArrayInt. Its length is \a
+ * \return DataArrayIdType * - a new instance of DataArrayIdType. Its length is \a
* this->getNumberOfNodes(). It holds for each node of \a this mesh either -1
* if the node is unused or a new id else. The caller is to delete this
* array using decrRef() as it is no more needed.
* \throw If the nodal connectivity includes an invalid id.
* \sa MEDCoupling1DGTUMesh::computeFetchedNodeIds, areAllNodesFetched
*/
-DataArrayInt *MEDCoupling1DGTUMesh::getNodeIdsInUse(int& nbrOfNodesInUse) const
+DataArrayIdType *MEDCoupling1DGTUMesh::getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const
{
nbrOfNodesInUse=-1;
- int nbOfNodes=getNumberOfNodes();
- int nbOfCells=getNumberOfCells();//checkConsistencyLight
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ mcIdType nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfCells=getNumberOfCells();//checkConsistencyLight
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfNodes,1);
- int *traducer=ret->getPointer();
+ mcIdType *traducer=ret->getPointer();
std::fill(traducer,traducer+nbOfNodes,-1);
- const int *conn=_conn->begin(),*conni(_conn_indx->begin());
- for(int i=0;i<nbOfCells;i++,conni++)
+ const mcIdType *conn=_conn->begin(),*conni(_conn_indx->begin());
+ for(mcIdType i=0;i<nbOfCells;i++,conni++)
{
- int nbNodesPerCell=conni[1]-conni[0];
- for(int j=0;j<nbNodesPerCell;j++)
+ mcIdType nbNodesPerCell=conni[1]-conni[0];
+ for(mcIdType j=0;j<nbNodesPerCell;j++)
{
- int nodeId=conn[conni[0]+j];
+ mcIdType nodeId=conn[conni[0]+j];
if(nodeId==-1) continue;
if(nodeId>=0 && nodeId<nbOfNodes)
traducer[nodeId]=1;
}
}
}
- nbrOfNodesInUse=(int)std::count(traducer,traducer+nbOfNodes,1);
+ nbrOfNodesInUse=ToIdType(std::count(traducer,traducer+nbOfNodes,1));
std::transform(traducer,traducer+nbOfNodes,traducer,MEDCouplingAccVisit());
return ret.retn();
}
*
* \sa renumberNodesInConn
*/
-void MEDCoupling1DGTUMesh::renumberNodesWithOffsetInConn(int offset)
+void MEDCoupling1DGTUMesh::renumberNodesWithOffsetInConn(mcIdType offset)
{
getNumberOfCells();//only to check that all is well defined.
//
- int nbOfTuples(_conn->getNumberOfTuples());
- int *pt(_conn->getPointer());
- for(int i=0;i<nbOfTuples;i++,pt++)
+ mcIdType nbOfTuples(_conn->getNumberOfTuples());
+ mcIdType *pt(_conn->getPointer());
+ for(mcIdType i=0;i<nbOfTuples;i++,pt++)
{
if(*pt==-1) continue;
*pt+=offset;
}
/*!
- * Same than renumberNodesInConn(const int *) except that here the format of old-to-new traducer is using map instead
+ * Same than renumberNodesInConn(const mcIdType *) except that here the format of old-to-new traducer is using map instead
* of array. This method is dedicated for renumbering from a big set of nodes the a tiny set of nodes which is the case during extraction
* of a big mesh.
*/
-void MEDCoupling1DGTUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap<int,int>& newNodeNumbersO2N)
+void MEDCoupling1DGTUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap<mcIdType,mcIdType>& newNodeNumbersO2N)
{
- this->renumberNodesInConnT< INTERP_KERNEL::HashMap<int,int> >(newNodeNumbersO2N);
+ this->renumberNodesInConnT< INTERP_KERNEL::HashMap<mcIdType,mcIdType> >(newNodeNumbersO2N);
}
/*!
- * Same than renumberNodesInConn(const int *) except that here the format of old-to-new traducer is using map instead
+ * Same than renumberNodesInConn(const mcIdType *) except that here the format of old-to-new traducer is using map instead
* of array. This method is dedicated for renumbering from a big set of nodes the a tiny set of nodes which is the case during extraction
* of a big mesh.
*/
-void MEDCoupling1DGTUMesh::renumberNodesInConn(const std::map<int,int>& newNodeNumbersO2N)
+void MEDCoupling1DGTUMesh::renumberNodesInConn(const std::map<mcIdType,mcIdType>& newNodeNumbersO2N)
{
- this->renumberNodesInConnT< std::map<int,int> >(newNodeNumbersO2N);
+ this->renumberNodesInConnT< std::map<mcIdType,mcIdType> >(newNodeNumbersO2N);
}
/*!
* See \ref numbering for more info on renumbering modes.
* \throw If the nodal connectivity of cells is not defined.
*/
-void MEDCoupling1DGTUMesh::renumberNodesInConn(const int *newNodeNumbersO2N)
+void MEDCoupling1DGTUMesh::renumberNodesInConn(const mcIdType *newNodeNumbersO2N)
{
getNumberOfCells();//only to check that all is well defined.
//
- int nbElemsIn(getNumberOfNodes()),nbOfTuples(_conn->getNumberOfTuples());
- int *pt(_conn->getPointer());
- for(int i=0;i<nbOfTuples;i++,pt++)
+ mcIdType nbElemsIn(getNumberOfNodes()),nbOfTuples(_conn->getNumberOfTuples());
+ mcIdType *pt(_conn->getPointer());
+ for(mcIdType i=0;i<nbOfTuples;i++,pt++)
{
if(*pt==-1) continue;
if(*pt>=0 && *pt<nbElemsIn)
* \param [in] fullyIn input that specifies if all node ids must be in [\a begin,\a end) array to consider cell to be in.
* \param [in,out] cellIdsKeptArr array where all candidate cell ids are put at the end.
*/
-void MEDCoupling1DGTUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const
+void MEDCoupling1DGTUMesh::fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const
{
- int nbOfCells=getNumberOfCells();
- MCAuto<DataArrayInt> cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1);
- int tmp=-1;
- int sz=_conn->getMaxValue(tmp); sz=std::max(sz,0)+1;
+ mcIdType nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> cellIdsKept=DataArrayIdType::New(); cellIdsKept->alloc(0,1);
+ mcIdType tmp=-1;
+ mcIdType sz=_conn->getMaxValue(tmp); sz=std::max(sz,ToIdType(0))+1;
std::vector<bool> fastFinder(sz,false);
- for(const int *work=begin;work!=end;work++)
+ for(const mcIdType *work=begin;work!=end;work++)
if(*work>=0 && *work<sz)
fastFinder[*work]=true;
- const int *conn=_conn->begin(),*conni=_conn_indx->begin();
- for(int i=0;i<nbOfCells;i++,conni++)
+ const mcIdType *conn=_conn->begin(),*conni=_conn_indx->begin();
+ for(mcIdType i=0;i<nbOfCells;i++,conni++)
{
int ref=0,nbOfHit=0;
- int nbNodesPerCell=conni[1]-conni[0];
+ mcIdType nbNodesPerCell=conni[1]-conni[0];
if(nbNodesPerCell>=0)
{
- for(int j=0;j<nbNodesPerCell;j++)
+ for(mcIdType j=0;j<nbNodesPerCell;j++)
{
- int nodeId=conn[conni[0]+j];
+ mcIdType nodeId=conn[conni[0]+j];
if(nodeId>=0)
{
ref++;
cellIdsKeptArr=cellIdsKept.retn();
}
-void MEDCoupling1DGTUMesh::allocateCells(int nbOfCells)
+void MEDCoupling1DGTUMesh::allocateCells(mcIdType nbOfCells)
{
if(nbOfCells<0)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::allocateCells : the input number of cells should be >= 0 !");
- _conn=DataArrayInt::New();
+ _conn=DataArrayIdType::New();
_conn->reserve(nbOfCells*3);
- _conn_indx=DataArrayInt::New();
+ _conn_indx=DataArrayIdType::New();
_conn_indx->reserve(nbOfCells+1); _conn_indx->pushBackSilent(0);
declareAsNew();
}
* attached to \a this.
* \throw If the nodal connectivity array in \a this is null (call MEDCoupling1SGTUMesh::allocateCells before).
*/
-void MEDCoupling1DGTUMesh::insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd)
+void MEDCoupling1DGTUMesh::insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd)
{
std::size_t sz(std::distance(nodalConnOfCellBg,nodalConnOfCellEnd));
- DataArrayInt *c(_conn),*c2(_conn_indx);
+ DataArrayIdType *c(_conn),*c2(_conn_indx);
if(c && c2)
{
- int pos=c2->back();
- if(pos==(int)c->getNumberOfTuples())
+ mcIdType pos=c2->back();
+ if(pos==c->getNumberOfTuples())
{
c->pushBackValsSilent(nodalConnOfCellBg,nodalConnOfCellEnd);
- c2->pushBackSilent(pos+sz);
+ c2->pushBackSilent(pos+ToIdType(sz));
}
else
{
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::insertNextCell : nodal connectivity array is null ! Call MEDCoupling1DGTUMesh::allocateCells before !");
}
-void MEDCoupling1DGTUMesh::setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex)
+void MEDCoupling1DGTUMesh::setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex)
{
if(nodalConn)
nodalConn->incrRef();
}
/*!
- * \return DataArrayInt * - the internal reference to the nodal connectivity. The caller is not responsible to deallocate it.
+ * \return DataArrayIdType * - the internal reference to the nodal connectivity. The caller is not responsible to deallocate it.
*/
-DataArrayInt *MEDCoupling1DGTUMesh::getNodalConnectivity() const
+DataArrayIdType *MEDCoupling1DGTUMesh::getNodalConnectivity() const
{
- const DataArrayInt *ret(_conn);
- return const_cast<DataArrayInt *>(ret);
+ const DataArrayIdType *ret(_conn);
+ return const_cast<DataArrayIdType *>(ret);
}
/*!
- * \return DataArrayInt * - the internal reference to the nodal connectivity index. The caller is not responsible to deallocate it.
+ * \return DataArrayIdType * - the internal reference to the nodal connectivity index. The caller is not responsible to deallocate it.
*/
-DataArrayInt *MEDCoupling1DGTUMesh::getNodalConnectivityIndex() const
+DataArrayIdType *MEDCoupling1DGTUMesh::getNodalConnectivityIndex() const
{
- const DataArrayInt *ret(_conn_indx);
- return const_cast<DataArrayInt *>(ret);
+ const DataArrayIdType *ret(_conn_indx);
+ return const_cast<DataArrayIdType *>(ret);
}
/*!
MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::copyWithNodalConnectivityPacked(bool& isShallowCpyOfNodalConnn) const
{
MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
- DataArrayInt *nc=0,*nci=0;
+ DataArrayIdType *nc=0,*nci=0;
isShallowCpyOfNodalConnn=retrievePackedNodalConnectivity(nc,nci);
- MCAuto<DataArrayInt> ncs(nc),ncis(nci);
+ MCAuto<DataArrayIdType> ncs(nc),ncis(nci);
ret->_conn=ncs; ret->_conn_indx=ncis;
ret->setCoords(getCoords());
return ret.retn();
*
* \throw if \a this does not pass MEDCoupling1DGTUMesh::checkConsistencyLight test
*/
-bool MEDCoupling1DGTUMesh::retrievePackedNodalConnectivity(DataArrayInt *&nodalConn, DataArrayInt *&nodalConnIndx) const
+bool MEDCoupling1DGTUMesh::retrievePackedNodalConnectivity(DataArrayIdType *&nodalConn, DataArrayIdType *&nodalConnIndx) const
{
if(isPacked())//performs the checkConsistencyLight
{
- const DataArrayInt *c0(_conn),*c1(_conn_indx);
- nodalConn=const_cast<DataArrayInt *>(c0); nodalConnIndx=const_cast<DataArrayInt *>(c1);
+ const DataArrayIdType *c0(_conn),*c1(_conn_indx);
+ nodalConn=const_cast<DataArrayIdType *>(c0); nodalConnIndx=const_cast<DataArrayIdType *>(c1);
nodalConn->incrRef(); nodalConnIndx->incrRef();
return true;
}
- int bg=_conn_indx->front(),end=_conn_indx->back();
- MCAuto<DataArrayInt> nc(_conn->selectByTupleIdSafeSlice(bg,end,1));
- MCAuto<DataArrayInt> nci(_conn_indx->deepCopy());
+ mcIdType bg=_conn_indx->front(),end=_conn_indx->back();
+ MCAuto<DataArrayIdType> nc(_conn->selectByTupleIdSafeSlice(bg,end,1));
+ MCAuto<DataArrayIdType> nci(_conn_indx->deepCopy());
nci->applyLin(1,-bg);
nodalConn=nc.retn(); nodalConnIndx=nci.retn();
return false;
bool MEDCoupling1DGTUMesh::isPacked() const
{
checkConsistencyLight();
- return _conn_indx->front()==0 && _conn_indx->back()==(int)_conn->getNumberOfTuples();
+ return _conn_indx->front()==0 && _conn_indx->back()==_conn->getNumberOfTuples();
}
MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshes(const MEDCoupling1DGTUMesh *mesh1, const MEDCoupling1DGTUMesh *mesh2)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::Merge1DGTUMeshes : all items must have the same geo type !");
std::vector< MCAuto<MEDCoupling1DGTUMesh> > bb(sz);
std::vector< const MEDCoupling1DGTUMesh * > aa(sz);
- int spaceDim=-3;
- for(std::size_t i=0;i<sz && spaceDim==-3;i++)
+ std::size_t spaceDimUndef=-3, spaceDim=spaceDimUndef;
+ for(std::size_t i=0;i<sz && spaceDim==spaceDimUndef;i++)
{
const MEDCoupling1DGTUMesh *cur=a[i];
const DataArrayDouble *coo=cur->getCoords();
if(coo)
spaceDim=coo->getNumberOfComponents();
}
- if(spaceDim==-3)
+ if(spaceDim==spaceDimUndef)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::Merge1DGTUMeshes : no spaceDim specified ! unable to perform merge !");
for(std::size_t i=0;i<sz;i++)
{
if(!(*it))
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords : null instance in the first element of input vector !");
std::vector< MCAuto<MEDCoupling1DGTUMesh> > objs(a.size());
- std::vector<const DataArrayInt *> ncs(a.size()),ncis(a.size());
+ std::vector<const DataArrayIdType *> ncs(a.size()),ncis(a.size());
(*it)->getNumberOfCells();//to check that all is OK
const DataArrayDouble *coords=(*it)->getCoords();
const INTERP_KERNEL::CellModel *cm=&((*it)->getCellModel());
}
MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh("merge",*cm));
ret->setCoords(coords);
- ret->_conn=DataArrayInt::Aggregate(ncs);
- ret->_conn_indx=DataArrayInt::AggregateIndexes(ncis);
+ ret->_conn=DataArrayIdType::Aggregate(ncs);
+ ret->_conn_indx=DataArrayIdType::AggregateIndexes(ncis);
return ret.retn();
}
if(a.empty())
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::Merge1DGTUMeshes : input array must be NON EMPTY !");
std::vector< MCAuto<MEDCoupling1DGTUMesh> > objs(a.size());
- std::vector<const DataArrayInt *> ncs(a.size()),ncis(a.size());
+ std::vector<const DataArrayIdType *> ncs(a.size()),ncis(a.size());
std::vector<const MEDCoupling1DGTUMesh *>::const_iterator it=a.begin();
- std::vector<int> nbNodesPerElt(a.size());
- int nbOfCells=(*it)->getNumberOfCells();
+ std::vector<mcIdType> nbNodesPerElt(a.size());
+ std::size_t nbOfCells=(*it)->getNumberOfCells();
bool tmp;
objs[0]=(*it)->copyWithNodalConnectivityPacked(tmp);
ncs[0]=objs[0]->getNodalConnectivity(); ncis[0]=objs[0]->getNodalConnectivityIndex();
nbNodesPerElt[0]=0;
- int prevNbOfNodes=(*it)->getNumberOfNodes();
+ mcIdType prevNbOfNodes=(*it)->getNumberOfNodes();
const INTERP_KERNEL::CellModel *cm=&((*it)->getCellModel());
it++;
for(int i=1;it!=a.end();i++,it++)
MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh("merge",*cm));
ret->setCoords(pts);
ret->_conn=AggregateNodalConnAndShiftNodeIds(ncs,nbNodesPerElt);
- ret->_conn_indx=DataArrayInt::AggregateIndexes(ncis);
+ ret->_conn_indx=DataArrayIdType::AggregateIndexes(ncis);
return ret.retn();
}
-MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::buildSetInstanceFromThis(int spaceDim) const
+MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::buildSetInstanceFromThis(std::size_t spaceDim) const
{
MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
- MCAuto<DataArrayInt> tmp1,tmp2;
- const DataArrayInt *nodalConn(_conn),*nodalConnI(_conn_indx);
+ MCAuto<DataArrayIdType> tmp1,tmp2;
+ const DataArrayIdType *nodalConn(_conn),*nodalConnI(_conn_indx);
if(!nodalConn)
{
- tmp1=DataArrayInt::New(); tmp1->alloc(0,1);
+ tmp1=DataArrayIdType::New(); tmp1->alloc(0,1);
}
else
tmp1=_conn;
//
if(!nodalConnI)
{
- tmp2=DataArrayInt::New(); tmp2->alloc(1,1); tmp2->setIJ(0,0,0);
+ tmp2=DataArrayIdType::New(); tmp2->alloc(1,1); tmp2->setIJ(0,0,0);
}
else
tmp2=_conn_indx;
DataArrayDouble *MEDCoupling1DGTUMesh::getBoundingBoxForBBTree(double arcDetEps) const
{
checkFullyDefined();
- int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
+ mcIdType spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
- for(int i=0;i<nbOfCells*spaceDim;i++)
+ for(mcIdType i=0;i<nbOfCells*spaceDim;i++)
{
bbox[2*i]=std::numeric_limits<double>::max();
bbox[2*i+1]=-std::numeric_limits<double>::max();
}
const double *coordsPtr(_coords->getConstPointer());
- const int *conn(_conn->getConstPointer()),*connI(_conn_indx->getConstPointer());
- for(int i=0;i<nbOfCells;i++)
+ const mcIdType *conn(_conn->getConstPointer()),*connI(_conn_indx->getConstPointer());
+ for(mcIdType i=0;i<nbOfCells;i++)
{
- int offset=connI[i];
- int nbOfNodesForCell(connI[i+1]-offset),kk(0);
- for(int j=0;j<nbOfNodesForCell;j++)
+ mcIdType offset=connI[i];
+ mcIdType nbOfNodesForCell(connI[i+1]-offset),kk(0);
+ for(mcIdType j=0;j<nbOfNodesForCell;j++)
{
- int nodeId=conn[offset+j];
+ mcIdType nodeId=conn[offset+j];
if(nodeId>=0 && nodeId<nbOfNodes)
{
for(int k=0;k<spaceDim;k++)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::computeDiameterField : not implemented yet for dynamic types !");
}
-std::vector<int> MEDCoupling1DGTUMesh::BuildAPolygonFromParts(const std::vector< std::vector<int> >& parts)
+std::vector<mcIdType> MEDCoupling1DGTUMesh::BuildAPolygonFromParts(const std::vector< std::vector<mcIdType> >& parts)
{
- std::vector<int> ret;
+ std::vector<mcIdType> ret;
if(parts.empty())
return ret;
ret.insert(ret.end(),parts[0].begin(),parts[0].end());
- int ref(ret.back());
+ mcIdType ref(ret.back());
std::size_t sz(parts.size()),nbh(1);
std::vector<bool> b(sz,true); b[0]=false;
while(nbh<sz)
{
checkConsistencyOfConnectivity();
INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::OrientationInverter> oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(getCellModelEnum()));
- int nbCells(getNumberOfCells());
- const int *connI(_conn_indx->begin());
- int *conn(_conn->getPointer());
- for(int i=0;i<nbCells;i++)
+ mcIdType nbCells=getNumberOfCells();
+ const mcIdType *connI(_conn_indx->begin());
+ mcIdType *conn(_conn->getPointer());
+ for(mcIdType i=0;i<nbCells;i++)
oi->operate(conn+connI[i],conn+connI[i+1]);
updateTime();
}
/*!
- * This method performs an aggregation of \a nodalConns (as DataArrayInt::Aggregate does) but in addition of that a shift is applied on the
+ * This method performs an aggregation of \a nodalConns (as DataArrayIdType::Aggregate does) but in addition of that a shift is applied on the
* values contained in \a nodalConns using corresponding offset specified in input \a offsetInNodeIdsPerElt.
* But it also manage the values -1, that have a semantic in MEDCoupling1DGTUMesh class (separator for polyhedron).
*
* \param [in] nodalConns - a list of nodal connectivity arrays same size than \a offsetInNodeIdsPerElt.
* \param [in] offsetInNodeIdsPerElt - a list of offsets to apply.
- * \return DataArrayInt * - A new object (to be managed by the caller) that is the result of the aggregation.
+ * \return DataArrayIdType * - A new object (to be managed by the caller) that is the result of the aggregation.
* \throw If \a nodalConns or \a offsetInNodeIdsPerElt are empty.
* \throw If \a nodalConns and \a offsetInNodeIdsPerElt have not the same size.
* \throw If presence of null pointer in \a nodalConns.
* \throw If presence of not allocated or array with not exactly one component in \a nodalConns.
*/
-DataArrayInt *MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(const std::vector<const DataArrayInt *>& nodalConns, const std::vector<int>& offsetInNodeIdsPerElt)
+DataArrayIdType *MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(const std::vector<const DataArrayIdType *>& nodalConns, const std::vector<mcIdType>& offsetInNodeIdsPerElt)
{
std::size_t sz1(nodalConns.size()),sz2(offsetInNodeIdsPerElt.size());
if(sz1!=sz2)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : input vectors do not have the same size !");
if(sz1==0)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : empty vectors in input !");
- int nbOfTuples=0;
- for(std::vector<const DataArrayInt *>::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++)
+ mcIdType nbOfTuples=0;
+ for(std::vector<const DataArrayIdType *>::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++)
{
if(!(*it))
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : presence of null pointer in input vector !");
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : presence of array with not exactly one component !");
nbOfTuples+=(*it)->getNumberOfTuples();
}
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1);
- int *pt=ret->getPointer();
- int i=0;
- for(std::vector<const DataArrayInt *>::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++,i++)
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(nbOfTuples,1);
+ mcIdType *pt=ret->getPointer();
+ mcIdType i=0;
+ for(std::vector<const DataArrayIdType *>::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++,i++)
{
- int curNbt=(*it)->getNumberOfTuples();
- const int *inPt=(*it)->begin();
- int offset=offsetInNodeIdsPerElt[i];
- for(int j=0;j<curNbt;j++,pt++)
+ mcIdType curNbt=(*it)->getNumberOfTuples();
+ const mcIdType *inPt=(*it)->begin();
+ mcIdType offset=offsetInNodeIdsPerElt[i];
+ for(mcIdType j=0;j<curNbt;j++,pt++)
{
if(inPt[j]!=-1)
*pt=inPt[j]+offset;
std::set<INTERP_KERNEL::NormalizedCellType> gts(m->getAllGeoTypes());
if(gts.size()!=1)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::New : input mesh must have exactly one geometric type !");
- int geoType((int)*gts.begin());
+ mcIdType geoType(ToIdType(*gts.begin()));
MCAuto<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(m->getName(),*gts.begin()));
ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription());
- int nbCells(m->getNumberOfCells());
- MCAuto<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
+ mcIdType nbCells=m->getNumberOfCells();
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New()),connI(DataArrayIdType::New());
conn->alloc(m->getNodalConnectivityArrayLen()-nbCells,1); connI->alloc(nbCells+1,1);
- int *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0;
- const int *cin(m->getNodalConnectivity()->begin()),*ciin(m->getNodalConnectivityIndex()->begin());
- for(int i=0;i<nbCells;i++,ciin++,ci++)
+ mcIdType *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0;
+ const mcIdType *cin(m->getNodalConnectivity()->begin()),*ciin(m->getNodalConnectivityIndex()->begin());
+ for(mcIdType i=0;i<nbCells;i++,ciin++,ci++)
{
if(cin[ciin[0]]==geoType)
{
MEDCOUPLING_EXPORT const INTERP_KERNEL::CellModel& getCellModel() const;
MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
MEDCOUPLING_EXPORT int getMeshDimension() const;
- MEDCOUPLING_EXPORT DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
- MEDCOUPLING_EXPORT std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
- MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(std::size_t cellId) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const;
MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
- MEDCOUPLING_EXPORT std::vector<int> getDistributionOfTypes() const;
- MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType, bool smartPflKiller=true) const;
- MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getDistributionOfTypes() const;
+ MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller=true) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
MEDCOUPLING_EXPORT void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const;
MEDCOUPLING_EXPORT std::string getVTKDataSetType() const;
MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
//
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
- MEDCOUPLING_EXPORT std::size_t getNodalConnectivityLength() const;
+ MEDCOUPLING_EXPORT mcIdType getNodalConnectivityLength() const;
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
- MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const;
- MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const;
+ MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const;
+ MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
- MEDCOUPLING_EXPORT DataArrayInt *getCellsInBoundingBox(const double *bbox, double eps) const;
- MEDCOUPLING_EXPORT DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
- MEDCOUPLING_EXPORT MEDCouplingPointSet *buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const;
- MEDCOUPLING_EXPORT DataArrayInt *findBoundaryNodes() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
+ MEDCOUPLING_EXPORT MEDCouplingPointSet *buildFacePartOfMySelfNode(const mcIdType *start, const mcIdType *end, bool fullyIn) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findBoundaryNodes() const;
MEDCOUPLING_EXPORT MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
- MEDCOUPLING_EXPORT void findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const;
+ MEDCOUPLING_EXPORT void findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const;
MEDCOUPLING_EXPORT static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(const std::vector< const MEDCoupling1GTUMesh *>& parts);
public:
- MEDCOUPLING_EXPORT virtual void allocateCells(int nbOfCells=0) = 0;
- MEDCOUPLING_EXPORT virtual void insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd) = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *getNodalConnectivity() const = 0;
+ MEDCOUPLING_EXPORT virtual void allocateCells(mcIdType nbOfCells=0) = 0;
+ MEDCOUPLING_EXPORT virtual void insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd) = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *getNodalConnectivity() const = 0;
MEDCOUPLING_EXPORT virtual void checkConsistencyOfConnectivity() const = 0;
protected:
MEDCoupling1GTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm);
MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
- MEDCOUPLING_EXPORT std::size_t getNumberOfCells() const;
- MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const;
- MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const;
- MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const;
- MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const;
MEDCOUPLING_EXPORT std::string simpleRepr() const;
MEDCOUPLING_EXPORT std::string advancedRepr() const;
MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
- MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true);
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const;
- MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy);
+ MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy);
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
// overload of MEDCouplingPointSet
MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
- MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const;
- MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const;
+ MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const;
+ MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const;
MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const;
- MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const;
+ MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const;
MEDCOUPLING_EXPORT void checkFullyDefined() const;
- MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<int>& tinyInfo) const;
- MEDCOUPLING_EXPORT DataArrayInt *computeFetchedNodeIds() const;
- MEDCOUPLING_EXPORT DataArrayInt *getNodeIdsInUse(int& nbrOfNodesInUse) const;
- MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(int offset);
- MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap<int,int>& newNodeNumbersO2N);
- MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map<int,int>& newNodeNumbersO2N) override;
- MEDCOUPLING_EXPORT void renumberNodesInConn(const int *newNodeNumbersO2N);
- MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const;
- MEDCOUPLING_EXPORT int getNumberOfNodesInCell(int cellId) const;
+ MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const;
+ MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset);
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap<mcIdType,mcIdType>& newNodeNumbersO2N);
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map<mcIdType,mcIdType>& newNodeNumbersO2N) override;
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N);
+ MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const;
MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const;
MEDCOUPLING_EXPORT void invertOrientationOfAllCells();
// overload of MEDCoupling1GTUMesh
MEDCOUPLING_EXPORT void checkConsistencyOfConnectivity() const;
- MEDCOUPLING_EXPORT void allocateCells(int nbOfCells=0);
- MEDCOUPLING_EXPORT void insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd);
+ MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0);
+ MEDCOUPLING_EXPORT void insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd);
public://specific
- MEDCOUPLING_EXPORT void setNodalConnectivity(DataArrayInt *nodalConn);
- MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivity() const;
- MEDCOUPLING_EXPORT int getNumberOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT void setNodalConnectivity(DataArrayIdType *nodalConn);
+ MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodesPerCell() const;
MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(std::vector<const MEDCoupling1SGTUMesh *>& a);
MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(std::vector<const MEDCoupling1SGTUMesh *>& a);
- MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
+ MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *buildSetInstanceFromThis(std::size_t spaceDim) const;
MEDCOUPLING_EXPORT MEDCoupling1GTUMesh *computeDualMesh() const;
- MEDCOUPLING_EXPORT DataArrayInt *sortHexa8EachOther();
+ MEDCOUPLING_EXPORT DataArrayIdType *sortHexa8EachOther();
MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const;
- MEDCOUPLING_EXPORT MEDCouplingCMesh *structurizeMe(DataArrayInt *& cellPerm, DataArrayInt *& nodePerm, double eps=1e-12) const;
+ MEDCOUPLING_EXPORT MEDCouplingCMesh *structurizeMe(DataArrayIdType *& cellPerm, DataArrayIdType *& nodePerm, double eps=1e-12) const;
public://serialization
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
- MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
+ MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings);
private:
MEDCoupling1SGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm);
private:
void checkNonDynamicGeoType() const;
static MEDCoupling1SGTUMesh *Merge1SGTUMeshesLL(std::vector<const MEDCoupling1SGTUMesh *>& a);
- DataArrayInt *simplexizePol0();
- DataArrayInt *simplexizePol1();
- DataArrayInt *simplexizePlanarFace5();
- DataArrayInt *simplexizePlanarFace6();
+ DataArrayIdType *simplexizePol0();
+ DataArrayIdType *simplexizePol1();
+ DataArrayIdType *simplexizePlanarFace5();
+ DataArrayIdType *simplexizePlanarFace6();
MEDCoupling1DGTUMesh *computeDualMesh3D() const;
MEDCoupling1DGTUMesh *computeDualMesh2D() const;
template<class MAPCLS>
MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
- MEDCOUPLING_EXPORT std::size_t getNumberOfCells() const;
- MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const;
- MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const;
- MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const;
- MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const;
MEDCOUPLING_EXPORT std::string simpleRepr() const;
MEDCOUPLING_EXPORT std::string advancedRepr() const;
MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
- MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true);
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const;
- MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy);
+ MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy);
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
// overload of MEDCouplingPointSet
MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
- MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const;
- MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const;
+ MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const;
+ MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const;
MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const;
- MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const;
+ MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const;
MEDCOUPLING_EXPORT void checkFullyDefined() const;
- MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<int>& tinyInfo) const;
- MEDCOUPLING_EXPORT DataArrayInt *computeFetchedNodeIds() const;
- MEDCOUPLING_EXPORT DataArrayInt *getNodeIdsInUse(int& nbrOfNodesInUse) const;
- MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(int offset);
- MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap<int,int>& newNodeNumbersO2N);
- MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map<int,int>& newNodeNumbersO2N) override;
- MEDCOUPLING_EXPORT void renumberNodesInConn(const int *newNodeNumbersO2N);
- MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const;
- MEDCOUPLING_EXPORT int getNumberOfNodesInCell(int cellId) const;
+ MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const;
+ MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset);
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap<mcIdType,mcIdType>& newNodeNumbersO2N);
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map<mcIdType,mcIdType>& newNodeNumbersO2N) override;
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N);
+ MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const;
MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const;
MEDCOUPLING_EXPORT void invertOrientationOfAllCells();
// overload of MEDCoupling1GTUMesh
MEDCOUPLING_EXPORT void checkConsistencyOfConnectivity() const;
- MEDCOUPLING_EXPORT void allocateCells(int nbOfCells=0);
- MEDCOUPLING_EXPORT void insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd);
+ MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0);
+ MEDCOUPLING_EXPORT void insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd);
public://specific
- MEDCOUPLING_EXPORT void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex);
- MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivity() const;
- MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivityIndex() const;
+ MEDCOUPLING_EXPORT void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex);
+ MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivityIndex() const;
MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *copyWithNodalConnectivityPacked(bool& isShallowCpyOfNodalConnn) const;
- MEDCOUPLING_EXPORT bool retrievePackedNodalConnectivity(DataArrayInt *&nodalConn, DataArrayInt *&nodalConnIndx) const;
+ MEDCOUPLING_EXPORT bool retrievePackedNodalConnectivity(DataArrayIdType *&nodalConn, DataArrayIdType *&nodalConnIndx) const;
MEDCOUPLING_EXPORT bool isPacked() const;
MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(const MEDCoupling1DGTUMesh *mesh1, const MEDCoupling1DGTUMesh *mesh2);
MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(std::vector<const MEDCoupling1DGTUMesh *>& a);
MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(std::vector<const MEDCoupling1DGTUMesh *>& a);
- MEDCOUPLING_EXPORT static DataArrayInt *AggregateNodalConnAndShiftNodeIds(const std::vector<const DataArrayInt *>& nodalConns, const std::vector<int>& offsetInNodeIdsPerElt);
- MEDCOUPLING_EXPORT static std::vector<int> BuildAPolygonFromParts(const std::vector< std::vector<int> >& parts);
- MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
+ MEDCOUPLING_EXPORT static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(const std::vector<const DataArrayIdType *>& nodalConns, const std::vector<mcIdType>& offsetInNodeIdsPerElt);
+ MEDCOUPLING_EXPORT static std::vector<mcIdType> BuildAPolygonFromParts(const std::vector< std::vector<mcIdType> >& parts);
+ MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *buildSetInstanceFromThis(std::size_t spaceDim) const;
public://serialization
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
- MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
+ MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings);
private:
MEDCoupling1DGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm);
void MEDCoupling::MEDCoupling1SGTUMesh::renumberNodesInConnT(const MAPCLS& newNodeNumbersO2N)
{
getNumberOfCells();//only to check that all is well defined.
- int *begPtr(_conn->getPointer());
- int nbElt(_conn->getNumberOfTuples());
- int *endPtr(begPtr+nbElt);
- for(int *it=begPtr;it!=endPtr;it++)
+ mcIdType *begPtr(_conn->getPointer());
+ mcIdType nbElt(_conn->getNumberOfTuples());
+ mcIdType *endPtr(begPtr+nbElt);
+ for(mcIdType *it=begPtr;it!=endPtr;it++)
{
auto it2(newNodeNumbersO2N.find(*it));
if(it2!=newNodeNumbersO2N.end())
{
getNumberOfCells();//only to check that all is well defined.
//
- int nbOfTuples(_conn->getNumberOfTuples());
- int *pt(_conn->getPointer());
- for(int i=0;i<nbOfTuples;i++,pt++)
+ mcIdType nbOfTuples(_conn->getNumberOfTuples());
+ mcIdType *pt(_conn->getPointer());
+ for(mcIdType i=0;i<nbOfTuples;i++,pt++)
{
if(*pt==-1) continue;
if(*pt>=0)
return new DataArrayDoubleCollection(*this);
}
-void DataArrayDoubleCollection::allocTuples(int nbOfTuples)
+void DataArrayDoubleCollection::allocTuples(mcIdType nbOfTuples)
{
std::size_t sz(_arrs.size());
for(std::size_t i=0;i<sz;i++)
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
-DataArrayDouble *DataArrayDoubleCollection::at(int pos)
+DataArrayDouble *DataArrayDoubleCollection::at(mcIdType pos)
{
- if(pos<0 || pos>=(int)_arrs.size())
+ if(pos<0 || pos>=ToIdType(_arrs.size()))
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::at (non const) : pos must be in [0,nbOfFields) !");
return _arrs[pos].first;
}
-const DataArrayDouble *DataArrayDoubleCollection::at(int pos) const
+const DataArrayDouble *DataArrayDoubleCollection::at(mcIdType pos) const
{
- if(pos<0 || pos>=(int)_arrs.size())
+ if(pos<0 || pos>=ToIdType(_arrs.size()))
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::at : pos must be in [0,nbOfFields) !");
return _arrs[pos].first;
}
-int DataArrayDoubleCollection::size() const
+mcIdType DataArrayDoubleCollection::size() const
{
- return (int)_arrs.size();
+ return ToIdType(_arrs.size());
}
-void DataArrayDoubleCollection::SynchronizeFineToCoarse(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *fine, DataArrayDoubleCollection *coarse)
+void DataArrayDoubleCollection::SynchronizeFineToCoarse(mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, mcIdType patchId, const DataArrayDoubleCollection *fine, DataArrayDoubleCollection *coarse)
{
if(!fine || !coarse)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineToCoarse : the input DataArrayDouble collections must be non NULL !");
}
}
-void DataArrayDoubleCollection::SynchronizeCoarseToFine(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine)
+void DataArrayDoubleCollection::SynchronizeCoarseToFine(mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, mcIdType patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine)
{
if(!fine || !coarse)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFine : the input DataArrayDouble collections must be non NULL !");
}
}
-void DataArrayDoubleCollection::SynchronizeFineEachOther(int patchId, int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, const std::vector<const MEDCouplingCartesianAMRMeshGen *>& children, const std::vector<DataArrayDoubleCollection *>& fieldsOnFine)
+void DataArrayDoubleCollection::SynchronizeFineEachOther(mcIdType patchId, mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, const std::vector<const MEDCouplingCartesianAMRMeshGen *>& children, const std::vector<DataArrayDoubleCollection *>& fieldsOnFine)
{
if(!fatherOfFineMesh)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineEachOther : father is NULL !");
return ;
std::size_t nbOfCall(fieldsOnFine[0]->_arrs.size());
for(std::size_t i=0;i<sz;i++)
- if(fatherOfFineMesh->getPatchIdFromChildMesh(children[i])!=(int)i)
+ if(fatherOfFineMesh->getPatchIdFromChildMesh(children[i])!=ToIdType(i))
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineEachOther : internal error !");
for(std::size_t i=1;i<sz;i++)
if(nbOfCall!=fieldsOnFine[i]->_arrs.size())
/*!
* This method updates \a p1dac ghost zone parts using \a p2dac (which is really const). \a p2 is in the neighborhood of \a p1 (which size is defined by \a ghostLev).
*/
-void DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const DataArrayDoubleCollection *p1dac, const MEDCouplingCartesianAMRPatch *p2, const DataArrayDoubleCollection *p2dac)
+void DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const DataArrayDoubleCollection *p1dac, const MEDCouplingCartesianAMRPatch *p2, const DataArrayDoubleCollection *p2dac)
{
if(!p1 || !p1dac || !p2 || !p2dac)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo : input pointer must be not NULL !");
}
}
-void DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine)
+void DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone(mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, mcIdType patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine)
{
if(!fine || !coarse)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone : the input DataArrayDouble collections must be non NULL !");
fatherOfFineMesh->fillCellFieldOnPatchOnlyOnGhostZone(patchId,coarse->_arrs[i].first,fine->_arrs[i].first,ghostLev);
}
-void DataArrayDoubleCollection::synchronizeMyGhostZoneUsing(int ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp, const MEDCouplingCartesianAMRMeshGen *father) const
+void DataArrayDoubleCollection::synchronizeMyGhostZoneUsing(mcIdType ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp, const MEDCouplingCartesianAMRMeshGen *father) const
{
DataArrayDoubleCollection *thisNC(const_cast<DataArrayDoubleCollection *>(this));
std::size_t sz(_arrs.size());
father->fillCellFieldOnPatchOnlyOnGhostZoneWith(ghostLev,thisp,otherp,thisNC->_arrs[i].first,other._arrs[i].first);
}
-void DataArrayDoubleCollection::synchronizeMyGhostZoneUsingExt(int ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp) const
+void DataArrayDoubleCollection::synchronizeMyGhostZoneUsingExt(mcIdType ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp) const
{
DataArrayDoubleCollection *thisNC(const_cast<DataArrayDoubleCollection *>(this));
std::size_t sz(_arrs.size());
_arrs[i].first=DataArrayDouble::New();
_arrs[i].first->alloc(0,info.second);
_arrs[i].first->setName(info.first);
- names[i]=info.second;
+ names[i]=info.first;
_arrs[i].second=IntensiveMaximum;
}
CheckDiscriminantNames(names);
return new MEDCouplingGridCollection(*this,newGf,oldGf);
}
-void MEDCouplingGridCollection::alloc(int ghostLev)
+void MEDCouplingGridCollection::alloc(mcIdType ghostLev)
{
for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
{
- int nbTuples((*it).first->getNumberOfCellsAtCurrentLevelGhost(ghostLev));
+ mcIdType nbTuples((*it).first->getNumberOfCellsAtCurrentLevelGhost(ghostLev));
DataArrayDoubleCollection *dadc((*it).second);
if(dadc)
dadc->allocTuples(nbTuples);
return elt->getNatures();
}
-bool MEDCouplingGridCollection::presenceOf(const MEDCouplingCartesianAMRMeshGen *m, int& pos) const
+bool MEDCouplingGridCollection::presenceOf(const MEDCouplingCartesianAMRMeshGen *m, mcIdType& pos) const
{
- int ret(0);
+ mcIdType ret(0);
for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++,ret++)
{
if((*it).first==m)
return false;
}
-const DataArrayDoubleCollection& MEDCouplingGridCollection::getFieldsAt(int pos) const
+const DataArrayDoubleCollection& MEDCouplingGridCollection::getFieldsAt(mcIdType pos) const
{
- if(pos<0 || pos>(int)_map_of_dadc.size())
+ if(pos<0 || pos>ToIdType(_map_of_dadc.size()))
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::getFieldsAt : invalid pos given in input ! Must be in [0,size) !");
return *_map_of_dadc[pos].second;
}
-DataArrayDoubleCollection& MEDCouplingGridCollection::getFieldsAt(int pos)
+DataArrayDoubleCollection& MEDCouplingGridCollection::getFieldsAt(mcIdType pos)
{
- if(pos<0 || pos>(int)_map_of_dadc.size())
+ if(pos<0 || pos>ToIdType(_map_of_dadc.size()))
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::getFieldsAt (non const) : invalid pos given in input ! Must be in [0,size) !");
return *_map_of_dadc[pos].second;
}
* part of fields of \a this. The fields are expected to be the same between \a other and \a this.
* This methods makes the hypothesis that \a this and \a other share two god father that are compatible each other that is to say with the same cell grid structure.
*/
-void MEDCouplingGridCollection::copyOverlappedZoneFrom(int ghostLev, const MEDCouplingGridCollection& other)
+void MEDCouplingGridCollection::copyOverlappedZoneFrom(mcIdType ghostLev, const MEDCouplingGridCollection& other)
{
for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
{
- std::vector<int> deltaThis,deltaOther;
- std::vector< std::pair<int,int> > rgThis((*it).first->positionRelativeToGodFather(deltaThis));
- std::vector<int> thisSt((*it).first->getImageMesh()->getCellGridStructure());
- std::transform(thisSt.begin(),thisSt.end(),thisSt.begin(),std::bind2nd(std::plus<int>(),2*ghostLev));
+ std::vector<mcIdType> deltaThis,deltaOther;
+ std::vector< std::pair<mcIdType,mcIdType> > rgThis((*it).first->positionRelativeToGodFather(deltaThis));
+ std::vector<mcIdType> thisSt((*it).first->getImageMesh()->getCellGridStructure());
+ std::transform(thisSt.begin(),thisSt.end(),thisSt.begin(),std::bind2nd(std::plus<mcIdType>(),2*ghostLev));
for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it2=other._map_of_dadc.begin();it2!=other._map_of_dadc.end();it2++)
{
- std::vector< std::pair<int,int> > rgOther((*it2).first->positionRelativeToGodFather(deltaOther));
+ std::vector< std::pair<mcIdType,mcIdType> > rgOther((*it2).first->positionRelativeToGodFather(deltaOther));
if(MEDCouplingStructuredMesh::AreRangesIntersect(rgThis,rgOther))
{
- std::vector< std::pair<int,int> > isect(MEDCouplingStructuredMesh::IntersectRanges(rgThis,rgOther));
- std::vector< std::pair<int,int> > pThis,pOther;
+ std::vector< std::pair<mcIdType,mcIdType> > isect(MEDCouplingStructuredMesh::IntersectRanges(rgThis,rgOther));
+ std::vector< std::pair<mcIdType,mcIdType> > pThis,pOther;
MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(rgThis,isect,pThis,true);
MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(rgOther,isect,pOther,true);
- std::vector<int> otherSt((*it2).first->getImageMesh()->getCellGridStructure());
+ std::vector<mcIdType> otherSt((*it2).first->getImageMesh()->getCellGridStructure());
MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(pThis,ghostLev);
MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(pOther,ghostLev);
- std::transform(otherSt.begin(),otherSt.end(),otherSt.begin(),std::bind2nd(std::plus<int>(),2*ghostLev));
- int sz((*it2).second->size());
- for(int i=0;i<sz;i++)
+ std::transform(otherSt.begin(),otherSt.end(),otherSt.begin(),std::bind2nd(std::plus<mcIdType>(),2*ghostLev));
+ mcIdType sz((*it2).second->size());
+ for(mcIdType i=0;i<sz;i++)
{
const DataArrayDouble *otherArr((*it2).second->at(i));
DataArrayDouble *thisArr((*it).second->at(i));
}
}
-void MEDCouplingGridCollection::SynchronizeFineToCoarse(int ghostLev, const MEDCouplingGridCollection *fine, const MEDCouplingGridCollection *coarse)
+void MEDCouplingGridCollection::SynchronizeFineToCoarse(mcIdType ghostLev, const MEDCouplingGridCollection *fine, const MEDCouplingGridCollection *coarse)
{
if(!fine || !coarse)
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeFineToCoarse : one or more input pointer is NULL !");
if((*it0).first==fatherOfFineMesh)
{
found=true;
- int patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
+ mcIdType patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
const DataArrayDoubleCollection *coarseDaCol((*it0).second);
DataArrayDoubleCollection *coarseModified(const_cast<DataArrayDoubleCollection *>(coarseDaCol));//coarse values in DataArrayDouble will be altered
DataArrayDoubleCollection::SynchronizeFineToCoarse(ghostLev,fatherOfFineMesh,patchId,(*it).second,coarseModified);
}
}
-void MEDCouplingGridCollection::SynchronizeCoarseToFine(int ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine)
+void MEDCouplingGridCollection::SynchronizeCoarseToFine(mcIdType ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine)
{
if(!fine || !coarse)
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFine : one or more input pointer is NULL !");
if((*it0).first==fatherOfFineMesh)
{
found=true;
- int patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
+ mcIdType patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
const DataArrayDoubleCollection *fineDaCol((*it).second);
DataArrayDoubleCollection *fineModified(const_cast<DataArrayDoubleCollection *>(fineDaCol));//fine values in DataArrayDouble will be altered
DataArrayDoubleCollection::SynchronizeCoarseToFine(ghostLev,fatherOfFineMesh,patchId,(*it0).second,fineModified);
*
* \sa synchronizeFineEachOtherExt
*/
-void MEDCouplingGridCollection::synchronizeFineEachOther(int ghostLev, const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& ps) const
+void MEDCouplingGridCollection::synchronizeFineEachOther(mcIdType ghostLev, const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& ps) const
{
for(std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >::const_iterator it=ps.begin();it!=ps.end();it++)
{
- int p1,p2;
+ mcIdType p1,p2;
if(!presenceOf((*it).first->getMesh(),p1))
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOther : internal error #1 !");
if(!presenceOf((*it).second->getMesh(),p2))
*
* \sa synchronizeFineEachOther
*/
-void MEDCouplingGridCollection::synchronizeFineEachOtherExt(int ghostLev, const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& ps) const
+void MEDCouplingGridCollection::synchronizeFineEachOtherExt(mcIdType ghostLev, const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& ps) const
{
for(std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >::const_iterator it=ps.begin();it!=ps.end();it++)
{
- int p1,p2;
+ mcIdType p1,p2;
if(!presenceOf((*it).first->getMesh(),p1))
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOtherExt : internal error #1 !");
if(!presenceOf((*it).second->getMesh(),p2))
/*!
* The pairs returned share the same direct father. The number of returned elements must be even.
*/
-std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > MEDCouplingGridCollection::findNeighbors(int ghostLev) const
+std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > MEDCouplingGridCollection::findNeighbors(mcIdType ghostLev) const
{
std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > ret;
std::map<const MEDCouplingCartesianAMRMeshGen *,std::vector< const MEDCouplingCartesianAMRMeshGen * > > m;
{
for(std::vector<const MEDCouplingCartesianAMRMeshGen *>::const_iterator it1=(*it0).second.begin();it1!=(*it0).second.end();it1++)
{
- int patchId((*it0).first->getPatchIdFromChildMesh(*it1));
- std::vector<int> neighs((*it0).first->getPatchIdsInTheNeighborhoodOf(patchId,ghostLev));
+ mcIdType patchId((*it0).first->getPatchIdFromChildMesh(*it1));
+ std::vector<mcIdType> neighs((*it0).first->getPatchIdsInTheNeighborhoodOf(patchId,ghostLev));
const MEDCouplingCartesianAMRPatch *pRef((*it0).first->getPatch(patchId));
- for(std::vector<int>::const_iterator it2=neighs.begin();it2!=neighs.end();it2++)
+ for(std::vector<mcIdType>::const_iterator it2=neighs.begin();it2!=neighs.end();it2++)
{
const MEDCouplingCartesianAMRPatch *pLoc((*it0).first->getPatch(*it2));
ret.push_back(std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *>(pRef,pLoc));
return ret;
}
-void MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone(int ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine)
+void MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone(mcIdType ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine)
{
if(!fine || !coarse)
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone : one or more input pointer is NULL !");
if((*it0).first==fatherOfFineMesh)
{
found=true;
- int patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
+ mcIdType patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
const DataArrayDoubleCollection *fineDaCol((*it).second);
DataArrayDoubleCollection *fineModified(const_cast<DataArrayDoubleCollection *>(fineDaCol));//fine values in DataArrayDouble will be altered
DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone(ghostLev,fatherOfFineMesh,patchId,(*it0).second,fineModified);
std::size_t sz(other._map_of_dadc.size());
for(std::size_t i=0;i<sz;i++)
{
- std::vector<int> pos(other._map_of_dadc[i].first->getPositionRelativeTo(oldGf));
+ std::vector<mcIdType> pos(other._map_of_dadc[i].first->getPositionRelativeTo(oldGf));
_map_of_dadc[i].first=newGf->getMeshAtPosition(pos);
const DataArrayDoubleCollection *dac(other._map_of_dadc[i].second);
if(dac)
/*!
* This method creates, attach to a main AMR mesh \a gf ( called god father :-) ) and returns a data linked to \a gf ready for the computation.
*/
-MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string,int> >& fieldNames, int ghostLev)
+MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string,int> >& fieldNames, mcIdType ghostLev)
{
return new MEDCouplingAMRAttribute(gf,fieldNames,ghostLev);
}
-MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string, std::vector<std::string> > >& fieldNames, int ghostLev)
+MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string, std::vector<std::string> > >& fieldNames, mcIdType ghostLev)
{
std::size_t sz(fieldNames.size());
std::vector< std::pair<std::string,int> > fieldNames2(sz);
* Returns the number of levels by \b only \b considering \a this (god father instance is considered only to see if it has not changed still last update of \a this).
*
*/
-int MEDCouplingAMRAttribute::getNumberOfLevels() const
+mcIdType MEDCouplingAMRAttribute::getNumberOfLevels() const
{
checkGodFatherFrozen();
- return (int)_levs.size();
+ return ToIdType(_levs.size());
}
/*!
{
for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
{
- int tmp(-1);
+ mcIdType tmp(-1);
if((*it)->presenceOf(mesh,tmp))
{
const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
{
for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
{
- int tmp(-1);
+ mcIdType tmp(-1);
if((*it)->presenceOf(mesh,tmp))
{
const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
{
for(std::vector< MCAuto<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
{
- int tmp(-1);
+ mcIdType tmp(-1);
if((*it)->presenceOf(mesh,tmp))
{
DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
std::size_t lev(0);
for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++,lev++)
{
- int tmp(-1);
+ mcIdType tmp(-1);
if((*it)->presenceOf(mesh,tmp))
{
const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
const DataArrayDouble *arr(0);
for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
{
- int tmp(-1);
+ mcIdType tmp(-1);
if((*it)->presenceOf(mesh,tmp))
{
const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
const DataArrayDouble *arr(0);
for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
{
- int tmp(-1);
+ mcIdType tmp(-1);
if((*it)->presenceOf(mesh,tmp))
{
const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost : the mesh specified is not in the progeny of this !");
//
MCAuto<MEDCouplingIMesh> im(mesh->getImageMesh()->buildWithGhost(_ghost_lev));
- std::vector<int> cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure());
+ std::vector<mcIdType> cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure());
MCAuto<DataArrayDouble> arr2(DataArrayDouble::New());
arr2->alloc(mesh->getImageMesh()->getNumberOfCells(),arr->getNumberOfComponents());
- std::vector< std::pair<int,int> > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs));
+ std::vector< std::pair<mcIdType,mcIdType> > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs));
MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(cgs2,_ghost_lev);
- std::vector<int> fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1);
+ std::vector<mcIdType> fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1);
MEDCouplingIMesh::SpreadCoarseToFine(arr,cgsWG,arr2,cgs2,fakeFactors);
arr2->copyStringInfoFrom(*arr);
//
const MEDCouplingIMesh *gfm(gf->getImageMesh());
std::vector<double> orig(gfm->getOrigin());
std::vector<double> spacing(gfm->getDXYZ());
- int dim((int)orig.size());
+ mcIdType dim(ToIdType(orig.size()));
std::copy(orig.begin(),orig.end(),std::ostream_iterator<double>(ofs," ")); ofs << "\" grid_description=\"";
- for(int i=0;i<dim;i++)
+ for(mcIdType i=0;i<dim;i++)
{
- char tmp[2]; tmp[0]='X'+i; tmp[1]='\0';
+ char tmp[2]; tmp[0]=(char)(int('X')+i); tmp[1]='\0';
ofs << tmp;
}
ofs << "\">\n";
//
- int maxLev(gf->getMaxNumberOfLevelsRelativeToThis()),kk(0);
- for(int i=0;i<maxLev;i++)
+ mcIdType maxLev(gf->getMaxNumberOfLevelsRelativeToThis()),kk(0);
+ for(mcIdType i=0;i<maxLev;i++)
{
std::vector<MEDCouplingCartesianAMRPatchGen *> patches(gf->retrieveGridsAt(i));
std::size_t sz(patches.size());
ofs << "\">\n";
if(i!=maxLev-1)
{
- std::vector<int> factors(patches[0]->getMesh()->getFactors());
- for(int k=0;k<dim;k++)
+ std::vector<mcIdType> factors(patches[0]->getMesh()->getFactors());
+ for(mcIdType k=0;k<dim;k++)
spacing[k]*=1./((double) factors[k]);
}
std::size_t jj(0);
const MEDCouplingCartesianAMRMeshGen *mesh((*it)->getMesh());
if(patchCast)
{
- const std::vector< std::pair<int,int> >& bltr(patchCast->getBLTRRangeRelativeToGF());
- for(int pp=0;pp<dim;pp++)
+ const std::vector< std::pair<mcIdType,mcIdType> >& bltr(patchCast->getBLTRRangeRelativeToGF());
+ for(mcIdType pp=0;pp<dim;pp++)
ofs << bltr[pp].first << " " << bltr[pp].second-1 << " ";
}
else
{
const MEDCouplingIMesh *im((*it)->getMesh()->getImageMesh());
- std::vector<int> cgs(im->getCellGridStructure());
- for(int pp=0;pp<dim;pp++)
+ std::vector<mcIdType> cgs(im->getCellGridStructure());
+ for(mcIdType pp=0;pp<dim;pp++)
ofs << "0 " << cgs[pp]-1 << " ";
}
ofs << "\" file=\"";
//
- int tmp(-1);
+ mcIdType tmp(-1);
if(_levs[i]->presenceOf((*it)->getMesh(),tmp))
{
const DataArrayDoubleCollection& ddc(_levs[i]->getFieldsAt(tmp));
for(std::size_t pp=0;pp<nbFields;pp++)
{
MCAuto<MEDCouplingIMesh> im(mesh->getImageMesh()->buildWithGhost(_ghost_lev));
- std::vector<int> cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure());
+ std::vector<mcIdType> cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure());
arrs2Safe[pp]=DataArrayDouble::New();
arrs2Safe[pp]->alloc(mesh->getImageMesh()->getNumberOfCells(),arrs[pp]->getNumberOfComponents());
- std::vector< std::pair<int,int> > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs));
+ std::vector< std::pair<mcIdType,mcIdType> > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs));
MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(cgs2,_ghost_lev);
- std::vector<int> fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1);
+ std::vector<mcIdType> fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1);
MEDCouplingIMesh::SpreadCoarseToFine(arrs[pp],cgsWG,arrs2Safe[pp],cgs2,fakeFactors);
arrs2Safe[pp]->copyStringInfoFrom(*arrs[pp]);
//
MCAuto<MEDCouplingAMRAttribute> ret(MEDCouplingAMRAttribute::New(targetGF,fieldNames,_ghost_lev));
ret->spillNatures(lev0->getNatures());
ret->alloc();
- int nbLevs(getNumberOfLevels());
+ mcIdType nbLevs(getNumberOfLevels());
if(targetGF->getMaxNumberOfLevelsRelativeToThis()!=nbLevs)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::projectTo : number of levels of this and targetGF must be the same !");
// first step copy level0
DataArrayDoubleCollection& colTarget(ret->_levs[0]->getFieldsAt(0));
colTarget.copyFrom(col);
// then go deeper and deeper
- for(int i=1;i<nbLevs;i++)
+ for(mcIdType i=1;i<nbLevs;i++)
{
ret->synchronizeCoarseToFineByOneLevel(i-1);
MEDCouplingGridCollection *targetCol(ret->_levs[i]);
while(sz>1)
{
sz--;
- synchronizeFineToCoarseByOneLevel((int)sz);
+ synchronizeFineToCoarseByOneLevel(ToIdType(sz));
}
}
* \param [in] toLev - an existing level considered as the target level to reach.
*
*/
-void MEDCouplingAMRAttribute::synchronizeFineToCoarseBetween(int fromLev, int toLev)
+void MEDCouplingAMRAttribute::synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev)
{
- int nbl(getNumberOfLevels());
+ mcIdType nbl(getNumberOfLevels());
if(fromLev<0 || toLev<0 || fromLev>=nbl || toLev>=nbl)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineToCoarseBetween : fromLev and toLev must be >= 0 and lower than number of levels in this !");
if(fromLev==toLev)
return ;//nothing to do
if(fromLev<toLev)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineToCoarseBetween : the fromLev level is lower than toLev level ! Call synchronizeFineToCoarseBetween ");
- for(int i=fromLev;i>toLev;i--)
+ for(mcIdType i=fromLev;i>toLev;i--)
synchronizeFineToCoarseByOneLevel(i);
}
std::size_t sz(_levs.size());
//
for(std::size_t i=0;i<sz-1;i++)
- synchronizeCoarseToFineByOneLevel((int)i);
+ synchronizeCoarseToFineByOneLevel(ToIdType(i));
}
/*!
* \param [in] fromLev - an existing level considered as coarse so lower than \a toLev
* \param [in] toLev - an existing level considered as the target level to reach.
*/
-void MEDCouplingAMRAttribute::synchronizeCoarseToFineBetween(int fromLev, int toLev)
+void MEDCouplingAMRAttribute::synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev)
{
- int nbl(getNumberOfLevels());
+ mcIdType nbl(getNumberOfLevels());
if(fromLev<0 || toLev<0 || fromLev>=nbl || toLev>=nbl)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeCoarseToFineBetween : fromLev and toLev must be >= 0 and lower than number of levels in this !");
if(fromLev==toLev)
return ;//nothing to do
if(fromLev>toLev)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeCoarseToFineBetween : the fromLev level is greater than toLev level ! Call synchronizeFineToCoarseBetween instead !");
- for(int i=fromLev;i<toLev;i++)
+ for(mcIdType i=fromLev;i<toLev;i++)
synchronizeCoarseToFineByOneLevel(i);
}
*/
void MEDCouplingAMRAttribute::synchronizeAllGhostZones()
{
- int sz(getNumberOfLevels());
+ mcIdType sz(getNumberOfLevels());
if(sz==0)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineEachOther : not any levels in this !");
// 1st - synchronize from coarse to the finest all the patches (excepted the god father one)
- for(int i=1;i<sz;i++)
+ for(mcIdType i=1;i<sz;i++)
{
const MEDCouplingGridCollection *fine(_levs[i]),*coarse(_levs[i-1]);
MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone(_ghost_lev,coarse,fine);
}
// 2nd - classical direct sublevel inside common patch
- for(int i=1;i<sz;i++)
+ for(mcIdType i=1;i<sz;i++)
{
const MEDCouplingGridCollection *curLev(_levs[i]);
if(!curLev)
DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(_ghost_lev,(*it).first,firstDAC,(*it).second,secondDAC);
}
// 4th - same level but with far ancestor.
- for(int i=1;i<sz;i++)
+ for(mcIdType i=1;i<sz;i++)
{
const MEDCouplingGridCollection *fine(_levs[i]);
fine->synchronizeFineEachOtherExt(_ghost_lev,_cross_lev_neighbors[i]);
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeAllGhostZonesOfDirectChidrenOf : input mesh is NULL !");
- int level(mesh->getAbsoluteLevelRelativeTo(_gf)),sz(getNumberOfLevels());
+ mcIdType level(mesh->getAbsoluteLevelRelativeTo(_gf)),sz(getNumberOfLevels());
if(level<0 || level>=sz-1)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeAllGhostZonesOfDirectChidrenOf : the specified level does not exist ! Must be in [0,nbOfLevelsOfThis-1) !");
const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& itemsToFilter(_neighbors[level+1]);
* This method updates \b all the patches at level \a level each other without consideration of their father.
* So this method is more time consuming than synchronizeAllGhostZonesOfDirectChidrenOf.
*/
-void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevel(int level)
+void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level)
{
- int maxLev(getNumberOfLevels());
+ mcIdType maxLev(getNumberOfLevels());
if(level<0 || level>=maxLev)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevel : the specified level must be in [0,maxLevel) !");
if(level==0)
* This method updates ghost zones of patches at level \a level whatever their father \b using \b father \b patches \b ONLY (at level \b level - 1).
* This method is useful to propagate to the ghost zone of childhood the modification.
*/
-void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(int level)
+void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level)
{
- int maxLev(getNumberOfLevels());
+ mcIdType maxLev(getNumberOfLevels());
if(level<=0 || level>=maxLev)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather : the specified level must be in (0,maxLevel) !");
const MEDCouplingGridCollection *fine(_levs[level]),*coarse(_levs[level-1]);
{//tony
}
-MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string,int> >& fieldNames, int ghostLev):MEDCouplingDataForGodFather(gf),_ghost_lev(ghostLev)
+MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string,int> >& fieldNames, mcIdType ghostLev):MEDCouplingDataForGodFather(gf),_ghost_lev(ghostLev)
{
//gf non empty, checked by constructor
- int maxLev(gf->getMaxNumberOfLevelsRelativeToThis());
+ mcIdType maxLev(gf->getMaxNumberOfLevelsRelativeToThis());
_levs.resize(maxLev);
- for(int i=0;i<maxLev;i++)
+ for(mcIdType i=0;i<maxLev;i++)
{
std::vector<MEDCouplingCartesianAMRPatchGen *> patches(gf->retrieveGridsAt(i));
std::size_t sz(patches.size());
for(std::size_t j=0;j<sz2;j++)
{
const MEDCouplingCartesianAMRPatch *p1(neigh2[j].first),*p2(neigh2[j].second);
- std::vector<int> pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf));
+ std::vector<mcIdType> pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf));
neigh3[j].first=_gf->getPatchAtPosition(pp1);
neigh3[j].second=_gf->getPatchAtPosition(pp2);
}
for(std::size_t i=0;i<sz;i++)
{
const MEDCouplingCartesianAMRPatch *p1(other._mixed_lev_neighbors[i].first),*p2(other._mixed_lev_neighbors[i].second);
- std::vector<int> pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf));
+ std::vector<mcIdType> pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf));
_mixed_lev_neighbors[i].first=_gf->getPatchAtPosition(pp1);
_mixed_lev_neighbors[i].second=_gf->getPatchAtPosition(pp2);
}
for(std::size_t j=0;j<sz2;j++)
{
const MEDCouplingCartesianAMRPatch *p1(neigh2[j].first),*p2(neigh2[j].second);
- std::vector<int> pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf));
+ std::vector<mcIdType> pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf));
neigh3[j].first=_gf->getPatchAtPosition(pp1);
neigh3[j].second=_gf->getPatchAtPosition(pp2);
}
const MEDCouplingGridCollection *elt(*it);
if(elt)
{
- int tmp(-1);
+ mcIdType tmp(-1);
if(elt->presenceOf(m,tmp))
{
return elt->getFieldsAt(tmp);
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::findCollectionAttachedTo : unable to find such part of mesh in this !");
}
-void MEDCouplingAMRAttribute::synchronizeFineToCoarseByOneLevel(int level)
+void MEDCouplingAMRAttribute::synchronizeFineToCoarseByOneLevel(mcIdType level)
{
- int nbl(getNumberOfLevels());
+ mcIdType nbl(getNumberOfLevels());
if(level<=0 || level>=nbl)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineToCoarseByOneLevel : the input level must be in ]0,nb_of_levels[ !");
const MEDCouplingGridCollection *fine(_levs[level]),*coarse(_levs[level-1]);
MEDCouplingGridCollection::SynchronizeFineToCoarse(_ghost_lev,fine,coarse);
}
-void MEDCouplingAMRAttribute::synchronizeCoarseToFineByOneLevel(int level)
+void MEDCouplingAMRAttribute::synchronizeCoarseToFineByOneLevel(mcIdType level)
{
- int nbl(getNumberOfLevels());
+ mcIdType nbl(getNumberOfLevels());
if(level<0 || level>=nbl-1)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineToCoarseByOneLevel : the input level must be in [0,nb_of_levels[ !");
const MEDCouplingGridCollection *fine(_levs[level+1]),*coarse(_levs[level]);
public:
static DataArrayDoubleCollection *New(const std::vector< std::pair<std::string,int> >& fieldNames);
DataArrayDoubleCollection *deepCopy() const;
- void allocTuples(int nbOfTuples);
+ void allocTuples(mcIdType nbOfTuples);
void dellocTuples();
void copyFrom(const DataArrayDoubleCollection& other);
void spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames);
std::vector<DataArrayDouble *> retrieveFields() const;
const DataArrayDouble *getFieldWithName(const std::string& name) const;
DataArrayDouble *getFieldWithName(const std::string& name);
- DataArrayDouble *at(int pos);
- const DataArrayDouble *at(int pos) const;
- int size() const;
- static void SynchronizeFineToCoarse(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *fine, DataArrayDoubleCollection *coarse);
- static void SynchronizeCoarseToFine(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine);
- static void SynchronizeFineEachOther(int patchId, int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, const std::vector<const MEDCouplingCartesianAMRMeshGen *>& children, const std::vector<DataArrayDoubleCollection *>& fieldsOnFine);
- static void SynchronizeCoarseToFineOnlyInGhostZone(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine);
- static void SynchronizeGhostZoneOfOneUsingTwo(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const DataArrayDoubleCollection *p1dac, const MEDCouplingCartesianAMRPatch *p2, const DataArrayDoubleCollection *p2dac);
- void synchronizeMyGhostZoneUsing(int ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp, const MEDCouplingCartesianAMRMeshGen *father) const;
- void synchronizeMyGhostZoneUsingExt(int ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp) const;
+ DataArrayDouble *at(mcIdType pos);
+ const DataArrayDouble *at(mcIdType pos) const;
+ mcIdType size() const;
+ static void SynchronizeFineToCoarse(mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, mcIdType patchId, const DataArrayDoubleCollection *fine, DataArrayDoubleCollection *coarse);
+ static void SynchronizeCoarseToFine(mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, mcIdType patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine);
+ static void SynchronizeFineEachOther(mcIdType patchId, mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, const std::vector<const MEDCouplingCartesianAMRMeshGen *>& children, const std::vector<DataArrayDoubleCollection *>& fieldsOnFine);
+ static void SynchronizeCoarseToFineOnlyInGhostZone(mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, mcIdType patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine);
+ static void SynchronizeGhostZoneOfOneUsingTwo(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const DataArrayDoubleCollection *p1dac, const MEDCouplingCartesianAMRPatch *p2, const DataArrayDoubleCollection *p2dac);
+ void synchronizeMyGhostZoneUsing(mcIdType ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp, const MEDCouplingCartesianAMRMeshGen *father) const;
+ void synchronizeMyGhostZoneUsingExt(mcIdType ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp) const;
private:
DataArrayDoubleCollection(const std::vector< std::pair<std::string,int> >& fieldNames);
DataArrayDoubleCollection(const DataArrayDoubleCollection& other);
public:
static MEDCouplingGridCollection *New(const std::vector<const MEDCouplingCartesianAMRMeshGen *>& ms, const std::vector< std::pair<std::string,int> >& fieldNames);
MEDCouplingGridCollection *deepCopy(const MEDCouplingCartesianAMRMeshGen *newGf, const MEDCouplingCartesianAMRMeshGen *oldGf) const;
- void alloc(int ghostLev);
+ void alloc(mcIdType ghostLev);
void dealloc();
void spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames);
void spillNatures(const std::vector<NatureOfField>& nfs);
std::vector< std::pair<std::string, std::vector<std::string> > > getInfoOnComponents() const;
std::vector<NatureOfField> getNatures() const;
- bool presenceOf(const MEDCouplingCartesianAMRMeshGen *m, int& pos) const;
- const DataArrayDoubleCollection& getFieldsAt(int pos) const;
- DataArrayDoubleCollection& getFieldsAt(int pos);
- void copyOverlappedZoneFrom(int ghostLev, const MEDCouplingGridCollection& other);
- static void SynchronizeFineToCoarse(int ghostLev, const MEDCouplingGridCollection *fine, const MEDCouplingGridCollection *coarse);
- static void SynchronizeCoarseToFine(int ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine);
- void synchronizeFineEachOther(int ghostLev, const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& ps) const;
- void synchronizeFineEachOtherExt(int ghostLev, const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& ps) const;
- std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > findNeighbors(int ghostLev) const;
- static void SynchronizeCoarseToFineOnlyInGhostZone(int ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine);
+ bool presenceOf(const MEDCouplingCartesianAMRMeshGen *m, mcIdType& pos) const;
+ const DataArrayDoubleCollection& getFieldsAt(mcIdType pos) const;
+ DataArrayDoubleCollection& getFieldsAt(mcIdType pos);
+ void copyOverlappedZoneFrom(mcIdType ghostLev, const MEDCouplingGridCollection& other);
+ static void SynchronizeFineToCoarse(mcIdType ghostLev, const MEDCouplingGridCollection *fine, const MEDCouplingGridCollection *coarse);
+ static void SynchronizeCoarseToFine(mcIdType ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine);
+ void synchronizeFineEachOther(mcIdType ghostLev, const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& ps) const;
+ void synchronizeFineEachOtherExt(mcIdType ghostLev, const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& ps) const;
+ std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > findNeighbors(mcIdType ghostLev) const;
+ static void SynchronizeCoarseToFineOnlyInGhostZone(mcIdType ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine);
void fillIfInTheProgenyOf(const std::string& fieldName, const MEDCouplingCartesianAMRMeshGen *head, std::vector<const DataArrayDouble *>& recurseArrs) const;
private:
MEDCouplingGridCollection(const std::vector<const MEDCouplingCartesianAMRMeshGen *>& ms, const std::vector< std::pair<std::string,int> >& fieldNames);
MEDCOUPLING_EXPORT MEDCouplingCartesianAMRMesh *getMyGodFather();
MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMesh *getMyGodFather() const;
MEDCOUPLING_EXPORT virtual void synchronizeFineToCoarse() = 0;
- MEDCOUPLING_EXPORT virtual void synchronizeFineToCoarseBetween(int fromLev, int toLev) = 0;
+ MEDCOUPLING_EXPORT virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev) = 0;
MEDCOUPLING_EXPORT virtual void synchronizeCoarseToFine() = 0;
- MEDCOUPLING_EXPORT virtual void synchronizeCoarseToFineBetween(int fromLev, int toLev) = 0;
+ MEDCOUPLING_EXPORT virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev) = 0;
MEDCOUPLING_EXPORT virtual void synchronizeAllGhostZones() = 0;
MEDCOUPLING_EXPORT virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh) = 0;
- MEDCOUPLING_EXPORT virtual void synchronizeAllGhostZonesAtASpecifiedLevel(int level) = 0;
- MEDCOUPLING_EXPORT virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(int level) = 0;
+ MEDCOUPLING_EXPORT virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level) = 0;
+ MEDCOUPLING_EXPORT virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level) = 0;
MEDCOUPLING_EXPORT virtual void alloc() = 0;
MEDCOUPLING_EXPORT virtual void dealloc() = 0;
protected:
class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
{
public:
- MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string,int> >& fieldNames, int ghostLev);
- MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string, std::vector<std::string> > >& fieldNames, int ghostLev);
+ MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string,int> >& fieldNames, mcIdType ghostLev);
+ MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string, std::vector<std::string> > >& fieldNames, mcIdType ghostLev);
MEDCOUPLING_EXPORT void spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames);
MEDCOUPLING_EXPORT void spillNatures(const std::vector<NatureOfField>& nfs);
MEDCOUPLING_EXPORT MEDCouplingAMRAttribute *deepCopy() const;
MEDCOUPLING_EXPORT MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
- MEDCOUPLING_EXPORT int getNumberOfLevels() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfLevels() const;
MEDCOUPLING_EXPORT std::vector<DataArrayDouble *> retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const;
MEDCOUPLING_EXPORT const DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
MEDCOUPLING_EXPORT DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName);
MEDCOUPLING_EXPORT MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const;
//
MEDCOUPLING_EXPORT void synchronizeFineToCoarse();
- MEDCOUPLING_EXPORT void synchronizeFineToCoarseBetween(int fromLev, int toLev);
+ MEDCOUPLING_EXPORT void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev);
MEDCOUPLING_EXPORT void synchronizeCoarseToFine();
- MEDCOUPLING_EXPORT void synchronizeCoarseToFineBetween(int fromLev, int toLev);
+ MEDCOUPLING_EXPORT void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev);
MEDCOUPLING_EXPORT void synchronizeAllGhostZones();
MEDCOUPLING_EXPORT void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
- MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevel(int level);
- MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(int level);
+ MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level);
+ MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level);
//
MEDCOUPLING_EXPORT void alloc();
MEDCOUPLING_EXPORT void dealloc();
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDCOUPLING_EXPORT void updateTime() const;
private:
- MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string,int> >& fieldNames, int ghostLev);
+ MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string,int> >& fieldNames, mcIdType ghostLev);
MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& other, bool deepCpyGF);
const DataArrayDoubleCollection& findCollectionAttachedTo(const MEDCouplingCartesianAMRMeshGen *m) const;
- void synchronizeFineToCoarseByOneLevel(int level);
- void synchronizeCoarseToFineByOneLevel(int level);
+ void synchronizeFineToCoarseByOneLevel(mcIdType level);
+ void synchronizeCoarseToFineByOneLevel(mcIdType level);
private:
- int _ghost_lev;
+ mcIdType _ghost_lev;
std::vector< MCAuto<MEDCouplingGridCollection> > _levs;
std::vector< std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > > _neighbors;
std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > _mixed_lev_neighbors;
MEDCouplingCurveLinearMesh *MEDCouplingCMesh::buildCurveLinear() const
{
checkConsistencyLight();
- int dim(getSpaceDimension());
+ std::size_t dim(getSpaceDimension());
MCAuto<MEDCouplingCurveLinearMesh> ret(MEDCouplingCurveLinearMesh::New());
ret->MEDCouplingStructuredMesh::operator=(*this);
- INTERP_KERNEL::AutoPtr<int> ngs(new int[dim]);
+ INTERP_KERNEL::AutoPtr<mcIdType> ngs(new mcIdType[dim]);
getNodeGridStructure(ngs);
ret->setNodeGridStructure(ngs,ngs+dim);
MCAuto<DataArrayDouble> coo(getCoordinatesAndOwner());
}
void MEDCouplingCMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const
{
if(!isEqualWithoutConsideringStr(other,prec))
throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkDeepEquivalWith : Meshes are not the same !");
* The user intend that the nodes are the same, so by construction of MEDCoupling::MEDCouplingCMesh, \a this and \a other are the same !
*/
void MEDCouplingCMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor) const
+ DataArrayIdType *&cellCor) const
{
if(!isEqualWithoutConsideringStr(other,prec))
throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !");
_z_array->checkMonotonic(true, eps);
}
-void MEDCouplingCMesh::getNodeGridStructure(int *res) const
+void MEDCouplingCMesh::getNodeGridStructure(mcIdType *res) const
{
- std::vector<int> ret(getNodeGridStructure());
+ std::vector<mcIdType> ret(getNodeGridStructure());
std::copy(ret.begin(),ret.end(),res);
}
-std::vector<int> MEDCouplingCMesh::getNodeGridStructure() const
+std::vector<mcIdType> MEDCouplingCMesh::getNodeGridStructure() const
{
static const char MSG[]="MEDCouplingCMesh::getNodeGridStructure : mesh is invalid ! null vectors (X, Y or Z) must be put contiguously at the end !";
- std::vector<int> ret;
+ std::vector<mcIdType> ret;
bool isOK(true);
if(_x_array)
{
return ret;
}
-MEDCouplingStructuredMesh *MEDCouplingCMesh::buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const
+MEDCouplingStructuredMesh *MEDCouplingCMesh::buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const
{
checkConsistencyLight();
int dim(getSpaceDimension());
- if(dim!=(int)cellPart.size())
+ if(dim!=ToIdType(cellPart.size()))
{
std::ostringstream oss; oss << "MEDCouplingCMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
return (int)getNodeGridStructure().size();
}
-void MEDCouplingCMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
+void MEDCouplingCMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const
{
- int tmp[3];
+ mcIdType tmp[3];
int spaceDim=getSpaceDimension();
getSplitNodeValues(tmp);
const DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)};
- int tmp2[3];
+ mcIdType tmp2[3];
GetPosFromId(nodeId,spaceDim,tmp,tmp2);
for(int j=0;j<spaceDim;j++)
if(tabs[j])
if(c)
{
const double *coords=c->getConstPointer();
- int nb=c->getNbOfElems();
+ mcIdType nb=ToIdType(c->getNbOfElems());
bbox[2*j]=coords[0];
bbox[2*j+1]=coords[nb-1];
j++;
{
std::string name="MeasureOfMesh_";
name+=getName();
- int nbelem=getNumberOfCells();
+ mcIdType nbelem=ToIdType(getNumberOfCells());
MEDCouplingFieldDouble *field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
field->setName(name);
DataArrayDouble* array=DataArrayDouble::New();
array->decrRef();
field->setMesh(const_cast<MEDCouplingCMesh *>(this));
field->synchronizeTimeWithMesh();
- int tmp[3];
+ mcIdType tmp[3];
getSplitCellValues(tmp);
int dim=getSpaceDimension();
const double **thisArr=new const double *[dim];
const DataArrayDouble *thisArr2[3]={_x_array,_y_array,_z_array};
for(int i=0;i<dim;i++)
thisArr[i]=thisArr2[i]->getConstPointer();
- for(int icell=0;icell<nbelem;icell++)
+ for(mcIdType icell=0;icell<nbelem;icell++)
{
- int tmp2[3];
+ mcIdType tmp2[3];
GetPosFromId(icell,dim,tmp,tmp2);
area_vol[icell]=1.;
for(int i=0;i<dim;i++)
//return 0;
}
-int MEDCouplingCMesh::getCellContainingPoint(const double *pos, double eps) const
+mcIdType MEDCouplingCMesh::getCellContainingPoint(const double *pos, double eps) const
{
int dim=getSpaceDimension();
- int ret=0;
- int coeff=1;
+ mcIdType ret=0;
+ mcIdType coeff=1;
for(int i=0;i<dim;i++)
{
const double *d=getCoordsAt(i)->getConstPointer();
- int nbOfNodes=getCoordsAt(i)->getNbOfElems();
+ mcIdType nbOfNodes=getCoordsAt(i)->getNbOfElems();
double ref=pos[i];
const double *w=std::find_if(d,d+nbOfNodes,std::bind2nd(std::greater_equal<double>(),ref));
- int w2=(int)std::distance(d,w);
+ mcIdType w2=ToIdType(std::distance(d,w));
if(w2<nbOfNodes)
{
if(w2==0)
return ret;
}
-void MEDCouplingCMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const
+void MEDCouplingCMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const
{
- int ret(getCellContainingPoint(pos,eps));
+ mcIdType ret(getCellContainingPoint(pos,eps));
elts.push_back(ret);
}
/*!
* Applies scaling transformation to all nodes of \a this mesh.
- * \param [in] point - coordinates of a scaling center. This array is to be of
+ * \param [in] postd::size_t - coordinates of a scaling center. This array is to be of
* size \a this->getSpaceDimension() at least.
* \param [in] factor - a scale factor.
*/
if(c)
{
double *coords=c->getPointer();
- int lgth=c->getNbOfElems();
+ mcIdType lgth=ToIdType(c->getNbOfElems());
std::transform(coords,coords+lgth,coords,std::bind2nd(std::minus<double>(),point[i]));
std::transform(coords,coords+lgth,coords,std::bind2nd(std::multiplies<double>(),factor));
std::transform(coords,coords+lgth,coords,std::bind2nd(std::plus<double>(),point[i]));
DataArrayDouble *MEDCouplingCMesh::getCoordinatesAndOwner() const
{
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
- int spaceDim(getSpaceDimension()),nbNodes(getNumberOfNodes());
+ int spaceDim(getSpaceDimension());
+ mcIdType nbNodes(getNumberOfNodes());
ret->alloc(nbNodes,spaceDim);
double *pt(ret->getPointer());
- int tmp[3];
+ mcIdType tmp[3];
getSplitNodeValues(tmp);
const DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)};
const double *tabsPtr[3];
- for(int j=0;j<spaceDim;j++)
+ for(mcIdType j=0;j<spaceDim;j++)
{
tabsPtr[j]=tabs[j]->getConstPointer();
ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0));
}
- int tmp2[3];
- for(int i=0;i<nbNodes;i++)
+ mcIdType tmp2[3];
+ for(mcIdType i=0;i<nbNodes;i++)
{
GetPosFromId(i,spaceDim,tmp,tmp2);
for(int j=0;j<spaceDim;j++)
{
DataArrayDouble *ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=ToIdType(getNumberOfCells());
ret->alloc(nbCells,spaceDim);
double *pt=ret->getPointer();
- int tmp[3];
+ mcIdType tmp[3];
getSplitCellValues(tmp);
const DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)};
std::vector<double> tabsPtr[3];
for(int j=0;j<spaceDim;j++)
{
- int sz=tabs[j]->getNbOfElems()-1;
+ mcIdType sz=tabs[j]->getNbOfElems()-1;
ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0));
const double *srcPtr=tabs[j]->getConstPointer();
tabsPtr[j].insert(tabsPtr[j].end(),srcPtr,srcPtr+sz);
std::transform(tabsPtr[j].begin(),tabsPtr[j].end(),srcPtr+1,tabsPtr[j].begin(),std::plus<double>());
std::transform(tabsPtr[j].begin(),tabsPtr[j].end(),tabsPtr[j].begin(),std::bind2nd(std::multiplies<double>(),0.5));
}
- int tmp2[3];
+ mcIdType tmp2[3];
for(int i=0;i<nbCells;i++)
{
GetPosFromId(i,spaceDim,tmp,tmp2);
return MEDCouplingCMesh::computeCellCenterOfMass();
}
-void MEDCouplingCMesh::renumberCells(const int *old2NewBg, bool check)
+void MEDCouplingCMesh::renumberCells(const mcIdType *old2NewBg, bool check)
{
throw INTERP_KERNEL::Exception("Functionality of renumbering cell not available for CMesh !");
}
-void MEDCouplingCMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+void MEDCouplingCMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
{
int it,order;
double time=getTime(it,order);
const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array};
for(int i=0;i<3;i++)
{
- int val=-1;
+ mcIdType val=-1;
std::string st;
if(thisArr[i])
{
tinyInfoD.push_back(time);
}
-void MEDCouplingCMesh::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
+void MEDCouplingCMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
a1->alloc(0,1);
- int sum=0;
+ mcIdType sum=0;
for(int i=0;i<3;i++)
if(tinyInfo[i]!=-1)
sum+=tinyInfo[i];
a2->alloc(sum,1);
}
-void MEDCouplingCMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
+void MEDCouplingCMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const
{
- a1=DataArrayInt::New();
+ a1=DataArrayIdType::New();
a1->alloc(0,1);
const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array};
- int sz=0;
+ mcIdType sz=0;
for(int i=0;i<3;i++)
{
if(thisArr[i])
a2Ptr=std::copy(thisArr[i]->getConstPointer(),thisArr[i]->getConstPointer()+thisArr[i]->getNumberOfTuples(),a2Ptr);
}
-void MEDCouplingCMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+void MEDCouplingCMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings)
{
setName(littleStrings[0]);
data+=tinyInfo[i];
}
}
- setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]);
+ setTime(tinyInfoD[0],FromIdType<int>(tinyInfo[3]),FromIdType<int>(tinyInfo[4]));
}
void MEDCouplingCMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const
const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array};
std::ostringstream stream2[3];
bool isDef[3];
- int nbOfCells=1,nbOfNodes=1;
+ mcIdType nbOfCells=1,nbOfNodes=1;
for(int i=0;i<3;i++)
{
isDef[i]=thisArr[i]!=0;
if(isDef[i])
{
- char tmp='X'+i;
+ char tmp=(char)((int)('X')+i);
stream2[i] << tmp << " positions array ";
if(!thisArr[i]->isAllocated())
stream2[i] << "set but not allocated.";
else
{
- int nbCompo=thisArr[i]->getNumberOfComponents();
+ std::size_t nbCompo=thisArr[i]->getNumberOfComponents();
if(nbCompo==1)
{
- int nbTuples=thisArr[i]->getNumberOfTuples();
+ mcIdType nbTuples=thisArr[i]->getNumberOfTuples();
if(nbTuples<1)
{ stream2[i] << "set and allocated - WARNING number of elements < 1 !"; nbOfCells=-1; nbOfNodes=-1; }
else
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const;
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const;
MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor) const;
+ DataArrayIdType *&cellCor) const;
MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
MEDCOUPLING_EXPORT int getSpaceDimension() const;
- MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
+ MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const;
MEDCOUPLING_EXPORT std::string simpleRepr() const;
MEDCOUPLING_EXPORT std::string advancedRepr() const;
MEDCOUPLING_EXPORT const DataArrayDouble *getCoordsAt(int i) const;
MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
- MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const;
- MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const;
+ MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const;
+ MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const;
MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle);
MEDCOUPLING_EXPORT void translate(const double *vector);
MEDCOUPLING_EXPORT void scale(const double *point, double factor);
MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const;
MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
- MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true);
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
//some useful methods
- MEDCOUPLING_EXPORT void getNodeGridStructure(int *res) const;
- MEDCOUPLING_EXPORT std::vector<int> getNodeGridStructure() const;
- MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const;
+ MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getNodeGridStructure() const;
+ MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const;
//serialisation-unserialization
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
- MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
+ MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings);
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
/// @cond INTERNAL
-int MEDCouplingCartesianAMRPatchGen::getNumberOfCellsRecursiveWithOverlap() const
+mcIdType MEDCouplingCartesianAMRPatchGen::getNumberOfCellsRecursiveWithOverlap() const
{
return _mesh->getNumberOfCellsRecursiveWithOverlap();
}
-int MEDCouplingCartesianAMRPatchGen::getNumberOfCellsRecursiveWithoutOverlap() const
+mcIdType MEDCouplingCartesianAMRPatchGen::getNumberOfCellsRecursiveWithoutOverlap() const
{
return _mesh->getNumberOfCellsRecursiveWithoutOverlap();
}
-int MEDCouplingCartesianAMRPatchGen::getMaxNumberOfLevelsRelativeToThis() const
+mcIdType MEDCouplingCartesianAMRPatchGen::getMaxNumberOfLevelsRelativeToThis() const
{
return _mesh->getMaxNumberOfLevelsRelativeToThis();
}
* \param [in] bottomLeftTopRight a vector equal to the space dimension of \a mesh that specifies for each dimension, the included cell start of the range for the first element of the pair,
* a the end cell (\b excluded) of the range for the second element of the pair.
*/
-MEDCouplingCartesianAMRPatch::MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair<int,int> >& bottomLeftTopRight):MEDCouplingCartesianAMRPatchGen(mesh),_bl_tr(bottomLeftTopRight)
+MEDCouplingCartesianAMRPatch::MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair<mcIdType,mcIdType> >& bottomLeftTopRight):MEDCouplingCartesianAMRPatchGen(mesh),_bl_tr(bottomLeftTopRight)
{
- int dim((int)bottomLeftTopRight.size()),dimExp(_mesh->getSpaceDimension());
+ std::size_t dim(bottomLeftTopRight.size()),dimExp(_mesh->getSpaceDimension());
if(dim!=dimExp)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch constructor : space dimension of father and input bottomLeft/topRight size mismatches !");
}
return new MEDCouplingCartesianAMRPatch(*this,father);
}
-void MEDCouplingCartesianAMRPatch::addPatch(const std::vector< std::pair<int,int> >& bottomLeftTopRight, const std::vector<int>& factors)
+void MEDCouplingCartesianAMRPatch::addPatch(const std::vector< std::pair<mcIdType,mcIdType> >& bottomLeftTopRight, const std::vector<mcIdType>& factors)
{
return getMeshSafe()->addPatch(bottomLeftTopRight,factors);
}
-int MEDCouplingCartesianAMRPatch::getNumberOfOverlapedCellsForFather() const
+mcIdType MEDCouplingCartesianAMRPatch::getNumberOfOverlapedCellsForFather() const
{
return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(_bl_tr);
}
*
* \sa isInMyNeighborhoodExt
*/
-bool MEDCouplingCartesianAMRPatch::isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const
+bool MEDCouplingCartesianAMRPatch::isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, mcIdType ghostLev) const
{
if(ghostLev<0)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::isInMyNeighborhood : the size of the neighborhood must be >= 0 !");
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::isInMyNeighborhood : the input patch is NULL !");
- const std::vector< std::pair<int,int> >& thisp(getBLTRRange());
- const std::vector< std::pair<int,int> >& otherp(other->getBLTRRange());
+ const std::vector< std::pair<mcIdType,mcIdType> >& thisp(getBLTRRange());
+ const std::vector< std::pair<mcIdType,mcIdType> >& otherp(other->getBLTRRange());
return IsInMyNeighborhood(ghostLev==0?0:1,thisp,otherp);//make hypothesis that nb this->_mesh->getFather->getFactors() is >= ghostLev
}
*
* \sa isInMyNeighborhood, isInMyNeighborhoodDiffLev
*/
-bool MEDCouplingCartesianAMRPatch::isInMyNeighborhoodExt(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const
+bool MEDCouplingCartesianAMRPatch::isInMyNeighborhoodExt(const MEDCouplingCartesianAMRPatch *other, mcIdType ghostLev) const
{
if(ghostLev<0)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::isInMyNeighborhoodExt : the size of the neighborhood must be >= 0 !");
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::isInMyNeighborhoodExt : the input patch is NULL !");
- int lev;
+ mcIdType lev;
const MEDCouplingCartesianAMRMeshGen *com(FindCommonAncestor(this,other,lev));//check that factors are OK
if(lev==0)
return isInMyNeighborhood(other,ghostLev);
- std::vector<int> offset(ComputeOffsetFromTwoToOne(com,lev,this,other));
- const std::vector< std::pair<int,int> >& thisp(getBLTRRange());
- std::vector< std::pair<int,int> > otherp(other->getBLTRRange());
+ std::vector<mcIdType> offset(ComputeOffsetFromTwoToOne(com,lev,this,other));
+ const std::vector< std::pair<mcIdType,mcIdType> >& thisp(getBLTRRange());
+ std::vector< std::pair<mcIdType,mcIdType> > otherp(other->getBLTRRange());
otherp=MEDCouplingStructuredMesh::TranslateCompactFrmt(otherp,offset);
return IsInMyNeighborhood(ghostLev,thisp,otherp);
}
*
* \sa isInMyNeighborhoodExt
*/
-bool MEDCouplingCartesianAMRPatch::isInMyNeighborhoodDiffLev(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const
+bool MEDCouplingCartesianAMRPatch::isInMyNeighborhoodDiffLev(const MEDCouplingCartesianAMRPatch *other, mcIdType ghostLev) const
{
- std::vector< std::pair<int,int> > thispp,otherpp;
- std::vector<int> factors;
+ std::vector< std::pair<mcIdType,mcIdType> > thispp,otherpp;
+ std::vector<mcIdType> factors;
ComputeZonesOfTwoRelativeToOneDiffLev(ghostLev,this,other,thispp,otherpp,factors);
return IsInMyNeighborhood(ghostLev>0?1:0,thispp,otherpp);//1 not ghostLev ! It is not a bug ( I hope :) ) ! Because as \a this is a refinement of \a other ghostLev is supposed to be <= factors
}
-std::vector< std::pair<int,int> > MEDCouplingCartesianAMRPatch::getBLTRRangeRelativeToGF() const
+std::vector< std::pair<mcIdType,mcIdType> > MEDCouplingCartesianAMRPatch::getBLTRRangeRelativeToGF() const
{
- std::vector< std::pair<int,int> > ret(_bl_tr);
+ std::vector< std::pair<mcIdType,mcIdType> > ret(_bl_tr);
const MEDCouplingCartesianAMRMeshGen *mesh(getMesh());
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::getBLTRRangeRelativeToGF : not valid !");
const MEDCouplingCartesianAMRMeshGen *fath(mesh->getFather());
if(!fath)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::getBLTRRangeRelativeToGF : not valid 2 !");
- std::vector<int> factors(fath->getFactors());
+ std::vector<mcIdType> factors(fath->getFactors());
std::size_t sz(ret.size());
for(std::size_t ii=0;ii<sz;ii++)
{
fath=oldFather->getFather();
while(fath)
{
- int pos(fath->getPatchIdFromChildMesh(oldFather));
+ mcIdType pos(fath->getPatchIdFromChildMesh(oldFather));
const MEDCouplingCartesianAMRPatch *p(fath->getPatch(pos));
- const std::vector< std::pair<int,int> >& tmp(p->getBLTRRange());
- const std::vector<int>& factors2(fath->getFactors());
- std::transform(factors.begin(),factors.end(),factors2.begin(),factors.begin(),std::multiplies<int>());
+ const std::vector< std::pair<mcIdType,mcIdType> >& tmp(p->getBLTRRange());
+ const std::vector<mcIdType>& factors2(fath->getFactors());
+ std::transform(factors.begin(),factors.end(),factors2.begin(),factors.begin(),std::multiplies<mcIdType>());
for(std::size_t ii=0;ii<sz;ii++)
{
- int delta(ret[ii].second-ret[ii].first);
+ mcIdType delta(ret[ii].second-ret[ii].first);
ret[ii].first+=tmp[ii].first*factors[ii];
ret[ii].second=ret[ii].first+delta;
}
return ret;
}
-std::vector<int> MEDCouplingCartesianAMRPatch::computeCellGridSt() const
+std::vector<mcIdType> MEDCouplingCartesianAMRPatch::computeCellGridSt() const
{
const MEDCouplingCartesianAMRMeshGen *m(getMesh());
if(!m)
const MEDCouplingCartesianAMRMeshGen *father(m->getFather());
if(!father)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::computeCellGridSt : no father help by underlying mesh !");
- const std::vector< std::pair<int,int> >& bltr(getBLTRRange());
- const std::vector<int>& factors(father->getFactors());
- std::vector<int> ret(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(bltr));
- std::transform(ret.begin(),ret.end(),factors.begin(),ret.begin(),std::multiplies<int>());
+ const std::vector< std::pair<mcIdType,mcIdType> >& bltr(getBLTRRange());
+ const std::vector<mcIdType>& factors(father->getFactors());
+ std::vector<mcIdType> ret(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(bltr));
+ std::transform(ret.begin(),ret.end(),factors.begin(),ret.begin(),std::multiplies<mcIdType>());
return ret;
}
-bool MEDCouplingCartesianAMRPatch::IsInMyNeighborhood(int ghostLev, const std::vector< std::pair<int,int> >& p1, const std::vector< std::pair<int,int> >& p2)
+bool MEDCouplingCartesianAMRPatch::IsInMyNeighborhood(mcIdType ghostLev, const std::vector< std::pair<mcIdType,mcIdType> >& p1, const std::vector< std::pair<mcIdType,mcIdType> >& p2)
{
std::size_t thispsize(p1.size());
if(thispsize!=p2.size())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::isInMyNeighborhood : the dimensions must be the same !");
for(std::size_t i=0;i<thispsize;i++)
{
- const std::pair<int,int>& thispp(p1[i]);
- const std::pair<int,int>& otherpp(p2[i]);
+ const std::pair<mcIdType,mcIdType>& thispp(p1[i]);
+ const std::pair<mcIdType,mcIdType>& otherpp(p2[i]);
if(thispp.second<thispp.first)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::isInMyNeighborhood : this patch is invalid !");
if(otherpp.second<otherpp.first)
continue;
if(otherpp.second+ghostLev-1==thispp.first)
continue;
- int start(std::max(thispp.first,otherpp.first)),end(std::min(thispp.second,otherpp.second));
+ mcIdType start(std::max(thispp.first,otherpp.first)),end(std::min(thispp.second,otherpp.second));
if(end<start)
return false;
}
/*!
* \sa FindNeighborsOfSubPatchesOf
*/
-std::vector< std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > > MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOfSameLev(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2)
+std::vector< std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > > MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOfSameLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2)
{
if(!p1 || !p2)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOfSameLev : the input pointers must be not NULL !");
*
* \sa FindNeighborsOfSubPatchesOfSameLev
*/
-void MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOf(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair<const MEDCouplingCartesianAMRPatch *, const MEDCouplingCartesianAMRPatch *> >& ret)
+void MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOf(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair<const MEDCouplingCartesianAMRPatch *, const MEDCouplingCartesianAMRPatch *> >& ret)
{
if(!p1 || !p2)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOf : the input pointers must be not NULL !");
*
* \saUpdateNeighborsOfOneWithTwoExt
*/
-void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(int ghostLev, const std::vector<int>& factors, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2)
+void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(mcIdType ghostLev, const std::vector<mcIdType>& factors, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2)
{
- const std::vector< std::pair<int,int> >& p1BLTR(p1->getBLTRRange());
- const std::vector< std::pair<int,int> >& p2BLTR(p2->getBLTRRange());
+ const std::vector< std::pair<mcIdType,mcIdType> >& p1BLTR(p1->getBLTRRange());
+ const std::vector< std::pair<mcIdType,mcIdType> >& p2BLTR(p2->getBLTRRange());
UpdateNeighborsOfOneWithTwoInternal(ghostLev,factors,p1BLTR,p2BLTR,dataOnP1,dataOnP2);
}
*
* \sa UpdateNeighborsOfOneWithTwo
*/
-void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoExt(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2)
+void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoExt(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2)
{
- const std::vector< std::pair<int,int> >& p1BLTR(p1->getBLTRRange());//p1BLTR=[(10,12),(5,8)]
- std::vector< std::pair<int,int> > p2BLTR(p2->getBLTRRange());//p2BLTR=[(0,1),(0,5)]
- int lev(0);
+ const std::vector< std::pair<mcIdType,mcIdType> >& p1BLTR(p1->getBLTRRange());//p1BLTR=[(10,12),(5,8)]
+ std::vector< std::pair<mcIdType,mcIdType> > p2BLTR(p2->getBLTRRange());//p2BLTR=[(0,1),(0,5)]
+ mcIdType lev(0);
const MEDCouplingCartesianAMRMeshGen *ca(FindCommonAncestor(p1,p2,lev));
- std::vector<int> offset(ComputeOffsetFromTwoToOne(ca,lev,p1,p2));//[12,4]
+ std::vector<mcIdType> offset(ComputeOffsetFromTwoToOne(ca,lev,p1,p2));//[12,4]
p2BLTR=MEDCouplingStructuredMesh::TranslateCompactFrmt(p2BLTR,offset);//p2BLTR=[(12,13),(4,9)]
UpdateNeighborsOfOneWithTwoInternal(ghostLev,p1->getMesh()->getFather()->getFactors(),p1BLTR,p2BLTR,dataOnP1,dataOnP2);
}
/*!
* \a p1 is expected to be more refined than \a p2. \a p1 and \a p2 have to share a common ancestor. Compared to UpdateNeighborsOfOneWithTwoExt here \a p1 and \a p2 are \b not at the same level !
*/
-void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoMixedLev(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2, bool isConservative)
+void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoMixedLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2, bool isConservative)
{
- std::vector< std::pair<int,int> > p1pp,p2pp;
- std::vector<int> factors;
+ std::vector< std::pair<mcIdType,mcIdType> > p1pp,p2pp;
+ std::vector<mcIdType> factors;
ComputeZonesOfTwoRelativeToOneDiffLev(ghostLev,p1,p2,p1pp,p2pp,factors);
//
- std::vector<int> dimsP2NotRefined(p2->computeCellGridSt());
- std::vector<int> dimsP2Refined(dimsP2NotRefined);
- std::transform(dimsP2NotRefined.begin(),dimsP2NotRefined.end(),factors.begin(),dimsP2Refined.begin(),std::multiplies<int>());
- std::vector< std::pair<int,int> > p2RefinedAbs(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsP2NotRefined));
- std::vector<int> dimsP2RefinedGhost(dimsP2Refined.size());
- std::transform(dimsP2Refined.begin(),dimsP2Refined.end(),dimsP2RefinedGhost.begin(),std::bind2nd(std::plus<int>(),2*ghostLev));
+ std::vector<mcIdType> dimsP2NotRefined(p2->computeCellGridSt());
+ std::vector<mcIdType> dimsP2Refined(dimsP2NotRefined);
+ std::transform(dimsP2NotRefined.begin(),dimsP2NotRefined.end(),factors.begin(),dimsP2Refined.begin(),std::multiplies<mcIdType>());
+ std::vector< std::pair<mcIdType,mcIdType> > p2RefinedAbs(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsP2NotRefined));
+ std::vector<mcIdType> dimsP2RefinedGhost(dimsP2Refined.size());
+ std::transform(dimsP2Refined.begin(),dimsP2Refined.end(),dimsP2RefinedGhost.begin(),std::bind2nd(std::plus<mcIdType>(),2*ghostLev));
MCAuto<DataArrayDouble> fineP2(DataArrayDouble::New()); fineP2->alloc(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(dimsP2RefinedGhost),dataOnP2->getNumberOfComponents());
MEDCouplingIMesh::SpreadCoarseToFineGhost(dataOnP2,dimsP2NotRefined,fineP2,p2RefinedAbs,factors,ghostLev);
if(isConservative)
{
- int fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(factors));
+ mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(factors));
std::transform(fineP2->begin(),fineP2->end(),fineP2->getPointer(),std::bind2nd(std::multiplies<double>(),1./((double)fact)));
}
//
* This method has 3 outputs. 2 two first are the resp the position of \a p1 and \a p2 relative to \a p1. And \a factToApplyOn2 is the coeff of refinement to be applied on \a p2 to be virtually
* on the same level as \a p1.
*/
-void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair<int,int> >& p1Zone, std::vector< std::pair<int,int> >& p2Zone, std::vector<int>& factToApplyOn2)
+void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair<mcIdType,mcIdType> >& p1Zone, std::vector< std::pair<mcIdType,mcIdType> >& p2Zone, std::vector<mcIdType>& factToApplyOn2)
{
std::vector<const MEDCouplingCartesianAMRMeshGen *> ancestorsOfThis;
const MEDCouplingCartesianAMRMeshGen *work(p1->getMesh()),*work2(0);
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev : this method is not called correctly !");
//
const MEDCouplingCartesianAMRMeshGen *comAncestor(ancestorsOfThis[levThis]);
- int idThis(comAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-1])),idOther(comAncestor->getPatchIdFromChildMesh(work2));
+ mcIdType idThis(comAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-1])),idOther(comAncestor->getPatchIdFromChildMesh(work2));
const MEDCouplingCartesianAMRPatch *thisp(comAncestor->getPatch(idThis)),*otherp(comAncestor->getPatch(idOther));
- std::vector<int> offset(ComputeOffsetFromTwoToOne(comAncestor,levOther,thisp,otherp));
+ std::vector<mcIdType> offset(ComputeOffsetFromTwoToOne(comAncestor,ToIdType(levOther),thisp,otherp));
p1Zone=thisp->getBLTRRange(); p2Zone=MEDCouplingStructuredMesh::TranslateCompactFrmt(otherp->getBLTRRange(),offset);
factToApplyOn2.resize(p1Zone.size()); std::fill(factToApplyOn2.begin(),factToApplyOn2.end(),1);
//
std::size_t nbOfTurn(levThis-levOther);
for(std::size_t i=0;i<nbOfTurn;i++)
{
- std::vector< std::pair<int,int> > tmp0;
+ std::vector< std::pair<mcIdType,mcIdType> > tmp0;
MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(p1Zone,p2Zone,tmp0,false);
p2Zone=tmp0;
const MEDCouplingCartesianAMRMeshGen *curAncestor(ancestorsOfThis[levThis-i]);
ApplyFactorsOnCompactFrmt(p2Zone,curAncestor->getFactors());
curAncestor=ancestorsOfThis[levThis-1-i];
- const std::vector<int>& factors(curAncestor->getFactors());
- std::transform(factToApplyOn2.begin(),factToApplyOn2.end(),factors.begin(),factToApplyOn2.begin(),std::multiplies<int>());
- int tmpId(curAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-2-i]));
+ const std::vector<mcIdType>& factors(curAncestor->getFactors());
+ std::transform(factToApplyOn2.begin(),factToApplyOn2.end(),factors.begin(),factToApplyOn2.begin(),std::multiplies<mcIdType>());
+ mcIdType tmpId(curAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-2-i]));
p1Zone=curAncestor->getPatch(tmpId)->getBLTRRange();
}
}
std::size_t MEDCouplingCartesianAMRPatch::getHeapMemorySizeWithoutChildren() const
{
std::size_t ret(sizeof(MEDCouplingCartesianAMRPatch));
- ret+=_bl_tr.capacity()*sizeof(std::pair<int,int>);
+ ret+=_bl_tr.capacity()*sizeof(std::pair<mcIdType,mcIdType>);
return ret;
}
-const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRPatch::FindCommonAncestor(const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, int& lev)
+const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRPatch::FindCommonAncestor(const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, mcIdType& lev)
{
const MEDCouplingCartesianAMRMeshGen *f1(p1->_mesh),*f2(p2->_mesh);
lev=0;
return f1;
}
-std::vector<int> MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen *comAncestor, int lev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2)
+std::vector<mcIdType> MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen *comAncestor, mcIdType lev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2)
{
if(lev<=0)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne : this method is useful only for lev > 0 !");
- int zeLev(lev-1);
- int dim(p1->getMesh()->getSpaceDimension());
+ mcIdType zeLev(lev-1);
+ mcIdType dim(p1->getMesh()->getSpaceDimension());
if(p2->getMesh()->getSpaceDimension()!=dim)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne : dimension must be the same !");
- std::vector< int > ret(dim,0);
- for(int i=0;i<zeLev;i++)
+ std::vector< mcIdType > ret(dim,0);
+ for(mcIdType i=0;i<zeLev;i++)
{
const MEDCouplingCartesianAMRMeshGen *f1(p1->_mesh),*f2(p2->_mesh);
const MEDCouplingCartesianAMRPatch *p1h(0),*p2h(0);
- for(int j=0;j<lev-i;j++)
+ for(mcIdType j=0;j<lev-i;j++)
{
const MEDCouplingCartesianAMRMeshGen *f1tmp(f1->getFather()),*f2tmp(f2->getFather());
- int pid1(f1tmp->getPatchIdFromChildMesh(f1)),pid2(f2tmp->getPatchIdFromChildMesh(f2));
+ mcIdType pid1(f1tmp->getPatchIdFromChildMesh(f1)),pid2(f2tmp->getPatchIdFromChildMesh(f2));
p1h=f1tmp->getPatch(pid1); p2h=f2tmp->getPatch(pid2);
f1=f1tmp; f2=f2tmp;
}
- std::vector< std::pair<int,int> > p2c(p2h->getBLTRRange());
- for(int k=0;k<dim;k++)
+ std::vector< std::pair<mcIdType,mcIdType> > p2c(p2h->getBLTRRange());
+ for(mcIdType k=0;k<dim;k++)
{
p2c[k].first+=ret[k];
p2c[k].second+=ret[k];
}
- for(int k=0;k<dim;k++)
+ for(mcIdType k=0;k<dim;k++)
{
ret[k]=p2c[k].first-p1h->getBLTRRange()[k].first;
ret[k]*=f1->getFactors()[k];
return ret;
}
-void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoInternal(int ghostLev, const std::vector<int>& factors, const std::vector< std::pair<int,int> >&p1 ,const std::vector< std::pair<int,int> >&p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2)
+void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoInternal(mcIdType ghostLev, const std::vector<mcIdType>& factors, const std::vector< std::pair<mcIdType,mcIdType> >&p1 ,const std::vector< std::pair<mcIdType,mcIdType> >&p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2)
{//p1=[(1,4),(2,4)] p2=[(4,5),(3,4)]
- int dim((int)factors.size());
- std::vector<int> dimsCoarse(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(p1));//[3,2]
- std::transform(dimsCoarse.begin(),dimsCoarse.end(),factors.begin(),dimsCoarse.begin(),std::multiplies<int>());//[12,8]
- std::transform(dimsCoarse.begin(),dimsCoarse.end(),dimsCoarse.begin(),std::bind2nd(std::plus<int>(),2*ghostLev));//[14,10]
- std::vector< std::pair<int,int> > rangeCoarse(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsCoarse));//[(0,14),(0,10)]
- std::vector<int> fakeFactors(dim,1);
+ mcIdType dim(ToIdType(factors.size()));
+ std::vector<mcIdType> dimsCoarse(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(p1));//[3,2]
+ std::transform(dimsCoarse.begin(),dimsCoarse.end(),factors.begin(),dimsCoarse.begin(),std::multiplies<mcIdType>());//[12,8]
+ std::transform(dimsCoarse.begin(),dimsCoarse.end(),dimsCoarse.begin(),std::bind2nd(std::plus<mcIdType>(),2*ghostLev));//[14,10]
+ std::vector< std::pair<mcIdType,mcIdType> > rangeCoarse(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsCoarse));//[(0,14),(0,10)]
+ std::vector<mcIdType> fakeFactors(dim,1);
//
- std::vector< std::pair<int,int> > tmp0,tmp1,tmp2;
+ std::vector< std::pair<mcIdType,mcIdType> > tmp0,tmp1,tmp2;
MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(p1,p2,tmp0,false);//tmp0=[(3,4),(1,2)]
ApplyFactorsOnCompactFrmt(tmp0,factors);//tmp0=[(12,16),(4,8)]
MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(tmp0,ghostLev);//tmp0=[(13,17),(5,9)]
- std::vector< std::pair<int,int> > interstRange(MEDCouplingStructuredMesh::IntersectRanges(tmp0,rangeCoarse));//interstRange=[(13,14),(5,9)]
+ std::vector< std::pair<mcIdType,mcIdType> > interstRange(MEDCouplingStructuredMesh::IntersectRanges(tmp0,rangeCoarse));//interstRange=[(13,14),(5,9)]
MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(p2,p1,tmp1,false);//tmp1=[(-3,0),(-1,1)]
ApplyFactorsOnCompactFrmt(tmp1,factors);//tmp1=[(-12,-4),(-4,0)]
MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(tmp1,interstRange,tmp2,false);//tmp2=[(1,2),(1,5)]
//
- std::vector< std::pair<int,int> > dimsFine(p2);
+ std::vector< std::pair<mcIdType,mcIdType> > dimsFine(p2);
ApplyFactorsOnCompactFrmt(dimsFine,factors);
ApplyAllGhostOnCompactFrmt(dimsFine,ghostLev);
//
* \param [in,out] partBeforeFact - the part of a image mesh in compact format that will be put in refined reference.
* \param [in] factors - the factors per axis.
*/
-void MEDCouplingCartesianAMRPatch::ApplyFactorsOnCompactFrmt(std::vector< std::pair<int,int> >& partBeforeFact, const std::vector<int>& factors)
+void MEDCouplingCartesianAMRPatch::ApplyFactorsOnCompactFrmt(std::vector< std::pair<mcIdType,mcIdType> >& partBeforeFact, const std::vector<mcIdType>& factors)
{
std::size_t sz(factors.size());
if(sz!=partBeforeFact.size())
* \param [in,out] partBeforeFact - the part of a image mesh in compact format that will be put in ghost reference.
* \param [in] ghostSize - the ghost size of zone for all axis.
*/
-void MEDCouplingCartesianAMRPatch::ApplyAllGhostOnCompactFrmt(std::vector< std::pair<int,int> >& partBeforeFact, int ghostSize)
+void MEDCouplingCartesianAMRPatch::ApplyAllGhostOnCompactFrmt(std::vector< std::pair<mcIdType,mcIdType> >& partBeforeFact, mcIdType ghostSize)
{
if(ghostSize<0)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::ApplyAllGhostOnCompactFrmt : ghost size must be >= 0 !");
return _mesh->getSpaceDimension();
}
-void MEDCouplingCartesianAMRMeshGen::setFactors(const std::vector<int>& newFactors)
+void MEDCouplingCartesianAMRMeshGen::setFactors(const std::vector<mcIdType>& newFactors)
{
- if(getSpaceDimension()!=(int)newFactors.size())
+ if(getSpaceDimension()!=ToIdType(newFactors.size()))
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::setFactors : size of input factors is not equal to the space dimension !");
if(_factors.empty())
{
declareAsNew();
}
-int MEDCouplingCartesianAMRMeshGen::getMaxNumberOfLevelsRelativeToThis() const
+mcIdType MEDCouplingCartesianAMRMeshGen::getMaxNumberOfLevelsRelativeToThis() const
{
- int ret(1);
+ mcIdType ret(1);
for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
ret=std::max(ret,(*it)->getMaxNumberOfLevelsRelativeToThis()+1);
return ret;
* The patches in \a this are ignored here.
* \sa getNumberOfCellsAtCurrentLevelGhost, getNumberOfCellsRecursiveWithOverlap
*/
-int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevel() const
+mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevel() const
{
return _mesh->getNumberOfCells();
}
*
* \sa getNumberOfCellsAtCurrentLevel
*/
-int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const
+mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const
{
MCAuto<MEDCouplingIMesh> tmp(_mesh->buildWithGhost(ghostLev));
return tmp->getNumberOfCells();
* This method returns the number of cells including the current level but \b also \b including recursively all cells of other levels
* starting from this. The set of cells which size is returned here are generally overlapping each other.
*/
-int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() const
+mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() const
{
- int ret(_mesh->getNumberOfCells());
+ mcIdType ret=_mesh->getNumberOfCells();
for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
ret+=(*it)->getNumberOfCellsRecursiveWithOverlap();
*
* \sa buildUnstructured
*/
-int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithoutOverlap() const
+mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithoutOverlap() const
{
- int ret(_mesh->getNumberOfCells());
+ mcIdType ret=_mesh->getNumberOfCells();
for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
ret-=(*it)->getNumberOfOverlapedCellsForFather();
*
* \sa getPatchAtPosition
*/
-std::vector<int> MEDCouplingCartesianAMRMeshGen::getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const
+std::vector<mcIdType> MEDCouplingCartesianAMRMeshGen::getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const
{
if(!ref)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPositionRelativeTo : input pointer is NULL !");
- std::vector<int> ret;
+ std::vector<mcIdType> ret;
getPositionRelativeToInternal(ref,ret);
std::reverse(ret.begin(),ret.end());
return ret;
/*!
* \sa getPositionRelativeTo, getMeshAtPosition
*/
-const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatchAtPosition(const std::vector<int>& pos) const
+const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatchAtPosition(const std::vector<mcIdType>& pos) const
{
std::size_t sz(pos.size());
if(sz==0)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : empty input -> no patch by definition !");
- int patchId(pos[0]);
+ mcIdType patchId(pos[0]);
const MEDCouplingCartesianAMRPatch *elt(getPatch(patchId));
if(sz==1)
return elt;
if(!elt || !elt->getMesh())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : NULL element found during walk !");
- std::vector<int> pos2(pos.begin()+1,pos.end());
+ std::vector<mcIdType> pos2(pos.begin()+1,pos.end());
return elt->getMesh()->getPatchAtPosition(pos2);
}
-const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshGen::getMeshAtPosition(const std::vector<int>& pos) const
+const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshGen::getMeshAtPosition(const std::vector<mcIdType>& pos) const
{
std::size_t sz(pos.size());
if(sz==0)
return this;
- int patchId(pos[0]);
+ mcIdType patchId(pos[0]);
const MEDCouplingCartesianAMRPatch *elt(getPatch(patchId));
if(sz==1)
{
}
if(!elt || !elt->getMesh())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : NULL element found during walk !");
- std::vector<int> pos2(pos.begin()+1,pos.end());
+ std::vector<mcIdType> pos2(pos.begin()+1,pos.end());
return elt->getMesh()->getMeshAtPosition(pos2);
}
*
* \return std::vector<MEDCouplingCartesianAMRPatchGen *> - objects in vector are to be managed (decrRef) by the caller.
*/
-std::vector<MEDCouplingCartesianAMRPatchGen *> MEDCouplingCartesianAMRMeshGen::retrieveGridsAt(int absoluteLev) const
+std::vector<MEDCouplingCartesianAMRPatchGen *> MEDCouplingCartesianAMRMeshGen::retrieveGridsAt(mcIdType absoluteLev) const
{
if(absoluteLev<0)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::retrieveGridsAt : absolute level must be >=0 !");
* a the end cell (\b excluded) of the range for the second element of the pair.
* \param [in] factors The factor of refinement per axis (different from 0).
*/
-void MEDCouplingCartesianAMRMeshGen::addPatch(const std::vector< std::pair<int,int> >& bottomLeftTopRight, const std::vector<int>& factors)
+void MEDCouplingCartesianAMRMeshGen::addPatch(const std::vector< std::pair<mcIdType,mcIdType> >& bottomLeftTopRight, const std::vector<mcIdType>& factors)
{
checkFactorsAndIfNotSetAssign(factors);
MCAuto<MEDCouplingIMesh> mesh(static_cast<MEDCouplingIMesh *>(_mesh->buildStructuredSubPart(bottomLeftTopRight)));
{
public:
InternalPatch():_nb_of_true(0) { }
- int getDimension() const { return (int)_part.size(); }
+ mcIdType getDimension() const { return ToIdType(_part.size()); }
double getEfficiency() const { return (double)_nb_of_true/(double)_crit.size(); }
- int getNumberOfCells() const { return (int)_crit.size(); }
- void setNumberOfTrue(int nboft) { _nb_of_true=nboft; }
+ mcIdType getNumberOfCells() const { return ToIdType(_crit.size()); }
+ void setNumberOfTrue(mcIdType nboft) { _nb_of_true=nboft; }
std::vector<bool>& getCriterion() { return _crit; }
const std::vector<bool>& getConstCriterion() const { return _crit; }
- void setPart(const std::vector< std::pair<int,int> >& part) { _part=part; }
- std::vector< std::pair<int,int> >& getPart() { return _part; }
- const std::vector< std::pair<int,int> >& getConstPart() const { return _part; }
+ void setPart(const std::vector< std::pair<mcIdType,mcIdType> >& part) { _part=part; }
+ std::vector< std::pair<mcIdType,mcIdType> >& getPart() { return _part; }
+ const std::vector< std::pair<mcIdType,mcIdType> >& getConstPart() const { return _part; }
bool presenceOfTrue() const { return _nb_of_true>0; }
- std::vector<int> computeCGS() const { return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(_part); }
- std::vector< std::vector<int> > computeSignature() const { return MEDCouplingStructuredMesh::ComputeSignaturePerAxisOf(computeCGS(),getConstCriterion()); }
- double getEfficiencyPerAxis(int axisId) const { return (double)_nb_of_true/((double)(_part[axisId].second-_part[axisId].first)); }
- void zipToFitOnCriterion(int minPatchLgth);
+ std::vector<mcIdType> computeCGS() const { return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(_part); }
+ std::vector< std::vector<mcIdType> > computeSignature() const { return MEDCouplingStructuredMesh::ComputeSignaturePerAxisOf(computeCGS(),getConstCriterion()); }
+ double getEfficiencyPerAxis(mcIdType axisId) const { return (double)_nb_of_true/((double)(_part[axisId].second-_part[axisId].first)); }
+ void zipToFitOnCriterion(mcIdType minPatchLgth);
void updateNumberOfTrue() const;
- MCAuto<InternalPatch> extractPart(const std::vector< std::pair<int,int> >&partInGlobal) const;
+ MCAuto<InternalPatch> extractPart(const std::vector< std::pair<mcIdType,mcIdType> >&partInGlobal) const;
MCAuto<InternalPatch> deepCopy() const;
protected:
~InternalPatch() { }
private:
- mutable int _nb_of_true;
+ mutable mcIdType _nb_of_true;
std::vector<bool> _crit;
//! _part is global
- std::vector< std::pair<int,int> > _part;
+ std::vector< std::pair<mcIdType,mcIdType> > _part;
};
-void InternalPatch::zipToFitOnCriterion(int minPatchLgth)
+void InternalPatch::zipToFitOnCriterion(mcIdType minPatchLgth)
{
- std::vector<int> cgs(computeCGS());
+ std::vector<mcIdType> cgs(computeCGS());
std::vector<bool> newCrit;
- std::vector< std::pair<int,int> > newPart,newPart2;
- int newNbOfTrue(MEDCouplingStructuredMesh::FindMinimalPartOf(minPatchLgth,cgs,_crit,newCrit,newPart));
+ std::vector< std::pair<mcIdType,mcIdType> > newPart,newPart2;
+ mcIdType newNbOfTrue(MEDCouplingStructuredMesh::FindMinimalPartOf(minPatchLgth,cgs,_crit,newCrit,newPart));
MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(_part,newPart,newPart2);
if(newNbOfTrue!=_nb_of_true)
throw INTERP_KERNEL::Exception("InternalPatch::zipToFitOnCrit : internal error !");
void InternalPatch::updateNumberOfTrue() const
{
- _nb_of_true=(int)std::count(_crit.begin(),_crit.end(),true);
+ _nb_of_true=ToIdType(std::count(_crit.begin(),_crit.end(),true));
}
-MCAuto<InternalPatch> InternalPatch::extractPart(const std::vector< std::pair<int,int> >&partInGlobal) const
+MCAuto<InternalPatch> InternalPatch::extractPart(const std::vector< std::pair<mcIdType,mcIdType> >&partInGlobal) const
{
MCAuto<InternalPatch> ret(new InternalPatch);
- std::vector<int> cgs(computeCGS());
- std::vector< std::pair<int,int> > newPart;
+ std::vector<mcIdType> cgs(computeCGS());
+ std::vector< std::pair<mcIdType,mcIdType> > newPart;
MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(_part,partInGlobal,newPart);
MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom(cgs,_crit,newPart,ret->getCriterion());
ret->setPart(partInGlobal);
return ret;
}
-void DissectBigPatch(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, int axisId, int largestLength, int& cutPlace)
+void DissectBigPatch(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, mcIdType axisId, mcIdType largestLength, mcIdType& cutPlace)
{
- int minimumPatchLength(bso.getMinimumPatchLength());
+ mcIdType minimumPatchLength(bso.getMinimumPatchLength());
std::vector<double> ratio(largestLength-minimumPatchLength,std::numeric_limits<double>::max());
- int index_min = -1;
+ mcIdType index_min = -1;
double minSemiEfficiencyRatio(std::numeric_limits<double>::max());
double efficiencyPerAxis[2];
- for(int i=minimumPatchLength-1;i<largestLength-minimumPatchLength;i++)
+ for(mcIdType i=minimumPatchLength-1;i<largestLength-minimumPatchLength;i++)
{
- for(int h=0;h<2;h++)
+ for(mcIdType h=0;h<2;h++)
{
- std::vector< std::pair<int,int> > rectH(patchToBeSplit->getConstPart());
+ std::vector< std::pair<mcIdType,mcIdType> > rectH(patchToBeSplit->getConstPart());
if(h==0)
rectH[axisId].second=patchToBeSplit->getConstPart()[axisId].first+i;
else
cutPlace=index_min+patchToBeSplit->getConstPart()[axisId].first;
}
-bool FindHole(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, int axisId, int& cutPlace)
+bool FindHole(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, mcIdType axisId, mcIdType& cutPlace)
{
cutPlace=-1;
- int minimumPatchLength(bso.getMinimumPatchLength());
- const int dim(patchToBeSplit->getDimension());
- std::vector< std::vector<int> > signatures(patchToBeSplit->computeSignature());
- for(int id=0;id<dim;id++)
+ mcIdType minimumPatchLength(bso.getMinimumPatchLength());
+ const mcIdType dim(patchToBeSplit->getDimension());
+ std::vector< std::vector<mcIdType> > signatures(patchToBeSplit->computeSignature());
+ for(mcIdType id=0;id<dim;id++)
{
- const std::vector<int>& signature(signatures[id]);
- std::vector<int> hole;
+ const std::vector<mcIdType>& signature(signatures[id]);
+ std::vector<mcIdType> hole;
std::vector<double> distance;
- int len((int)signature.size());
- for(int i=minimumPatchLength-1;i<len-minimumPatchLength;i++)
+ mcIdType len(ToIdType(signature.size()));
+ for(mcIdType i=minimumPatchLength-1;i<len-minimumPatchLength;i++)
if(signature[i]==0)
hole.push_back(i);
if(!hole.empty())
{
- int closestHoleToMiddle(hole[0]);
- int oldDistanceToMiddle(std::abs(hole[0]-len/2));
- int newDistanceToMiddle(oldDistanceToMiddle);
+ mcIdType closestHoleToMiddle(hole[0]);
+ mcIdType oldDistanceToMiddle(std::abs(hole[0]-len/2));
+ mcIdType newDistanceToMiddle(oldDistanceToMiddle);
for(std::size_t i=0;i<hole.size();i++)
{
newDistanceToMiddle=std::abs(hole[i]-len/2);
return false;
}
-bool FindInflection(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, int& cutPlace, int& axisId)
+bool FindInflection(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, mcIdType& cutPlace, int& axisId)
{
bool cutFound(false); cutPlace=-1;// do not set axisId before to be sure that cutFound was set to true
- const std::vector< std::pair<int,int> >& part(patchToBeSplit->getConstPart());
- int sign,minimumPatchLength(bso.getMinimumPatchLength());
- const int dim(patchToBeSplit->getDimension());
-
- std::vector<int> zeroCrossDims(dim,-1);
- std::vector<int> zeroCrossVals(dim,-1);
- std::vector< std::vector<int> > signatures(patchToBeSplit->computeSignature());
- for (int id=0;id<dim;id++)
+ const std::vector< std::pair<mcIdType,mcIdType> >& part(patchToBeSplit->getConstPart());
+ mcIdType sign,minimumPatchLength(bso.getMinimumPatchLength());
+ const mcIdType dim(patchToBeSplit->getDimension());
+
+ std::vector<mcIdType> zeroCrossDims(dim,-1);
+ std::vector<mcIdType> zeroCrossVals(dim,-1);
+ std::vector< std::vector<mcIdType> > signatures(patchToBeSplit->computeSignature());
+ for (mcIdType id=0;id<dim;id++)
{
- const std::vector<int>& signature(signatures[id]);
+ const std::vector<mcIdType>& signature(signatures[id]);
- std::vector<int> derivate_second_order,gradient_absolute,zero_cross,edge,max_cross_list ;
+ std::vector<mcIdType> derivate_second_order,gradient_absolute,zero_cross,edge,max_cross_list ;
std::vector<double> distance ;
for(std::size_t i=1;i<signature.size()-1;i++)
// Gradient absolute value
for(std::size_t i=1;i<derivate_second_order.size();i++)
- gradient_absolute.push_back(abs(derivate_second_order[i]-derivate_second_order[i-1])) ;
+ gradient_absolute.push_back(std::abs(derivate_second_order[i]-derivate_second_order[i-1])) ;
if(derivate_second_order.empty())
continue;
for(std::size_t i=1;i<derivate_second_order.size()-1;i++)
if ( sign==0 || sign==-1 )
if ( i >= (std::size_t)minimumPatchLength-2 && i <= signature.size()-minimumPatchLength-2 )
{
- zero_cross.push_back(i) ;
+ zero_cross.push_back(ToIdType(i)) ;
edge.push_back(gradient_absolute[i]) ;
}
}
if ( zero_cross.size() > 0 )
{
- int max_cross=*max_element(edge.begin(),edge.end()) ;
- for (unsigned int i=0;i<edge.size();i++)
+ mcIdType max_cross=*max_element(edge.begin(),edge.end()) ;
+ for (std::size_t i=0;i<edge.size();i++)
if (edge[i]==max_cross)
max_cross_list.push_back(zero_cross[i]+1) ;
- double center((signature.size()/2.0));
- for (unsigned int i=0;i<max_cross_list.size();i++)
- distance.push_back(fabs(max_cross_list[i]+1-center));
+ double center(static_cast<double>(signature.size())/2.0);
+ for (std::size_t i=0;i<max_cross_list.size();i++)
+ distance.push_back(fabs(FromIdType<double>(max_cross_list[i])+1-center));
double distance_min=*min_element(distance.begin(),distance.end()) ;
- int pos_distance_min=find(distance.begin(),distance.end(),distance_min)-distance.begin();
- int best_place = max_cross_list[pos_distance_min] + part[id].first ;
+ mcIdType pos_distance_min=ToIdType(find(distance.begin(),distance.end(),distance_min)-distance.begin());
+ mcIdType best_place = max_cross_list[pos_distance_min] + part[id].first ;
if ( max_cross >=0 )
{
zeroCrossDims[id] = best_place ;
if ( zeroCrossDims[0]!=-1 || zeroCrossDims[1]!=-1 )
{
- int max_cross_dims = *max_element(zeroCrossVals.begin(),zeroCrossVals.end()) ;
+ mcIdType max_cross_dims = *max_element(zeroCrossVals.begin(),zeroCrossVals.end()) ;
if (zeroCrossVals[0]==max_cross_dims && zeroCrossVals[1]==max_cross_dims )
{
- int nl_left(part[0].second-part[0].first);
- int nc_left(part[1].second-part[1].first);
+ mcIdType nl_left(part[0].second-part[0].first);
+ mcIdType nc_left(part[1].second-part[1].first);
if ( nl_left >= nc_left )
max_cross_dims = 0 ;
else
max_cross_dims = 1 ;
}
else
- max_cross_dims=std::find(zeroCrossVals.begin(),zeroCrossVals.end(),max_cross_dims)-zeroCrossVals.begin();
+ max_cross_dims=ToIdType(std::find(zeroCrossVals.begin(),zeroCrossVals.end(),max_cross_dims)-zeroCrossVals.begin());
cutFound=true;
cutPlace=zeroCrossDims[max_cross_dims];
- axisId=max_cross_dims ;
+ axisId=FromIdType<int>(max_cross_dims);
}
return cutFound;
}
-bool TryAction4(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, int axisId, int rangeOfAxisId, int& cutPlace)
+bool TryAction4(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, mcIdType axisId, mcIdType rangeOfAxisId, mcIdType& cutPlace)
{
if(patchToBeSplit->getEfficiency()<=bso.getEfficiencyGoal())
{
return ret;
}
-void DealWithCut(double minPatchLgth, const InternalPatch *patchToBeSplit, int axisId, int cutPlace, std::vector<MCAuto<InternalPatch> >& listOfPatches)
+void DealWithCut(double minPatchLgth, const InternalPatch *patchToBeSplit, int axisId, mcIdType cutPlace, std::vector<MCAuto<InternalPatch> >& listOfPatches)
{
MCAuto<InternalPatch> leftPart,rightPart;
- std::vector< std::pair<int,int> > rect(patchToBeSplit->getConstPart());
- std::vector< std::pair<int,int> > leftRect(rect),rightRect(rect);
+ std::vector< std::pair<mcIdType,mcIdType> > rect(patchToBeSplit->getConstPart());
+ std::vector< std::pair<mcIdType,mcIdType> > leftRect(rect),rightRect(rect);
leftRect[axisId].second=cutPlace+1;
rightRect[axisId].first=cutPlace+1;
leftPart=patchToBeSplit->extractPart(leftRect);
rightPart=patchToBeSplit->extractPart(rightRect);
- leftPart->zipToFitOnCriterion(minPatchLgth); rightPart->zipToFitOnCriterion(minPatchLgth);
+ leftPart->zipToFitOnCriterion(ToIdType(minPatchLgth)); rightPart->zipToFitOnCriterion(ToIdType(minPatchLgth));
listOfPatches.push_back(leftPart);
listOfPatches.push_back(rightPart);
}
declareAsNew();
}
-void MEDCouplingCartesianAMRMeshGen::removePatch(int patchId)
+void MEDCouplingCartesianAMRMeshGen::removePatch(mcIdType patchId)
{
checkPatchId(patchId);
- int sz((int)_patches.size()),j(0);
+ mcIdType sz(ToIdType(_patches.size())),j(0);
std::vector< MCAuto<MEDCouplingCartesianAMRPatch> > patches(sz-1);
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
if(i!=patchId)
patches[j++]=_patches[i];
(const_cast<MEDCouplingCartesianAMRMeshGen *>(_patches[patchId]->getMesh()))->detachFromFather();
declareAsNew();
}
-int MEDCouplingCartesianAMRMeshGen::getNumberOfPatches() const
+mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfPatches() const
{
- return (int)_patches.size();
+ return ToIdType(_patches.size());
}
/*!
* for more information.
*
*/
-void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const std::vector<bool>& criterion, const std::vector<int>& factors)
+void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const std::vector<bool>& criterion, const std::vector<mcIdType>& factors)
{
- int nbCells(getNumberOfCellsAtCurrentLevel());
- if(nbCells!=(int)criterion.size())
+ mcIdType nbCells(getNumberOfCellsAtCurrentLevel());
+ if(nbCells!=ToIdType(criterion.size()))
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion : the number of tuples of criterion array must be equal to the number of cells at the current level !");
_patches.clear();
- std::vector<int> cgs(_mesh->getCellGridStructure());
+ std::vector<mcIdType> cgs(_mesh->getCellGridStructure());
std::vector< MCAuto<InternalPatch> > listOfPatches,listOfPatchesOK;
//
MCAuto<InternalPatch> p(new InternalPatch);
for(std::vector< MCAuto<InternalPatch> >::iterator it=listOfPatches.begin();it!=listOfPatches.end();it++)
{
//
- int axisId,largestLength,cutPlace;
+ int axisId;
+ mcIdType largestLength,cutPlace;
MEDCouplingStructuredMesh::FindTheWidestAxisOfGivenRangeInCompactFrmt((*it)->getConstPart(),axisId,largestLength);
if((*it)->getEfficiency()>=bso.getEfficiencyThreshold() && ((*it)->getNumberOfCells()>bso.getMaximumNbOfCellsInPatch() || largestLength>bso.getMaximumPatchLength()))
{
* This method creates patches in \a this (by destroying the patches if any). This method uses \a criterion array as a field on cells on this level.
* This method only create patches at level 0 relative to \a this.
*/
-void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<int>& factors)
+void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<mcIdType>& factors)
{
if(!criterion || !criterion->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion : the criterion DataArrayByte instance must be allocated and not NULL !");
declareAsNew();
}
-void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<int>& factors, double eps)
+void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<mcIdType>& factors, double eps)
{
if(!criterion)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion : null criterion pointer !");
createPatchesFromCriterion(bso,inp,factors);
}
-int MEDCouplingCartesianAMRMeshGen::getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const
+mcIdType MEDCouplingCartesianAMRMeshGen::getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const
{
- int ret(0);
+ mcIdType ret(0);
for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++,ret++)
{
if((*it)->getMesh()==mesh)
return ret;
}
-const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatch(int patchId) const
+const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatch(mcIdType patchId) const
{
checkPatchId(patchId);
return _patches[patchId];
* This method states if patch2 (with id \a patchId2) is in the neighborhood of patch1 (with id \a patchId1).
* The neighborhood size is defined by \a ghostLev in the reference of \a this ( \b not in the reference of patches !).
*/
-bool MEDCouplingCartesianAMRMeshGen::isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const
+bool MEDCouplingCartesianAMRMeshGen::isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const
{
const MEDCouplingCartesianAMRPatch *p1(getPatch(patchId1)),*p2(getPatch(patchId2));
return p1->isInMyNeighborhood(p2,ghostLev);
* \throw if \a cellFieldOnThis is NULL or not allocated
* \sa fillCellFieldOnPatch, MEDCouplingIMesh::SpreadCoarseToFine
*/
-DataArrayDouble *MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const
+DataArrayDouble *MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const
{
if(!cellFieldOnThis || !cellFieldOnThis->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createCellFieldOnPatch : the input cell field array is NULL or not allocated !");
*
* \sa createCellFieldOnPatch, fillCellFieldComingFromPatch
*/
-void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative) const
+void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative) const
{
if(!cellFieldOnThis || !cellFieldOnThis->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createCellFieldOnPatch : the input cell field array is NULL or not allocated !");
MEDCouplingIMesh::SpreadCoarseToFine(cellFieldOnThis,_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors());
if(isConservative)
{
- int fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
+ mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
std::transform(cellFieldOnPatch->begin(),cellFieldOnPatch->end(),cellFieldOnPatch->getPointer(),std::bind2nd(std::multiplies<double>(),1./((double)fact)));
}
}
*
* \sa fillCellFieldOnPatch, fillCellFieldOnPatchGhostAdv
*/
-void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev, bool isConservative) const
+void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative) const
{
if(!cellFieldOnThis || !cellFieldOnThis->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createCellFieldOnPatchGhost : the input cell field array is NULL or not allocated !");
MEDCouplingIMesh::SpreadCoarseToFineGhost(cellFieldOnThis,_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors(),ghostLev);
if(isConservative)
{
- int fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
+ mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
std::transform(cellFieldOnPatch->begin(),cellFieldOnPatch->end(),cellFieldOnPatch->getPointer(),std::bind2nd(std::multiplies<double>(),1./((double)fact)));
}
}
* \param [in,out] cellFieldOnPatch - The array of the cell field on the requested patch to be filled \b only \b in \b the \b ghost \b zone.
* \param [in] ghostLev - The size of the ghost zone (must be >=0 !)
*/
-void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyOnGhostZone(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const
+void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const
{
if(!cellFieldOnThis || !cellFieldOnThis->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::fillCellFieldOnPatchOnlyOnGhostZone : the input cell field array is NULL or not allocated !");
*
* \sa fillCellFieldOnPatchOnlyGhostAdv
*/
-void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, const std::vector<const DataArrayDouble *>& arrsOnPatches, bool isConservative) const
+void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, const std::vector<const DataArrayDouble *>& arrsOnPatches, bool isConservative) const
{
- int nbp(getNumberOfPatches());
- if(nbp!=(int)arrsOnPatches.size())
+ mcIdType nbp(getNumberOfPatches());
+ if(nbp!=ToIdType(arrsOnPatches.size()))
{
std::ostringstream oss; oss << "MEDCouplingCartesianAMRMesh::fillCellFieldOnPatchGhostAdv : there are " << nbp << " patches in this and " << arrsOnPatches.size() << " arrays in the last parameter !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
*
* \sa getPatchIdsInTheNeighborhoodOf
*/
-void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, const std::vector<const DataArrayDouble *>& arrsOnPatches) const
+void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, const std::vector<const DataArrayDouble *>& arrsOnPatches) const
{
- int nbp(getNumberOfPatches());
- if(nbp!=(int)arrsOnPatches.size())
+ mcIdType nbp(getNumberOfPatches());
+ if(nbp!=ToIdType(arrsOnPatches.size()))
{
std::ostringstream oss; oss << "MEDCouplingCartesianAMRMesh::fillCellFieldOnPatchOnlyGhostAdv : there are " << nbp << " patches in this and " << arrsOnPatches.size() << " arrays in the last parameter !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
const MEDCouplingCartesianAMRPatch *refP(getPatch(patchId));
DataArrayDouble *theFieldToFill(const_cast<DataArrayDouble *>(arrsOnPatches[patchId]));
- std::vector<int> ids(getPatchIdsInTheNeighborhoodOf(patchId,ghostLev));
- for(std::vector<int>::const_iterator it=ids.begin();it!=ids.end();it++)
+ std::vector<mcIdType> ids(getPatchIdsInTheNeighborhoodOf(patchId,ghostLev));
+ for(std::vector<mcIdType>::const_iterator it=ids.begin();it!=ids.end();it++)
{
const MEDCouplingCartesianAMRPatch *otherP(getPatch(*it));
MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(ghostLev,_factors,refP,otherP,theFieldToFill,arrsOnPatches[*it]);
}
}
-void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyOnGhostZoneWith(int ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const
+void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const
{
MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(ghostLev,_factors,patchToBeModified,neighborPatch,cellFieldOnPatch,cellFieldNeighbor);
}
* \throw if \a cellFieldOnPatch is NULL or not allocated
* \sa createCellFieldOnPatch, MEDCouplingIMesh::CondenseFineToCoarse,fillCellFieldComingFromPatchGhost
*/
-void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative) const
+void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative) const
{
if(!cellFieldOnPatch || !cellFieldOnPatch->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::fillCellFieldComingFromPatch : the input cell field array is NULL or not allocated !");
MEDCouplingIMesh::CondenseFineToCoarse(_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors(),cellFieldOnThis);
if(!isConservative)
{
- int fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
+ mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
MEDCouplingStructuredMesh::MultiplyPartOf(_mesh->getCellGridStructure(),patch->getBLTRRange(),1./((double)fact),cellFieldOnThis);
}
}
* \throw if \a cellFieldOnPatch is NULL or not allocated
* \sa fillCellFieldComingFromPatch
*/
-void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev, bool isConservative) const
+void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative) const
{
if(!cellFieldOnPatch || !cellFieldOnPatch->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::fillCellFieldComingFromPatchGhost : the input cell field array is NULL or not allocated !");
MEDCouplingIMesh::CondenseFineToCoarseGhost(_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors(),cellFieldOnThis,ghostLev);
if(!isConservative)
{
- int fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
+ mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
MEDCouplingStructuredMesh::MultiplyPartOfByGhost(_mesh->getCellGridStructure(),patch->getBLTRRange(),ghostLev,1./((double)fact),cellFieldOnThis);
}
}
*
* \param [in] patchId - the id of the considered patch.
* \param [in] ghostLev - the size of the neighborhood.
- * \return DataArrayInt * - the newly allocated array containing the list of patches in the neighborhood of the considered patch. This array is to be deallocated by the caller.
+ * \return DataArrayIdType * - the newly allocated array containing the list of patches in the neighborhood of the considered patch. This array is to be deallocated by the caller.
*/
-DataArrayInt *MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const
+DataArrayIdType *MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const
{
- int nbp(getNumberOfPatches());
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- for(int i=0;i<nbp;i++)
+ mcIdType nbp(getNumberOfPatches());
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
+ for(mcIdType i=0;i<nbp;i++)
{
if(i!=patchId)
if(isPatchInNeighborhoodOf(i,patchId,ghostLev))
{
MCAuto<MEDCouplingUMesh> part(_mesh->buildUnstructured());
std::vector<bool> bs(_mesh->getNumberOfCells(),false);
- std::vector<int> cgs(_mesh->getCellGridStructure());
+ std::vector<mcIdType> cgs(_mesh->getCellGridStructure());
std::vector< MCAuto<MEDCouplingUMesh> > msSafe(_patches.size()+1);
std::size_t ii(0);
for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++)
MEDCouplingStructuredMesh::SwitchOnIdsFrom(cgs,(*it)->getBLTRRange(),bs);
msSafe[ii+1]=(*it)->getMesh()->buildUnstructured();
}
- MCAuto<DataArrayInt> eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs));
+ MCAuto<DataArrayIdType> eltsOff(DataArrayIdType::BuildListOfSwitchedOff(bs));
msSafe[0]=static_cast<MEDCouplingUMesh *>(part->buildPartOfMySelf(eltsOff->begin(),eltsOff->end(),false));
std::vector< const MEDCouplingUMesh * > ms(msSafe.size());
for(std::size_t i=0;i<msSafe.size();i++)
* \return MEDCouplingFieldDouble * - a newly created instance the caller has reponsability to deal with.
* \sa buildUnstructured
*/
-MEDCouplingFieldDouble *MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostSz, const std::vector<const DataArrayDouble *>& recurseArrs) const
+MEDCouplingFieldDouble *MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, const std::vector<const DataArrayDouble *>& recurseArrs) const
{
if(recurseArrs.empty())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseWithoutOverlapWithoutGhost : array is empty ! Should never happen !");
//
std::vector<bool> bs(_mesh->getNumberOfCells(),false);
- std::vector<int> cgs(_mesh->getCellGridStructure());
+ std::vector<mcIdType> cgs(_mesh->getCellGridStructure());
std::vector< MCAuto<MEDCouplingFieldDouble> > msSafe(_patches.size()+1);
std::size_t ii(0);
for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++)
std::vector<const DataArrayDouble *> tmpArrs(extractSubTreeFromGlobalFlatten((*it)->getMesh(),recurseArrs));
msSafe[ii+1]=(*it)->getMesh()->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,tmpArrs);
}
- MCAuto<DataArrayInt> eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs));
+ MCAuto<DataArrayIdType> eltsOff(DataArrayIdType::BuildListOfSwitchedOff(bs));
//
MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS));
MCAuto<DataArrayDouble> arr2(extractGhostFrom(ghostSz,recurseArrs[0]));
* This method extracts from \arr arr the part inside \a arr by cutting the \a ghostSz external part.
* \arr is expected to be an array having a number of tuples equal to \c getImageMesh()->buildWithGhost(ghostSz).
*/
-DataArrayDouble *MEDCouplingCartesianAMRMeshGen::extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const
+DataArrayDouble *MEDCouplingCartesianAMRMeshGen::extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const
{
- std::vector<int> st(_mesh->getCellGridStructure());
- std::vector< std::pair<int,int> > p(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(st));
- std::transform(st.begin(),st.end(),st.begin(),std::bind2nd(std::plus<int>(),2*ghostSz));
+ std::vector<mcIdType> st(_mesh->getCellGridStructure());
+ std::vector< std::pair<mcIdType,mcIdType> > p(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(st));
+ std::transform(st.begin(),st.end(),st.begin(),std::bind2nd(std::plus<mcIdType>(),2*ghostSz));
MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(p,ghostSz);
MCAuto<DataArrayDouble> ret(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,arr,p));
return ret.retn();
*
* \sa fillCellFieldOnPatchOnlyGhostAdv
*/
-std::vector<int> MEDCouplingCartesianAMRMeshGen::getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const
+std::vector<mcIdType> MEDCouplingCartesianAMRMeshGen::getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const
{
- std::vector<int> ret;
- int nbp(getNumberOfPatches());
+ std::vector<mcIdType> ret;
+ mcIdType nbp(getNumberOfPatches());
//
- for(int i=0;i<nbp;i++)
+ for(mcIdType i=0;i<nbp;i++)
{
if(i!=patchId)
if(isPatchInNeighborhoodOf(i,patchId,ghostLev))
{
std::ostringstream oss;
oss << "amr=MEDCouplingCartesianAMRMesh(\""<< getImageMesh()->getName() << "\"," << getSpaceDimension() << ",[";
- std::vector<int> ngs(getImageMesh()->getNodeGridStructure());
+ std::vector<mcIdType> ngs(getImageMesh()->getNodeGridStructure());
std::vector<double> orig(getImageMesh()->getOrigin()),dxyz(getImageMesh()->getDXYZ());
- std::copy(ngs.begin(),ngs.end(),std::ostream_iterator<int>(oss,","));
+ std::copy(ngs.begin(),ngs.end(),std::ostream_iterator<mcIdType>(oss,","));
oss << "],[";
std::copy(orig.begin(),orig.end(),std::ostream_iterator<double>(oss,","));
oss << "],[";
}
}
-MEDCouplingCartesianAMRMeshGen::MEDCouplingCartesianAMRMeshGen(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop,
+MEDCouplingCartesianAMRMeshGen::MEDCouplingCartesianAMRMeshGen(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop,
const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop)
{
_mesh=MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctStart,nodeStrctStop,originStart,originStop,dxyzStart,dxyzStop);
_mesh=mesh; _mesh->incrRef();
}
-void MEDCouplingCartesianAMRMeshGen::checkPatchId(int patchId) const
+void MEDCouplingCartesianAMRMeshGen::checkPatchId(mcIdType patchId) const
{
- int sz(getNumberOfPatches());
+ mcIdType sz(getNumberOfPatches());
if(patchId<0 || patchId>=sz)
{
std::ostringstream oss; oss << "MEDCouplingCartesianAMRMeshGen::checkPatchId : invalid patchId (" << patchId << ") ! Must be in [0," << sz << ") !";
}
}
-void MEDCouplingCartesianAMRMeshGen::checkFactorsAndIfNotSetAssign(const std::vector<int>& factors)
+void MEDCouplingCartesianAMRMeshGen::checkFactorsAndIfNotSetAssign(const std::vector<mcIdType>& factors)
{
- if(getSpaceDimension()!=(int)factors.size())
+ if(getSpaceDimension()!=ToIdType(factors.size()))
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::checkFactorsAndIfNotSetAssign : invalid size of factors ! size must be equal to the spaceDimension !");
if(_factors.empty())
{
}
}
-void MEDCouplingCartesianAMRMeshGen::retrieveGridsAtInternal(int lev, std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> >& grids) const
+void MEDCouplingCartesianAMRMeshGen::retrieveGridsAtInternal(mcIdType lev, std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> >& grids) const
{
if(lev==0)
{
}
}
-int MEDCouplingCartesianAMRMeshGen::GetGhostLevelInFineRef(int ghostLev, const std::vector<int>& factors)
+mcIdType MEDCouplingCartesianAMRMeshGen::GetGhostLevelInFineRef(mcIdType ghostLev, const std::vector<mcIdType>& factors)
{
if(ghostLev<0)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::GetGhostLevelInFineRef : the ghost size must be >=0 !");
if(factors.empty())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::GetGhostLevelInFineRef : no factors defined !");
- int ghostLevInPatchRef;
+ mcIdType ghostLevInPatchRef;
if(ghostLev==0)
ghostLevInPatchRef=0;
else
*/
std::vector<const DataArrayDouble *> MEDCouplingCartesianAMRMeshGen::extractSubTreeFromGlobalFlatten(const MEDCouplingCartesianAMRMeshGen *head, const std::vector<const DataArrayDouble *>& all) const
{
- int maxLev(getMaxNumberOfLevelsRelativeToThis());
+ mcIdType maxLev(getMaxNumberOfLevelsRelativeToThis());
std::vector<const DataArrayDouble *> ret;
std::vector<const MEDCouplingCartesianAMRMeshGen *> meshes(1,this);
std::size_t kk(0);
- for(int i=0;i<maxLev;i++)
+ for(mcIdType i=0;i<maxLev;i++)
{
std::vector<const MEDCouplingCartesianAMRMeshGen *> meshesTmp;
for(std::vector<const MEDCouplingCartesianAMRMeshGen *>::const_iterator it=meshes.begin();it!=meshes.end();it++)
if(patch)
{
std::ostringstream oss2; oss2 << varName << ".addPatch([";
- const std::vector< std::pair<int,int> >& bltr(patch->getBLTRRange());
+ const std::vector< std::pair<mcIdType,mcIdType> >& bltr(patch->getBLTRRange());
std::size_t sz(bltr.size());
for(std::size_t i=0;i<sz;i++)
{
oss2 << ",";
}
oss2 << "],[";
- std::copy(_factors.begin(),_factors.end(),std::ostream_iterator<int>(oss2,","));
+ std::copy(_factors.begin(),_factors.end(),std::ostream_iterator<mcIdType>(oss2,","));
oss2 << "])\n";
oss << oss2.str();
std::ostringstream oss3; oss3 << varName << "[" << j++ << "]";
/*!
* This method returns the level of \a this. 0 for god father. 1 for children of god father ...
*/
-int MEDCouplingCartesianAMRMeshSub::getAbsoluteLevel() const
+mcIdType MEDCouplingCartesianAMRMeshSub::getAbsoluteLevel() const
{
if(!_father)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshSub::getAbsoluteLevel : Impossible to find a god father because there is a hole in chain !");
declareAsNew();
}
-std::vector< std::pair<int,int> > MEDCouplingCartesianAMRMeshSub::positionRelativeToGodFather(std::vector<int>& st) const
+std::vector< std::pair<mcIdType,mcIdType> > MEDCouplingCartesianAMRMeshSub::positionRelativeToGodFather(std::vector<mcIdType>& st) const
{
st=_father->getFactors();
std::size_t dim(st.size());
- std::vector<int> prev(st);
- int id(_father->getPatchIdFromChildMesh(this));
+ std::vector<mcIdType> prev(st);
+ mcIdType id(_father->getPatchIdFromChildMesh(this));
const MEDCouplingCartesianAMRPatch *p(_father->getPatch(id));
- std::vector< std::pair<int,int> > ret(p->getBLTRRange());
- std::vector<int> delta(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(ret)),start(dim);
- std::transform(delta.begin(),delta.end(),prev.begin(),delta.begin(),std::multiplies<int>());
+ std::vector< std::pair<mcIdType,mcIdType> > ret(p->getBLTRRange());
+ std::vector<mcIdType> delta(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(ret)),start(dim);
+ std::transform(delta.begin(),delta.end(),prev.begin(),delta.begin(),std::multiplies<mcIdType>());
for(std::size_t i=0;i<dim;i++)
start[i]=ret[i].first;
- std::transform(start.begin(),start.end(),prev.begin(),start.begin(),std::multiplies<int>());
+ std::transform(start.begin(),start.end(),prev.begin(),start.begin(),std::multiplies<mcIdType>());
const MEDCouplingCartesianAMRMeshGen *it(_father);
while(!dynamic_cast<const MEDCouplingCartesianAMRMesh *>(it))
{
const MEDCouplingCartesianAMRMeshSub *itc(static_cast<const MEDCouplingCartesianAMRMeshSub *>(it));
- int id2(itc->_father->getPatchIdFromChildMesh(itc));
+ mcIdType id2(itc->_father->getPatchIdFromChildMesh(itc));
const MEDCouplingCartesianAMRPatch *p2(itc->_father->getPatch(id2));
- const std::vector< std::pair<int,int> >& start2(p2->getBLTRRange());
- std::vector<int> tmp(dim);
+ const std::vector< std::pair<mcIdType,mcIdType> >& start2(p2->getBLTRRange());
+ std::vector<mcIdType> tmp(dim);
for(std::size_t i=0;i<dim;i++)
tmp[i]=start2[i].first;
//
prev=itc->_father->getFactors();
- std::transform(st.begin(),st.end(),prev.begin(),st.begin(),std::multiplies<int>());
- std::transform(st.begin(),st.end(),tmp.begin(),tmp.begin(),std::multiplies<int>());
- std::transform(start.begin(),start.end(),tmp.begin(),start.begin(),std::plus<int>());
+ std::transform(st.begin(),st.end(),prev.begin(),st.begin(),std::multiplies<mcIdType>());
+ std::transform(st.begin(),st.end(),tmp.begin(),tmp.begin(),std::multiplies<mcIdType>());
+ std::transform(start.begin(),start.end(),tmp.begin(),start.begin(),std::plus<mcIdType>());
it=itc->_father;
}
for(std::size_t i=0;i<dim;i++)
return ret;
}
-int MEDCouplingCartesianAMRMeshSub::getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const
+mcIdType MEDCouplingCartesianAMRMeshSub::getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const
{
if(this==ref)
return 0;
/*!
* \sa getPositionRelativeTo
*/
-void MEDCouplingCartesianAMRMeshSub::getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<int>& ret) const
+void MEDCouplingCartesianAMRMeshSub::getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<mcIdType>& ret) const
{
if(this==ref)
return ;
if(!_father)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshSub::getPositionRelativeToInternal : ref is not in the progeny of this !");
- int myId(_father->getPatchIdFromChildMesh(this));
+ mcIdType myId(_father->getPatchIdFromChildMesh(this));
ret.push_back(myId);
_father->getPositionRelativeToInternal(ref,ret);
}
-MEDCouplingCartesianAMRMesh *MEDCouplingCartesianAMRMesh::New(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop,
+MEDCouplingCartesianAMRMesh *MEDCouplingCartesianAMRMesh::New(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop,
const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop)
{
return new MEDCouplingCartesianAMRMesh(meshName,spaceDim,nodeStrctStart,nodeStrctStop,originStart,originStop,dxyzStart,dxyzStop);
return this;
}
-int MEDCouplingCartesianAMRMesh::getAbsoluteLevel() const
+mcIdType MEDCouplingCartesianAMRMesh::getAbsoluteLevel() const
{
return 0;
}
{//not a bug - do nothing
}
-std::vector< std::pair<int,int> > MEDCouplingCartesianAMRMesh::positionRelativeToGodFather(std::vector<int>& st) const
+std::vector< std::pair<mcIdType,mcIdType> > MEDCouplingCartesianAMRMesh::positionRelativeToGodFather(std::vector<mcIdType>& st) const
{
st=_mesh->getCellGridStructure();
return MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(st);
}
-int MEDCouplingCartesianAMRMesh::getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const
+mcIdType MEDCouplingCartesianAMRMesh::getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const
{
if(this==ref)
return 0;
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::getAbsoluteLevelRelativeTo : ref is not in the progeny of this !");
}
-std::vector<MEDCouplingCartesianAMRPatchGen *> MEDCouplingCartesianAMRMesh::retrieveGridsAt(int absoluteLev) const
+std::vector<MEDCouplingCartesianAMRPatchGen *> MEDCouplingCartesianAMRMesh::retrieveGridsAt(mcIdType absoluteLev) const
{
std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> > rets;
retrieveGridsAtInternal(absoluteLev,rets);
*
* \sa createPatchesFromCriterion
*/
-void MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML(const std::vector<const INTERP_KERNEL::BoxSplittingOptions *>& bso, const DataArrayDouble *criterion, const std::vector< std::vector<int> >& factors, double eps)
+void MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML(const std::vector<const INTERP_KERNEL::BoxSplittingOptions *>& bso, const DataArrayDouble *criterion, const std::vector< std::vector<mcIdType> >& factors, double eps)
{
std::size_t nbOfLevs(bso.size());
if(nbOfLevs!=factors.size())
if(!bso[i])
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML : presence of a NULL BoxSplittingOptions in input vector !");
//
- std::vector<MEDCouplingCartesianAMRPatchGen *> elts(retrieveGridsAt((int)(i)));
+ std::vector<MEDCouplingCartesianAMRPatchGen *> elts(retrieveGridsAt(ToIdType((i))));
std::size_t sz(elts.size());
std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> > elts2(sz);
std::vector< MCAuto<DataArrayDouble> > elts3(sz);
}
}
-void MEDCouplingCartesianAMRMesh::getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<int>& ret) const
+void MEDCouplingCartesianAMRMesh::getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<mcIdType>& ret) const
{
}
{
}
-MEDCouplingCartesianAMRMesh::MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop,
+MEDCouplingCartesianAMRMesh::MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop,
const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop):MEDCouplingCartesianAMRMeshGen(meshName,spaceDim,nodeStrctStart,nodeStrctStop,originStart,originStop,dxyzStart,dxyzStop)
{
}
{
class MEDCouplingIMesh;
class MEDCouplingUMesh;
- class DataArrayInt;
+ class DataArrayIdType;
class DataArrayByte;
class DataArrayDouble;
class MEDCoupling1SGTUMesh;
{
public:
MEDCOUPLING_EXPORT virtual MEDCouplingCartesianAMRPatchGen *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const = 0;
- MEDCOUPLING_EXPORT int getNumberOfCellsRecursiveWithOverlap() const;
- MEDCOUPLING_EXPORT int getNumberOfCellsRecursiveWithoutOverlap() const;
- MEDCOUPLING_EXPORT int getMaxNumberOfLevelsRelativeToThis() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsRecursiveWithOverlap() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsRecursiveWithoutOverlap() const;
+ MEDCOUPLING_EXPORT mcIdType getMaxNumberOfLevelsRelativeToThis() const;
MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getMesh() const { return _mesh; }
protected:
MEDCouplingCartesianAMRPatchGen(const MEDCouplingCartesianAMRPatchGen& other, MEDCouplingCartesianAMRMeshGen *father);
class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
{
public:
- MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair<int,int> >& bottomLeftTopRight);
+ MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair<mcIdType,mcIdType> >& bottomLeftTopRight);
MEDCouplingCartesianAMRPatch *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const;
// direct forward to _mesh
- MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair<int,int> >& bottomLeftTopRight, const std::vector<int>& factors);
+ MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair<mcIdType,mcIdType> >& bottomLeftTopRight, const std::vector<mcIdType>& factors);
// end of direct forward to _mesh
- MEDCOUPLING_EXPORT int getNumberOfOverlapedCellsForFather() const;
- MEDCOUPLING_EXPORT bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
- MEDCOUPLING_EXPORT bool isInMyNeighborhoodExt(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
- MEDCOUPLING_EXPORT bool isInMyNeighborhoodDiffLev(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfOverlapedCellsForFather() const;
+ MEDCOUPLING_EXPORT bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, mcIdType ghostLev) const;
+ MEDCOUPLING_EXPORT bool isInMyNeighborhoodExt(const MEDCouplingCartesianAMRPatch *other, mcIdType ghostLev) const;
+ MEDCOUPLING_EXPORT bool isInMyNeighborhoodDiffLev(const MEDCouplingCartesianAMRPatch *other, mcIdType ghostLev) const;
// basic set/get
- MEDCOUPLING_EXPORT const std::vector< std::pair<int,int> >& getBLTRRange() const { return _bl_tr; }
- MEDCOUPLING_EXPORT std::vector< std::pair<int,int> > getBLTRRangeRelativeToGF() const;
- MEDCOUPLING_EXPORT std::vector<int> computeCellGridSt() const;
- MEDCOUPLING_EXPORT static bool IsInMyNeighborhood(int ghostLev, const std::vector< std::pair<int,int> >& p1, const std::vector< std::pair<int,int> >& p2);
+ MEDCOUPLING_EXPORT const std::vector< std::pair<mcIdType,mcIdType> >& getBLTRRange() const { return _bl_tr; }
+ MEDCOUPLING_EXPORT std::vector< std::pair<mcIdType,mcIdType> > getBLTRRangeRelativeToGF() const;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> computeCellGridSt() const;
+ MEDCOUPLING_EXPORT static bool IsInMyNeighborhood(mcIdType ghostLev, const std::vector< std::pair<mcIdType,mcIdType> >& p1, const std::vector< std::pair<mcIdType,mcIdType> >& p2);
//
- static std::vector< std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > > FindNeighborsOfSubPatchesOfSameLev(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2);
- static void FindNeighborsOfSubPatchesOf(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& ret);
- static void UpdateNeighborsOfOneWithTwo(int ghostLev, const std::vector<int>& factors, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2);
- static void UpdateNeighborsOfOneWithTwoExt(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2);
- static void UpdateNeighborsOfOneWithTwoMixedLev(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2, bool isConservative);
+ static std::vector< std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > > FindNeighborsOfSubPatchesOfSameLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2);
+ static void FindNeighborsOfSubPatchesOf(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& ret);
+ static void UpdateNeighborsOfOneWithTwo(mcIdType ghostLev, const std::vector<mcIdType>& factors, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2);
+ static void UpdateNeighborsOfOneWithTwoExt(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2);
+ static void UpdateNeighborsOfOneWithTwoMixedLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2, bool isConservative);
private:
- static void ComputeZonesOfTwoRelativeToOneDiffLev(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair<int,int> >& p1Zone, std::vector< std::pair<int,int> >& p2Zone, std::vector<int>& factToApplyOn2);
+ static void ComputeZonesOfTwoRelativeToOneDiffLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair<mcIdType,mcIdType> >& p1Zone, std::vector< std::pair<mcIdType,mcIdType> >& p2Zone, std::vector<mcIdType>& factToApplyOn2);
private:
std::size_t getHeapMemorySizeWithoutChildren() const;
- static const MEDCouplingCartesianAMRMeshGen *FindCommonAncestor(const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, int& lev);
- static std::vector<int> ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen *comAncestor, int lev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2);
- static void UpdateNeighborsOfOneWithTwoInternal(int ghostLev, const std::vector<int>& factors, const std::vector< std::pair<int,int> >&p1 ,const std::vector< std::pair<int,int> >&p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2);
+ static const MEDCouplingCartesianAMRMeshGen *FindCommonAncestor(const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, mcIdType& lev);
+ static std::vector<mcIdType> ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen *comAncestor, mcIdType lev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2);
+ static void UpdateNeighborsOfOneWithTwoInternal(mcIdType ghostLev, const std::vector<mcIdType>& factors, const std::vector< std::pair<mcIdType,mcIdType> >&p1 ,const std::vector< std::pair<mcIdType,mcIdType> >&p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2);
public:
- static void ApplyFactorsOnCompactFrmt(std::vector< std::pair<int,int> >& partBeforeFact, const std::vector<int>& factors);
- static void ApplyAllGhostOnCompactFrmt(std::vector< std::pair<int,int> >& partBeforeFact, int ghostSize);
+ static void ApplyFactorsOnCompactFrmt(std::vector< std::pair<mcIdType,mcIdType> >& partBeforeFact, const std::vector<mcIdType>& factors);
+ static void ApplyAllGhostOnCompactFrmt(std::vector< std::pair<mcIdType,mcIdType> >& partBeforeFact, mcIdType ghostSize);
private:
MEDCouplingCartesianAMRPatch(const MEDCouplingCartesianAMRPatch& other, MEDCouplingCartesianAMRMeshGen *father);
private:
//! bottom left/top right cell range relative to \a _father
- std::vector< std::pair<int,int> > _bl_tr;
+ std::vector< std::pair<mcIdType,mcIdType> > _bl_tr;
};
/*!
public:
MEDCOUPLING_EXPORT virtual MEDCouplingCartesianAMRMeshGen *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const = 0;
MEDCOUPLING_EXPORT int getSpaceDimension() const;
- MEDCOUPLING_EXPORT const std::vector<int>& getFactors() const { return _factors; }
- MEDCOUPLING_EXPORT void setFactors(const std::vector<int>& newFactors);
- MEDCOUPLING_EXPORT int getMaxNumberOfLevelsRelativeToThis() const;
- MEDCOUPLING_EXPORT int getNumberOfCellsAtCurrentLevel() const;
- MEDCOUPLING_EXPORT int getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const;
- MEDCOUPLING_EXPORT int getNumberOfCellsRecursiveWithOverlap() const;
- MEDCOUPLING_EXPORT int getNumberOfCellsRecursiveWithoutOverlap() const;
+ MEDCOUPLING_EXPORT const std::vector<mcIdType>& getFactors() const { return _factors; }
+ MEDCOUPLING_EXPORT void setFactors(const std::vector<mcIdType>& newFactors);
+ MEDCOUPLING_EXPORT mcIdType getMaxNumberOfLevelsRelativeToThis() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsAtCurrentLevel() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsRecursiveWithOverlap() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsRecursiveWithoutOverlap() const;
MEDCOUPLING_EXPORT const MEDCouplingIMesh *getImageMesh() const { return _mesh; }
//
MEDCOUPLING_EXPORT virtual const MEDCouplingCartesianAMRMeshGen *getFather() const = 0;
MEDCOUPLING_EXPORT virtual const MEDCouplingCartesianAMRMeshGen *getGodFather() const = 0;
- MEDCOUPLING_EXPORT virtual int getAbsoluteLevel() const = 0;
+ MEDCOUPLING_EXPORT virtual mcIdType getAbsoluteLevel() const = 0;
MEDCOUPLING_EXPORT virtual void detachFromFather() = 0;
- MEDCOUPLING_EXPORT virtual std::vector< std::pair<int,int> > positionRelativeToGodFather(std::vector<int>& st) const = 0;
- MEDCOUPLING_EXPORT virtual int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const = 0;
- MEDCOUPLING_EXPORT std::vector<int> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
- MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<int>& pos) const;
- MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<int>& pos) const;
- MEDCOUPLING_EXPORT virtual std::vector<MEDCouplingCartesianAMRPatchGen *> retrieveGridsAt(int absoluteLev) const;
- MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair<int,int> >& bottomLeftTopRight, const std::vector<int>& factors);
+ MEDCOUPLING_EXPORT virtual std::vector< std::pair<mcIdType,mcIdType> > positionRelativeToGodFather(std::vector<mcIdType>& st) const = 0;
+ MEDCOUPLING_EXPORT virtual mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const = 0;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
+ MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<mcIdType>& pos) const;
+ MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<mcIdType>& pos) const;
+ MEDCOUPLING_EXPORT virtual std::vector<MEDCouplingCartesianAMRPatchGen *> retrieveGridsAt(mcIdType absoluteLev) const;
+ MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair<mcIdType,mcIdType> >& bottomLeftTopRight, const std::vector<mcIdType>& factors);
MEDCOUPLING_EXPORT void removeAllPatches();
- MEDCOUPLING_EXPORT void removePatch(int patchId);
- MEDCOUPLING_EXPORT int getNumberOfPatches() const;
- MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const std::vector<bool>& criterion, const std::vector<int>& factors);
- MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<int>& factors);
- MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<int>& factors, double eps);
- MEDCOUPLING_EXPORT int getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
+ MEDCOUPLING_EXPORT void removePatch(mcIdType patchId);
+ MEDCOUPLING_EXPORT mcIdType getNumberOfPatches() const;
+ MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const std::vector<bool>& criterion, const std::vector<mcIdType>& factors);
+ MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<mcIdType>& factors);
+ MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<mcIdType>& factors, double eps);
+ MEDCOUPLING_EXPORT mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
MEDCOUPLING_EXPORT std::vector< const MEDCouplingCartesianAMRPatch *> getPatches() const;
- MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRPatch *getPatch(int patchId) const;
- MEDCOUPLING_EXPORT bool isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const;
- MEDCOUPLING_EXPORT DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const;
+ MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const;
+ MEDCOUPLING_EXPORT bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const;
// coarse to fine
- MEDCOUPLING_EXPORT void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
- MEDCOUPLING_EXPORT void fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev, bool isConservative=true) const;
- MEDCOUPLING_EXPORT void fillCellFieldOnPatchOnlyOnGhostZone(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const;
+ MEDCOUPLING_EXPORT void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
+ MEDCOUPLING_EXPORT void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const;
+ MEDCOUPLING_EXPORT void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const;
// coarse to fine + fine to fine
- MEDCOUPLING_EXPORT void fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, const std::vector<const DataArrayDouble *>& arrsOnPatches, bool isConservative=true) const;
+ MEDCOUPLING_EXPORT void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, const std::vector<const DataArrayDouble *>& arrsOnPatches, bool isConservative=true) const;
// fine to fine
- MEDCOUPLING_EXPORT void fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, const std::vector<const DataArrayDouble *>& arrsOnPatches) const;
- MEDCOUPLING_EXPORT void fillCellFieldOnPatchOnlyOnGhostZoneWith(int ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
+ MEDCOUPLING_EXPORT void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, const std::vector<const DataArrayDouble *>& arrsOnPatches) const;
+ MEDCOUPLING_EXPORT void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
// fine to coarse
- MEDCOUPLING_EXPORT void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
- MEDCOUPLING_EXPORT void fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev, bool isConservative=true) const;
+ MEDCOUPLING_EXPORT void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
+ MEDCOUPLING_EXPORT void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const;
//
- MEDCOUPLING_EXPORT DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
//
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const;
MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const;
MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostSz, const std::vector<const DataArrayDouble *>& recurseArrs) const;
- MEDCOUPLING_EXPORT DataArrayDouble *extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const;
- MEDCOUPLING_EXPORT std::vector<int> getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, const std::vector<const DataArrayDouble *>& recurseArrs) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
MEDCOUPLING_EXPORT std::string buildPythonDumpOfThis() const;
protected:
MEDCouplingCartesianAMRMeshGen(const MEDCouplingCartesianAMRMeshGen& other);
- MEDCouplingCartesianAMRMeshGen(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop,
+ MEDCouplingCartesianAMRMeshGen(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop,
const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop);
MEDCouplingCartesianAMRMeshGen(MEDCouplingIMesh *mesh);
- void checkPatchId(int patchId) const;
- void checkFactorsAndIfNotSetAssign(const std::vector<int>& factors);
- void retrieveGridsAtInternal(int lev, std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> >& grids) const;
- static int GetGhostLevelInFineRef(int ghostLev, const std::vector<int>& factors);
+ void checkPatchId(mcIdType patchId) const;
+ void checkFactorsAndIfNotSetAssign(const std::vector<mcIdType>& factors);
+ void retrieveGridsAtInternal(mcIdType lev, std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> >& grids) const;
+ static mcIdType GetGhostLevelInFineRef(mcIdType ghostLev, const std::vector<mcIdType>& factors);
std::vector<const DataArrayDouble *> extractSubTreeFromGlobalFlatten(const MEDCouplingCartesianAMRMeshGen *head, const std::vector<const DataArrayDouble *>& all) const;
void dumpPatchesOf(const std::string& varName, std::ostream& oss) const;
public:
- virtual void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<int>& ret) const = 0;
+ virtual void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<mcIdType>& ret) const = 0;
protected:
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
protected:
MCAuto<MEDCouplingIMesh> _mesh;
std::vector< MCAuto<MEDCouplingCartesianAMRPatch> > _patches;
- std::vector<int> _factors;
+ std::vector<mcIdType> _factors;
};
class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
MEDCouplingCartesianAMRMeshSub(MEDCouplingCartesianAMRMeshGen *father, MEDCouplingIMesh *mesh);
MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getFather() const;
MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getGodFather() const;
- MEDCOUPLING_EXPORT int getAbsoluteLevel() const;
+ MEDCOUPLING_EXPORT mcIdType getAbsoluteLevel() const;
MEDCOUPLING_EXPORT void detachFromFather();
- MEDCOUPLING_EXPORT std::vector< std::pair<int,int> > positionRelativeToGodFather(std::vector<int>& st) const;
- MEDCOUPLING_EXPORT int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
+ MEDCOUPLING_EXPORT std::vector< std::pair<mcIdType,mcIdType> > positionRelativeToGodFather(std::vector<mcIdType>& st) const;
+ MEDCOUPLING_EXPORT mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
private:
MEDCouplingCartesianAMRMeshSub(const MEDCouplingCartesianAMRMeshSub& other, MEDCouplingCartesianAMRMeshGen *father);
MEDCouplingCartesianAMRMeshSub *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const;
- void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<int>& ret) const;
+ void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<mcIdType>& ret) const;
protected:
MEDCouplingCartesianAMRMeshGen *_father;
};
class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
{
public:
- MEDCOUPLING_EXPORT static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop,
+ MEDCOUPLING_EXPORT static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop,
const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop);
MEDCOUPLING_EXPORT static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh);
MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getFather() const;
MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getGodFather() const;
- MEDCOUPLING_EXPORT int getAbsoluteLevel() const;
+ MEDCOUPLING_EXPORT mcIdType getAbsoluteLevel() const;
MEDCOUPLING_EXPORT void detachFromFather();
- MEDCOUPLING_EXPORT std::vector< std::pair<int,int> > positionRelativeToGodFather(std::vector<int>& st) const;
- MEDCOUPLING_EXPORT int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
- MEDCOUPLING_EXPORT std::vector<MEDCouplingCartesianAMRPatchGen *> retrieveGridsAt(int absoluteLev) const;
+ MEDCOUPLING_EXPORT std::vector< std::pair<mcIdType,mcIdType> > positionRelativeToGodFather(std::vector<mcIdType>& st) const;
+ MEDCOUPLING_EXPORT mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
+ MEDCOUPLING_EXPORT std::vector<MEDCouplingCartesianAMRPatchGen *> retrieveGridsAt(mcIdType absoluteLev) const;
MEDCouplingCartesianAMRMesh *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const;
- MEDCOUPLING_EXPORT void createPatchesFromCriterionML(const std::vector<const INTERP_KERNEL::BoxSplittingOptions *>& bso, const DataArrayDouble *criterion, const std::vector< std::vector<int> >& factors, double eps);
+ MEDCOUPLING_EXPORT void createPatchesFromCriterionML(const std::vector<const INTERP_KERNEL::BoxSplittingOptions *>& bso, const DataArrayDouble *criterion, const std::vector< std::vector<mcIdType> >& factors, double eps);
private:
- void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<int>& ret) const;
+ void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<mcIdType>& ret) const;
MEDCouplingCartesianAMRMesh(const MEDCouplingCartesianAMRMesh& other);
- MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop,
+ MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop,
const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop);
MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh);
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
std::size_t MEDCouplingCurveLinearMesh::getHeapMemorySizeWithoutChildren() const
{
std::size_t ret(MEDCouplingStructuredMesh::getHeapMemorySizeWithoutChildren());
- ret+=_structure.capacity()*sizeof(int);
+ ret+=_structure.capacity()*sizeof(mcIdType);
return ret;
}
}
void MEDCouplingCurveLinearMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const
{
if(!isEqualWithoutConsideringStr(other,prec))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkDeepEquivalWith : Meshes are not the same !");
* The user intend that the nodes are the same, so by construction of MEDCoupling::MEDCouplingCurveLinearMesh, \a this and \a other are the same !
*/
void MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor) const
+ DataArrayIdType *&cellCor) const
{
if(!isEqualWithoutConsideringStr(other,prec))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !");
void MEDCouplingCurveLinearMesh::checkConsistencyLight() const
{
- std::size_t sz=_structure.size(),i=0,nbOfNodes=1;
+ std::size_t sz=_structure.size(),i=0;
+ mcIdType nbOfNodes=1;
if(sz<1)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : structure should have a lgth of size 1 at least !");
- for(std::vector<int>::const_iterator it=_structure.begin();it!=_structure.end();it++,i++)
+ for(std::vector<mcIdType>::const_iterator it=_structure.begin();it!=_structure.end();it++,i++)
{
if((*it)<1)
{ std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkConsistencyLight : At pos #" << i << " of structure value is " << *it << "should be >= 1 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array is not allocated !");
if(_coords->getNumberOfComponents()<1)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array should have >= 1 components !");
- if(_coords->getNumberOfTuples()!=(int)nbOfNodes)
+ if(_coords->getNumberOfTuples()!=nbOfNodes)
{
std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkConsistencyLight : structure said that number of nodes should be equal to " << nbOfNodes << " but number of tuples in array is equal to " << _coords->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
checkConsistencyLight();
}
-std::size_t MEDCouplingCurveLinearMesh::getNumberOfCells() const
+mcIdType MEDCouplingCurveLinearMesh::getNumberOfCells() const
{
checkConsistencyLight();
return MEDCouplingStructuredMesh::getNumberOfCells();
}
-int MEDCouplingCurveLinearMesh::getNumberOfNodes() const
+mcIdType MEDCouplingCurveLinearMesh::getNumberOfNodes() const
{
checkConsistencyLight();
return MEDCouplingStructuredMesh::getNumberOfNodes();
}
-void MEDCouplingCurveLinearMesh::getNodeGridStructure(int *res) const
+void MEDCouplingCurveLinearMesh::getNodeGridStructure(mcIdType *res) const
{
std::copy(_structure.begin(),_structure.end(),res);
}
{
if(!((const DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getSpaceDimension : no array set ! impossible to deduce a space dimension !");
- return _coords->getNumberOfComponents();
+ return int(_coords->getNumberOfComponents());
}
-void MEDCouplingCurveLinearMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
+void MEDCouplingCurveLinearMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const
{
if(!((const DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCoordinatesOfNode : Coordinates not set !");
- int nbOfCompo=_coords->getNumberOfComponents();
+ std::size_t nbOfCompo=_coords->getNumberOfComponents();
if(nodeId>=0 && nodeId<_coords->getNumberOfTuples())
coo.insert(coo.end(),_coords->begin()+nodeId*nbOfCompo,_coords->begin()+(nodeId+1)*nbOfCompo);
else
}
}
-void MEDCouplingCurveLinearMesh::setNodeGridStructure(const int *gridStructBg, const int *gridStructEnd)
+void MEDCouplingCurveLinearMesh::setNodeGridStructure(const mcIdType *gridStructBg, const mcIdType *gridStructEnd)
{
std::size_t sz=std::distance(gridStructBg,gridStructEnd);
if(sz>=1 && sz<=3)
}
}
-std::vector<int> MEDCouplingCurveLinearMesh::getNodeGridStructure() const
+std::vector<mcIdType> MEDCouplingCurveLinearMesh::getNodeGridStructure() const
{
return _structure;
}
-MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const
+MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const
{
checkConsistencyLight();
int dim(getSpaceDimension());
- std::vector<int> dims(getMeshDimension());
- if(dim!=(int)cellPart.size())
+ std::vector<mcIdType> dims(getMeshDimension());
+ if(dim!=ToIdType(cellPart.size()))
{
std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::vector< std::pair<int,int> > nodePartFormat(cellPart);
- for(std::vector< std::pair<int,int> >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++)
+ std::vector< std::pair<mcIdType,mcIdType> > nodePartFormat(cellPart);
+ for(std::vector< std::pair<mcIdType,mcIdType> >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++)
(*it).second++;
- MCAuto<DataArrayInt> tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat));
+ MCAuto<DataArrayIdType> tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat));
MCAuto<MEDCouplingCurveLinearMesh> ret(dynamic_cast<MEDCouplingCurveLinearMesh *>(deepCopy()));
const DataArrayDouble *coo(ret->getCoords());
if(coo)
*/
void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim1(bool isAbs, MEDCouplingFieldDouble *field) const
{
- int nbnodes=getNumberOfNodes();
+ mcIdType nbnodes=getNumberOfNodes();
int spaceDim=getSpaceDimension();
MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
if(nbnodes==0)
*/
void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2(bool isAbs, MEDCouplingFieldDouble *field) const
{
- int nbcells=getNumberOfCells();
+ mcIdType nbcells=getNumberOfCells();
int spaceDim=getSpaceDimension();
if(spaceDim!=2 && spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2 : with meshDim 2 only space dimension 2 and 3 are possible !");
arr->alloc(nbcells,1);
double *pt=arr->getPointer();
const double *coords=_coords->begin();
- int nX=_structure[0]-1;
- int conn[4];
- for(int i=0;i<nbcells;i++,pt++)
+ mcIdType nX=_structure[0]-1;
+ mcIdType conn[4];
+ for(mcIdType i=0;i<nbcells;i++,pt++)
{
- int cy=i/nX,cx=i-cy*nX;
+ mcIdType cy=i/nX,cx=i-cy*nX;
conn[0]=cy*(nX+1)+cx; conn[1]=(cy+1)*(nX+1)+cx; conn[2]=(cy+1)*(nX+1)+1+cx; conn[3]=cy*(nX+1)+cx+1;
- *pt=INTERP_KERNEL::computeVolSurfOfCell2<int,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_QUAD4,conn,4,coords,spaceDim);
+ *pt=INTERP_KERNEL::computeVolSurfOfCell2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_QUAD4,conn,4,coords,spaceDim);
}
if(isAbs)
arr->abs();
*/
void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3(bool isAbs, MEDCouplingFieldDouble *field) const
{
- int nbcells=getNumberOfCells();
+ mcIdType nbcells=getNumberOfCells();
int spaceDim=getSpaceDimension();
if(spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3 : with meshDim 3 only space dimension 3 is possible !");
arr->alloc(nbcells,1);
double *pt=arr->getPointer();
const double *coords=_coords->begin();
- int nX=_structure[0]-1,nY=(_structure[0]-1)*(_structure[1]-1);
- int nY1=_structure[0]*_structure[1];
- int conn[8];
- for(int i=0;i<nbcells;i++,pt++)
+ mcIdType nX=_structure[0]-1,nY=(_structure[0]-1)*(_structure[1]-1);
+ mcIdType nY1=_structure[0]*_structure[1];
+ mcIdType conn[8];
+ for(mcIdType i=0;i<nbcells;i++,pt++)
{
- int cz=i/nY;
- int cy=(i-cz*nY)/nX;
- int cx=(i-cz*nY)-nX*cy;
+ mcIdType cz=i/nY;
+ mcIdType cy=(i-cz*nY)/nX;
+ mcIdType cx=(i-cz*nY)-nX*cy;
conn[0]=cz*nY1+cy*(nX+1)+cx; conn[1]=cz*nY1+(cy+1)*(nX+1)+cx; conn[2]=cz*nY1+(cy+1)*(nX+1)+1+cx; conn[3]=cz*nY1+cy*(nX+1)+cx+1;
conn[4]=(cz+1)*nY1+cy*(nX+1)+cx; conn[5]=(cz+1)*nY1+(cy+1)*(nX+1)+cx; conn[6]=(cz+1)*nY1+(cy+1)*(nX+1)+1+cx; conn[7]=(cz+1)*nY1+cy*(nX+1)+cx+1;
- *pt=INTERP_KERNEL::computeVolSurfOfCell2<int,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_HEXA8,conn,8,coords,3);
+ *pt=INTERP_KERNEL::computeVolSurfOfCell2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_HEXA8,conn,8,coords,3);
}
if(isAbs)
arr->abs();
throw INTERP_KERNEL::Exception("Expected a cmesh with meshDim == 2 !");
MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
DataArrayDouble *array=DataArrayDouble::New();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
array->alloc(nbOfCells,3);
double *vals=array->getPointer();
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{ vals[3*i]=0.; vals[3*i+1]=0.; vals[3*i+2]=1.; }
ret->setArray(array);
array->decrRef();
public:
static const int MY_SPACEDIM=SPACEDIMM;
static const int MY_MESHDIM=8;
- typedef int MyConnType;
+ typedef mcIdType MyConnType;
static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
// begin
// useless, but for windows compilation ...
const double* getCoordinatesPtr() const { return 0; }
- const int* getConnectivityPtr() const { return 0; }
- const int* getConnectivityIndexPtr() const { return 0; }
- INTERP_KERNEL::NormalizedCellType getTypeOfElement(int) const { return (INTERP_KERNEL::NormalizedCellType)0; }
+ const mcIdType* getConnectivityPtr() const { return 0; }
+ const mcIdType* getConnectivityIndexPtr() const { return 0; }
+ INTERP_KERNEL::NormalizedCellType getTypeOfElement(mcIdType) const { return (INTERP_KERNEL::NormalizedCellType)0; }
// end
};
}
/// @endcond
-int MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double eps) const
+mcIdType MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double eps) const
{
checkConsistencyLight();
int spaceDim=getSpaceDimension();
const double *coords=_coords->getConstPointer();
- int nodeId=-1;
+ mcIdType nodeId=-1;
_coords->distanceToTuple(pos,pos+spaceDim,nodeId);
if(nodeId<0)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCellContainingPoint : internal problem 1 !");
- int conn[8];
- int nbOfNodes=getNumberOfNodes();
+ mcIdType conn[8];
+ mcIdType nbOfNodes=getNumberOfNodes();
if(nbOfNodes==1)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCellContainingPoint : No cells in this !");
switch(getMeshDimension())
case 2:
if(spaceDim==2)
{
- int ny=nodeId/_structure[0],nx=nodeId-ny*_structure[0];
+ mcIdType ny=nodeId/_structure[0],nx=nodeId-ny*_structure[0];
if(nx>0 && ny>0)
{
conn[0]=nx-1+_structure[0]*(ny-1); conn[1]=nx-1+_structure[0]*ny; conn[2]=nx+_structure[0]*ny; conn[3]=nx+_structure[0]*(ny-1);
{
if(spaceDim==3)
{
- int nY=_structure[0]*_structure[1];
- int nz=nodeId/_structure[1]; int ny=(nodeId-nz*nY)/_structure[0]; int nx=(nodeId-nz*nY)-_structure[0]*ny;
+ mcIdType nY=_structure[0]*_structure[1];
+ mcIdType nz=nodeId/_structure[1]; mcIdType ny=(nodeId-nz*nY)/_structure[0]; mcIdType nx=(nodeId-nz*nY)-_structure[0]*ny;
if(nx>0 && ny>0 && nz>0)
{
conn[0]=nx-1+_structure[0]*(ny-1)+nY*(nz-1); conn[1]=nx-1+_structure[2]*ny+nY*(nz-1); conn[2]=nx+_structure[2]*ny+nY*(nz-1); conn[3]=nx+_structure[0]*(ny-1)+nY*(nz-1);
}
}
-void MEDCouplingCurveLinearMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const
+void MEDCouplingCurveLinearMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const
{
- int ret(getCellContainingPoint(pos,eps));
+ mcIdType ret(getCellContainingPoint(pos,eps));
elts.push_back(ret);
}
if(!((DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::rotate : no coordinates set !");
int spaceDim=getSpaceDimension();
- int nbNodes=_coords->getNumberOfTuples();
+ mcIdType nbNodes(_coords->getNumberOfTuples());
double *coords=_coords->getPointer();
if(spaceDim==3)
DataArrayDouble::Rotate3DAlg(center,vector,angle,nbNodes,coords,coords);
if(!((DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::translate : no coordinates set !");
double *coords=_coords->getPointer();
- int nbNodes=getNumberOfNodes();
+ mcIdType nbNodes=getNumberOfNodes();
int dim=getSpaceDimension();
- for(int i=0; i<nbNodes; i++)
+ for(mcIdType i=0; i<nbNodes; i++)
for(int idim=0; idim<dim;idim++)
coords[i*dim+idim]+=vector[idim];
_coords->declareAsNew();
if(!((DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::scale : no coordinates set !");
double *coords=_coords->getPointer();
- int nbNodes=_coords->getNumberOfTuples();
- int dim=_coords->getNumberOfComponents();
- for(int i=0;i<nbNodes;i++)
+ mcIdType nbNodes(_coords->getNumberOfTuples());
+ std::size_t dim(_coords->getNumberOfComponents());
+ for(mcIdType i=0;i<nbNodes;i++)
{
std::transform(coords+i*dim,coords+(i+1)*dim,point,coords+i*dim,std::minus<double>());
std::transform(coords+i*dim,coords+(i+1)*dim,coords+i*dim,std::bind2nd(std::multiplies<double>(),factor));
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
int meshDim=getMeshDimension();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
ret->alloc(nbOfCells,spaceDim);
ret->copyStringInfoFrom(*getCoords());
switch(meshDim)
*/
void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3(DataArrayDouble *bary) const
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
double *ptToFill=bary->getPointer();
const double *coor=_coords->getConstPointer();
if(getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3 : with meshDim 3 only space dimension 3 is possible !");
- int nX=_structure[0]-1,nY=(_structure[0]-1)*(_structure[1]-1);
- int nY1=_structure[0]*_structure[1];
- int conn[8];
- for(int i=0;i<nbOfCells;i++)
+ mcIdType nX=_structure[0]-1,nY=(_structure[0]-1)*(_structure[1]-1);
+ mcIdType nY1=_structure[0]*_structure[1];
+ mcIdType conn[8];
+ for(mcIdType i=0;i<nbOfCells;i++)
{
- int cz=i/nY;
- int cy=(i-cz*nY)/nX;
- int cx=(i-cz*nY)-nX*cy;
+ mcIdType cz=i/nY;
+ mcIdType cy=(i-cz*nY)/nX;
+ mcIdType cx=(i-cz*nY)-nX*cy;
conn[0]=cz*nY1+cy*(nX+1)+cx+1; conn[1]=cz*nY1+cy*(nX+1)+cx; conn[2]=cz*nY1+(cy+1)*(nX+1)+cx; conn[3]=cz*nY1+(cy+1)*(nX+1)+1+cx;
conn[4]=(cz+1)*nY1+cy*(nX+1)+cx+1; conn[5]=(cz+1)*nY1+cy*(nX+1)+cx; conn[6]=(cz+1)*nY1+(cy+1)*(nX+1)+cx; conn[7]=(cz+1)*nY1+(cy+1)*(nX+1)+1+cx;
- INTERP_KERNEL::computeBarycenter2<int,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_HEXA8,conn,8,coor,3,ptToFill);
+ INTERP_KERNEL::computeBarycenter2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_HEXA8,conn,8,coor,3,ptToFill);
ptToFill+=3;
}
}
*/
void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim2(DataArrayDouble *bary) const
{
- int nbcells=getNumberOfCells();
+ mcIdType nbcells=getNumberOfCells();
int spaceDim=getSpaceDimension();
double *ptToFill=bary->getPointer();
const double *coor=_coords->getConstPointer();
if(spaceDim!=2 && spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim2 : with meshDim 2 only space dimension 2 and 3 are possible !");
- int nX=_structure[0]-1;
- int conn[4];
- for(int i=0;i<nbcells;i++)
+ mcIdType nX=_structure[0]-1;
+ mcIdType conn[4];
+ for(mcIdType i=0;i<nbcells;i++)
{
- int cy=i/nX,cx=i-cy*nX;
+ mcIdType cy=i/nX,cx=i-cy*nX;
conn[0]=cy*(nX+1)+cx; conn[1]=(cy+1)*(nX+1)+cx; conn[2]=(cy+1)*(nX+1)+1+cx; conn[3]=cy*(nX+1)+cx+1;
- INTERP_KERNEL::computeBarycenter2<int,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_QUAD4,conn,4,coor,spaceDim,ptToFill);
+ INTERP_KERNEL::computeBarycenter2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_QUAD4,conn,4,coor,spaceDim,ptToFill);
ptToFill+=spaceDim;
}
}
std::transform(bary->begin(),bary->end(),bary->getPointer(),std::bind2nd(std::multiplies<double>(),0.5));
}
-void MEDCouplingCurveLinearMesh::renumberCells(const int *old2NewBg, bool check)
+void MEDCouplingCurveLinearMesh::renumberCells(const mcIdType *old2NewBg, bool check)
{
throw INTERP_KERNEL::Exception("Functionality of renumbering cell not available for CurveLinear Mesh !");
}
-void MEDCouplingCurveLinearMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+void MEDCouplingCurveLinearMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
{
int it,order;
double time=getTime(it,order);
//
tinyInfo.push_back(it);
tinyInfo.push_back(order);
- tinyInfo.push_back((int)_structure.size());
- for(std::vector<int>::const_iterator itt=_structure.begin();itt!=_structure.end();itt++)
+ tinyInfo.push_back(ToIdType(_structure.size()));
+ for(std::vector<mcIdType>::const_iterator itt=_structure.begin();itt!=_structure.end();itt++)
tinyInfo.push_back(*itt);
- std::vector<int> tinyInfo2;
+ std::vector<mcIdType> tinyInfo2;
if((const DataArrayDouble *)_coords)
_coords->getTinySerializationIntInformation(tinyInfo2);
tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end());
tinyInfoD.push_back(time);
}
-void MEDCouplingCurveLinearMesh::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
+void MEDCouplingCurveLinearMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
a1->alloc(tinyInfo[2],1);
- std::vector<int> tinyInfo2(tinyInfo.begin()+3+tinyInfo[2],tinyInfo.end());
+ std::vector<mcIdType> tinyInfo2(tinyInfo.begin()+3+tinyInfo[2],tinyInfo.end());
a2->resizeForUnserialization(tinyInfo2);
}
-void MEDCouplingCurveLinearMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
+void MEDCouplingCurveLinearMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const
{
- a1=DataArrayInt::New();
- a1->alloc((int)_structure.size(),1);
- int *ptr=a1->getPointer();
- for(std::vector<int>::const_iterator it=_structure.begin();it!=_structure.end();it++,ptr++)
+ a1=DataArrayIdType::New();
+ a1->alloc(_structure.size(),1);
+ mcIdType *ptr=a1->getPointer();
+ for(std::vector<mcIdType>::const_iterator it=_structure.begin();it!=_structure.end();it++,ptr++)
*ptr=(*it);
- int sz=0;
+ mcIdType sz=0;
if((const DataArrayDouble *)_coords)
if(_coords->isAllocated())
sz=_coords->getNbOfElems();
std::copy(_coords->begin(),_coords->end(),a2->getPointer());
}
-void MEDCouplingCurveLinearMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+void MEDCouplingCurveLinearMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings)
{
setName(littleStrings[0]);
setDescription(littleStrings[1]);
setTimeUnit(littleStrings[2]);
- setTime(tinyInfoD[0],tinyInfo[0],tinyInfo[1]);
- int sz=tinyInfo[2];
+ setTime(tinyInfoD[0],FromIdType<int>(tinyInfo[0]),FromIdType<int>(tinyInfo[1]));
+ mcIdType sz=tinyInfo[2];
_structure.resize(sz);
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
_structure[i]=tinyInfo[3+i];
- if((int)tinyInfo.size()>sz+3)
+ if(ToIdType(tinyInfo.size())>sz+3)
{
_coords=DataArrayDouble::New();
- std::vector<int> tinyInfo2(tinyInfo.begin()+3+sz,tinyInfo.end());
+ std::vector<mcIdType> tinyInfo2(tinyInfo.begin()+3+sz,tinyInfo.end());
_coords->resizeForUnserialization(tinyInfo2);
std::copy(a2->begin(),a2->end(),_coords->getPointer());
std::vector<std::string> littleStrings2(littleStrings.begin()+3,littleStrings.end());
void MEDCouplingCurveLinearMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const
{
std::ostringstream extent;
- int meshDim=(int)_structure.size();
- if(meshDim<=0 || meshDim>3)
+ std::size_t meshDim=_structure.size();
+ if(meshDim==0 || meshDim>3)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::writeVTKLL : meshDim invalid ! must be in [1,2,3] !");
- for(int i=0;i<3;i++)
- { int val=i<meshDim?_structure[i]-1:0; extent << "0 " << val << " "; }
+ for(std::size_t i=0;i<3;i++)
+ { mcIdType val=i<meshDim?_structure[i]-1:0; extent << "0 " << val << " "; }
ofs << " <" << getVTKDataSetType() << " WholeExtent=\"" << extent.str() << "\">\n";
ofs << " <Piece Extent=\"" << extent.str() << "\">\n";
ofs << " <PointData>\n" << pointData << std::endl;
{
stream << "MEDCouplingCurveLinearMesh C++ instance at " << this << ". Name : \"" << getName() << "\".";
stream << " Nodal structure : [";
- for(std::size_t i=0;i<_structure.size();i++)
+ std::size_t s_size=_structure.size();
+ for(std::size_t i=0;i<s_size;i++)
{
- char tmp='X'+i;
+ char tmp=(char)((int)('X')+i);
stream << " " << tmp << "=" << _structure[i];
- if(i!=_structure.size()-1)
+ if(i!=s_size-1)
stream << ", ";
}
stream << " ].";
{ stream << std::endl << "No coordinates set !"; return ; }
if(!coo->isAllocated())
{ stream << std::endl << "Coordinates set but not allocated !"; return ; }
- int nbOfCompo(coo->getNumberOfComponents());
- int nbOfCompoExp(-1);
+ std::size_t nbOfCompo(coo->getNumberOfComponents());
+ std::size_t nbOfCompoExp(-1);
try
{
nbOfCompoExp=getSpaceDimension();
}
- catch(INTERP_KERNEL::Exception& e)
+ catch(INTERP_KERNEL::Exception&)
{
}
if(nbOfCompo!=nbOfCompoExp)
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const;
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const;
MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor) const;
+ DataArrayIdType *&cellCor) const;
MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
- MEDCOUPLING_EXPORT std::size_t getNumberOfCells() const;
- MEDCOUPLING_EXPORT int getNumberOfNodes() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const;
MEDCOUPLING_EXPORT int getSpaceDimension() const;
- MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
+ MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const;
MEDCOUPLING_EXPORT std::string simpleRepr() const;
MEDCOUPLING_EXPORT std::string advancedRepr() const;
MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const;
MEDCOUPLING_EXPORT DataArrayDouble *getCoords();
MEDCOUPLING_EXPORT const DataArrayDouble *getCoords() const;
MEDCOUPLING_EXPORT void setCoords(const DataArrayDouble *coords);
- MEDCOUPLING_EXPORT void setNodeGridStructure(const int *gridStructBg, const int *gridStructEnd);
- MEDCOUPLING_EXPORT std::vector<int> getNodeGridStructure() const;
- MEDCOUPLING_EXPORT MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const;
+ MEDCOUPLING_EXPORT void setNodeGridStructure(const mcIdType *gridStructBg, const mcIdType *gridStructEnd);
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getNodeGridStructure() const;
+ MEDCOUPLING_EXPORT MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const;
// tools
MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
- MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const;
- MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const;
+ MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const;
+ MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const;
MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle);
MEDCOUPLING_EXPORT void translate(const double *vector);
MEDCOUPLING_EXPORT void scale(const double *point, double factor);
MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const;
MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
- MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true);
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
//some useful methods
- MEDCOUPLING_EXPORT void getNodeGridStructure(int *res) const;
+ MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const;
//serialisation-unserialization
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
- MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
+ MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings);
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
std::string getVTKDataSetType() const;
private:
MCAuto<DataArrayDouble> _coords;
- std::vector<int> _structure;
+ std::vector<mcIdType> _structure;
};
}
if(sz!=arrRefs.size())
throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime constructor : internal error ! should never happen !");
_slices.resize(sz);
- for(std::size_t i=0;i<sz;i++)
+ for(int i=0;i<ToIdType(sz);i++)
{
if(arrRefs.empty())
throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime constructor : A field is null in list impossible to build a time definition !");
- _slices[i]=MEDCouplingDefinitionTimeSlice::New(fs[i],meshRefs[i],arrRefs[i],(int)i);
+ _slices[i]=MEDCouplingDefinitionTimeSlice::New(fs[i],meshRefs[i],arrRefs[i],i);
}
if(sz<=1)
return ;
* \throw If type of any cell in \a begin differs from that of cell # \a begin[0].
* \throw If the range [_begin_,_end_) is empty.
*/
-void MEDCouplingField::setGaussLocalizationOnCells(const int *begin, const int *end, const std::vector<double>& refCoo,
+void MEDCouplingField::setGaussLocalizationOnCells(const mcIdType *begin, const mcIdType *end, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg)
{
if(!_mesh)
/*!
* Returns an id of the Gauss localization object corresponding to a given cell type.
* \param [in] type - the cell type of interest.
- * \return int - the id of the Gauss localization object.
+ * \return mcIdType - the id of the Gauss localization object.
* \throw If \a this field is not on Gauss points.
* \throw If the spatial discretization of \a this field is NULL.
* \throw If no Gauss localization object found for the given cell \a type.
* \throw If more than one Gauss localization object found for the given cell \a type.
*/
-int MEDCouplingField::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const
+mcIdType MEDCouplingField::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdOfOneType method !");
/*!
* Returns ids of Gauss localization objects corresponding to a given cell type.
* \param [in] type - the cell type of interest.
- * \return std::set<int> - ids of the Gauss localization object.
+ * \return std::set<mcIdType> - ids of the Gauss localization object.
* \throw If \a this field is not on Gauss points.
* \throw If the spatial discretization of \a this field is NULL
*/
-std::set<int> MEDCouplingField::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
+std::set<mcIdType> MEDCouplingField::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdsOfOneType method !");
/*!
* Returns number of Gauss localization objects available. Implicitly all ids in
* [0,getNbOfGaussLocalization()) are valid Gauss localization ids.
- * \return int - the number of available Gauss localization objects.
+ * \return mcIdType - the number of available Gauss localization objects.
* \throw If \a this field is not on Gauss points.
* \throw If the spatial discretization of \a this field is NULL.
*/
-int MEDCouplingField::getNbOfGaussLocalization() const
+mcIdType MEDCouplingField::getNbOfGaussLocalization() const
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNbOfGaussLocalization method !");
/*!
* Returns an id of the Gauss localization object corresponding to a type of a given cell.
* \param [in] cellId - an id of the cell of interest.
- * \return int - the id of the Gauss localization object.
+ * \return mcIdType - the id of the Gauss localization object.
* \throw If \a this field is not on Gauss points.
* \throw If the spatial discretization of \a this field is NULL.
* \throw If no Gauss localization object found for the given cell.
*/
-int MEDCouplingField::getGaussLocalizationIdOfOneCell(int cellId) const
+mcIdType MEDCouplingField::getGaussLocalizationIdOfOneCell(mcIdType cellId) const
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdOfOneCell method !");
* \throw If \a locId is not within the valid range.
* \throw If the spatial discretization of \a this field is NULL.
*/
-void MEDCouplingField::getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const
+void MEDCouplingField::getCellIdsHavingGaussLocalization(int locId, std::vector<mcIdType>& cellIds) const
{
cellIds.clear();
if(!((const MEDCouplingFieldDiscretization *)_type))
* \param [in] start - an array of cell ids to include to the result mesh.
* \param [in] end - specifies the end of the array \a start, so that
* the last value of \a start is \a end[ -1 ].
- * \param [out] di - a new instance of DataArrayInt holding the ids of entities (nodes,
+ * \param [out] di - a new instance of DataArrayIdType holding the ids of entities (nodes,
* cells, Gauss points). The caller is to delete this array using decrRef() as it
* is no more needed.
* \return MEDCouplingMesh * - a new instance of MEDCouplingMesh. The caller is to
* \throw If the mesh is not set.
* \sa buildSubMeshDataRange()
*/
-MEDCouplingMesh *MEDCouplingField::buildSubMeshData(const int *start, const int *end, DataArrayInt *&di) const
+MEDCouplingMesh *MEDCouplingField::buildSubMeshData(const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call buildSubMeshData method !");
*
* \sa MEDCouplingField::buildSubMeshData
*/
-MEDCouplingMesh *MEDCouplingField::buildSubMeshDataRange(int begin, int end, int step, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const
+MEDCouplingMesh *MEDCouplingField::buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call buildSubMeshDataRange method !");
/*!
* This method returns tuples ids implied by the mesh selection of the cell ids contained in array defined as an interval [start;end).
- * \return a newly allocated DataArrayInt instance containing tuples ids.
+ * \return a newly allocated DataArrayIdType instance containing tuples ids.
*/
-DataArrayInt *MEDCouplingField::computeTupleIdsToSelectFromCellIds(const int *startCellIds, const int *endCellIds) const
+DataArrayIdType *MEDCouplingField::computeTupleIdsToSelectFromCellIds(const mcIdType *startCellIds, const mcIdType *endCellIds) const
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call computeTupleIdsToSelectFromCellIds method !");
/*!
* Returns number of tuples expected regarding the spatial discretization of \a this
* field and number of entities in the underlying mesh. This method behaves exactly as MEDCouplingFieldDouble::getNumberOfTuples.
- * \return int - the number of expected tuples.
+ * \return mcIdType - the number of expected tuples.
* \throw If the spatial discretization of \a this field is NULL.
* \throw If the mesh is not set.
*/
-int MEDCouplingField::getNumberOfTuplesExpected() const
+mcIdType MEDCouplingField::getNumberOfTuplesExpected() const
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNumberOfTuplesExpected method !");
/*!
* Returns number of mesh entities in the underlying mesh of \a this field regarding the
* spatial discretization.
- * \return int - the number of mesh entities porting the field values.
+ * \return mcIdType - the number of mesh entities porting the field values.
* \throw If the spatial discretization of \a this field is NULL.
* \throw If the mesh is not set.
*/
-int MEDCouplingField::getNumberOfMeshPlacesExpected() const
+mcIdType MEDCouplingField::getNumberOfMeshPlacesExpected() const
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNumberOfMeshPlacesExpected method !");
* \throw If input code point to invalid zones in spatial discretization.
* \throw If spatial discretization in \a this requires a mesh and those mesh is invalid (null,...)
*/
-int MEDCouplingField::getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
+mcIdType MEDCouplingField::getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const
{
const MEDCouplingFieldDiscretization *t(_type);
if(!t)
namespace MEDCoupling
{
- class DataArrayInt;
+ class DataArrayIdType;
class DataArrayDouble;
class MEDCouplingMesh;
class MEDCouplingFieldDouble;
MEDCOUPLING_EXPORT virtual void setNature(NatureOfField nat);
MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscr() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const int *start, const int *end, DataArrayInt *&di) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(int begin, int end, int step, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const;
- MEDCOUPLING_EXPORT DataArrayInt *computeTupleIdsToSelectFromCellIds(const int *startCellIds, const int *endCellIds) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const mcIdType *startCellIds, const mcIdType *endCellIds) const;
MEDCOUPLING_EXPORT const MEDCouplingFieldDiscretization *getDiscretization() const { return _type; }
MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *getDiscretization() { return _type; }
MEDCOUPLING_EXPORT void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
- MEDCOUPLING_EXPORT int getNumberOfTuplesExpected() const;
- MEDCOUPLING_EXPORT int getNumberOfMeshPlacesExpected() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpected() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlacesExpected() const;
// Gauss point specific methods
MEDCOUPLING_EXPORT void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg);
- MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const int *begin, const int *end, const std::vector<double>& refCoo,
+ MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const mcIdType *begin, const mcIdType *end, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg);
MEDCOUPLING_EXPORT void clearGaussLocalizations();
MEDCOUPLING_EXPORT MEDCouplingGaussLocalization& getGaussLocalization(int locId);
- MEDCOUPLING_EXPORT int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
- MEDCOUPLING_EXPORT std::set<int> getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
- MEDCOUPLING_EXPORT int getNbOfGaussLocalization() const;
- MEDCOUPLING_EXPORT int getGaussLocalizationIdOfOneCell(int cellId) const;
- MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const;
+ MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT std::set<mcIdType> getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT mcIdType getNbOfGaussLocalization() const;
+ MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
+ MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(int locId, std::vector<mcIdType>& cellIds) const;
MEDCOUPLING_EXPORT const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
MEDCOUPLING_EXPORT void updateTime() const;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
// for MED file RW
- MEDCOUPLING_EXPORT int getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0;
protected:
MEDCOUPLING_EXPORT MEDCouplingField(TypeOfField type);
const TypeOfField MEDCouplingFieldDiscretizationP1::TYPE=ON_NODES;
-const int MEDCouplingFieldDiscretizationPerCell::DFT_INVALID_LOCID_VALUE=-1;
+const mcIdType MEDCouplingFieldDiscretizationPerCell::DFT_INVALID_LOCID_VALUE=-1;
const char MEDCouplingFieldDiscretizationGauss::REPR[]="GAUSS";
/*!
* For all field discretization excepted GaussPts the [ \a startCellIds, \a endCellIds ) has no impact on the cloned instance.
*/
-MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePart(const int *startCellIds, const int *endCellIds) const
+MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePart(const mcIdType *startCellIds, const mcIdType *endCellIds) const
{
return clone();
}
/*!
* For all field discretization excepted GaussPts the slice( \a beginCellId, \a endCellIds, \a stepCellId ) has no impact on the cloned instance.
*/
-MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePartRange(int beginCellIds, int endCellIds, int stepCellIds) const
+MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
{
return clone();
}
void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const
{
MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
- int nbOfCompo=arr->getNumberOfComponents();
- int nbOfElems=getNumberOfTuples(mesh);
+ std::size_t nbOfCompo=arr->getNumberOfComponents();
+ mcIdType nbOfElems=getNumberOfTuples(mesh);
std::fill(res,res+nbOfCompo,0.);
const double *arrPtr=arr->getConstPointer();
const double *volPtr=vol->getArray()->getConstPointer();
double deno=0.;
- for(int i=0;i<nbOfElems;i++)
+ for(mcIdType i=0;i<nbOfElems;i++)
{
double v=fabs(volPtr[i]);
- for(int j=0;j<nbOfCompo;j++)
+ for(std::size_t j=0;j<nbOfCompo;j++)
res[j]+=fabs(arrPtr[i*nbOfCompo+j])*v;
deno+=v;
}
void MEDCouplingFieldDiscretization::normL2(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const
{
MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
- int nbOfCompo=arr->getNumberOfComponents();
- int nbOfElems=getNumberOfTuples(mesh);
+ std::size_t nbOfCompo=arr->getNumberOfComponents();
+ mcIdType nbOfElems=getNumberOfTuples(mesh);
std::fill(res,res+nbOfCompo,0.);
const double *arrPtr=arr->getConstPointer();
const double *volPtr=vol->getArray()->getConstPointer();
double deno=0.;
- for(int i=0;i<nbOfElems;i++)
+ for(mcIdType i=0;i<nbOfElems;i++)
{
double v=fabs(volPtr[i]);
- for(int j=0;j<nbOfCompo;j++)
+ for(std::size_t j=0;j<nbOfCompo;j++)
res[j]+=arrPtr[i*nbOfCompo+j]*arrPtr[i*nbOfCompo+j]*v;
deno+=v;
}
if(!arr)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::integral : input array is NULL !");
MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,isWAbs);
- std::size_t nbOfCompo(arr->getNumberOfComponents()),nbOfElems(getNumberOfTuples(mesh));
+ std::size_t nbOfCompo(arr->getNumberOfComponents());
+ mcIdType nbOfElems(getNumberOfTuples(mesh));
if(nbOfElems!=arr->getNumberOfTuples())
{
std::ostringstream oss; oss << "MEDCouplingFieldDiscretization::integral : field is not correct ! number of tuples in array is " << arr->getNumberOfTuples();
std::fill(res,res+nbOfCompo,0.);
const double *arrPtr(arr->begin()),*volPtr(vol->getArray()->begin());
INTERP_KERNEL::AutoPtr<double> tmp=new double[nbOfCompo];
- for(std::size_t i=0;i<nbOfElems;i++)
+ for(mcIdType i=0;i<nbOfElems;i++)
{
std::transform(arrPtr+i*nbOfCompo,arrPtr+(i+1)*nbOfCompo,(double *)tmp,std::bind2nd(std::multiplies<double>(),volPtr[i]));
std::transform((double *)tmp,(double *)tmp+nbOfCompo,res,res,std::plus<double>());
*
* \sa MEDCouplingFieldDiscretization::buildSubMeshData
*/
-MEDCouplingMesh *MEDCouplingFieldDiscretization::buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const
+MEDCouplingMesh *MEDCouplingFieldDiscretization::buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const
{
- MCAuto<DataArrayInt> da=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds);
+ MCAuto<DataArrayIdType> da=DataArrayIdType::Range(beginCellIds,endCellIds,stepCellIds);
return buildSubMeshData(mesh,da->begin(),da->end(),di);
}
-void MEDCouplingFieldDiscretization::getSerializationIntArray(DataArrayInt *& arr) const
+void MEDCouplingFieldDiscretization::getSerializationIntArray(DataArrayIdType *& arr) const
{
arr=0;
}
/*!
* Empty : Not a bug
*/
-void MEDCouplingFieldDiscretization::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+void MEDCouplingFieldDiscretization::getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const
{
}
{
}
-void MEDCouplingFieldDiscretization::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *& arr)
+void MEDCouplingFieldDiscretization::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *& arr)
{
arr=0;
}
/*!
* Empty : Not a bug
*/
-void MEDCouplingFieldDiscretization::checkForUnserialization(const std::vector<int>& tinyInfo, const DataArrayInt *arr)
+void MEDCouplingFieldDiscretization::checkForUnserialization(const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *arr)
{
}
* This method is typically the first step of renumbering. The implementation is empty it is not a bug only gauss is impacted
* virtually by this method.
*/
-void MEDCouplingFieldDiscretization::renumberCells(const int *old2NewBg, bool check)
+void MEDCouplingFieldDiscretization::renumberCells(const mcIdType *old2NewBg, bool check)
{
}
-double MEDCouplingFieldDiscretization::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const
+double MEDCouplingFieldDiscretization::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const
{
throw INTERP_KERNEL::Exception("getIJK Invalid ! only for GaussPoint and GaussNE discretizations !");
}
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-void MEDCouplingFieldDiscretization::setGaussLocalizationOnCells(const MEDCouplingMesh *m, const int *begin, const int *end, const std::vector<double>& refCoo,
+void MEDCouplingFieldDiscretization::setGaussLocalizationOnCells(const MEDCouplingMesh *m, const mcIdType *begin, const mcIdType *end, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg)
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-MEDCouplingGaussLocalization& MEDCouplingFieldDiscretization::getGaussLocalization(int locId)
+MEDCouplingGaussLocalization& MEDCouplingFieldDiscretization::getGaussLocalization(mcIdType locId)
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-const MEDCouplingGaussLocalization& MEDCouplingFieldDiscretization::getGaussLocalization(int locId) const
+const MEDCouplingGaussLocalization& MEDCouplingFieldDiscretization::getGaussLocalization(mcIdType locId) const
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-int MEDCouplingFieldDiscretization::getNbOfGaussLocalization() const
+mcIdType MEDCouplingFieldDiscretization::getNbOfGaussLocalization() const
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-int MEDCouplingFieldDiscretization::getGaussLocalizationIdOfOneCell(int cellId) const
+mcIdType MEDCouplingFieldDiscretization::getGaussLocalizationIdOfOneCell(mcIdType cellId) const
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-int MEDCouplingFieldDiscretization::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const
+mcIdType MEDCouplingFieldDiscretization::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-std::set<int> MEDCouplingFieldDiscretization::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
+std::set<mcIdType> MEDCouplingFieldDiscretization::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-void MEDCouplingFieldDiscretization::getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const
+void MEDCouplingFieldDiscretization::getCellIdsHavingGaussLocalization(mcIdType locId, std::vector<mcIdType>& cellIds) const
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, const int *old2NewPtr, int newNbOfEntity, DataArrayDouble *arr, const std::string& msg)
+void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, const mcIdType *old2NewPtr, mcIdType newNbOfEntity, DataArrayDouble *arr, const std::string& msg)
{
if(!arr)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr : input array is NULL !");
- int oldNbOfElems=arr->getNumberOfTuples();
- int nbOfComp=arr->getNumberOfComponents();
- int newNbOfTuples=newNbOfEntity;
+ mcIdType oldNbOfElems=arr->getNumberOfTuples();
+ std::size_t nbOfComp=arr->getNumberOfComponents();
+ mcIdType newNbOfTuples=newNbOfEntity;
MCAuto<DataArrayDouble> arrCpy=arr->deepCopy();
const double *ptSrc=arrCpy->getConstPointer();
arr->reAlloc(newNbOfTuples);
double *ptToFill=arr->getPointer();
std::fill(ptToFill,ptToFill+nbOfComp*newNbOfTuples,std::numeric_limits<double>::max());
INTERP_KERNEL::AutoPtr<double> tmp=new double[nbOfComp];
- for(int i=0;i<oldNbOfElems;i++)
+ for(mcIdType i=0;i<oldNbOfElems;i++)
{
- int newNb=old2NewPtr[i];
+ mcIdType newNb=old2NewPtr[i];
if(newNb>=0)//if newNb<0 the node is considered as out.
{
if(std::find_if(ptToFill+newNb*nbOfComp,ptToFill+(newNb+1)*nbOfComp,std::bind2nd(std::not_equal_to<double>(),std::numeric_limits<double>::max()))
}
}
-void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const std::string& msg)
+void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const mcIdType *new2OldPtr, mcIdType new2OldSz, DataArrayDouble *arr, const std::string& msg)
{
- int nbOfComp=arr->getNumberOfComponents();
+ std::size_t nbOfComp=arr->getNumberOfComponents();
MCAuto<DataArrayDouble> arrCpy=arr->deepCopy();
const double *ptSrc=arrCpy->getConstPointer();
arr->reAlloc(new2OldSz);
double *ptToFill=arr->getPointer();
- for(int i=0;i<new2OldSz;i++)
+ for(mcIdType i=0;i<new2OldSz;i++)
{
- int oldNb=new2OldPtr[i];
+ mcIdType oldNb=new2OldPtr[i];
std::copy(ptSrc+oldNb*nbOfComp,ptSrc+(oldNb+1)*nbOfComp,ptToFill+i*nbOfComp);
}
}
return ret;
}
-int MEDCouplingFieldDiscretizationP0::getNumberOfTuples(const MEDCouplingMesh *mesh) const
+mcIdType MEDCouplingFieldDiscretizationP0::getNumberOfTuples(const MEDCouplingMesh *mesh) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfTuples : NULL input mesh !");
* If an incoherency is detected, an exception will be thrown. If the input code is coherent, the number of tuples expected is returned.
* The number of tuples expected is equal to those to have a valid field lying on \a this and having a mesh fitting perfectly the input code (geometric type distribution).
*/
-int MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
+mcIdType MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const
{
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode : invalid input code !");
- int nbOfSplit=(int)idsPerType.size();
- int nbOfTypes=(int)code.size()/3;
- int ret=0;
- for(int i=0;i<nbOfTypes;i++)
+ mcIdType nbOfSplit=ToIdType(idsPerType.size());
+ mcIdType nbOfTypes=ToIdType(code.size()/3);
+ mcIdType ret=0;
+ for(mcIdType i=0;i<nbOfTypes;i++)
{
- int nbOfEltInChunk=code[3*i+1];
+ mcIdType nbOfEltInChunk=code[3*i+1];
if(nbOfEltInChunk<0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode : invalid input code ! presence of negative value in a type !");
- int pos=code[3*i+2];
+ mcIdType pos=code[3*i+2];
if(pos!=-1)
{
if(pos<0 || pos>=nbOfSplit)
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode : input code points to pos " << pos << " in typeid " << i << " ! Should be in [0," << nbOfSplit << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- const DataArrayInt *ids(idsPerType[pos]);
- if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || (int)ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
+ const DataArrayIdType *ids(idsPerType[pos]);
+ if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
{
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode : input pfl chunck at pos " << pos << " should have " << i << " tuples and one component and with ids all >=0 !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
return ret;
}
-int MEDCouplingFieldDiscretizationP0::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
+mcIdType MEDCouplingFieldDiscretizationP0::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfMeshPlaces : NULL input mesh !");
return mesh->getNumberOfCells();
}
-DataArrayInt *MEDCouplingFieldDiscretizationP0::getOffsetArr(const MEDCouplingMesh *mesh) const
+DataArrayIdType *MEDCouplingFieldDiscretizationP0::getOffsetArr(const MEDCouplingMesh *mesh) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getOffsetArr : NULL input mesh !");
- int nbOfTuples=mesh->getNumberOfCells();
- DataArrayInt *ret=DataArrayInt::New();
+ std::size_t nbOfTuples=mesh->getNumberOfCells();
+ DataArrayIdType *ret=DataArrayIdType::New();
ret->alloc(nbOfTuples+1,1);
ret->iota(0);
return ret;
}
void MEDCouplingFieldDiscretizationP0::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check)
+ const mcIdType *old2NewBg, bool check)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::renumberArraysForCell : NULL input mesh !");
- const int *array=old2NewBg;
+ const mcIdType *array=old2NewBg;
if(check)
- array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
+ array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
for(std::vector<DataArray *>::const_iterator it=arrays.begin();it!=arrays.end();it++)
{
if(*it)
(*it)->renumberInPlace(array);
}
if(check)
- free(const_cast<int *>(array));
+ free(const_cast<mcIdType *>(array));
}
DataArrayDouble *MEDCouplingFieldDiscretizationP0::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const
return mesh->computeCellCenterOfMass();
}
-void MEDCouplingFieldDiscretizationP0::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const
+void MEDCouplingFieldDiscretizationP0::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd,
+ DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::computeMeshRestrictionFromTupleIds : NULL input mesh !");
- MCAuto<DataArrayInt> tmp=DataArrayInt::New();
- tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1);
+ MCAuto<DataArrayIdType> tmp=DataArrayIdType::New();
+ tmp->alloc(std::distance(tupleIdsBg,tupleIdsEnd),1);
std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer());
- MCAuto<DataArrayInt> tmp2(tmp->deepCopy());
+ MCAuto<DataArrayIdType> tmp2(tmp->deepCopy());
cellRestriction=tmp.retn();
trueTupleRestriction=tmp2.retn();
}
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getValueOn : NULL input mesh !");
- int id=mesh->getCellContainingPoint(loc,_precision);
+ mcIdType id=mesh->getCellContainingPoint(loc,_precision);
if(id==-1)
throw INTERP_KERNEL::Exception("Specified point is detected outside of mesh : unable to apply P0::getValueOn !");
arr->getTuple(id,res);
}
-void MEDCouplingFieldDiscretizationP0::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const
+void MEDCouplingFieldDiscretizationP0::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const
{
const MEDCouplingCMesh *meshC=dynamic_cast<const MEDCouplingCMesh *>(mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("P0::getValueOnPos is only accessible for structured meshes !");
- int id=meshC->getCellIdFromPos(i,j,k);
+ mcIdType id=meshC->getCellIdFromPos(i,j,k);
arr->getTuple(id,res);
}
-DataArrayDouble *MEDCouplingFieldDiscretizationP0::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const
+DataArrayDouble *MEDCouplingFieldDiscretizationP0::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getValueOnMulti : NULL input mesh !");
- MCAuto<DataArrayInt> eltsArr,eltsIndexArr;
+ MCAuto<DataArrayIdType> eltsArr,eltsIndexArr;
mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr);
- const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin());
+ const mcIdType *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin());
int spaceDim=mesh->getSpaceDimension();
- int nbOfComponents=arr->getNumberOfComponents();
+ std::size_t nbOfComponents=arr->getNumberOfComponents();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfPoints,nbOfComponents);
double *ptToFill=ret->getPointer();
- for(int i=0;i<nbOfPoints;i++,ptToFill+=nbOfComponents)
+ for(mcIdType i=0;i<nbOfPoints;i++,ptToFill+=nbOfComponents)
if(eltsIndex[i+1]-eltsIndex[i]>=1)
arr->getTuple(elts[eltsIndex[i]],ptToFill);
else
/*!
* Nothing to do. It's not a bug.
*/
-void MEDCouplingFieldDiscretizationP0::renumberValuesOnNodes(double , const int *, int newNbOfNodes, DataArrayDouble *) const
+void MEDCouplingFieldDiscretizationP0::renumberValuesOnNodes(double , const mcIdType *, mcIdType newNbOfNodes, DataArrayDouble *) const
{
}
-void MEDCouplingFieldDiscretizationP0::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationP0::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const
{
RenumberEntitiesFromO2NArr(epsOnVals,old2New,newSz,arr,"Cell");
}
-void MEDCouplingFieldDiscretizationP0::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationP0::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const
{
RenumberEntitiesFromN2OArr(new2old,newSz,arr,"Cell");
}
* \return a newly allocated array containing ids to select into the DataArrayDouble of the field.
*
*/
-DataArrayInt *MEDCouplingFieldDiscretizationP0::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const
+DataArrayIdType *MEDCouplingFieldDiscretizationP0::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const
{
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc((int)std::distance(startCellIds,endCellIds),1);
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ ret->alloc(std::distance(startCellIds,endCellIds),1);
std::copy(startCellIds,endCellIds,ret->getPointer());
return ret.retn();
}
*
* \sa MEDCouplingFieldDiscretizationP0::buildSubMeshDataRange
*/
-MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const
+MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::buildSubMeshData : NULL input mesh !");
MCAuto<MEDCouplingMesh> ret=mesh->buildPart(start,end);
- MCAuto<DataArrayInt> diSafe=DataArrayInt::New();
- diSafe->alloc((int)std::distance(start,end),1);
+ MCAuto<DataArrayIdType> diSafe=DataArrayIdType::New();
+ diSafe->alloc(std::distance(start,end),1);
std::copy(start,end,diSafe->getPointer());
di=diSafe.retn();
return ret.retn();
*
* \sa MEDCouplingFieldDiscretizationP0::buildSubMeshData
*/
-MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const
+MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::buildSubMeshDataRange : NULL input mesh !");
return EasyAggregate<MEDCouplingFieldDiscretizationP0>(fds);
}
-int MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuples(const MEDCouplingMesh *mesh) const
+mcIdType MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuples(const MEDCouplingMesh *mesh) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::getNumberOfTuples : NULL input mesh !");
* If an incoherency is detected, an exception will be thrown. If the input code is coherent, the number of tuples expected is returned.
* The number of tuples expected is equal to those to have a valid field lying on \a this and having a mesh fitting perfectly the input code (geometric type distribution).
*/
-int MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
+mcIdType MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const
{
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode : invalid input code !");
- int nbOfSplit=(int)idsPerType.size();
- int nbOfTypes=(int)code.size()/3;
- int ret=0;
- for(int i=0;i<nbOfTypes;i++)
+ mcIdType nbOfSplit=ToIdType(idsPerType.size());
+ mcIdType nbOfTypes=ToIdType(code.size()/3);
+ mcIdType ret=0;
+ for(mcIdType i=0;i<nbOfTypes;i++)
{
- int nbOfEltInChunk=code[3*i+1];
+ mcIdType nbOfEltInChunk=code[3*i+1];
if(nbOfEltInChunk<0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode : invalid input code ! presence of negative value in a type !");
- int pos=code[3*i+2];
+ mcIdType pos=code[3*i+2];
if(pos!=-1)
{
if(pos<0 || pos>=nbOfSplit)
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode : input code points to pos " << pos << " in typeid " << i << " ! Should be in [0," << nbOfSplit << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- const DataArrayInt *ids(idsPerType[pos]);
- if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || (int)ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
+ const DataArrayIdType *ids(idsPerType[pos]);
+ if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
{
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode : input pfl chunck at pos " << pos << " should have " << i << " tuples and one component and with ids all >=0 !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
return ret;
}
-int MEDCouplingFieldDiscretizationOnNodes::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
+mcIdType MEDCouplingFieldDiscretizationOnNodes::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::getNumberOfMeshPlaces : NULL input mesh !");
* Nothing to do here.
*/
void MEDCouplingFieldDiscretizationOnNodes::renumberArraysForCell(const MEDCouplingMesh *, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check)
+ const mcIdType *old2NewBg, bool check)
{
}
-DataArrayInt *MEDCouplingFieldDiscretizationOnNodes::getOffsetArr(const MEDCouplingMesh *mesh) const
+DataArrayIdType *MEDCouplingFieldDiscretizationOnNodes::getOffsetArr(const MEDCouplingMesh *mesh) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::getOffsetArr : NULL input mesh !");
- int nbOfTuples=mesh->getNumberOfNodes();
- DataArrayInt *ret=DataArrayInt::New();
+ mcIdType nbOfTuples=mesh->getNumberOfNodes();
+ DataArrayIdType *ret=DataArrayIdType::New();
ret->alloc(nbOfTuples+1,1);
ret->iota(0);
return ret;
return mesh->getCoordinatesAndOwner();
}
-void MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const
+void MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd,
+ DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds : NULL input mesh !");
- MCAuto<DataArrayInt> ret1=mesh->getCellIdsFullyIncludedInNodeIds(tupleIdsBg,tupleIdsEnd);
+ MCAuto<DataArrayIdType> ret1=mesh->getCellIdsFullyIncludedInNodeIds(tupleIdsBg,tupleIdsEnd);
const MEDCouplingUMesh *meshc=dynamic_cast<const MEDCouplingUMesh *>(mesh);
if(!meshc)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds : trying to subpart field on nodes by node ids ! Your mesh has to be unstructured !");
MCAuto<MEDCouplingUMesh> meshPart=static_cast<MEDCouplingUMesh *>(meshc->buildPartOfMySelf(ret1->begin(),ret1->end(),true));
- MCAuto<DataArrayInt> ret2=meshPart->computeFetchedNodeIds();
+ MCAuto<DataArrayIdType> ret2=meshPart->computeFetchedNodeIds();
cellRestriction=ret1.retn();
trueTupleRestriction=ret2.retn();
}
{
if(!mesh || !da)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::checkCoherencyBetween : NULL input mesh or DataArray !");
- if(mesh->getNumberOfNodes()!=(int)da->getNumberOfTuples())
+ if(mesh->getNumberOfNodes()!=da->getNumberOfTuples())
{
std::ostringstream message;
message << "Field on nodes invalid because there are " << mesh->getNumberOfNodes();
* @param di is an array returned that specifies entity ids (here nodes ids) in mesh 'mesh' of entity in returned submesh.
* Example : The first node id of returned mesh has the (*di)[0] id in 'mesh'
*/
-MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const
+MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::buildSubMeshData : NULL input mesh !");
- DataArrayInt *diTmp=0;
+ DataArrayIdType *diTmp=0;
MCAuto<MEDCouplingMesh> ret=mesh->buildPartAndReduceNodes(start,end,diTmp);
- MCAuto<DataArrayInt> diTmpSafe(diTmp);
- MCAuto<DataArrayInt> di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes());
+ MCAuto<DataArrayIdType> diTmpSafe(diTmp);
+ MCAuto<DataArrayIdType> di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes());
di=di2.retn();
return ret.retn();
}
*
* \sa MEDCouplingFieldDiscretizationNodes::buildSubMeshData
*/
-MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const
+MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::buildSubMeshDataRange : NULL input mesh !");
- DataArrayInt *diTmp=0;
+ DataArrayIdType *diTmp=0;
MCAuto<MEDCouplingMesh> ret=mesh->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,diTmp);
if(diTmp)
{
- MCAuto<DataArrayInt> diTmpSafe(diTmp);
- MCAuto<DataArrayInt> di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes());
+ MCAuto<DataArrayIdType> diTmpSafe(diTmp);
+ MCAuto<DataArrayIdType> di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes());
di=di2.retn();
}
return ret.retn();
* \return a newly allocated array containing ids to select into the DataArrayDouble of the field.
*
*/
-DataArrayInt *MEDCouplingFieldDiscretizationOnNodes::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const
+DataArrayIdType *MEDCouplingFieldDiscretizationOnNodes::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::computeTupleIdsToSelectFromCellIds : NULL input mesh !");
return umesh2->computeFetchedNodeIds();
}
-void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnNodes(double epsOnVals, const int *old2NewPtr, int newNbOfNodes, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnNodes(double epsOnVals, const mcIdType *old2NewPtr, mcIdType newNbOfNodes, DataArrayDouble *arr) const
{
RenumberEntitiesFromO2NArr(epsOnVals,old2NewPtr,newNbOfNodes,arr,"Node");
}
/*!
* Nothing to do it's not a bug.
*/
-void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const
{
}
/*!
* Nothing to do it's not a bug.
*/
-void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const
{
}
-void MEDCouplingFieldDiscretizationOnNodes::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const
+void MEDCouplingFieldDiscretizationOnNodes::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const
{
const MEDCouplingCMesh *meshC=dynamic_cast<const MEDCouplingCMesh *>(mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("OnNodes::getValueOnPos(i,j,k) is only accessible for structured meshes !");
- int id=meshC->getNodeIdFromPos(i,j,k);
+ mcIdType id=meshC->getNodeIdFromPos(i,j,k);
arr->getTuple(id,res);
}
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::getValueOn : NULL input mesh !");
- int id=mesh->getCellContainingPoint(loc,_precision);
+ mcIdType id=mesh->getCellContainingPoint(loc,_precision);
if(id==-1)
throw INTERP_KERNEL::Exception("Specified point is detected outside of mesh : unable to apply P1::getValueOn !");
INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(id);
* This method localizes a point defined by 'loc' in a cell with id 'cellId' into mesh 'mesh'.
* The result is put into res expected to be of size at least arr->getNumberOfComponents()
*/
-void MEDCouplingFieldDiscretizationP1::getValueInCell(const MEDCouplingMesh *mesh, int cellId, const DataArrayDouble *arr, const double *loc, double *res) const
+void MEDCouplingFieldDiscretizationP1::getValueInCell(const MEDCouplingMesh *mesh, mcIdType cellId, const DataArrayDouble *arr, const double *loc, double *res) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::getValueInCell : NULL input mesh !");
- std::vector<int> conn;
+ std::vector<mcIdType> conn;
std::vector<double> coo;
mesh->getNodeIdsOfCell(cellId,conn);
- for(std::vector<int>::const_iterator iter=conn.begin();iter!=conn.end();iter++)
+ for(std::vector<mcIdType>::const_iterator iter=conn.begin();iter!=conn.end();iter++)
mesh->getCoordinatesOfNode(*iter,coo);
int spaceDim=mesh->getSpaceDimension();
std::size_t nbOfNodes=conn.size();
INTERP_KERNEL::AutoPtr<double> tmp=new double[nbOfNodes];
INTERP_KERNEL::NormalizedCellType ct(mesh->getTypeOfCell(cellId));
INTERP_KERNEL::barycentric_coords(ct,vec,loc,tmp);
- int sz=arr->getNumberOfComponents();
+ std::size_t sz=arr->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<double> tmp2=new double[sz];
std::fill(res,res+sz,0.);
for(std::size_t i=0;i<nbOfNodes;i++)
}
}
-DataArrayDouble *MEDCouplingFieldDiscretizationP1::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const
+DataArrayDouble *MEDCouplingFieldDiscretizationP1::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::getValueOnMulti : NULL input mesh !");
- MCAuto<DataArrayInt> eltsArr,eltsIndexArr;
+ MCAuto<DataArrayIdType> eltsArr,eltsIndexArr;
mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr);
- const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin());
+ const mcIdType *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin());
int spaceDim=mesh->getSpaceDimension();
- int nbOfComponents=arr->getNumberOfComponents();
+ std::size_t nbOfComponents=arr->getNumberOfComponents();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfPoints,nbOfComponents);
double *ptToFill=ret->getPointer();
- for(int i=0;i<nbOfPoints;i++)
+ for(mcIdType i=0;i<nbOfPoints;i++)
if(eltsIndex[i+1]-eltsIndex[i]>=1)
getValueInCell(mesh,elts[eltsIndex[i]],arr,loc+i*spaceDim,ptToFill+i*nbOfComponents);
else
}
/*!
- * This constructor deep copies MEDCoupling::DataArrayInt instance from other (if any).
+ * This constructor deep copies MEDCoupling::DataArrayIdType instance from other (if any).
*/
-MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const int *startCellIds, const int *endCellIds):_discr_per_cell(0)
+MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const mcIdType *startCellIds, const mcIdType *endCellIds):_discr_per_cell(0)
{
- DataArrayInt *arr=other._discr_per_cell;
+ DataArrayIdType *arr=other._discr_per_cell;
if(arr)
{
if(startCellIds==0 && endCellIds==0)
}
}
-MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, int beginCellIds, int endCellIds, int stepCellIds):_discr_per_cell(0)
+MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds):_discr_per_cell(0)
{
- DataArrayInt *arr=other._discr_per_cell;
+ DataArrayIdType *arr=other._discr_per_cell;
if(arr)
{
_discr_per_cell=arr->selectByTupleIdSafeSlice(beginCellIds,endCellIds,stepCellIds);
}
}
-MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(DataArrayInt *dpc):_discr_per_cell(dpc)
+MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(DataArrayIdType *dpc):_discr_per_cell(dpc)
{
if(_discr_per_cell)
_discr_per_cell->incrRef();
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell has no discretization per cell !");
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween : NULL input mesh or DataArray !");
- std::size_t nbOfTuples(_discr_per_cell->getNumberOfTuples());
+ mcIdType nbOfTuples(_discr_per_cell->getNumberOfTuples());
if(nbOfTuples!=mesh->getNumberOfCells())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell has a discretization per cell but it's not matching the underlying mesh !");
}
return false;
bool ret=_discr_per_cell->isEqualIfNotWhy(*otherC->_discr_per_cell,reason);
if(!ret)
- reason.insert(0,"Field discretization per cell DataArrayInt given the discid per cell :");
+ reason.insert(0,"Field discretization per cell DataArrayIdType given the discid per cell :");
return ret;
}
* This method is typically the first step of renumbering. The impact on _discr_per_cell is necessary here.
* virtually by this method.
*/
-void MEDCouplingFieldDiscretizationPerCell::renumberCells(const int *old2NewBg, bool check)
+void MEDCouplingFieldDiscretizationPerCell::renumberCells(const mcIdType *old2NewBg, bool check)
{
- int nbCells=_discr_per_cell->getNumberOfTuples();
- const int *array=old2NewBg;
+ mcIdType nbCells=_discr_per_cell->getNumberOfTuples();
+ const mcIdType *array=old2NewBg;
if(check)
- array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells);
+ array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells);
//
- DataArrayInt *dpc=_discr_per_cell->renumber(array);
+ DataArrayIdType *dpc=_discr_per_cell->renumber(array);
_discr_per_cell->decrRef();
_discr_per_cell=dpc;
//
if(check)
- free(const_cast<int *>(array));
+ free(const_cast<mcIdType *>(array));
}
void MEDCouplingFieldDiscretizationPerCell::buildDiscrPerCellIfNecessary(const MEDCouplingMesh *mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::buildDiscrPerCellIfNecessary : NULL input mesh !");
if(!_discr_per_cell)
{
- _discr_per_cell=DataArrayInt::New();
- int nbTuples=mesh->getNumberOfCells();
+ _discr_per_cell=DataArrayIdType::New();
+ mcIdType nbTuples=mesh->getNumberOfCells();
_discr_per_cell->alloc(nbTuples,1);
- int *ptr=_discr_per_cell->getPointer();
+ mcIdType *ptr=_discr_per_cell->getPointer();
std::fill(ptr,ptr+nbTuples,DFT_INVALID_LOCID_VALUE);
}
}
{
if(!_discr_per_cell)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells : no discretization defined !");
- MCAuto<DataArrayInt> test=_discr_per_cell->findIdsEqual(DFT_INVALID_LOCID_VALUE);
+ MCAuto<DataArrayIdType> test( _discr_per_cell->findIdsEqual(DFT_INVALID_LOCID_VALUE));
if(test->getNumberOfTuples()!=0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells : presence of orphan cells !");
}
*
* If no descretization is set in 'this' and exception will be thrown.
*/
-std::vector<DataArrayInt *> MEDCouplingFieldDiscretizationPerCell::splitIntoSingleGaussDicrPerCellType(std::vector<int>& locIds) const
+std::vector<DataArrayIdType *> MEDCouplingFieldDiscretizationPerCell::splitIntoSingleGaussDicrPerCellType(std::vector<mcIdType>& locIds) const
{
if(!_discr_per_cell)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::splitIntoSingleGaussDicrPerCellType : no descretization set !");
return _discr_per_cell->partitionByDifferentValues(locIds);
}
-const DataArrayInt *MEDCouplingFieldDiscretizationPerCell::getArrayOfDiscIds() const
+const DataArrayIdType *MEDCouplingFieldDiscretizationPerCell::getArrayOfDiscIds() const
{
return _discr_per_cell;
}
-void MEDCouplingFieldDiscretizationPerCell::setArrayOfDiscIds(const DataArrayInt *adids)
+void MEDCouplingFieldDiscretizationPerCell::setArrayOfDiscIds(const DataArrayIdType *adids)
{
if(adids!=_discr_per_cell)
{
if(_discr_per_cell)
_discr_per_cell->decrRef();
- _discr_per_cell=const_cast<DataArrayInt *>(adids);
+ _discr_per_cell=const_cast<DataArrayIdType *>(adids);
if(_discr_per_cell)
_discr_per_cell->incrRef();
declareAsNew();
{
}
-MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, const int *startCellIds, const int *endCellIds):MEDCouplingFieldDiscretizationPerCell(other,startCellIds,endCellIds),_loc(other._loc)
+MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, const mcIdType *startCellIds, const mcIdType *endCellIds):MEDCouplingFieldDiscretizationPerCell(other,startCellIds,endCellIds),_loc(other._loc)
{
}
-MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, int beginCellIds, int endCellIds, int stepCellIds):MEDCouplingFieldDiscretizationPerCell(other,beginCellIds,endCellIds,stepCellIds),_loc(other._loc)
+MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds):MEDCouplingFieldDiscretizationPerCell(other,beginCellIds,endCellIds,stepCellIds),_loc(other._loc)
{
}
return new MEDCouplingFieldDiscretizationGauss(*this);
}
-MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationGauss::clonePart(const int *startCellIds, const int *endCellIds) const
+MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationGauss::clonePart(const mcIdType *startCellIds, const mcIdType *endCellIds) const
{
return new MEDCouplingFieldDiscretizationGauss(*this,startCellIds,endCellIds);
}
-MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationGauss::clonePartRange(int beginCellIds, int endCellIds, int stepCellIds) const
+MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationGauss::clonePartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
{
return new MEDCouplingFieldDiscretizationGauss(*this,beginCellIds,endCellIds,stepCellIds);
}
if(_discr_per_cell->isAllocated())
{
oss << "Discretization per cell : ";
- std::copy(_discr_per_cell->begin(),_discr_per_cell->end(),std::ostream_iterator<int>(oss,", "));
+ std::copy(_discr_per_cell->begin(),_discr_per_cell->end(),std::ostream_iterator<mcIdType>(oss,", "));
oss << std::endl;
}
}
* If an incoherency is detected, an exception will be thrown. If the input code is coherent, the number of tuples expected is returned.
* The number of tuples expected is equal to those to have a valid field lying on \a this and having a mesh fitting perfectly the input code (geometric type distribution).
*/
-int MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
+mcIdType MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const
{
if(!_discr_per_cell || !_discr_per_cell->isAllocated() || _discr_per_cell->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode");
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : invalid input code !");
- int nbOfSplit=(int)idsPerType.size();
- int nbOfTypes=(int)code.size()/3;
- std::size_t ret(0);
- for(int i=0;i<nbOfTypes;i++)
+ mcIdType nbOfSplit=ToIdType(idsPerType.size());
+ mcIdType nbOfTypes=ToIdType(code.size()/3);
+ mcIdType ret(0);
+ for(mcIdType i=0;i<nbOfTypes;i++)
{
- int nbOfEltInChunk=code[3*i+1];
+ mcIdType nbOfEltInChunk=code[3*i+1];
if(nbOfEltInChunk<0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : invalid input code ! presence of negative value in a type !");
- int pos=code[3*i+2];
+ mcIdType pos=code[3*i+2];
if(pos!=-1)
{
if(pos<0 || pos>=nbOfSplit)
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : input code points to pos " << pos << " in typeid " << i << " ! Should be in [0," << nbOfSplit << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- const DataArrayInt *ids(idsPerType[pos]);
- if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || (int)ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
+ const DataArrayIdType *ids(idsPerType[pos]);
+ if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
{
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : input pfl chunck at pos " << pos << " should have " << i << " tuples and one component and with ids all >=0 !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
return getNumberOfTuples(0);//0 is not an error ! It is to be sure that input mesh is not used
}
-int MEDCouplingFieldDiscretizationGauss::getNumberOfTuples(const MEDCouplingMesh *) const
+mcIdType MEDCouplingFieldDiscretizationGauss::getNumberOfTuples(const MEDCouplingMesh *) const
{
- int ret=0;
+ mcIdType ret=0;
if (_discr_per_cell == 0)
throw INTERP_KERNEL::Exception("Discretization is not initialized!");
- const int *dcPtr=_discr_per_cell->getConstPointer();
- int nbOfTuples=_discr_per_cell->getNumberOfTuples();
- int maxSz=(int)_loc.size();
- for(const int *w=dcPtr;w!=dcPtr+nbOfTuples;w++)
+ const mcIdType *dcPtr=_discr_per_cell->getConstPointer();
+ mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ mcIdType maxSz=ToIdType(_loc.size());
+ for(const mcIdType *w=dcPtr;w!=dcPtr+nbOfTuples;w++)
{
if(*w>=0 && *w<maxSz)
ret+=_loc[*w].getNumberOfGaussPt();
return ret;
}
-int MEDCouplingFieldDiscretizationGauss::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
+mcIdType MEDCouplingFieldDiscretizationGauss::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfMeshPlaces : NULL input mesh !");
* This method is redevelopped for performance reasons, but it is equivalent to a call to MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField
* and a call to DataArrayDouble::computeOffsetsFull on the returned array.
*/
-DataArrayInt *MEDCouplingFieldDiscretizationGauss::getOffsetArr(const MEDCouplingMesh *mesh) const
+DataArrayIdType *MEDCouplingFieldDiscretizationGauss::getOffsetArr(const MEDCouplingMesh *mesh) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getOffsetArr : NULL input mesh !");
- std::size_t nbOfTuples(mesh->getNumberOfCells());
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ mcIdType nbOfTuples=mesh->getNumberOfCells();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfTuples+1,1);
- int *retPtr(ret->getPointer());
- const int *start(_discr_per_cell->begin());
+ mcIdType *retPtr(ret->getPointer());
+ const mcIdType *start(_discr_per_cell->begin());
if(_discr_per_cell->getNumberOfTuples()!=nbOfTuples)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getOffsetArr : mismatch between the mesh and the discretization ids array length !");
- int maxPossible=(int)_loc.size();
+ mcIdType maxPossible=ToIdType(_loc.size());
retPtr[0]=0;
- for(std::size_t i=0;i<nbOfTuples;i++,start++)
+ for(mcIdType i=0;i<nbOfTuples;i++,start++)
{
if(*start>=0 && *start<maxPossible)
retPtr[i+1]=retPtr[i]+_loc[*start].getNumberOfGaussPt();
}
void MEDCouplingFieldDiscretizationGauss::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check)
+ const mcIdType *old2NewBg, bool check)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::renumberArraysForCell : NULL input mesh !");
- const int *array=old2NewBg;
+ const mcIdType *array=old2NewBg;
if(check)
- array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
- int nbOfCells=_discr_per_cell->getNumberOfTuples();
- int nbOfTuples=getNumberOfTuples(0);
- const int *dcPtr=_discr_per_cell->getConstPointer();
- int *array2=new int[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace.
- int *array3=new int[nbOfCells];//store for each cell in present dcp array (already renumbered) the offset needed by each cell in new numbering.
+ array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
+ mcIdType nbOfCells=_discr_per_cell->getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples(0);
+ const mcIdType *dcPtr=_discr_per_cell->getConstPointer();
+ mcIdType *array2=new mcIdType[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace.
+ mcIdType *array3=new mcIdType[nbOfCells];//store for each cell in present dcp array (already renumbered) the offset needed by each cell in new numbering.
array3[0]=0;
- for(int i=1;i<nbOfCells;i++)
+ for(mcIdType i=1;i<nbOfCells;i++)
array3[i]=array3[i-1]+_loc[dcPtr[i-1]].getNumberOfGaussPt();
- int j=0;
- for(int i=0;i<nbOfCells;i++)
+ mcIdType j=0;
+ for(mcIdType i=0;i<nbOfCells;i++)
{
- int nbOfGaussPt=_loc[dcPtr[array[i]]].getNumberOfGaussPt();
- for(int k=0;k<nbOfGaussPt;k++,j++)
+ mcIdType nbOfGaussPt=_loc[dcPtr[array[i]]].getNumberOfGaussPt();
+ for(mcIdType k=0;k<nbOfGaussPt;k++,j++)
array2[j]=array3[array[i]]+k;
}
delete [] array3;
(*it)->renumberInPlace(array2);
delete [] array2;
if(check)
- free(const_cast<int*>(array));
+ free(const_cast<mcIdType*>(array));
}
DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues : NULL input mesh !");
checkNoOrphanCells();
MCAuto<MEDCouplingUMesh> umesh=mesh->buildUnstructured();//in general do nothing
- int nbOfTuples=getNumberOfTuples(mesh);
+ mcIdType nbOfTuples=getNumberOfTuples(mesh);
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=mesh->getSpaceDimension();
ret->alloc(nbOfTuples,spaceDim);
- std::vector< int > locIds;
- std::vector<DataArrayInt *> parts=splitIntoSingleGaussDicrPerCellType(locIds);
- std::vector< MCAuto<DataArrayInt> > parts2(parts.size());
+ std::vector< mcIdType > locIds;
+ std::vector<DataArrayIdType *> parts=splitIntoSingleGaussDicrPerCellType(locIds);
+ std::vector< MCAuto<DataArrayIdType> > parts2(parts.size());
std::copy(parts.begin(),parts.end(),parts2.begin());
- MCAuto<DataArrayInt> offsets=buildNbOfGaussPointPerCellField();
+ MCAuto<DataArrayIdType> offsets=buildNbOfGaussPointPerCellField();
offsets->computeOffsets();
- const int *ptrOffsets=offsets->getConstPointer();
+ const mcIdType *ptrOffsets=offsets->getConstPointer();
const double *coords=umesh->getCoords()->getConstPointer();
- const int *connI=umesh->getNodalConnectivityIndex()->getConstPointer();
- const int *conn=umesh->getNodalConnectivity()->getConstPointer();
+ const mcIdType *connI=umesh->getNodalConnectivityIndex()->getConstPointer();
+ const mcIdType *conn=umesh->getNodalConnectivity()->getConstPointer();
double *valsToFill=ret->getPointer();
for(std::size_t i=0;i<parts2.size();i++)
{
INTERP_KERNEL::NormalizedCellType typ(cli.getType());
const std::vector<double>& wg(cli.getWeights());
calculator.addGaussInfo(typ,INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension(),
- &cli.getGaussCoords()[0],(int)wg.size(),&cli.getRefCoords()[0],
+ &cli.getGaussCoords()[0],ToIdType(wg.size()),&cli.getRefCoords()[0],
INTERP_KERNEL::CellModel::GetCellModel(typ).getNumberOfNodes());
//
- for(const int *w=parts2[i]->begin();w!=parts2[i]->end();w++)
+ for(const mcIdType *w=parts2[i]->begin();w!=parts2[i]->end();w++)
calculator.calculateCoords(cli.getType(),coords,spaceDim,conn+connI[*w]+1,valsToFill+spaceDim*(ptrOffsets[*w]));
}
ret->copyStringInfoFrom(*umesh->getCoords());
return ret.retn();
}
-void MEDCouplingFieldDiscretizationGauss::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const
+void MEDCouplingFieldDiscretizationGauss::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd,
+ DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeMeshRestrictionFromTupleIds : NULL input mesh !");
- MCAuto<DataArrayInt> tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1);
+ MCAuto<DataArrayIdType> tmp=DataArrayIdType::New(); tmp->alloc(std::distance(tupleIdsBg,tupleIdsEnd),1);
std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer());
tmp->sort(true);
tmp=tmp->buildUnique();
- MCAuto<DataArrayInt> nbOfNodesPerCell=buildNbOfGaussPointPerCellField();
+ MCAuto<DataArrayIdType> nbOfNodesPerCell=buildNbOfGaussPointPerCellField();
nbOfNodesPerCell->computeOffsetsFull();
nbOfNodesPerCell->findIdsRangesInListOfIds(tmp,cellRestriction,trueTupleRestriction);
}
{
}
-void MEDCouplingFieldDiscretizationGauss::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+void MEDCouplingFieldDiscretizationGauss::getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const
{
- int val=-1;
+ mcIdType val=-1;
if(_discr_per_cell)
val=_discr_per_cell->getNumberOfTuples();
tinyInfo.push_back(val);
- tinyInfo.push_back((int)_loc.size());
+ tinyInfo.push_back(ToIdType(_loc.size()));
if(_loc.empty())
tinyInfo.push_back(-1);
else
(*iter).pushTinySerializationDblInfo(tinyInfo);
}
-void MEDCouplingFieldDiscretizationGauss::getSerializationIntArray(DataArrayInt *& arr) const
+void MEDCouplingFieldDiscretizationGauss::getSerializationIntArray(DataArrayIdType *& arr) const
{
arr=0;
if(_discr_per_cell)
arr=_discr_per_cell;
}
-void MEDCouplingFieldDiscretizationGauss::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *& arr)
+void MEDCouplingFieldDiscretizationGauss::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *& arr)
{
- int val=tinyInfo[0];
+ mcIdType val=tinyInfo[0];
if(val>=0)
{
- _discr_per_cell=DataArrayInt::New();
+ _discr_per_cell=DataArrayIdType::New();
_discr_per_cell->alloc(val,1);
}
else
commonUnserialization(tinyInfo);
}
-void MEDCouplingFieldDiscretizationGauss::checkForUnserialization(const std::vector<int>& tinyInfo, const DataArrayInt *arr)
+void MEDCouplingFieldDiscretizationGauss::checkForUnserialization(const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *arr)
{
- static const char MSG[]="MEDCouplingFieldDiscretizationGauss::checkForUnserialization : expect to have one not null DataArrayInt !";
- int val=tinyInfo[0];
+ static const char MSG[]="MEDCouplingFieldDiscretizationGauss::checkForUnserialization : expect to have one not null DataArrayIdType !";
+ mcIdType val=tinyInfo[0];
if(val>=0)
{
if(!arr)
throw INTERP_KERNEL::Exception(MSG);
arr->checkNbOfTuplesAndComp(val,1,MSG);
- _discr_per_cell=const_cast<DataArrayInt *>(arr);
+ _discr_per_cell=const_cast<DataArrayIdType *>(arr);
_discr_per_cell->incrRef();
}
else
delete [] tmp;
}
-double MEDCouplingFieldDiscretizationGauss::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const
+double MEDCouplingFieldDiscretizationGauss::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const
{
- int offset=getOffsetOfCell(cellId);
+ mcIdType offset=getOffsetOfCell(cellId);
return da->getIJ(offset+nodeIdInCell,compoId);
}
MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(mesh,da);
for(std::vector<MEDCouplingGaussLocalization>::const_iterator iter=_loc.begin();iter!=_loc.end();iter++)
(*iter).checkConsistencyLight();
- int nbOfDesc=(int)_loc.size();
- int nbOfCells=mesh->getNumberOfCells();
- const int *dc=_discr_per_cell->getConstPointer();
- for(int i=0;i<nbOfCells;i++)
+ mcIdType nbOfDesc=ToIdType(_loc.size());
+ mcIdType nbOfCells=mesh->getNumberOfCells();
+ const mcIdType *dc=_discr_per_cell->getConstPointer();
+ for(mcIdType i=0;i<nbOfCells;i++)
{
if(dc[i]>=nbOfDesc)
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- std::size_t nbOfTuples(getNumberOfTuples(mesh));
+ mcIdType nbOfTuples(getNumberOfTuples(mesh));
if(nbOfTuples!=da->getNumberOfTuples())
{
std::ostringstream oss; oss << "Invalid number of tuples in the array : expecting " << nbOfTuples << " having " << da->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getMeasureField : no discr per cell array defined but with nb of components different from 1 !");
if(_discr_per_cell->getNumberOfTuples()!=vol->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getMeasureField : no discr per cell array defined but mismatch between nb of cells of mesh and size of spatial disr array !");
- MCAuto<DataArrayInt> offset=getOffsetArr(mesh);
+ MCAuto<DataArrayIdType> offset=getOffsetArr(mesh);
MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); arr->alloc(getNumberOfTuples(mesh),1);
ret->setArray(arr);
double *arrPtr=arr->getPointer();
- const int *offsetPtr=offset->getConstPointer();
- int maxGaussLoc=(int)_loc.size();
- std::vector<int> locIds;
- std::vector<DataArrayInt *> ids=splitIntoSingleGaussDicrPerCellType(locIds);
- std::vector< MCAuto<DataArrayInt> > ids2(ids.size()); std::copy(ids.begin(),ids.end(),ids2.begin());
+ const mcIdType *offsetPtr=offset->getConstPointer();
+ mcIdType maxGaussLoc=ToIdType(_loc.size());
+ std::vector<mcIdType> locIds;
+ std::vector<DataArrayIdType *> ids=splitIntoSingleGaussDicrPerCellType(locIds);
+ std::vector< MCAuto<DataArrayIdType> > ids2(ids.size()); std::copy(ids.begin(),ids.end(),ids2.begin());
for(std::size_t i=0;i<locIds.size();i++)
{
- const DataArrayInt *curIds=ids[i];
- int locId=locIds[i];
+ const DataArrayIdType *curIds=ids[i];
+ mcIdType locId=locIds[i];
if(locId>=0 && locId<maxGaussLoc)
{
const MEDCouplingGaussLocalization& loc=_loc[locId];
- int nbOfGaussPt=loc.getNumberOfGaussPt();
+ mcIdType nbOfGaussPt=loc.getNumberOfGaussPt();
INTERP_KERNEL::AutoPtr<double> weights=new double[nbOfGaussPt];
double sum=std::accumulate(loc.getWeights().begin(),loc.getWeights().end(),0.);
std::transform(loc.getWeights().begin(),loc.getWeights().end(),(double *)weights,std::bind2nd(std::multiplies<double>(),1./sum));
- for(const int *cellId=curIds->begin();cellId!=curIds->end();cellId++)
- for(int j=0;j<nbOfGaussPt;j++)
+ for(const mcIdType *cellId=curIds->begin();cellId!=curIds->end();cellId++)
+ for(mcIdType j=0;j<nbOfGaussPt;j++)
arrPtr[offsetPtr[*cellId]+j]=weights[j]*volPtr[*cellId];
}
else
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
-void MEDCouplingFieldDiscretizationGauss::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const
+void MEDCouplingFieldDiscretizationGauss::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const
{
throw INTERP_KERNEL::Exception("getValueOnPos(i,j,k) : Not applicable for Gauss points !");
}
-DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const
+DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const
{
throw INTERP_KERNEL::Exception("getValueOnMulti : Not implemented yet for gauss points !");
}
-MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const
+MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildSubMeshData : NULL input mesh !");
- MCAuto<DataArrayInt> diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end);
+ MCAuto<DataArrayIdType> diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end);
MCAuto<MEDCouplingMesh> ret=mesh->buildPart(start,end);
di=diSafe.retn();
return ret.retn();
*
* \sa MEDCouplingFieldDiscretizationGauss::buildSubMeshData
*/
-MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const
+MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const
{
if(stepCellIds!=1)//even for stepCellIds==-1 the output will not be a range
return MEDCouplingFieldDiscretization::buildSubMeshDataRange(mesh,beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,di);
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : no discretization array set !");
di=0; beginOut=0; endOut=0; stepOut=stepCellIds;
const char msg[]="MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : cell #";
- int nbOfTuples=_discr_per_cell->getNumberOfTuples();
- const int *w=_discr_per_cell->begin();
- int nbMaxOfLocId=(int)_loc.size();
- for(int i=0;i<nbOfTuples;i++,w++)
+ mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ const mcIdType *w=_discr_per_cell->begin();
+ mcIdType nbMaxOfLocId=ToIdType(_loc.size());
+ for(mcIdType i=0;i<nbOfTuples;i++,w++)
{
if(*w!=DFT_INVALID_LOCID_VALUE)
{
if(*w>=0 && *w<nbMaxOfLocId)
{
- int delta=_loc[*w].getNumberOfGaussPt();
+ mcIdType delta=_loc[*w].getNumberOfGaussPt();
if(i<beginCellIds)
beginOut+=delta;
endOut+=delta;
* \return a newly allocated array containing ids to select into the DataArrayDouble of the field.
*
*/
-DataArrayInt *MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const
+DataArrayIdType *MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds : null mesh !");
- MCAuto<DataArrayInt> nbOfNodesPerCell=buildNbOfGaussPointPerCellField();//check of _discr_per_cell not NULL pointer
- std::size_t nbOfCells(mesh->getNumberOfCells());
+ MCAuto<DataArrayIdType> nbOfNodesPerCell=buildNbOfGaussPointPerCellField();//check of _discr_per_cell not NULL pointer
+ mcIdType nbOfCells(mesh->getNumberOfCells());
if(_discr_per_cell->getNumberOfTuples()!=nbOfCells)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds : mismatch of nb of tuples of cell ids array and number of cells !");
nbOfNodesPerCell->computeOffsetsFull();
- MCAuto<DataArrayInt> sel=DataArrayInt::New(); sel->useArray(startCellIds,false,DeallocType::CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1);
+ MCAuto<DataArrayIdType> sel=DataArrayIdType::New(); sel->useArray(startCellIds,false,DeallocType::CPP_DEALLOC,ToIdType(std::distance(startCellIds,endCellIds)),1);
return sel->buildExplicitArrByRanges(nbOfNodesPerCell);
}
/*!
* No implementation needed !
*/
-void MEDCouplingFieldDiscretizationGauss::renumberValuesOnNodes(double , const int *, int newNbOfNodes, DataArrayDouble *) const
+void MEDCouplingFieldDiscretizationGauss::renumberValuesOnNodes(double , const mcIdType *, mcIdType newNbOfNodes, DataArrayDouble *) const
{
}
-void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
-void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const
{
throw INTERP_KERNEL::Exception("Number of cells has changed and becomes higher with some cells that have been split ! Unable to conserve the Gauss field !");
}
if(fds.empty())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::aggregate : input array is empty");
std::vector<MEDCouplingGaussLocalization> loc;//store the localizations for the output GaussDiscretization object
- std::vector< MCAuto<DataArrayInt> > discPerCells(fds.size());
+ std::vector< MCAuto<DataArrayIdType> > discPerCells(fds.size());
std::size_t i(0);
for(auto it=fds.begin();it!=fds.end();++it,++i)
{
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::aggregate : same field discretization expected for all input discretizations !");
//
std::vector<MEDCouplingGaussLocalization> loc2(itc->_loc);
- std::vector<int> newLocId(loc2.size());
+ std::vector<mcIdType> newLocId(loc2.size());
for(std::size_t j=0;j<loc2.size();++j)
{
std::size_t k(0);
{
if(loc2[j].isEqual(loc[k],1e-10))
{
- newLocId[j]=(int)k;
+ newLocId[j]=ToIdType(k);
break;
}
}
if(k==loc.size())// current loc2[j]
{
- newLocId[j]=(int)loc.size();
+ newLocId[j]=ToIdType(loc.size());
loc.push_back(loc2[j]);
}
}
- const DataArrayInt *dpc(itc->_discr_per_cell);
+ const DataArrayIdType *dpc(itc->_discr_per_cell);
if(!dpc)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::aggregate : Presence of nullptr array of disc per cell !");
- MCAuto<DataArrayInt> dpc2(dpc->deepCopy());
+ MCAuto<DataArrayIdType> dpc2(dpc->deepCopy());
dpc2->transformWithIndArr(newLocId.data(),newLocId.data()+newLocId.size());
discPerCells[i]=dpc2;
}
- MCAuto<DataArrayInt> dpc3(DataArrayInt::Aggregate(ToConstVect(discPerCells)));
+ MCAuto<DataArrayIdType> dpc3(DataArrayIdType::Aggregate(ToConstVect(discPerCells)));
MCAuto<MEDCouplingFieldDiscretizationGauss> ret(new MEDCouplingFieldDiscretizationGauss(dpc3,loc));
return DynamicCast<MEDCouplingFieldDiscretizationGauss,MEDCouplingFieldDiscretization>(ret);
}
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType : NULL input mesh !");
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
- if((int)cm.getDimension()!=mesh->getMeshDimension())
+ if(ToIdType(cm.getDimension())!=mesh->getMeshDimension())
{
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType : mismatch of dimensions ! MeshDim==" << mesh->getMeshDimension();
oss << " whereas Type '" << cm.getRepr() << "' has dimension " << cm.getDimension() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
buildDiscrPerCellIfNecessary(mesh);
- int id=(int)_loc.size();
+ mcIdType id=ToIdType(_loc.size());
MEDCouplingGaussLocalization elt(type,refCoo,gsCoo,wg);
_loc.push_back(elt);
- int *ptr=_discr_per_cell->getPointer();
- int nbCells=mesh->getNumberOfCells();
- for(int i=0;i<nbCells;i++)
+ mcIdType *ptr=_discr_per_cell->getPointer();
+ mcIdType nbCells=mesh->getNumberOfCells();
+ for(mcIdType i=0;i<nbCells;i++)
if(mesh->getTypeOfCell(i)==type)
ptr[i]=id;
zipGaussLocalizations();
}
-void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const int *begin, const int *end, const std::vector<double>& refCoo,
+void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const mcIdType *begin, const mcIdType *end, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg)
{
if(!mesh)
throw INTERP_KERNEL::Exception("Size of [begin,end) must be equal or greater than 1 !");
INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(*begin);
MEDCouplingGaussLocalization elt(type,refCoo,gsCoo,wg);
- int id=(int)_loc.size();
- int *ptr=_discr_per_cell->getPointer();
- for(const int *w=begin+1;w!=end;w++)
+ mcIdType id=ToIdType(_loc.size());
+ mcIdType *ptr=_discr_per_cell->getPointer();
+ for(const mcIdType *w=begin+1;w!=end;w++)
{
if(mesh->getTypeOfCell(*w)!=type)
{
}
}
//
- for(const int *w2=begin;w2!=end;w2++)
+ for(const mcIdType *w2=begin;w2!=end;w2++)
ptr[*w2]=id;
//
_loc.push_back(elt);
_loc.clear();
}
-void MEDCouplingFieldDiscretizationGauss::setGaussLocalization(int locId, const MEDCouplingGaussLocalization& loc)
+void MEDCouplingFieldDiscretizationGauss::setGaussLocalization(mcIdType locId, const MEDCouplingGaussLocalization& loc)
{
if(locId<0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::setGaussLocalization : localization id has to be >=0 !");
- int sz=(int)_loc.size();
+ mcIdType sz=ToIdType(_loc.size());
MEDCouplingGaussLocalization gLoc(INTERP_KERNEL::NORM_ERROR);
if(locId>=sz)
_loc.resize(locId+1,gLoc);
_loc[locId]=loc;
}
-void MEDCouplingFieldDiscretizationGauss::resizeLocalizationVector(int newSz)
+void MEDCouplingFieldDiscretizationGauss::resizeLocalizationVector(mcIdType newSz)
{
if(newSz<0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::resizeLocalizationVector : new size has to be >=0 !");
_loc.resize(newSz,gLoc);
}
-MEDCouplingGaussLocalization& MEDCouplingFieldDiscretizationGauss::getGaussLocalization(int locId)
+MEDCouplingGaussLocalization& MEDCouplingFieldDiscretizationGauss::getGaussLocalization(mcIdType locId)
{
checkLocalizationId(locId);
return _loc[locId];
}
-int MEDCouplingFieldDiscretizationGauss::getNbOfGaussLocalization() const
+mcIdType MEDCouplingFieldDiscretizationGauss::getNbOfGaussLocalization() const
{
- return (int)_loc.size();
+ return ToIdType(_loc.size());
}
-int MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneCell(int cellId) const
+mcIdType MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneCell(mcIdType cellId) const
{
if(!_discr_per_cell)
throw INTERP_KERNEL::Exception("No Gauss localization still set !");
- int locId=_discr_per_cell->begin()[cellId];
+ mcIdType locId=_discr_per_cell->begin()[cellId];
if(locId<0)
throw INTERP_KERNEL::Exception("No Gauss localization set for the specified cell !");
return locId;
}
-int MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const
+mcIdType MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const
{
- std::set<int> ret=getGaussLocalizationIdsOfOneType(type);
+ std::set<mcIdType> ret=getGaussLocalizationIdsOfOneType(type);
if(ret.empty())
throw INTERP_KERNEL::Exception("No gauss discretization found for the specified type !");
if(ret.size()>1)
return *ret.begin();
}
-std::set<int> MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
+std::set<mcIdType> MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
{
if(!_discr_per_cell)
throw INTERP_KERNEL::Exception("No Gauss localization still set !");
- std::set<int> ret;
- int id=0;
+ std::set<mcIdType> ret;
+ mcIdType id=0;
for(std::vector<MEDCouplingGaussLocalization>::const_iterator iter=_loc.begin();iter!=_loc.end();iter++,id++)
if((*iter).getType()==type)
ret.insert(id);
return ret;
}
-void MEDCouplingFieldDiscretizationGauss::getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const
+void MEDCouplingFieldDiscretizationGauss::getCellIdsHavingGaussLocalization(mcIdType locId, std::vector<mcIdType>& cellIds) const
{
- if(locId<0 || locId>=(int)_loc.size())
+ if(locId<0 || locId>=ToIdType(_loc.size()))
throw INTERP_KERNEL::Exception("Invalid locId given : must be in range [0:getNbOfGaussLocalization()) !");
- int nbOfTuples=_discr_per_cell->getNumberOfTuples();
- const int *ptr=_discr_per_cell->getConstPointer();
- for(int i=0;i<nbOfTuples;i++)
+ mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ const mcIdType *ptr=_discr_per_cell->getConstPointer();
+ for(mcIdType i=0;i<nbOfTuples;i++)
if(ptr[i]==locId)
cellIds.push_back(i);
}
-const MEDCouplingGaussLocalization& MEDCouplingFieldDiscretizationGauss::getGaussLocalization(int locId) const
+const MEDCouplingGaussLocalization& MEDCouplingFieldDiscretizationGauss::getGaussLocalization(mcIdType locId) const
{
checkLocalizationId(locId);
return _loc[locId];
}
-void MEDCouplingFieldDiscretizationGauss::checkLocalizationId(int locId) const
+void MEDCouplingFieldDiscretizationGauss::checkLocalizationId(mcIdType locId) const
{
- if(locId<0 || locId>=(int)_loc.size())
+ if(locId<0 || locId>=ToIdType(_loc.size()))
throw INTERP_KERNEL::Exception("Invalid locId given : must be in range [0:getNbOfGaussLocalization()) !");
}
-int MEDCouplingFieldDiscretizationGauss::getOffsetOfCell(int cellId) const
+mcIdType MEDCouplingFieldDiscretizationGauss::getOffsetOfCell(mcIdType cellId) const
{
- int ret=0;
- const int *start=_discr_per_cell->getConstPointer();
- for(const int *w=start;w!=start+cellId;w++)
+ mcIdType ret=0;
+ const mcIdType *start=_discr_per_cell->getConstPointer();
+ for(const mcIdType *w=start;w!=start+cellId;w++)
ret+=_loc[*w].getNumberOfGaussPt();
return ret;
}
* This method returns a newly created array with number of tuples equals to '_discr_per_cell->getNumberOfTuples' and number of components equal to 1.
* The i_th tuple in returned array is the number of gauss point if the corresponding cell.
*/
-DataArrayInt *MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField() const
+DataArrayIdType *MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField() const
{
if(!_discr_per_cell)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField : no discretization array set !");
- int nbOfTuples=_discr_per_cell->getNumberOfTuples();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- const int *w=_discr_per_cell->begin();
+ mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ const mcIdType *w=_discr_per_cell->begin();
ret->alloc(nbOfTuples,1);
- int *valsToFill=ret->getPointer();
- int nbMaxOfLocId=(int)_loc.size();
- for(int i=0;i<nbOfTuples;i++,w++)
+ mcIdType *valsToFill=ret->getPointer();
+ mcIdType nbMaxOfLocId=ToIdType(_loc.size());
+ for(mcIdType i=0;i<nbOfTuples;i++,w++)
if(*w!=DFT_INVALID_LOCID_VALUE)
{
if(*w>=0 && *w<nbMaxOfLocId)
*/
void MEDCouplingFieldDiscretizationGauss::zipGaussLocalizations()
{
- const int *start=_discr_per_cell->begin();
- int nbOfTuples=_discr_per_cell->getNumberOfTuples();
- INTERP_KERNEL::AutoPtr<int> tmp=new int[_loc.size()];
- std::fill((int *)tmp,(int *)tmp+_loc.size(),-2);
- for(const int *w=start;w!=start+nbOfTuples;w++)
+ const mcIdType *start=_discr_per_cell->begin();
+ mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=new mcIdType[_loc.size()];
+ std::fill((mcIdType *)tmp,(mcIdType *)tmp+_loc.size(),-2);
+ for(const mcIdType *w=start;w!=start+nbOfTuples;w++)
if(*w>=0)
tmp[*w]=1;
- int fid=0;
- for(int i=0;i<(int)_loc.size();i++)
+ mcIdType fid=0;
+ for(mcIdType i=0;i<ToIdType(_loc.size());i++)
if(tmp[i]!=-2)
tmp[i]=fid++;
- if(fid==(int)_loc.size())
+ if(fid==ToIdType(_loc.size()))
return;
// zip needed
- int *start2=_discr_per_cell->getPointer();
- for(int *w2=start2;w2!=start2+nbOfTuples;w2++)
+ mcIdType *start2=_discr_per_cell->getPointer();
+ for(mcIdType *w2=start2;w2!=start2+nbOfTuples;w2++)
if(*w2>=0)
*w2=tmp[*w2];
std::vector<MEDCouplingGaussLocalization> tmpLoc;
- for(int i=0;i<(int)_loc.size();i++)
+ for(mcIdType i=0;i<ToIdType(_loc.size());i++)
if(tmp[i]!=-2)
tmpLoc.push_back(_loc[i]);
_loc=tmpLoc;
}
-void MEDCouplingFieldDiscretizationGauss::commonUnserialization(const std::vector<int>& tinyInfo)
+void MEDCouplingFieldDiscretizationGauss::commonUnserialization(const std::vector<mcIdType>& tinyInfo)
{
- int nbOfLoc=tinyInfo[1];
+ mcIdType nbOfLoc=tinyInfo[1];
_loc.clear();
- int dim=tinyInfo[2];
- int delta=-1;
+ mcIdType dim=tinyInfo[2];
+ mcIdType delta=-1;
if(nbOfLoc>0)
- delta=((int)tinyInfo.size()-3)/nbOfLoc;
- for(int i=0;i<nbOfLoc;i++)
+ delta=(ToIdType(tinyInfo.size())-3)/nbOfLoc;
+ for(mcIdType i=0;i<nbOfLoc;i++)
{
- std::vector<int> tmp(tinyInfo.begin()+3+i*delta,tinyInfo.begin()+3+(i+1)*delta);
+ std::vector<mcIdType> tmp(tinyInfo.begin()+3+i*delta,tinyInfo.begin()+3+(i+1)*delta);
MEDCouplingGaussLocalization elt=MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(dim,tmp);
_loc.push_back(elt);
}
* If an incoherency is detected, an exception will be thrown. If the input code is coherent, the number of tuples expected is returned.
* The number of tuples expected is equal to those to have a valid field lying on \a this and having a mesh fitting perfectly the input code (geometric type distribution).
*/
-int MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
+mcIdType MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const
{
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode : invalid input code !");
- int nbOfSplit=(int)idsPerType.size();
- int nbOfTypes=(int)code.size()/3;
- int ret(0);
- for(int i=0;i<nbOfTypes;i++)
+ mcIdType nbOfSplit=ToIdType(idsPerType.size());
+ mcIdType nbOfTypes=ToIdType(code.size()/3);
+ mcIdType ret(0);
+ for(mcIdType i=0;i<nbOfTypes;i++)
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)code[3*i]));
if(cm.isDynamic())
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode : At pos #" << i << " the geometric type " << cm.getRepr() << " is dynamic ! There are not managed by GAUSS_NE field discretization !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbOfEltInChunk=code[3*i+1];
+ mcIdType nbOfEltInChunk=code[3*i+1];
if(nbOfEltInChunk<0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode : invalid input code ! presence of negative value in a type !");
- int pos=code[3*i+2];
+ mcIdType pos=code[3*i+2];
if(pos!=-1)
{
if(pos<0 || pos>=nbOfSplit)
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode : input code points to pos " << pos << " in typeid " << i << " ! Should be in [0," << nbOfSplit << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- const DataArrayInt *ids(idsPerType[pos]);
- if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || (int)ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
+ const DataArrayIdType *ids(idsPerType[pos]);
+ if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
{
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode : input pfl chunck at pos " << pos << " should have " << i << " tuples and one component and with ids all >=0 !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- ret+=nbOfEltInChunk*(int)cm.getNumberOfNodes();
+ ret+=nbOfEltInChunk*ToIdType(cm.getNumberOfNodes());
}
return ret;
}
-int MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples(const MEDCouplingMesh *mesh) const
+mcIdType MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples(const MEDCouplingMesh *mesh) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples : NULL input mesh !");
- int ret=0;
- int nbOfCells=mesh->getNumberOfCells();
- for(int i=0;i<nbOfCells;i++)
+ mcIdType ret=0;
+ mcIdType nbOfCells=mesh->getNumberOfCells();
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
return ret;
}
-int MEDCouplingFieldDiscretizationGaussNE::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
+mcIdType MEDCouplingFieldDiscretizationGaussNE::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfMeshPlaces : NULL input mesh !");
return mesh->getNumberOfCells();
}
-DataArrayInt *MEDCouplingFieldDiscretizationGaussNE::getOffsetArr(const MEDCouplingMesh *mesh) const
+DataArrayIdType *MEDCouplingFieldDiscretizationGaussNE::getOffsetArr(const MEDCouplingMesh *mesh) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getOffsetArr : NULL input mesh !");
- int nbOfTuples=mesh->getNumberOfCells();
- DataArrayInt *ret=DataArrayInt::New();
+ mcIdType nbOfTuples=mesh->getNumberOfCells();
+ DataArrayIdType *ret=DataArrayIdType::New();
ret->alloc(nbOfTuples+1,1);
- int *retPtr=ret->getPointer();
+ mcIdType *retPtr=ret->getPointer();
retPtr[0]=0;
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
}
void MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check)
+ const mcIdType *old2NewBg, bool check)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell : NULL input mesh !");
- const int *array=old2NewBg;
+ const mcIdType *array=old2NewBg;
if(check)
- array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
- int nbOfCells=mesh->getNumberOfCells();
- int nbOfTuples=getNumberOfTuples(mesh);
- int *array2=new int[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace.
- int *array3=new int[nbOfCells];//store for each cell in after renumbering the offset needed by each cell in new numbering.
+ array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
+ mcIdType nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfTuples=getNumberOfTuples(mesh);
+ mcIdType *array2=new mcIdType[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace.
+ mcIdType *array3=new mcIdType[nbOfCells];//store for each cell in after renumbering the offset needed by each cell in new numbering.
array3[0]=0;
- for(int i=1;i<nbOfCells;i++)
+ for(mcIdType i=1;i<nbOfCells;i++)
{
- INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell((int)std::distance(array,std::find(array,array+nbOfCells,i-1)));
+ INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(ToIdType(std::distance(array,std::find(array,array+nbOfCells,i-1))));
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
array3[i]=array3[i-1]+cm.getNumberOfNodes();
}
- int j=0;
- for(int i=0;i<nbOfCells;i++)
+ mcIdType j=0;
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
- for(int k=0;k<(int)cm.getNumberOfNodes();k++,j++)
+ for(mcIdType k=0;k<ToIdType(cm.getNumberOfNodes());k++,j++)
array2[j]=array3[array[i]]+k;
}
delete [] array3;
(*it)->renumberInPlace(array2);
delete [] array2;
if(check)
- free(const_cast<int *>(array));
+ free(const_cast<mcIdType *>(array));
}
DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscValues : NULL input mesh !");
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
MCAuto<MEDCouplingUMesh> umesh=mesh->buildUnstructured();//in general do nothing
- int nbOfTuples=getNumberOfTuples(umesh);
+ mcIdType nbOfTuples=getNumberOfTuples(umesh);
int spaceDim=mesh->getSpaceDimension();
ret->alloc(nbOfTuples,spaceDim);
const double *coords=umesh->getCoords()->begin();
- const int *connI=umesh->getNodalConnectivityIndex()->getConstPointer();
- const int *conn=umesh->getNodalConnectivity()->getConstPointer();
- int nbCells=umesh->getNumberOfCells();
+ const mcIdType *connI=umesh->getNodalConnectivityIndex()->getConstPointer();
+ const mcIdType *conn=umesh->getNodalConnectivity()->getConstPointer();
+ mcIdType nbCells=umesh->getNumberOfCells();
double *retPtr=ret->getPointer();
- for(int i=0;i<nbCells;i++,connI++)
- for(const int *w=conn+connI[0]+1;w!=conn+connI[1];w++)
+ for(mcIdType i=0;i<nbCells;i++,connI++)
+ for(const mcIdType *w=conn+connI[0]+1;w!=conn+connI[1];w++)
if(*w>=0)
retPtr=std::copy(coords+(*w)*spaceDim,coords+((*w)+1)*spaceDim,retPtr);
return ret.retn();
{
if(!mesh || !arr)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::integral : input mesh or array is null !");
- int nbOfCompo=arr->getNumberOfComponents();
+ std::size_t nbOfCompo=arr->getNumberOfComponents();
std::fill(res,res+nbOfCompo,0.);
//
MCAuto<MEDCouplingFieldDouble> vol=mesh->getMeasureField(isWAbs);
std::set<INTERP_KERNEL::NormalizedCellType> types=mesh->getAllGeoTypes();
- MCAuto<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
+ MCAuto<DataArrayIdType> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
nbOfNodesPerCell->computeOffsetsFull();
const double *arrPtr=arr->begin(),*volPtr=vol->getArray()->begin();
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=types.begin();it!=types.end();it++)
INTERP_KERNEL::AutoPtr<double> wArr2=new double[wArrSz];
double sum=std::accumulate(wArr,wArr+wArrSz,0.);
std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind2nd(std::multiplies<double>(),1./sum));
- MCAuto<DataArrayInt> ids=mesh->giveCellsWithType(*it);
- MCAuto<DataArrayInt> ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell);
- const int *ptIds2=ids2->begin(),*ptIds=ids->begin();
- int nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
- for(int i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++,ptIds2+=wArrSz)
+ MCAuto<DataArrayIdType> ids=mesh->giveCellsWithType(*it);
+ MCAuto<DataArrayIdType> ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell);
+ const mcIdType *ptIds2=ids2->begin(),*ptIds=ids->begin();
+ mcIdType nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
+ for(mcIdType i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++,ptIds2+=wArrSz)
{
- for(int k=0;k<nbOfCompo;k++)
+ for(std::size_t k=0;k<nbOfCompo;k++)
{
double tmp=0.;
for(std::size_t j=0;j<wArrSz;j++)
switch(geoType)
{
case INTERP_KERNEL::NORM_POINT1:
- lgth=(int)sizeof(FGP_POINT1)/sizeof(double);
+ lgth=sizeof(FGP_POINT1)/sizeof(double);
return FGP_POINT1;
case INTERP_KERNEL::NORM_SEG2:
- lgth=(int)sizeof(FGP_SEG2)/sizeof(double);
+ lgth=sizeof(FGP_SEG2)/sizeof(double);
return FGP_SEG2;
case INTERP_KERNEL::NORM_SEG3:
- lgth=(int)sizeof(FGP_SEG3)/sizeof(double);
+ lgth=sizeof(FGP_SEG3)/sizeof(double);
return FGP_SEG3;
case INTERP_KERNEL::NORM_SEG4:
- lgth=(int)sizeof(FGP_SEG4)/sizeof(double);
+ lgth=sizeof(FGP_SEG4)/sizeof(double);
return FGP_SEG4;
case INTERP_KERNEL::NORM_TRI3:
- lgth=(int)sizeof(FGP_TRI3)/sizeof(double);
+ lgth=sizeof(FGP_TRI3)/sizeof(double);
return FGP_TRI3;
case INTERP_KERNEL::NORM_TRI6:
- lgth=(int)sizeof(FGP_TRI6)/sizeof(double);
+ lgth=sizeof(FGP_TRI6)/sizeof(double);
return FGP_TRI6;
case INTERP_KERNEL::NORM_TRI7:
- lgth=(int)sizeof(FGP_TRI7)/sizeof(double);
+ lgth=sizeof(FGP_TRI7)/sizeof(double);
return FGP_TRI7;
case INTERP_KERNEL::NORM_QUAD4:
- lgth=(int)sizeof(FGP_QUAD4)/sizeof(double);
+ lgth=sizeof(FGP_QUAD4)/sizeof(double);
return FGP_QUAD4;
case INTERP_KERNEL::NORM_QUAD8:
- lgth=(int)sizeof(FGP_QUAD8)/sizeof(double);
+ lgth=sizeof(FGP_QUAD8)/sizeof(double);
return FGP_QUAD8;
case INTERP_KERNEL::NORM_QUAD9:
- lgth=(int)sizeof(FGP_QUAD9)/sizeof(double);
+ lgth=sizeof(FGP_QUAD9)/sizeof(double);
return FGP_QUAD9;
case INTERP_KERNEL::NORM_TETRA4:
- lgth=(int)sizeof(FGP_TETRA4)/sizeof(double);
+ lgth=sizeof(FGP_TETRA4)/sizeof(double);
return FGP_TETRA4;
case INTERP_KERNEL::NORM_TETRA10:
- lgth=(int)sizeof(FGP_TETRA10)/sizeof(double);
+ lgth=sizeof(FGP_TETRA10)/sizeof(double);
return FGP_TETRA10;
case INTERP_KERNEL::NORM_PENTA6:
- lgth=(int)sizeof(FGP_PENTA6)/sizeof(double);
+ lgth=sizeof(FGP_PENTA6)/sizeof(double);
return FGP_PENTA6;
case INTERP_KERNEL::NORM_PENTA15:
- lgth=(int)sizeof(FGP_PENTA15)/sizeof(double);
+ lgth=sizeof(FGP_PENTA15)/sizeof(double);
return FGP_PENTA15;
case INTERP_KERNEL::NORM_HEXA8:
- lgth=(int)sizeof(FGP_HEXA8)/sizeof(double);
+ lgth=sizeof(FGP_HEXA8)/sizeof(double);
return FGP_HEXA8;
case INTERP_KERNEL::NORM_HEXA20:
- lgth=(int)sizeof(FGP_HEXA20)/sizeof(double);
+ lgth=sizeof(FGP_HEXA20)/sizeof(double);
return FGP_HEXA20;
case INTERP_KERNEL::NORM_HEXA27:
- lgth=(int)sizeof(FGP_HEXA27)/sizeof(double);
+ lgth=sizeof(FGP_HEXA27)/sizeof(double);
return FGP_HEXA27;
case INTERP_KERNEL::NORM_PYRA5:
- lgth=(int)sizeof(FGP_PYRA5)/sizeof(double);
+ lgth=sizeof(FGP_PYRA5)/sizeof(double);
return FGP_PYRA5;
case INTERP_KERNEL::NORM_PYRA13:
- lgth=(int)sizeof(FGP_PYRA13)/sizeof(double);
+ lgth=sizeof(FGP_PYRA13)/sizeof(double);
return FGP_PYRA13;
default:
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::GetWeightArrayFromGeometricType : only SEG[2,3,4], TRI[3,6,7], QUAD[4,9], TETRA[4,10], PENTA[6,15], HEXA[8,20,27], PYRA[5,13] supported !");
lgth=0;
return 0;
case INTERP_KERNEL::NORM_SEG2:
- lgth=(int)sizeof(REF_SEG2)/sizeof(double);
+ lgth=sizeof(REF_SEG2)/sizeof(double);
return REF_SEG2;
case INTERP_KERNEL::NORM_SEG3:
- lgth=(int)sizeof(REF_SEG3)/sizeof(double);
+ lgth=sizeof(REF_SEG3)/sizeof(double);
return REF_SEG3;
case INTERP_KERNEL::NORM_SEG4:
- lgth=(int)sizeof(REF_SEG4)/sizeof(double);
+ lgth=sizeof(REF_SEG4)/sizeof(double);
return REF_SEG4;
case INTERP_KERNEL::NORM_TRI3:
- lgth=(int)sizeof(REF_TRI3)/sizeof(double);
+ lgth=sizeof(REF_TRI3)/sizeof(double);
return REF_TRI3;
case INTERP_KERNEL::NORM_TRI6:
- lgth=(int)sizeof(REF_TRI6)/sizeof(double);
+ lgth=sizeof(REF_TRI6)/sizeof(double);
return REF_TRI6;
case INTERP_KERNEL::NORM_TRI7:
- lgth=(int)sizeof(REF_TRI7)/sizeof(double);
+ lgth=sizeof(REF_TRI7)/sizeof(double);
return REF_TRI7;
case INTERP_KERNEL::NORM_QUAD4:
- lgth=(int)sizeof(REF_QUAD4)/sizeof(double);
+ lgth=sizeof(REF_QUAD4)/sizeof(double);
return REF_QUAD4;
case INTERP_KERNEL::NORM_QUAD8:
- lgth=(int)sizeof(REF_QUAD8)/sizeof(double);
+ lgth=sizeof(REF_QUAD8)/sizeof(double);
return REF_QUAD8;
case INTERP_KERNEL::NORM_QUAD9:
- lgth=(int)sizeof(REF_QUAD9)/sizeof(double);
+ lgth=sizeof(REF_QUAD9)/sizeof(double);
return REF_QUAD9;
case INTERP_KERNEL::NORM_TETRA4:
- lgth=(int)sizeof(REF_TETRA4)/sizeof(double);
+ lgth=sizeof(REF_TETRA4)/sizeof(double);
return REF_TETRA4;
case INTERP_KERNEL::NORM_TETRA10:
- lgth=(int)sizeof(REF_TETRA10)/sizeof(double);
+ lgth=sizeof(REF_TETRA10)/sizeof(double);
return REF_TETRA10;
case INTERP_KERNEL::NORM_PENTA6:
- lgth=(int)sizeof(REF_PENTA6)/sizeof(double);
+ lgth=sizeof(REF_PENTA6)/sizeof(double);
return REF_PENTA6;
case INTERP_KERNEL::NORM_PENTA15:
- lgth=(int)sizeof(REF_PENTA15)/sizeof(double);
+ lgth=sizeof(REF_PENTA15)/sizeof(double);
return REF_PENTA15;
case INTERP_KERNEL::NORM_HEXA8:
- lgth=(int)sizeof(REF_HEXA8)/sizeof(double);
+ lgth=sizeof(REF_HEXA8)/sizeof(double);
return REF_HEXA8;
case INTERP_KERNEL::NORM_HEXA20:
- lgth=(int)sizeof(REF_HEXA20)/sizeof(double);
+ lgth=sizeof(REF_HEXA20)/sizeof(double);
return REF_HEXA20;
case INTERP_KERNEL::NORM_HEXA27:
- lgth=(int)sizeof(REF_HEXA27)/sizeof(double);
+ lgth=sizeof(REF_HEXA27)/sizeof(double);
return REF_HEXA27;
case INTERP_KERNEL::NORM_PYRA5:
- lgth=(int)sizeof(REF_PYRA5)/sizeof(double);
+ lgth=sizeof(REF_PYRA5)/sizeof(double);
return REF_PYRA5;
case INTERP_KERNEL::NORM_PYRA13:
- lgth=(int)sizeof(REF_PYRA13)/sizeof(double);
+ lgth=sizeof(REF_PYRA13)/sizeof(double);
return REF_PYRA13;
default:
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::GetRefCoordsFromGeometricType : only SEG[2,3,4], TRI[3,6,7], QUAD[4,8,9], TETRA[4,10], PENTA[6,15], HEXA[8,20,27], PYRA[5,13] supported !");
}
case INTERP_KERNEL::NORM_SEG2:
{
- lgth=(int)sizeof(LOC_SEG2)/sizeof(double);
+ lgth=sizeof(LOC_SEG2)/sizeof(double);
return LOC_SEG2;
}
case INTERP_KERNEL::NORM_SEG3:
{
- lgth=(int)sizeof(LOC_SEG3)/sizeof(double);
+ lgth=sizeof(LOC_SEG3)/sizeof(double);
return LOC_SEG3;
}
case INTERP_KERNEL::NORM_SEG4:
{
- lgth=(int)sizeof(LOC_SEG4)/sizeof(double);
+ lgth=sizeof(LOC_SEG4)/sizeof(double);
return LOC_SEG4;
}
case INTERP_KERNEL::NORM_TRI3:
{
- lgth=(int)sizeof(LOC_TRI3)/sizeof(double);
+ lgth=sizeof(LOC_TRI3)/sizeof(double);
return LOC_TRI3;
}
case INTERP_KERNEL::NORM_TRI6:
{
- lgth=(int)sizeof(LOC_TRI6)/sizeof(double);
+ lgth=sizeof(LOC_TRI6)/sizeof(double);
return LOC_TRI6;
}
case INTERP_KERNEL::NORM_TRI7:
{
- lgth=(int)sizeof(LOC_TRI7)/sizeof(double);
+ lgth=sizeof(LOC_TRI7)/sizeof(double);
return LOC_TRI7;
}
case INTERP_KERNEL::NORM_QUAD4:
{
- lgth=(int)sizeof(LOC_QUAD4)/sizeof(double);
+ lgth=sizeof(LOC_QUAD4)/sizeof(double);
return LOC_QUAD4;
}
case INTERP_KERNEL::NORM_QUAD8:
{
- lgth=(int)sizeof(LOC_QUAD8)/sizeof(double);
+ lgth=sizeof(LOC_QUAD8)/sizeof(double);
return LOC_QUAD8;
}
case INTERP_KERNEL::NORM_QUAD9:
{
- lgth=(int)sizeof(LOC_QUAD9)/sizeof(double);
+ lgth=sizeof(LOC_QUAD9)/sizeof(double);
return LOC_QUAD9;
}
case INTERP_KERNEL::NORM_TETRA4:
{
- lgth=(int)sizeof(LOC_TETRA4)/sizeof(double);
+ lgth=sizeof(LOC_TETRA4)/sizeof(double);
return LOC_TETRA4;
}
case INTERP_KERNEL::NORM_TETRA10:
{
- lgth=(int)sizeof(LOC_TETRA10)/sizeof(double);
+ lgth=sizeof(LOC_TETRA10)/sizeof(double);
return LOC_TETRA10;
}
case INTERP_KERNEL::NORM_PENTA6:
{
- lgth=(int)sizeof(LOC_PENTA6)/sizeof(double);
+ lgth=sizeof(LOC_PENTA6)/sizeof(double);
return LOC_PENTA6;
}
case INTERP_KERNEL::NORM_PENTA15:
{
- lgth=(int)sizeof(LOC_PENTA15)/sizeof(double);
+ lgth=sizeof(LOC_PENTA15)/sizeof(double);
return LOC_PENTA15;
}
case INTERP_KERNEL::NORM_HEXA8:
{
- lgth=(int)sizeof(LOC_HEXA8)/sizeof(double);
+ lgth=sizeof(LOC_HEXA8)/sizeof(double);
return LOC_HEXA8;
}
case INTERP_KERNEL::NORM_HEXA20:
{
- lgth=(int)sizeof(LOC_HEXA20)/sizeof(double);
+ lgth=sizeof(LOC_HEXA20)/sizeof(double);
return LOC_HEXA20;
}
case INTERP_KERNEL::NORM_HEXA27:
{
- lgth=(int)sizeof(LOC_HEXA27)/sizeof(double);
+ lgth=sizeof(LOC_HEXA27)/sizeof(double);
return LOC_HEXA27;
}
case INTERP_KERNEL::NORM_PYRA5:
{
- lgth=(int)sizeof(LOC_PYRA5)/sizeof(double);
+ lgth=sizeof(LOC_PYRA5)/sizeof(double);
return LOC_PYRA5;
}
case INTERP_KERNEL::NORM_PYRA13:
{
- lgth=(int)sizeof(LOC_PYRA13)/sizeof(double);
+ lgth=sizeof(LOC_PYRA13)/sizeof(double);
return LOC_PYRA13;
}
default:
}
}
-void MEDCouplingFieldDiscretizationGaussNE::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const
+void MEDCouplingFieldDiscretizationGaussNE::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd,
+ DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::computeMeshRestrictionFromTupleIds : NULL input mesh !");
- MCAuto<DataArrayInt> tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1);
+ MCAuto<DataArrayIdType> tmp=DataArrayIdType::New(); tmp->alloc(std::distance(tupleIdsBg,tupleIdsEnd),1);
std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer());
tmp->sort(true);
tmp=tmp->buildUnique();
- MCAuto<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
+ MCAuto<DataArrayIdType> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
nbOfNodesPerCell->computeOffsetsFull();
nbOfNodesPerCell->findIdsRangesInListOfIds(tmp,cellRestriction,trueTupleRestriction);
}
{
}
-double MEDCouplingFieldDiscretizationGaussNE::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const
+double MEDCouplingFieldDiscretizationGaussNE::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getIJK : NULL input mesh !");
- int offset=0;
- for(int i=0;i<cellId;i++)
+ mcIdType offset=0;
+ for(mcIdType i=0;i<cellId;i++)
{
INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
void MEDCouplingFieldDiscretizationGaussNE::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const
{
- std::size_t nbOfTuples(getNumberOfTuples(mesh));
+ mcIdType nbOfTuples(getNumberOfTuples(mesh));
if(nbOfTuples!=da->getNumberOfTuples())
{
std::ostringstream oss; oss << "Invalid number of tuples in the array : expecting " << nbOfTuples << " !";
ret->setMesh(mesh);
//
std::set<INTERP_KERNEL::NormalizedCellType> types=mesh->getAllGeoTypes();
- MCAuto<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
- int nbTuples=nbOfNodesPerCell->accumulate(0);
+ MCAuto<DataArrayIdType> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
+ mcIdType nbTuples=nbOfNodesPerCell->accumulate((std::size_t)0);
nbOfNodesPerCell->computeOffsetsFull();
MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); arr->alloc(nbTuples,1);
ret->setArray(arr);
INTERP_KERNEL::AutoPtr<double> wArr2=new double[wArrSz];
double sum=std::accumulate(wArr,wArr+wArrSz,0.);
std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind2nd(std::multiplies<double>(),1./sum));
- MCAuto<DataArrayInt> ids=mesh->giveCellsWithType(*it);
- MCAuto<DataArrayInt> ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell);
- const int *ptIds2=ids2->begin(),*ptIds=ids->begin();
- int nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
- for(int i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++)
+ MCAuto<DataArrayIdType> ids=mesh->giveCellsWithType(*it);
+ MCAuto<DataArrayIdType> ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell);
+ const mcIdType *ptIds2=ids2->begin(),*ptIds=ids->begin();
+ mcIdType nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
+ for(mcIdType i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++)
for(std::size_t j=0;j<wArrSz;j++,ptIds2++)
arrPtr[*ptIds2]=wArr2[j]*volPtr[*ptIds];
}
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
-void MEDCouplingFieldDiscretizationGaussNE::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const
+void MEDCouplingFieldDiscretizationGaussNE::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const
{
throw INTERP_KERNEL::Exception("getValueOnPos(i,j,k) : Not applicable for Gauss points !");
}
-DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const
+DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const
{
throw INTERP_KERNEL::Exception("getValueOnMulti : Not implemented for Gauss NE !");
}
-MEDCouplingMesh *MEDCouplingFieldDiscretizationGaussNE::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const
+MEDCouplingMesh *MEDCouplingFieldDiscretizationGaussNE::buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::buildSubMeshData : NULL input mesh !");
- MCAuto<DataArrayInt> diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end);
+ MCAuto<DataArrayIdType> diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end);
MCAuto<MEDCouplingMesh> ret=mesh->buildPart(start,end);
di=diSafe.retn();
return ret.retn();
*
* \sa MEDCouplingFieldDiscretizationGauss::buildSubMeshData
*/
-MEDCouplingMesh *MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const
+MEDCouplingMesh *MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const
{
if(stepCellIds!=1)//even for stepCellIds==-1 the output will not be a range
return MEDCouplingFieldDiscretization::buildSubMeshDataRange(mesh,beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,di);
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange : NULL input mesh !");
- int nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
di=0; beginOut=0; endOut=0; stepOut=stepCellIds;
const char msg[]="MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange : cell #";
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(cm.isDynamic())
{ std::ostringstream oss; oss << msg << i << " presence of dynamic cell (polygons and polyedrons) ! Not implemented !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
- int delta=cm.getNumberOfNodes();
+ mcIdType delta=cm.getNumberOfNodes();
if(i<beginCellIds)
beginOut+=delta;
endOut+=delta;
* \return a newly allocated array containing ids to select into the DataArrayDouble of the field.
*
*/
-DataArrayInt *MEDCouplingFieldDiscretizationGaussNE::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const
+DataArrayIdType *MEDCouplingFieldDiscretizationGaussNE::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::computeTupleIdsToSelectFromCellIds : null mesh !");
- MCAuto<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
+ MCAuto<DataArrayIdType> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
nbOfNodesPerCell->computeOffsetsFull();
- MCAuto<DataArrayInt> sel=DataArrayInt::New(); sel->useArray(startCellIds,false,DeallocType::CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1);
+ MCAuto<DataArrayIdType> sel=DataArrayIdType::New(); sel->useArray(startCellIds,false,DeallocType::CPP_DEALLOC,std::distance(startCellIds,endCellIds),1);
return sel->buildExplicitArrByRanges(nbOfNodesPerCell);
}
/*!
* No implementation needed !
*/
-void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnNodes(double , const int *, int newNbOfNodes, DataArrayDouble *) const
+void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnNodes(double , const mcIdType *, mcIdType newNbOfNodes, DataArrayDouble *) const
{
}
-void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
return EasyAggregate<MEDCouplingFieldDiscretizationGaussNE>(fds);
}
-void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
std::copy(res2->begin(),res2->end(),res);
}
-DataArrayDouble *MEDCouplingFieldDiscretizationKriging::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfTargetPoints) const
+DataArrayDouble *MEDCouplingFieldDiscretizationKriging::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfTargetPoints) const
{
if(!arr || !arr->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array is null or not allocated !");
- std::size_t nbOfRows(getNumberOfMeshPlaces(mesh));
+ mcIdType nbOfRows=getNumberOfMeshPlaces(mesh);
if(arr->getNumberOfTuples()!=nbOfRows)
{
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array does not have correct number of tuples ! Excepted " << nbOfRows << " having " << arr->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbCols(-1),nbCompo(arr->getNumberOfComponents());
+ mcIdType nbCols(-1);
+ std::size_t nbCompo=arr->getNumberOfComponents();
MCAuto<DataArrayDouble> m(computeEvaluationMatrixOnGivenPts(mesh,loc,nbOfTargetPoints,nbCols));
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbOfTargetPoints,nbCompo);
- INTERP_KERNEL::matrixProduct(m->begin(),nbOfTargetPoints,nbCols,arr->begin(),nbOfRows,nbCompo,ret->getPointer());
+ INTERP_KERNEL::matrixProduct(m->begin(),nbOfTargetPoints,nbCols,arr->begin(),nbOfRows,ToIdType(nbCompo),ret->getPointer());
return ret.retn();
}
*
* \return the new result matrix to be deallocated by the caller.
*/
-DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixOnGivenPts(const MEDCouplingMesh *mesh, const double *loc, int nbOfTargetPoints, int& nbCols) const
+DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixOnGivenPts(const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfTargetPoints, mcIdType& nbCols) const
{
- int isDrift(-1),nbRows(-1);
+ mcIdType isDrift(-1),nbRows(-1);
MCAuto<DataArrayDouble> matrixInv(computeInverseMatrix(mesh,isDrift,nbRows));
//
MCAuto<DataArrayDouble> coords=getLocalizationOfDiscValues(mesh);
- int nbOfPts(coords->getNumberOfTuples()),dimension(coords->getNumberOfComponents());
+ mcIdType nbOfPts(coords->getNumberOfTuples());
+ std::size_t dimension(coords->getNumberOfComponents());
MCAuto<DataArrayDouble> locArr=DataArrayDouble::New();
locArr->useArray(loc,false,DeallocType::CPP_DEALLOC,nbOfTargetPoints,dimension);
nbCols=nbOfPts;
matrix3->alloc(nbOfTargetPoints*nbRows,1);
double *work=matrix3->getPointer();
const double *workCst(matrix2->begin()),*workCst2(loc);
- for(int i=0;i<nbOfTargetPoints;i++,workCst+=nbOfPts,workCst2+=isDrift-1)
+ for(mcIdType i=0;i<nbOfTargetPoints;i++,workCst+=nbOfPts,workCst2+=isDrift-1)
{
- for(int j=0;j<nbOfPts;j++)
+ for(mcIdType j=0;j<nbOfPts;j++)
work[i*nbRows+j]=workCst[j];
work[i*nbRows+nbOfPts]=1.0;
- for(int j=0;j<isDrift-1;j++)
+ for(mcIdType j=0;j<isDrift-1;j++)
work[i*nbRows+(nbOfPts+1+j)]=workCst2[j];
}
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
MCAuto<DataArrayDouble> ret2(DataArrayDouble::New());
ret2->alloc(nbOfTargetPoints*nbOfPts,1);
workCst=ret->begin(); work=ret2->getPointer();
- for(int i=0;i<nbOfTargetPoints;i++,workCst+=nbRows)
+ for(mcIdType i=0;i<nbOfTargetPoints;i++,workCst+=nbRows)
work=std::copy(workCst,workCst+nbOfPts,work);
return ret2.retn();
}
* \return the new result matrix to be deallocated by the caller.
* \sa computeMatrix
*/
-DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeInverseMatrix(const MEDCouplingMesh *mesh, int& isDrift, int& matSz) const
+DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeInverseMatrix(const MEDCouplingMesh *mesh, mcIdType& isDrift, mcIdType& matSz) const
{
MCAuto<DataArrayDouble> matrixWithDrift(computeMatrix(mesh,isDrift,matSz));
MCAuto<DataArrayDouble> matrixInv(DataArrayDouble::New());
* \return the new result matrix to be deallocated by the caller.
* \sa computeInverseMatrix
*/
-DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeMatrix(const MEDCouplingMesh *mesh, int& isDrift, int& matSz) const
+DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeMatrix(const MEDCouplingMesh *mesh, mcIdType& isDrift, mcIdType& matSz) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::computeMatrix : NULL input mesh !");
MCAuto<DataArrayDouble> coords(getLocalizationOfDiscValues(mesh));
- int nbOfPts(coords->getNumberOfTuples());
+ mcIdType nbOfPts(coords->getNumberOfTuples());
MCAuto<DataArrayDouble> matrix(coords->buildEuclidianDistanceDenseMatrix());
operateOnDenseMatrix(mesh->getSpaceDimension(),nbOfPts*nbOfPts,matrix->getPointer());
// Drift
* Whatever the value of \a isDrift the number of tuples of returned DataArrayDouble will be equal to \c arr->getNumberOfTuples() + \a isDrift.
* \return a newly allocated array containing coefficients including or not drift coefficient at the end depending the value of \a isDrift parameter.
*/
-DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, int& isDrift) const
+DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, mcIdType& isDrift) const
{
- int nbRows(-1);
+ mcIdType nbRows(-1);
MCAuto<DataArrayDouble> matrixInv(computeInverseMatrix(mesh,isDrift,nbRows));
MCAuto<DataArrayDouble> KnewiK(DataArrayDouble::New());
KnewiK->alloc(nbRows*1,1);
* \param [in] nbOfElems is the result of the product of nb of rows and the nb of columns of matrix \a matrixPtr
* \param [in,out] matrixPtr is the dense matrix whose on each values the operation will be applied
*/
-void MEDCouplingFieldDiscretizationKriging::operateOnDenseMatrix(int spaceDimension, int nbOfElems, double *matrixPtr) const
+void MEDCouplingFieldDiscretizationKriging::operateOnDenseMatrix(int spaceDimension, mcIdType nbOfElems, double *matrixPtr) const
{
switch(spaceDimension)
{
}
}
-void MEDCouplingFieldDiscretizationKriging::OperateOnDenseMatrixH3(int nbOfElems, double *matrixPtr)
+void MEDCouplingFieldDiscretizationKriging::OperateOnDenseMatrixH3(mcIdType nbOfElems, double *matrixPtr)
{
- for(int i=0;i<nbOfElems;i++)
+ for(mcIdType i=0;i<nbOfElems;i++)
{
double val=matrixPtr[i];
matrixPtr[i]=val*val*val;
}
}
-void MEDCouplingFieldDiscretizationKriging::OperateOnDenseMatrixH2Ln(int nbOfElems, double *matrixPtr)
+void MEDCouplingFieldDiscretizationKriging::OperateOnDenseMatrixH2Ln(mcIdType nbOfElems, double *matrixPtr)
{
- for(int i=0;i<nbOfElems;i++)
+ for(mcIdType i=0;i<nbOfElems;i++)
{
double val=matrixPtr[i];
if(val!=0.)
* \param [out] delta the delta of number of columns between returned dense matrix and input dense matrix \a matr. \a delta is equal to number of components of \a arr + 1.
* \sa performDrift
*/
-DataArrayDouble *MEDCouplingFieldDiscretizationKriging::PerformDriftRect(const DataArrayDouble *matr, const DataArrayDouble *arr, int& delta)
+DataArrayDouble *MEDCouplingFieldDiscretizationKriging::PerformDriftRect(const DataArrayDouble *matr, const DataArrayDouble *arr, mcIdType& delta)
{
if(!matr || !matr->isAllocated() || matr->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : invalid input dense matrix ! Must be allocated not NULL and with exactly one component !");
if(!arr || !arr->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : invalid input array of coordiantes ! Must be allocated and not NULL !");
- int spaceDimension(arr->getNumberOfComponents()),nbOfPts(arr->getNumberOfTuples()),nbOfEltInMatrx(matr->getNumberOfTuples());
- delta=spaceDimension+1;
- int nbOfCols(nbOfEltInMatrx/nbOfPts);
+ std::size_t spaceDimension(arr->getNumberOfComponents());
+ mcIdType nbOfPts(arr->getNumberOfTuples()),nbOfEltInMatrx(matr->getNumberOfTuples());
+ delta=ToIdType(spaceDimension)+1;
+ mcIdType nbOfCols(nbOfEltInMatrx/nbOfPts);
if(nbOfEltInMatrx%nbOfPts!=0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : size of input dense matrix and input arrays mismatch ! NbOfElems in matrix % nb of tuples in array must be equal to 0 !");
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfPts*(nbOfCols+delta));
double *retPtr(ret->getPointer());
const double *mPtr(matr->begin()),*aPtr(arr->begin());
- for(int i=0;i<nbOfPts;i++,aPtr+=spaceDimension,mPtr+=nbOfCols)
+ for(mcIdType i=0;i<nbOfPts;i++,aPtr+=spaceDimension,mPtr+=nbOfCols)
{
retPtr=std::copy(mPtr,mPtr+nbOfCols,retPtr);
*retPtr++=1.;
* \return a newly allocated array having \a isDrift more tuples than \a arr.
* \sa computeVectorOfCoefficients
*/
-DataArrayDouble *MEDCouplingFieldDiscretizationKriging::PerformDriftOfVec(const DataArrayDouble *arr, int isDrift)
+DataArrayDouble *MEDCouplingFieldDiscretizationKriging::PerformDriftOfVec(const DataArrayDouble *arr, mcIdType isDrift)
{
if(!arr || !arr->isAllocated() || arr->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftOfVec : input array must be not NULL allocated and with one component !");
* \return a newly allocated matrix bigger than input matrix \a matr.
* \sa MEDCouplingFieldDiscretizationKriging::PerformDriftRect
*/
-DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, int& delta) const
+DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, mcIdType& delta) const
{
std::size_t spaceDimension(arr->getNumberOfComponents());
- delta=spaceDimension+1;
- std::size_t szOfMatrix(arr->getNumberOfTuples());
+ delta=ToIdType(spaceDimension)+1;
+ mcIdType szOfMatrix(arr->getNumberOfTuples());
if(szOfMatrix*szOfMatrix!=matr->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::performDrift : invalid size");
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
const double *srcWork=matr->getConstPointer();
const double *srcWork2=arr->getConstPointer();
double *destWork=ret->getPointer();
- for(std::size_t i=0;i<szOfMatrix;i++)
+ for(mcIdType i=0;i<szOfMatrix;i++)
{
destWork=std::copy(srcWork,srcWork+szOfMatrix,destWork);
srcWork+=szOfMatrix;
namespace MEDCoupling
{
class DataArray;
- class DataArrayInt;
+ class DataArrayIdType;
class MEDCouplingMesh;
class DataArrayDouble;
class MEDCouplingFieldDouble;
MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const;
MEDCOUPLING_EXPORT virtual MEDCouplingFieldDiscretization *deepCopy() const;
MEDCOUPLING_EXPORT virtual MEDCouplingFieldDiscretization *clone() const = 0;
- MEDCOUPLING_EXPORT virtual MEDCouplingFieldDiscretization *clonePart(const int *startCellIds, const int *endCellIds) const;
- MEDCOUPLING_EXPORT virtual MEDCouplingFieldDiscretization *clonePartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingFieldDiscretization *clonePart(const mcIdType *startCellIds, const mcIdType *endCellIds) const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingFieldDiscretization *clonePartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const;
MEDCOUPLING_EXPORT virtual std::string getStringRepr() const = 0;
MEDCOUPLING_EXPORT virtual const char *getRepr() const = 0;
- MEDCOUPLING_EXPORT virtual int getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const = 0;
- MEDCOUPLING_EXPORT virtual int getNumberOfTuples(const MEDCouplingMesh *mesh) const = 0;
- MEDCOUPLING_EXPORT virtual int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const = 0;
+ MEDCOUPLING_EXPORT virtual mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const = 0;
+ MEDCOUPLING_EXPORT virtual mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const = 0;
+ MEDCOUPLING_EXPORT virtual mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const = 0;
MEDCOUPLING_EXPORT virtual void normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const;
MEDCOUPLING_EXPORT virtual void normL2(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const;
MEDCOUPLING_EXPORT virtual void integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const;
MEDCOUPLING_EXPORT virtual DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const = 0;
- MEDCOUPLING_EXPORT virtual void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const = 0;
+ MEDCOUPLING_EXPORT virtual void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd,
+ DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const = 0;
MEDCOUPLING_EXPORT virtual void checkCompatibilityWithNature(NatureOfField nat) const = 0;
- MEDCOUPLING_EXPORT virtual void renumberCells(const int *old2NewBg, bool check=true);
+ MEDCOUPLING_EXPORT virtual void renumberCells(const mcIdType *old2NewBg, bool check=true);
MEDCOUPLING_EXPORT virtual void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check) = 0;
- MEDCOUPLING_EXPORT virtual double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const;
+ const mcIdType *old2NewBg, bool check) = 0;
+ MEDCOUPLING_EXPORT virtual double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const;
MEDCOUPLING_EXPORT virtual void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const = 0;
MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const = 0;
MEDCOUPLING_EXPORT virtual void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const = 0;
- MEDCOUPLING_EXPORT virtual void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const = 0;
- MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const = 0;
- MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const;
- MEDCOUPLING_EXPORT virtual void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const = 0;
- MEDCOUPLING_EXPORT virtual void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const = 0;
- MEDCOUPLING_EXPORT virtual void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const = 0;
+ MEDCOUPLING_EXPORT virtual void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT virtual void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const = 0;
+ MEDCOUPLING_EXPORT virtual void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const = 0;
+ MEDCOUPLING_EXPORT virtual void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const = 0;
MEDCOUPLING_EXPORT virtual MCAuto<MEDCouplingFieldDiscretization> aggregate(std::vector<const MEDCouplingFieldDiscretization *>& fds) const = 0;
- MEDCOUPLING_EXPORT virtual void getSerializationIntArray(DataArrayInt *& arr) const;
- MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+ MEDCOUPLING_EXPORT virtual void getSerializationIntArray(DataArrayIdType *& arr) const;
+ MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
MEDCOUPLING_EXPORT virtual void finishUnserialization(const std::vector<double>& tinyInfo);
- MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *& arr);
- MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector<int>& tinyInfo, const DataArrayInt *arr);
+ MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *& arr);
+ MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *arr);
MEDCOUPLING_EXPORT virtual void setGaussLocalizationOnType(const MEDCouplingMesh *m, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg);
- MEDCOUPLING_EXPORT virtual void setGaussLocalizationOnCells(const MEDCouplingMesh *m, const int *begin, const int *end, const std::vector<double>& refCoo,
+ MEDCOUPLING_EXPORT virtual void setGaussLocalizationOnCells(const MEDCouplingMesh *m, const mcIdType *begin, const mcIdType *end, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg);
MEDCOUPLING_EXPORT virtual void clearGaussLocalizations();
- MEDCOUPLING_EXPORT virtual MEDCouplingGaussLocalization& getGaussLocalization(int locId);
- MEDCOUPLING_EXPORT virtual int getNbOfGaussLocalization() const;
- MEDCOUPLING_EXPORT virtual int getGaussLocalizationIdOfOneCell(int cellId) const;
- MEDCOUPLING_EXPORT virtual int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
- MEDCOUPLING_EXPORT virtual std::set<int> getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
- MEDCOUPLING_EXPORT virtual void getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const;
- MEDCOUPLING_EXPORT virtual const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId);
+ MEDCOUPLING_EXPORT virtual mcIdType getNbOfGaussLocalization() const;
+ MEDCOUPLING_EXPORT virtual mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
+ MEDCOUPLING_EXPORT virtual mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT virtual std::set<mcIdType> getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT virtual void getCellIdsHavingGaussLocalization(mcIdType locId, std::vector<mcIdType>& cellIds) const;
+ MEDCOUPLING_EXPORT virtual const MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId) const;
MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0;
MEDCOUPLING_EXPORT virtual ~MEDCouplingFieldDiscretization();
protected:
MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization();
- MEDCOUPLING_EXPORT static void RenumberEntitiesFromO2NArr(double epsOnVals, const int *old2NewPtr, int newNbOfEntity, DataArrayDouble *arr, const std::string& msg);
- MEDCOUPLING_EXPORT static void RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const std::string& msg);
+ MEDCOUPLING_EXPORT static void RenumberEntitiesFromO2NArr(double epsOnVals, const mcIdType *old2NewPtr, mcIdType newNbOfEntity, DataArrayDouble *arr, const std::string& msg);
+ MEDCOUPLING_EXPORT static void RenumberEntitiesFromN2OArr(const mcIdType *new2OldPtr, mcIdType new2OldSz, DataArrayDouble *arr, const std::string& msg);
template<class FIELD_DISC>
static MCAuto<MEDCouplingFieldDiscretization> EasyAggregate(std::vector<const MEDCouplingFieldDiscretization *>& fds);
protected:
MEDCOUPLING_EXPORT std::string getStringRepr() const;
MEDCOUPLING_EXPORT const char *getRepr() const;
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const;
- MEDCOUPLING_EXPORT int getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const;
- MEDCOUPLING_EXPORT int getNumberOfTuples(const MEDCouplingMesh *mesh) const;
- MEDCOUPLING_EXPORT int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
- MEDCOUPLING_EXPORT DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check);
+ const mcIdType *old2NewBg, bool check);
MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const;
- MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const;
+ MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd,
+ DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const;
MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
- MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
- MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const;
- MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const;
- MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const;
- MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingFieldDiscretization> aggregate(std::vector<const MEDCouplingFieldDiscretization *>& fds) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const;
- MEDCOUPLING_EXPORT DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const;
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
public:
static const char REPR[];
class MEDCouplingFieldDiscretizationOnNodes : public MEDCouplingFieldDiscretization
{
public:
- MEDCOUPLING_EXPORT int getNumberOfTuples(const MEDCouplingMesh *mesh) const;
- MEDCOUPLING_EXPORT int getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const;
- MEDCOUPLING_EXPORT int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
- MEDCOUPLING_EXPORT DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check);
+ const mcIdType *old2NewBg, bool check);
MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
- MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const;
+ MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd,
+ DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const;
MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const;
- MEDCOUPLING_EXPORT DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const;
- MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const;
- MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const;
- MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const;
public:
- MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
+ MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const;
};
class MEDCouplingFieldDiscretizationP1 : public MEDCouplingFieldDiscretizationOnNodes
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
- MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const;
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingFieldDiscretization> aggregate(std::vector<const MEDCouplingFieldDiscretization *>& fds) const override;
public:
static const char REPR[];
static const TypeOfField TYPE;
protected:
- MEDCOUPLING_EXPORT void getValueInCell(const MEDCouplingMesh *mesh, int cellId, const DataArrayDouble *arr, const double *loc, double *res) const;
+ MEDCOUPLING_EXPORT void getValueInCell(const MEDCouplingMesh *mesh, mcIdType cellId, const DataArrayDouble *arr, const double *loc, double *res) const;
};
/*!
class MEDCouplingFieldDiscretizationPerCell : public MEDCouplingFieldDiscretization
{
public:
- MEDCOUPLING_EXPORT const DataArrayInt *getArrayOfDiscIds() const;
- MEDCOUPLING_EXPORT void setArrayOfDiscIds(const DataArrayInt *adids);
+ MEDCOUPLING_EXPORT const DataArrayIdType *getArrayOfDiscIds() const;
+ MEDCOUPLING_EXPORT void setArrayOfDiscIds(const DataArrayIdType *adids);
MEDCOUPLING_EXPORT void checkNoOrphanCells() const;
- MEDCOUPLING_EXPORT std::vector<DataArrayInt *> splitIntoSingleGaussDicrPerCellType(std::vector< int >& locIds) const;
+ MEDCOUPLING_EXPORT std::vector<DataArrayIdType *> splitIntoSingleGaussDicrPerCellType(std::vector< mcIdType >& locIds) const;
protected:
MEDCouplingFieldDiscretizationPerCell();
- MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const int *startCellIds, const int *endCellIds);
- MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, int beginCellIds, int endCellIds, int stepCellIds);
- MEDCouplingFieldDiscretizationPerCell(DataArrayInt *dpc);
+ MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const mcIdType *startCellIds, const mcIdType *endCellIds);
+ MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds);
+ MEDCouplingFieldDiscretizationPerCell(DataArrayIdType *dpc);
~MEDCouplingFieldDiscretizationPerCell();
void updateTime() const;
std::size_t getHeapMemorySizeWithoutChildren() const;
void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const;
bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const;
bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const;
- void renumberCells(const int *old2NewBg, bool check);
+ void renumberCells(const mcIdType *old2NewBg, bool check);
protected:
void buildDiscrPerCellIfNecessary(const MEDCouplingMesh *mesh);
protected:
DataArrayIdType *_discr_per_cell;
- static const int DFT_INVALID_LOCID_VALUE;
+ static const mcIdType DFT_INVALID_LOCID_VALUE;
};
class MEDCouplingFieldDiscretizationGauss : public MEDCouplingFieldDiscretizationPerCell
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clone() const;
- MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clonePart(const int *startCellIds, const int *endCellIds) const;
- MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clonePartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clonePart(const mcIdType *startCellIds, const mcIdType *endCellIds) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clonePartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const;
MEDCOUPLING_EXPORT std::string getStringRepr() const;
MEDCOUPLING_EXPORT const char *getRepr() const;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
- MEDCOUPLING_EXPORT int getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const;
- MEDCOUPLING_EXPORT int getNumberOfTuples(const MEDCouplingMesh *mesh) const;
- MEDCOUPLING_EXPORT int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
- MEDCOUPLING_EXPORT DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check);
+ const mcIdType *old2NewBg, bool check);
MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
- MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const;
+ MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd,
+ DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const;
MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const;
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<double>& tinyInfo);
- MEDCOUPLING_EXPORT void getSerializationIntArray(DataArrayInt *& arr) const;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *& arr);
- MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector<int>& tinyInfo, const DataArrayInt *arr);
- MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const;
+ MEDCOUPLING_EXPORT void getSerializationIntArray(DataArrayIdType *& arr) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *& arr);
+ MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *arr);
+ MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const;
MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
- MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
- MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const;
- MEDCOUPLING_EXPORT DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const;
- MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const;
- MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const;
- MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingFieldDiscretization> aggregate(std::vector<const MEDCouplingFieldDiscretization *>& fds) const override;
MEDCOUPLING_EXPORT void setGaussLocalizationOnType(const MEDCouplingMesh *mesh, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg);
- MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const int *begin, const int *end, const std::vector<double>& refCoo,
+ MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const mcIdType *begin, const mcIdType *end, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg);
MEDCOUPLING_EXPORT void clearGaussLocalizations();
- MEDCOUPLING_EXPORT void setGaussLocalization(int locId, const MEDCouplingGaussLocalization& loc);
- MEDCOUPLING_EXPORT void resizeLocalizationVector(int newSz);
- MEDCOUPLING_EXPORT MEDCouplingGaussLocalization& getGaussLocalization(int locId);
- MEDCOUPLING_EXPORT int getNbOfGaussLocalization() const;
- MEDCOUPLING_EXPORT int getGaussLocalizationIdOfOneCell(int cellId) const;
- MEDCOUPLING_EXPORT int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
- MEDCOUPLING_EXPORT std::set<int> getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
- MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const;
- MEDCOUPLING_EXPORT const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
- MEDCOUPLING_EXPORT DataArrayInt *buildNbOfGaussPointPerCellField() const;
+ MEDCOUPLING_EXPORT void setGaussLocalization(mcIdType locId, const MEDCouplingGaussLocalization& loc);
+ MEDCOUPLING_EXPORT void resizeLocalizationVector(mcIdType newSz);
+ MEDCOUPLING_EXPORT MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId);
+ MEDCOUPLING_EXPORT mcIdType getNbOfGaussLocalization() const;
+ MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
+ MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT std::set<mcIdType> getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(mcIdType locId, std::vector<mcIdType>& cellIds) const;
+ MEDCOUPLING_EXPORT const MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *buildNbOfGaussPointPerCellField() const;
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
protected:
- MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, const int *startCellIds=0, const int *endCellIds=0);
- MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, int beginCellIds, int endCellIds, int stepCellIds);
- MEDCouplingFieldDiscretizationGauss(DataArrayInt *dpc, const std::vector<MEDCouplingGaussLocalization>& loc):MEDCouplingFieldDiscretizationPerCell(dpc),_loc(loc) { }
+ MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, const mcIdType *startCellIds=0, const mcIdType *endCellIds=0);
+ MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds);
+ MEDCouplingFieldDiscretizationGauss(DataArrayIdType *dpc, const std::vector<MEDCouplingGaussLocalization>& loc):MEDCouplingFieldDiscretizationPerCell(dpc),_loc(loc) { }
void zipGaussLocalizations();
- int getOffsetOfCell(int cellId) const;
- void checkLocalizationId(int locId) const;
- void commonUnserialization(const std::vector<int>& tinyInfo);
+ mcIdType getOffsetOfCell(mcIdType cellId) const;
+ void checkLocalizationId(mcIdType locId) const;
+ void commonUnserialization(const std::vector<mcIdType>& tinyInfo);
public:
static const char REPR[];
static const TypeOfField TYPE;
MEDCOUPLING_EXPORT std::string getStringRepr() const;
MEDCOUPLING_EXPORT const char *getRepr() const;
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const;
- MEDCOUPLING_EXPORT int getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const;
- MEDCOUPLING_EXPORT int getNumberOfTuples(const MEDCouplingMesh *mesh) const;
- MEDCOUPLING_EXPORT int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
- MEDCOUPLING_EXPORT DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check);
+ const mcIdType *old2NewBg, bool check);
MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const;
- MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const;
+ MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd,
+ DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const;
MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const;
- MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const;
+ MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const;
MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
- MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
- MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const;
- MEDCOUPLING_EXPORT DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const;
- MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const;
- MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const;
- MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingFieldDiscretization> aggregate(std::vector<const MEDCouplingFieldDiscretization *>& fds) const override;
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT static const double *GetWeightArrayFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth);
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
- MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const;
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingFieldDiscretization> aggregate(std::vector<const MEDCouplingFieldDiscretization *>& fds) const override;
public://specific part
- MEDCOUPLING_EXPORT DataArrayDouble *computeEvaluationMatrixOnGivenPts(const MEDCouplingMesh *mesh, const double *loc, int nbOfTargetPoints, int& nbCols) const;
- MEDCOUPLING_EXPORT DataArrayDouble *computeInverseMatrix(const MEDCouplingMesh *mesh, int& isDrift, int& matSz) const;
- MEDCOUPLING_EXPORT DataArrayDouble *computeMatrix(const MEDCouplingMesh *mesh, int& isDrift, int& matSz) const;
- MEDCOUPLING_EXPORT DataArrayDouble *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, int& isDrift) const;
- MEDCOUPLING_EXPORT void operateOnDenseMatrix(int spaceDimension, int nbOfElems, double *matrixPtr) const;
- MEDCOUPLING_EXPORT DataArrayDouble *performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, int& delta) const;
- MEDCOUPLING_EXPORT static void OperateOnDenseMatrixH3(int nbOfElems, double *matrixPtr);
- MEDCOUPLING_EXPORT static void OperateOnDenseMatrixH2Ln(int nbOfElems, double *matrixPtr);
- MEDCOUPLING_EXPORT static DataArrayDouble *PerformDriftRect(const DataArrayDouble *matr, const DataArrayDouble *arr, int& delta);
- MEDCOUPLING_EXPORT static DataArrayDouble *PerformDriftOfVec(const DataArrayDouble *arr, int isDrift);
+ MEDCOUPLING_EXPORT DataArrayDouble *computeEvaluationMatrixOnGivenPts(const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfTargetPoints, mcIdType& nbCols) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeInverseMatrix(const MEDCouplingMesh *mesh, mcIdType& isDrift, mcIdType& matSz) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeMatrix(const MEDCouplingMesh *mesh, mcIdType& isDrift, mcIdType& matSz) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, mcIdType& isDrift) const;
+ MEDCOUPLING_EXPORT void operateOnDenseMatrix(int spaceDimension, mcIdType nbOfElems, double *matrixPtr) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, mcIdType& delta) const;
+ MEDCOUPLING_EXPORT static void OperateOnDenseMatrixH3(mcIdType nbOfElems, double *matrixPtr);
+ MEDCOUPLING_EXPORT static void OperateOnDenseMatrixH2Ln(mcIdType nbOfElems, double *matrixPtr);
+ MEDCOUPLING_EXPORT static DataArrayDouble *PerformDriftRect(const DataArrayDouble *matr, const DataArrayDouble *arr, mcIdType& delta);
+ MEDCOUPLING_EXPORT static DataArrayDouble *PerformDriftOfVec(const DataArrayDouble *arr, mcIdType isDrift);
public:
static const char REPR[];
static const TypeOfField TYPE;
MCAuto<MEDCouplingFieldDiscretizationP0> nsp(new MEDCouplingFieldDiscretizationP0);
ret->setDiscretization(nsp);
const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkConsistencyLight call
- int nbCells(m->getNumberOfCells());
+ mcIdType nbCells=ToIdType(m->getNumberOfCells());
std::vector<DataArrayDouble *> arrs(getArrays());
std::size_t sz(arrs.size());
std::vector< MCAuto<DataArrayDouble> > outArrsSafe(sz); std::vector<DataArrayDouble *> outArrs(sz);
for(std::size_t j=0;j<sz;j++)
{
- int nbCompo(arrs[j]->getNumberOfComponents());
+ std::size_t nbCompo(arrs[j]->getNumberOfComponents());
outArrsSafe[j]=DataArrayDouble::New(); outArrsSafe[j]->alloc(nbCells,nbCompo);
outArrsSafe[j]->copyStringInfoFrom(*arrs[j]);
outArrs[j]=outArrsSafe[j];
double *pt(outArrsSafe[j]->getPointer());
const double *srcPt(arrs[j]->begin());
- for(int i=0;i<nbCells;i++,pt+=nbCompo)
+ for(mcIdType i=0;i<nbCells;i++,pt+=nbCompo)
{
- std::vector<int> nodeIds;
+ std::vector<mcIdType> nodeIds;
m->getNodeIdsOfCell(i,nodeIds);
std::fill(pt,pt+nbCompo,0.);
std::size_t nbNodesInCell(nodeIds.size());
MCAuto<MEDCouplingFieldDiscretizationP1> nsp(new MEDCouplingFieldDiscretizationP1);
ret->setDiscretization(nsp);
const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkConsistencyLight call
- MCAuto<DataArrayInt> rn(DataArrayInt::New()),rni(DataArrayInt::New());
+ MCAuto<DataArrayIdType> rn(DataArrayIdType::New()),rni(DataArrayIdType::New());
m->getReverseNodalConnectivity(rn,rni);
- MCAuto<DataArrayInt> rni2(rni->deltaShiftIndex());
+ MCAuto<DataArrayIdType> rni2(rni->deltaShiftIndex());
MCAuto<DataArrayDouble> rni3(rni2->convertToDblArr()); rni2=0;
std::vector<DataArrayDouble *> arrs(getArrays());
std::size_t sz(arrs.size());
* \ref py_mcfielddouble_renumberNodes "Here is a Python example".
* \endif
*/
-void MEDCouplingFieldDouble::renumberNodes(const int *old2NewBg, double eps)
+void MEDCouplingFieldDouble::renumberNodes(const mcIdType *old2NewBg, double eps)
{
const MEDCouplingPointSet *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("Invalid mesh to apply renumberNodes on it !");
- int nbOfNodes=meshC->getNumberOfNodes();
+ mcIdType nbOfNodes=meshC->getNumberOfNodes();
MCAuto<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCopy());
- int newNbOfNodes=*std::max_element(old2NewBg,old2NewBg+nbOfNodes)+1;
+ mcIdType newNbOfNodes=*std::max_element(old2NewBg,old2NewBg+nbOfNodes)+1;
renumberNodesWithoutMesh(old2NewBg,newNbOfNodes,eps);
meshC2->renumberNodes(old2NewBg,newNbOfNodes);
setMesh(meshC2);
* \throw If the spatial discretization of \a this field is NULL.
* \throw If values at merged nodes differ more than \a eps.
*/
-void MEDCouplingFieldDouble::renumberNodesWithoutMesh(const int *old2NewBg, int newNbOfNodes, double eps)
+void MEDCouplingFieldDouble::renumberNodesWithoutMesh(const mcIdType *old2NewBg, mcIdType newNbOfNodes, double eps)
{
if(_type.isNull())
throw INTERP_KERNEL::Exception("Expecting a spatial discretization to be able to operate a renumbering !");
* vmin are not included in the result array.
* \param [in] vmax - an upper boundary of the range. Tuples with values more than \a
* vmax are not included in the result array.
- * \return DataArrayInt * - a new instance of DataArrayInt holding ids of selected
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of selected
* tuples. The caller is to delete this array using decrRef() as it is no
* more needed.
* \throw If the data array is not set.
* \throw If \a this->getNumberOfComponents() != 1.
*/
-DataArrayInt *MEDCouplingFieldDouble::findIdsInRange(double vmin, double vmax) const
+DataArrayIdType *MEDCouplingFieldDouble::findIdsInRange(double vmin, double vmax) const
{
if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::findIdsInRange : no default array set !");
if(*iter)
{
isExistingArr=true;
- int loc;
+ mcIdType loc;
ret=std::max(ret,(*iter)->getMaxValue(loc));
}
}
/*!
* Returns the maximal value and all its locations within \a this scalar field.
* Only the first of available data arrays is checked.
- * \param [out] tupleIds - a new instance of DataArrayInt containing indices of
+ * \param [out] tupleIds - a new instance of DataArrayIdType containing indices of
* tuples holding the maximal value. The caller is to delete it using
* decrRef() as it is no more needed.
* \return double - the maximal value among all values of the first array of \a this filed.
* \throw If \a this->getNumberOfComponents() != 1.
* \throw If there is an empty data array in \a this field.
*/
-double MEDCouplingFieldDouble::getMaxValue2(DataArrayInt*& tupleIds) const
+double MEDCouplingFieldDouble::getMaxValue2(DataArrayIdType*& tupleIds) const
{
std::vector<DataArrayDouble *> arrays;
timeDiscr()->getArrays(arrays);
double ret(-std::numeric_limits<double>::max());
bool isExistingArr=false;
tupleIds=0;
- MCAuto<DataArrayInt> ret1;
+ MCAuto<DataArrayIdType> ret1;
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
{
if(*iter)
{
isExistingArr=true;
- DataArrayInt *tmp;
+ DataArrayIdType *tmp;
ret=std::max(ret,(*iter)->getMaxValue2(tmp));
- MCAuto<DataArrayInt> tmpSafe(tmp);
- if(!((const DataArrayInt *)ret1))
+ MCAuto<DataArrayIdType> tmpSafe(tmp);
+ if(!((const DataArrayIdType *)ret1))
ret1=tmpSafe;
}
}
if(*iter)
{
isExistingArr=true;
- int loc;
+ mcIdType loc;
ret=std::min(ret,(*iter)->getMinValue(loc));
}
}
/*!
* Returns the minimal value and all its locations within \a this scalar field.
* Only the first of available data arrays is checked.
- * \param [out] tupleIds - a new instance of DataArrayInt containing indices of
+ * \param [out] tupleIds - a new instance of DataArrayIdType containing indices of
* tuples holding the minimal value. The caller is to delete it using
* decrRef() as it is no more needed.
* \return double - the minimal value among all values of the first array of \a this filed.
* \throw If \a this->getNumberOfComponents() != 1.
* \throw If there is an empty data array in \a this field.
*/
-double MEDCouplingFieldDouble::getMinValue2(DataArrayInt*& tupleIds) const
+double MEDCouplingFieldDouble::getMinValue2(DataArrayIdType*& tupleIds) const
{
std::vector<DataArrayDouble *> arrays;
timeDiscr()->getArrays(arrays);
double ret(-std::numeric_limits<double>::max());
bool isExistingArr=false;
tupleIds=0;
- MCAuto<DataArrayInt> ret1;
+ MCAuto<DataArrayIdType> ret1;
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
{
if(*iter)
{
isExistingArr=true;
- DataArrayInt *tmp;
+ DataArrayIdType *tmp;
ret=std::max(ret,(*iter)->getMinValue2(tmp));
- MCAuto<DataArrayInt> tmpSafe(tmp);
- if(!((const DataArrayInt *)ret1))
+ MCAuto<DataArrayIdType> tmpSafe(tmp);
+ if(!((const DataArrayIdType *)ret1))
ret1=tmpSafe;
}
}
if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getWeightedAverageValue : no default array defined !");
MCAuto<MEDCouplingFieldDouble> w=buildMeasureField(isWAbs);
- double deno=w->getArray()->accumulate(0);
+ double deno=w->getArray()->accumulate((std::size_t)0);
MCAuto<DataArrayDouble> arr=getArray()->deepCopy();
arr->multiplyEqual(w->getArray());
arr->accumulate(res);
- int nCompo = getArray()->getNumberOfComponents();
+ std::size_t nCompo = getArray()->getNumberOfComponents();
std::transform(res,res+nCompo,res,std::bind2nd(std::multiplies<double>(),1./deno));
}
*/
double MEDCouplingFieldDouble::getWeightedAverageValue(int compId, bool isWAbs) const
{
- int nbComps=getArray()->getNumberOfComponents();
- if(compId<0 || compId>=nbComps)
+ std::size_t nbComps=getArray()->getNumberOfComponents();
+ if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::getWeightedAverageValue : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception(oss.str());
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL1 !");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL1 !");
- int nbComps=getArray()->getNumberOfComponents();
- if(compId<0 || compId>=nbComps)
+ std::size_t nbComps=getArray()->getNumberOfComponents();
+ if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL1 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception(oss.str());
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL2");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL2 !");
- int nbComps=getArray()->getNumberOfComponents();
- if(compId<0 || compId>=nbComps)
+ std::size_t nbComps=getArray()->getNumberOfComponents();
+ if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL2 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception(oss.str());
{
if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::normMax : no default array defined !");
- int nbComps=getArray()->getNumberOfComponents();
- if(compId<0 || compId>=nbComps)
+ std::size_t nbComps=getArray()->getNumberOfComponents();
+ if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::normMax : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception(oss.str());
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform integral");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform integral !");
- int nbComps=getArray()->getNumberOfComponents();
- if(compId<0 || compId>=nbComps)
+ std::size_t nbComps=getArray()->getNumberOfComponents();
+ if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::integral : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception(oss.str());
* \ref py_mcfielddouble_getValueOnPos "Here is a Python example".
* \endif
*/
-void MEDCouplingFieldDouble::getValueOnPos(int i, int j, int k, double *res) const
+void MEDCouplingFieldDouble::getValueOnPos(mcIdType i, mcIdType j, mcIdType k, double *res) const
{
const DataArrayDouble *arr=timeDiscr()->getArray();
if(!_mesh)
* \ref py_mcfielddouble_getValueOnMulti "Here is a Python example".
* \endif
*/
-DataArrayDouble *MEDCouplingFieldDouble::getValueOnMulti(const double *spaceLoc, int nbOfPoints) const
+DataArrayDouble *MEDCouplingFieldDouble::getValueOnMulti(const double *spaceLoc, mcIdType nbOfPoints) const
{
const DataArrayDouble *arr=timeDiscr()->getArray();
if(!_mesh)
std::vector<double> res2;
for(std::vector< const DataArrayDouble *>::const_iterator iter=arrs.begin();iter!=arrs.end();iter++)
{
- int sz=(int)res2.size();
+ std::size_t sz=res2.size();
res2.resize(sz+(*iter)->getNumberOfComponents());
_type->getValueOn(*iter,_mesh,spaceLoc,&res2[sz]);
}
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::operator= : no mesh defined !");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform operator = !");
- int nbOfTuple=_type->getNumberOfTuples(_mesh);
+ mcIdType nbOfTuple=_type->getNumberOfTuples(_mesh);
timeDiscr()->setOrCreateUniformValueOnAllComponents(nbOfTuple,value);
return *this;
}
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::applyFunc : no mesh defined !");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform applyFunc !");
- int nbOfTuple=_type->getNumberOfTuples(_mesh);
+ mcIdType nbOfTuple=_type->getNumberOfTuples(_mesh);
timeDiscr()->setUniformValue(nbOfTuple,nbOfComp,val);
}
* \throw If the spatial discretization is not fully defined.
* \sa MEDCouplingField::getNumberOfTuplesExpected
*/
-std::size_t MEDCouplingFieldDouble::getNumberOfTuples() const
+mcIdType MEDCouplingFieldDouble::getNumberOfTuples() const
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Impossible to retrieve number of tuples because no mesh specified !");
* data array.
* \throw If the data array is not set.
*/
-std::size_t MEDCouplingFieldDouble::getNumberOfValues() const
+mcIdType MEDCouplingFieldDouble::getNumberOfValues() const
{
if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getNumberOfValues : No array specified !");
* \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT" or
* \ref MEDCoupling::ON_GAUSS_NE "ON_GAUSS_NE".
*/
-double MEDCouplingFieldDouble::getIJK(int cellId, int nodeIdInCell, int compoId) const
+double MEDCouplingFieldDouble::getIJK(mcIdType cellId, int nodeIdInCell, int compoId) const
{
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getIJK !");
{
if(_mesh==0 || other==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::changeUnderlyingMesh : is expected to operate on not null meshes !");
- DataArrayInt *cellCor=0,*nodeCor=0;
+ DataArrayIdType *cellCor=0,*nodeCor=0;
other->checkGeoEquivalWith(_mesh,levOfCheck,precOnMesh,cellCor,nodeCor);
- MCAuto<DataArrayInt> cellCor2(cellCor),nodeCor2(nodeCor);
+ MCAuto<DataArrayIdType> cellCor2(cellCor),nodeCor2(nodeCor);
if(cellCor)
renumberCellsWithoutMesh(cellCor->getConstPointer(),false);
if(nodeCor)
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform mergeNodes !");
MCAuto<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCopy());
bool ret;
- int ret2;
- MCAuto<DataArrayInt> arr=meshC2->mergeNodes(eps,ret,ret2);
+ mcIdType ret2;
+ MCAuto<DataArrayIdType> arr=meshC2->mergeNodes(eps,ret,ret2);
if(!ret)//no nodes have been merged.
return ret;
std::vector<DataArrayDouble *> arrays;
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform mergeNodesCenter !");
MCAuto<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCopy());
bool ret;
- int ret2;
- MCAuto<DataArrayInt> arr=meshC2->mergeNodesCenter(eps,ret,ret2);
+ mcIdType ret2;
+ MCAuto<DataArrayIdType> arr=meshC2->mergeNodesCenter(eps,ret,ret2);
if(!ret)//no nodes have been merged.
return ret;
std::vector<DataArrayDouble *> arrays;
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipCoords !");
MCAuto<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCopy());
- int oldNbOfNodes=meshC2->getNumberOfNodes();
- MCAuto<DataArrayInt> arr=meshC2->zipCoordsTraducer();
+ mcIdType oldNbOfNodes=meshC2->getNumberOfNodes();
+ MCAuto<DataArrayIdType> arr=meshC2->zipCoordsTraducer();
if(meshC2->getNumberOfNodes()!=oldNbOfNodes)
{
std::vector<DataArrayDouble *> arrays;
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipConnectivity !");
MCAuto<MEDCouplingUMesh> meshC2((MEDCouplingUMesh *)meshC->deepCopy());
- std::size_t oldNbOfCells(meshC2->getNumberOfCells());
- MCAuto<DataArrayInt> arr=meshC2->zipConnectivityTraducer(compType);
+ mcIdType oldNbOfCells(meshC2->getNumberOfCells());
+ MCAuto<DataArrayIdType> arr=meshC2->zipConnectivityTraducer(compType);
if(meshC2->getNumberOfCells()!=oldNbOfCells)
{
std::vector<DataArrayDouble *> arrays;
timeDiscr()->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
if(*iter)
- _type->renumberValuesOnCells(epsOnVals,meshC,arr->getConstPointer(),meshC2->getNumberOfCells(),*iter);
+ _type->renumberValuesOnCells(epsOnVals,meshC,arr->getConstPointer(),ToIdType(meshC2->getNumberOfCells()),*iter);
setMesh(meshC2);
return true;
}
const MCAuto<MEDCouplingUMesh> umesh(mesh->buildUnstructured());
MCAuto<MEDCouplingFieldDouble> ret(clone(false));
ret->setMesh(umesh);
- DataArrayInt *cellIds=0;
+ DataArrayIdType *cellIds=0;
MCAuto<MEDCouplingUMesh> mesh2=umesh->buildSlice3D(origin,vec,eps,cellIds);
- MCAuto<DataArrayInt> cellIds2=cellIds;
+ MCAuto<DataArrayIdType> cellIds2=cellIds;
ret->setMesh(mesh2);
- MCAuto<DataArrayInt> tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end());
+ MCAuto<DataArrayIdType> tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end());
std::vector<DataArrayDouble *> arrays;
timeDiscr()->getArrays(arrays);
int i=0;
throw INTERP_KERNEL::Exception("No underlying mesh on this field to perform simplexize !");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform simplexize !");
- int oldNbOfCells=_mesh->getNumberOfCells();
+ std::size_t oldNbOfCells=_mesh->getNumberOfCells();
MCAuto<MEDCouplingMesh> meshC2(_mesh->deepCopy());
- MCAuto<DataArrayInt> arr=meshC2->simplexize(policy);
- int newNbOfCells=meshC2->getNumberOfCells();
+ MCAuto<DataArrayIdType> arr=meshC2->simplexize(policy);
+ std::size_t newNbOfCells=meshC2->getNumberOfCells();
if(oldNbOfCells==newNbOfCells)
return false;
std::vector<DataArrayDouble *> arrays;
timeDiscr()->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
if(*iter)
- _type->renumberValuesOnCellsR(_mesh,arr->getConstPointer(),arr->getNbOfElems(),*iter);
+ _type->renumberValuesOnCellsR(_mesh,arr->getConstPointer(),ToIdType(arr->getNbOfElems()),*iter);
setMesh(meshC2);
return true;
}
checkConsistencyLight();
const MEDCouplingMesh *mesh(getMesh());
INTERP_KERNEL::AutoCppPtr<Voronizer> vor;
- int meshDim(mesh->getMeshDimension()),spaceDim(mesh->getSpaceDimension());
+ std::size_t meshDim(mesh->getMeshDimension()),spaceDim(mesh->getSpaceDimension());
if(meshDim==1 && (spaceDim==1 || spaceDim==2 || spaceDim==3))
vor=new Voronizer1D;
else if(meshDim==2 && (spaceDim==2 || spaceDim==3))
MCAuto<MEDCouplingUMesh> umesh(mesh->buildUnstructured());
umesh=umesh->clone(false);
umesh->convertQuadraticCellsToLinear();
- MCAuto<DataArrayInt> o2n(umesh->zipCoordsTraducer());
- MCAuto<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(umesh->getNumberOfNodes()));
+ MCAuto<DataArrayIdType> o2n(umesh->zipCoordsTraducer());
+ MCAuto<DataArrayIdType> n2o(o2n->invertArrayO2N2N2O(umesh->getNumberOfNodes()));
MCAuto<DataArrayDouble> arr(getArray()->selectByTupleIdSafe(n2o->begin(),n2o->end()));
MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_NODES));
ret->setArray(arr);
if(!disc2)
throw INTERP_KERNEL::Exception("convertQuadraticCellsToLinear : Not a ON_GAUSS_PT field");
std::set<INTERP_KERNEL::NormalizedCellType> gt2(umesh->getAllGeoTypes());
- std::vector< MCAuto<DataArrayInt> > cellIdsV;
+ std::vector< MCAuto<DataArrayIdType> > cellIdsV;
std::vector< MCAuto<MEDCouplingUMesh> > meshesV;
std::vector< MEDCouplingGaussLocalization > glV;
bool isZipReq(false);
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=gt.begin();it!=gt.end();it++)
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(*it));
- MCAuto<DataArrayInt> cellIds(umesh->giveCellsWithType(*it));
+ MCAuto<DataArrayIdType> cellIds(umesh->giveCellsWithType(*it));
cellIdsV.push_back(cellIds);
MCAuto<MEDCouplingUMesh> part(umesh->buildPartOfMySelf(cellIds->begin(),cellIds->end()));
- int id(disc2->getGaussLocalizationIdOfOneType(*it));
+ mcIdType id(disc2->getGaussLocalizationIdOfOneType(*it));
const MEDCouplingGaussLocalization& gl(disc2->getGaussLocalization(id));
if(!cm.isQuadratic())
{
{
std::vector< const MEDCouplingUMesh * > meshesPtr(VecAutoToVecOfCstPt(meshesV));
umesh=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshesPtr);
- std::vector< const DataArrayInt * > zeCellIds(VecAutoToVecOfCstPt(cellIdsV));
- MCAuto<DataArrayInt> zeIds(DataArrayInt::Aggregate(zeCellIds));
+ std::vector< const DataArrayIdType * > zeCellIds(VecAutoToVecOfCstPt(cellIdsV));
+ MCAuto<DataArrayIdType> zeIds(DataArrayIdType::Aggregate(zeCellIds));
umesh->renumberCells(zeIds->begin());
umesh->setName(mesh->getName());
}
* \param [in] dftValue - value assigned to new values added to \a this field.
* \throw If \a this is not allocated.
*/
-void MEDCouplingFieldDouble::changeNbOfComponents(int newNbOfComp, double dftValue)
+void MEDCouplingFieldDouble::changeNbOfComponents(std::size_t newNbOfComp, double dftValue)
{
timeDiscr()->changeNbOfComponents(newNbOfComp,dftValue);
}
* \throw If a component index (\a i) is not valid:
* \a i < 0 || \a i >= \a this->getNumberOfComponents().
*/
-MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std::vector<int>& compoIds) const
+MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std::vector<std::size_t>& compoIds) const
{
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform keepSelectedComponents !");
return ret.retn();
}
-
/*!
* Copy all components in a specified order from another field.
* The number of tuples in \a this and the other field can be different.
* \throw If \a compoIds.size() != \a a->getNumberOfComponents().
* \throw If \a compoIds[i] < 0 or \a compoIds[i] > \a this->getNumberOfComponents().
*/
-void MEDCouplingFieldDouble::setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<int>& compoIds)
+void MEDCouplingFieldDouble::setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<std::size_t>& compoIds)
{
timeDiscr()->setSelectedComponents(f->timeDiscr(),compoIds);
}
for(;it!=a.end();it++)
if(!ref->areCompatibleForMerge(*it))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply MergeFields on them! Check support mesh, field nature, and spatial and time discretisation.");
- for(int i=0;i<(int)a.size();i++)
+ for(std::size_t i=0;i<a.size();i++)
{
if(!a[i])
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::MergeFields : presence of nullptr instance in input vector !");
inpMeshBase=fieldToWO->getMesh();
inpMesh=inpMeshBase->buildUnstructured();
}
- int nbCells(inpMesh->getNumberOfCells());
+ mcIdType nbCells(inpMesh->getNumberOfCells());
const MEDCouplingFieldDiscretization *disc(fieldToWO->getDiscretization());
const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc));
if(!disc2)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::voronoize2D : Not a ON_GAUSS_PT field");
- int nbLocs(disc2->getNbOfGaussLocalization());
+ mcIdType nbLocs(disc2->getNbOfGaussLocalization());
std::vector< MCAuto<MEDCouplingUMesh> > cells(nbCells);
- for(int i=0;i<nbLocs;i++)
+ for(mcIdType i=0;i<nbLocs;i++)
{
const MEDCouplingGaussLocalization& gl(disc2->getGaussLocalization(i));
if(gl.getDimension()!=vor->getDimension())
MCAuto<MEDCouplingUMesh> coo3(MEDCouplingUMesh::Build0DMeshFromCoords(coo2));
//
MCAuto<MEDCouplingUMesh> vorCellsForCurDisc(vor->doIt(mesh,coo2,eps));
- std::vector<int> ids;
+ std::vector<mcIdType> ids;
MCAuto<DataArrayDouble> ptsInReal;
disc2->getCellIdsHavingGaussLocalization(i,ids);
{
MCAuto<MEDCouplingUMesh> subMesh(inpMesh->buildPartOfMySelf(&ids[0],&ids[0]+ids.size()));
ptsInReal=gl.localizePtsInRefCooForEachCell(vorCellsForCurDisc->getCoords(),subMesh);
}
- int nbPtsPerCell(vorCellsForCurDisc->getNumberOfNodes());
- for(std::size_t j=0;j<ids.size();j++)
+ mcIdType nbPtsPerCell(vorCellsForCurDisc->getNumberOfNodes());
+ for(mcIdType j=0;j<ToIdType(ids.size());j++)
{
MCAuto<MEDCouplingUMesh> elt(vorCellsForCurDisc->clone(false));
MCAuto<DataArrayDouble> coo4(ptsInReal->selectByTupleIdSafeSlice(j*nbPtsPerCell,(j+1)*nbPtsPerCell,1));
MEDCOUPLING_EXPORT std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
MEDCOUPLING_EXPORT bool areCompatibleForMerge(const MEDCouplingField *other) const;
MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingFieldDouble *other) const;
- MEDCOUPLING_EXPORT void renumberNodes(const int *old2NewBg, double eps=1e-15);
- MEDCOUPLING_EXPORT void renumberNodesWithoutMesh(const int *old2NewBg, int newNbOfNodes, double eps=1e-15);
- MEDCOUPLING_EXPORT DataArrayInt *findIdsInRange(double vmin, double vmax) const;
+ MEDCOUPLING_EXPORT void renumberNodes(const mcIdType *old2NewBg, double eps=1e-15);
+ MEDCOUPLING_EXPORT void renumberNodesWithoutMesh(const mcIdType *old2NewBg, mcIdType newNbOfNodes, double eps=1e-15);
+ MEDCOUPLING_EXPORT DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *deepCopy() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *cellToNodeDiscretization() const;
MEDCOUPLING_EXPORT MEDCouplingFieldInt *convertToIntField() const;
MEDCOUPLING_EXPORT MEDCouplingFieldFloat *convertToFloatField() const;
- MEDCOUPLING_EXPORT double getIJK(int cellId, int nodeIdInCell, int compoId) const;
+ MEDCOUPLING_EXPORT double getIJK(mcIdType cellId, int nodeIdInCell, int compoId) const;
MEDCOUPLING_EXPORT double accumulate(int compId) const;
MEDCOUPLING_EXPORT void accumulate(double *res) const;
MEDCOUPLING_EXPORT double getMaxValue() const;
- MEDCOUPLING_EXPORT double getMaxValue2(DataArrayInt*& tupleIds) const;
+ MEDCOUPLING_EXPORT double getMaxValue2(DataArrayIdType*& tupleIds) const;
MEDCOUPLING_EXPORT double getMinValue() const;
- MEDCOUPLING_EXPORT double getMinValue2(DataArrayInt*& tupleIds) const;
+ MEDCOUPLING_EXPORT double getMinValue2(DataArrayIdType*& tupleIds) const;
MEDCOUPLING_EXPORT double getAverageValue() const;
MEDCOUPLING_EXPORT double norm2() const;
MEDCOUPLING_EXPORT void getWeightedAverageValue(double *res, bool isWAbs=true) const;
MEDCOUPLING_EXPORT void normMax(double *res) const;
MEDCOUPLING_EXPORT double integral(int compId, bool isWAbs) const;
MEDCOUPLING_EXPORT void integral(bool isWAbs, double *res) const;
- MEDCOUPLING_EXPORT void getValueOnPos(int i, int j, int k, double *res) const;
+ MEDCOUPLING_EXPORT void getValueOnPos(mcIdType i, mcIdType j, mcIdType k, double *res) const;
MEDCOUPLING_EXPORT void getValueOn(const double *spaceLoc, double *res) const;
MEDCOUPLING_EXPORT void getValueOn(const double *spaceLoc, double time, double *res) const;
- MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const double *spaceLoc, int nbOfPoints) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const double *spaceLoc, mcIdType nbOfPoints) const;
MEDCOUPLING_EXPORT void applyLin(double a, double b, int compoId);
MEDCOUPLING_EXPORT void applyLin(double a, double b);
MEDCOUPLING_EXPORT MEDCouplingFieldDouble &operator=(double value);
MEDCOUPLING_EXPORT void applyFuncFast32(const std::string& func);
MEDCOUPLING_EXPORT void applyFuncFast64(const std::string& func);
MEDCOUPLING_EXPORT std::size_t getNumberOfComponents() const;
- MEDCOUPLING_EXPORT std::size_t getNumberOfTuples() const;
- MEDCOUPLING_EXPORT std::size_t getNumberOfValues() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuples() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfValues() const;
MEDCOUPLING_EXPORT void updateTime() const;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *deviator() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *magnitude() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *maxPerTuple() const;
- MEDCOUPLING_EXPORT void changeNbOfComponents(int newNbOfComp, double dftValue=0.);
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *keepSelectedComponents(const std::vector<int>& compoIds) const;
- MEDCOUPLING_EXPORT void setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<int>& compoIds);
+ MEDCOUPLING_EXPORT void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.);
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const;
+ MEDCOUPLING_EXPORT void setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<std::size_t>& compoIds);
MEDCOUPLING_EXPORT void sortPerTuple(bool asc);
MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *MergeFields(const std::vector<const MEDCouplingFieldDouble *>& a);
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingMesh.hxx"
+#include "MEDCouplingMemArray.txx"
using namespace MEDCoupling;
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingMesh.hxx"
+#include "MEDCouplingMemArray.txx"
using namespace MEDCoupling;
MEDCOUPLING_EXPORT virtual typename Traits<T>::FieldType *clone(bool recDeepCpy) const = 0;
MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT typename Traits<T>::FieldType *cloneWithMesh(bool recDeepCpy) const;
- MEDCOUPLING_EXPORT typename Traits<T>::FieldType *buildSubPart(const DataArrayInt *part) const;
- MEDCOUPLING_EXPORT typename Traits<T>::FieldType *buildSubPart(const int *partBg, const int *partEnd) const;
- MEDCOUPLING_EXPORT typename Traits<T>::FieldType *buildSubPartRange(int begin, int end, int step) const;
+ MEDCOUPLING_EXPORT typename Traits<T>::FieldType *buildSubPart(const DataArrayIdType *part) const;
+ MEDCOUPLING_EXPORT typename Traits<T>::FieldType *buildSubPart(const mcIdType *partBg, const mcIdType *partEnd) const;
+ MEDCOUPLING_EXPORT typename Traits<T>::FieldType *buildSubPartRange(mcIdType begin, mcIdType end, mcIdType step) const;
MEDCOUPLING_EXPORT void setArray(typename Traits<T>::ArrayType *array) { _time_discr->setArray(array,this); }
MEDCOUPLING_EXPORT void setEndArray(typename Traits<T>::ArrayType *array) { _time_discr->setEndArray(array,this); }
MEDCOUPLING_EXPORT const typename Traits<T>::ArrayType *getArray() const { return _time_discr->getArray(); }
MEDCOUPLING_EXPORT double getTime(int& iteration, int& order) const { return _time_discr->getTime(iteration,order); }
MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const { return _time_discr->getStartTime(iteration,order); }
MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const { return _time_discr->getEndTime(iteration,order); }
- MEDCOUPLING_EXPORT T getIJ(int tupleId, int compoId) const { return getArray()->getIJ(tupleId,compoId); }
+ MEDCOUPLING_EXPORT T getIJ(mcIdType tupleId, std::size_t compoId) const { return getArray()->getIJ(tupleId,compoId); }
MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingFieldT<T> *other, double meshPrec, T valsPrec) const;
MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingFieldT<T> *other, double meshPrec, T valsPrec, std::string& reason) const;
MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingFieldT<T> *other, double meshPrec, T valsPrec) const;
MEDCOUPLING_EXPORT bool areCompatibleForDiv(const MEDCouplingField *other) const;
MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingFieldT<T> *other);
MEDCOUPLING_EXPORT void copyAllTinyAttrFrom(const MEDCouplingFieldT<T> *other);
- MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true);
- MEDCOUPLING_EXPORT void renumberCellsWithoutMesh(const int *old2NewBg, bool check=true);
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
+ MEDCOUPLING_EXPORT void renumberCellsWithoutMesh(const mcIdType *old2NewBg, bool check=true);
//
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfoI, DataArrayInt *&dataInt, std::vector<typename Traits<T>::ArrayType *>& arrays);
- MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector<int>& tinyInfoI, const DataArrayInt *dataInt, const std::vector<typename Traits<T>::ArrayType *>& arrays);
- MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
- MEDCOUPLING_EXPORT void serialize(DataArrayInt *&dataInt, std::vector<typename Traits<T>::ArrayType *>& arrays) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI, DataArrayIdType *&dataInt, std::vector<typename Traits<T>::ArrayType *>& arrays);
+ MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector<mcIdType>& tinyInfoI, const DataArrayIdType *dataInt, const std::vector<typename Traits<T>::ArrayType *>& arrays);
+ MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&dataInt, std::vector<typename Traits<T>::ArrayType *>& arrays) const;
MEDCOUPLING_EXPORT const MEDCouplingTimeDiscretizationTemplate<T> *timeDiscrSafe() const;
protected:
MEDCouplingTimeDiscretizationTemplate<T> *timeDiscrSafe();
* \endif
*/
template<class T>
- void MEDCouplingFieldT<T>::renumberCells(const int *old2NewBg, bool check)
+ void MEDCouplingFieldT<T>::renumberCells(const mcIdType *old2NewBg, bool check)
{
renumberCellsWithoutMesh(old2NewBg,check);
MCAuto<MEDCouplingMesh> m(_mesh->deepCopy());
* \throw If mesh nature does not allow renumbering (e.g. structured mesh).
*/
template<class T>
- void MEDCouplingFieldT<T>::renumberCellsWithoutMesh(const int *old2NewBg, bool check)
+ void MEDCouplingFieldT<T>::renumberCellsWithoutMesh(const mcIdType *old2NewBg, bool check)
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Expecting a defined mesh to be able to operate a renumbering !");
{
if(getArray()->isAllocated())
{
- int nbOfCompo=getArray()->getNumberOfComponents();
+ std::size_t nbOfCompo=getArray()->getNumberOfComponents();
ret << Traits<T>::FieldTypeName << " default array has " << nbOfCompo << " components and " << getArray()->getNumberOfTuples() << " tuples.\n";
ret << Traits<T>::FieldTypeName << " default array has following info on components : ";
- for(int i=0;i<nbOfCompo;i++)
+ for(std::size_t i=0;i<nbOfCompo;i++)
ret << "\"" << getArray()->getInfoOnComponent(i) << "\" ";
ret << "\n";
}
nat=MEDCouplingNatureOfField::GetRepr(_nature);
stream << "Nature of field : " << nat << ".\n";
}
- catch(INTERP_KERNEL::Exception& e)
+ catch(INTERP_KERNEL::Exception&)
{ }
const MEDCouplingFieldDiscretization *fd(_type);
if(!fd)
* \sa MEDCoupling::MEDCouplingFieldDouble::buildSubPart(const DataArrayInt *) const, MEDCouplingFieldDouble::buildSubPartRange
*/
template<class T>
- typename Traits<T>::FieldType *MEDCouplingFieldT<T>::buildSubPart(const int *partBg, const int *partEnd) const
+ typename Traits<T>::FieldType *MEDCouplingFieldT<T>::buildSubPart(const mcIdType *partBg, const mcIdType *partEnd) const
{
if(_type.isNull())
throw INTERP_KERNEL::Exception("MEDCouplingFieldT::buildSubPart : Expecting a not NULL spatial discretization !");
- DataArrayInt *arrSelect;
+ DataArrayIdType *arrSelect;
MCAuto<MEDCouplingMesh> m=_type->buildSubMeshData(_mesh,partBg,partEnd,arrSelect);
- MCAuto<DataArrayInt> arrSelect2(arrSelect);
+ MCAuto<DataArrayIdType> arrSelect2(arrSelect);
MCAuto< typename Traits<T>::FieldType > ret(clone(false));//quick shallow copy.
const MEDCouplingFieldDiscretization *disc=getDiscretization();
if(disc)
timeDiscrSafe()->getArrays(arrays);
std::vector<typename Traits<T>::ArrayType *> arrs;
std::vector< MCAuto< typename Traits<T>::ArrayType > > arrsSafe;
- const int *arrSelBg=arrSelect->begin();
- const int *arrSelEnd=arrSelect->end();
+ const mcIdType *arrSelBg=arrSelect->begin();
+ const mcIdType *arrSelEnd=arrSelect->end();
for(typename std::vector<typename Traits<T>::ArrayType *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
{
typename Traits<T>::ArrayType *arr(0);
* \sa MEDCouplingFieldDouble::buildSubPartRange
*/
template<class T>
- typename Traits<T>::FieldType *MEDCouplingFieldT<T>::buildSubPart(const DataArrayInt *part) const
+ typename Traits<T>::FieldType *MEDCouplingFieldT<T>::buildSubPart(const DataArrayIdType *part) const
{
if(part==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldT::buildSubPart : not empty array must be passed to this method !");
* \sa MEDCouplingFieldDouble::buildSubPart
*/
template<class T>
- typename Traits<T>::FieldType *MEDCouplingFieldT<T>::buildSubPartRange(int begin, int end, int step) const
+ typename Traits<T>::FieldType *MEDCouplingFieldT<T>::buildSubPartRange(mcIdType begin, mcIdType end, mcIdType step) const
{
if(_type.isNull())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : Expecting a not NULL spatial discretization !");
- DataArrayInt *arrSelect;
- int beginOut,endOut,stepOut;
+ DataArrayIdType *arrSelect;
+ mcIdType beginOut,endOut,stepOut;
MCAuto<MEDCouplingMesh> m(_type->buildSubMeshDataRange(_mesh,begin,end,step,beginOut,endOut,stepOut,arrSelect));
- MCAuto<DataArrayInt> arrSelect2(arrSelect);
+ MCAuto<DataArrayIdType> arrSelect2(arrSelect);
MCAuto< typename Traits<T>::FieldType > ret(clone(false));//quick shallow copy.
const MEDCouplingFieldDiscretization *disc=getDiscretization();
if(disc)
{
if(arrSelect)
{
- const int *arrSelBg=arrSelect->begin();
- const int *arrSelEnd=arrSelect->end();
+ const mcIdType *arrSelBg=arrSelect->begin();
+ const mcIdType *arrSelEnd=arrSelect->end();
arr=(*iter)->selectByTupleIdSafe(arrSelBg,arrSelEnd);
}
else
* @param tinyInfo out parameter resized correctly after the call. The length of this vector is tiny.
*/
template<class T>
- void MEDCouplingFieldT<T>::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+ void MEDCouplingFieldT<T>::getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const
{
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationIntInformation !");
tinyInfo.clear();
- tinyInfo.push_back((int)_type->getEnum());
- tinyInfo.push_back((int)timeDiscrSafe()->getEnum());
- tinyInfo.push_back((int)_nature);
+ tinyInfo.push_back(ToIdType(_type->getEnum()));
+ tinyInfo.push_back(ToIdType(timeDiscrSafe()->getEnum()));
+ tinyInfo.push_back(ToIdType(_nature));
timeDiscrSafe()->getTinySerializationIntInformation(tinyInfo);
- std::vector<int> tinyInfo2;
+ std::vector<mcIdType> tinyInfo2;
_type->getTinySerializationIntInformation(tinyInfo2);
tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end());
- tinyInfo.push_back((int)tinyInfo2.size());
+ tinyInfo.push_back(ToIdType(tinyInfo2.size()));
}
/*!
* \sa checkForUnserialization
*/
template<class T>
- void MEDCouplingFieldT<T>::resizeForUnserialization(const std::vector<int>& tinyInfoI, DataArrayInt *&dataInt, std::vector<typename Traits<T>::ArrayType *>& arrays)
+ void MEDCouplingFieldT<T>::resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI, DataArrayIdType *&dataInt, std::vector<typename Traits<T>::ArrayType *>& arrays)
{
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !");
dataInt=0;
- std::vector<int> tinyInfoITmp(tinyInfoI);
- int sz=tinyInfoITmp.back();
+ std::vector<mcIdType> tinyInfoITmp(tinyInfoI);
+ mcIdType sz=tinyInfoITmp.back();
tinyInfoITmp.pop_back();
- std::vector<int> tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz);
- std::vector<int> tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end());
+ std::vector<mcIdType> tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz);
+ std::vector<mcIdType> tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end());
timeDiscrSafe()->resizeForUnserialization(tinyInfoI2,arrays);
- std::vector<int> tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end());
+ std::vector<mcIdType> tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end());
_type->resizeForUnserialization(tinyInfoITmp3,dataInt);
}
* \sa resizeForUnserialization
*/
template<class T>
- void MEDCouplingFieldT<T>::checkForUnserialization(const std::vector<int>& tinyInfoI, const DataArrayInt *dataInt, const std::vector<typename Traits<T>::ArrayType *>& arrays)
+ void MEDCouplingFieldT<T>::checkForUnserialization(const std::vector<mcIdType>& tinyInfoI, const DataArrayIdType *dataInt, const std::vector<typename Traits<T>::ArrayType *>& arrays)
{
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !");
- std::vector<int> tinyInfoITmp(tinyInfoI);
- int sz=tinyInfoITmp.back();
+ std::vector<mcIdType> tinyInfoITmp(tinyInfoI);
+ mcIdType sz=tinyInfoITmp.back();
tinyInfoITmp.pop_back();
- std::vector<int> tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz);
- std::vector<int> tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end());
+ std::vector<mcIdType> tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz);
+ std::vector<mcIdType> tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end());
timeDiscrSafe()->checkForUnserialization(tinyInfoI2,arrays);
- std::vector<int> tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end());
+ std::vector<mcIdType> tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end());
_type->checkForUnserialization(tinyInfoITmp3,dataInt);
}
template<class T>
- void MEDCouplingFieldT<T>::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
+ void MEDCouplingFieldT<T>::finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
{
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform finishUnserialization !");
- std::vector<int> tinyInfoI2(tinyInfoI.begin()+3,tinyInfoI.end());
+ std::vector<mcIdType> tinyInfoI2(tinyInfoI.begin()+3,tinyInfoI.end());
//
std::vector<double> tmp(tinyInfoD);
- int sz=(int)tinyInfoD.back();//very bad, lack of time to improve it
+ mcIdType sz=ToIdType(tinyInfoD.back());//very bad, lack of time to improve it
tmp.pop_back();
std::vector<double> tmp1(tmp.begin(),tmp.end()-sz);
std::vector<double> tmp2(tmp.end()-sz,tmp.end());
timeDiscrSafe()->finishUnserialization(tinyInfoI2,tmp1,tinyInfoS);
_nature=(NatureOfField)tinyInfoI[2];
_type->finishUnserialization(tmp2);
- int nbOfElemS=(int)tinyInfoS.size();
+ std::size_t nbOfElemS=tinyInfoS.size();
_name=tinyInfoS[nbOfElemS-3];
_desc=tinyInfoS[nbOfElemS-2];
setTimeUnit(tinyInfoS[nbOfElemS-1]);
* The values returned must be consulted only in readonly mode.
*/
template<class T>
- void MEDCouplingFieldT<T>::serialize(DataArrayInt *&dataInt, std::vector<typename Traits<T>::ArrayType *>& arrays) const
+ void MEDCouplingFieldT<T>::serialize(DataArrayIdType *&dataInt, std::vector<typename Traits<T>::ArrayType *>& arrays) const
{
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform serialize !");
return simpleRepr();
}
-void MEDCouplingFieldTemplate::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+void MEDCouplingFieldTemplate::getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationIntInformation !");
tinyInfo.clear();
- tinyInfo.push_back((int)_type->getEnum());
- tinyInfo.push_back((int)_nature);
- std::vector<int> tinyInfo2;
+ tinyInfo.push_back(ToIdType(_type->getEnum()));
+ tinyInfo.push_back(ToIdType(_nature));
+ std::vector<mcIdType> tinyInfo2;
_type->getTinySerializationIntInformation(tinyInfo2);
tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end());
- tinyInfo.push_back((int)tinyInfo2.size());
+ tinyInfo.push_back(ToIdType(tinyInfo2.size()));
}
void MEDCouplingFieldTemplate::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
tinyInfo.push_back(_desc);
}
-void MEDCouplingFieldTemplate::resizeForUnserialization(const std::vector<int>& tinyInfoI, DataArrayInt *&dataInt)
+void MEDCouplingFieldTemplate::resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI, DataArrayIdType *&dataInt)
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !");
dataInt=0;
- std::vector<int> tinyInfoITmp(tinyInfoI.begin()+2,tinyInfoI.end());
+ std::vector<mcIdType> tinyInfoITmp(tinyInfoI.begin()+2,tinyInfoI.end());
_type->resizeForUnserialization(tinyInfoITmp,dataInt);
}
-void MEDCouplingFieldTemplate::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
+void MEDCouplingFieldTemplate::finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform finishUnserialization !");
_desc=tinyInfoS[1];
}
-void MEDCouplingFieldTemplate::serialize(DataArrayInt *&dataInt) const
+void MEDCouplingFieldTemplate::serialize(DataArrayIdType *&dataInt) const
{
_type->getSerializationIntArray(dataInt);
}
MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingFieldTemplate> clone(bool recDeepCpy) const;
//
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfoI, DataArrayInt *&dataInt);
- MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
- MEDCOUPLING_EXPORT void serialize(DataArrayInt *&dataInt) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI, DataArrayIdType *&dataInt);
+ MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&dataInt) const;
//
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
private:
int dim=cm.getDimension();
if(!cm.isDynamic())
{
- if((int)_ref_coord.size()!=nbNodes*dim)
+ if(ToIdType(_ref_coord.size())!=nbNodes*dim)
{
std::ostringstream oss; oss << "Invalid size of refCoo : expecting to be : " << nbNodes << " (nbNodePerCell) * " << dim << " (dim) !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
* push at the end of tinyInfo its basic serialization info. The size of pushed data is always the same.
* @param tinyInfo inout parameter.
*/
-void MEDCouplingGaussLocalization::pushTinySerializationIntInfo(std::vector<int>& tinyInfo) const
+void MEDCouplingGaussLocalization::pushTinySerializationIntInfo(std::vector<mcIdType>& tinyInfo) const
{
- tinyInfo.push_back((int)_type);
+ tinyInfo.push_back(ToIdType(_type));
tinyInfo.push_back(getNumberOfPtsInRefCell());
tinyInfo.push_back(getNumberOfGaussPt());
}
ptsInRefCoo->checkAllocated();
mesh->checkConsistencyLight();
//
- int nbCells(mesh->getNumberOfCells());
+ mcIdType nbCells=mesh->getNumberOfCells();
const double *coords(mesh->getCoords()->begin());
- const int *connI(mesh->getNodalConnectivityIndex()->begin()),*conn(mesh->getNodalConnectivity()->begin());
+ const mcIdType *connI(mesh->getNodalConnectivityIndex()->begin()),*conn(mesh->getNodalConnectivity()->begin());
//
- int nbPts(ptsInRefCoo->getNumberOfTuples());
+ mcIdType nbPts(ptsInRefCoo->getNumberOfTuples());
INTERP_KERNEL::NormalizedCellType typ(getType());
int dim(INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension()),outDim(mesh->getSpaceDimension());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbPts*nbCells,outDim);
double *retPtr(ret->getPointer());
- if(dim!=(int)ptsInRefCoo->getNumberOfComponents())
+ if(dim!=ToIdType(ptsInRefCoo->getNumberOfComponents()))
throw INTERP_KERNEL::Exception("MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell : number of components of input coo is not equal to dim of element !");
const std::vector<double>& wg(getWeights());
INTERP_KERNEL::GaussCoords calculator;
calculator.addGaussInfo(typ,dim, ptsInRefCoo->begin(),nbPts,&_ref_coord[0],getNumberOfPtsInRefCell());
//
- for(int i=0;i<nbCells;i++,retPtr+=nbPts*outDim)
+ for(mcIdType i=0;i<nbCells;i++,retPtr+=nbPts*outDim)
calculator.calculateCoords(getType(),coords,outDim,conn+connI[i]+1,retPtr);
return ret;
}
{
MCAuto<DataArrayDouble> coo(DataArrayDouble::New());
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getType()));
- if(getDimension()!=(int)cm.getDimension())
+ if(getDimension()!=ToIdType(cm.getDimension()))
throw INTERP_KERNEL::Exception("BuildRefCell : dimension mistmatch !");
coo->alloc(cm.getNumberOfNodes(),getDimension());
std::copy(_ref_coord.begin(),_ref_coord.end(),coo->getPointer());
MCAuto<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New("",getType()));
ret->setCoords(coo);
- MCAuto<DataArrayInt> conn(DataArrayInt::New());
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New());
conn->alloc(cm.getNumberOfNodes(),1);
conn->iota();
ret->setNodalConnectivity(conn);
/*!
* The format of 'tinyData' parameter is the same than pushed in method MEDCouplingGaussLocalization::pushTinySerializationIntInfo.
*/
-MEDCouplingGaussLocalization MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(int dim, const std::vector<int>& tinyData)
+MEDCouplingGaussLocalization MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(mcIdType dim, const std::vector<mcIdType>& tinyData)
{
std::vector<double> v1(dim*tinyData[1]),v2(dim*tinyData[2]),v3(tinyData[2]);
return MEDCouplingGaussLocalization((INTERP_KERNEL::NormalizedCellType)tinyData[0],v1,v2,v3);
}
-int MEDCouplingGaussLocalization::checkCoherencyOfRequest(int gaussPtIdInCell, int comp) const
+int MEDCouplingGaussLocalization::checkCoherencyOfRequest(mcIdType gaussPtIdInCell, int comp) const
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
int dim=cm.getDimension();
- int nbGsPts=getNumberOfGaussPt();
+ mcIdType nbGsPts=getNumberOfGaussPt();
if(gaussPtIdInCell<0 || gaussPtIdInCell>=nbGsPts)
throw INTERP_KERNEL::Exception("gaussPtIdInCell specified is invalid : must be in [0:nbGsPts) !");
if(comp<0 || comp>=dim)
MEDCOUPLING_EXPORT std::size_t getMemorySize() const;
MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const;
- MEDCOUPLING_EXPORT void pushTinySerializationIntInfo(std::vector<int>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void pushTinySerializationIntInfo(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT void pushTinySerializationDblInfo(std::vector<double>& tinyInfo) const;
MEDCOUPLING_EXPORT const double *fillWithValues(const double *vals);
//
MEDCOUPLING_EXPORT void setGaussCoords(const std::vector<double>& gsCoo);
MEDCOUPLING_EXPORT void setWeights(const std::vector<double>& w);
//
- MEDCOUPLING_EXPORT static MEDCouplingGaussLocalization BuildNewInstanceFromTinyInfo(int dim, const std::vector<int>& tinyData);
+ MEDCOUPLING_EXPORT static MEDCouplingGaussLocalization BuildNewInstanceFromTinyInfo(mcIdType dim, const std::vector<mcIdType>& tinyData);
MEDCOUPLING_EXPORT static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
private:
- int checkCoherencyOfRequest(int gaussPtIdInCell, int comp) const;
+ int checkCoherencyOfRequest(mcIdType gaussPtIdInCell, int comp) const;
private:
INTERP_KERNEL::NormalizedCellType _type;
std::vector<double> _ref_coord;
return new MEDCouplingIMesh;
}
-MEDCouplingIMesh *MEDCouplingIMesh::New(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop,
+MEDCouplingIMesh *MEDCouplingIMesh::New(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop,
const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop)
{
MCAuto<MEDCouplingIMesh> ret(new MEDCouplingIMesh);
* \return MEDCouplingIMesh * - a newly alloacted object to be managed by the caller.
* \throw if \a ghostLev < 0.
*/
-MEDCouplingIMesh *MEDCouplingIMesh::buildWithGhost(int ghostLev) const
+MEDCouplingIMesh *MEDCouplingIMesh::buildWithGhost(mcIdType ghostLev) const
{
if(ghostLev<0)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::buildWithGhost : the ghostLev must be >= 0 !");
checkConsistencyLight();
int spaceDim(getSpaceDimension());
double origin[3],dxyz[3];
- int structure[3];
+ mcIdType structure[3];
for(int i=0;i<spaceDim;i++)
{
- origin[i]=_origin[i]-ghostLev*_dxyz[i];
+ origin[i]=_origin[i]-FromIdType<double>(ghostLev)*_dxyz[i];
dxyz[i]=_dxyz[i];
structure[i]=_structure[i]+2*ghostLev;
}
return ret.retn();
}
-void MEDCouplingIMesh::setNodeStruct(const int *nodeStrctStart, const int *nodeStrctStop)
+void MEDCouplingIMesh::setNodeStruct(const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop)
{
checkSpaceDimension();
- int sz((int)std::distance(nodeStrctStart,nodeStrctStop));
+ mcIdType sz((mcIdType)std::distance(nodeStrctStart,nodeStrctStop));
if(sz!=_space_dim)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::setNodeStruct : input vector of node structure has not the right size ! Or change space dimension before calling it !");
std::copy(nodeStrctStart,nodeStrctStop,_structure);
declareAsNew();
}
-std::vector<int> MEDCouplingIMesh::getNodeStruct() const
+std::vector<mcIdType> MEDCouplingIMesh::getNodeStruct() const
{
checkSpaceDimension();
- return std::vector<int>(_structure,_structure+_space_dim);
+ return std::vector<mcIdType>(_structure,_structure+_space_dim);
}
void MEDCouplingIMesh::setOrigin(const double *originStart, const double *originStop)
{
checkSpaceDimension();
- int sz((int)std::distance(originStart,originStop));
+ mcIdType sz(ToIdType(std::distance(originStart,originStop)));
if(sz!=_space_dim)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::setOrigin : input vector of origin vector has not the right size ! Or change space dimension before calling it !");
std::copy(originStart,originStop,_origin);
void MEDCouplingIMesh::setDXYZ(const double *dxyzStart, const double *dxyzStop)
{
checkSpaceDimension();
- int sz((int)std::distance(dxyzStart,dxyzStop));
+ mcIdType sz(ToIdType(std::distance(dxyzStart,dxyzStop)));
if(sz!=_space_dim)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::setDXYZ : input vector of dxyz vector has not the right size ! Or change space dimension before calling it !");
std::copy(dxyzStart,dxyzStop,_dxyz);
* The origin of \a this will be not touched only spacing and node structure will be changed.
* This method can be useful for AMR users.
*/
-void MEDCouplingIMesh::refineWithFactor(const std::vector<int>& factors)
+void MEDCouplingIMesh::refineWithFactor(const std::vector<mcIdType>& factors)
{
- if((int)factors.size()!=_space_dim)
+ if(ToIdType(factors.size())!=_space_dim)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::refineWithFactor : refinement factors must have size equal to spaceDim !");
checkConsistencyLight();
- std::vector<int> structure(_structure,_structure+3);
+ std::vector<mcIdType> structure(_structure,_structure+3);
std::vector<double> dxyz(_dxyz,_dxyz+3);
for(int i=0;i<_space_dim;i++)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::refineWithFactor : factor for axis #" << i << " (" << factors[i] << ")is invalid ! Must be > 0 !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int factAbs(std::abs(factors[i]));
+ mcIdType factAbs(std::abs(factors[i]));
double fact2(1./(double)factors[i]);
structure[i]=(_structure[i]-1)*factAbs+1;
dxyz[i]=fact2*_dxyz[i];
MEDCouplingIMesh *MEDCouplingIMesh::asSingleCell() const
{
checkConsistencyLight();
- int spaceDim(getSpaceDimension()),nodeSt[3];
+ mcIdType spaceDim(getSpaceDimension()),nodeSt[3];
double dxyz[3];
for(int i=0;i<spaceDim;i++)
{
if(_structure[i]>=2)
{
nodeSt[i]=2;
- dxyz[i]=(_structure[i]-1)*_dxyz[i];
+ dxyz[i]=double(_structure[i]-1)*_dxyz[i];
}
else
{
*
* \sa CondenseFineToCoarseGhost,SpreadCoarseToFine
*/
-void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA)
+void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA)
{
if(coarseSt.size()!=fineLocInCoarse.size() || coarseSt.size()!=facts.size())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : All input vectors (dimension) must have the same size !");
if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the parameters 1 or 3 are NULL or not allocated !");
- int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse));
- int nbCompo(fineDA->getNumberOfComponents());
- if((int)coarseDA->getNumberOfComponents()!=nbCompo)
+ std::size_t meshDim(coarseSt.size());
+ mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse));
+ std::size_t nbCompo=fineDA->getNumberOfComponents();
+ if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the number of components of fine DA and coarse one mismatches !");
- if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
+ if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarse : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbTuplesFine(fineDA->getNumberOfTuples());
+ mcIdType nbTuplesFine(fineDA->getNumberOfTuples());
if(nbOfTuplesInFineExp==0)
{
if(nbTuplesFine==0)
}
if(nbTuplesFine%nbOfTuplesInFineExp!=0)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : Invalid nb of tuples in fine DataArray regarding its structure !");
- int fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies<int>()));
+ mcIdType fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies<mcIdType>()));
if(nbTuplesFine!=fact*nbOfTuplesInFineExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarse : Invalid number of tuples (" << nbTuplesFine << ") of fine dataarray is invalid ! Must be " << fact*nbOfTuplesInFineExp << "!";
double *outPtr(coarseDA->getPointer());
const double *inPtr(fineDA->begin());
//
- std::vector<int> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
+ std::vector<mcIdType> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
switch(meshDim)
{
case 1:
{
- int offset(fineLocInCoarse[0].first),fact0(facts[0]);
+ mcIdType offset(fineLocInCoarse[0].first),fact0(facts[0]);
for(int i=0;i<dims[0];i++)
{
double *loc(outPtr+(offset+i)*nbCompo);
- for(int ifact=0;ifact<fact0;ifact++,inPtr+=nbCompo)
+ for(mcIdType ifact=0;ifact<fact0;ifact++,inPtr+=nbCompo)
{
if(ifact!=0)
std::transform(inPtr,inPtr+nbCompo,loc,loc,std::plus<double>());
}
case 2:
{
- int kk(fineLocInCoarse[0].first+coarseSt[0]*fineLocInCoarse[1].first),fact1(facts[1]),fact0(facts[0]);
+ mcIdType kk(fineLocInCoarse[0].first+coarseSt[0]*fineLocInCoarse[1].first),fact1(facts[1]),fact0(facts[0]);
for(int j=0;j<dims[1];j++)
{
- for(int jfact=0;jfact<fact1;jfact++)
+ for(mcIdType jfact=0;jfact<fact1;jfact++)
{
for(int i=0;i<dims[0];i++)
{
double *loc(outPtr+(kk+i)*nbCompo);
- for(int ifact=0;ifact<fact0;ifact++,inPtr+=nbCompo)
+ for(mcIdType ifact=0;ifact<fact0;ifact++,inPtr+=nbCompo)
{
if(jfact!=0 || ifact!=0)
std::transform(inPtr,inPtr+nbCompo,loc,loc,std::plus<double>());
}
case 3:
{
- int kk(fineLocInCoarse[0].first+coarseSt[0]*fineLocInCoarse[1].first+coarseSt[0]*coarseSt[1]*fineLocInCoarse[2].first),fact2(facts[2]),fact1(facts[1]),fact0(facts[0]);
+ mcIdType kk(fineLocInCoarse[0].first+coarseSt[0]*fineLocInCoarse[1].first+coarseSt[0]*coarseSt[1]*fineLocInCoarse[2].first),fact2(facts[2]),fact1(facts[1]),fact0(facts[0]);
for(int k=0;k<dims[2];k++)
{
- for(int kfact=0;kfact<fact2;kfact++)
+ for(mcIdType kfact=0;kfact<fact2;kfact++)
{
for(int j=0;j<dims[1];j++)
{
- for(int jfact=0;jfact<fact1;jfact++)
+ for(mcIdType jfact=0;jfact<fact1;jfact++)
{
for(int i=0;i<dims[0];i++)
{
double *loc(outPtr+(kk+i+j*coarseSt[0])*nbCompo);
- for(int ifact=0;ifact<fact0;ifact++,inPtr+=nbCompo)
+ for(mcIdType ifact=0;ifact<fact0;ifact++,inPtr+=nbCompo)
{
if(kfact!=0 || jfact!=0 || ifact!=0)
std::transform(inPtr,inPtr+nbCompo,loc,loc,std::plus<double>());
*
* \sa CondenseFineToCoarse,SpreadCoarseToFineGhost
*/
-void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA, int ghostSize)
+void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA, mcIdType ghostSize)
{
if(ghostSize<0)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : ghost level has to be >= 0 !");
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : All input vectors (dimension) must have the same size !");
if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the parameters 1 or 3 are NULL or not allocated !");
- std::vector<int> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
- int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
- int nbCompo(fineDA->getNumberOfComponents());
- if((int)coarseDA->getNumberOfComponents()!=nbCompo)
+ std::vector<mcIdType> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<mcIdType>(),2*ghostSize));
+ std::size_t meshDim(coarseSt.size());
+ mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
+ std::size_t nbCompo(fineDA->getNumberOfComponents());
+ if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the number of components of fine DA and coarse one mismatches !");
- if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
+ if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp)
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
//
- std::vector<int> fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
- std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies<int>());
- std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
- int nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
+ std::vector<mcIdType> fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
+ std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies<mcIdType>());
+ std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus<mcIdType>(),2*ghostSize));
+ mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
if(fineDA->getNumberOfTuples()!=nbTuplesFineExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarseGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !";
double *outPtr(coarseDA->getPointer());
const double *inPtr(fineDA->begin());
//
- std::vector<int> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
+ std::vector<mcIdType> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
switch(meshDim)
{
case 1:
{
- int offset(fineLocInCoarse[0].first+ghostSize),fact0(facts[0]);
+ mcIdType offset(fineLocInCoarse[0].first+ghostSize),fact0(facts[0]);
inPtr+=ghostSize*nbCompo;
for(int i=0;i<dims[0];i++)
{
double *loc(outPtr+(offset+i)*nbCompo);
- for(int ifact=0;ifact<fact0;ifact++,inPtr+=nbCompo)
+ for(mcIdType ifact=0;ifact<fact0;ifact++,inPtr+=nbCompo)
{
if(ifact!=0)
std::transform(inPtr,inPtr+nbCompo,loc,loc,std::plus<double>());
}
case 2:
{
- int nxwg(coarseSt[0]+2*ghostSize);
- int kk(fineLocInCoarse[0].first+ghostSize+nxwg*(fineLocInCoarse[1].first+ghostSize)),fact1(facts[1]),fact0(facts[0]);
+ mcIdType nxwg(coarseSt[0]+2*ghostSize);
+ mcIdType kk(fineLocInCoarse[0].first+ghostSize+nxwg*(fineLocInCoarse[1].first+ghostSize)),fact1(facts[1]),fact0(facts[0]);
inPtr+=(dims[0]*fact0+2*ghostSize)*ghostSize*nbCompo;
for(int j=0;j<dims[1];j++)
{
- for(int jfact=0;jfact<fact1;jfact++)
+ for(mcIdType jfact=0;jfact<fact1;jfact++)
{
inPtr+=ghostSize*nbCompo;
for(int i=0;i<dims[0];i++)
{
double *loc(outPtr+(kk+i)*nbCompo);
- for(int ifact=0;ifact<fact0;ifact++,inPtr+=nbCompo)
+ for(mcIdType ifact=0;ifact<fact0;ifact++,inPtr+=nbCompo)
{
if(jfact!=0 || ifact!=0)
std::transform(inPtr,inPtr+nbCompo,loc,loc,std::plus<double>());
}
case 3:
{
- int nxwg(coarseSt[0]+2*ghostSize),nxywg((coarseSt[0]+2*ghostSize)*(coarseSt[1]+2*ghostSize));
- int kk(fineLocInCoarse[0].first+ghostSize+nxwg*(fineLocInCoarse[1].first+ghostSize)+nxywg*(fineLocInCoarse[2].first+ghostSize)),fact2(facts[2]),fact1(facts[1]),fact0(facts[0]);
+ mcIdType nxwg(coarseSt[0]+2*ghostSize),nxywg((coarseSt[0]+2*ghostSize)*(coarseSt[1]+2*ghostSize));
+ mcIdType kk(fineLocInCoarse[0].first+ghostSize+nxwg*(fineLocInCoarse[1].first+ghostSize)+nxywg*(fineLocInCoarse[2].first+ghostSize)),fact2(facts[2]),fact1(facts[1]),fact0(facts[0]);
inPtr+=(dims[0]*fact0+2*ghostSize)*(dims[1]*fact1+2*ghostSize)*ghostSize*nbCompo;
for(int k=0;k<dims[2];k++)
{
- for(int kfact=0;kfact<fact2;kfact++)
+ for(mcIdType kfact=0;kfact<fact2;kfact++)
{
inPtr+=ghostSize*(dims[0]*fact0+2*ghostSize)*nbCompo;
for(int j=0;j<dims[1];j++)
{
- int kky(j*nxwg);
- for(int jfact=0;jfact<fact1;jfact++)
+ mcIdType kky(j*nxwg);
+ for(mcIdType jfact=0;jfact<fact1;jfact++)
{
inPtr+=ghostSize*nbCompo;
for(int i=0;i<dims[0];i++)
{
double *loc(outPtr+(kky+kk+i)*nbCompo);
- for(int ifact=0;ifact<fact0;ifact++,inPtr+=nbCompo)
+ for(mcIdType ifact=0;ifact<fact0;ifact++,inPtr+=nbCompo)
{
if(kfact!=0 || jfact!=0 || ifact!=0)
std::transform(inPtr,inPtr+nbCompo,loc,loc,std::plus<double>());
* \param [in] facts The refinement coefficient per axis.
* \sa SpreadCoarseToFineGhost, CondenseFineToCoarse
*/
-void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts)
+void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts)
{
if(coarseSt.size()!=fineLocInCoarse.size() || coarseSt.size()!=facts.size())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : All input vectors (dimension) must have the same size !");
if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the parameters 1 or 3 are NULL or not allocated !");
- int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse));
- int nbCompo(fineDA->getNumberOfComponents());
- if((int)coarseDA->getNumberOfComponents()!=nbCompo)
+ std::size_t meshDim(coarseSt.size());
+ mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse));
+ std::size_t nbCompo=fineDA->getNumberOfComponents();
+ if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the number of components of fine DA and coarse one mismatches !");
- if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
+ if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFine : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbTuplesFine(fineDA->getNumberOfTuples());
+ mcIdType nbTuplesFine(fineDA->getNumberOfTuples());
if(nbTuplesFine%nbOfTuplesInFineExp!=0)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : Invalid nb of tuples in fine DataArray regarding its structure !");
- int fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies<int>()));
+ mcIdType fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies<mcIdType>()));
if(nbTuplesFine!=fact*nbOfTuplesInFineExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFine : Invalid number of tuples (" << nbTuplesFine << ") of fine dataarray is invalid ! Must be " << fact*nbOfTuplesInFineExp << "!";
double *outPtr(fineDA->getPointer());
const double *inPtr(coarseDA->begin());
//
- std::vector<int> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
+ std::vector<mcIdType> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
switch(meshDim)
{
case 1:
{
- int offset(fineLocInCoarse[0].first),fact0(facts[0]);
+ mcIdType offset(fineLocInCoarse[0].first),fact0(facts[0]);
for(int i=0;i<dims[0];i++)
{
const double *loc(inPtr+(offset+i)*nbCompo);
- for(int ifact=0;ifact<fact0;ifact++)
+ for(mcIdType ifact=0;ifact<fact0;ifact++)
outPtr=std::copy(loc,loc+nbCompo,outPtr);
}
break;
}
case 2:
{
- int kk(fineLocInCoarse[0].first+coarseSt[0]*fineLocInCoarse[1].first),fact0(facts[0]),fact1(facts[1]);
+ mcIdType kk(fineLocInCoarse[0].first+coarseSt[0]*fineLocInCoarse[1].first),fact0(facts[0]),fact1(facts[1]);
for(int j=0;j<dims[1];j++)
{
- for(int jfact=0;jfact<fact1;jfact++)
+ for(mcIdType jfact=0;jfact<fact1;jfact++)
{
for(int i=0;i<dims[0];i++)
{
const double *loc(inPtr+(kk+i)*nbCompo);
- for(int ifact=0;ifact<fact0;ifact++)
+ for(mcIdType ifact=0;ifact<fact0;ifact++)
outPtr=std::copy(loc,loc+nbCompo,outPtr);
}
}
}
case 3:
{
- int kk(fineLocInCoarse[0].first+coarseSt[0]*fineLocInCoarse[1].first+coarseSt[0]*coarseSt[1]*fineLocInCoarse[2].first),fact0(facts[0]),fact1(facts[2]),fact2(facts[2]);
+ mcIdType kk(fineLocInCoarse[0].first+coarseSt[0]*fineLocInCoarse[1].first+coarseSt[0]*coarseSt[1]*fineLocInCoarse[2].first),fact0(facts[0]),fact1(facts[2]),fact2(facts[2]);
for(int k=0;k<dims[2];k++)
{
- for(int kfact=0;kfact<fact2;kfact++)
+ for(mcIdType kfact=0;kfact<fact2;kfact++)
{
for(int j=0;j<dims[1];j++)
{
- for(int jfact=0;jfact<fact1;jfact++)
+ for(mcIdType jfact=0;jfact<fact1;jfact++)
{
for(int i=0;i<dims[0];i++)
{
const double *loc(inPtr+(kk+i+j*coarseSt[0])*nbCompo);
- for(int ifact=0;ifact<fact0;ifact++)
+ for(mcIdType ifact=0;ifact<fact0;ifact++)
outPtr=std::copy(loc,loc+nbCompo,outPtr);
}
}
*
* \sa CondenseFineToCoarse, SpreadCoarseToFineGhostZone
*/
-void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts, int ghostSize)
+void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
{
if(ghostSize<0)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : ghost level has to be >= 0 !");
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : All input vectors (dimension) must have the same size !");
if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the parameters 1 or 3 are NULL or not allocated !");
- std::vector<int> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
- int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
- int nbCompo(fineDA->getNumberOfComponents());
- if((int)coarseDA->getNumberOfComponents()!=nbCompo)
+ std::vector<mcIdType> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<mcIdType>(),2*ghostSize));
+ std::size_t meshDim(coarseSt.size());
+ mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
+ std::size_t nbCompo=fineDA->getNumberOfComponents();
+ if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the number of components of fine DA and coarse one mismatches !");
- if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
+ if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp)
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
//
- std::vector<int> fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
- std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies<int>());
- std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
- int nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
+ std::vector<mcIdType> fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
+ std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies<mcIdType>());
+ std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus<mcIdType>(),2*ghostSize));
+ mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
if(fineDA->getNumberOfTuples()!=nbTuplesFineExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !";
{
case 1:
{
- std::vector<int> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
- int offset(fineLocInCoarse[0].first+ghostSize-1),fact0(facts[0]);//offset is always >=0 thanks to the fact that ghostSize>=1 !
- for(int i=0;i<ghostSize;i++)
+ std::vector<mcIdType> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
+ mcIdType offset(fineLocInCoarse[0].first+ghostSize-1),fact0(facts[0]);//offset is always >=0 thanks to the fact that ghostSize>=1 !
+ for(mcIdType i=0;i<ghostSize;i++)
outPtr=std::copy(inPtr+offset*nbCompo,inPtr+(offset+1)*nbCompo,outPtr);
offset=fineLocInCoarse[0].first+ghostSize;
for(int i=0;i<dims[0];i++)
{
const double *loc(inPtr+(offset+i)*nbCompo);
- for(int ifact=0;ifact<fact0;ifact++)
+ for(mcIdType ifact=0;ifact<fact0;ifact++)
outPtr=std::copy(loc,loc+nbCompo,outPtr);
}
offset=fineLocInCoarse[0].second+ghostSize;
- for(int i=0;i<ghostSize;i++)
+ for(mcIdType i=0;i<ghostSize;i++)
outPtr=std::copy(inPtr+offset*nbCompo,inPtr+(offset+1)*nbCompo,outPtr);
break;
}
}
case 3:
{
- std::vector<int> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
- int fact0(facts[0]),fact1(facts[1]),fact2(facts[2]);
- int nxyWgCoarse((coarseSt[0]+2*ghostSize)*(coarseSt[1]+2*ghostSize)),nxyWgFine((dims[0]*fact0+2*ghostSize)*(dims[1]*fact1+2*ghostSize));
- int offset((fineLocInCoarse[2].first+ghostSize-1)*nxyWgCoarse);//offset is always >=0 thanks to the fact that ghostSize>=1 !
- for(int i=0;i<ghostSize;i++,outPtr+=nxyWgFine*nbCompo)
+ std::vector<mcIdType> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
+ mcIdType fact0(facts[0]),fact1(facts[1]),fact2(facts[2]);
+ mcIdType nxyWgCoarse((coarseSt[0]+2*ghostSize)*(coarseSt[1]+2*ghostSize)),nxyWgFine((dims[0]*fact0+2*ghostSize)*(dims[1]*fact1+2*ghostSize));
+ mcIdType offset((fineLocInCoarse[2].first+ghostSize-1)*nxyWgCoarse);//offset is always >=0 thanks to the fact that ghostSize>=1 !
+ for(mcIdType i=0;i<ghostSize;i++,outPtr+=nxyWgFine*nbCompo)
SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
offset+=nxyWgCoarse;
for(int i=0;i<dims[2];i++,offset+=nxyWgCoarse)
- for(int j=0;j<fact2;j++,outPtr+=nxyWgFine*nbCompo)
+ for(mcIdType j=0;j<fact2;j++,outPtr+=nxyWgFine*nbCompo)
SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
- for(int i=0;i<ghostSize;i++,outPtr+=nxyWgFine*nbCompo)
+ for(mcIdType i=0;i<ghostSize;i++,outPtr+=nxyWgFine*nbCompo)
SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
break;
}
*
* \sa SpreadCoarseToFineGhost
*/
-void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts, int ghostSize)
+void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
{
if(ghostSize<0)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : ghost level has to be >= 0 !");
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : All input vectors (dimension) must have the same size !");
if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the parameters 1 or 3 are NULL or not allocated !");
- std::vector<int> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
- int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
- int nbCompo(fineDA->getNumberOfComponents());
- if((int)coarseDA->getNumberOfComponents()!=nbCompo)
+ std::vector<mcIdType> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<mcIdType>(),2*ghostSize));
+ std::size_t meshDim(coarseSt.size());
+ mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
+ std::size_t nbCompo=fineDA->getNumberOfComponents();
+ if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the number of components of fine DA and coarse one mismatches !");
- if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
+ if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp)
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
//
- std::vector<int> fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
- std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies<int>());
- std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
- int nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
+ std::vector<mcIdType> fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
+ std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies<mcIdType>());
+ std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus<mcIdType>(),2*ghostSize));
+ mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
if(fineDA->getNumberOfTuples()!=nbTuplesFineExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhostZone : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !";
double *outPtr(fineDA->getPointer());
const double *inPtr(coarseDA->begin());
//
- std::vector<int> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
+ std::vector<mcIdType> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
switch(meshDim)
{
case 1:
{
- int offset(fineLocInCoarse[0].first+ghostSize-1),fact0(facts[0]);//offset is always >=0 thanks to the fact that ghostSize>=1 !
- for(int i=0;i<ghostSize;i++)
+ mcIdType offset(fineLocInCoarse[0].first+ghostSize-1),fact0(facts[0]);//offset is always >=0 thanks to the fact that ghostSize>=1 !
+ for(mcIdType i=0;i<ghostSize;i++)
outPtr=std::copy(inPtr+offset*nbCompo,inPtr+(offset+1)*nbCompo,outPtr);
outPtr+=nbCompo*fact0*dims[0];
offset=fineLocInCoarse[0].second+ghostSize;
- for(int i=0;i<ghostSize;i++)
+ for(mcIdType i=0;i<ghostSize;i++)
outPtr=std::copy(inPtr+offset*nbCompo,inPtr+(offset+1)*nbCompo,outPtr);
break;
}
case 2:
{
- SpreadCoarseToFineGhostZone2D(inPtr,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
+ SpreadCoarseToFineGhostZone2D(inPtr,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
break;
}
case 3:
{
- int fact0(facts[0]),fact1(facts[1]),fact2(facts[2]);
- int nxyWgCoarse((coarseSt[0]+2*ghostSize)*(coarseSt[1]+2*ghostSize)),nxyWgFine((dims[0]*fact0+2*ghostSize)*(dims[1]*fact1+2*ghostSize));
- int offset((fineLocInCoarse[2].first+ghostSize-1)*nxyWgCoarse);//offset is always >=0 thanks to the fact that ghostSize>=1 !
- for(int i=0;i<ghostSize;i++,outPtr+=nxyWgFine*nbCompo)
- SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
+ mcIdType fact0(facts[0]),fact1(facts[1]),fact2(facts[2]);
+ mcIdType nxyWgCoarse((coarseSt[0]+2*ghostSize)*(coarseSt[1]+2*ghostSize)),nxyWgFine((dims[0]*fact0+2*ghostSize)*(dims[1]*fact1+2*ghostSize));
+ mcIdType offset((fineLocInCoarse[2].first+ghostSize-1)*nxyWgCoarse);//offset is always >=0 thanks to the fact that ghostSize>=1 !
+ for(mcIdType i=0;i<ghostSize;i++,outPtr+=nxyWgFine*nbCompo)
+ SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
offset+=nxyWgCoarse;
for(int i=0;i<dims[2];i++,offset+=nxyWgCoarse)
- for(int j=0;j<fact2;j++,outPtr+=nxyWgFine*nbCompo)
- SpreadCoarseToFineGhostZone2D(inPtr+offset*nbCompo,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
- for(int i=0;i<ghostSize;i++,outPtr+=nxyWgFine*nbCompo)
- SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
+ for(mcIdType j=0;j<fact2;j++,outPtr+=nxyWgFine*nbCompo)
+ SpreadCoarseToFineGhostZone2D(inPtr+offset*nbCompo,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
+ for(mcIdType i=0;i<ghostSize;i++,outPtr+=nxyWgFine*nbCompo)
+ SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
break;
}
default:
}
void MEDCouplingIMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const
{
if(!isEqualWithoutConsideringStr(other,prec))
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::checkDeepEquivalWith : Meshes are not the same !");
* The user intend that the nodes are the same, so by construction of MEDCoupling::MEDCouplingIMesh, \a this and \a other are the same !
*/
void MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor) const
+ DataArrayIdType *&cellCor) const
{
if(!isEqualWithoutConsideringStr(other,prec))
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !");
checkConsistencyLight();
}
-void MEDCouplingIMesh::getNodeGridStructure(int *res) const
+void MEDCouplingIMesh::getNodeGridStructure(mcIdType *res) const
{
checkSpaceDimension();
std::copy(_structure,_structure+_space_dim,res);
}
-std::vector<int> MEDCouplingIMesh::getNodeGridStructure() const
+std::vector<mcIdType> MEDCouplingIMesh::getNodeGridStructure() const
{
checkSpaceDimension();
- std::vector<int> ret(_structure,_structure+_space_dim);
+ std::vector<mcIdType> ret(_structure,_structure+_space_dim);
return ret;
}
-MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const
+MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const
{
checkConsistencyLight();
int dim(getSpaceDimension());
- if(dim!=(int)cellPart.size())
+ if(dim!=ToIdType(cellPart.size()))
{
std::ostringstream oss; oss << "MEDCouplingIMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
double retOrigin[3]={0.,0.,0.};
- int retStruct[3]={0,0,0};
+ mcIdType retStruct[3]={0,0,0};
MCAuto<MEDCouplingIMesh> ret(dynamic_cast<MEDCouplingIMesh *>(deepCopy()));
for(int i=0;i<dim;i++)
{
- int startNode(cellPart[i].first),endNode(cellPart[i].second+1);
- int myDelta(endNode-startNode);
+ mcIdType startNode(cellPart[i].first),endNode(cellPart[i].second+1);
+ mcIdType myDelta(endNode-startNode);
if(startNode<0 || startNode>=_structure[i])
{
std::ostringstream oss; oss << "MEDCouplingIMesh::buildStructuredSubPart : At dimension #" << i << " the start node id is " << startNode << " it should be in [0," << _structure[i] << ") !";
std::ostringstream oss; oss << "MEDCouplingIMesh::buildStructuredSubPart : Along dimension #" << i << " the number of nodes is " << _structure[i] << ", and you are requesting for " << myDelta << " nodes wide range !" << std::endl;
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- retOrigin[i]=_origin[i]+startNode*_dxyz[i];
+ retOrigin[i]=_origin[i]+FromIdType<double>(startNode)*_dxyz[i];
retStruct[i]=myDelta;
}
ret->setNodeStruct(retStruct,retStruct+dim);
return _space_dim;
}
-void MEDCouplingIMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
+void MEDCouplingIMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const
{
- int tmp[3];
+ mcIdType tmp[3];
int spaceDim(getSpaceDimension());
getSplitNodeValues(tmp);
- int tmp2[3];
+ mcIdType tmp2[3];
GetPosFromId(nodeId,spaceDim,tmp,tmp2);
for(int j=0;j<spaceDim;j++)
- coo.push_back(_origin[j]+_dxyz[j]*tmp2[j]);
+ coo.push_back(_origin[j]+_dxyz[j]*FromIdType<double>(tmp2[j]));
}
std::string MEDCouplingIMesh::simpleRepr() const
for(int idim=0; idim<dim; idim++)
{
bbox[2*idim]=_origin[idim];
- int coeff(_structure[idim]);
+ mcIdType coeff(_structure[idim]);
if(_structure[idim]<0)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::getBoundingBox : on axis #" << idim << " number of nodes in structure is < 0 !";
}
if(_structure[idim]>1)
coeff=_structure[idim]-1;
- bbox[2*idim+1]=_origin[idim]+_dxyz[idim]*coeff;
+ bbox[2*idim+1]=_origin[idim]+_dxyz[idim]*FromIdType<double>(coeff);
}
}
checkConsistencyLight();
std::string name="MeasureOfMesh_";
name+=getName();
- int nbelem(getNumberOfCells());
+ std::size_t nbelem=getNumberOfCells();
MEDCouplingFieldDouble *field(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME));
field->setName(name);
DataArrayDouble* array(DataArrayDouble::New());
//return 0;
}
-int MEDCouplingIMesh::getCellContainingPoint(const double *pos, double eps) const
+mcIdType MEDCouplingIMesh::getCellContainingPoint(const double *pos, double eps) const
{
- int dim(getSpaceDimension()),ret(0),coeff(1);
- for(int i=0;i<dim;i++)
+ mcIdType dim(getSpaceDimension()),ret(0),coeff(1);
+ for(mcIdType i=0;i<dim;i++)
{
- int nbOfCells(_structure[i]-1);
+ mcIdType nbOfCells(_structure[i]-1);
double ref(pos[i]);
- int tmp((int)((ref-_origin[i])/_dxyz[i]));
+ mcIdType tmp(ToIdType((ref-_origin[i])/_dxyz[i]));
if(tmp>=0 && tmp<nbOfCells)
{
ret+=coeff*tmp;
return ret;
}
-void MEDCouplingIMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const
+void MEDCouplingIMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const
{
- int ret(getCellContainingPoint(pos,eps));
+ mcIdType ret(getCellContainingPoint(pos,eps));
elts.push_back(ret);
}
{
checkConsistencyLight();
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
- int spaceDim(getSpaceDimension()),nbNodes(getNumberOfNodes());
+ int spaceDim(getSpaceDimension());
+ mcIdType nbNodes(getNumberOfNodes());
ret->alloc(nbNodes,spaceDim);
double *pt(ret->getPointer());
ret->setInfoOnComponents(buildInfoOnComponents());
- int tmp2[3],tmp[3];
+ mcIdType tmp2[3],tmp[3];
getSplitNodeValues(tmp);
- for(int i=0;i<nbNodes;i++)
+ for(mcIdType i=0;i<nbNodes;i++)
{
GetPosFromId(i,spaceDim,tmp,tmp2);
for(int j=0;j<spaceDim;j++)
- pt[i*spaceDim+j]=_dxyz[j]*tmp2[j]+_origin[j];
+ pt[i*spaceDim+j]=_dxyz[j]*FromIdType<double>(tmp2[j])+_origin[j];
}
return ret.retn();
}
{
checkConsistencyLight();
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
- int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells()),tmp[3],tmp2[3];
+ int spaceDim(getSpaceDimension());
+ mcIdType nbCells(ToIdType(getNumberOfCells())),tmp[3],tmp2[3];
ret->alloc(nbCells,spaceDim);
double *pt(ret->getPointer()),shiftOrigin[3];
std::transform(_dxyz,_dxyz+spaceDim,shiftOrigin,std::bind2nd(std::multiplies<double>(),0.5));
std::transform(_origin,_origin+spaceDim,shiftOrigin,shiftOrigin,std::plus<double>());
getSplitCellValues(tmp);
ret->setInfoOnComponents(buildInfoOnComponents());
- for(int i=0;i<nbCells;i++)
+ for(mcIdType i=0;i<nbCells;i++)
{
GetPosFromId(i,spaceDim,tmp,tmp2);
for(int j=0;j<spaceDim;j++)
- pt[i*spaceDim+j]=_dxyz[j]*tmp2[j]+shiftOrigin[j];
+ pt[i*spaceDim+j]=_dxyz[j]*FromIdType<double>(tmp2[j])+shiftOrigin[j];
}
return ret.retn();
}
return MEDCouplingIMesh::computeCellCenterOfMass();
}
-void MEDCouplingIMesh::renumberCells(const int *old2NewBg, bool check)
+void MEDCouplingIMesh::renumberCells(const mcIdType *old2NewBg, bool check)
{
throw INTERP_KERNEL::Exception("Functionality of renumbering cell not available for IMesh !");
}
-void MEDCouplingIMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+void MEDCouplingIMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
{
int it,order;
double time(getTime(it,order));
tinyInfoD.insert(tinyInfoD.end(),_origin,_origin+3);
}
-void MEDCouplingIMesh::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
+void MEDCouplingIMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
a1->alloc(0,1);
a2->alloc(0,1);
}
-void MEDCouplingIMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
+void MEDCouplingIMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const
{
- a1=DataArrayInt::New();
+ a1=DataArrayIdType::New();
a1->alloc(0,1);
a2=DataArrayDouble::New();
a2->alloc(0,1);
}
-void MEDCouplingIMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+void MEDCouplingIMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings)
{
setName(littleStrings[0]);
setDescription(littleStrings[1]);
setTimeUnit(littleStrings[2]);
setAxisUnit(littleStrings[3]);
- setTime(tinyInfoD[0],tinyInfo[0],tinyInfo[1]);
- _space_dim=tinyInfo[2];
+ setTime(tinyInfoD[0],FromIdType<int>(tinyInfo[0]),FromIdType<int>(tinyInfo[1]));
+ _space_dim=FromIdType<int>(tinyInfo[2]);
_structure[0]=tinyInfo[3]; _structure[1]=tinyInfo[4]; _structure[2]=tinyInfo[5];
_dxyz[0]=tinyInfoD[1]; _dxyz[1]=tinyInfoD[2]; _dxyz[2]=tinyInfoD[3];
_origin[0]=tinyInfoD[4]; _origin[1]=tinyInfoD[5]; _origin[2]=tinyInfoD[6];
return ;
stream << "\n";
std::ostringstream stream0,stream1;
- int nbNodes(1),nbCells(0);
+ mcIdType nbNodes(1),nbCells(0);
bool isPb(false);
for(int i=0;i<_space_dim;i++)
{
- char tmp('X'+i);
- int tmpNodes(_structure[i]);
+ char tmp=(char)((int)('X')+i);
+ mcIdType tmpNodes(_structure[i]);
stream1 << "- Axis " << tmp << " : " << tmpNodes << " nodes (orig=" << _origin[i] << ", inter=" << _dxyz[i] << ").";
if(i!=_space_dim-1)
stream1 << std::endl;
for(int i=0;i<dim;i++)
{
std::ostringstream oss;
- char tmp('X'+i); oss << tmp;
+ char tmp=(char)((int)('X')+i); oss << tmp;
ret[i]=DataArray::BuildInfoFromVarAndUnit(oss.str(),_axis_unit);
}
return ret;
}
}
-void MEDCouplingIMesh::SpreadCoarseToFineGhost2D(const double *inPtr, double *outPtr, int nbCompo, const std::vector<int>& coarseSt, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts, int ghostSize)
+void MEDCouplingIMesh::SpreadCoarseToFineGhost2D(const double *inPtr, double *outPtr, std::size_t nbCompo, const std::vector<mcIdType>& coarseSt, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
{
double *outPtrWork(outPtr);
- std::vector<int> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
- int nxwg(coarseSt[0]+2*ghostSize),fact0(facts[0]),fact1(facts[1]);
- int kk(fineLocInCoarse[0].first+ghostSize-1+nxwg*(fineLocInCoarse[1].first+ghostSize-1));//kk is always >=0 thanks to the fact that ghostSize>=1 !
- for(int jg=0;jg<ghostSize;jg++)
+ std::vector<mcIdType> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
+ mcIdType nxwg(coarseSt[0]+2*ghostSize),fact0(facts[0]),fact1(facts[1]);
+ mcIdType kk(fineLocInCoarse[0].first+ghostSize-1+nxwg*(fineLocInCoarse[1].first+ghostSize-1));//kk is always >=0 thanks to the fact that ghostSize>=1 !
+ for(mcIdType jg=0;jg<ghostSize;jg++)
{
- for(int ig=0;ig<ghostSize;ig++)
+ for(mcIdType ig=0;ig<ghostSize;ig++)
outPtrWork=std::copy(inPtr+kk*nbCompo,inPtr+(kk+1)*nbCompo,outPtrWork);
- int kk0(kk+1);
- for(int ig=0;ig<dims[0];ig++,kk0++)
- for(int ifact=0;ifact<fact0;ifact++)
+ mcIdType kk0(kk+1);
+ for(mcIdType ig=0;ig<dims[0];ig++,kk0++)
+ for(mcIdType ifact=0;ifact<fact0;ifact++)
outPtrWork=std::copy(inPtr+(kk0)*nbCompo,inPtr+(kk0+1)*nbCompo,outPtrWork);
- for(int ik=0;ik<ghostSize;ik++)
+ for(mcIdType ik=0;ik<ghostSize;ik++)
outPtrWork=std::copy(inPtr+kk0*nbCompo,inPtr+(kk0+1)*nbCompo,outPtrWork);
}
- for(int j=0;j<dims[1];j++)
+ for(mcIdType j=0;j<dims[1];j++)
{
kk=fineLocInCoarse[0].first-1+ghostSize+nxwg*(fineLocInCoarse[1].first+ghostSize+j);
- for(int jfact=0;jfact<fact1;jfact++)
+ for(mcIdType jfact=0;jfact<fact1;jfact++)
{
- for(int ig=0;ig<ghostSize;ig++)
+ for(mcIdType ig=0;ig<ghostSize;ig++)
outPtrWork=std::copy(inPtr+kk*nbCompo,inPtr+(kk+1)*nbCompo,outPtrWork);
- int kk0(kk+1);//1 not ghost. We make the hypothesis that factors is >= ghostlev
- for(int i=0;i<dims[0];i++,kk0++)
+ mcIdType kk0(kk+1);//1 not ghost. We make the hypothesis that factors is >= ghostlev
+ for(mcIdType i=0;i<dims[0];i++,kk0++)
{
const double *loc(inPtr+kk0*nbCompo);
- for(int ifact=0;ifact<fact0;ifact++)
+ for(mcIdType ifact=0;ifact<fact0;ifact++)
outPtrWork=std::copy(loc,loc+nbCompo,outPtrWork);
}
- for(int ig=0;ig<ghostSize;ig++)
+ for(mcIdType ig=0;ig<ghostSize;ig++)
outPtrWork=std::copy(inPtr+kk0*nbCompo,inPtr+(kk0+1)*nbCompo,outPtrWork);
}
}
kk=fineLocInCoarse[0].first+ghostSize-1+nxwg*(fineLocInCoarse[1].second+ghostSize);
- for(int jg=0;jg<ghostSize;jg++)
+ for(mcIdType jg=0;jg<ghostSize;jg++)
{
- for(int ig=0;ig<ghostSize;ig++)
+ for(mcIdType ig=0;ig<ghostSize;ig++)
outPtrWork=std::copy(inPtr+kk*nbCompo,inPtr+(kk+1)*nbCompo,outPtrWork);
- int kk0(kk+1);
- for(int ig=0;ig<dims[0];ig++,kk0++)
- for(int ifact=0;ifact<fact0;ifact++)
+ mcIdType kk0(kk+1);
+ for(mcIdType ig=0;ig<dims[0];ig++,kk0++)
+ for(mcIdType ifact=0;ifact<fact0;ifact++)
outPtrWork=std::copy(inPtr+(kk0)*nbCompo,inPtr+(kk0+1)*nbCompo,outPtrWork);
- for(int ik=0;ik<ghostSize;ik++)
+ for(mcIdType ik=0;ik<ghostSize;ik++)
outPtrWork=std::copy(inPtr+kk0*nbCompo,inPtr+(kk0+1)*nbCompo,outPtrWork);
}
}
-void MEDCouplingIMesh::SpreadCoarseToFineGhostZone2D(const double *inPtr, double *outPtr, int nbCompo, const std::vector<int>& coarseSt, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts, int ghostSize)
+void MEDCouplingIMesh::SpreadCoarseToFineGhostZone2D(const double *inPtr, double *outPtr, std::size_t nbCompo, const std::vector<mcIdType>& coarseSt, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
{
double *outPtr2(outPtr);
- std::vector<int> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
- int nxwg(coarseSt[0]+2*ghostSize),fact0(facts[0]),fact1(facts[1]);
- int kk(fineLocInCoarse[0].first+ghostSize-1+nxwg*(fineLocInCoarse[1].first+ghostSize-1));//kk is always >=0 thanks to the fact that ghostSize>=1 !
- for(int jg=0;jg<ghostSize;jg++)
+ std::vector<mcIdType> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
+ mcIdType nxwg(coarseSt[0]+2*ghostSize),fact0(facts[0]),fact1(facts[1]);
+ mcIdType kk(fineLocInCoarse[0].first+ghostSize-1+nxwg*(fineLocInCoarse[1].first+ghostSize-1));//kk is always >=0 thanks to the fact that ghostSize>=1 !
+ for(mcIdType jg=0;jg<ghostSize;jg++)
{
- for(int ig=0;ig<ghostSize;ig++)
+ for(mcIdType ig=0;ig<ghostSize;ig++)
outPtr2=std::copy(inPtr+kk*nbCompo,inPtr+(kk+1)*nbCompo,outPtr2);
- int kk0(kk+1);
- for(int ig=0;ig<dims[0];ig++,kk0++)
- for(int ifact=0;ifact<fact0;ifact++)
+ mcIdType kk0(kk+1);
+ for(mcIdType ig=0;ig<dims[0];ig++,kk0++)
+ for(mcIdType ifact=0;ifact<fact0;ifact++)
outPtr2=std::copy(inPtr+(kk0)*nbCompo,inPtr+(kk0+1)*nbCompo,outPtr2);
- for(int ik=0;ik<ghostSize;ik++)
+ for(mcIdType ik=0;ik<ghostSize;ik++)
outPtr2=std::copy(inPtr+kk0*nbCompo,inPtr+(kk0+1)*nbCompo,outPtr2);
}
- for(int j=0;j<dims[1];j++)
+ for(mcIdType j=0;j<dims[1];j++)
{
kk=fineLocInCoarse[0].first-1+ghostSize+nxwg*(fineLocInCoarse[1].first+ghostSize+j);
- for(int jfact=0;jfact<fact1;jfact++)
+ for(mcIdType jfact=0;jfact<fact1;jfact++)
{
- for(int ig=0;ig<ghostSize;ig++)
+ for(mcIdType ig=0;ig<ghostSize;ig++)
outPtr2=std::copy(inPtr+kk*nbCompo,inPtr+(kk+1)*nbCompo,outPtr2);
- int kk0(kk+1+dims[0]);//1 not ghost. We make the hypothesis that factors is >= ghostlev
+ mcIdType kk0(kk+1+dims[0]);//1 not ghost. We make the hypothesis that factors is >= ghostlev
outPtr2+=fact0*nbCompo*dims[0];
- for(int ig=0;ig<ghostSize;ig++)
+ for(mcIdType ig=0;ig<ghostSize;ig++)
outPtr2=std::copy(inPtr+kk0*nbCompo,inPtr+(kk0+1)*nbCompo,outPtr2);
}
}
kk=fineLocInCoarse[0].first+ghostSize-1+nxwg*(fineLocInCoarse[1].second+ghostSize);
- for(int jg=0;jg<ghostSize;jg++)
+ for(mcIdType jg=0;jg<ghostSize;jg++)
{
- for(int ig=0;ig<ghostSize;ig++)
+ for(mcIdType ig=0;ig<ghostSize;ig++)
outPtr2=std::copy(inPtr+kk*nbCompo,inPtr+(kk+1)*nbCompo,outPtr2);
- int kk0(kk+1);
- for(int ig=0;ig<dims[0];ig++,kk0++)
- for(int ifact=0;ifact<fact0;ifact++)
+ mcIdType kk0(kk+1);
+ for(mcIdType ig=0;ig<dims[0];ig++,kk0++)
+ for(mcIdType ifact=0;ifact<fact0;ifact++)
outPtr2=std::copy(inPtr+(kk0)*nbCompo,inPtr+(kk0+1)*nbCompo,outPtr2);
- for(int ik=0;ik<ghostSize;ik++)
+ for(mcIdType ik=0;ik<ghostSize;ik++)
outPtr2=std::copy(inPtr+kk0*nbCompo,inPtr+(kk0+1)*nbCompo,outPtr2);
}
}
{
public:
MEDCOUPLING_EXPORT static MEDCouplingIMesh *New();
- MEDCOUPLING_EXPORT static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop,
+ MEDCOUPLING_EXPORT static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop,
const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop);
//
MEDCOUPLING_EXPORT void setSpaceDimension(int spaceDim);
- MEDCOUPLING_EXPORT void setNodeStruct(const int *nodeStrctStart, const int *nodeStrctStop);
- MEDCOUPLING_EXPORT std::vector<int> getNodeStruct() const;
+ MEDCOUPLING_EXPORT void setNodeStruct(const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop);
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getNodeStruct() const;
MEDCOUPLING_EXPORT void setOrigin(const double *originStart, const double *originStop);
MEDCOUPLING_EXPORT std::vector<double> getOrigin() const;
MEDCOUPLING_EXPORT void setDXYZ(const double *dxyzStart, const double *dxyzStop);
MEDCOUPLING_EXPORT std::string getAxisUnit() const;
MEDCOUPLING_EXPORT double getMeasureOfAnyCell() const;
MEDCOUPLING_EXPORT MEDCouplingCMesh *convertToCartesian() const;
- MEDCOUPLING_EXPORT void refineWithFactor(const std::vector<int>& factors);
+ MEDCOUPLING_EXPORT void refineWithFactor(const std::vector<mcIdType>& factors);
MEDCOUPLING_EXPORT MEDCouplingIMesh *asSingleCell() const;
- MEDCOUPLING_EXPORT static void CondenseFineToCoarse(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA);
- MEDCOUPLING_EXPORT static void CondenseFineToCoarseGhost(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA, int ghostSize);
- MEDCOUPLING_EXPORT static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts);
- MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts, int ghostSize);
- MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts, int ghostSize);
+ MEDCOUPLING_EXPORT static void CondenseFineToCoarse(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA);
+ MEDCOUPLING_EXPORT static void CondenseFineToCoarseGhost(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA, mcIdType ghostSize);
+ MEDCOUPLING_EXPORT static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts);
+ MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize);
+ MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize);
//
MEDCOUPLING_EXPORT MEDCouplingIMesh *deepCopy() const;
MEDCOUPLING_EXPORT MEDCouplingIMesh *clone(bool recDeepCpy) const;
MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const;
- MEDCOUPLING_EXPORT MEDCouplingIMesh *buildWithGhost(int ghostLev) const;
+ MEDCOUPLING_EXPORT MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const;
MEDCOUPLING_EXPORT void updateTime() const;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const;
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const;
MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor) const;
+ DataArrayIdType *&cellCor) const;
MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
MEDCOUPLING_EXPORT int getSpaceDimension() const;
- MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
+ MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const;
MEDCOUPLING_EXPORT std::string simpleRepr() const;
MEDCOUPLING_EXPORT std::string advancedRepr() const;
// tools
MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
- MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const;
- MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const;
+ MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const;
+ MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const;
MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle);
MEDCOUPLING_EXPORT void translate(const double *vector);
MEDCOUPLING_EXPORT void scale(const double *point, double factor);
MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const;
MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
- MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true);
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
//some useful methods
- MEDCOUPLING_EXPORT void getNodeGridStructure(int *res) const;
- MEDCOUPLING_EXPORT std::vector<int> getNodeGridStructure() const;
- MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const;
+ MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getNodeGridStructure() const;
+ MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const;
//serialisation-unserialization
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
- MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
+ MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings);
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
void checkSpaceDimension() const;
static void CheckSpaceDimension(int spaceDim);
static int FindIntRoot(int val, int order);
- static void SpreadCoarseToFineGhost2D(const double *inPtr, double *outPtr, int nbCompo, const std::vector<int>& coarseSt, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts, int ghostSize);
- static void SpreadCoarseToFineGhostZone2D(const double *inPtr, double *outPtr, int nbCompo, const std::vector<int>& coarseSt, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts, int ghostSize);
+ static void SpreadCoarseToFineGhost2D(const double *inPtr, double *outPtr, std::size_t nbCompo, const std::vector<mcIdType>& coarseSt, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize);
+ static void SpreadCoarseToFineGhostZone2D(const double *inPtr, double *outPtr, std::size_t nbCompo, const std::vector<mcIdType>& coarseSt, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize);
private:
int _space_dim;
double _origin[3];
using namespace MEDCoupling;
-template class MEDCoupling::MapKeyVal<int>;
+template class MEDCoupling::MapKeyVal<mcIdType, mcIdType>;
#include "MEDCoupling.hxx"
#include "MCAuto.hxx"
+#include "MCType.hxx"
#include "MEDCouplingTimeLabel.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "InterpKernelException.hxx"
namespace MEDCoupling
{
- template<class T>
+ template<class ID, class T>
class MapKeyVal : public RefCountObject, public TimeLabel
{
public:
- static MCAuto< MapKeyVal<T> > New();
- std::map<T,T>& data() { return _m; }
- const std::map<T,T>& data() const { return _m; }
+ static MCAuto< MapKeyVal<ID, T> > New();
+ std::map<ID,T>& data() { return _m; }
+ const std::map<ID,T>& data() const { return _m; }
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject*> getDirectChildrenWithNull() const;
void updateTime() const { }
MapKeyVal() { }
~MapKeyVal() { }
private:
- std::map<T,T> _m;
+ std::map<ID,T> _m;
};
- using MapII = MapKeyVal<int>;
+ using MapII = MapKeyVal<mcIdType, mcIdType>;
}
#endif
namespace MEDCoupling
{
- template<class T>
- MCAuto< MapKeyVal<T> > MapKeyVal<T>::New()
+ template<class ID, class T>
+ MCAuto< MapKeyVal<ID, T> > MapKeyVal<ID, T>::New()
{
- MCAuto< MapKeyVal<T> > ret(new MapKeyVal<T>);
+ MCAuto< MapKeyVal<ID, T> > ret(new MapKeyVal<ID, T>);
return ret;
}
- template<class T>
- std::size_t MapKeyVal<T>::getHeapMemorySizeWithoutChildren() const
+ template<class ID, class T>
+ std::size_t MapKeyVal<ID, T>::getHeapMemorySizeWithoutChildren() const
{
- return _m.size()*sizeof(std::pair<T,T>);
+ return _m.size()*sizeof(std::pair<ID, T>);
}
- template<class T>
- std::vector<const BigMemoryObject*> MapKeyVal<T>::getDirectChildrenWithNull() const
+ template<class ID, class T>
+ std::vector<const BigMemoryObject*> MapKeyVal<ID, T>::getDirectChildrenWithNull() const
{
return std::vector<const BigMemoryObject*>();//not a bug no child. Leaf object !
}
* because the mesh is aggregated and potentially modified by rotate or translate method.
* @param cell2DId Id of cell in mesh2D mesh where the computation of 1D mesh will be done.
*/
-MEDCouplingMappedExtrudedMesh *MEDCouplingMappedExtrudedMesh::New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId)
+MEDCouplingMappedExtrudedMesh *MEDCouplingMappedExtrudedMesh::New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId)
{
return new MEDCouplingMappedExtrudedMesh(mesh3D,mesh2D,cell2DId);
}
_mesh1D->copyTinyStringsFrom(otherC->_mesh1D);
}
-MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId)
+MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId)
try:_mesh2D(const_cast<MEDCouplingUMesh *>(mesh2D)),_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(0),_cell_2D_id(cell2DId)
{
if(_mesh2D.isNotNull())
}
}
-std::size_t MEDCouplingMappedExtrudedMesh::getNumberOfCells() const
+mcIdType MEDCouplingMappedExtrudedMesh::getNumberOfCells() const
{
return _mesh2D->getNumberOfCells()*_mesh1D->getNumberOfCells();
}
-int MEDCouplingMappedExtrudedMesh::getNumberOfNodes() const
+mcIdType MEDCouplingMappedExtrudedMesh::getNumberOfNodes() const
{
return _mesh2D->getNumberOfNodes();
}
}
void MEDCouplingMappedExtrudedMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const
{
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::checkDeepEquivalWith : not implemented yet !");
}
void MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor) const
+ DataArrayIdType *&cellCor) const
{
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith : not implemented yet !");
}
-INTERP_KERNEL::NormalizedCellType MEDCouplingMappedExtrudedMesh::getTypeOfCell(std::size_t cellId) const
+INTERP_KERNEL::NormalizedCellType MEDCouplingMappedExtrudedMesh::getTypeOfCell(mcIdType cellId) const
{
- const int *ids(_mesh3D_ids->begin());
+ const mcIdType *ids(_mesh3D_ids->begin());
std::size_t nbOf3DCells(_mesh3D_ids->getNumberOfTuples());
- const int *where(std::find(ids,ids+nbOf3DCells,cellId));
+ const mcIdType *where(std::find(ids,ids+nbOf3DCells,cellId));
if(where==ids+nbOf3DCells)
throw INTERP_KERNEL::Exception("Invalid cellId specified >= getNumberOfCells() !");
std::size_t nbOfCells2D(_mesh2D->getNumberOfCells());
std::size_t locId((std::distance(ids,where))%nbOfCells2D);
- INTERP_KERNEL::NormalizedCellType tmp(_mesh2D->getTypeOfCell(locId));
+ INTERP_KERNEL::NormalizedCellType tmp(_mesh2D->getTypeOfCell(ToIdType(locId)));
return INTERP_KERNEL::CellModel::GetCellModel(tmp).getExtrudedType();
}
return ret;
}
-DataArrayInt *MEDCouplingMappedExtrudedMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
+DataArrayIdType *MEDCouplingMappedExtrudedMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
INTERP_KERNEL::NormalizedCellType revExtTyp(cm.getReverseExtrudedType());
- MCAuto<DataArrayInt> ret(DataArrayInt::New());
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
if(revExtTyp==INTERP_KERNEL::NORM_ERROR)
{
ret->alloc(0,1);
return ret.retn();
}
- MCAuto<DataArrayInt> tmp(_mesh2D->giveCellsWithType(revExtTyp));
- int nbOfLevs(_mesh1D->getNumberOfCells());
- int nbOfCells2D(_mesh2D->getNumberOfCells());
- int nbOfTuples(tmp->getNumberOfTuples());
+ MCAuto<DataArrayIdType> tmp(_mesh2D->giveCellsWithType(revExtTyp));
+ mcIdType nbOfLevs=_mesh1D->getNumberOfCells();
+ mcIdType nbOfCells2D=_mesh2D->getNumberOfCells();
+ mcIdType nbOfTuples(tmp->getNumberOfTuples());
ret->alloc(nbOfLevs*nbOfTuples,1);
- int *pt(ret->getPointer());
+ mcIdType *pt(ret->getPointer());
for(int i=0;i<nbOfLevs;i++,pt+=nbOfTuples)
- std::transform(tmp->begin(),tmp->end(),pt,std::bind2nd(std::plus<int>(),i*nbOfCells2D));
- MCAuto<DataArrayInt> ret2(ret->renumberR(_mesh3D_ids->begin()));
+ std::transform(tmp->begin(),tmp->end(),pt,std::bind2nd(std::plus<mcIdType>(),i*nbOfCells2D));
+ MCAuto<DataArrayIdType> ret2(ret->renumberR(_mesh3D_ids->begin()));
ret2->sort();
return ret2.retn();
}
-DataArrayInt *MEDCouplingMappedExtrudedMesh::computeNbOfNodesPerCell() const
+DataArrayIdType *MEDCouplingMappedExtrudedMesh::computeNbOfNodesPerCell() const
{
- MCAuto<DataArrayInt> ret2D(_mesh2D->computeNbOfNodesPerCell());
- int nbOfLevs(_mesh1D->getNumberOfCells());
- int nbOfCells2D(_mesh2D->getNumberOfCells());
- MCAuto<DataArrayInt> ret3D(DataArrayInt::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
- int *pt(ret3D->getPointer());
+ MCAuto<DataArrayIdType> ret2D(_mesh2D->computeNbOfNodesPerCell());
+ mcIdType nbOfLevs=_mesh1D->getNumberOfCells();
+ mcIdType nbOfCells2D=_mesh2D->getNumberOfCells();
+ MCAuto<DataArrayIdType> ret3D(DataArrayIdType::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
+ mcIdType *pt(ret3D->getPointer());
for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
std::copy(ret2D->begin(),ret2D->end(),pt);
ret3D->applyLin(2,0,0);
return ret3D->renumberR(_mesh3D_ids->begin());
}
-DataArrayInt *MEDCouplingMappedExtrudedMesh::computeNbOfFacesPerCell() const
+DataArrayIdType *MEDCouplingMappedExtrudedMesh::computeNbOfFacesPerCell() const
{
- MCAuto<DataArrayInt> ret2D(_mesh2D->computeNbOfNodesPerCell());
- int nbOfLevs(_mesh1D->getNumberOfCells());
- int nbOfCells2D(_mesh2D->getNumberOfCells());
- MCAuto<DataArrayInt> ret3D(DataArrayInt::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
- int *pt(ret3D->getPointer());
+ MCAuto<DataArrayIdType> ret2D(_mesh2D->computeNbOfNodesPerCell());
+ mcIdType nbOfLevs=_mesh1D->getNumberOfCells();
+ mcIdType nbOfCells2D=_mesh2D->getNumberOfCells();
+ MCAuto<DataArrayIdType> ret3D(DataArrayIdType::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
+ mcIdType *pt(ret3D->getPointer());
for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
std::copy(ret2D->begin(),ret2D->end(),pt);
ret3D->applyLin(2,2,0);
return ret3D->renumberR(_mesh3D_ids->begin());
}
-DataArrayInt *MEDCouplingMappedExtrudedMesh::computeEffectiveNbOfNodesPerCell() const
+DataArrayIdType *MEDCouplingMappedExtrudedMesh::computeEffectiveNbOfNodesPerCell() const
{
return computeNbOfNodesPerCell();
}
-std::size_t MEDCouplingMappedExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
+mcIdType MEDCouplingMappedExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
- std::size_t ret(0);
- std::size_t nbOfCells2D(_mesh2D->getNumberOfCells());
- for(std::size_t i=0;i<nbOfCells2D;i++)
+ mcIdType ret(0);
+ mcIdType nbOfCells2D(_mesh2D->getNumberOfCells());
+ for(mcIdType i=0;i<nbOfCells2D;i++)
{
INTERP_KERNEL::NormalizedCellType t(_mesh2D->getTypeOfCell(i));
if(INTERP_KERNEL::CellModel::GetCellModel(t).getExtrudedType()==type)
return ret*_mesh1D->getNumberOfCells();
}
-void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const
+void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const
{
- int nbOfCells2D(_mesh2D->getNumberOfCells());
- int nbOfNodes2D(_mesh2D->getNumberOfNodes());
- int locId(cellId%nbOfCells2D);
- int lev(cellId/nbOfCells2D);
- std::vector<int> tmp,tmp2;
+ mcIdType nbOfCells2D(_mesh2D->getNumberOfCells());
+ mcIdType nbOfNodes2D(_mesh2D->getNumberOfNodes());
+ mcIdType locId(cellId%nbOfCells2D);
+ mcIdType lev(cellId/nbOfCells2D);
+ std::vector<mcIdType> tmp,tmp2;
_mesh2D->getNodeIdsOfCell(locId,tmp);
tmp2=tmp;
- std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::plus<int>(),nbOfNodes2D*lev));
- std::transform(tmp2.begin(),tmp2.end(),tmp2.begin(),std::bind2nd(std::plus<int>(),nbOfNodes2D*(lev+1)));
+ std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::plus<mcIdType>(),nbOfNodes2D*lev));
+ std::transform(tmp2.begin(),tmp2.end(),tmp2.begin(),std::bind2nd(std::plus<mcIdType>(),nbOfNodes2D*(lev+1)));
conn.insert(conn.end(),tmp.begin(),tmp.end());
conn.insert(conn.end(),tmp2.begin(),tmp2.end());
}
-void MEDCouplingMappedExtrudedMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
+void MEDCouplingMappedExtrudedMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const
{
- int nbOfNodes2D(_mesh2D->getNumberOfNodes());
- int locId(nodeId%nbOfNodes2D);
- int lev(nodeId/nbOfNodes2D);
+ mcIdType nbOfNodes2D(_mesh2D->getNumberOfNodes());
+ mcIdType locId(nodeId%nbOfNodes2D);
+ mcIdType lev(nodeId/nbOfNodes2D);
std::vector<double> tmp,tmp2;
_mesh2D->getCoordinatesOfNode(locId,tmp);
tmp2=tmp;
double bbox2D[6];
_mesh2D->getBoundingBox(bbox2D);
const double *nodes1D(_mesh1D->getCoords()->begin());
- int nbOfNodes1D(_mesh1D->getNumberOfNodes());
+ mcIdType nbOfNodes1D(_mesh1D->getNumberOfNodes());
double bbox1DMin[3],bbox1DMax[3],tmp[3];
std::fill(bbox1DMin,bbox1DMin+3,std::numeric_limits<double>::max());
std::fill(bbox1DMax,bbox1DMax+3,-(std::numeric_limits<double>::max()));
- for(int i=0;i<nbOfNodes1D;i++)
+ for(mcIdType i=0;i<nbOfNodes1D;i++)
{
std::transform(nodes1D+3*i,nodes1D+3*(i+1),bbox1DMin,bbox1DMin,static_cast<const double& (*)(const double&, const double&)>(std::min<double>));
std::transform(nodes1D+3*i,nodes1D+3*(i+1),bbox1DMax,bbox1DMax,static_cast<const double& (*)(const double&, const double&)>(std::max<double>));
}
std::transform(bbox1DMax,bbox1DMax+3,bbox1DMin,tmp,std::minus<double>());
- int id=(int)std::distance(tmp,std::max_element(tmp,tmp+3));
+ mcIdType id=ToIdType(std::distance(tmp,std::max_element(tmp,tmp+3)));
bbox[0]=bbox1DMin[0]; bbox[1]=bbox1DMax[0];
bbox[2]=bbox1DMin[1]; bbox[3]=bbox1DMax[1];
bbox[4]=bbox1DMin[2]; bbox[5]=bbox1DMax[2];
updateTimeWith(*_mesh1D);
}
-void MEDCouplingMappedExtrudedMesh::renumberCells(const int *old2NewBg, bool check)
+void MEDCouplingMappedExtrudedMesh::renumberCells(const mcIdType *old2NewBg, bool check)
{
throw INTERP_KERNEL::Exception("Functionality of renumbering cells unavailable for ExtrudedMesh");
}
MCAuto<MEDCouplingUMesh> mesh2DZC(_mesh2D->deepCopyConnectivityOnly());
mesh2DZC->zipCoords();
MCAuto<MEDCouplingUMesh> ret(mesh2DZC->buildExtrudedMesh(_mesh1D,0));
- const int *renum(_mesh3D_ids->begin());
+ const mcIdType *renum(_mesh3D_ids->begin());
ret->renumberCells(renum,false);
ret->setName(getName());
return ret.retn();
MCAuto<MEDCouplingFieldDouble> ret2D(_mesh2D->getMeasureField(true)),ret1D(_mesh1D->getMeasureField(true));
const double *ret2DPtr(ret2D->getArray()->begin());
const double *ret1DPtr(ret1D->getArray()->begin());
- int nbOf2DCells(_mesh2D->getNumberOfCells()),nbOf1DCells(_mesh1D->getNumberOfCells()),nbOf3DCells(nbOf2DCells*nbOf1DCells);
- const int *renum(_mesh3D_ids->begin());
+ mcIdType nbOf2DCells=_mesh2D->getNumberOfCells(),
+ nbOf1DCells=_mesh1D->getNumberOfCells(),nbOf3DCells(nbOf2DCells*nbOf1DCells);
+ const mcIdType *renum(_mesh3D_ids->begin());
MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME));
ret->setMesh(this);
ret->synchronizeTimeWithMesh();
MCAuto<DataArrayDouble> da(DataArrayDouble::New());
da->alloc(nbOf3DCells,1);
double *retPtr(da->getPointer());
- for(int i=0;i<nbOf1DCells;i++)
- for(int j=0;j<nbOf2DCells;j++)
+ for(mcIdType i=0;i<nbOf1DCells;i++)
+ for(mcIdType j=0;j<nbOf2DCells;j++)
retPtr[renum[i*nbOf2DCells+j]]=ret2DPtr[j]*ret1DPtr[i];
ret->setArray(da);
ret->setName(name);
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::buildOrthogonalField : This method has no sense for MEDCouplingMappedExtrudedMesh that is 3D !");
}
-int MEDCouplingMappedExtrudedMesh::getCellContainingPoint(const double *pos, double eps) const
+mcIdType MEDCouplingMappedExtrudedMesh::getCellContainingPoint(const double *pos, double eps) const
{
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::getCellContainingPoint : not implemented yet !");
}
-void MEDCouplingMappedExtrudedMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const
+void MEDCouplingMappedExtrudedMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const
{
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::getCellsContainingPoint : not implemented yet !");
}
if(mesh3D->getNumberOfCells()%_mesh2D->getNumberOfCells()!=0)
throw INTERP_KERNEL::Exception(errMsg3);
if(_mesh3D_ids.isNull())
- _mesh3D_ids=DataArrayInt::New();
+ _mesh3D_ids=DataArrayIdType::New();
if(_mesh1D.isNull())
_mesh1D=MEDCouplingUMesh::New();
computeExtrusionAlg(mesh3D);
}
-void MEDCouplingMappedExtrudedMesh::build1DExtrusion(int idIn3DDesc, int newId, int nbOf1DLev, MEDCouplingUMesh *subMesh,
- const int *desc3D, const int *descIndx3D,
- const int *revDesc3D, const int *revDescIndx3D,
+void MEDCouplingMappedExtrudedMesh::build1DExtrusion(mcIdType idIn3DDesc, mcIdType newId, mcIdType nbOf1DLev, MEDCouplingUMesh *subMesh,
+ const mcIdType *desc3D, const mcIdType *descIndx3D,
+ const mcIdType *revDesc3D, const mcIdType *revDescIndx3D,
bool computeMesh1D)
{
- int nbOf2DCells(_mesh2D->getNumberOfCells());
- int start(revDescIndx3D[idIn3DDesc]);
- int end(revDescIndx3D[idIn3DDesc+1]);
+ mcIdType nbOf2DCells=_mesh2D->getNumberOfCells();
+ mcIdType start(revDescIndx3D[idIn3DDesc]);
+ mcIdType end(revDescIndx3D[idIn3DDesc+1]);
if(end-start!=1)
{
std::ostringstream ost; ost << "Invalid bases 2D mesh specified : 2D cell # " << idIn3DDesc;
ost << " shared by more than 1 3D cell !!!";
throw INTERP_KERNEL::Exception(ost.str().c_str());
}
- int current3DCell(revDesc3D[start]);
- int current2DCell(idIn3DDesc);
- int *mesh3DIDs(_mesh3D_ids->getPointer());
+ mcIdType current3DCell(revDesc3D[start]);
+ mcIdType current2DCell(idIn3DDesc);
+ mcIdType *mesh3DIDs(_mesh3D_ids->getPointer());
mesh3DIDs[newId]=current3DCell;
- const int *conn2D(subMesh->getNodalConnectivity()->begin());
- const int *conn2DIndx(subMesh->getNodalConnectivityIndex()->begin());
- for(int i=1;i<nbOf1DLev;i++)
+ const mcIdType *conn2D(subMesh->getNodalConnectivity()->begin());
+ const mcIdType *conn2DIndx(subMesh->getNodalConnectivityIndex()->begin());
+ for(mcIdType i=1;i<nbOf1DLev;i++)
{
- std::vector<int> conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]);
+ std::vector<mcIdType> conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]);
std::sort(conn.begin(),conn.end());
if(computeMesh1D)
computeBaryCenterOfFace(conn,i-1);
}
if(computeMesh1D)
{
- std::vector<int> conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]);
+ std::vector<mcIdType> conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]);
std::sort(conn.begin(),conn.end());
computeBaryCenterOfFace(conn,nbOf1DLev-1);
current2DCell=findOppositeFaceOf(current2DCell,current3DCell,conn,
}
}
-int MEDCouplingMappedExtrudedMesh::findOppositeFaceOf(int current2DCell, int current3DCell, const std::vector<int>& connSorted,
- const int *desc3D, const int *descIndx3D,
- const int *conn2D, const int *conn2DIndx)
+mcIdType MEDCouplingMappedExtrudedMesh::findOppositeFaceOf(mcIdType current2DCell, mcIdType current3DCell, const std::vector<mcIdType>& connSorted,
+ const mcIdType *desc3D, const mcIdType *descIndx3D,
+ const mcIdType *conn2D, const mcIdType *conn2DIndx)
{
- int start(descIndx3D[current3DCell]);
- int end(descIndx3D[current3DCell+1]);
+ mcIdType start(descIndx3D[current3DCell]);
+ mcIdType end(descIndx3D[current3DCell+1]);
bool found=false;
- for(const int *candidate2D=desc3D+start;candidate2D!=desc3D+end && !found;candidate2D++)
+ for(const mcIdType *candidate2D=desc3D+start;candidate2D!=desc3D+end && !found;candidate2D++)
{
if(*candidate2D!=current2DCell)
{
- std::vector<int> conn2(conn2D+conn2DIndx[*candidate2D]+1,conn2D+conn2DIndx[*candidate2D+1]);
+ std::vector<mcIdType> conn2(conn2D+conn2DIndx[*candidate2D]+1,conn2D+conn2DIndx[*candidate2D+1]);
std::sort(conn2.begin(),conn2.end());
- std::list<int> intersect;
+ std::list<mcIdType> intersect;
std::set_intersection(connSorted.begin(),connSorted.end(),conn2.begin(),conn2.end(),
- std::insert_iterator< std::list<int> >(intersect,intersect.begin()));
+ std::insert_iterator< std::list<mcIdType> >(intersect,intersect.begin()));
if(intersect.empty())
return *candidate2D;
}
throw INTERP_KERNEL::Exception(ost.str().c_str());
}
-void MEDCouplingMappedExtrudedMesh::computeBaryCenterOfFace(const std::vector<int>& nodalConnec, int lev1DId)
+void MEDCouplingMappedExtrudedMesh::computeBaryCenterOfFace(const std::vector<mcIdType>& nodalConnec, mcIdType lev1DId)
{
double *zoneToUpdate(_mesh1D->getCoords()->getPointer()+lev1DId*3);
std::fill(zoneToUpdate,zoneToUpdate+3,0.);
const double *coords(_mesh2D->getCoords()->begin());
- for(std::vector<int>::const_iterator iter=nodalConnec.begin();iter!=nodalConnec.end();iter++)
+ for(std::vector<mcIdType>::const_iterator iter=nodalConnec.begin();iter!=nodalConnec.end();iter++)
std::transform(zoneToUpdate,zoneToUpdate+3,coords+3*(*iter),zoneToUpdate,std::plus<double>());
- std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind2nd(std::multiplies<double>(),(double)(1./(int)nodalConnec.size())));
+ std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind2nd(std::multiplies<double>(),(1./(double)nodalConnec.size())));
}
-int MEDCouplingMappedExtrudedMesh::FindCorrespCellByNodalConn(const std::vector<int>& nodalConnec, const int *revNodalPtr, const int *revNodalIndxPtr)
+mcIdType MEDCouplingMappedExtrudedMesh::FindCorrespCellByNodalConn(const std::vector<mcIdType>& nodalConnec, const mcIdType *revNodalPtr, const mcIdType *revNodalIndxPtr)
{
- std::vector<int>::const_iterator iter=nodalConnec.begin();
- std::set<int> s1(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]);
+ std::vector<mcIdType>::const_iterator iter=nodalConnec.begin();
+ std::set<mcIdType> s1(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]);
iter++;
for(;iter!=nodalConnec.end();iter++)
{
- std::set<int> s2(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]);
- std::set<int> s3;
- std::set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(),std::insert_iterator< std::set<int> >(s3,s3.end()));
+ std::set<mcIdType> s2(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]);
+ std::set<mcIdType> s3;
+ std::set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(),std::insert_iterator< std::set<mcIdType> >(s3,s3.end()));
s1=s3;
}
if(s1.size()==1)
return *(s1.begin());
std::ostringstream ostr;
ostr << "Cell with nodal connec : ";
- std::copy(nodalConnec.begin(),nodalConnec.end(),std::ostream_iterator<int>(ostr," "));
+ std::copy(nodalConnec.begin(),nodalConnec.end(),std::ostream_iterator<mcIdType>(ostr," "));
ostr << " is not part of mesh";
throw INTERP_KERNEL::Exception(ostr.str().c_str());
}
m2r=m2->clone(true);
m1r->changeSpaceDimension(1);
m2r->changeSpaceDimension(1);
- std::vector<int> c;
+ std::vector<mcIdType> c;
std::vector<double> ref,ref2;
m1->getNodeIdsOfCell(0,c);
m1->getCoordinatesOfNode(c[0],ref);
_mesh1D->scale(point,factor);
}
-std::vector<int> MEDCouplingMappedExtrudedMesh::getDistributionOfTypes() const
+std::vector<mcIdType> MEDCouplingMappedExtrudedMesh::getDistributionOfTypes() const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
-DataArrayInt *MEDCouplingMappedExtrudedMesh::checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
+DataArrayIdType *MEDCouplingMappedExtrudedMesh::checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
-void MEDCouplingMappedExtrudedMesh::splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType, bool smartPflKiller) const
+void MEDCouplingMappedExtrudedMesh::splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
-MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPart(const int *start, const int *end) const
+MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPart(const mcIdType *start, const mcIdType *end) const
{
// not implemented yet !
return 0;
}
-MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const
+MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const
{
// not implemented yet !
return 0;
}
-DataArrayInt *MEDCouplingMappedExtrudedMesh::simplexize(int policy)
+DataArrayIdType *MEDCouplingMappedExtrudedMesh::simplexize(int policy)
{
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::simplexize : unavailable for such a type of mesh : Extruded !");
}
const DataArrayDouble *arr1D(_mesh1D->getCoords());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(getNumberOfNodes(),3);
- int nbOf1DLev(_mesh1D->getNumberOfNodes());
- int nbOf2DNodes(_mesh2D->getNumberOfNodes());
+ mcIdType nbOf1DLev(_mesh1D->getNumberOfNodes());
+ mcIdType nbOf2DNodes(_mesh2D->getNumberOfNodes());
const double *ptSrc(arr2D->begin());
double *pt(ret->getPointer());
std::copy(ptSrc,ptSrc+3*nbOf2DNodes,pt);
- for(int i=1;i<nbOf1DLev;i++)
+ for(mcIdType i=1;i<nbOf1DLev;i++)
{
std::copy(ptSrc,ptSrc+3*nbOf2DNodes,pt+3*i*nbOf2DNodes);
double vec[3];
std::copy(arr1D->begin()+3*i,arr1D->begin()+3*(i+1),vec);
std::transform(arr1D->begin()+3*(i-1),arr1D->begin()+3*i,vec,vec,std::minus<double>());
- for(int j=0;j<nbOf2DNodes;j++)
+ for(mcIdType j=0;j<nbOf2DNodes;j++)
std::transform(vec,vec+3,pt+3*(i*nbOf2DNodes+j),pt+3*(i*nbOf2DNodes+j),std::plus<double>());
}
return ret.retn();
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::computeIsoBarycenterOfNodesPerCell: not yet implemented !");
}
-void MEDCouplingMappedExtrudedMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const
+void MEDCouplingMappedExtrudedMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const
{
MCAuto<MEDCouplingUMesh> m(buildUnstructured());
m->getReverseNodalConnectivity(revNodal,revNodalIndx);
void MEDCouplingMappedExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh *mesh3D)
{
_mesh3D_ids->alloc(mesh3D->getNumberOfCells(),1);
- int nbOf1DLev(mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells());
+ mcIdType nbOf1DLev=mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells();
_mesh1D->setMeshDimension(1);
_mesh1D->allocateCells(nbOf1DLev);
- int tmpConn[2];
- for(int i=0;i<nbOf1DLev;i++)
+ mcIdType tmpConn[2];
+ for(mcIdType i=0;i<nbOf1DLev;i++)
{
tmpConn[0]=i;
tmpConn[1]=i+1;
myCoords->alloc(nbOf1DLev+1,3);
_mesh1D->setCoords(myCoords);
myCoords->decrRef();
- MCAuto<DataArrayInt> desc(DataArrayInt::New()),descIndx(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescIndx(DataArrayInt::New());
+ MCAuto<DataArrayIdType> desc(DataArrayIdType::New()),descIndx(DataArrayIdType::New()),revDesc(DataArrayIdType::New()),revDescIndx(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> subMesh(mesh3D->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx));
- MCAuto<DataArrayInt> revNodal2D(DataArrayInt::New()),revNodalIndx2D(DataArrayInt::New());
+ MCAuto<DataArrayIdType> revNodal2D(DataArrayIdType::New()),revNodalIndx2D(DataArrayIdType::New());
subMesh->getReverseNodalConnectivity(revNodal2D,revNodalIndx2D);
- const int *nodal2D(_mesh2D->getNodalConnectivity()->begin());
- const int *nodal2DIndx(_mesh2D->getNodalConnectivityIndex()->begin());
- const int *revNodal2DPtr(revNodal2D->begin());
- const int *revNodalIndx2DPtr(revNodalIndx2D->begin());
- const int *descP(desc->begin()),*descIndxP(descIndx->begin()),*revDescP(revDesc->begin()),*revDescIndxP(revDescIndx->begin());
+ const mcIdType *nodal2D(_mesh2D->getNodalConnectivity()->begin());
+ const mcIdType *nodal2DIndx(_mesh2D->getNodalConnectivityIndex()->begin());
+ const mcIdType *revNodal2DPtr(revNodal2D->begin());
+ const mcIdType *revNodalIndx2DPtr(revNodalIndx2D->begin());
+ const mcIdType *descP(desc->begin()),*descIndxP(descIndx->begin()),*revDescP(revDesc->begin()),*revDescIndxP(revDescIndx->begin());
//
- int nbOf2DCells(_mesh2D->getNumberOfCells());
- for(int i=0;i<nbOf2DCells;i++)
+ mcIdType nbOf2DCells=_mesh2D->getNumberOfCells();
+ for(mcIdType i=0;i<nbOf2DCells;i++)
{
- int idInSubMesh;
- std::vector<int> nodalConnec(nodal2D+nodal2DIndx[i]+1,nodal2D+nodal2DIndx[i+1]);
+ mcIdType idInSubMesh;
+ std::vector<mcIdType> nodalConnec(nodal2D+nodal2DIndx[i]+1,nodal2D+nodal2DIndx[i+1]);
try
{
idInSubMesh=FindCorrespCellByNodalConn(nodalConnec,revNodal2DPtr,revNodalIndx2DPtr);
}
}
-void MEDCouplingMappedExtrudedMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+void MEDCouplingMappedExtrudedMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
{
- std::vector<int> tinyInfo1;
+ std::vector<mcIdType> tinyInfo1;
std::vector<std::string> ls1;
std::vector<double> ls3;
_mesh2D->getTinySerializationInformation(ls3,tinyInfo1,ls1);
- std::vector<int> tinyInfo2;
+ std::vector<mcIdType> tinyInfo2;
std::vector<std::string> ls2;
std::vector<double> ls4;
_mesh1D->getTinySerializationInformation(ls4,tinyInfo2,ls2);
tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end());
littleStrings.insert(littleStrings.end(),ls2.begin(),ls2.end());
tinyInfo.push_back(_cell_2D_id);
- tinyInfo.push_back((int)tinyInfo1.size());
+ tinyInfo.push_back(ToIdType(tinyInfo1.size()));
tinyInfo.push_back(_mesh3D_ids->getNbOfElems());
littleStrings.push_back(getName());
littleStrings.push_back(getDescription());
}
-void MEDCouplingMappedExtrudedMesh::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
+void MEDCouplingMappedExtrudedMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
std::size_t sz=tinyInfo.size();
- int sz1=tinyInfo[sz-2];
- std::vector<int> ti1(tinyInfo.begin(),tinyInfo.begin()+sz1);
- std::vector<int> ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3);
+ mcIdType sz1=tinyInfo[sz-2];
+ std::vector<mcIdType> ti1(tinyInfo.begin(),tinyInfo.begin()+sz1);
+ std::vector<mcIdType> ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3);
MEDCouplingUMesh *um=MEDCouplingUMesh::New();
- DataArrayInt *a1tmp=DataArrayInt::New();
+ DataArrayIdType *a1tmp=DataArrayIdType::New();
DataArrayDouble *a2tmp=DataArrayDouble::New();
- int la1=0,la2=0;
+ mcIdType la1=0,la2=0;
std::vector<std::string> ls1,ls2;
um->resizeForUnserialization(ti1,a1tmp,a2tmp,ls1);
la1+=a1tmp->getNbOfElems(); la2+=a2tmp->getNbOfElems();
a1tmp->decrRef(); a2tmp->decrRef();
- a1tmp=DataArrayInt::New(); a2tmp=DataArrayDouble::New();
+ a1tmp=DataArrayIdType::New(); a2tmp=DataArrayDouble::New();
um->resizeForUnserialization(ti2,a1tmp,a2tmp,ls2);
la1+=a1tmp->getNbOfElems(); la2+=a2tmp->getNbOfElems();
a1tmp->decrRef(); a2tmp->decrRef();
littleStrings.resize(ls1.size()+ls2.size()+2);
}
-void MEDCouplingMappedExtrudedMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
+void MEDCouplingMappedExtrudedMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const
{
- a1=DataArrayInt::New(); a2=DataArrayDouble::New();
- DataArrayInt *a1_1=0,*a1_2=0;
+ a1=DataArrayIdType::New(); a2=DataArrayDouble::New();
+ DataArrayIdType *a1_1=0,*a1_2=0;
DataArrayDouble *a2_1=0,*a2_2=0;
_mesh2D->serialize(a1_1,a2_1);
_mesh1D->serialize(a1_2,a2_2);
a1->alloc(a1_1->getNbOfElems()+a1_2->getNbOfElems()+_mesh3D_ids->getNbOfElems(),1);
- int *ptri=a1->getPointer();
+ mcIdType *ptri=a1->getPointer();
ptri=std::copy(a1_1->begin(),a1_1->begin()+a1_1->getNbOfElems(),ptri);
a1_1->decrRef();
ptri=std::copy(a1_2->begin(),a1_2->begin()+a1_2->getNbOfElems(),ptri);
a2_2->decrRef();
}
-void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
+void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
{
setName(littleStrings[littleStrings.size()-2]);
setDescription(littleStrings.back());
std::size_t sz=tinyInfo.size();
- int sz1=tinyInfo[sz-2];
+ mcIdType sz1=tinyInfo[sz-2];
_cell_2D_id=tinyInfo[sz-3];
- std::vector<int> ti1(tinyInfo.begin(),tinyInfo.begin()+sz1);
- std::vector<int> ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3);
- DataArrayInt *a1tmp=DataArrayInt::New();
+ std::vector<mcIdType> ti1(tinyInfo.begin(),tinyInfo.begin()+sz1);
+ std::vector<mcIdType> ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3);
+ DataArrayIdType *a1tmp=DataArrayIdType::New();
DataArrayDouble *a2tmp=DataArrayDouble::New();
- const int *a1Ptr=a1->begin();
+ const mcIdType *a1Ptr=a1->begin();
const double *a2Ptr=a2->begin();
_mesh2D=MEDCouplingUMesh::New();
std::vector<std::string> ls1,ls2;
ls2.clear();
ls2.insert(ls2.end(),littleStrings.begin()+ls1.size(),littleStrings.end()-2);
_mesh1D=MEDCouplingUMesh::New();
- a1tmp=DataArrayInt::New(); a2tmp=DataArrayDouble::New();
+ a1tmp=DataArrayIdType::New(); a2tmp=DataArrayDouble::New();
_mesh1D->resizeForUnserialization(ti2,a1tmp,a2tmp,ls1);
std::copy(a2Ptr,a2Ptr+a2tmp->getNbOfElems(),a2tmp->getPointer());
std::copy(a1Ptr,a1Ptr+a1tmp->getNbOfElems(),a1tmp->getPointer());
_mesh1D->unserialization(d1,ti2,a1tmp,a2tmp,ls2);
a1tmp->decrRef(); a2tmp->decrRef();
//
- _mesh3D_ids=DataArrayInt::New();
- int szIds=(int)std::distance(a1Ptr,a1->begin()+a1->getNbOfElems());
+ _mesh3D_ids=DataArrayIdType::New();
+ mcIdType szIds=ToIdType(std::distance(a1Ptr,a1->begin()))+a1->getNbOfElems();
_mesh3D_ids->alloc(szIds,1);
std::copy(a1Ptr,a1Ptr+szIds,_mesh3D_ids->getPointer());
}
namespace MEDCoupling
{
- class DataArrayInt;
+ class DataArrayIdType;
class DataArrayDouble;
class MEDCouplingUMesh;
class MEDCouplingCMesh;
class MEDCouplingMappedExtrudedMesh : public MEDCouplingMesh
{
public:
- MEDCOUPLING_EXPORT static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
+ MEDCOUPLING_EXPORT static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId);
MEDCOUPLING_EXPORT static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D);
MEDCOUPLING_EXPORT static MEDCouplingMappedExtrudedMesh *New();
MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other);
- MEDCOUPLING_EXPORT std::size_t getNumberOfCells() const;
- MEDCOUPLING_EXPORT int getNumberOfNodes() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const;
MEDCOUPLING_EXPORT int getSpaceDimension() const;
MEDCOUPLING_EXPORT int getMeshDimension() const;
MEDCOUPLING_EXPORT MEDCouplingMappedExtrudedMesh *deepCopy() const;
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const;
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const;
MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor) const;
- MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(std::size_t cellId) const;
+ DataArrayIdType *&cellCor) const;
+ MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const;
MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
- MEDCOUPLING_EXPORT DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
- MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const;
- MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const;
- MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const;
- MEDCOUPLING_EXPORT std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
- MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const;
- MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const;
+ MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const;
MEDCOUPLING_EXPORT std::string simpleRepr() const;
MEDCOUPLING_EXPORT std::string advancedRepr() const;
MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const;
MEDCOUPLING_EXPORT void updateTime() const;
- MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true);
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
MEDCOUPLING_EXPORT MEDCouplingUMesh *getMesh2D() const { return _mesh2D.iAmATrollConstCast(); }
MEDCOUPLING_EXPORT MEDCouplingUMesh *getMesh1D() const { return _mesh1D.iAmATrollConstCast(); }
- MEDCOUPLING_EXPORT DataArrayInt *getMesh3DIds() const { return _mesh3D_ids.iAmATrollConstCast(); }
+ MEDCOUPLING_EXPORT DataArrayIdType *getMesh3DIds() const { return _mesh3D_ids.iAmATrollConstCast(); }
MEDCOUPLING_EXPORT MEDCouplingUMesh *build3DUnstructuredMesh() const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
- MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const;
- MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const;
- MEDCOUPLING_EXPORT static int FindCorrespCellByNodalConn(const std::vector<int>& nodalConnec,
- const int *revNodalPtr, const int *revNodalIndxPtr);
+ MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const;
+ MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const;
+ MEDCOUPLING_EXPORT static mcIdType FindCorrespCellByNodalConn(const std::vector<mcIdType>& nodalConnec,
+ const mcIdType *revNodalPtr, const mcIdType *revNodalIndxPtr);
MEDCOUPLING_EXPORT static void Project1DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps,
MEDCouplingUMesh *&m1r, MEDCouplingUMesh *&m2r, double *v);
MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle);
MEDCOUPLING_EXPORT void translate(const double *vector);
MEDCOUPLING_EXPORT void scale(const double *point, double factor);
- MEDCOUPLING_EXPORT std::vector<int> getDistributionOfTypes() const;
- MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const;
- MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType, bool smartPflKiller=true) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const int *start, const int *end) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const;
- MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy);
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getDistributionOfTypes() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller=true) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy);
MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const;
MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
- MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const;
+ MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const;
//Serialization unserialisation
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
- MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
+ MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings);
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
- MEDCOUPLING_EXPORT int get2DCellIdForExtrusion() const { return _cell_2D_id; }
+ MEDCOUPLING_EXPORT mcIdType get2DCellIdForExtrusion() const { return _cell_2D_id; }
private:
- MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
+ MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId);
MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D);
MEDCouplingMappedExtrudedMesh(const MEDCouplingMappedExtrudedMesh& other, bool deepCpy);
MEDCouplingMappedExtrudedMesh();
void computeExtrusion(const MEDCouplingUMesh *mesh3D);
void computeExtrusionAlg(const MEDCouplingUMesh *mesh3D);
- void build1DExtrusion(int idIn3DDesc, int newId, int nbOf1DLev, MEDCouplingUMesh *subMesh,
- const int *desc3D, const int *descIndx3D,
- const int *revDesc3D, const int *revDescIndx3D,
+ void build1DExtrusion(mcIdType idIn3DDesc, mcIdType newId, mcIdType nbOf1DLev, MEDCouplingUMesh *subMesh,
+ const mcIdType *desc3D, const mcIdType *descIndx3D,
+ const mcIdType *revDesc3D, const mcIdType *revDescIndx3D,
bool computeMesh1D);
- int findOppositeFaceOf(int current2DCell, int current3DCell, const std::vector<int>& connSorted,
- const int *desc3D, const int *descIndx3D,
- const int *conn2D, const int *conn2DIndx);
- void computeBaryCenterOfFace(const std::vector<int>& nodalConnec, int lev1DId);
+ mcIdType findOppositeFaceOf(mcIdType current2DCell, mcIdType current3DCell, const std::vector<mcIdType>& connSorted,
+ const mcIdType *desc3D, const mcIdType *descIndx3D,
+ const mcIdType *conn2D, const mcIdType *conn2DIndx);
+ void computeBaryCenterOfFace(const std::vector<mcIdType>& nodalConnec, mcIdType lev1DId);
~MEDCouplingMappedExtrudedMesh();
void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const;
std::string getVTKDataSetType() const;
using namespace MEDCoupling;
-DenseMatrix *DenseMatrix::New(int nbRows, int nbCols)
+DenseMatrix *DenseMatrix::New(mcIdType nbRows, mcIdType nbCols)
{
return new DenseMatrix(nbRows,nbCols);
}
-DenseMatrix *DenseMatrix::New(DataArrayDouble *array, int nbRows, int nbCols)
+DenseMatrix *DenseMatrix::New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols)
{
return new DenseMatrix(array,nbRows,nbCols);
}
*
* \sa reShape
*/
-void DenseMatrix::reBuild(DataArrayDouble *array, int nbRows, int nbCols)
+void DenseMatrix::reBuild(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols)
{
- int nbr(getNumberOfRowsExt(nbRows)),nbc(getNumberOfColsExt(nbCols));
+ mcIdType nbr(getNumberOfRowsExt(nbRows)),nbc(getNumberOfColsExt(nbCols));
CheckArraySizes(array,nbr,nbc);
DataArrayDouble *data(_data);
if(data!=array)
* \throw if the \c nbRows*nbCols is not equal to \c this->getNbOfElems()
* \sa reBuild
*/
-void DenseMatrix::reShape(int nbRows, int nbCols)
+void DenseMatrix::reShape(mcIdType nbRows, mcIdType nbCols)
{
if(nbRows<0 || nbCols<0)
throw INTERP_KERNEL::Exception("DenseMatrix::reShape : number of rows and number of cols must be > 0 both !");
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DenseMatrix::Multiply : input matrices must be not NULL !");
CheckCompatibleSizeForMul(a1,a2);
- int nbr(a1->getNumberOfRows()),nbc(a2->getNumberOfCols());
+ mcIdType nbr(a1->getNumberOfRows()),nbc(a2->getNumberOfCols());
MCAuto<DataArrayDouble> data(DataArrayDouble::New()); data->alloc(nbr*nbc,1);
MCAuto<DenseMatrix> ret(DenseMatrix::New(data,a1->getNumberOfRows(),a2->getNumberOfCols()));
INTERP_KERNEL::matrixProduct(a1->getData()->begin(),a1->getNumberOfRows(),a1->getNumberOfCols(),a2->getData()->begin(),a2->getNumberOfRows(),a2->getNumberOfCols(),data->getPointer());
{
}
-DenseMatrix::DenseMatrix(int nbRows, int nbCols):_nb_rows(nbRows),_nb_cols(nbCols),_data(DataArrayDouble::New())
+DenseMatrix::DenseMatrix(mcIdType nbRows, mcIdType nbCols):_nb_rows(nbRows),_nb_cols(nbCols),_data(DataArrayDouble::New())
{
if(_nb_rows<0 || _nb_cols<0)
throw INTERP_KERNEL::Exception("constructor of DenseMatrix : number of rows and number of cols must be > 0 both !");
- int nbOfTuples(_nb_rows*_nb_cols);
+ mcIdType nbOfTuples(_nb_rows*_nb_cols);
_data->alloc(nbOfTuples,1);
}
-DenseMatrix::DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols):_nb_rows(nbRows),_nb_cols(nbCols)
+DenseMatrix::DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols):_nb_rows(nbRows),_nb_cols(nbCols)
{
CheckArraySizes(array,_nb_rows,_nb_cols);
_data=array; _data->incrRef();
}
-int DenseMatrix::getNumberOfRowsExt(int nbRows) const
+mcIdType DenseMatrix::getNumberOfRowsExt(mcIdType nbRows) const
{
if(nbRows<-1)
throw INTERP_KERNEL::Exception("DenseMatrix::getNumberOfRowsExt : invalid input must be >= -1 !");
return nbRows;
}
-int DenseMatrix::getNumberOfColsExt(int nbCols) const
+mcIdType DenseMatrix::getNumberOfColsExt(mcIdType nbCols) const
{
if(nbCols<-1)
throw INTERP_KERNEL::Exception("DenseMatrix::getNumberOfColsExt : invalid input must be >= -1 !");
throw INTERP_KERNEL::Exception("DenseMatrix::checkValidData : data has not 1 component !");
}
-void DenseMatrix::CheckArraySizes(DataArrayDouble *array, int nbRows, int nbCols)
+void DenseMatrix::CheckArraySizes(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols)
{
if(nbRows<0 || nbCols<0)
throw INTERP_KERNEL::Exception("constructor #2 of DenseMatrix : number of rows and number of cols must be > 0 both !");
throw INTERP_KERNEL::Exception("constructor #2 of DenseMatrix : input array is empty or not allocated !");
if(array->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("constructor #2 of DenseMatrix : input array must have exactly one component !");
- std::size_t nbr((std::size_t)nbRows),nbc((std::size_t)nbCols);
- if(nbr*nbc!=array->getNbOfElems())
+ if(nbRows*nbCols!=array->getNbOfElems())
throw INTERP_KERNEL::Exception("constructor #2 of DenseMatrix : the number of elems in input array is not equal to the product of nbRows and nbCols !");
}
class DenseMatrix : public RefCountObject, public TimeLabel
{
public:
- MEDCOUPLING_EXPORT static DenseMatrix *New(int nbRows, int nbCols);
- MEDCOUPLING_EXPORT static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols);
+ MEDCOUPLING_EXPORT static DenseMatrix *New(mcIdType nbRows, mcIdType nbCols);
+ MEDCOUPLING_EXPORT static DenseMatrix *New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
MEDCOUPLING_EXPORT DenseMatrix *deepCopy() const;
MEDCOUPLING_EXPORT DenseMatrix *shallowCpy() const;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDCOUPLING_EXPORT void updateTime() const;
//
- MEDCOUPLING_EXPORT int getNumberOfRows() const { return _nb_rows; }
- MEDCOUPLING_EXPORT int getNumberOfCols() const { return _nb_cols; }
- MEDCOUPLING_EXPORT int getNbOfElems() const { return _nb_rows*_nb_cols; }
- MEDCOUPLING_EXPORT void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1);
- MEDCOUPLING_EXPORT void reShape(int nbRows, int nbCols);
+ MEDCOUPLING_EXPORT mcIdType getNumberOfRows() const { return _nb_rows; }
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCols() const { return _nb_cols; }
+ MEDCOUPLING_EXPORT mcIdType getNbOfElems() const { return _nb_rows*_nb_cols; }
+ MEDCOUPLING_EXPORT void reBuild(DataArrayDouble *array, mcIdType nbRows=-1, mcIdType nbCols=-1);
+ MEDCOUPLING_EXPORT void reShape(mcIdType nbRows, mcIdType nbCols);
MEDCOUPLING_EXPORT void transpose();
//
MEDCOUPLING_EXPORT bool isEqual(const DenseMatrix& other, double eps) const;
MEDCOUPLING_EXPORT DataArrayDouble *getData() { return _data; }
private:
~DenseMatrix();
- DenseMatrix(int nbRows, int nbCols);
- DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols);
- int getNumberOfRowsExt(int nbRows) const;
- int getNumberOfColsExt(int nbCols) const;
+ DenseMatrix(mcIdType nbRows, mcIdType nbCols);
+ DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
+ mcIdType getNumberOfRowsExt(mcIdType nbRows) const;
+ mcIdType getNumberOfColsExt(mcIdType nbCols) const;
void checkValidData() const;
- static void CheckArraySizes(DataArrayDouble *array, int nbRows, int nbCols);
+ static void CheckArraySizes(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
static void CheckSameSize(const DenseMatrix *a1, const DenseMatrix *a2);
static void CheckCompatibleSizeForMul(const DenseMatrix *a1, const DenseMatrix *a2);
private:
- int _nb_rows;
- int _nb_cols;
+ mcIdType _nb_rows;
+ mcIdType _nb_cols;
MCAuto<DataArrayDouble> _data;
};
}
using namespace MEDCoupling;
-template class MEDCoupling::MemArray<int>;
+template class MEDCoupling::MemArray<mcIdType>;
template class MEDCoupling::MemArray<double>;
-template class MEDCoupling::DataArrayTemplate<int>;
+template class MEDCoupling::DataArrayTemplate<mcIdType>;
template class MEDCoupling::DataArrayTemplate<double>;
-template class MEDCoupling::DataArrayTemplateClassic<int>;
+template class MEDCoupling::DataArrayTemplateClassic<mcIdType>;
template class MEDCoupling::DataArrayTemplateClassic<double>;
template class MEDCoupling::DataArrayTemplateFP<double>;
template class MEDCoupling::DataArrayIterator<double>;
-template class MEDCoupling::DataArrayIterator<int>;
+template class MEDCoupling::DataArrayIterator<mcIdType>;
template class MEDCoupling::DataArrayDiscrete<Int32>;
template class MEDCoupling::DataArrayDiscreteSigned<Int32>;
template class MEDCoupling::DataArrayDiscrete<Int64>;
template class MEDCoupling::DataArrayDiscreteSigned<Int64>;
-template class MEDCoupling::DataArrayTuple<int>;
+template class MEDCoupling::DataArrayTuple<mcIdType>;
template class MEDCoupling::DataArrayTuple<double>;
template class MEDCoupling::DataArrayTuple<float>;
-template<int SPACEDIM>
-void DataArrayDouble::findCommonTuplesAlg(const double *bbox, int nbNodes, int limitNodeId, double prec, DataArrayInt *c, DataArrayInt *cI) const
+template<mcIdType SPACEDIM>
+void DataArrayDouble::findCommonTuplesAlg(const double *bbox, mcIdType nbNodes, mcIdType limitNodeId, double prec, DataArrayIdType *c, DataArrayIdType *cI) const
{
const double *coordsPtr=getConstPointer();
- BBTreePts<SPACEDIM,int> myTree(bbox,0,0,nbNodes,prec);
+ BBTreePts<SPACEDIM,mcIdType> myTree(bbox,0,0,nbNodes,prec);
std::vector<bool> isDone(nbNodes);
- for(int i=0;i<nbNodes;i++)
+ for(mcIdType i=0;i<nbNodes;i++)
{
if(!isDone[i])
{
- std::vector<int> intersectingElems;
+ std::vector<mcIdType> intersectingElems;
myTree.getElementsAroundPoint(coordsPtr+i*SPACEDIM,intersectingElems);
if(intersectingElems.size()>1)
{
- std::vector<int> commonNodes;
- for(std::vector<int>::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++)
+ std::vector<mcIdType> commonNodes;
+ for(std::vector<mcIdType>::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++)
if(*it!=i)
if(*it>=limitNodeId)
{
}
if(!commonNodes.empty())
{
- cI->pushBackSilent(cI->back()+(int)commonNodes.size()+1);
+ cI->pushBackSilent(cI->back()+ToIdType(commonNodes.size())+1);
c->pushBackSilent(i);
c->insertAtTheEnd(commonNodes.begin(),commonNodes.end());
}
}
}
-template<int SPACEDIM>
-void DataArrayDouble::FindTupleIdsNearTuplesAlg(const BBTreePts<SPACEDIM,int>& myTree, const double *pos, int nbOfTuples, double eps,
- DataArrayInt *c, DataArrayInt *cI)
+template<mcIdType SPACEDIM>
+void DataArrayDouble::FindTupleIdsNearTuplesAlg(const BBTreePts<SPACEDIM,mcIdType>& myTree, const double *pos, mcIdType nbOfTuples, double eps,
+ DataArrayIdType *c, DataArrayIdType *cI)
{
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
- std::vector<int> intersectingElems;
+ std::vector<mcIdType> intersectingElems;
myTree.getElementsAroundPoint(pos+i*SPACEDIM,intersectingElems);
- std::vector<int> commonNodes;
- for(std::vector<int>::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++)
+ std::vector<mcIdType> commonNodes;
+ for(std::vector<mcIdType>::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++)
commonNodes.push_back(*it);
- cI->pushBackSilent(cI->back()+(int)commonNodes.size());
+ cI->pushBackSilent(cI->back()+ToIdType(commonNodes.size()));
c->insertAtTheEnd(commonNodes.begin(),commonNodes.end());
}
}
-template<int SPACEDIM>
-void DataArrayDouble::FindClosestTupleIdAlg(const BBTreePts<SPACEDIM,int>& myTree, double dist, const double *pos, int nbOfTuples, const double *thisPt, int thisNbOfTuples, int *res)
+template<mcIdType SPACEDIM>
+void DataArrayDouble::FindClosestTupleIdAlg(const BBTreePts<SPACEDIM,mcIdType>& myTree, double dist, const double *pos, mcIdType nbOfTuples, const double *thisPt, mcIdType thisNbOfTuples, mcIdType *res)
{
double distOpt(dist);
const double *p(pos);
- int *r(res);
- for(int i=0;i<nbOfTuples;i++,p+=SPACEDIM,r++)
+ mcIdType *r(res);
+ for(mcIdType i=0;i<nbOfTuples;i++,p+=SPACEDIM,r++)
{
while(true)
{
- int elem=-1;
+ mcIdType elem=-1;
double ret=myTree.getElementsAroundPoint2(p,distOpt,elem);
if(ret!=std::numeric_limits<double>::max())
{
}
}
-int DataArray::EffectiveCircPerm(int nbOfShift, int nbOfTuples)
+mcIdType DataArray::EffectiveCircPerm(mcIdType nbOfShift, mcIdType nbOfTuples)
{
if(nbOfTuples<=0)
throw INTERP_KERNEL::Exception("DataArray::EffectiveCircPerm : number of tuples is expected to be > 0 !");
}
else
{
- int tmp(-nbOfShift);
+ mcIdType tmp(-nbOfShift);
tmp=tmp%nbOfTuples;
return nbOfTuples-tmp;
}
_info_on_compo=other._info_on_compo;
}
-void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds)
+void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vector<std::size_t>& compoIds)
{
- int nbOfCompoOth=other.getNumberOfComponents();
+ std::size_t nbOfCompoOth=other.getNumberOfComponents();
std::size_t newNbOfCompo=compoIds.size();
for(std::size_t i=0;i<newNbOfCompo;i++)
if(compoIds[i]>=nbOfCompoOth || compoIds[i]<0)
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
for(std::size_t i=0;i<newNbOfCompo;i++)
- setInfoOnComponent((int)i,other.getInfoOnComponent(compoIds[i]));
+ setInfoOnComponent(i,other.getInfoOnComponent(compoIds[i]));
}
-void DataArray::copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other)
+void DataArray::copyPartOfStringInfoFrom2(const std::vector<std::size_t>& compoIds, const DataArray& other)
{
- std::size_t nbOfCompo(getNumberOfComponents());
- std::size_t partOfCompoToSet=compoIds.size();
- if(partOfCompoToSet!=other.getNumberOfComponents())
+ if(compoIds.size()!=other.getNumberOfComponents())
throw INTERP_KERNEL::Exception("Given compoIds has not the same size as number of components of given array !");
+ std::size_t partOfCompoToSet=compoIds.size();
+ std::size_t nbOfCompo=getNumberOfComponents();
for(std::size_t i=0;i<partOfCompoToSet;i++)
- if(compoIds[i]>=(int)nbOfCompo || compoIds[i]<0)
+ if(compoIds[i]>=nbOfCompo || compoIds[i]<0)
{
std::ostringstream oss; oss << "Specified component id is out of range (" << compoIds[i] << ") compared with nb of actual components (" << nbOfCompo << ")";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
for(std::size_t i=0;i<partOfCompoToSet;i++)
- setInfoOnComponent(compoIds[i],other.getInfoOnComponent((int)i));
+ setInfoOnComponent(compoIds[i],other.getInfoOnComponent(i));
}
bool DataArray::areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const
*
* \sa DataArrayDouble::setPartOfValues3, DataArrayInt::setPartOfValues3, DataArrayChar::setPartOfValues3.
*/
-void DataArray::setPartOfValuesBase3(const DataArray *aBase, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare)
+void DataArray::setPartOfValuesBase3(const DataArray *aBase, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare)
{
if(!aBase)
throw INTERP_KERNEL::Exception("DataArray::setPartOfValuesBase3 : input aBase object is NULL !");
DataArrayDouble *this1(dynamic_cast<DataArrayDouble *>(this));
- DataArrayInt *this2(dynamic_cast<DataArrayInt *>(this));
+ DataArrayIdType *this2(dynamic_cast<DataArrayIdType *>(this));
DataArrayChar *this3(dynamic_cast<DataArrayChar *>(this));
const DataArrayDouble *a1(dynamic_cast<const DataArrayDouble *>(aBase));
- const DataArrayInt *a2(dynamic_cast<const DataArrayInt *>(aBase));
+ const DataArrayIdType *a2(dynamic_cast<const DataArrayIdType *>(aBase));
const DataArrayChar *a3(dynamic_cast<const DataArrayChar *>(aBase));
if(this1 && a1)
{
std::vector<std::string> DataArray::getVarsOnComponent() const
{
- int nbOfCompo=(int)_info_on_compo.size();
+ std::size_t nbOfCompo=_info_on_compo.size();
std::vector<std::string> ret(nbOfCompo);
- for(int i=0;i<nbOfCompo;i++)
+ for(std::size_t i=0;i<nbOfCompo;i++)
ret[i]=getVarOnComponent(i);
return ret;
}
std::vector<std::string> DataArray::getUnitsOnComponent() const
{
- int nbOfCompo=(int)_info_on_compo.size();
+ std::size_t nbOfCompo=_info_on_compo.size();
std::vector<std::string> ret(nbOfCompo);
- for(int i=0;i<nbOfCompo;i++)
+ for(std::size_t i=0;i<nbOfCompo;i++)
ret[i]=getUnitOnComponent(i);
return ret;
}
* \return std::string - a string containing the information on \a i-th component.
* \throw If \a i is not a valid component index.
*/
-std::string DataArray::getInfoOnComponent(int i) const
+std::string DataArray::getInfoOnComponent(std::size_t i) const
{
- if(i<(int)_info_on_compo.size() && i>=0)
+ if(i<_info_on_compo.size())
return _info_on_compo[i];
else
{
- std::ostringstream oss; oss << "DataArray::getInfoOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << (int) _info_on_compo.size();
+ std::ostringstream oss; oss << "DataArray::getInfoOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << _info_on_compo.size();
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
* \return std::string - a string containing the var information, or the full info.
* \throw If \a i is not a valid component index.
*/
-std::string DataArray::getVarOnComponent(int i) const
+std::string DataArray::getVarOnComponent(std::size_t i) const
{
- if(i<(int)_info_on_compo.size() && i>=0)
+ if(i<_info_on_compo.size())
{
return GetVarNameFromInfo(_info_on_compo[i]);
}
else
{
- std::ostringstream oss; oss << "DataArray::getVarOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << (int) _info_on_compo.size();
+ std::ostringstream oss; oss << "DataArray::getVarOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << _info_on_compo.size();
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
* \return std::string - a string containing the unit information, if any, or "".
* \throw If \a i is not a valid component index.
*/
-std::string DataArray::getUnitOnComponent(int i) const
+std::string DataArray::getUnitOnComponent(std::size_t i) const
{
- if(i<(int)_info_on_compo.size() && i>=0)
+ if(i<_info_on_compo.size())
{
return GetUnitFromInfo(_info_on_compo[i]);
}
else
{
- std::ostringstream oss; oss << "DataArray::getUnitOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << (int) _info_on_compo.size();
+ std::ostringstream oss; oss << "DataArray::getUnitOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << _info_on_compo.size();
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
if(arr2.empty())
throw INTERP_KERNEL::Exception("DataArray::Aggregate : only null instance in input vector !");
std::vector<const DataArrayDouble *> arrd;
- std::vector<const DataArrayInt *> arri;
+ std::vector<const DataArrayIdType *> arri;
std::vector<const DataArrayChar *> arrc;
for(std::vector<const DataArray *>::const_iterator it=arr2.begin();it!=arr2.end();it++)
{
const DataArrayDouble *a=dynamic_cast<const DataArrayDouble *>(*it);
if(a)
{ arrd.push_back(a); continue; }
- const DataArrayInt *b=dynamic_cast<const DataArrayInt *>(*it);
+ const DataArrayIdType *b=dynamic_cast<const DataArrayIdType *>(*it);
if(b)
{ arri.push_back(b); continue; }
const DataArrayChar *c=dynamic_cast<const DataArrayChar *>(*it);
if(arr2.size()==arrd.size())
return DataArrayDouble::Aggregate(arrd);
if(arr2.size()==arri.size())
- return DataArrayInt::Aggregate(arri);
+ return DataArrayIdType::Aggregate(arri);
if(arr2.size()==arrc.size())
return DataArrayChar::Aggregate(arrc);
throw INTERP_KERNEL::Exception("DataArray::Aggregate : all input arrays must have the same type !");
* \param [in] info - the string containing the information.
* \throw If \a i is not a valid component index.
*/
-void DataArray::setInfoOnComponent(int i, const std::string& info)
+void DataArray::setInfoOnComponent(std::size_t i, const std::string& info)
{
- if(i<(int)_info_on_compo.size() && i>=0)
+ if(i<_info_on_compo.size())
_info_on_compo[i]=info;
else
{
- std::ostringstream oss; oss << "DataArray::setInfoOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << (int) _info_on_compo.size();
+ std::ostringstream oss; oss << "DataArray::setInfoOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << _info_on_compo.size();
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
_info_on_compo=info;
}
-void DataArray::checkNbOfTuples(int nbOfTuples, const std::string& msg) const
+void DataArray::checkNbOfTuples(mcIdType nbOfTuples, const std::string& msg) const
{
- if((int)getNumberOfTuples()!=nbOfTuples)
+ if(getNumberOfTuples()!=nbOfTuples)
{
std::ostringstream oss; oss << msg << " : mismatch number of tuples : expected " << nbOfTuples << " having " << getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
-void DataArray::checkNbOfComps(int nbOfCompo, const std::string& msg) const
+void DataArray::checkNbOfComps(std::size_t nbOfCompo, const std::string& msg) const
{
- if((int)getNumberOfComponents()!=nbOfCompo)
+ if (getNumberOfComponents()!=nbOfCompo)
{
std::ostringstream oss; oss << msg << " : mismatch number of components : expected " << nbOfCompo << " having " << getNumberOfComponents() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
-void DataArray::checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const
+void DataArray::checkNbOfElems(mcIdType nbOfElems, const std::string& msg) const
{
if(getNbOfElems()!=nbOfElems)
{
}
}
-void DataArray::checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const
+void DataArray::checkNbOfTuplesAndComp(mcIdType nbOfTuples, std::size_t nbOfCompo, const std::string& msg) const
{
checkNbOfTuples(nbOfTuples,msg);
checkNbOfComps(nbOfCompo,msg);
/*!
* Simply this method checks that \b value is in [0,\b ref).
*/
-void DataArray::CheckValueInRange(int ref, int value, const std::string& msg)
+void DataArray::CheckValueInRange(mcIdType ref, mcIdType value, const std::string& msg)
{
if(value<0 || value>=ref)
{
* This method checks that [\b start, \b end) is compliant with ref length \b value.
* typically start in [0,\b value) and end in [0,\b value). If value==start and start==end, it is supported.
*/
-void DataArray::CheckValueInRangeEx(int value, int start, int end, const std::string& msg)
+void DataArray::CheckValueInRangeEx(mcIdType value, mcIdType start, mcIdType end, const std::string& msg)
{
if(start<0 || start>=value)
{
}
}
-void DataArray::CheckClosingParInRange(int ref, int value, const std::string& msg)
+void DataArray::CheckClosingParInRange(mcIdType ref, mcIdType value, const std::string& msg)
{
if(value<0 || value>ref)
{
* \throw If \a nbOfSlices not > 0
* \throw If \a sliceId not in [0,nbOfSlices)
*/
-void DataArray::GetSlice(int start, int stop, int step, int sliceId, int nbOfSlices, int& startSlice, int& stopSlice)
+void DataArray::GetSlice(mcIdType start, mcIdType stop, mcIdType step, mcIdType sliceId, mcIdType nbOfSlices, mcIdType& startSlice, mcIdType& stopSlice)
{
- if(nbOfSlices<=0)
- {
- std::ostringstream oss; oss << "DataArray::GetSlice : nbOfSlices (" << nbOfSlices << ") must be > 0 !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- if(sliceId<0 || sliceId>=nbOfSlices)
- {
- std::ostringstream oss; oss << "DataArray::GetSlice : sliceId (" << nbOfSlices << ") must be in [0 , nbOfSlices (" << nbOfSlices << ") ) !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- int nbElems=GetNumberOfItemGivenBESRelative(start,stop,step,"DataArray::GetSlice");
- int minNbOfElemsPerSlice=nbElems/nbOfSlices;
- startSlice=start+minNbOfElemsPerSlice*step*sliceId;
- if(sliceId<nbOfSlices-1)
- stopSlice=start+minNbOfElemsPerSlice*step*(sliceId+1);
- else
- stopSlice=stop;
+ DataArrayTools<mcIdType>::GetSlice(start, stop, step, sliceId, nbOfSlices, startSlice, stopSlice);
}
-int DataArray::GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg)
+mcIdType DataArray::GetNumberOfItemGivenBES(mcIdType begin, mcIdType end, mcIdType step, const std::string& msg)
{
- if(end<begin)
- {
- std::ostringstream oss; oss << msg << " : end before begin !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- if(end==begin)
- return 0;
- if(step<=0)
- {
- std::ostringstream oss; oss << msg << " : invalid step should be > 0 !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- return (end-1-begin)/step+1;
+ return DataArrayTools<mcIdType>::GetNumberOfItemGivenBES(begin, end, step, msg);
}
-int DataArray::GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg)
+mcIdType DataArray::GetNumberOfItemGivenBESRelative(mcIdType begin, mcIdType end, mcIdType step, const std::string& msg)
{
- if(step==0)
- throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES : step=0 is not allowed !");
- if(end<begin && step>0)
- {
- std::ostringstream oss; oss << msg << " : end before begin whereas step is positive !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- if(begin<end && step<0)
- {
- std::ostringstream oss; oss << msg << " : invalid step should be > 0 !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- if(begin!=end)
- return (std::max(begin,end)-1-std::min(begin,end))/std::abs(step)+1;
- else
- return 0;
+ return DataArrayTools<mcIdType>::GetNumberOfItemGivenBESRelative(begin, end, step, msg);
}
-int DataArray::GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step)
+mcIdType DataArray::GetPosOfItemGivenBESRelativeNoThrow(mcIdType value, mcIdType begin, mcIdType end, mcIdType step)
{
- if(step!=0)
- {
- if(step>0)
- {
- if(begin<=value && value<end)
- {
- if((value-begin)%step==0)
- return (value-begin)/step;
- else
- return -1;
- }
- else
- return -1;
- }
- else
- {
- if(begin>=value && value>end)
- {
- if((begin-value)%(-step)==0)
- return (begin-value)/(-step);
- else
- return -1;
- }
- else
- return -1;
- }
- }
- else
- return -1;
+ return DataArrayTools<mcIdType>::GetPosOfItemGivenBESRelativeNoThrow(value, begin, end, step);
}
/*!
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::isMonotonic : only supported with 'this' array with ONE component !");
- int nbOfElements=getNumberOfTuples();
+ mcIdType nbOfElements(getNumberOfTuples());
const double *ptr=getConstPointer();
if(nbOfElements==0)
return true;
double absEps=fabs(eps);
if(increasing)
{
- for(int i=1;i<nbOfElements;i++)
+ for(mcIdType i=1;i<nbOfElements;i++)
{
if(ptr[i]<(ref+absEps))
return false;
}
else
{
- for(int i=1;i<nbOfElements;i++)
+ for(mcIdType i=1;i<nbOfElements;i++)
{
if(ptr[i]>(ref-absEps))
return false;
}
}
-void DataArrayDouble::writeVTK(std::ostream& ofs, int indent, const std::string& nameInFile, DataArrayByte *byteArr) const
+void DataArrayDouble::writeVTK(std::ostream& ofs, mcIdType indent, const std::string& nameInFile, DataArrayByte *byteArr) const
{
static const char SPACE[4]={' ',' ',' ',' '};
checkAllocated();
void DataArrayDouble::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- int nbTuples(getNumberOfTuples()),nbComp(getNumberOfComponents());
+ mcIdType nbTuples=getNumberOfTuples();
+ std::size_t nbComp=getNumberOfComponents();
const double *data(getConstPointer());
stream.precision(17);
stream << "DataArrayDouble *" << varName << "=DataArrayDouble::New();" << std::endl;
std::size_t nbOfCompo(_info_on_compo.size());
if(nbOfCompo>=1)
{
- std::size_t nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples(getNumberOfTuples());
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayDouble::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const double *data=begin();
- int nbOfTuples=getNumberOfTuples();
- int nbOfCompo=(int)_info_on_compo.size();
+ mcIdType nbOfTuples(getNumberOfTuples());
+ std::size_t nbOfCompo(_info_on_compo.size());
std::ostringstream oss2; oss2 << "[";
oss2.precision(17);
std::string oss2Str(oss2.str());
bool isFinished=true;
- for(int i=0;i<nbOfTuples && isFinished;i++)
+ for(mcIdType i=0;i<nbOfTuples && isFinished;i++)
{
if(nbOfCompo>1)
{
oss2 << "(";
- for(int j=0;j<nbOfCompo;j++,data++)
+ for(std::size_t j=0;j<nbOfCompo;j++,data++)
{
oss2 << *data;
if(j!=nbOfCompo-1) oss2 << ", ";
* \param [out] tupleIds - the tuple ids containing the same number of tuples than \a other has.
* \sa DataArrayDouble::findCommonTuples
*/
-bool DataArrayDouble::areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayInt *&tupleIds) const
+bool DataArrayDouble::areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayIdType *&tupleIds) const
{
if(!other)
throw INTERP_KERNEL::Exception("DataArrayDouble::areIncludedInMe : input array is NULL !");
if(getNumberOfComponents()!=other->getNumberOfComponents())
throw INTERP_KERNEL::Exception("DataArrayDouble::areIncludedInMe : the number of components does not match !");
MCAuto<DataArrayDouble> a=DataArrayDouble::Aggregate(this,other);
- DataArrayInt *c=0,*ci=0;
+ DataArrayIdType *c=0,*ci=0;
a->findCommonTuples(prec,getNumberOfTuples(),c,ci);
- MCAuto<DataArrayInt> cSafe(c),ciSafe(ci);
- int newNbOfTuples=-1;
- MCAuto<DataArrayInt> ids=DataArrayInt::ConvertIndexArrayToO2N(a->getNumberOfTuples(),c->begin(),ci->begin(),ci->end(),newNbOfTuples);
- MCAuto<DataArrayInt> ret1=ids->selectByTupleIdSafeSlice(getNumberOfTuples(),a->getNumberOfTuples(),1);
+ MCAuto<DataArrayIdType> cSafe(c),ciSafe(ci);
+ mcIdType newNbOfTuples=-1;
+ MCAuto<DataArrayIdType> ids=DataArrayIdType::ConvertIndexArrayToO2N(a->getNumberOfTuples(),c->begin(),ci->begin(),ci->end(),newNbOfTuples);
+ MCAuto<DataArrayIdType> ret1=ids->selectByTupleIdSafeSlice(getNumberOfTuples(),a->getNumberOfTuples(),1);
tupleIds=ret1.retn();
return newNbOfTuples==getNumberOfTuples();
}
* \endif
* \sa DataArrayInt::ConvertIndexArrayToO2N(), DataArrayDouble::areIncludedInMe
*/
-void DataArrayDouble::findCommonTuples(double prec, int limitTupleId, DataArrayInt *&comm, DataArrayInt *&commIndex) const
+void DataArrayDouble::findCommonTuples(double prec, mcIdType limitTupleId, DataArrayIdType *&comm, DataArrayIdType *&commIndex) const
{
checkAllocated();
- int nbOfCompo=getNumberOfComponents();
+ std::size_t nbOfCompo=getNumberOfComponents();
if ((nbOfCompo<1) || (nbOfCompo>4)) //test before work
throw INTERP_KERNEL::Exception("DataArrayDouble::findCommonTuples : Unexpected spacedim of coords. Must be 1, 2, 3 or 4.");
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples(getNumberOfTuples());
//
- MCAuto<DataArrayInt> c(DataArrayInt::New()),cI(DataArrayInt::New()); c->alloc(0,1); cI->pushBackSilent(0);
+ MCAuto<DataArrayIdType> c(DataArrayIdType::New()),cI(DataArrayIdType::New()); c->alloc(0,1); cI->pushBackSilent(0);
switch(nbOfCompo)
{
case 4:
* \return the minimal distance between the two set of points \a this and \a other.
* \sa DataArrayDouble::findClosestTupleId
*/
-double DataArrayDouble::minimalDistanceTo(const DataArrayDouble *other, int& thisTupleId, int& otherTupleId) const
+double DataArrayDouble::minimalDistanceTo(const DataArrayDouble *other, mcIdType& thisTupleId, mcIdType& otherTupleId) const
{
- MCAuto<DataArrayInt> part1=findClosestTupleId(other);
- int nbOfCompo(getNumberOfComponents());
- int otherNbTuples(other->getNumberOfTuples());
+ MCAuto<DataArrayIdType> part1=findClosestTupleId(other);
+ std::size_t nbOfCompo=getNumberOfComponents();
+ mcIdType otherNbTuples=other->getNumberOfTuples();
const double *thisPt(begin()),*otherPt(other->begin());
- const int *part1Pt(part1->begin());
+ const mcIdType *part1Pt(part1->begin());
double ret=std::numeric_limits<double>::max();
- for(int i=0;i<otherNbTuples;i++,part1Pt++,otherPt+=nbOfCompo)
+ for(mcIdType i=0;i<otherNbTuples;i++,part1Pt++,otherPt+=nbOfCompo)
{
double tmp(0.);
- for(int j=0;j<nbOfCompo;j++)
+ for(std::size_t j=0;j<nbOfCompo;j++)
tmp+=(otherPt[j]-thisPt[nbOfCompo*(*part1Pt)+j])*(otherPt[j]-thisPt[nbOfCompo*(*part1Pt)+j]);
if(tmp<ret)
{ ret=tmp; thisTupleId=*part1Pt; otherTupleId=i; }
* \return a newly allocated (new object to be dealt by the caller) DataArrayInt having \c other->getNumberOfTuples() tuples and one components.
* \sa DataArrayDouble::minimalDistanceTo
*/
-DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) const
+DataArrayIdType *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) const
{
if(!other)
throw INTERP_KERNEL::Exception("DataArrayDouble::findClosestTupleId : other instance is NULL !");
oss << ", whereas number of components in other is " << other->getNumberOfComponents() << "! Should be equal !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbOfTuples=other->getNumberOfTuples();
- int thisNbOfTuples=getNumberOfTuples();
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1);
+ mcIdType nbOfTuples(other->getNumberOfTuples());
+ mcIdType thisNbOfTuples(getNumberOfTuples());
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(nbOfTuples,1);
double bounds[6];
getMinMaxPerComponent(bounds);
switch(nbOfCompo)
double xDelta(fabs(bounds[1]-bounds[0])),yDelta(fabs(bounds[3]-bounds[2])),zDelta(fabs(bounds[5]-bounds[4]));
double delta=std::max(xDelta,yDelta); delta=std::max(delta,zDelta);
double characSize=pow((delta*delta*delta)/((double)thisNbOfTuples),1./3.);
- BBTreePts<3,int> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12);
+ BBTreePts<3,mcIdType> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12);
FindClosestTupleIdAlg<3>(myTree,3.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer());
break;
}
double xDelta(fabs(bounds[1]-bounds[0])),yDelta(fabs(bounds[3]-bounds[2]));
double delta=std::max(xDelta,yDelta);
double characSize=sqrt(delta/(double)thisNbOfTuples);
- BBTreePts<2,int> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12);
+ BBTreePts<2,mcIdType> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12);
FindClosestTupleIdAlg<2>(myTree,2.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer());
break;
}
case 1:
{
- double characSize=fabs(bounds[1]-bounds[0])/thisNbOfTuples;
- BBTreePts<1,int> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12);
+ double characSize=fabs(bounds[1]-bounds[0])/FromIdType<double>(thisNbOfTuples);
+ BBTreePts<1,mcIdType> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12);
FindClosestTupleIdAlg<1>(myTree,1.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer());
break;
}
* \throw If \a this and \a otherBBoxFrmt have not the same number of components.
* \throw If \a this and \a otherBBoxFrmt number of components is not even (BBox format).
*/
-DataArrayInt *DataArrayDouble::computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const
+DataArrayIdType *DataArrayDouble::computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const
{
if(!otherBBoxFrmt)
throw INTERP_KERNEL::Exception("DataArrayDouble::computeNbOfInteractionsWith : input array is NULL !");
if(!isAllocated() || !otherBBoxFrmt->isAllocated())
throw INTERP_KERNEL::Exception("DataArrayDouble::computeNbOfInteractionsWith : this and input array must be allocated !");
- std::size_t nbOfComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
+ mcIdType nbOfTuples(getNumberOfTuples());
if(nbOfComp!=otherBBoxFrmt->getNumberOfComponents())
{
std::ostringstream oss; oss << "DataArrayDouble::computeNbOfInteractionsWith : this number of components (" << nbOfComp << ") must be equal to the number of components of input array (" << otherBBoxFrmt->getNumberOfComponents() << ") !";
std::ostringstream oss; oss << "DataArrayDouble::computeNbOfInteractionsWith : Number of components (" << nbOfComp << ") is not even ! It should be to be compatible with bbox format !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfTuples,1);
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(nbOfTuples,1);
const double *thisBBPtr(begin());
- int *retPtr(ret->getPointer());
+ mcIdType *retPtr(ret->getPointer());
switch(nbOfComp/2)
{
case 3:
{
- BBTree<3,int> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
- for(std::size_t i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
+ BBTree<3,mcIdType> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
+ for(mcIdType i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
*retPtr=bbt.getNbOfIntersectingElems(thisBBPtr);
break;
}
case 2:
{
- BBTree<2,int> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
- for(std::size_t i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
+ BBTree<2,mcIdType> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
+ for(mcIdType i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
*retPtr=bbt.getNbOfIntersectingElems(thisBBPtr);
break;
}
case 1:
{
- BBTree<1,int> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
- for(std::size_t i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
+ BBTree<1,mcIdType> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
+ for(mcIdType i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
*retPtr=bbt.getNbOfIntersectingElems(thisBBPtr);
break;
}
* \ref py_mcdataarraydouble_getdifferentvalues "Here is a Python example".
* \endif
*/
-DataArrayDouble *DataArrayDouble::getDifferentValues(double prec, int limitTupleId) const
+DataArrayDouble *DataArrayDouble::getDifferentValues(double prec, mcIdType limitTupleId) const
{
checkAllocated();
- DataArrayInt *c0=0,*cI0=0;
+ DataArrayIdType *c0=0,*cI0=0;
findCommonTuples(prec,limitTupleId,c0,cI0);
- MCAuto<DataArrayInt> c(c0),cI(cI0);
- int newNbOfTuples=-1;
- MCAuto<DataArrayInt> o2n=DataArrayInt::ConvertIndexArrayToO2N(getNumberOfTuples(),c0->begin(),cI0->begin(),cI0->end(),newNbOfTuples);
+ MCAuto<DataArrayIdType> c(c0),cI(cI0);
+ mcIdType newNbOfTuples=-1;
+ MCAuto<DataArrayIdType> o2n=DataArrayIdType::ConvertIndexArrayToO2N(getNumberOfTuples(),c0->begin(),cI0->begin(),cI0->end(),newNbOfTuples);
return renumberAndReduce(o2n->getConstPointer(),newNbOfTuples);
}
* \ref py_mcdataarraydouble_setselectedcomponents "Here is a Python example".
* \endif
*/
-void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std::vector<int>& compoIds)
+void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std::vector<std::size_t>& compoIds)
{
if(!a)
throw INTERP_KERNEL::Exception("DataArrayDouble::setSelectedComponents : input DataArrayDouble is NULL !");
checkAllocated();
copyPartOfStringInfoFrom2(compoIds,*a);
std::size_t partOfCompoSz=compoIds.size();
- int nbOfCompo=getNumberOfComponents();
- int nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples());
+ std::size_t nbOfCompo=getNumberOfComponents();
+ mcIdType nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples());
const double *ac=a->getConstPointer();
double *nc=getPointer();
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
for(std::size_t j=0;j<partOfCompoSz;j++,ac++)
nc[nbOfCompo*i+compoIds[j]]=*ac;
}
-
/*!
* Checks if 0.0 value is present in \a this array. If it is the case, an exception
* is thrown.
void DataArrayDouble::checkNoNullValues() const
{
const double *tmp=getConstPointer();
- std::size_t nbOfElems=getNbOfElems();
+ mcIdType nbOfElems=getNbOfElems();
const double *where=std::find(tmp,tmp+nbOfElems,0.);
if(where!=tmp+nbOfElems)
throw INTERP_KERNEL::Exception("A value 0.0 have been detected !");
void DataArrayDouble::getMinMaxPerComponent(double *bounds) const
{
checkAllocated();
- int dim=getNumberOfComponents();
- for (int idim=0; idim<dim; idim++)
+ std::size_t dim=getNumberOfComponents();
+ for (std::size_t idim=0; idim<dim; idim++)
{
bounds[idim*2]=std::numeric_limits<double>::max();
bounds[idim*2+1]=-std::numeric_limits<double>::max();
}
const double *ptr=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++)
+ mcIdType nbOfTuples=getNumberOfTuples();
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
- for(int idim=0;idim<dim;idim++)
+ for(std::size_t idim=0;idim<dim;idim++)
{
if(bounds[idim*2]>ptr[i*dim+idim])
{
{
checkAllocated();
const double *dataPtr=getConstPointer();
- int nbOfCompo=getNumberOfComponents();
- int nbTuples=getNumberOfTuples();
+ std::size_t nbOfCompo=getNumberOfComponents();
+ mcIdType nbTuples=getNumberOfTuples();
MCAuto<DataArrayDouble> bbox=DataArrayDouble::New();
bbox->alloc(nbTuples,2*nbOfCompo);
double *bboxPtr=bbox->getPointer();
- for(int i=0;i<nbTuples;i++)
+ for(mcIdType i=0;i<nbTuples;i++)
{
- for(int j=0;j<nbOfCompo;j++)
+ for(std::size_t j=0;j<nbOfCompo;j++)
{
bboxPtr[2*nbOfCompo*i+2*j]=dataPtr[nbOfCompo*i+j]-epsilon;
bboxPtr[2*nbOfCompo*i+2*j+1]=dataPtr[nbOfCompo*i+j]+epsilon;
*
* \sa MEDCouplingPointSet::getNodeIdsNearPoints, DataArrayDouble::getDifferentValues
*/
-void DataArrayDouble::computeTupleIdsNearTuples(const DataArrayDouble *other, double eps, DataArrayInt *& c, DataArrayInt *& cI) const
+void DataArrayDouble::computeTupleIdsNearTuples(const DataArrayDouble *other, double eps, DataArrayIdType *& c, DataArrayIdType *& cI) const
{
if(!other)
throw INTERP_KERNEL::Exception("DataArrayDouble::computeTupleIdsNearTuples : input pointer other is null !");
checkAllocated();
other->checkAllocated();
- int nbOfCompo=getNumberOfComponents();
- int otherNbOfCompo=other->getNumberOfComponents();
+ std::size_t nbOfCompo=getNumberOfComponents();
+ std::size_t otherNbOfCompo=other->getNumberOfComponents();
if(nbOfCompo!=otherNbOfCompo)
throw INTERP_KERNEL::Exception("DataArrayDouble::computeTupleIdsNearTuples : number of components should be equal between this and other !");
- int nbOfTuplesOther=other->getNumberOfTuples();
- MCAuto<DataArrayInt> cArr(DataArrayInt::New()),cIArr(DataArrayInt::New()); cArr->alloc(0,1); cIArr->pushBackSilent(0);
+ mcIdType nbOfTuplesOther=other->getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
+ MCAuto<DataArrayIdType> cArr(DataArrayIdType::New()),cIArr(DataArrayIdType::New()); cArr->alloc(0,1); cIArr->pushBackSilent(0);
switch(nbOfCompo)
{
case 3:
{
- BBTreePts<3,int> myTree(begin(),0,0,getNumberOfTuples(),eps);
+ BBTreePts<3,mcIdType> myTree(begin(),0,0,nbOfTuples,eps);
FindTupleIdsNearTuplesAlg<3>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr);
break;
}
case 2:
{
- BBTreePts<2,int> myTree(begin(),0,0,getNumberOfTuples(),eps);
+ BBTreePts<2,mcIdType> myTree(begin(),0,0,nbOfTuples,eps);
FindTupleIdsNearTuplesAlg<2>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr);
break;
}
case 1:
{
- BBTreePts<1,int> myTree(begin(),0,0,getNumberOfTuples(),eps);
+ BBTreePts<1,mcIdType> myTree(begin(),0,0,nbOfTuples,eps);
FindTupleIdsNearTuplesAlg<1>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr);
break;
}
void DataArrayDouble::recenterForMaxPrecision(double eps)
{
checkAllocated();
- int dim=getNumberOfComponents();
+ std::size_t dim=getNumberOfComponents();
std::vector<double> bounds(2*dim);
getMinMaxPerComponent(&bounds[0]);
- for(int i=0;i<dim;i++)
+ for(std::size_t i=0;i<dim;i++)
{
double delta=bounds[2*i+1]-bounds[2*i];
double offset=(bounds[2*i]+bounds[2*i+1])/2.;
* \throw If \a this->getNumberOfComponents() != 1
* \throw If \a this->getNumberOfTuples() < 1
*/
-double DataArrayDouble::getMaxValue2(DataArrayInt*& tupleIds) const
+double DataArrayDouble::getMaxValue2(DataArrayIdType*& tupleIds) const
{
- int tmp;
+ mcIdType tmp;
tupleIds=0;
double ret=getMaxValue(tmp);
tupleIds=findIdsInRange(ret,ret);
* \throw If \a this->getNumberOfComponents() != 1
* \throw If \a this->getNumberOfTuples() < 1
*/
-double DataArrayDouble::getMinValue2(DataArrayInt*& tupleIds) const
+double DataArrayDouble::getMinValue2(DataArrayIdType*& tupleIds) const
{
- int tmp;
+ mcIdType tmp;
tupleIds=0;
double ret=getMinValue(tmp);
tupleIds=findIdsInRange(ret,ret);
* \throw If \a this is not allocated
*
*/
-int DataArrayDouble::count(double value, double eps) const
+mcIdType DataArrayDouble::count(double value, double eps) const
{
- int ret=0;
+ mcIdType ret=0;
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::count : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !");
const double *vals=begin();
- int nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++,vals++)
+ mcIdType nbOfTuples=getNumberOfTuples();
+ for(mcIdType i=0;i<nbOfTuples;i++,vals++)
if(fabs(*vals-value)<=eps)
ret++;
return ret;
{
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::getAverageValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !");
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples(getNumberOfTuples());
if(nbOfTuples<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::getAverageValue : array exists but number of tuples must be > 0 !");
const double *vals=getConstPointer();
double ret=std::accumulate(vals,vals+nbOfTuples,0.);
- return ret/nbOfTuples;
+ return ret/FromIdType<double>(nbOfTuples);
}
/*!
void DataArrayDouble::normMaxPerComponent(double * res) const
{
checkAllocated();
- std::size_t nbOfTuples(getNumberOfTuples());
- int nbOfCompos(getNumberOfComponents());
+ mcIdType nbOfTuples(getNumberOfTuples());
+ std::size_t nbOfCompos(getNumberOfComponents());
std::fill(res, res+nbOfCompos, -1.0);
const double *pt(getConstPointer());
- for(std::size_t i=0;i<nbOfTuples;i++)
- for (int j=0; j<nbOfCompos; j++, pt++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
+ for (std::size_t j=0; j<nbOfCompos; j++, pt++)
{
double val(std::abs(*pt));
if(val>res[j])
{
checkAllocated();
const double *ptr=getConstPointer();
- int nbTuple=getNumberOfTuples();
- int nbComps=getNumberOfComponents();
+ mcIdType nbTuple(getNumberOfTuples());
+ std::size_t nbComps(getNumberOfComponents());
std::fill(res,res+nbComps,0.);
- for(int i=0;i<nbTuple;i++)
+ for(mcIdType i=0;i<nbTuple;i++)
std::transform(ptr+i*nbComps,ptr+(i+1)*nbComps,res,res,std::plus<double>());
}
* \return the min distance.
* \sa MEDCouplingUMesh::distanceToPoint
*/
-double DataArrayDouble::distanceToTuple(const double *tupleBg, const double *tupleEnd, int& tupleId) const
+double DataArrayDouble::distanceToTuple(const double *tupleBg, const double *tupleEnd, mcIdType& tupleId) const
{
checkAllocated();
- int nbTuple=getNumberOfTuples();
- int nbComps=getNumberOfComponents();
- if(nbComps!=(int)std::distance(tupleBg,tupleEnd))
+ mcIdType nbTuple(getNumberOfTuples());
+ std::size_t nbComps(getNumberOfComponents());
+ if(nbComps!=(std::size_t)std::distance(tupleBg,tupleEnd))
{ std::ostringstream oss; oss << "DataArrayDouble::distanceToTuple : size of input tuple is " << std::distance(tupleBg,tupleEnd) << " should be equal to the number of components in this : " << nbComps << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
if(nbTuple==0)
throw INTERP_KERNEL::Exception("DataArrayDouble::distanceToTuple : no tuple in this ! No distance to compute !");
double ret0=std::numeric_limits<double>::max();
tupleId=-1;
const double *work=getConstPointer();
- for(int i=0;i<nbTuple;i++)
+ for(mcIdType i=0;i<nbTuple;i++)
{
double val=0.;
- for(int j=0;j<nbComps;j++,work++)
+ for(std::size_t j=0;j<nbComps;j++,work++)
val+=(*work-tupleBg[j])*((*work-tupleBg[j]));
if(val>=ret0)
continue;
* \throw If \a the condition ( 0 <= \a compId < \a this->getNumberOfComponents() ) is
* not respected.
*/
-double DataArrayDouble::accumulate(int compId) const
+double DataArrayDouble::accumulate(std::size_t compId) const
{
checkAllocated();
const double *ptr=getConstPointer();
- int nbTuple=getNumberOfTuples();
- int nbComps=getNumberOfComponents();
- if(compId<0 || compId>=nbComps)
+ mcIdType nbTuple(getNumberOfTuples());
+ std::size_t nbComps(getNumberOfComponents());
+ if(compId>=nbComps)
throw INTERP_KERNEL::Exception("DataArrayDouble::accumulate : Invalid compId specified : No such nb of components !");
double ret=0.;
- for(int i=0;i<nbTuple;i++)
+ for(mcIdType i=0;i<nbTuple;i++)
ret+=ptr[i*nbComps+compId];
return ret;
}
* \throw If there is an id in [ \a bgOfIndex, \a endOfIndex ) not in [0, \c this->getNumberOfTuples).
* \throw If std::distance(bgOfIndex,endOfIndex)==0.
*/
-DataArrayDouble *DataArrayDouble::accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const
+DataArrayDouble *DataArrayDouble::accumulatePerChunck(const mcIdType *bgOfIndex, const mcIdType *endOfIndex) const
{
if(!bgOfIndex || !endOfIndex)
throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : input pointer NULL !");
checkAllocated();
- int nbCompo=getNumberOfComponents();
- int nbOfTuples=getNumberOfTuples();
- int sz=(int)std::distance(bgOfIndex,endOfIndex);
+ std::size_t nbCompo(getNumberOfComponents());
+ mcIdType nbOfTuples(getNumberOfTuples());
+ std::size_t sz=std::distance(bgOfIndex,endOfIndex);
if(sz<1)
throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : invalid size of input index array !");
sz--;
MCAuto<DataArrayDouble> ret=DataArrayDouble::New(); ret->alloc(sz,nbCompo);
- const int *w=bgOfIndex;
+ const mcIdType *w=bgOfIndex;
if(*w<0 || *w>=nbOfTuples)
throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : The first element of the input index not in [0,nbOfTuples) !");
const double *srcPt=begin()+(*w)*nbCompo;
double *tmp=ret->getPointer();
- for(int i=0;i<sz;i++,tmp+=nbCompo,w++)
+ for(std::size_t i=0;i<sz;i++,tmp+=nbCompo,w++)
{
std::fill(tmp,tmp+nbCompo,0.);
if(w[1]>=w[0])
{
- for(int j=w[0];j<w[1];j++,srcPt+=nbCompo)
+ for(mcIdType j=w[0];j<w[1];j++,srcPt+=nbCompo)
{
if(j>=0 && j<nbOfTuples)
std::transform(srcPt,srcPt+nbCompo,tmp,tmp,std::plus<double>());
{
checkAllocated();
checkNbOfComps(1,"DataArrayDouble::cumSum : this is expected to be single component");
- int nbOfTuple(getNumberOfTuples());
+ mcIdType nbOfTuple(getNumberOfTuples());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfTuple+1,1);
double *ptr(ret->getPointer());
ptr[0]=0.;
const double *thisPtr(begin());
- for(int i=0;i<nbOfTuple;i++)
+ for(mcIdType i=0;i<nbOfTuple;i++)
ptr[i+1]=ptr[i]+thisPtr[i];
return ret;
}
DataArrayDouble *DataArrayDouble::fromPolarToCart() const
{
checkAllocated();
- int nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp!=2)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromPolarToCart : must be an array with exactly 2 components !");
- int nbOfTuple(getNumberOfTuples());
+ mcIdType nbOfTuple(getNumberOfTuples());
DataArrayDouble *ret(DataArrayDouble::New());
ret->alloc(nbOfTuple,2);
double *w(ret->getPointer());
const double *wIn(getConstPointer());
- for(int i=0;i<nbOfTuple;i++,w+=2,wIn+=2)
+ for(mcIdType i=0;i<nbOfTuple;i++,w+=2,wIn+=2)
{
w[0]=wIn[0]*cos(wIn[1]);
w[1]=wIn[0]*sin(wIn[1]);
DataArrayDouble *DataArrayDouble::fromCylToCart() const
{
checkAllocated();
- int nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCylToCart : must be an array with exactly 3 components !");
- int nbOfTuple(getNumberOfTuples());
+ mcIdType nbOfTuple(getNumberOfTuples());
DataArrayDouble *ret(DataArrayDouble::New());
ret->alloc(getNumberOfTuples(),3);
double *w(ret->getPointer());
const double *wIn(getConstPointer());
- for(int i=0;i<nbOfTuple;i++,w+=3,wIn+=3)
+ for(mcIdType i=0;i<nbOfTuple;i++,w+=3,wIn+=3)
{
w[0]=wIn[0]*cos(wIn[1]);
w[1]=wIn[0]*sin(wIn[1]);
DataArrayDouble *DataArrayDouble::fromSpherToCart() const
{
checkAllocated();
- int nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromSpherToCart : must be an array with exactly 3 components !");
- int nbOfTuple(getNumberOfTuples());
+ mcIdType nbOfTuple(getNumberOfTuples());
DataArrayDouble *ret(DataArrayDouble::New());
ret->alloc(getNumberOfTuples(),3);
double *w(ret->getPointer());
const double *wIn(getConstPointer());
- for(int i=0;i<nbOfTuple;i++,w+=3,wIn+=3)
+ for(mcIdType i=0;i<nbOfTuple;i++,w+=3,wIn+=3)
{
w[0]=wIn[0]*cos(wIn[2])*sin(wIn[1]);
w[1]=wIn[0]*sin(wIn[2])*sin(wIn[1]);
DataArrayDouble *DataArrayDouble::cartesianize(MEDCouplingAxisType atOfThis) const
{
checkAllocated();
- int nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
MCAuto<DataArrayDouble> ret;
switch(atOfThis)
{
{
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
checkAllocated();
- int nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
if(nbOfComp!=2)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToPolar : must be an array with exactly 2 components !");
ret->alloc(nbTuples,2);
double *retPtr(ret->getPointer());
const double *ptr(begin());
- for(int i=0;i<nbTuples;i++,ptr+=2,retPtr+=2)
+ for(mcIdType i=0;i<nbTuples;i++,ptr+=2,retPtr+=2)
{
retPtr[0]=sqrt(ptr[0]*ptr[0]+ptr[1]*ptr[1]);
retPtr[1]=atan2(ptr[1],ptr[0]);
{
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
checkAllocated();
- int nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCyl : must be an array with exactly 3 components !");
ret->alloc(nbTuples,3);
double *retPtr(ret->getPointer());
const double *ptr(begin());
- for(int i=0;i<nbTuples;i++,ptr+=3,retPtr+=3)
+ for(mcIdType i=0;i<nbTuples;i++,ptr+=3,retPtr+=3)
{
retPtr[0]=sqrt(ptr[0]*ptr[0]+ptr[1]*ptr[1]);
retPtr[1]=atan2(ptr[1],ptr[0]);
{
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
checkAllocated();
- int nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToSpher : must be an array with exactly 3 components !");
ret->alloc(nbTuples,3);
double *retPtr(ret->getPointer());
const double *ptr(begin());
- for(int i=0;i<nbTuples;i++,ptr+=3,retPtr+=3)
+ for(mcIdType i=0;i<nbTuples;i++,ptr+=3,retPtr+=3)
{
retPtr[0]=sqrt(ptr[0]*ptr[0]+ptr[1]*ptr[1]+ptr[2]*ptr[2]);
retPtr[1]=acos(ptr[2]/retPtr[0]);
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCylGiven : input coords are NULL !");
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
checkAllocated(); coords->checkAllocated();
- std::size_t nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCylGiven : must be an array with exactly 3 components !");
if(coords->getNumberOfComponents()!=3)
double Ur[3],Uteta[3],Uz[3],*retPtr(ret->getPointer());
const double *coo(coords->begin()),*vectField(begin());
std::transform(vect,vect+3,Uz,std::bind2nd(std::multiplies<double>(),1./magOfVect));
- for(int i=0;i<nbTuples;i++,vectField+=3,retPtr+=3,coo+=3)
+ for(mcIdType i=0;i<nbTuples;i++,vectField+=3,retPtr+=3,coo+=3)
{
std::transform(coo,coo+3,center,Ur,std::minus<double>());
Uteta[0]=Uz[1]*Ur[2]-Uz[2]*Ur[1]; Uteta[1]=Uz[2]*Ur[0]-Uz[0]*Ur[2]; Uteta[2]=Uz[0]*Ur[1]-Uz[1]*Ur[0];
DataArrayDouble *DataArrayDouble::doublyContractedProduct() const
{
checkAllocated();
- int nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp!=6)
throw INTERP_KERNEL::Exception("DataArrayDouble::doublyContractedProduct : must be an array with exactly 6 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,dest++,src+=6)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest++,src+=6)
*dest=src[0]*src[0]+src[1]*src[1]+src[2]*src[2]+2.*src[3]*src[3]+2.*src[4]*src[4]+2.*src[5]*src[5];
return ret;
}
{
checkAllocated();
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
switch(getNumberOfComponents())
{
case 6:
- for(int i=0;i<nbOfTuple;i++,dest++,src+=6)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest++,src+=6)
*dest=src[0]*src[1]*src[2]+2.*src[4]*src[5]*src[3]-src[0]*src[4]*src[4]-src[2]*src[3]*src[3]-src[1]*src[5]*src[5];
return ret;
case 4:
- for(int i=0;i<nbOfTuple;i++,dest++,src+=4)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest++,src+=4)
*dest=src[0]*src[3]-src[1]*src[2];
return ret;
case 9:
- for(int i=0;i<nbOfTuple;i++,dest++,src+=9)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest++,src+=9)
*dest=src[0]*src[4]*src[8]+src[1]*src[5]*src[6]+src[2]*src[3]*src[7]-src[0]*src[5]*src[7]-src[1]*src[3]*src[8]-src[2]*src[4]*src[6];
return ret;
default:
DataArrayDouble *DataArrayDouble::eigenValues() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6)
throw INTERP_KERNEL::Exception("DataArrayDouble::eigenValues : must be an array with exactly 6 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,3);
const double *src=getConstPointer();
double *dest=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,dest+=3,src+=6)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest+=3,src+=6)
INTERP_KERNEL::computeEigenValues6(src,dest);
return ret;
}
DataArrayDouble *DataArrayDouble::eigenVectors() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6)
throw INTERP_KERNEL::Exception("DataArrayDouble::eigenVectors : must be an array with exactly 6 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,9);
const double *src=getConstPointer();
double *dest=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,src+=6)
+ for(mcIdType i=0;i<nbOfTuple;i++,src+=6)
{
double tmp[3];
INTERP_KERNEL::computeEigenValues6(src,tmp);
- for(int j=0;j<3;j++,dest+=3)
+ for(mcIdType j=0;j<3;j++,dest+=3)
INTERP_KERNEL::computeEigenVectorForEigenValue6(src,tmp[j],1e-12,dest);
}
return ret;
DataArrayDouble *DataArrayDouble::inverse() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6 && nbOfComp!=9 && nbOfComp!=4)
throw INTERP_KERNEL::Exception("DataArrayDouble::inversion : must be an array with 4,6 or 9 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,nbOfComp);
const double *src=getConstPointer();
double *dest=ret->getPointer();
if(nbOfComp==6)
- for(int i=0;i<nbOfTuple;i++,dest+=6,src+=6)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest+=6,src+=6)
{
double det=src[0]*src[1]*src[2]+2.*src[4]*src[5]*src[3]-src[0]*src[4]*src[4]-src[2]*src[3]*src[3]-src[1]*src[5]*src[5];
dest[0]=(src[1]*src[2]-src[4]*src[4])/det;
dest[5]=(src[3]*src[4]-src[1]*src[5])/det;
}
else if(nbOfComp==4)
- for(int i=0;i<nbOfTuple;i++,dest+=4,src+=4)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest+=4,src+=4)
{
double det=src[0]*src[3]-src[1]*src[2];
dest[0]=src[3]/det;
dest[3]=src[0]/det;
}
else
- for(int i=0;i<nbOfTuple;i++,dest+=9,src+=9)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest+=9,src+=9)
{
double det=src[0]*src[4]*src[8]+src[1]*src[5]*src[6]+src[2]*src[3]*src[7]-src[0]*src[5]*src[7]-src[1]*src[3]*src[8]-src[2]*src[4]*src[6];
dest[0]=(src[4]*src[8]-src[7]*src[5])/det;
DataArrayDouble *DataArrayDouble::trace() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6 && nbOfComp!=9 && nbOfComp!=4)
throw INTERP_KERNEL::Exception("DataArrayDouble::trace : must be an array with 4,6 or 9 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
if(nbOfComp==6)
- for(int i=0;i<nbOfTuple;i++,dest++,src+=6)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest++,src+=6)
*dest=src[0]+src[1]+src[2];
else if(nbOfComp==4)
- for(int i=0;i<nbOfTuple;i++,dest++,src+=4)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest++,src+=4)
*dest=src[0]+src[3];
else
- for(int i=0;i<nbOfTuple;i++,dest++,src+=9)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest++,src+=9)
*dest=src[0]+src[4]+src[8];
return ret;
}
DataArrayDouble *DataArrayDouble::deviator() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6)
throw INTERP_KERNEL::Exception("DataArrayDouble::deviator : must be an array with exactly 6 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,6);
const double *src=getConstPointer();
double *dest=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,dest+=6,src+=6)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest+=6,src+=6)
{
double tr=(src[0]+src[1]+src[2])/3.;
dest[0]=src[0]-tr;
DataArrayDouble *DataArrayDouble::magnitude() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,dest++)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest++)
{
double sum=0.;
- for(int j=0;j<nbOfComp;j++,src++)
+ for(std::size_t j=0;j<nbOfComp;j++,src++)
sum+=(*src)*(*src);
*dest=sqrt(sum);
}
DataArrayDouble *DataArrayDouble::maxPerTuple() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp(getNumberOfComponents());
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple(getNumberOfTuples());
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,dest++,src+=nbOfComp)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest++,src+=nbOfComp)
*dest=*std::max_element(src,src+nbOfComp);
return ret.retn();
}
* \throw If \a this is not allocated.
* \sa DataArrayDouble::maxPerTuple
*/
-DataArrayDouble *DataArrayDouble::maxPerTupleWithCompoId(DataArrayInt* &compoIdOfMaxPerTuple) const
+DataArrayDouble *DataArrayDouble::maxPerTupleWithCompoId(DataArrayIdType* &compoIdOfMaxPerTuple) const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp(getNumberOfComponents());
MCAuto<DataArrayDouble> ret0=DataArrayDouble::New();
- MCAuto<DataArrayInt> ret1=DataArrayInt::New();
- int nbOfTuple=getNumberOfTuples();
+ MCAuto<DataArrayIdType> ret1=DataArrayIdType::New();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret0->alloc(nbOfTuple,1); ret1->alloc(nbOfTuple,1);
const double *src=getConstPointer();
- double *dest=ret0->getPointer(); int *dest1=ret1->getPointer();
- for(int i=0;i<nbOfTuple;i++,dest++,dest1++,src+=nbOfComp)
+ double *dest=ret0->getPointer(); mcIdType *dest1=ret1->getPointer();
+ for(mcIdType i=0;i<nbOfTuple;i++,dest++,dest1++,src+=nbOfComp)
{
const double *loc=std::max_element(src,src+nbOfComp);
*dest=*loc;
- *dest1=(int)std::distance(src,loc);
+ *dest1=ToIdType(std::distance(src,loc));
}
compoIdOfMaxPerTuple=ret1.retn();
return ret0.retn();
DataArrayDouble *DataArrayDouble::buildEuclidianDistanceDenseMatrix() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
- int nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfComp(getNumberOfComponents());
+ mcIdType nbOfTuples(getNumberOfTuples());
const double *inData=getConstPointer();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfTuples*nbOfTuples,1);
double *outData=ret->getPointer();
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
outData[i*nbOfTuples+i]=0.;
- for(int j=i+1;j<nbOfTuples;j++)
+ for(mcIdType j=i+1;j<nbOfTuples;j++)
{
double dist=0.;
- for(int k=0;k<nbOfComp;k++)
+ for(std::size_t k=0;k<nbOfComp;k++)
{ double delta=inData[i*nbOfComp+k]-inData[j*nbOfComp+k]; dist+=delta*delta; }
dist=sqrt(dist);
outData[i*nbOfTuples+j]=dist;
throw INTERP_KERNEL::Exception("DataArrayDouble::buildEuclidianDistanceDenseMatrixWith : input parameter is null !");
checkAllocated();
other->checkAllocated();
- int nbOfComp=getNumberOfComponents();
- int otherNbOfComp=other->getNumberOfComponents();
+ std::size_t nbOfComp(getNumberOfComponents());
+ std::size_t otherNbOfComp(other->getNumberOfComponents());
if(nbOfComp!=otherNbOfComp)
{
std::ostringstream oss; oss << "DataArrayDouble::buildEuclidianDistanceDenseMatrixWith : this nb of compo=" << nbOfComp << " and other nb of compo=" << otherNbOfComp << ". It should match !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbOfTuples=getNumberOfTuples();
- int otherNbOfTuples=other->getNumberOfTuples();
+ mcIdType nbOfTuples(getNumberOfTuples());
+ mcIdType otherNbOfTuples(other->getNumberOfTuples());
const double *inData=getConstPointer();
const double *inDataOther=other->getConstPointer();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(otherNbOfTuples*nbOfTuples,1);
double *outData=ret->getPointer();
- for(int i=0;i<otherNbOfTuples;i++,inDataOther+=nbOfComp)
+ for(mcIdType i=0;i<otherNbOfTuples;i++,inDataOther+=nbOfComp)
{
- for(int j=0;j<nbOfTuples;j++)
+ for(mcIdType j=0;j<nbOfTuples;j++)
{
double dist=0.;
- for(int k=0;k<nbOfComp;k++)
+ for(std::size_t k=0;k<nbOfComp;k++)
{ double delta=inDataOther[k]-inData[j*nbOfComp+k]; dist+=delta*delta; }
dist=sqrt(dist);
outData[i*nbOfTuples+j]=dist;
{
checkAllocated();
double *pt=getPointer();
- int nbOfTuple=getNumberOfTuples();
- int nbOfComp=getNumberOfComponents();
+ mcIdType nbOfTuple(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
if(asc)
- for(int i=0;i<nbOfTuple;i++,pt+=nbOfComp)
+ for(mcIdType i=0;i<nbOfTuple;i++,pt+=nbOfComp)
std::sort(pt,pt+nbOfComp);
else
- for(int i=0;i<nbOfTuple;i++,pt+=nbOfComp)
+ for(mcIdType i=0;i<nbOfTuple;i++,pt+=nbOfComp)
std::sort(pt,pt+nbOfComp,std::greater<double>());
declareAsNew();
}
* \throw If \a this is not allocated.
* \throw If \a func returns \a false.
*/
-DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, FunctionToEvaluate func) const
+DataArrayDouble *DataArrayDouble::applyFunc(std::size_t nbOfComp, FunctionToEvaluate func) const
{
checkAllocated();
DataArrayDouble *newArr=DataArrayDouble::New();
- int nbOfTuples=getNumberOfTuples();
- int oldNbOfComp=getNumberOfComponents();
+ mcIdType nbOfTuples(getNumberOfTuples());
+ std::size_t oldNbOfComp(getNumberOfComponents());
newArr->alloc(nbOfTuples,nbOfComp);
const double *ptr=getConstPointer();
double *ptrToFill=newArr->getPointer();
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
if(!func(ptr+i*oldNbOfComp,ptrToFill+i*nbOfComp))
{
* \throw If \a this is not allocated.
* \throw If computing \a func fails.
*/
-DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, const std::string& func, bool isSafe) const
+DataArrayDouble *DataArrayDouble::applyFunc(std::size_t nbOfComp, const std::string& func, bool isSafe) const
{
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
*/
DataArrayDouble *DataArrayDouble::applyFunc(const std::string& func, bool isSafe) const
{
- int nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::applyFunc : output number of component must be > 0 !");
checkAllocated();
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples(getNumberOfTuples());
MCAuto<DataArrayDouble> newArr(DataArrayDouble::New());
newArr->alloc(nbOfTuples,nbOfComp);
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
std::set<std::string> vars;
expr.getTrueSetOfVars(vars);
- if((int)vars.size()>1)
+ if(vars.size()>1)
{
std::ostringstream oss; oss << "DataArrayDouble::applyFunc : this method works only with at most one var func expression ! If you need to map comps on variables please use applyFuncCompo or applyFuncNamedCompo instead ! Vars in expr are : ";
std::copy(vars.begin(),vars.end(),std::ostream_iterator<std::string>(oss," "));
expr.prepareFastEvaluator();
if(!isSafe)
{
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
- for(int iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
+ for(std::size_t iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
{
buff=*ptr;
expr.evaluateDoubleInternal(stck);
}
else
{
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
- for(int iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
+ for(std::size_t iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
{
buff=*ptr;
try
*/
void DataArrayDouble::applyFuncOnThis(const std::string& func, bool isSafe)
{
- int nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::applyFuncOnThis : output number of component must be > 0 !");
checkAllocated();
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples(getNumberOfTuples());
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
std::set<std::string> vars;
expr.getTrueSetOfVars(vars);
- if((int)vars.size()>1)
+ if(vars.size()>1)
{
std::ostringstream oss; oss << "DataArrayDouble::applyFuncOnThis : this method works only with at most one var func expression ! If you need to map comps on variables please use applyFuncCompo or applyFuncNamedCompo instead ! Vars in expr are : ";
std::copy(vars.begin(),vars.end(),std::ostream_iterator<std::string>(oss," "));
expr.prepareFastEvaluator();
if(!isSafe)
{
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
- for(int iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
+ for(std::size_t iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
{
buff=*ptr;
expr.evaluateDoubleInternal(stck);
}
else
{
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
- for(int iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
+ for(std::size_t iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
{
buff=*ptr;
try
* \throw If \a func contains vars that are not in \a this->getInfoOnComponent().
* \throw If computing \a func fails.
*/
-DataArrayDouble *DataArrayDouble::applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe) const
+DataArrayDouble *DataArrayDouble::applyFuncCompo(std::size_t nbOfComp, const std::string& func, bool isSafe) const
{
return applyFuncNamedCompo(nbOfComp,getVarsOnComponent(),func,isSafe);
}
* \throw If \a func contains vars not in \a varsOrder.
* \throw If computing \a func fails.
*/
-DataArrayDouble *DataArrayDouble::applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe) const
+DataArrayDouble *DataArrayDouble::applyFuncNamedCompo(std::size_t nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe) const
{
if(nbOfComp<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::applyFuncNamedCompo : output number of component must be > 0 !");
std::vector<std::string> varsOrder2(varsOrder);
- int oldNbOfComp(getNumberOfComponents());
- for(int i=(int)varsOrder.size();i<oldNbOfComp;i++)
+ std::size_t oldNbOfComp(getNumberOfComponents());
+ for(std::size_t i=varsOrder.size();i<oldNbOfComp;i++)
varsOrder2.push_back(std::string());
checkAllocated();
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples(getNumberOfTuples());
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
std::set<std::string> vars;
expr.getTrueSetOfVars(vars);
- if((int)vars.size()>oldNbOfComp)
+ if(vars.size()>oldNbOfComp)
{
std::ostringstream oss; oss << "The field has " << oldNbOfComp << " components and there are ";
oss << vars.size() << " variables : ";
INTERP_KERNEL::AutoPtr<double> buff(new double[oldNbOfComp]);
double *buffPtr(buff),*ptrToFill;
std::vector<double> stck;
- for(int iComp=0;iComp<nbOfComp;iComp++)
+ for(std::size_t iComp=0;iComp<nbOfComp;iComp++)
{
- expr.prepareExprEvaluationDouble(varsOrder2,oldNbOfComp,nbOfComp,iComp,buffPtr,buffPtr+oldNbOfComp);
+ expr.prepareExprEvaluationDouble(varsOrder2,(int)oldNbOfComp,(int)nbOfComp,(int)iComp,buffPtr,buffPtr+oldNbOfComp);
expr.prepareFastEvaluator();
const double *ptr(getConstPointer());
ptrToFill=newArr->getPointer()+iComp;
if(!isSafe)
{
- for(int i=0;i<nbOfTuples;i++,ptrToFill+=nbOfComp,ptr+=oldNbOfComp)
+ for(mcIdType i=0;i<nbOfTuples;i++,ptrToFill+=nbOfComp,ptr+=oldNbOfComp)
{
std::copy(ptr,ptr+oldNbOfComp,buffPtr);
expr.evaluateDoubleInternal(stck);
}
else
{
- for(int i=0;i<nbOfTuples;i++,ptrToFill+=nbOfComp,ptr+=oldNbOfComp)
+ for(mcIdType i=0;i<nbOfTuples;i++,ptrToFill+=nbOfComp,ptr+=oldNbOfComp)
{
std::copy(ptr,ptr+oldNbOfComp,buffPtr);
try
*((void **)&funcPtr)=funcStr;//he he...
//
double *ptr=getPointer();
- int nbOfComp=getNumberOfComponents();
- int nbOfTuples=getNumberOfTuples();
- int nbOfElems=nbOfTuples*nbOfComp;
- for(int i=0;i<nbOfElems;i++,ptr++)
+ std::size_t nbOfComp=getNumberOfComponents();
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfElems=nbOfTuples*nbOfComp;
+ for(std::size_t i=0;i<nbOfElems;i++,ptr++)
*ptr=funcPtr(*ptr);
declareAsNew();
}
*((void **)&funcPtr)=funcStr;//he he...
//
double *ptr=getPointer();
- int nbOfComp=getNumberOfComponents();
- int nbOfTuples=getNumberOfTuples();
- int nbOfElems=nbOfTuples*nbOfComp;
- for(int i=0;i<nbOfElems;i++,ptr++)
+ std::size_t nbOfComp=getNumberOfComponents();
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfElems=nbOfTuples*nbOfComp;
+ for(std::size_t i=0;i<nbOfElems;i++,ptr++)
*ptr=funcPtr(*ptr);
declareAsNew();
}
checkAllocated();
if(getNumberOfComponents()!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::symmetry3DPlane : this is excepted to have 3 components !");
- int nbTuples(getNumberOfTuples());
+ mcIdType nbTuples(getNumberOfTuples());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbTuples,3);
Symmetry3DPlane(point,normalVector,nbTuples,begin(),ret->getPointer());
* \ref py_mcdataarraydouble_getidsinrange "Here is a Python example".
* \endif
*/
-DataArrayInt *DataArrayDouble::findIdsInRange(double vmin, double vmax) const
+DataArrayIdType *DataArrayDouble::findIdsInRange(double vmin, double vmax) const
{
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsInRange : this must have exactly one component !");
const double *cptr(begin());
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- int nbOfTuples(getNumberOfTuples());
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
+ mcIdType nbOfTuples(getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr>=vmin && *cptr<=vmax)
ret->pushBackSilent(i);
return ret.retn();
*
* \sa DataArrayDouble::findIdsInRange
*/
-DataArrayInt *DataArrayDouble::findIdsNotInRange(double vmin, double vmax) const
+DataArrayIdType *DataArrayDouble::findIdsNotInRange(double vmin, double vmax) const
{
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsNotInRange : this must have exactly one component !");
const double *cptr(begin());
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- int nbOfTuples(getNumberOfTuples());
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
+ mcIdType nbOfTuples(getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr<vmin || *cptr>vmax)
ret->pushBackSilent(i);
return ret.retn();
throw INTERP_KERNEL::Exception("DataArrayDouble::Aggregate : input list must contain at least one NON EMPTY DataArrayDouble !");
std::vector<const DataArrayDouble *>::const_iterator it=a.begin();
std::size_t nbOfComp((*it)->getNumberOfComponents());
- int nbt=(*it++)->getNumberOfTuples();
- for(int i=1;it!=a.end();it++,i++)
+ mcIdType nbt=(*it++)->getNumberOfTuples();
+ for(mcIdType i=1;it!=a.end();it++,i++)
{
if((*it)->getNumberOfComponents()!=nbOfComp)
throw INTERP_KERNEL::Exception("DataArrayDouble::Aggregate : Nb of components mismatch for array aggregation !");
std::size_t nbOfComp(a1->getNumberOfComponents());
if(nbOfComp!=a2->getNumberOfComponents())
throw INTERP_KERNEL::Exception("Nb of components mismatch for array Dot !");
- std::size_t nbOfTuple(a1->getNumberOfTuples());
+ mcIdType nbOfTuple(a1->getNumberOfTuples());
if(nbOfTuple!=a2->getNumberOfTuples())
throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Dot !");
DataArrayDouble *ret=DataArrayDouble::New();
ret->alloc(nbOfTuple,1);
double *retPtr=ret->getPointer();
const double *a1Ptr=a1->begin(),*a2Ptr(a2->begin());
- for(std::size_t i=0;i<nbOfTuple;i++)
+ for(mcIdType i=0;i<nbOfTuple;i++)
{
double sum=0.;
for(std::size_t j=0;j<nbOfComp;j++)
throw INTERP_KERNEL::Exception("Nb of components mismatch for array crossProduct !");
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("Nb of components must be equal to 3 for array crossProduct !");
- std::size_t nbOfTuple(a1->getNumberOfTuples());
+ mcIdType nbOfTuple(a1->getNumberOfTuples());
if(nbOfTuple!=a2->getNumberOfTuples())
throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array crossProduct !");
DataArrayDouble *ret=DataArrayDouble::New();
ret->alloc(nbOfTuple,3);
double *retPtr=ret->getPointer();
const double *a1Ptr(a1->begin()),*a2Ptr(a2->begin());
- for(std::size_t i=0;i<nbOfTuple;i++)
+ for(mcIdType i=0;i<nbOfTuple;i++)
{
retPtr[3*i]=a1Ptr[3*i+1]*a2Ptr[3*i+2]-a1Ptr[3*i+2]*a2Ptr[3*i+1];
retPtr[3*i+1]=a1Ptr[3*i+2]*a2Ptr[3*i]-a1Ptr[3*i]*a2Ptr[3*i+2];
std::size_t nbOfComp(a1->getNumberOfComponents());
if(nbOfComp!=a2->getNumberOfComponents())
throw INTERP_KERNEL::Exception("Nb of components mismatch for array Max !");
- std::size_t nbOfTuple(a1->getNumberOfTuples());
+ mcIdType nbOfTuple(a1->getNumberOfTuples());
if(nbOfTuple!=a2->getNumberOfTuples())
throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Max !");
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
std::size_t nbOfComp(a1->getNumberOfComponents());
if(nbOfComp!=a2->getNumberOfComponents())
throw INTERP_KERNEL::Exception("Nb of components mismatch for array min !");
- std::size_t nbOfTuple(a1->getNumberOfTuples());
+ mcIdType nbOfTuple(a1->getNumberOfTuples());
if(nbOfTuple!=a2->getNumberOfTuples())
throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array min !");
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
{
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : at least one of input instances is null !");
- int nbOfTuple=a1->getNumberOfTuples();
- int nbOfTuple2=a2->getNumberOfTuples();
- int nbOfComp=a1->getNumberOfComponents();
- int nbOfComp2=a2->getNumberOfComponents();
+ mcIdType nbOfTuple=a1->getNumberOfTuples();
+ mcIdType nbOfTuple2=a2->getNumberOfTuples();
+ std::size_t nbOfComp=a1->getNumberOfComponents();
+ std::size_t nbOfComp2=a2->getNumberOfComponents();
if(nbOfTuple!=nbOfTuple2)
throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : number of tuples mismatches !");
if(nbOfComp!=1 || nbOfComp2!=1)
MCAuto<DataArrayDouble> ret=DataArrayDouble::New(); ret->alloc(nbOfTuple,1);
const double *ptr1(a1->begin()),*ptr2(a2->begin());
double *ptr=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,ptr1++,ptr2++,ptr++)
+ for(mcIdType i=0;i<nbOfTuple;i++,ptr1++,ptr2++,ptr++)
{
if(*ptr1>=0)
{
{
if(!other)
throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : input instance is null !");
- int nbOfTuple=getNumberOfTuples();
- int nbOfTuple2=other->getNumberOfTuples();
- int nbOfComp=getNumberOfComponents();
- int nbOfComp2=other->getNumberOfComponents();
+ mcIdType nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple2=other->getNumberOfTuples();
+ std::size_t nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp2=other->getNumberOfComponents();
if(nbOfTuple!=nbOfTuple2)
throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of tuples mismatches !");
if(nbOfComp!=1 || nbOfComp2!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of components of both arrays must be equal to 1 !");
double *ptr=getPointer();
const double *ptrc=other->begin();
- for(int i=0;i<nbOfTuple;i++,ptrc++,ptr++)
+ for(mcIdType i=0;i<nbOfTuple;i++,ptrc++,ptr++)
{
if(*ptr>=0)
*ptr=pow(*ptr,*ptrc);
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::toVectorOfBool : must be applied on single component array !");
- int nbt(getNumberOfTuples());
+ mcIdType nbt(getNumberOfTuples());
std::vector<bool> ret(nbt);
const double *pt(begin());
- for(int i=0;i<nbt;i++)
+ for(mcIdType i=0;i<nbt;i++)
{
if(fabs(pt[i])<eps)
ret[i]=false;
* Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
* Server side.
*/
-void DataArrayDouble::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+void DataArrayDouble::getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const
{
tinyInfo.resize(2);
if(isAllocated())
{
tinyInfo[0]=getNumberOfTuples();
- tinyInfo[1]=getNumberOfComponents();
+ tinyInfo[1]=ToIdType(getNumberOfComponents());
}
else
{
{
if(isAllocated())
{
- int nbOfCompo=getNumberOfComponents();
+ std::size_t nbOfCompo(getNumberOfComponents());
tinyInfo.resize(nbOfCompo+1);
tinyInfo[0]=getName();
- for(int i=0;i<nbOfCompo;i++)
+ for(std::size_t i=0;i<nbOfCompo;i++)
tinyInfo[i+1]=getInfoOnComponent(i);
}
else
* Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
* This method returns if a feeding is needed.
*/
-bool DataArrayDouble::resizeForUnserialization(const std::vector<int>& tinyInfoI)
+bool DataArrayDouble::resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI)
{
- int nbOfTuple=tinyInfoI[0];
- int nbOfComp=tinyInfoI[1];
+ mcIdType nbOfTuple=tinyInfoI[0];
+ mcIdType nbOfComp=tinyInfoI[1];
if(nbOfTuple!=-1 || nbOfComp!=-1)
{
alloc(nbOfTuple,nbOfComp);
/*!
* Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
*/
-void DataArrayDouble::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS)
+void DataArrayDouble::finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<std::string>& tinyInfoS)
{
setName(tinyInfoS[0]);
if(isAllocated())
{
- int nbOfCompo=getNumberOfComponents();
- for(int i=0;i<nbOfCompo;i++)
+ std::size_t nbOfCompo(getNumberOfComponents());
+ for(std::size_t i=0;i<nbOfCompo;i++)
setInfoOnComponent(i,tinyInfoS[i+1]);
}
}
* Low static method that operates 3D rotation of 'nbNodes' 3D nodes whose coordinates are arranged in \a coordsIn
* around an axe ( \a center, \a vect) and with angle \a angle.
*/
-void DataArrayDouble::Rotate3DAlg(const double *center, const double *vect, double angle, int nbNodes, const double *coordsIn, double *coordsOut)
+void DataArrayDouble::Rotate3DAlg(const double *center, const double *vect, double angle, mcIdType nbNodes, const double *coordsIn, double *coordsOut)
{
if(!center || !vect)
throw INTERP_KERNEL::Exception("DataArrayDouble::Rotate3DAlg : null vector in input !");
std::transform(matrix,matrix+9,matrixTmp,matrix,std::plus<double>());
//rotation matrix computed.
double tmp[3];
- for(int i=0; i<nbNodes; i++)
+ for(mcIdType i=0; i<nbNodes; i++)
{
std::transform(coordsIn+i*3,coordsIn+(i+1)*3,center,tmp,std::minus<double>());
coordsOut[i*3]=matrix[0]*tmp[0]+matrix[1]*tmp[1]+matrix[2]*tmp[2]+center[0];
}
}
-void DataArrayDouble::Symmetry3DPlane(const double point[3], const double normalVector[3], int nbNodes, const double *coordsIn, double *coordsOut)
+void DataArrayDouble::Symmetry3DPlane(const double point[3], const double normalVector[3], mcIdType nbNodes, const double *coordsIn, double *coordsOut)
{
double matrix[9],matrix2[9],matrix3[9];
double vect[3],crossVect[3];
matrix2[0]=vect[0]/nv; matrix2[1]=vect[1]/nv; matrix2[2]=vect[2]/nv;
matrix2[3]=crossVect[0]/nc; matrix2[4]=crossVect[1]/nc; matrix2[5]=crossVect[2]/nc;
matrix2[6]=normalVector[0]/ni; matrix2[7]=normalVector[1]/ni; matrix2[8]=normalVector[2]/ni;
- for(int i=0;i<3;i++)
- for(int j=0;j<3;j++)
+ for(mcIdType i=0;i<3;i++)
+ for(mcIdType j=0;j<3;j++)
{
double val(0.);
- for(int k=0;k<3;k++)
+ for(mcIdType k=0;k<3;k++)
val+=matrix[3*i+k]*matrix2[3*k+j];
matrix3[3*i+j]=val;
}
//rotation matrix computed.
double tmp[3];
- for(int i=0; i<nbNodes; i++)
+ for(mcIdType i=0; i<nbNodes; i++)
{
std::transform(coordsIn+i*3,coordsIn+(i+1)*3,point,tmp,std::minus<double>());
coordsOut[i*3]=matrix3[0]*tmp[0]+matrix3[1]*tmp[1]+matrix3[2]*tmp[2]+point[0];
* Low static method that operates 3D rotation of \a nbNodes 3D nodes whose coordinates are arranged in \a coords
* around the center point \a center and with angle \a angle.
*/
-void DataArrayDouble::Rotate2DAlg(const double *center, double angle, int nbNodes, const double *coordsIn, double *coordsOut)
+void DataArrayDouble::Rotate2DAlg(const double *center, double angle, mcIdType nbNodes, const double *coordsIn, double *coordsOut)
{
double cosa=cos(angle);
double sina=sin(angle);
double matrix[4];
matrix[0]=cosa; matrix[1]=-sina; matrix[2]=sina; matrix[3]=cosa;
double tmp[2];
- for(int i=0; i<nbNodes; i++)
+ for(mcIdType i=0; i<nbNodes; i++)
{
std::transform(coordsIn+i*2,coordsIn+(i+1)*2,center,tmp,std::minus<double>());
coordsOut[i*2]=matrix[0]*tmp[0]+matrix[1]*tmp[1]+center[0];
{
}
-DataArrayDoubleTuple::DataArrayDoubleTuple(double *pt, int nbOfComp):DataArrayTuple<double>(pt,nbOfComp)
+DataArrayDoubleTuple::DataArrayDoubleTuple(double *pt, std::size_t nbOfComp):DataArrayTuple<double>(pt,nbOfComp)
{
}
std::string DataArrayDoubleTuple::repr() const
{
std::ostringstream oss; oss.precision(17); oss << "(";
- for(int i=0;i<_nb_of_compo-1;i++)
+ for(std::size_t i=0;i<_nb_of_compo-1;i++)
oss << _pt[i] << ", ";
oss << _pt[_nb_of_compo-1] << ")";
return oss.str();
* This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or
* \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem.
*/
-DataArrayDouble *DataArrayDoubleTuple::buildDADouble(int nbOfTuples, int nbOfCompo) const
+DataArrayDouble *DataArrayDoubleTuple::buildDADouble(std::size_t nbOfTuples, std::size_t nbOfCompo) const
{
return this->buildDA(nbOfTuples,nbOfCompo);
}
-/*!
- * Returns the only one value in \a this, if and only if number of elements
- * (nb of tuples * nb of components) is equal to 1, and that \a this is allocated.
- * \return double - the sole value stored in \a this array.
- * \throw If at least one of conditions stated above is not fulfilled.
- */
-int DataArrayInt::intValue() const
-{
- if(isAllocated())
- {
- if(getNbOfElems()==1)
- {
- return *getConstPointer();
- }
- else
- throw INTERP_KERNEL::Exception("DataArrayInt::intValue : DataArrayInt instance is allocated but number of elements is not equal to 1 !");
- }
- else
- throw INTERP_KERNEL::Exception("DataArrayInt::intValue : DataArrayInt instance is not allocated !");
-}
-
/*!
* Returns a full copy of \a this. For more info on copying data arrays see
* \ref MEDCouplingArrayBasicsCopyDeep.
return new DataArrayInt32(*this);
}
-/*!
- * Computes distribution of values of \a this one-dimensional array between given value
- * ranges (casts). This method is typically useful for entity number splitting by types,
- * for example.
- * \warning The values contained in \a arrBg should be sorted ascendently. No
- * check of this is be done. If not, the result is not warranted.
- * \param [in] arrBg - the array of ascending values defining the value ranges. The i-th
- * value of \a arrBg (\a arrBg[ i ]) gives the lowest value of the i-th range,
- * and the greatest value of the i-th range equals to \a arrBg[ i+1 ] - 1. \a
- * arrBg containing \a n values defines \a n-1 ranges. The last value of \a arrBg
- * should be more than every value in \a this array.
- * \param [in] arrEnd - specifies the end of the array \a arrBg, so that
- * the last value of \a arrBg is \a arrEnd[ -1 ].
- * \param [out] castArr - a new instance of DataArrayInt, of same size as \a this array
- * (same number of tuples and components), the caller is to delete
- * using decrRef() as it is no more needed.
- * This array contains indices of ranges for every value of \a this array. I.e.
- * the i-th value of \a castArr gives the index of range the i-th value of \a this
- * belongs to. Or, in other words, this parameter contains for each tuple in \a
- * this in which cast it holds.
- * \param [out] rankInsideCast - a new instance of DataArrayInt, of same size as \a this
- * array, the caller is to delete using decrRef() as it is no more needed.
- * This array contains ranks of values of \a this array within ranges
- * they belongs to. I.e. the i-th value of \a rankInsideCast gives the rank of
- * the i-th value of \a this array within the \a castArr[ i ]-th range, to which
- * the i-th value of \a this belongs to. Or, in other words, this param contains
- * for each tuple its rank inside its cast. The rank is computed as difference
- * between the value and the lowest value of range.
- * \param [out] castsPresent - a new instance of DataArrayInt, containing indices of
- * ranges (casts) to which at least one value of \a this array belongs.
- * Or, in other words, this param contains the casts that \a this contains.
- * The caller is to delete this array using decrRef() as it is no more needed.
- *
- * \b Example: If \a this contains [6,5,0,3,2,7,8,1,4] and \a arrBg contains [0,4,9] then
- * the output of this method will be :
- * - \a castArr : [1,1,0,0,0,1,1,0,1]
- * - \a rankInsideCast: [2,1,0,3,2,3,4,1,0]
- * - \a castsPresent : [0,1]
- *
- * I.e. values of \a this array belong to 2 ranges: #0 and #1. Value 6 belongs to the
- * range #1 and its rank within this range is 2; etc.
- *
- * \throw If \a this->getNumberOfComponents() != 1.
- * \throw If \a arrEnd - arrBg < 2.
- * \throw If any value of \a this is not less than \a arrEnd[-1].
- */
-void DataArrayInt::splitByValueRange(const int *arrBg, const int *arrEnd,
- DataArrayInt *& castArr, DataArrayInt *& rankInsideCast, DataArrayInt *& castsPresent) const
+DataArrayInt32Iterator *DataArrayInt32::iterator()
{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("Call splitByValueRange method on DataArrayInt with only one component, you can call 'rearrange' method before !");
- int nbOfTuples=getNumberOfTuples();
- std::size_t nbOfCast=std::distance(arrBg,arrEnd);
- if(nbOfCast<2)
- throw INTERP_KERNEL::Exception("DataArrayInt::splitByValueRange : The input array giving the cast range values should be of size >=2 !");
- nbOfCast--;
- const int *work=getConstPointer();
- typedef std::reverse_iterator<const int *> rintstart;
- rintstart bg(arrEnd);//OK no problem because size of 'arr' is greater or equal 2
- rintstart end2(arrBg);
- MCAuto<DataArrayInt> ret1=DataArrayInt::New();
- MCAuto<DataArrayInt> ret2=DataArrayInt::New();
- MCAuto<DataArrayInt> ret3=DataArrayInt::New();
- ret1->alloc(nbOfTuples,1);
- ret2->alloc(nbOfTuples,1);
- int *ret1Ptr=ret1->getPointer();
- int *ret2Ptr=ret2->getPointer();
- std::set<std::size_t> castsDetected;
- for(int i=0;i<nbOfTuples;i++)
- {
- rintstart res=std::find_if(bg,end2,std::bind2nd(std::less_equal<int>(), work[i]));
- std::size_t pos=std::distance(bg,res);
- std::size_t pos2=nbOfCast-pos;
- if(pos2<nbOfCast)
- {
- ret1Ptr[i]=(int)pos2;
- ret2Ptr[i]=work[i]-arrBg[pos2];
- castsDetected.insert(pos2);
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::splitByValueRange : At rank #" << i << " the value is " << work[i] << " should be in [0," << *bg << ") !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- ret3->alloc((int)castsDetected.size(),1);
- std::copy(castsDetected.begin(),castsDetected.end(),ret3->getPointer());
- castArr=ret1.retn();
- rankInsideCast=ret2.retn();
- castsPresent=ret3.retn();
+ return new DataArrayInt32Iterator(this);
}
-/*!
- * This method look at \a this if it can be considered as a range defined by the 3-tuple ( \a strt , \a sttoopp , \a stteepp ).
- * If false is returned the tuple must be ignored. If true is returned \a this can be considered by a range( \a strt , \a sttoopp , \a stteepp ).
- * This method works only if \a this is allocated and single component. If not an exception will be thrown.
- *
- * \param [out] strt - the start of the range (included) if true is returned.
- * \param [out] sttoopp - the end of the range (not included) if true is returned.
- * \param [out] stteepp - the step of the range if true is returned.
- * \return the verdict of the check.
- *
- * \sa DataArray::GetNumberOfItemGivenBES
- */
-bool DataArrayInt::isRange(int& strt, int& sttoopp, int& stteepp) const
+
+DataArrayInt32Iterator::DataArrayInt32Iterator(DataArrayInt32 *da):DataArrayIterator<Int32>(da)
{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::isRange : this must be single component array !");
- int nbTuples(getNumberOfTuples());
- if(nbTuples==0)
- { strt=0; sttoopp=0; stteepp=1; return true; }
- const int *pt(begin());
- strt=*pt;
- if(nbTuples==1)
- { sttoopp=strt+1; stteepp=1; return true; }
- strt=*pt; sttoopp=pt[nbTuples-1];
- if(strt==sttoopp)
- return false;
- if(sttoopp>strt)
- {
- sttoopp++;
- int a(sttoopp-1-strt),tmp(strt);
- if(a%(nbTuples-1)!=0)
- return false;
- stteepp=a/(nbTuples-1);
- for(int i=0;i<nbTuples;i++,tmp+=stteepp)
- if(pt[i]!=tmp)
- return false;
- return true;
- }
- else
- {
- sttoopp--;
- int a(strt-sttoopp-1),tmp(strt);
- if(a%(nbTuples-1)!=0)
- return false;
- stteepp=-(a/(nbTuples-1));
- for(int i=0;i<nbTuples;i++,tmp+=stteepp)
- if(pt[i]!=tmp)
- return false;
- return true;
- }
}
-/*!
- * Creates a one-dimensional DataArrayInt (\a res) whose contents are computed from
- * values of \a this (\a a) and the given (\a indArr) arrays as follows:
- * \a res[ \a indArr[ \a a[ i ]]] = i. I.e. for each value in place i \a v = \a a[ i ],
- * new value in place \a indArr[ \a v ] is i.
- * \param [in] indArrBg - the array holding indices within the result array to assign
- * indices of values of \a this array pointing to values of \a indArrBg.
- * \param [in] indArrEnd - specifies the end of the array \a indArrBg, so that
- * the last value of \a indArrBg is \a indArrEnd[ -1 ].
- * \return DataArrayInt * - the new instance of DataArrayInt.
- * The caller is to delete this result array using decrRef() as it is no more
- * needed.
- * \throw If \a this->getNumberOfComponents() != 1.
- * \throw If any value of \a this array is not a valid index for \a indArrBg array.
- * \throw If any value of \a indArrBg is not a valid index for \a this array.
- */
-DataArrayInt *DataArrayInt::transformWithIndArrR(const int *indArrBg, const int *indArrEnd) const
+DataArrayInt32Tuple::DataArrayInt32Tuple(Int32 *pt, std::size_t nbOfComp):DataArrayTuple<Int32>(pt,nbOfComp)
{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("Call transformWithIndArrR method on DataArrayInt with only one component, you can call 'rearrange' method before !");
- int nbElemsIn=(int)std::distance(indArrBg,indArrEnd);
- int nbOfTuples=getNumberOfTuples();
- const int *pt=getConstPointer();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(nbOfTuples,1);
- ret->fillWithValue(-1);
- int *tmp=ret->getPointer();
- for(int i=0;i<nbOfTuples;i++,pt++)
- {
- if(*pt>=0 && *pt<nbElemsIn)
- {
- int pos=indArrBg[*pt];
- if(pos>=0 && pos<nbOfTuples)
- tmp[pos]=i;
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::transformWithIndArrR : error on tuple #" << i << " value of new pos is " << pos << " ( indArrBg[" << *pt << "]) ! Should be in [0," << nbOfTuples << ") !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::transformWithIndArrR : error on tuple #" << i << " value is " << *pt << " and indirectionnal array as a size equal to " << nbElemsIn << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- return ret.retn();
}
-/*!
- * Creates a one-dimensional DataArrayInt of given length, whose contents are computed
- * from values of \a this array, which is supposed to contain a renumbering map in
- * "Old to New" mode. The result array contains a renumbering map in "New to Old" mode.
- * To know how to use the renumbering maps see \ref numbering.
- * \param [in] newNbOfElem - the number of tuples in the result array.
- * \return DataArrayInt * - the new instance of DataArrayInt.
- * The caller is to delete this result array using decrRef() as it is no more
- * needed.
- *
- * \if ENABLE_EXAMPLES
- * \ref cpp_mcdataarrayint_invertarrayo2n2n2o "Here is a C++ example".<br>
- * \ref py_mcdataarrayint_invertarrayo2n2n2o "Here is a Python example".
- * \endif
- */
-DataArrayInt *DataArrayInt::invertArrayO2N2N2O(int newNbOfElem) const
-{
- MCAuto<DataArrayInt> ret(DataArrayInt::New());
- ret->alloc(newNbOfElem,1);
- int nbOfOldNodes(this->getNumberOfTuples());
- const int *old2New(begin());
- int *pt(ret->getPointer());
- for(int i=0;i!=nbOfOldNodes;i++)
- {
- int newp(old2New[i]);
- if(newp!=-1)
- {
- if(newp>=0 && newp<newNbOfElem)
- pt[newp]=i;
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::invertArrayO2N2N2O : At place #" << i << " the newplace is " << newp << " must be in [0," << newNbOfElem << ") !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- }
- return ret.retn();
+std::string DataArrayInt32Tuple::repr() const
+{
+ std::ostringstream oss; oss << "(";
+ for(std::size_t i=0;i<_nb_of_compo-1;i++)
+ oss << _pt[i] << ", ";
+ oss << _pt[_nb_of_compo-1] << ")";
+ return oss.str();
}
-/*!
- * This method is similar to DataArrayInt::invertArrayO2N2N2O except that
- * Example : If \a this contains [0,1,2,0,3,4,5,4,6,4] this method will return [0,1,2,4,5,6,8] whereas DataArrayInt::invertArrayO2N2N2O returns [3,1,2,4,9,6,8]
- */
-DataArrayInt *DataArrayInt::invertArrayO2N2N2OBis(int newNbOfElem) const
-{
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(newNbOfElem,1);
- int nbOfOldNodes=getNumberOfTuples();
- const int *old2New=getConstPointer();
- int *pt=ret->getPointer();
- for(int i=nbOfOldNodes-1;i>=0;i--)
- {
- int newp(old2New[i]);
- if(newp!=-1)
- {
- if(newp>=0 && newp<newNbOfElem)
- pt[newp]=i;
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::invertArrayO2N2N2OBis : At place #" << i << " the newplace is " << newp << " must be in [0," << newNbOfElem << ") !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- }
- return ret.retn();
+Int32 DataArrayInt32Tuple::intValue() const
+{
+ return this->zeValue();
}
/*!
- * Creates a one-dimensional DataArrayInt of given length, whose contents are computed
- * from values of \a this array, which is supposed to contain a renumbering map in
- * "New to Old" mode. The result array contains a renumbering map in "Old to New" mode.
- * To know how to use the renumbering maps see \ref numbering.
- * \param [in] newNbOfElem - the number of tuples in the result array.
- * \return DataArrayInt * - the new instance of DataArrayInt.
- * The caller is to delete this result array using decrRef() as it is no more
- * needed.
- *
- * \if ENABLE_EXAMPLES
- * \ref cpp_mcdataarrayint_invertarrayn2o2o2n "Here is a C++ example".
- *
- * \ref py_mcdataarrayint_invertarrayn2o2o2n "Here is a Python example".
- * \sa invertArrayN2O2O2NOptimized
- * \endif
+ * This method returns a newly allocated instance the caller should dealed with by a MEDCoupling::DataArrayInt::decrRef.
+ * This method performs \b no copy of data. The content is only referenced using MEDCoupling::DataArrayInt::useArray with ownership set to \b false.
+ * This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or
+ * \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem.
*/
-DataArrayInt *DataArrayInt::invertArrayN2O2O2N(int oldNbOfElem) const
+DataArrayInt32 *DataArrayInt32Tuple::buildDAInt(std::size_t nbOfTuples, std::size_t nbOfCompo) const
{
- checkAllocated();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(oldNbOfElem,1);
- const int *new2Old=getConstPointer();
- int *pt=ret->getPointer();
- std::fill(pt,pt+oldNbOfElem,-1);
- int nbOfNewElems=getNumberOfTuples();
- for(int i=0;i<nbOfNewElems;i++)
- {
- int v(new2Old[i]);
- if(v>=0 && v<oldNbOfElem)
- pt[v]=i;
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::invertArrayN2O2O2N : in new id #" << i << " old value is " << v << " expected to be in [0," << oldNbOfElem << ") !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- return ret.retn();
+ return this->buildDA(nbOfTuples,nbOfCompo);
}
-/*!
- * Creates a map, whose contents are computed
- * from values of \a this array, which is supposed to contain a renumbering map in
- * "New to Old" mode. The result array contains a renumbering map in "Old to New" mode.
- * To know how to use the renumbering maps see \ref numbering.
- * \param [in] newNbOfElem - the number of tuples in the result array.
- * \return MapII - the new instance of Map.
- *
- * \if ENABLE_EXAMPLES
- * \ref cpp_mcdataarrayint_invertarrayn2o2o2n "Here is a C++ example".
- *
- * \ref py_mcdataarrayint_invertarrayn2o2o2n "Here is a Python example".
- * \sa invertArrayN2O2O2N, giveN2OOptimized, MEDCouplingPointSet::renumberNodesInConn
- * \endif
- */
-MCAuto< MapKeyVal<int> > DataArrayInt32::invertArrayN2O2O2NOptimized() const
+DataArrayInt64Iterator *DataArrayInt64::iterator()
{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt32::invertArrayN2O2O2NOptimized : single component expected !");
- MCAuto< MapKeyVal<int> > ret(MapKeyVal<int>::New());
- std::map<int,int>& m(ret->data());
- const int *new2Old(begin());
- std::size_t nbOfNewElems(this->getNumberOfTuples());
- for(std::size_t i=0;i<nbOfNewElems;i++)
- {
- int v(new2Old[i]);
- m[v]=i;
- }
- return ret;
+ return new DataArrayInt64Iterator(this);
}
-/*!
- * Creates a map, whose contents are computed
- * from values of \a this array, which is supposed to contain a renumbering map in
- * "New to Old" mode. The result array contains a renumbering map in "New to Old" mode as C++ map for performance reasons.
- *
- * \sa invertArrayN2O2O2NOptimized, MEDCouplingPointSet::renumberNodesInConn
- */
-MCAuto< MapKeyVal<int> > DataArrayInt32::giveN2OOptimized() const
+
+DataArrayInt64Iterator::DataArrayInt64Iterator(DataArrayInt64 *da):DataArrayIterator<Int64>(da)
{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt32::giveN2OOptimized : single component expected !");
- MCAuto< MapKeyVal<int> > ret(MapKeyVal<int>::New());
- std::map<int,int>& m(ret->data());
- const int *new2Old(begin());
- std::size_t nbOfNewElems(this->getNumberOfTuples());
- for(std::size_t i=0;i<nbOfNewElems;i++)
- {
- int v(new2Old[i]);
- m[i]=v;
- }
- return ret;
}
-/*!
- * Returns a new DataArrayInt containing a renumbering map in "Old to New" mode.
- * This map, if applied to \a this array, would make it sorted. For example, if
- * \a this array contents are [9,10,0,6,4,11,3,7] then the contents of the result array
- * are [5,6,0,3,2,7,1,4]; if this result array (\a res) is used as an argument in call
- * \a this->renumber(\a res) then the returned array contains [0,3,4,6,7,9,10,11].
- * This method is useful for renumbering (in MED file for example). For more info
- * on renumbering see \ref numbering.
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- * array using decrRef() as it is no more needed.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- * \throw If there are equal values in \a this array.
- */
-DataArrayInt *DataArrayInt::checkAndPreparePermutation() const
+DataArrayInt64Tuple::DataArrayInt64Tuple(Int64 *pt, std::size_t nbOfComp):DataArrayTuple<Int64>(pt,nbOfComp)
{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::checkAndPreparePermutation : number of components must == 1 !");
- int nbTuples=getNumberOfTuples();
- const int *pt=getConstPointer();
- int *pt2=CheckAndPreparePermutation(pt,pt+nbTuples);
- DataArrayInt *ret=DataArrayInt::New();
- ret->useArray(pt2,true,DeallocType::C_DEALLOC,nbTuples,1);
- return ret;
}
-/*!
- * This method tries to find the permutation to apply to the first input \a ids1 to obtain the same array (without considering strings information) the second
- * input array \a ids2.
- * \a ids1 and \a ids2 are expected to be both a list of ids (both with number of components equal to one) not sorted and with values that can be negative.
- * This method will throw an exception is no such permutation array can be obtained. It is typically the case if there is some ids in \a ids1 not in \a ids2 or
- * inversely.
- * In case of success both assertion will be true (no throw) :
- * \c ids1->renumber(ret)->isEqual(ids2) where \a ret is the return of this method.
- * \c ret->transformWithIndArr(ids2)->isEqual(ids1)
- *
- * \b Example:
- * - \a ids1 : [3,1,103,4,6,10,-7,205]
- * - \a ids2 : [-7,1,205,10,6,3,103,4]
- * - \a return is : [5,1,6,7,4,3,0,2] because ids2[5]==ids1[0], ids2[1]==ids1[1], ids2[6]==ids1[2]...
- *
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- * array using decrRef() as it is no more needed.
- * \throw If either ids1 or ids2 is null not allocated or not with one components.
- *
- * \sa DataArrayInt32::findIdForEach
- */
-DataArrayInt *DataArrayInt::FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2)
-{
- if(!ids1 || !ids2)
- throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two input arrays must be not null !");
- if(!ids1->isAllocated() || !ids2->isAllocated())
- throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two input arrays must be allocated !");
- if(ids1->getNumberOfComponents()!=1 || ids2->getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two input arrays have exactly one component !");
- if(ids1->getNumberOfTuples()!=ids2->getNumberOfTuples())
- {
- std::ostringstream oss; oss << "DataArrayInt::FindPermutationFromFirstToSecond : first array has " << ids1->getNumberOfTuples() << " tuples and the second one " << ids2->getNumberOfTuples() << " tuples ! No chance to find a permutation between the 2 arrays !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- MCAuto<DataArrayInt> p1(ids1->deepCopy());
- MCAuto<DataArrayInt> p2(ids2->deepCopy());
- p1->sort(true); p2->sort(true);
- if(!p1->isEqualWithoutConsideringStr(*p2))
- throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two arrays are not lying on same ids ! Impossible to find a permutation between the 2 arrays !");
- p1=ids1->checkAndPreparePermutation();
- p2=ids2->checkAndPreparePermutation();
- p2=p2->invertArrayO2N2N2O(p2->getNumberOfTuples());
- p2=p2->selectByTupleIdSafe(p1->begin(),p1->end());
- return p2.retn();
+std::string DataArrayInt64Tuple::repr() const
+{
+ std::ostringstream oss; oss << "(";
+ for(std::size_t i=0;i<_nb_of_compo-1;i++)
+ oss << _pt[i] << ", ";
+ oss << _pt[_nb_of_compo-1] << ")";
+ return oss.str();
}
-/*!
- * Returns two arrays describing a surjective mapping from \a this set of values (\a A)
- * onto a set of values of size \a targetNb (\a B). The surjective function is
- * \a B[ \a A[ i ]] = i. That is to say that for each \a id in [0,\a targetNb), where \a
- * targetNb < \a this->getNumberOfTuples(), there exists at least one tupleId (\a tid) so
- * that <em> this->getIJ( tid, 0 ) == id</em>. <br>
- * The first of out arrays returns indices of elements of \a this array, grouped by their
- * place in the set \a B. The second out array is the index of the first one; it shows how
- * many elements of \a A are mapped into each element of \a B. <br>
- * For more info on
- * mapping and its usage in renumbering see \ref numbering. <br>
- * \b Example:
- * - \a this: [0,3,2,3,2,2,1,2]
- * - \a targetNb: 4
- * - \a arr: [0, 6, 2,4,5,7, 1,3]
- * - \a arrI: [0,1,2,6,8]
- *
- * This result means: <br>
- * the element of \a B 0 encounters within \a A once (\a arrI[ 0+1 ] - \a arrI[ 0 ]) and
- * its index within \a A is 0 ( \a arr[ 0:1 ] == \a arr[ \a arrI[ 0 ] : \a arrI[ 0+1 ]]);<br>
- * the element of \a B 2 encounters within \a A 4 times (\a arrI[ 2+1 ] - \a arrI[ 2 ]) and
- * its indices within \a A are [2,4,5,7] ( \a arr[ 2:6 ] == \a arr[ \a arrI[ 2 ] :
- * \a arrI[ 2+1 ]]); <br> etc.
- * \param [in] targetNb - the size of the set \a B. \a targetNb must be equal or more
- * than the maximal value of \a A.
- * \param [out] arr - a new instance of DataArrayInt returning indices of
- * elements of \a this, grouped by their place in the set \a B. The caller is to delete
- * this array using decrRef() as it is no more needed.
- * \param [out] arrI - a new instance of DataArrayInt returning size of groups of equal
- * elements of \a this. The caller is to delete this array using decrRef() as it
- * is no more needed.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- * \throw If any value in \a this is more or equal to \a targetNb.
- */
-void DataArrayInt::changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, DataArrayInt *&arrI) const
+Int64 DataArrayInt64Tuple::intValue() const
{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : number of components must == 1 !");
- int nbOfTuples=getNumberOfTuples();
- MCAuto<DataArrayInt> ret(DataArrayInt::New());
- MCAuto<DataArrayInt> retI(DataArrayInt::New());
- retI->alloc(targetNb+1,1);
- const int *input=getConstPointer();
- std::vector< std::vector<int> > tmp(targetNb);
- for(int i=0;i<nbOfTuples;i++)
- {
- int tmp2=input[i];
- if(tmp2>=0 && tmp2<targetNb)
- tmp[tmp2].push_back(i);
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::changeSurjectiveFormat : At pos " << i << " presence of element " << tmp2 << " ! should be in [0," << targetNb << ") !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- int *retIPtr=retI->getPointer();
- *retIPtr=0;
- for(std::vector< std::vector<int> >::const_iterator it1=tmp.begin();it1!=tmp.end();it1++,retIPtr++)
- retIPtr[1]=retIPtr[0]+(int)((*it1).size());
- if(nbOfTuples!=retI->getIJ(targetNb,0))
- throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : big problem should never happen !");
- ret->alloc(nbOfTuples,1);
- int *retPtr=ret->getPointer();
- for(std::vector< std::vector<int> >::const_iterator it1=tmp.begin();it1!=tmp.end();it1++)
- retPtr=std::copy((*it1).begin(),(*it1).end(),retPtr);
- arr=ret.retn();
- arrI=retI.retn();
+ return this->zeValue();
}
-
-/*!
- * Returns a new DataArrayInt containing a renumbering map in "Old to New" mode computed
- * from a zip representation of a surjective format (returned e.g. by
- * \ref MEDCoupling::DataArrayDouble::findCommonTuples() "DataArrayDouble::findCommonTuples()"
- * for example). The result array minimizes the permutation. <br>
- * For more info on renumbering see \ref numbering. <br>
- * \b Example: <br>
- * - \a nbOfOldTuples: 10
- * - \a arr : [0,3, 5,7,9]
- * - \a arrIBg : [0,2,5]
- * - \a newNbOfTuples: 7
- * - result array : [0,1,2,0,3,4,5,4,6,4]
- *
- * \param [in] nbOfOldTuples - number of tuples in the initial array \a arr.
- * \param [in] arr - the array of tuple indices grouped by \a arrIBg array.
- * \param [in] arrIBg - the array dividing all indices stored in \a arr into groups of
- * (indices of) equal values. Its every element (except the last one) points to
- * the first element of a group of equal values.
- * \param [in] arrIEnd - specifies the end of \a arrIBg, so that the last element of \a
- * arrIBg is \a arrIEnd[ -1 ].
- * \param [out] newNbOfTuples - number of tuples after surjection application.
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- * array using decrRef() as it is no more needed.
- * \throw If any value of \a arr breaks condition ( 0 <= \a arr[ i ] < \a nbOfOldTuples ).
- */
-DataArrayInt *DataArrayInt::ConvertIndexArrayToO2N(int nbOfOldTuples, const int *arr, const int *arrIBg, const int *arrIEnd, int &newNbOfTuples)
-{
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(nbOfOldTuples,1);
- int *pt=ret->getPointer();
- std::fill(pt,pt+nbOfOldTuples,-1);
- int nbOfGrps=((int)std::distance(arrIBg,arrIEnd))-1;
- const int *cIPtr=arrIBg;
- for(int i=0;i<nbOfGrps;i++)
- pt[arr[cIPtr[i]]]=-(i+2);
- int newNb=0;
- for(int iNode=0;iNode<nbOfOldTuples;iNode++)
- {
- if(pt[iNode]<0)
- {
- if(pt[iNode]==-1)
- pt[iNode]=newNb++;
- else
- {
- int grpId=-(pt[iNode]+2);
- for(int j=cIPtr[grpId];j<cIPtr[grpId+1];j++)
- {
- if(arr[j]>=0 && arr[j]<nbOfOldTuples)
- pt[arr[j]]=newNb;
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::ConvertIndexArrayToO2N : With element #" << j << " value is " << arr[j] << " should be in [0," << nbOfOldTuples << ") !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- newNb++;
- }
- }
- }
- newNbOfTuples=newNb;
- return ret.retn();
+DataArrayInt64 *DataArrayInt64Tuple::buildDAInt(std::size_t nbOfTuples, std::size_t nbOfCompo) const
+{
+ return this->buildDA(nbOfTuples,nbOfCompo);
}
-/*!
- * Returns a new DataArrayInt containing a renumbering map in "New to Old" mode,
- * which if applied to \a this array would make it sorted ascendingly.
- * For more info on renumbering see \ref numbering. <br>
- * \b Example: <br>
- * - \a this: [2,0,1,1,0,1,2,0,1,1,0,0]
- * - result: [10,0,5,6,1,7,11,2,8,9,3,4]
- * - after applying result to \a this: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2]
- *
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- * array using decrRef() as it is no more needed.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- */
-DataArrayInt *DataArrayInt::buildPermArrPerLevel() const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildPermArrPerLevel : number of components must == 1 !");
- int nbOfTuples=getNumberOfTuples();
- const int *pt=getConstPointer();
- std::map<int,int> m;
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(nbOfTuples,1);
- int *opt=ret->getPointer();
- for(int i=0;i<nbOfTuples;i++,pt++,opt++)
- {
- int val=*pt;
- std::map<int,int>::iterator it=m.find(val);
- if(it!=m.end())
- {
- *opt=(*it).second;
- (*it).second++;
- }
- else
- {
- *opt=0;
- m.insert(std::pair<int,int>(val,1));
- }
- }
- int sum=0;
- for(std::map<int,int>::iterator it=m.begin();it!=m.end();it++)
- {
- int vt=(*it).second;
- (*it).second=sum;
- sum+=vt;
- }
- pt=getConstPointer();
- opt=ret->getPointer();
- for(int i=0;i<nbOfTuples;i++,pt++,opt++)
- *opt+=m[*pt];
- //
- return ret.retn();
-}
-
-/*!
- * Checks if \a this array has the given size, and if its contents is equal to an array filled with
- * iota(). This method is particularly useful for DataArrayInt instances that represent
- * a renumbering array, to check if there is a real need in renumbering.
- * This method checks than \a this can be considered as an identity mapping
- * of a set having \a sizeExpected elements into itself.
- *
- * \param [in] sizeExpected - The number of elements expected.
- * \return bool - \a true if \a this array contents == \a range( \a this->getNumberOfTuples())
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- */
-bool DataArrayInt::isIota(int sizeExpected) const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- return false;
- int nbOfTuples(getNumberOfTuples());
- if(nbOfTuples!=sizeExpected)
- return false;
- const int *pt=getConstPointer();
- for(int i=0;i<nbOfTuples;i++,pt++)
- if(*pt!=i)
- return false;
- return true;
-}
-
-/*!
- * Checks if all values in \a this array are equal to \a val.
- * \param [in] val - value to check equality of array values to.
- * \return bool - \a true if all values are \a val.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1
- * \sa DataArrayInt::checkUniformAndGuess
- */
-bool DataArrayInt::isUniform(int val) const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::isUniform : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
- const int *w(begin()),*end2(end());
- for(;w!=end2;w++)
- if(*w!=val)
- return false;
- return true;
-}
-
-/*!
- * This method checks that \a this is uniform. If not and exception will be thrown.
- * In case of uniformity the corresponding value is returned.
- *
- * \return int - the unique value contained in this
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1
- * \throw If \a this is not uniform.
- * \sa DataArrayInt::isUniform
- */
-int DataArrayInt::checkUniformAndGuess() const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
- if(empty())
- throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : this is empty !");
- const int *w(begin()),*end2(end());
- int ret(*w);
- for(;w!=end2;w++)
- if(*w!=ret)
- throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : this is not uniform !");
- return ret;
-}
-
-/*!
- * Checks if all values in \a this array are unique.
- * \return bool - \a true if condition above is true
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1
- */
-bool DataArrayInt::hasUniqueValues() const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::hasOnlyUniqueValues: must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
- std::size_t nbOfTuples(getNumberOfTuples());
- std::set<int> s(begin(),end()); // in C++11, should use unordered_set (O(1) complexity)
- if (s.size() != nbOfTuples)
- return false;
- return true;
-}
-
-/*!
- * Copy all components in a specified order from another DataArrayInt.
- * The specified components become the first ones in \a this array.
- * Both numerical and textual data is copied. The number of tuples in \a this and
- * the other array can be different.
- * \param [in] a - the array to copy data from.
- * \param [in] compoIds - sequence of zero based indices of components, data of which is
- * to be copied.
- * \throw If \a a is NULL.
- * \throw If \a compoIds.size() != \a a->getNumberOfComponents().
- * \throw If \a compoIds[i] < 0 or \a compoIds[i] > \a this->getNumberOfComponents().
- *
- * \if ENABLE_EXAMPLES
- * \ref py_mcdataarrayint_setselectedcomponents "Here is a Python example".
- * \endif
- */
-void DataArrayInt::setSelectedComponents(const DataArrayInt *a, const std::vector<int>& compoIds)
-{
- if(!a)
- throw INTERP_KERNEL::Exception("DataArrayInt::setSelectedComponents : input DataArrayInt is NULL !");
- checkAllocated();
- a->checkAllocated();
- copyPartOfStringInfoFrom2(compoIds,*a);
- std::size_t partOfCompoSz=compoIds.size();
- int nbOfCompo=getNumberOfComponents();
- int nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples());
- const int *ac=a->getConstPointer();
- int *nc=getPointer();
- for(int i=0;i<nbOfTuples;i++)
- for(std::size_t j=0;j<partOfCompoSz;j++,ac++)
- nc[nbOfCompo*i+compoIds[j]]=*ac;
-}
-
-DataArrayIntIterator *DataArrayInt::iterator()
-{
- return new DataArrayIntIterator(this);
-}
-
-/*!
- * Creates a new DataArrayInt containing IDs (indices) of tuples holding value \b not
- * equal to a given one.
- * \param [in] val - the value to ignore within \a this.
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- * array using decrRef() as it is no more needed.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- */
-DataArrayInt *DataArrayInt::findIdsNotEqual(int val) const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !");
- const int *cptr(getConstPointer());
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- int nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++,cptr++)
- if(*cptr!=val)
- ret->pushBackSilent(i);
- return ret.retn();
-}
-
-/*!
- * Creates a new DataArrayInt containing IDs (indices) of tuples holding tuple equal to those defined by [ \a tupleBg , \a tupleEnd )
- * This method is an extension of DataArrayInt::findIdsEqual method.
- *
- * \param [in] tupleBg - the begin (included) of the input tuple to find within \a this.
- * \param [in] tupleEnd - the end (excluded) of the input tuple to find within \a this.
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- * array using decrRef() as it is no more needed.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != std::distance(tupleBg,tupleEnd).
- * \throw If \a this->getNumberOfComponents() is equal to 0.
- * \sa DataArrayInt::findIdsEqual
- */
-DataArrayInt *DataArrayInt::findIdsEqualTuple(const int *tupleBg, const int *tupleEnd) const
-{
- std::size_t nbOfCompoExp(std::distance(tupleBg,tupleEnd));
- checkAllocated();
- if(getNumberOfComponents()!=nbOfCompoExp)
- {
- std::ostringstream oss; oss << "DataArrayInt::findIdsEqualTuple : mismatch of number of components. Input tuple has " << nbOfCompoExp << " whereas this array has " << getNumberOfComponents() << " components !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- if(nbOfCompoExp==0)
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualTuple : number of components should be > 0 !");
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- const int *bg(begin()),*end2(end()),*work(begin());
- while(work!=end2)
- {
- work=std::search(work,end2,tupleBg,tupleEnd);
- if(work!=end2)
- {
- std::size_t pos(std::distance(bg,work));
- if(pos%nbOfCompoExp==0)
- ret->pushBackSilent(pos/nbOfCompoExp);
- work++;
- }
- }
- return ret.retn();
-}
-
-/*!
- * This method finds for each element \a ELT in [valsBg,valsEnd) elements in \a this equal to it. Associated to ELT
- * this method will return the tuple id of last element found. If there is no element in \a this equal to ELT
- * an exception will be thrown.
- *
- * In case of success this[ret]==vals. Samely ret->transformWithIndArr(this->begin(),this->end())==vals.
- * Where \a vals is the [valsBg,valsEnd) array and \a ret the array returned by this method.
- * This method can be seen as an extension of FindPermutationFromFirstToSecond.
- * <br>
- * \b Example: <br>
- * - \a this: [17,27,2,10,-4,3,12,27,16]
- * - \a val : [3,16,-4,27,17]
- * - result: [5,8,4,7,0]
- *
- * \return - An array of size std::distance(valsBg,valsEnd)
- *
- * \sa DataArrayInt32::FindPermutationFromFirstToSecond
- */
-MCAuto<DataArrayInt32> DataArrayInt32::findIdForEach(const int *valsBg, const int *valsEnd) const
-{
- MCAuto<DataArrayInt32> ret(DataArrayInt32::New());
- std::size_t nbOfTuplesOut(std::distance(valsBg,valsEnd));
- ret->alloc(nbOfTuplesOut,1);
- MCAuto< MapKeyVal<int> > zeMap(invertArrayN2O2O2NOptimized());
- const std::map<int,int>& dat(zeMap->data());
- int *ptToFeed(ret->getPointer());
- for(const int *pt=valsBg;pt!=valsEnd;pt++)
- {
- std::map<int,int>::const_iterator it(dat.find(*pt));
- if(it!=dat.end())
- *ptToFeed++=(*it).second;
- else
- {
- std::ostringstream oss; oss << "DataArrayInt32::findIdForEach : error for element at place " << std::distance(valsBg,pt);
- oss << " of input array value is " << *pt << " which is not in this !";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- }
- return ret;
-}
-
-/*!
- * Assigns \a newValue to all elements holding \a oldValue within \a this
- * one-dimensional array.
- * \param [in] oldValue - the value to replace.
- * \param [in] newValue - the value to assign.
- * \return int - number of replacements performed.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- */
-int DataArrayInt::changeValue(int oldValue, int newValue)
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::changeValue : the array must have only one component, you can call 'rearrange' method before !");
- if(oldValue==newValue)
- return 0;
- int *start(getPointer()),*end2(start+getNbOfElems());
- int ret(0);
- for(int *val=start;val!=end2;val++)
- {
- if(*val==oldValue)
- {
- *val=newValue;
- ret++;
- }
- }
- if(ret>0)
- declareAsNew();
- return ret;
-}
-
-/*!
- * Creates a new DataArrayInt containing IDs (indices) of tuples holding value equal to
- * one of given values.
- * \param [in] valsBg - an array of values to find within \a this array.
- * \param [in] valsEnd - specifies the end of the array \a valsBg, so that
- * the last value of \a valsBg is \a valsEnd[ -1 ].
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- * array using decrRef() as it is no more needed.
- * \throw If \a this->getNumberOfComponents() != 1.
- */
-DataArrayInt *DataArrayInt::findIdsEqualList(const int *valsBg, const int *valsEnd) const
-{
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : the array must have only one component, you can call 'rearrange' method before !");
- std::set<int> vals2(valsBg,valsEnd);
- const int *cptr(getConstPointer());
- std::vector<int> res;
- int nbOfTuples(getNumberOfTuples());
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- for(int i=0;i<nbOfTuples;i++,cptr++)
- if(vals2.find(*cptr)!=vals2.end())
- ret->pushBackSilent(i);
- return ret.retn();
-}
-
-/*!
- * Creates a new DataArrayInt containing IDs (indices) of tuples holding values \b not
- * equal to any of given values.
- * \param [in] valsBg - an array of values to ignore within \a this array.
- * \param [in] valsEnd - specifies the end of the array \a valsBg, so that
- * the last value of \a valsBg is \a valsEnd[ -1 ].
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- * array using decrRef() as it is no more needed.
- * \throw If \a this->getNumberOfComponents() != 1.
- */
-DataArrayInt *DataArrayInt::findIdsNotEqualList(const int *valsBg, const int *valsEnd) const
-{
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : the array must have only one component, you can call 'rearrange' method before !");
- std::set<int> vals2(valsBg,valsEnd);
- const int *cptr=getConstPointer();
- std::vector<int> res;
- int nbOfTuples=getNumberOfTuples();
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- for(int i=0;i<nbOfTuples;i++,cptr++)
- if(vals2.find(*cptr)==vals2.end())
- ret->pushBackSilent(i);
- return ret.retn();
-}
-
-/*!
- * This method is an extension of DataArrayInt::findIdFirstEqual method because this method works for DataArrayInt with
- * any number of components excepted 0 (an INTERP_KERNEL::Exception is thrown in this case).
- * This method searches in \b this is there is a tuple that matched the input parameter \b tupl.
- * If any the tuple id is returned. If not -1 is returned.
- *
- * This method throws an INTERP_KERNEL::Exception if the number of components in \b this mismatches with the size of
- * the input vector. An INTERP_KERNEL::Exception is thrown too if \b this is not allocated.
- *
- * \return tuple id where \b tupl is. -1 if no such tuple exists in \b this.
- * \sa DataArrayInt::findIdSequence, DataArrayInt::presenceOfTuple.
- */
-int DataArrayInt::findIdFirstEqualTuple(const std::vector<int>& tupl) const
-{
- checkAllocated();
- int nbOfCompo=getNumberOfComponents();
- if(nbOfCompo==0)
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdFirstEqualTuple : 0 components in 'this' !");
- if(nbOfCompo!=(int)tupl.size())
- {
- std::ostringstream oss; oss << "DataArrayInt::findIdFirstEqualTuple : 'this' contains " << nbOfCompo << " components and searching for a tuple of length " << tupl.size() << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- const int *cptr=getConstPointer();
- std::size_t nbOfVals=getNbOfElems();
- for(const int *work=cptr;work!=cptr+nbOfVals;)
- {
- work=std::search(work,cptr+nbOfVals,tupl.begin(),tupl.end());
- if(work!=cptr+nbOfVals)
- {
- if(std::distance(cptr,work)%nbOfCompo!=0)
- work++;
- else
- return std::distance(cptr,work)/nbOfCompo;
- }
- }
- return -1;
-}
-
-/*!
- * This method searches the sequence specified in input parameter \b vals in \b this.
- * This works only for DataArrayInt having number of components equal to one (if not an INTERP_KERNEL::Exception will be thrown).
- * This method differs from DataArrayInt::findIdFirstEqualTuple in that the position is internal raw data is not considered here contrary to DataArrayInt::findIdFirstEqualTuple.
- * \sa DataArrayInt::findIdFirstEqualTuple
- */
-int DataArrayInt::findIdSequence(const std::vector<int>& vals) const
-{
- checkAllocated();
- int nbOfCompo=getNumberOfComponents();
- if(nbOfCompo!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdSequence : works only for DataArrayInt instance with one component !");
- const int *cptr=getConstPointer();
- std::size_t nbOfVals=getNbOfElems();
- const int *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end());
- if(loc!=cptr+nbOfVals)
- return std::distance(cptr,loc);
- return -1;
-}
-
-/*!
- * This method expects to be called when number of components of this is equal to one.
- * This method returns the tuple id, if it exists, of the first tuple equal to \b value.
- * If not any tuple contains \b value -1 is returned.
- * \sa DataArrayInt::presenceOfValue
- */
-int DataArrayInt::findIdFirstEqual(int value) const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
- const int *cptr=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
- const int *ret=std::find(cptr,cptr+nbOfTuples,value);
- if(ret!=cptr+nbOfTuples)
- return std::distance(cptr,ret);
- return -1;
-}
-
-/*!
- * This method expects to be called when number of components of this is equal to one.
- * This method returns the tuple id, if it exists, of the first tuple so that the value is contained in \b vals.
- * If not any tuple contains one of the values contained in 'vals' -1 is returned.
- * \sa DataArrayInt::presenceOfValue
- */
-int DataArrayInt::findIdFirstEqual(const std::vector<int>& vals) const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
- std::set<int> vals2(vals.begin(),vals.end());
- const int *cptr=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
- for(const int *w=cptr;w!=cptr+nbOfTuples;w++)
- if(vals2.find(*w)!=vals2.end())
- return std::distance(cptr,w);
- return -1;
-}
-
-/*!
- * This method returns the number of values in \a this that are equals to input parameter \a value.
- * This method only works for single component array.
- *
- * \return a value in [ 0, \c this->getNumberOfTuples() )
- *
- * \throw If \a this is not allocated
- *
- */
-int DataArrayInt::count(int value) const
-{
- int ret=0;
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::count : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
- const int *vals=begin();
- int nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++,vals++)
- if(*vals==value)
- ret++;
- return ret;
-}
-
-/*!
- * This method is an extension of DataArrayInt::presenceOfValue method because this method works for DataArrayInt with
- * any number of components excepted 0 (an INTERP_KERNEL::Exception is thrown in this case).
- * This method searches in \b this is there is a tuple that matched the input parameter \b tupl.
- * This method throws an INTERP_KERNEL::Exception if the number of components in \b this mismatches with the size of
- * the input vector. An INTERP_KERNEL::Exception is thrown too if \b this is not allocated.
- * \sa DataArrayInt::findIdFirstEqualTuple
- */
-bool DataArrayInt::presenceOfTuple(const std::vector<int>& tupl) const
-{
- return findIdFirstEqualTuple(tupl)!=-1;
-}
-
-
-/*!
- * Returns \a true if a given value is present within \a this one-dimensional array.
- * \param [in] value - the value to find within \a this array.
- * \return bool - \a true in case if \a value is present within \a this array.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- * \sa findIdFirstEqual()
- */
-bool DataArrayInt::presenceOfValue(int value) const
-{
- return findIdFirstEqual(value)!=-1;
-}
-
-/*!
- * This method expects to be called when number of components of this is equal to one.
- * This method returns true if it exists a tuple so that the value is contained in \b vals.
- * If not any tuple contains one of the values contained in 'vals' false is returned.
- * \sa DataArrayInt::findIdFirstEqual
- */
-bool DataArrayInt::presenceOfValue(const std::vector<int>& vals) const
-{
- return findIdFirstEqual(vals)!=-1;
-}
-
-/*!
- * Accumulates values of each component of \a this array.
- * \param [out] res - an array of length \a this->getNumberOfComponents(), allocated
- * by the caller, that is filled by this method with sum value for each
- * component.
- * \throw If \a this is not allocated.
- */
-void DataArrayInt::accumulate(int *res) const
-{
- checkAllocated();
- const int *ptr=getConstPointer();
- int nbTuple=getNumberOfTuples();
- int nbComps=getNumberOfComponents();
- std::fill(res,res+nbComps,0);
- for(int i=0;i<nbTuple;i++)
- std::transform(ptr+i*nbComps,ptr+(i+1)*nbComps,res,res,std::plus<int>());
-}
-
-int DataArrayInt::accumulate(int compId) const
-{
- checkAllocated();
- const int *ptr=getConstPointer();
- int nbTuple=getNumberOfTuples();
- int nbComps=getNumberOfComponents();
- if(compId<0 || compId>=nbComps)
- throw INTERP_KERNEL::Exception("DataArrayInt::accumulate : Invalid compId specified : No such nb of components !");
- int ret=0;
- for(int i=0;i<nbTuple;i++)
- ret+=ptr[i*nbComps+compId];
- return ret;
-}
-
-/*!
- * This method accumulate using addition tuples in \a this using input index array [ \a bgOfIndex, \a endOfIndex ).
- * The returned array will have same number of components than \a this and number of tuples equal to
- * \c std::distance(bgOfIndex,endOfIndex) \b minus \b one.
- *
- * The input index array is expected to be ascendingly sorted in which the all referenced ids should be in [0, \c this->getNumberOfTuples).
- *
- * \param [in] bgOfIndex - begin (included) of the input index array.
- * \param [in] endOfIndex - end (excluded) of the input index array.
- * \return DataArrayInt * - the new instance having the same number of components than \a this.
- *
- * \throw If bgOfIndex or end is NULL.
- * \throw If input index array is not ascendingly sorted.
- * \throw If there is an id in [ \a bgOfIndex, \a endOfIndex ) not in [0, \c this->getNumberOfTuples).
- * \throw If std::distance(bgOfIndex,endOfIndex)==0.
- */
-DataArrayInt *DataArrayInt::accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const
-{
- if(!bgOfIndex || !endOfIndex)
- throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : input pointer NULL !");
- checkAllocated();
- int nbCompo=getNumberOfComponents();
- int nbOfTuples=getNumberOfTuples();
- int sz=(int)std::distance(bgOfIndex,endOfIndex);
- if(sz<1)
- throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : invalid size of input index array !");
- sz--;
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(sz,nbCompo);
- const int *w=bgOfIndex;
- if(*w<0 || *w>=nbOfTuples)
- throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : The first element of the input index not in [0,nbOfTuples) !");
- const int *srcPt=begin()+(*w)*nbCompo;
- int *tmp=ret->getPointer();
- for(int i=0;i<sz;i++,tmp+=nbCompo,w++)
- {
- std::fill(tmp,tmp+nbCompo,0);
- if(w[1]>=w[0])
- {
- for(int j=w[0];j<w[1];j++,srcPt+=nbCompo)
- {
- if(j>=0 && j<nbOfTuples)
- std::transform(srcPt,srcPt+nbCompo,tmp,tmp,std::plus<int>());
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::accumulatePerChunck : At rank #" << i << " the input index array points to id " << j << " should be in [0," << nbOfTuples << ") !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::accumulatePerChunck : At rank #" << i << " the input index array is not in ascendingly sorted.";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- ret->copyStringInfoFrom(*this);
- return ret.retn();
-}
-
-/*!
- * Returns a new DataArrayInt by concatenating two given arrays, so that (1) the number
- * of tuples in the result array is <em> a1->getNumberOfTuples() + a2->getNumberOfTuples() -
- * offsetA2</em> and (2)
- * the number of component in the result array is same as that of each of given arrays.
- * First \a offsetA2 tuples of \a a2 are skipped and thus are missing from the result array.
- * Info on components is copied from the first of the given arrays. Number of components
- * in the given arrays must be the same.
- * \param [in] a1 - an array to include in the result array.
- * \param [in] a2 - another array to include in the result array.
- * \param [in] offsetA2 - number of tuples of \a a2 to skip.
- * \return DataArrayInt * - the new instance of DataArrayInt.
- * The caller is to delete this result array using decrRef() as it is no more
- * needed.
- * \throw If either \a a1 or \a a2 is NULL.
- * \throw If \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents().
- */
-DataArrayInt *DataArrayInt::Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2)
-{
- if(!a1 || !a2)
- throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : input DataArrayInt instance is NULL !");
- std::size_t nbOfComp(a1->getNumberOfComponents());
- if(nbOfComp!=a2->getNumberOfComponents())
- throw INTERP_KERNEL::Exception("Nb of components mismatch for array Aggregation !");
- std::size_t nbOfTuple1(a1->getNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples());
- MCAuto<DataArrayInt> ret(DataArrayInt::New());
- ret->alloc(nbOfTuple1+nbOfTuple2-offsetA2,nbOfComp);
- int *pt=std::copy(a1->begin(),a1->end(),ret->getPointer());
- std::copy(a2->getConstPointer()+offsetA2*nbOfComp,a2->getConstPointer()+nbOfTuple2*nbOfComp,pt);
- ret->copyStringInfoFrom(*a1);
- return ret.retn();
-}
-
-/*!
- * Returns a new DataArrayInt by concatenating all given arrays, so that (1) the number
- * of tuples in the result array is a sum of the number of tuples of given arrays and (2)
- * the number of component in the result array is same as that of each of given arrays.
- * Info on components is copied from the first of the given arrays. Number of components
- * in the given arrays must be the same.
- * If the number of non null of elements in \a arr is equal to one the returned object is a copy of it
- * not the object itself.
- * \param [in] arr - a sequence of arrays to include in the result array.
- * \return DataArrayInt * - the new instance of DataArrayInt.
- * The caller is to delete this result array using decrRef() as it is no more
- * needed.
- * \throw If all arrays within \a arr are NULL.
- * \throw If getNumberOfComponents() of arrays within \a arr.
- */
-DataArrayInt *DataArrayInt::Aggregate(const std::vector<const DataArrayInt *>& arr)
-{
- std::vector<const DataArrayInt *> a;
- for(std::vector<const DataArrayInt *>::const_iterator it4=arr.begin();it4!=arr.end();it4++)
- if(*it4)
- a.push_back(*it4);
- if(a.empty())
- throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : input list must be NON EMPTY !");
- std::vector<const DataArrayInt *>::const_iterator it=a.begin();
- std::size_t nbOfComp((*it)->getNumberOfComponents()),nbt((*it++)->getNumberOfTuples());
- for(int i=1;it!=a.end();it++,i++)
- {
- if((*it)->getNumberOfComponents()!=nbOfComp)
- throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : Nb of components mismatch for array aggregation !");
- nbt+=(*it)->getNumberOfTuples();
- }
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(nbt,nbOfComp);
- int *pt=ret->getPointer();
- for(it=a.begin();it!=a.end();it++)
- pt=std::copy((*it)->getConstPointer(),(*it)->getConstPointer()+(*it)->getNbOfElems(),pt);
- ret->copyStringInfoFrom(*(a[0]));
- return ret.retn();
-}
-
-/*!
- * This method takes as input a list of DataArrayInt instances \a arrs that represent each a packed index arrays.
- * A packed index array is an allocated array with one component, and at least one tuple. The first element
- * of each array in \a arrs must be 0. Each array in \a arrs is expected to be increasingly monotonic.
- * This method is useful for users that want to aggregate a pair of DataArrayInt representing an indexed data (typically nodal connectivity index in unstructured meshes.
- *
- * \return DataArrayInt * - a new object to be managed by the caller.
- */
-DataArrayInt *DataArrayInt::AggregateIndexes(const std::vector<const DataArrayInt *>& arrs)
-{
- int retSz=1;
- for(std::vector<const DataArrayInt *>::const_iterator it4=arrs.begin();it4!=arrs.end();it4++)
- {
- if(*it4)
- {
- (*it4)->checkAllocated();
- if((*it4)->getNumberOfComponents()!=1)
- {
- std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with nb of compo != 1 at pos " << std::distance(arrs.begin(),it4) << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- int nbTupl=(*it4)->getNumberOfTuples();
- if(nbTupl<1)
- {
- std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with nb of tuples < 1 at pos " << std::distance(arrs.begin(),it4) << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- if((*it4)->front()!=0)
- {
- std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with front value != 0 at pos " << std::distance(arrs.begin(),it4) << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- retSz+=nbTupl-1;
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a null instance at pos " << std::distance(arrs.begin(),it4) << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- if(arrs.empty())
- throw INTERP_KERNEL::Exception("DataArrayInt::AggregateIndexes : input list must be NON EMPTY !");
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(retSz,1);
- int *pt=ret->getPointer(); *pt++=0;
- for(std::vector<const DataArrayInt *>::const_iterator it=arrs.begin();it!=arrs.end();it++)
- pt=std::transform((*it)->begin()+1,(*it)->end(),pt,std::bind2nd(std::plus<int>(),pt[-1]));
- ret->copyStringInfoFrom(*(arrs[0]));
- return ret.retn();
-}
-
-/*!
- * Returns in a single walk in \a this the min value and the max value in \a this.
- * \a this is expected to be single component array.
- *
- * \param [out] minValue - the min value in \a this.
- * \param [out] maxValue - the max value in \a this.
- *
- * \sa getMinValueInArray, getMinValue, getMaxValueInArray, getMaxValue
- */
-void DataArrayInt::getMinMaxValues(int& minValue, int& maxValue) const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::getMinMaxValues : must be applied on DataArrayInt with only one component !");
- int nbTuples(getNumberOfTuples());
- const int *pt(begin());
- minValue=std::numeric_limits<int>::max(); maxValue=-std::numeric_limits<int>::max();
- for(int i=0;i<nbTuples;i++,pt++)
- {
- if(*pt<minValue)
- minValue=*pt;
- if(*pt>maxValue)
- maxValue=*pt;
- }
-}
-
-/*!
- * Modify all elements of \a this array, so that
- * an element _x_ becomes \f$ numerator / x \f$.
- * \warning If an exception is thrown because of presence of 0 element in \a this
- * array, all elements processed before detection of the zero element remain
- * modified.
- * \param [in] numerator - the numerator used to modify array elements.
- * \throw If \a this is not allocated.
- * \throw If there is an element equal to 0 in \a this array.
- */
-void DataArrayInt::applyInv(int numerator)
-{
- checkAllocated();
- int *ptr=getPointer();
- std::size_t nbOfElems=getNbOfElems();
- for(std::size_t i=0;i<nbOfElems;i++,ptr++)
- {
- if(*ptr!=0)
- {
- *ptr=numerator/(*ptr);
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::applyInv : presence of null value in tuple #" << i/getNumberOfComponents() << " component #" << i%getNumberOfComponents();
- oss << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- declareAsNew();
-}
-
-/*!
- * Modify all elements of \a this array, so that
- * an element _x_ becomes \f$ x / val \f$.
- * \param [in] val - the denominator used to modify array elements.
- * \throw If \a this is not allocated.
- * \throw If \a val == 0.
- */
-void DataArrayInt::applyDivideBy(int val)
-{
- if(val==0)
- throw INTERP_KERNEL::Exception("DataArrayInt::applyDivideBy : Trying to divide by 0 !");
- checkAllocated();
- int *ptr=getPointer();
- std::size_t nbOfElems=getNbOfElems();
- std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::divides<int>(),val));
- declareAsNew();
-}
-
-/*!
- * Modify all elements of \a this array, so that
- * an element _x_ becomes <em> x % val </em>.
- * \param [in] val - the divisor used to modify array elements.
- * \throw If \a this is not allocated.
- * \throw If \a val <= 0.
- */
-void DataArrayInt::applyModulus(int val)
-{
- if(val<=0)
- throw INTERP_KERNEL::Exception("DataArrayInt::applyDivideBy : Trying to operate modulus on value <= 0 !");
- checkAllocated();
- int *ptr=getPointer();
- std::size_t nbOfElems=getNbOfElems();
- std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::modulus<int>(),val));
- declareAsNew();
-}
-
-/*!
- * This method works only on data array with one component.
- * This method returns a newly allocated array storing stored ascendantly tuple ids in \b this so that
- * this[*id] in [\b vmin,\b vmax)
- *
- * \param [in] vmin begin of range. This value is included in range (included).
- * \param [in] vmax end of range. This value is \b not included in range (excluded).
- * \return a newly allocated data array that the caller should deal with.
- *
- * \sa DataArrayInt::findIdsNotInRange , DataArrayInt::findIdsStricltyNegative
- */
-DataArrayInt *DataArrayInt::findIdsInRange(int vmin, int vmax) const
-{
- InRange<int> ir(vmin,vmax);
- MCAuto<DataArrayInt> ret(findIdsAdv(ir));
- return ret.retn();
-}
-
-/*!
- * This method works only on data array with one component.
- * This method returns a newly allocated array storing stored ascendantly tuple ids in \b this so that
- * this[*id] \b not in [\b vmin,\b vmax)
- *
- * \param [in] vmin begin of range. This value is \b not included in range (excluded).
- * \param [in] vmax end of range. This value is included in range (included).
- * \return a newly allocated data array that the caller should deal with.
- *
- * \sa DataArrayInt::findIdsInRange , DataArrayInt::findIdsStricltyNegative
- */
-DataArrayInt *DataArrayInt::findIdsNotInRange(int vmin, int vmax) const
-{
- NotInRange<int> nir(vmin,vmax);
- MCAuto<DataArrayInt> ret(findIdsAdv(nir));
- return ret.retn();
-}
-
-/*!
- * This method works only on data array with one component.
- * This method checks that all ids in \b this are in [ \b vmin, \b vmax ). If there is at least one element in \a this not in [ \b vmin, \b vmax ) an exception will be thrown.
- *
- * \param [in] vmin begin of range. This value is included in range (included).
- * \param [in] vmax end of range. This value is \b not included in range (excluded).
- * \return if all ids in \a this are so that (*this)[i]==i for all i in [ 0, \c this->getNumberOfTuples() ). */
-bool DataArrayInt::checkAllIdsInRange(int vmin, int vmax) const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::checkAllIdsInRange : this must have exactly one component !");
- int nbOfTuples=getNumberOfTuples();
- bool ret=true;
- const int *cptr=getConstPointer();
- for(int i=0;i<nbOfTuples;i++,cptr++)
- {
- if(*cptr>=vmin && *cptr<vmax)
- { ret=ret && *cptr==i; }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::checkAllIdsInRange : tuple #" << i << " has value " << *cptr << " should be in [" << vmin << "," << vmax << ") !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- return ret;
-}
-
-/*!
- * Modify all elements of \a this array, so that
- * an element _x_ becomes <em> val % x </em>.
- * \warning If an exception is thrown because of presence of an element <= 0 in \a this
- * array, all elements processed before detection of the zero element remain
- * modified.
- * \param [in] val - the divident used to modify array elements.
- * \throw If \a this is not allocated.
- * \throw If there is an element equal to or less than 0 in \a this array.
- */
-void DataArrayInt::applyRModulus(int val)
-{
- checkAllocated();
- int *ptr=getPointer();
- std::size_t nbOfElems=getNbOfElems();
- for(std::size_t i=0;i<nbOfElems;i++,ptr++)
- {
- if(*ptr>0)
- {
- *ptr=val%(*ptr);
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::applyRModulus : presence of value <=0 in tuple #" << i/getNumberOfComponents() << " component #" << i%getNumberOfComponents();
- oss << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- declareAsNew();
-}
-
-/*!
- * Modify all elements of \a this array, so that
- * an element _x_ becomes <em> val ^ x </em>.
- * \param [in] val - the value used to apply pow on all array elements.
- * \throw If \a this is not allocated.
- * \throw If \a val < 0.
- */
-void DataArrayInt::applyPow(int val)
-{
- checkAllocated();
- if(val<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::applyPow : input pow in < 0 !");
- int *ptr=getPointer();
- std::size_t nbOfElems=getNbOfElems();
- if(val==0)
- {
- std::fill(ptr,ptr+nbOfElems,1);
- return ;
- }
- for(std::size_t i=0;i<nbOfElems;i++,ptr++)
- {
- int tmp=1;
- for(int j=0;j<val;j++)
- tmp*=*ptr;
- *ptr=tmp;
- }
- declareAsNew();
-}
-
-/*!
- * Modify all elements of \a this array, so that
- * an element _x_ becomes \f$ val ^ x \f$.
- * \param [in] val - the value used to apply pow on all array elements.
- * \throw If \a this is not allocated.
- * \throw If there is an element < 0 in \a this array.
- * \warning If an exception is thrown because of presence of 0 element in \a this
- * array, all elements processed before detection of the zero element remain
- * modified.
- */
-void DataArrayInt::applyRPow(int val)
-{
- checkAllocated();
- int *ptr=getPointer();
- std::size_t nbOfElems=getNbOfElems();
- for(std::size_t i=0;i<nbOfElems;i++,ptr++)
- {
- if(*ptr>=0)
- {
- int tmp=1;
- for(int j=0;j<*ptr;j++)
- tmp*=val;
- *ptr=tmp;
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::applyRPow : presence of negative value in tuple #" << i/getNumberOfComponents() << " component #" << i%getNumberOfComponents();
- oss << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- declareAsNew();
-}
-
-/*!
- * Returns a new DataArrayInt which is a minimal partition of elements of \a groups.
- * The i-th item of the result array is an ID of a set of elements belonging to a
- * unique set of groups, which the i-th element is a part of. This set of elements
- * belonging to a unique set of groups is called \a family, so the result array contains
- * IDs of families each element belongs to.
- *
- * \b Example: if we have two groups of elements: \a group1 [0,4] and \a group2 [ 0,1,2 ],
- * then there are 3 families:
- * - \a family1 (with ID 1) contains element [0] belonging to ( \a group1 + \a group2 ),
- * - \a family2 (with ID 2) contains elements [4] belonging to ( \a group1 ),
- * - \a family3 (with ID 3) contains element [1,2] belonging to ( \a group2 ), <br>
- * and the result array contains IDs of families [ 1,3,3,0,2 ]. <br> Note a family ID 0 which
- * stands for the element #3 which is in none of groups.
- *
- * \param [in] groups - sequence of groups of element IDs.
- * \param [in] newNb - total number of elements; it must be more than max ID of element
- * in \a groups.
- * \param [out] fidsOfGroups - IDs of families the elements of each group belong to.
- * \return DataArrayInt * - a new instance of DataArrayInt containing IDs of families
- * each element with ID from range [0, \a newNb ) belongs to. The caller is to
- * delete this array using decrRef() as it is no more needed.
- * \throw If any element ID in \a groups violates condition ( 0 <= ID < \a newNb ).
- */
-DataArrayInt *DataArrayInt::MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups)
-{
- std::vector<const DataArrayInt *> groups2;
- for(std::vector<const DataArrayInt *>::const_iterator it4=groups.begin();it4!=groups.end();it4++)
- if(*it4)
- groups2.push_back(*it4);
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(newNb,1);
- int *retPtr=ret->getPointer();
- std::fill(retPtr,retPtr+newNb,0);
- int fid=1;
- for(std::vector<const DataArrayInt *>::const_iterator iter=groups2.begin();iter!=groups2.end();iter++)
- {
- const int *ptr=(*iter)->getConstPointer();
- std::size_t nbOfElem=(*iter)->getNbOfElems();
- int sfid=fid;
- for(int j=0;j<sfid;j++)
- {
- bool found=false;
- for(std::size_t i=0;i<nbOfElem;i++)
- {
- if(ptr[i]>=0 && ptr[i]<newNb)
- {
- if(retPtr[ptr[i]]==j)
- {
- retPtr[ptr[i]]=fid;
- found=true;
- }
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::MakePartition : In group \"" << (*iter)->getName() << "\" in tuple #" << i << " value = " << ptr[i] << " ! Should be in [0," << newNb;
- oss << ") !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- if(found)
- fid++;
- }
- }
- fidsOfGroups.clear();
- fidsOfGroups.resize(groups2.size());
- int grId=0;
- for(std::vector<const DataArrayInt *>::const_iterator iter=groups2.begin();iter!=groups2.end();iter++,grId++)
- {
- std::set<int> tmp;
- const int *ptr=(*iter)->getConstPointer();
- std::size_t nbOfElem=(*iter)->getNbOfElems();
- for(const int *p=ptr;p!=ptr+nbOfElem;p++)
- tmp.insert(retPtr[*p]);
- fidsOfGroups[grId].insert(fidsOfGroups[grId].end(),tmp.begin(),tmp.end());
- }
- return ret.retn();
-}
-
-/*!
- * Returns a new DataArrayInt which contains all elements of given one-dimensional
- * arrays. The result array does not contain any duplicates and its values
- * are sorted in ascending order.
- * \param [in] arr - sequence of DataArrayInt's to unite.
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- * array using decrRef() as it is no more needed.
- * \throw If any \a arr[i] is not allocated.
- * \throw If \a arr[i]->getNumberOfComponents() != 1.
- */
-DataArrayInt *DataArrayInt::BuildUnion(const std::vector<const DataArrayInt *>& arr)
-{
- std::vector<const DataArrayInt *> a;
- for(std::vector<const DataArrayInt *>::const_iterator it4=arr.begin();it4!=arr.end();it4++)
- if(*it4)
- a.push_back(*it4);
- for(std::vector<const DataArrayInt *>::const_iterator it=a.begin();it!=a.end();it++)
- {
- (*it)->checkAllocated();
- if((*it)->getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::BuildUnion : only single component allowed !");
- }
- //
- std::set<int> r;
- for(std::vector<const DataArrayInt *>::const_iterator it=a.begin();it!=a.end();it++)
- {
- const int *pt=(*it)->getConstPointer();
- int nbOfTuples=(*it)->getNumberOfTuples();
- r.insert(pt,pt+nbOfTuples);
- }
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)r.size(),1);
- std::copy(r.begin(),r.end(),ret->getPointer());
- return ret;
-}
-
-/*!
- * Returns a new DataArrayInt which contains elements present in each of given one-dimensional
- * arrays. The result array does not contain any duplicates and its values
- * are sorted in ascending order.
- * \param [in] arr - sequence of DataArrayInt's to intersect.
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- * array using decrRef() as it is no more needed.
- * \throw If any \a arr[i] is not allocated.
- * \throw If \a arr[i]->getNumberOfComponents() != 1.
- */
-DataArrayInt *DataArrayInt::BuildIntersection(const std::vector<const DataArrayInt *>& arr)
-{
- std::vector<const DataArrayInt *> a;
- for(std::vector<const DataArrayInt *>::const_iterator it4=arr.begin();it4!=arr.end();it4++)
- if(*it4)
- a.push_back(*it4);
- for(std::vector<const DataArrayInt *>::const_iterator it=a.begin();it!=a.end();it++)
- {
- (*it)->checkAllocated();
- if((*it)->getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::BuildIntersection : only single component allowed !");
- }
- //
- std::set<int> r;
- for(std::vector<const DataArrayInt *>::const_iterator it=a.begin();it!=a.end();it++)
- {
- const int *pt=(*it)->getConstPointer();
- int nbOfTuples=(*it)->getNumberOfTuples();
- std::set<int> s1(pt,pt+nbOfTuples);
- if(it!=a.begin())
- {
- std::set<int> r2;
- std::set_intersection(r.begin(),r.end(),s1.begin(),s1.end(),inserter(r2,r2.end()));
- r=r2;
- }
- else
- r=s1;
- }
- DataArrayInt *ret(DataArrayInt::New());
- ret->alloc((int)r.size(),1);
- std::copy(r.begin(),r.end(),ret->getPointer());
- return ret;
-}
-
-/// @cond INTERNAL
-namespace MEDCouplingImpl
-{
- class OpSwitchedOn
- {
- public:
- OpSwitchedOn(int *pt):_pt(pt),_cnt(0) { }
- void operator()(const bool& b) { if(b) *_pt++=_cnt; _cnt++; }
- private:
- int *_pt;
- int _cnt;
- };
-
- class OpSwitchedOff
- {
- public:
- OpSwitchedOff(int *pt):_pt(pt),_cnt(0) { }
- void operator()(const bool& b) { if(!b) *_pt++=_cnt; _cnt++; }
- private:
- int *_pt;
- int _cnt;
- };
-}
-/// @endcond
-
-/*!
- * This method returns the list of ids in ascending mode so that v[id]==true.
- */
-DataArrayInt *DataArrayInt::BuildListOfSwitchedOn(const std::vector<bool>& v)
-{
- int sz((int)std::count(v.begin(),v.end(),true));
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
- std::for_each(v.begin(),v.end(),MEDCouplingImpl::OpSwitchedOn(ret->getPointer()));
- return ret.retn();
-}
-
-/*!
- * This method returns the list of ids in ascending mode so that v[id]==false.
- */
-DataArrayInt *DataArrayInt::BuildListOfSwitchedOff(const std::vector<bool>& v)
-{
- int sz((int)std::count(v.begin(),v.end(),false));
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
- std::for_each(v.begin(),v.end(),MEDCouplingImpl::OpSwitchedOff(ret->getPointer()));
- return ret.retn();
-}
-
-/*!
- * This method allows to put a vector of vector of integer into a more compact data structure (skyline).
- * This method is not available into python because no available optimized data structure available to map std::vector< std::vector<int> >.
- *
- * \param [in] v the input data structure to be translate into skyline format.
- * \param [out] data the first element of the skyline format. The user is expected to deal with newly allocated array.
- * \param [out] dataIndex the second element of the skyline format.
- */
-void DataArrayInt::PutIntoToSkylineFrmt(const std::vector< std::vector<int> >& v, DataArrayInt *& data, DataArrayInt *& dataIndex)
-{
- int sz((int)v.size());
- MCAuto<DataArrayInt> ret0(DataArrayInt::New()),ret1(DataArrayInt::New());
- ret1->alloc(sz+1,1);
- int *pt(ret1->getPointer()); *pt=0;
- for(int i=0;i<sz;i++,pt++)
- pt[1]=pt[0]+(int)v[i].size();
- ret0->alloc(ret1->back(),1);
- pt=ret0->getPointer();
- for(int i=0;i<sz;i++)
- pt=std::copy(v[i].begin(),v[i].end(),pt);
- data=ret0.retn(); dataIndex=ret1.retn();
-}
-
-/*!
- * Returns a new DataArrayInt which contains a complement of elements of \a this
- * one-dimensional array. I.e. the result array contains all elements from the range [0,
- * \a nbOfElement) not present in \a this array.
- * \param [in] nbOfElement - maximal size of the result array.
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- * array using decrRef() as it is no more needed.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- * \throw If any element \a x of \a this array violates condition ( 0 <= \a x < \a
- * nbOfElement ).
- */
-DataArrayInt *DataArrayInt::buildComplement(int nbOfElement) const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : only single component allowed !");
- std::vector<bool> tmp(nbOfElement);
- const int *pt=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
- for(const int *w=pt;w!=pt+nbOfTuples;w++)
- if(*w>=0 && *w<nbOfElement)
- tmp[*w]=true;
- else
- throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : an element is not in valid range : [0,nbOfElement) !");
- int nbOfRetVal=(int)std::count(tmp.begin(),tmp.end(),false);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc(nbOfRetVal,1);
- int j=0;
- int *retPtr=ret->getPointer();
- for(int i=0;i<nbOfElement;i++)
- if(!tmp[i])
- retPtr[j++]=i;
- return ret;
-}
-
-/*!
- * Returns a new DataArrayInt containing elements of \a this one-dimensional missing
- * from an \a other one-dimensional array.
- * \param [in] other - a DataArrayInt containing elements not to include in the result array.
- * \return DataArrayInt * - a new instance of DataArrayInt with one component. The
- * caller is to delete this array using decrRef() as it is no more needed.
- * \throw If \a other is NULL.
- * \throw If \a other is not allocated.
- * \throw If \a other->getNumberOfComponents() != 1.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- * \sa DataArrayInt::buildSubstractionOptimized()
- */
-DataArrayInt *DataArrayInt::buildSubstraction(const DataArrayInt *other) const
-{
- if(!other)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : DataArrayInt pointer in input is NULL !");
- checkAllocated();
- other->checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed !");
- if(other->getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed for other type !");
- const int *pt=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
- std::set<int> s1(pt,pt+nbOfTuples);
- pt=other->getConstPointer();
- nbOfTuples=other->getNumberOfTuples();
- std::set<int> s2(pt,pt+nbOfTuples);
- std::vector<int> r;
- std::set_difference(s1.begin(),s1.end(),s2.begin(),s2.end(),std::back_insert_iterator< std::vector<int> >(r));
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)r.size(),1);
- std::copy(r.begin(),r.end(),ret->getPointer());
- return ret;
-}
-
-/*!
- * \a this is expected to have one component and to be sorted ascendingly (as for \a other).
- * \a other is expected to be a part of \a this. If not DataArrayInt::buildSubstraction should be called instead.
- *
- * \param [in] other an array with one component and expected to be sorted ascendingly.
- * \ret list of ids in \a this but not in \a other.
- * \sa DataArrayInt::buildSubstraction
- */
-DataArrayInt *DataArrayInt::buildSubstractionOptimized(const DataArrayInt *other) const
-{
- static const char *MSG="DataArrayInt::buildSubstractionOptimized : only single component allowed !";
- if(!other) throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstractionOptimized : NULL input array !");
- checkAllocated(); other->checkAllocated();
- if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception(MSG);
- if(other->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception(MSG);
- const int *pt1Bg(begin()),*pt1End(end()),*pt2Bg(other->begin()),*pt2End(other->end());
- const int *work1(pt1Bg),*work2(pt2Bg);
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- for(;work1!=pt1End;work1++)
- {
- if(work2!=pt2End && *work1==*work2)
- work2++;
- else
- ret->pushBackSilent(*work1);
- }
- return ret.retn();
-}
-
-
-/*!
- * Returns a new DataArrayInt which contains all elements of \a this and a given
- * one-dimensional arrays. The result array does not contain any duplicates
- * and its values are sorted in ascending order.
- * \param [in] other - an array to unite with \a this one.
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- * array using decrRef() as it is no more needed.
- * \throw If \a this or \a other is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- * \throw If \a other->getNumberOfComponents() != 1.
- */
-DataArrayInt *DataArrayInt::buildUnion(const DataArrayInt *other) const
-{
- std::vector<const DataArrayInt *>arrs(2);
- arrs[0]=this; arrs[1]=other;
- return BuildUnion(arrs);
-}
-
-
-/*!
- * Returns a new DataArrayInt which contains elements present in both \a this and a given
- * one-dimensional arrays. The result array does not contain any duplicates
- * and its values are sorted in ascending order.
- * \param [in] other - an array to intersect with \a this one.
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- * array using decrRef() as it is no more needed.
- * \throw If \a this or \a other is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- * \throw If \a other->getNumberOfComponents() != 1.
- */
-DataArrayInt *DataArrayInt::buildIntersection(const DataArrayInt *other) const
-{
- std::vector<const DataArrayInt *>arrs(2);
- arrs[0]=this; arrs[1]=other;
- return BuildIntersection(arrs);
-}
-
-/*!
- * This method can be applied on allocated with one component DataArrayInt instance.
- * This method is typically relevant for sorted arrays. All consecutive duplicated items in \a this will appear only once in returned DataArrayInt instance.
- * Example : if \a this contains [1,2,2,3,3,3,3,4,5,5,7,7,7,19] the returned array will contain [1,2,3,4,5,7,19]
- *
- * \return a newly allocated array that contain the result of the unique operation applied on \a this.
- * \throw if \a this is not allocated or if \a this has not exactly one component.
- * \sa DataArrayInt::buildUniqueNotSorted
- */
-DataArrayInt *DataArrayInt::buildUnique() const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildUnique : only single component allowed !");
- int nbOfTuples=getNumberOfTuples();
- MCAuto<DataArrayInt> tmp=deepCopy();
- int *data=tmp->getPointer();
- int *last=std::unique(data,data+nbOfTuples);
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(std::distance(data,last),1);
- std::copy(data,last,ret->getPointer());
- return ret.retn();
-}
-
-/*!
- * This method can be applied on allocated with one component DataArrayInt instance.
- * This method keep elements only once by keeping the same order in \a this that is not expected to be sorted.
- *
- * \return a newly allocated array that contain the result of the unique operation applied on \a this.
- *
- * \throw if \a this is not allocated or if \a this has not exactly one component.
- *
- * \sa DataArrayInt::buildUnique
- */
-DataArrayInt *DataArrayInt::buildUniqueNotSorted() const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildUniqueNotSorted : only single component allowed !");
- int minVal,maxVal;
- getMinMaxValues(minVal,maxVal);
- std::vector<bool> b(maxVal-minVal+1,false);
- const int *ptBg(begin()),*endBg(end());
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- for(const int *pt=ptBg;pt!=endBg;pt++)
- {
- if(!b[*pt-minVal])
- {
- ret->pushBackSilent(*pt);
- b[*pt-minVal]=true;
- }
- }
- ret->copyStringInfoFrom(*this);
- return ret.retn();
-}
-
-/*!
- * Returns a new DataArrayInt which contains size of every of groups described by \a this
- * "index" array. Such "index" array is returned for example by
- * \ref MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity
- * "MEDCouplingUMesh::buildDescendingConnectivity" and
- * \ref MEDCoupling::MEDCouplingUMesh::getNodalConnectivityIndex
- * "MEDCouplingUMesh::getNodalConnectivityIndex" etc.
- * This method performs the reverse operation of DataArrayInt::computeOffsetsFull.
- * \return DataArrayInt * - a new instance of DataArrayInt, whose number of tuples
- * equals to \a this->getNumberOfComponents() - 1, and number of components is 1.
- * The caller is to delete this array using decrRef() as it is no more needed.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- * \throw If \a this->getNumberOfTuples() < 2.
- *
- * \b Example: <br>
- * - this contains [1,3,6,7,7,9,15]
- * - result array contains [2,3,1,0,2,6],
- * where 2 = 3 - 1, 3 = 6 - 3, 1 = 7 - 6 etc.
- *
- * \sa DataArrayInt::computeOffsetsFull
- */
-DataArrayInt *DataArrayInt::deltaShiftIndex() const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : only single component allowed !");
- int nbOfTuples=getNumberOfTuples();
- if(nbOfTuples<2)
- throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : 1 tuple at least must be present in 'this' !");
- const int *ptr=getConstPointer();
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc(nbOfTuples-1,1);
- int *out=ret->getPointer();
- std::transform(ptr+1,ptr+nbOfTuples,ptr,out,std::minus<int>());
- return ret;
-}
-
-/*!
- * Modifies \a this one-dimensional array so that value of each element \a x
- * of \a this array (\a a) is computed as \f$ x_i = \sum_{j=0}^{i-1} a[ j ] \f$.
- * Or: for each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number of tuples
- * and components remains the same.<br>
- * This method is useful for allToAllV in MPI with contiguous policy. This method
- * differs from computeOffsetsFull() in that the number of tuples is \b not changed by
- * this one.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- *
- * \b Example: <br>
- * - Before \a this contains [3,5,1,2,0,8]
- * - After \a this contains [0,3,8,9,11,11]<br>
- * Note that the last element 19 = 11 + 8 is missing because size of \a this
- * array is retained and thus there is no space to store the last element.
- */
-void DataArrayInt::computeOffsets()
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsets : only single component allowed !");
- int nbOfTuples=getNumberOfTuples();
- if(nbOfTuples==0)
- return ;
- int *work=getPointer();
- int tmp=work[0];
- work[0]=0;
- for(int i=1;i<nbOfTuples;i++)
- {
- int tmp2=work[i];
- work[i]=work[i-1]+tmp;
- tmp=tmp2;
- }
- declareAsNew();
-}
-
-
-/*!
- * Modifies \a this one-dimensional array so that value of each element \a x
- * of \a this array (\a a) is computed as \f$ x_i = \sum_{j=0}^{i-1} a[ j ] \f$.
- * Or: for each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number
- * components remains the same and number of tuples is inceamented by one.<br>
- * This method is useful for allToAllV in MPI with contiguous policy. This method
- * differs from computeOffsets() in that the number of tuples is changed by this one.
- * This method performs the reverse operation of DataArrayInt::deltaShiftIndex.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- *
- * \b Example: <br>
- * - Before \a this contains [3,5,1,2,0,8]
- * - After \a this contains [0,3,8,9,11,11,19]<br>
- * \sa DataArrayInt::deltaShiftIndex
- */
-void DataArrayInt::computeOffsetsFull()
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsetsFull : only single component allowed !");
- int nbOfTuples=getNumberOfTuples();
- int *ret=(int *)malloc((nbOfTuples+1)*sizeof(int));
- const int *work=getConstPointer();
- ret[0]=0;
- for(int i=0;i<nbOfTuples;i++)
- ret[i+1]=work[i]+ret[i];
- useArray(ret,true,DeallocType::C_DEALLOC,nbOfTuples+1,1);
- declareAsNew();
-}
-
-/*!
- * Returns two new DataArrayInt instances whose contents is computed from that of \a this and \a listOfIds arrays as follows.
- * \a this is expected to be an offset format ( as returned by DataArrayInt::computeOffsetsFull ) that is to say with one component
- * and ** sorted strictly increasingly **. \a listOfIds is expected to be sorted ascendingly (not strictly needed for \a listOfIds).
- * This methods searches in \a this, considered as a set of contiguous \c this->getNumberOfComponents() ranges, all ids in \a listOfIds
- * filling completely one of the ranges in \a this.
- *
- * \param [in] listOfIds a list of ids that has to be sorted ascendingly.
- * \param [out] rangeIdsFetched the range ids fetched
- * \param [out] idsInInputListThatFetch contains the list of ids in \a listOfIds that are \b fully included in a range in \a this. So
- * \a idsInInputListThatFetch is a part of input \a listOfIds.
- *
- * \sa DataArrayInt::computeOffsetsFull
- *
- * \b Example: <br>
- * - \a this : [0,3,7,9,15,18]
- * - \a listOfIds contains [0,1,2,3,7,8,15,16,17]
- * - \a rangeIdsFetched result array: [0,2,4]
- * - \a idsInInputListThatFetch result array: [0,1,2,7,8,15,16,17]
- * In this example id 3 in input \a listOfIds is alone so it do not appear in output \a idsInInputListThatFetch.
- * <br>
- */
-void DataArrayInt::findIdsRangesInListOfIds(const DataArrayInt *listOfIds, DataArrayInt *& rangeIdsFetched, DataArrayInt *& idsInInputListThatFetch) const
-{
- if(!listOfIds)
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : input list of ids is null !");
- listOfIds->checkAllocated(); checkAllocated();
- if(listOfIds->getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : input list of ids must have exactly one component !");
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : this must have exactly one component !");
- MCAuto<DataArrayInt> ret0=DataArrayInt::New(); ret0->alloc(0,1);
- MCAuto<DataArrayInt> ret1=DataArrayInt::New(); ret1->alloc(0,1);
- const int *tupEnd(listOfIds->end()),*offBg(begin()),*offEnd(end()-1);
- const int *tupPtr(listOfIds->begin()),*offPtr(offBg);
- while(tupPtr!=tupEnd && offPtr!=offEnd)
- {
- if(*tupPtr==*offPtr)
- {
- int i=offPtr[0];
- while(i<offPtr[1] && *tupPtr==i && tupPtr!=tupEnd) { i++; tupPtr++; }
- if(i==offPtr[1])
- {
- ret0->pushBackSilent((int)std::distance(offBg,offPtr));
- ret1->pushBackValsSilent(tupPtr-(offPtr[1]-offPtr[0]),tupPtr);
- offPtr++;
- }
- }
- else
- { if(*tupPtr<*offPtr) tupPtr++; else offPtr++; }
- }
- rangeIdsFetched=ret0.retn();
- idsInInputListThatFetch=ret1.retn();
-}
-
-/*!
- * Returns a new DataArrayInt whose contents is computed from that of \a this and \a
- * offsets arrays as follows. \a offsets is a one-dimensional array considered as an
- * "index" array of a "iota" array, thus, whose each element gives an index of a group
- * beginning within the "iota" array. And \a this is a one-dimensional array
- * considered as a selector of groups described by \a offsets to include into the result array.
- * \throw If \a offsets is NULL.
- * \throw If \a offsets is not allocated.
- * \throw If \a offsets->getNumberOfComponents() != 1.
- * \throw If \a offsets is not monotonically increasing.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- * \throw If any element of \a this is not a valid index for \a offsets array.
- *
- * \b Example: <br>
- * - \a this: [0,2,3]
- * - \a offsets: [0,3,6,10,14,20]
- * - result array: [0,1,2,6,7,8,9,10,11,12,13] == <br>
- * \c range(0,3) + \c range(6,10) + \c range(10,14) ==<br>
- * \c range( \a offsets[ \a this[0] ], offsets[ \a this[0]+1 ]) +
- * \c range( \a offsets[ \a this[1] ], offsets[ \a this[1]+1 ]) +
- * \c range( \a offsets[ \a this[2] ], offsets[ \a this[2]+1 ])
- */
-DataArrayInt *DataArrayInt::buildExplicitArrByRanges(const DataArrayInt *offsets) const
-{
- if(!offsets)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : DataArrayInt pointer in input is NULL !");
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : only single component allowed !");
- offsets->checkAllocated();
- if(offsets->getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : input array should have only single component !");
- int othNbTuples=offsets->getNumberOfTuples()-1;
- int nbOfTuples=getNumberOfTuples();
- int retNbOftuples=0;
- const int *work=getConstPointer();
- const int *offPtr=offsets->getConstPointer();
- for(int i=0;i<nbOfTuples;i++)
- {
- int val=work[i];
- if(val>=0 && val<othNbTuples)
- {
- int delta=offPtr[val+1]-offPtr[val];
- if(delta>=0)
- retNbOftuples+=delta;
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrByRanges : Tuple #" << val << " of offset array has a delta < 0 !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrByRanges : Tuple #" << i << " in this contains " << val;
- oss << " whereas offsets array is of size " << othNbTuples+1 << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(retNbOftuples,1);
- int *retPtr=ret->getPointer();
- for(int i=0;i<nbOfTuples;i++)
- {
- int val=work[i];
- int start=offPtr[val];
- int off=offPtr[val+1]-start;
- for(int j=0;j<off;j++,retPtr++)
- *retPtr=start+j;
- }
- return ret.retn();
-}
-
-/*!
- * Returns a new DataArrayInt whose contents is computed using \a this that must be a
- * scaled array (monotonically increasing).
-from that of \a this and \a
- * offsets arrays as follows. \a offsets is a one-dimensional array considered as an
- * "index" array of a "iota" array, thus, whose each element gives an index of a group
- * beginning within the "iota" array. And \a this is a one-dimensional array
- * considered as a selector of groups described by \a offsets to include into the result array.
- * \throw If \a is NULL.
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- * \throw If \a this->getNumberOfTuples() == 0.
- * \throw If \a this is not monotonically increasing.
- * \throw If any element of ids in ( \a bg \a stop \a step ) points outside the scale in \a this.
- *
- * \b Example: <br>
- * - \a bg , \a stop and \a step : (0,5,2)
- * - \a this: [0,3,6,10,14,20]
- * - result array: [0,0,0, 2,2,2,2, 4,4,4,4,4,4] == <br>
- */
-DataArrayInt *DataArrayInt::buildExplicitArrOfSliceOnScaledArr(int bg, int stop, int step) const
-{
- if(!isAllocated())
- throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : not allocated array !");
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : number of components is expected to be equal to one !");
- int nbOfTuples(getNumberOfTuples());
- if(nbOfTuples==0)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : number of tuples must be != 0 !");
- const int *ids(begin());
- int nbOfEltsInSlc(GetNumberOfItemGivenBESRelative(bg,stop,step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr")),sz(0),pos(bg);
- for(int i=0;i<nbOfEltsInSlc;i++,pos+=step)
- {
- if(pos>=0 && pos<nbOfTuples-1)
- {
- int delta(ids[pos+1]-ids[pos]);
- sz+=delta;
- if(delta<0)
- {
- std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrOfSliceOnScaledArr : At pos #" << i << " of input slice, value is " << pos << " and at this pos this is not monotonically increasing !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrOfSliceOnScaledArr : At pos #" << i << " of input slice, value is " << pos << " should be in [0," << nbOfTuples-1 << ") !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
- int *retPtr(ret->getPointer());
- pos=bg;
- for(int i=0;i<nbOfEltsInSlc;i++,pos+=step)
- {
- int delta(ids[pos+1]-ids[pos]);
- for(int j=0;j<delta;j++,retPtr++)
- *retPtr=pos;
- }
- return ret.retn();
-}
-
-/*!
- * Given in input ranges \a ranges, it returns a newly allocated DataArrayInt instance having one component and the same number of tuples than \a this.
- * For each tuple at place **i** in \a this it tells which is the first range in \a ranges that contains value \c this->getIJ(i,0) and put the result
- * in tuple **i** of returned DataArrayInt.
- * If ranges overlapped (in theory it should not) this method do not detect it and always returns the first range.
- *
- * For example if \a this contains : [1,24,7,8,10,17] and \a ranges contains [(0,3),(3,8),(8,15),(15,22),(22,30)]
- * The return DataArrayInt will contain : **[0,4,1,2,2,3]**
- *
- * \param [in] ranges typically come from output of MEDCouplingUMesh::ComputeRangesFromTypeDistribution. Each range is specified like this : 1st component is
- * for lower value included and 2nd component is the upper value of corresponding range **excluded**.
- * \throw If offsets is a null pointer or does not have 2 components or if \a this is not allocated or \a this do not have exactly one component. To finish an exception
- * is thrown if no ranges in \a ranges contains value in \a this.
- *
- * \sa DataArrayInt::findIdInRangeForEachTuple
- */
-DataArrayInt *DataArrayInt::findRangeIdForEachTuple(const DataArrayInt *ranges) const
-{
- if(!ranges)
- throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : null input pointer !");
- if(ranges->getNumberOfComponents()!=2)
- throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : input DataArrayInt instance should have 2 components !");
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : this should have only one component !");
- int nbTuples=getNumberOfTuples();
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTuples,1);
- int nbOfRanges=ranges->getNumberOfTuples();
- const int *rangesPtr=ranges->getConstPointer();
- int *retPtr=ret->getPointer();
- const int *inPtr=getConstPointer();
- for(int i=0;i<nbTuples;i++,retPtr++)
- {
- int val=inPtr[i];
- bool found=false;
- for(int j=0;j<nbOfRanges && !found;j++)
- if(val>=rangesPtr[2*j] && val<rangesPtr[2*j+1])
- { *retPtr=j; found=true; }
- if(found)
- continue;
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::findRangeIdForEachTuple : tuple #" << i << " not found by any ranges !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- return ret.retn();
-}
-
-/*!
- * Given in input ranges \a ranges, it returns a newly allocated DataArrayInt instance having one component and the same number of tuples than \a this.
- * For each tuple at place **i** in \a this it tells which is the sub position of the first range in \a ranges that contains value \c this->getIJ(i,0) and put the result
- * in tuple **i** of returned DataArrayInt.
- * If ranges overlapped (in theory it should not) this method do not detect it and always returns the sub position of the first range.
- *
- * For example if \a this contains : [1,24,7,8,10,17] and \a ranges contains [(0,3),(3,8),(8,15),(15,22),(22,30)]
- * The return DataArrayInt will contain : **[1,2,4,0,2,2]**
- * This method is often called in pair with DataArrayInt::findRangeIdForEachTuple method.
- *
- * \param [in] ranges typically come from output of MEDCouplingUMesh::ComputeRangesFromTypeDistribution. Each range is specified like this : 1st component is
- * for lower value included and 2nd component is the upper value of corresponding range **excluded**.
- * \throw If offsets is a null pointer or does not have 2 components or if \a this is not allocated or \a this do not have exactly one component. To finish an exception
- * is thrown if no ranges in \a ranges contains value in \a this.
- * \sa DataArrayInt::findRangeIdForEachTuple
- */
-DataArrayInt *DataArrayInt::findIdInRangeForEachTuple(const DataArrayInt *ranges) const
-{
- if(!ranges)
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : null input pointer !");
- if(ranges->getNumberOfComponents()!=2)
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : input DataArrayInt instance should have 2 components !");
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : this should have only one component !");
- int nbTuples=getNumberOfTuples();
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTuples,1);
- int nbOfRanges=ranges->getNumberOfTuples();
- const int *rangesPtr=ranges->getConstPointer();
- int *retPtr=ret->getPointer();
- const int *inPtr=getConstPointer();
- for(int i=0;i<nbTuples;i++,retPtr++)
- {
- int val=inPtr[i];
- bool found=false;
- for(int j=0;j<nbOfRanges && !found;j++)
- if(val>=rangesPtr[2*j] && val<rangesPtr[2*j+1])
- { *retPtr=val-rangesPtr[2*j]; found=true; }
- if(found)
- continue;
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::findIdInRangeForEachTuple : tuple #" << i << " not found by any ranges !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- return ret.retn();
-}
-
-/*!
- * \b WARNING this method is a \b non \a const \b method. This method works tuple by tuple. Each tuple is expected to be pairs (number of components must be equal to 2).
- * This method rearrange each pair in \a this so that, tuple with id \b tid will be after the call \c this->getIJ(tid,0)==this->getIJ(tid-1,1) and \c this->getIJ(tid,1)==this->getIJ(tid+1,0).
- * If it is impossible to reach such condition an exception will be thrown ! \b WARNING In case of throw \a this can be partially modified !
- * If this method has correctly worked, \a this will be able to be considered as a linked list.
- * This method does nothing if number of tuples is lower of equal to 1.
- *
- * This method is useful for users having an unstructured mesh having only SEG2 to rearrange internally the connectivity without any coordinates consideration.
- *
- * \sa MEDCouplingUMesh::orderConsecutiveCells1D, DataArrayInt::fromLinkedListOfPairToList
- */
-void DataArrayInt::sortEachPairToMakeALinkedList()
-{
- checkAllocated();
- if(getNumberOfComponents()!=2)
- throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : Only works on DataArrayInt instance with nb of components equal to 2 !");
- int nbOfTuples(getNumberOfTuples());
- if(nbOfTuples<=1)
- return ;
- int *conn(getPointer());
- for(int i=1;i<nbOfTuples;i++,conn+=2)
- {
- if(i>1)
- {
- if(conn[2]==conn[3])
- {
- std::ostringstream oss; oss << "DataArrayInt::sortEachPairToMakeALinkedList : In the tuple #" << i << " presence of a pair filled with same ids !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- if(conn[2]!=conn[1] && conn[3]==conn[1] && conn[2]!=conn[0])
- std::swap(conn[2],conn[3]);
- //not(conn[2]==conn[1] && conn[3]!=conn[1] && conn[3]!=conn[0])
- if(conn[2]!=conn[1] || conn[3]==conn[1] || conn[3]==conn[0])
- {
- std::ostringstream oss; oss << "DataArrayInt::sortEachPairToMakeALinkedList : In the tuple #" << i << " something is invalid !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- else
- {
- if(conn[0]==conn[1] || conn[2]==conn[3])
- throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : In the 2 first tuples presence of a pair filled with same ids !");
- int tmp[4];
- std::set<int> s;
- s.insert(conn,conn+4);
- if(s.size()!=3)
- throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : This can't be considered as a linked list regarding 2 first tuples !");
- if(std::count(conn,conn+4,conn[0])==2)
- {
- tmp[0]=conn[1];
- tmp[1]=conn[0];
- tmp[2]=conn[0];
- if(conn[2]==conn[0])
- { tmp[3]=conn[3]; }
- else
- { tmp[3]=conn[2];}
- std::copy(tmp,tmp+4,conn);
- }
- else
- {//here we are sure to have (std::count(conn,conn+4,conn[1])==2)
- if(conn[1]==conn[3])
- std::swap(conn[2],conn[3]);
- }
- }
- }
-}
-
-/*!
- * \a this is expected to be a correctly linked list of pairs.
- *
- * \sa DataArrayInt::sortEachPairToMakeALinkedList
- */
-MCAuto<DataArrayInt> DataArrayInt::fromLinkedListOfPairToList() const
-{
- checkAllocated();
- checkNbOfComps(2,"DataArrayInt::fromLinkedListOfPairToList : this is expected to have 2 components");
- int nbTuples(getNumberOfTuples());
- if(nbTuples<1)
- throw INTERP_KERNEL::Exception("DataArrayInt::fromLinkedListOfPairToList : no tuples in this ! Not a linked list !");
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbTuples+1,1);
- const int *thisPtr(begin());
- int *retPtr(ret->getPointer());
- retPtr[0]=thisPtr[0];
- for(int i=0;i<nbTuples;i++)
- {
- retPtr[i+1]=thisPtr[2*i+1];
- if(i<nbTuples-1)
- if(thisPtr[2*i+1]!=thisPtr[2*(i+1)+0])
- {
- std::ostringstream oss; oss << "DataArrayInt::fromLinkedListOfPairToList : this is not a proper linked list of pair. The link is broken between tuple #" << i << " and tuple #" << i+1 << " ! Call sortEachPairToMakeALinkedList ?";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- }
- return ret;
-}
-
-/*!
- * This method returns all different values found in \a this. This method throws if \a this has not been allocated.
- * But the number of components can be different from one.
- * \return a newly allocated array (that should be dealt by the caller) containing different values in \a this.
- */
-DataArrayInt *DataArrayInt::getDifferentValues() const
-{
- checkAllocated();
- std::set<int> ret;
- ret.insert(begin(),end());
- MCAuto<DataArrayInt> ret2=DataArrayInt::New(); ret2->alloc((int)ret.size(),1);
- std::copy(ret.begin(),ret.end(),ret2->getPointer());
- return ret2.retn();
-}
-
-/*!
- * This method is a refinement of DataArrayInt::getDifferentValues because it returns not only different values in \a this but also, for each of
- * them it tells which tuple id have this id.
- * This method works only on arrays with one component (if it is not the case call DataArrayInt::rearrange(1) ).
- * This method returns two arrays having same size.
- * The instances of DataArrayInt in the returned vector have be specially allocated and computed by this method. Each of them should be dealt by the caller of this method.
- * Example : if this is equal to [1,0,1,2,0,2,2,-3,2] -> differentIds=[-3,0,1,2] and returned array will be equal to [[7],[1,4],[0,2],[3,5,6,8]]
- */
-std::vector<DataArrayInt *> DataArrayInt::partitionByDifferentValues(std::vector<int>& differentIds) const
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::partitionByDifferentValues : this should have only one component !");
- int id=0;
- std::map<int,int> m,m2,m3;
- for(const int *w=begin();w!=end();w++)
- m[*w]++;
- differentIds.resize(m.size());
- std::vector<DataArrayInt *> ret(m.size());
- std::vector<int *> retPtr(m.size());
- for(std::map<int,int>::const_iterator it=m.begin();it!=m.end();it++,id++)
- {
- m2[(*it).first]=id;
- ret[id]=DataArrayInt::New();
- ret[id]->alloc((*it).second,1);
- retPtr[id]=ret[id]->getPointer();
- differentIds[id]=(*it).first;
- }
- id=0;
- for(const int *w=begin();w!=end();w++,id++)
- {
- retPtr[m2[*w]][m3[*w]++]=id;
- }
- return ret;
-}
-
-/*!
- * This method split ids in [0, \c this->getNumberOfTuples() ) using \a this array as a field of weight (>=0 each).
- * The aim of this method is to return a set of \a nbOfSlices chunk of contiguous ids as balanced as possible.
- *
- * \param [in] nbOfSlices - number of slices expected.
- * \return - a vector having a size equal to \a nbOfSlices giving the start (included) and the stop (excluded) of each chunks.
- *
- * \sa DataArray::GetSlice
- * \throw If \a this is not allocated or not with exactly one component.
- * \throw If an element in \a this if < 0.
- */
-std::vector< std::pair<int,int> > DataArrayInt::splitInBalancedSlices(int nbOfSlices) const
-{
- if(!isAllocated() || getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : this array should have number of components equal to one and must be allocated !");
- if(nbOfSlices<=0)
- throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : number of slices must be >= 1 !");
- int sum(accumulate(0)),nbOfTuples(getNumberOfTuples());
- int sumPerSlc(sum/nbOfSlices),pos(0);
- const int *w(begin());
- std::vector< std::pair<int,int> > ret(nbOfSlices);
- for(int i=0;i<nbOfSlices;i++)
- {
- std::pair<int,int> p(pos,-1);
- int locSum(0);
- while(locSum<sumPerSlc && pos<nbOfTuples) { pos++; locSum+=*w++; }
- if(i!=nbOfSlices-1)
- p.second=pos;
- else
- p.second=nbOfTuples;
- ret[i]=p;
- }
- return ret;
-}
-
-/*!
- * Returns a new DataArrayInt that is a modulus of two given arrays. There are 3
- * valid cases.
- * 1. The arrays have same number of tuples and components. Then each value of
- * the result array (_a_) is a division of the corresponding values of \a a1 and
- * \a a2, i.e.: _a_ [ i, j ] = _a1_ [ i, j ] % _a2_ [ i, j ].
- * 2. The arrays have same number of tuples and one array, say _a2_, has one
- * component. Then
- * _a_ [ i, j ] = _a1_ [ i, j ] % _a2_ [ i, 0 ].
- * 3. The arrays have same number of components and one array, say _a2_, has one
- * tuple. Then
- * _a_ [ i, j ] = _a1_ [ i, j ] % _a2_ [ 0, j ].
- *
- * Info on components is copied either from the first array (in the first case) or from
- * the array with maximal number of elements (getNbOfElems()).
- * \warning No check of division by zero is performed!
- * \param [in] a1 - a dividend array.
- * \param [in] a2 - a divisor array.
- * \return DataArrayInt * - the new instance of DataArrayInt.
- * The caller is to delete this result array using decrRef() as it is no more
- * needed.
- * \throw If either \a a1 or \a a2 is NULL.
- * \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
- * \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
- * none of them has number of tuples or components equal to 1.
- */
-DataArrayInt *DataArrayInt::Modulus(const DataArrayInt *a1, const DataArrayInt *a2)
-{
- if(!a1 || !a2)
- throw INTERP_KERNEL::Exception("DataArrayInt::Modulus : input DataArrayInt instance is NULL !");
- int nbOfTuple1=a1->getNumberOfTuples();
- int nbOfTuple2=a2->getNumberOfTuples();
- int nbOfComp1=a1->getNumberOfComponents();
- int nbOfComp2=a2->getNumberOfComponents();
- if(nbOfTuple2==nbOfTuple1)
- {
- if(nbOfComp1==nbOfComp2)
- {
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(nbOfTuple2,nbOfComp1);
- std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::modulus<int>());
- ret->copyStringInfoFrom(*a1);
- return ret.retn();
- }
- else if(nbOfComp2==1)
- {
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(nbOfTuple1,nbOfComp1);
- const int *a2Ptr=a2->getConstPointer();
- const int *a1Ptr=a1->getConstPointer();
- int *res=ret->getPointer();
- for(int i=0;i<nbOfTuple1;i++)
- res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind2nd(std::modulus<int>(),a2Ptr[i]));
- ret->copyStringInfoFrom(*a1);
- return ret.retn();
- }
- else
- {
- a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Modulus !");
- return 0;
- }
- }
- else if(nbOfTuple2==1)
- {
- a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Modulus !");
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(nbOfTuple1,nbOfComp1);
- const int *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer();
- int *pt=ret->getPointer();
- for(int i=0;i<nbOfTuple1;i++)
- pt=std::transform(a1ptr+i*nbOfComp1,a1ptr+(i+1)*nbOfComp1,a2ptr,pt,std::modulus<int>());
- ret->copyStringInfoFrom(*a1);
- return ret.retn();
- }
- else
- {
- a1->checkNbOfTuples(nbOfTuple2,"Nb of tuples mismatch for array Modulus !");//will always throw an exception
- return 0;
- }
-}
-
-/*!
- * Modify \a this array so that each value becomes a modulus of division of this value by
- * a value of another DataArrayInt. There are 3 valid cases.
- * 1. The arrays have same number of tuples and components. Then each value of
- * \a this array is divided by the corresponding value of \a other one, i.e.:
- * _a_ [ i, j ] %= _other_ [ i, j ].
- * 2. The arrays have same number of tuples and \a other array has one component. Then
- * _a_ [ i, j ] %= _other_ [ i, 0 ].
- * 3. The arrays have same number of components and \a other array has one tuple. Then
- * _a_ [ i, j ] %= _a2_ [ 0, j ].
- *
- * \warning No check of division by zero is performed!
- * \param [in] other - a divisor array.
- * \throw If \a other is NULL.
- * \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
- * \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
- * \a other has number of both tuples and components not equal to 1.
- */
-void DataArrayInt::modulusEqual(const DataArrayInt *other)
-{
- if(!other)
- throw INTERP_KERNEL::Exception("DataArrayInt::modulusEqual : input DataArrayInt instance is NULL !");
- const char *msg="Nb of tuples mismatch for DataArrayInt::modulusEqual !";
- checkAllocated(); other->checkAllocated();
- int nbOfTuple=getNumberOfTuples();
- int nbOfTuple2=other->getNumberOfTuples();
- int nbOfComp=getNumberOfComponents();
- int nbOfComp2=other->getNumberOfComponents();
- if(nbOfTuple==nbOfTuple2)
- {
- if(nbOfComp==nbOfComp2)
- {
- std::transform(begin(),end(),other->begin(),getPointer(),std::modulus<int>());
- }
- else if(nbOfComp2==1)
- {
- if(nbOfComp2==nbOfComp)
- {
- int *ptr=getPointer();
- const int *ptrc=other->getConstPointer();
- for(int i=0;i<nbOfTuple;i++)
- std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::modulus<int>(),*ptrc++));
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else if(nbOfTuple2==1)
- {
- int *ptr=getPointer();
- const int *ptrc=other->getConstPointer();
- for(int i=0;i<nbOfTuple;i++)
- std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::modulus<int>());
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- declareAsNew();
-}
-
-/*!
- * Returns a new DataArrayInt that is the result of pow of two given arrays. There are 3
- * valid cases.
- *
- * \param [in] a1 - an array to pow up.
- * \param [in] a2 - another array to sum up.
- * \return DataArrayInt * - the new instance of DataArrayInt.
- * The caller is to delete this result array using decrRef() as it is no more
- * needed.
- * \throw If either \a a1 or \a a2 is NULL.
- * \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples()
- * \throw If \a a1->getNumberOfComponents() != 1 or \a a2->getNumberOfComponents() != 1.
- * \throw If there is a negative value in \a a2.
- */
-DataArrayInt *DataArrayInt::Pow(const DataArrayInt *a1, const DataArrayInt *a2)
-{
- if(!a1 || !a2)
- throw INTERP_KERNEL::Exception("DataArrayInt::Pow : at least one of input instances is null !");
- int nbOfTuple=a1->getNumberOfTuples();
- int nbOfTuple2=a2->getNumberOfTuples();
- int nbOfComp=a1->getNumberOfComponents();
- int nbOfComp2=a2->getNumberOfComponents();
- if(nbOfTuple!=nbOfTuple2)
- throw INTERP_KERNEL::Exception("DataArrayInt::Pow : number of tuples mismatches !");
- if(nbOfComp!=1 || nbOfComp2!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::Pow : number of components of both arrays must be equal to 1 !");
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbOfTuple,1);
- const int *ptr1(a1->begin()),*ptr2(a2->begin());
- int *ptr=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,ptr1++,ptr2++,ptr++)
- {
- if(*ptr2>=0)
- {
- int tmp=1;
- for(int j=0;j<*ptr2;j++)
- tmp*=*ptr1;
- *ptr=tmp;
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::Pow : on tuple #" << i << " of a2 value is < 0 (" << *ptr2 << ") !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- return ret.retn();
-}
-
-/*!
- * Apply pow on values of another DataArrayInt to values of \a this one.
- *
- * \param [in] other - an array to pow to \a this one.
- * \throw If \a other is NULL.
- * \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples()
- * \throw If \a this->getNumberOfComponents() != 1 or \a other->getNumberOfComponents() != 1
- * \throw If there is a negative value in \a other.
- */
-void DataArrayInt::powEqual(const DataArrayInt *other)
-{
- if(!other)
- throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : input instance is null !");
- int nbOfTuple=getNumberOfTuples();
- int nbOfTuple2=other->getNumberOfTuples();
- int nbOfComp=getNumberOfComponents();
- int nbOfComp2=other->getNumberOfComponents();
- if(nbOfTuple!=nbOfTuple2)
- throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : number of tuples mismatches !");
- if(nbOfComp!=1 || nbOfComp2!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : number of components of both arrays must be equal to 1 !");
- int *ptr=getPointer();
- const int *ptrc=other->begin();
- for(int i=0;i<nbOfTuple;i++,ptrc++,ptr++)
- {
- if(*ptrc>=0)
- {
- int tmp=1;
- for(int j=0;j<*ptrc;j++)
- tmp*=*ptr;
- *ptr=tmp;
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::powEqual : on tuple #" << i << " of other value is < 0 (" << *ptrc << ") !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- declareAsNew();
-}
-
-/*!
- * This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn
- * (\ref numbering-indirect).
- * This method returns the result of the extraction ( specified by a set of ids in [\b idsOfSelectBg , \b idsOfSelectEnd ) ).
- * The selection of extraction is done standardly in new2old format.
- * This method returns indexed arrays (\ref numbering-indirect) using 2 arrays (arrOut,arrIndexOut).
- *
- * \param [in] idsOfSelectBg begin of set of ids of the input extraction (included)
- * \param [in] idsOfSelectEnd end of set of ids of the input extraction (excluded)
- * \param [in] arrIn arr origin array from which the extraction will be done.
- * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn
- * \param [out] arrOut the resulting array
- * \param [out] arrIndexOut the index array of the resulting array \b arrOut
- * \sa DataArrayInt::ExtractFromIndexedArraysSlice
- */
-void DataArrayInt::ExtractFromIndexedArrays(const int *idsOfSelectBg, const int *idsOfSelectEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
- DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut)
-{
- if(!arrIn || !arrIndxIn)
- throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : input pointer is NULL !");
- arrIn->checkAllocated(); arrIndxIn->checkAllocated();
- if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : input arrays must have exactly one component !");
- std::size_t sz=std::distance(idsOfSelectBg,idsOfSelectEnd);
- const int *arrInPtr=arrIn->begin();
- const int *arrIndxPtr=arrIndxIn->begin();
- int nbOfGrps=arrIndxIn->getNumberOfTuples()-1;
- if(nbOfGrps<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !");
- int maxSizeOfArr=arrIn->getNumberOfTuples();
- MCAuto<DataArrayInt> arro=DataArrayInt::New();
- MCAuto<DataArrayInt> arrIo=DataArrayInt::New();
- arrIo->alloc((int)(sz+1),1);
- const int *idsIt=idsOfSelectBg;
- int *work=arrIo->getPointer();
- *work++=0;
- int lgth=0;
- for(std::size_t i=0;i<sz;i++,work++,idsIt++)
- {
- if(*idsIt>=0 && *idsIt<nbOfGrps)
- lgth+=arrIndxPtr[*idsIt+1]-arrIndxPtr[*idsIt];
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArrays : id located on pos #" << i << " value is " << *idsIt << " ! Must be in [0," << nbOfGrps << ") !";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- if(lgth>=work[-1])
- *work=lgth;
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArrays : id located on pos #" << i << " value is " << *idsIt << " and at this pos arrIndxIn[" << *idsIt;
- oss << "+1]-arrIndxIn[" << *idsIt << "] < 0 ! The input index array is bugged !";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- }
- arro->alloc(lgth,1);
- work=arro->getPointer();
- idsIt=idsOfSelectBg;
- for(std::size_t i=0;i<sz;i++,idsIt++)
- {
- if(arrIndxPtr[*idsIt]>=0 && arrIndxPtr[*idsIt+1]<=maxSizeOfArr)
- work=std::copy(arrInPtr+arrIndxPtr[*idsIt],arrInPtr+arrIndxPtr[*idsIt+1],work);
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArrays : id located on pos #" << i << " value is " << *idsIt << " arrIndx[" << *idsIt << "] must be >= 0 and arrIndx[";
- oss << *idsIt << "+1] <= " << maxSizeOfArr << " (the size of arrIn)!";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- }
- arrOut=arro.retn();
- arrIndexOut=arrIo.retn();
-}
-
-/*!
- * This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn
- * (\ref numbering-indirect).
- * This method returns the result of the extraction ( specified by a set of ids with a slice given by \a idsOfSelectStart, \a idsOfSelectStop and \a idsOfSelectStep ).
- * The selection of extraction is done standardly in new2old format.
- * This method returns indexed arrays (\ref numbering-indirect) using 2 arrays (arrOut,arrIndexOut).
- *
- * \param [in] idsOfSelectStart begin of set of ids of the input extraction (included)
- * \param [in] idsOfSelectStop end of set of ids of the input extraction (excluded)
- * \param [in] idsOfSelectStep
- * \param [in] arrIn arr origin array from which the extraction will be done.
- * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn
- * \param [out] arrOut the resulting array
- * \param [out] arrIndexOut the index array of the resulting array \b arrOut
- * \sa DataArrayInt::ExtractFromIndexedArrays
- */
-void DataArrayInt::ExtractFromIndexedArraysSlice(int idsOfSelectStart, int idsOfSelectStop, int idsOfSelectStep, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
- DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut)
-{
- if(!arrIn || !arrIndxIn)
- throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : input pointer is NULL !");
- arrIn->checkAllocated(); arrIndxIn->checkAllocated();
- if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : input arrays must have exactly one component !");
- int sz=DataArrayInt::GetNumberOfItemGivenBESRelative(idsOfSelectStart,idsOfSelectStop,idsOfSelectStep,"MEDCouplingUMesh::ExtractFromIndexedArraysSlice : Input slice ");
- const int *arrInPtr=arrIn->begin();
- const int *arrIndxPtr=arrIndxIn->begin();
- int nbOfGrps=arrIndxIn->getNumberOfTuples()-1;
- if(nbOfGrps<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !");
- int maxSizeOfArr=arrIn->getNumberOfTuples();
- MCAuto<DataArrayInt> arro=DataArrayInt::New();
- MCAuto<DataArrayInt> arrIo=DataArrayInt::New();
- arrIo->alloc((int)(sz+1),1);
- int idsIt=idsOfSelectStart;
- int *work=arrIo->getPointer();
- *work++=0;
- int lgth=0;
- for(int i=0;i<sz;i++,work++,idsIt+=idsOfSelectStep)
- {
- if(idsIt>=0 && idsIt<nbOfGrps)
- lgth+=arrIndxPtr[idsIt+1]-arrIndxPtr[idsIt];
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " ! Must be in [0," << nbOfGrps << ") !";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- if(lgth>=work[-1])
- *work=lgth;
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " and at this pos arrIndxIn[" << idsIt;
- oss << "+1]-arrIndxIn[" << idsIt << "] < 0 ! The input index array is bugged !";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- }
- arro->alloc(lgth,1);
- work=arro->getPointer();
- idsIt=idsOfSelectStart;
- for(int i=0;i<sz;i++,idsIt+=idsOfSelectStep)
- {
- if(arrIndxPtr[idsIt]>=0 && arrIndxPtr[idsIt+1]<=maxSizeOfArr)
- work=std::copy(arrInPtr+arrIndxPtr[idsIt],arrInPtr+arrIndxPtr[idsIt+1],work);
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " arrIndx[" << idsIt << "] must be >= 0 and arrIndx[";
- oss << idsIt << "+1] <= " << maxSizeOfArr << " (the size of arrIn)!";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- }
- arrOut=arro.retn();
- arrIndexOut=arrIo.retn();
-}
-
-/*!
- * This method works on an input pair (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn.
- * This method builds an output pair (\b arrOut,\b arrIndexOut) that is a copy from \b arrIn for all cell ids \b not \b in [ \b idsOfSelectBg , \b idsOfSelectEnd ) and for
- * cellIds \b in [ \b idsOfSelectBg , \b idsOfSelectEnd ) a copy coming from the corresponding values in input pair (\b srcArr, \b srcArrIndex).
- * This method is an generalization of MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx that performs the same thing but by without building explicitly a result output arrays.
- *
- * \param [in] idsOfSelectBg begin of set of ids of the input extraction (included)
- * \param [in] idsOfSelectEnd end of set of ids of the input extraction (excluded)
- * \param [in] arrIn arr origin array from which the extraction will be done.
- * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn
- * \param [in] srcArr input array that will be used as source of copy for ids in [ \b idsOfSelectBg, \b idsOfSelectEnd )
- * \param [in] srcArrIndex index array of \b srcArr
- * \param [out] arrOut the resulting array
- * \param [out] arrIndexOut the index array of the resulting array \b arrOut
- *
- * \sa DataArrayInt::SetPartOfIndexedArraysSameIdx
- */
-void DataArrayInt::SetPartOfIndexedArrays(const int *idsOfSelectBg, const int *idsOfSelectEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
- const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex,
- DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut)
-{
- if(arrIn==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
- throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArrays : presence of null pointer in input parameter !");
- MCAuto<DataArrayInt> arro=DataArrayInt::New();
- MCAuto<DataArrayInt> arrIo=DataArrayInt::New();
- int nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
- std::vector<bool> v(nbOfTuples,true);
- int offset=0;
- const int *arrIndxInPtr=arrIndxIn->begin();
- const int *srcArrIndexPtr=srcArrIndex->begin();
- for(const int *it=idsOfSelectBg;it!=idsOfSelectEnd;it++,srcArrIndexPtr++)
- {
- if(*it>=0 && *it<nbOfTuples)
- {
- v[*it]=false;
- offset+=(srcArrIndexPtr[1]-srcArrIndexPtr[0])-(arrIndxInPtr[*it+1]-arrIndxInPtr[*it]);
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::SetPartOfIndexedArrays : On pos #" << std::distance(idsOfSelectBg,it) << " value is " << *it << " not in [0," << nbOfTuples << ") !";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- }
- srcArrIndexPtr=srcArrIndex->begin();
- arrIo->alloc(nbOfTuples+1,1);
- arro->alloc(arrIn->getNumberOfTuples()+offset,1);
- const int *arrInPtr=arrIn->begin();
- const int *srcArrPtr=srcArr->begin();
- int *arrIoPtr=arrIo->getPointer(); *arrIoPtr++=0;
- int *arroPtr=arro->getPointer();
- for(int ii=0;ii<nbOfTuples;ii++,arrIoPtr++)
- {
- if(v[ii])
- {
- arroPtr=std::copy(arrInPtr+arrIndxInPtr[ii],arrInPtr+arrIndxInPtr[ii+1],arroPtr);
- *arrIoPtr=arrIoPtr[-1]+(arrIndxInPtr[ii+1]-arrIndxInPtr[ii]);
- }
- else
- {
- std::size_t pos=std::distance(idsOfSelectBg,std::find(idsOfSelectBg,idsOfSelectEnd,ii));
- arroPtr=std::copy(srcArrPtr+srcArrIndexPtr[pos],srcArrPtr+srcArrIndexPtr[pos+1],arroPtr);
- *arrIoPtr=arrIoPtr[-1]+(srcArrIndexPtr[pos+1]-srcArrIndexPtr[pos]);
- }
- }
- arrOut=arro.retn();
- arrIndexOut=arrIo.retn();
-}
-
-
-/*!
- * This method works on an input pair (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn.
- * This method builds an output pair (\b arrOut,\b arrIndexOut) that is a copy from \b arrIn for all cell ids \b not \b in [ \b idsOfSelectBg , \b idsOfSelectEnd ) and for
- * cellIds \b in [\b idsOfSelectBg, \b idsOfSelectEnd) a copy coming from the corresponding values in input pair (\b srcArr, \b srcArrIndex).
- * This method is an generalization of DataArrayInt::SetPartOfIndexedArraysSameIdx that performs the same thing but by without building explicitly a result output arrays.
- *
- * \param [in] start begin of set of ids of the input extraction (included)
- * \param [in] end end of set of ids of the input extraction (excluded)
- * \param [in] step step of the set of ids in range mode.
- * \param [in] arrIn arr origin array from which the extraction will be done.
- * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn
- * \param [in] srcArr input array that will be used as source of copy for ids in [\b idsOfSelectBg, \b idsOfSelectEnd)
- * \param [in] srcArrIndex index array of \b srcArr
- * \param [out] arrOut the resulting array
- * \param [out] arrIndexOut the index array of the resulting array \b arrOut
- *
- * \sa DataArrayInt::SetPartOfIndexedArraysSameIdx DataArrayInt::SetPartOfIndexedArrays
- */
-void DataArrayInt::SetPartOfIndexedArraysSlice(int start, int end, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
- const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex,
- DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut)
-{
- if(arrIn==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
- throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSlice : presence of null pointer in input parameter !");
- MCAuto<DataArrayInt> arro=DataArrayInt::New();
- MCAuto<DataArrayInt> arrIo=DataArrayInt::New();
- int nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
- int offset=0;
- const int *arrIndxInPtr=arrIndxIn->begin();
- const int *srcArrIndexPtr=srcArrIndex->begin();
- int nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSlice : ");
- int it=start;
- for(int i=0;i<nbOfElemsToSet;i++,srcArrIndexPtr++,it+=step)
- {
- if(it>=0 && it<nbOfTuples)
- offset+=(srcArrIndexPtr[1]-srcArrIndexPtr[0])-(arrIndxInPtr[it+1]-arrIndxInPtr[it]);
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::SetPartOfIndexedArraysSlice : On pos #" << i << " value is " << it << " not in [0," << nbOfTuples << ") !";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- }
- srcArrIndexPtr=srcArrIndex->begin();
- arrIo->alloc(nbOfTuples+1,1);
- arro->alloc(arrIn->getNumberOfTuples()+offset,1);
- const int *arrInPtr=arrIn->begin();
- const int *srcArrPtr=srcArr->begin();
- int *arrIoPtr=arrIo->getPointer(); *arrIoPtr++=0;
- int *arroPtr=arro->getPointer();
- for(int ii=0;ii<nbOfTuples;ii++,arrIoPtr++)
- {
- int pos=DataArray::GetPosOfItemGivenBESRelativeNoThrow(ii,start,end,step);
- if(pos<0)
- {
- arroPtr=std::copy(arrInPtr+arrIndxInPtr[ii],arrInPtr+arrIndxInPtr[ii+1],arroPtr);
- *arrIoPtr=arrIoPtr[-1]+(arrIndxInPtr[ii+1]-arrIndxInPtr[ii]);
- }
- else
- {
- arroPtr=std::copy(srcArrPtr+srcArrIndexPtr[pos],srcArrPtr+srcArrIndexPtr[pos+1],arroPtr);
- *arrIoPtr=arrIoPtr[-1]+(srcArrIndexPtr[pos+1]-srcArrIndexPtr[pos]);
- }
- }
- arrOut=arro.retn();
- arrIndexOut=arrIo.retn();
-}
-
-
-/*!
- * This method works on an input pair (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn.
- * This method is an specialization of MEDCouplingUMesh::SetPartOfIndexedArrays in the case of assignment do not modify the index in \b arrIndxIn.
- *
- * \param [in] idsOfSelectBg begin of set of ids of the input extraction (included)
- * \param [in] idsOfSelectEnd end of set of ids of the input extraction (excluded)
- * \param [in,out] arrInOut arr origin array from which the extraction will be done.
- * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn
- * \param [in] srcArr input array that will be used as source of copy for ids in [ \b idsOfSelectBg , \b idsOfSelectEnd )
- * \param [in] srcArrIndex index array of \b srcArr
- *
- * \sa DataArrayInt::SetPartOfIndexedArrays
- */
-void DataArrayInt::SetPartOfIndexedArraysSameIdx(const int *idsOfSelectBg, const int *idsOfSelectEnd, DataArrayInt *arrInOut, const DataArrayInt *arrIndxIn,
- const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex)
-{
- if(arrInOut==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
- throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdx : presence of null pointer in input parameter !");
- int nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
- const int *arrIndxInPtr=arrIndxIn->begin();
- const int *srcArrIndexPtr=srcArrIndex->begin();
- int *arrInOutPtr=arrInOut->getPointer();
- const int *srcArrPtr=srcArr->begin();
- for(const int *it=idsOfSelectBg;it!=idsOfSelectEnd;it++,srcArrIndexPtr++)
- {
- if(*it>=0 && *it<nbOfTuples)
- {
- if(srcArrIndexPtr[1]-srcArrIndexPtr[0]==arrIndxInPtr[*it+1]-arrIndxInPtr[*it])
- std::copy(srcArrPtr+srcArrIndexPtr[0],srcArrPtr+srcArrIndexPtr[1],arrInOutPtr+arrIndxInPtr[*it]);
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::SetPartOfIndexedArraysSameIdx : On pos #" << std::distance(idsOfSelectBg,it) << " id (idsOfSelectBg[" << std::distance(idsOfSelectBg,it)<< "]) is " << *it << " arrIndxIn[id+1]-arrIndxIn[id]!=srcArrIndex[pos+1]-srcArrIndex[pos] !";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::SetPartOfIndexedArraysSameIdx : On pos #" << std::distance(idsOfSelectBg,it) << " value is " << *it << " not in [0," << nbOfTuples << ") !";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- }
-}
-
-/*!
- * This method works on an input pair (\b arr, \b arrIndx) where \b arr indexes is in \b arrIndx.
- * This method will not impact the size of inout parameter \b arrIndx but the size of \b arr will be modified in case of suppression.
- *
- * \param [in] idsToRemoveBg begin of set of ids to remove in \b arr (included)
- * \param [in] idsToRemoveEnd end of set of ids to remove in \b arr (excluded)
- * \param [in,out] arr array in which the remove operation will be done.
- * \param [in,out] arrIndx array in the remove operation will modify
- * \param [in] offsetForRemoval (by default 0) offset so that for each i in [0,arrIndx->getNumberOfTuples()-1) removal process will be performed in the following range [arr+arrIndx[i]+offsetForRemoval,arr+arr[i+1])
- * \return true if \b arr and \b arrIndx have been modified, false if not.
- */
-bool DataArrayInt::RemoveIdsFromIndexedArrays(const int *idsToRemoveBg, const int *idsToRemoveEnd, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval)
-{
- if(!arrIndx || !arr)
- throw INTERP_KERNEL::Exception("DataArrayInt::RemoveIdsFromIndexedArrays : some input arrays are empty !");
- if(offsetForRemoval<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::RemoveIdsFromIndexedArrays : offsetForRemoval should be >=0 !");
- std::set<int> s(idsToRemoveBg,idsToRemoveEnd);
- int nbOfGrps=arrIndx->getNumberOfTuples()-1;
- int *arrIPtr=arrIndx->getPointer();
- *arrIPtr++=0;
- int previousArrI=0;
- const int *arrPtr=arr->begin();
- std::vector<int> arrOut;//no utility to switch to DataArrayInt because copy always needed
- for(int i=0;i<nbOfGrps;i++,arrIPtr++)
- {
- if(*arrIPtr-previousArrI>offsetForRemoval)
- {
- for(const int *work=arrPtr+previousArrI+offsetForRemoval;work!=arrPtr+*arrIPtr;work++)
- {
- if(s.find(*work)==s.end())
- arrOut.push_back(*work);
- }
- }
- previousArrI=*arrIPtr;
- *arrIPtr=(int)arrOut.size();
- }
- if(arr->getNumberOfTuples()==arrOut.size())
- return false;
- arr->alloc((int)arrOut.size(),1);
- std::copy(arrOut.begin(),arrOut.end(),arr->getPointer());
- return true;
-}
-
-/*!
- * This method works on an input pair (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn.
- * This method is an specialization of MEDCouplingUMesh::SetPartOfIndexedArrays in the case of assignment do not modify the index in \b arrIndxIn.
- *
- * \param [in] start begin of set of ids of the input extraction (included)
- * \param [in] end end of set of ids of the input extraction (excluded)
- * \param [in] step step of the set of ids in range mode.
- * \param [in,out] arrInOut arr origin array from which the extraction will be done.
- * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn
- * \param [in] srcArr input array that will be used as source of copy for ids in [\b idsOfSelectBg, \b idsOfSelectEnd)
- * \param [in] srcArrIndex index array of \b srcArr
- *
- * \sa DataArrayInt::SetPartOfIndexedArraysSlice DataArrayInt::SetPartOfIndexedArraysSameIdx
- */
-void DataArrayInt::SetPartOfIndexedArraysSameIdxSlice(int start, int end, int step, DataArrayInt *arrInOut, const DataArrayInt *arrIndxIn,
- const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex)
-{
- if(arrInOut==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
- throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : presence of null pointer in input parameter !");
- int nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
- const int *arrIndxInPtr=arrIndxIn->begin();
- const int *srcArrIndexPtr=srcArrIndex->begin();
- int *arrInOutPtr=arrInOut->getPointer();
- const int *srcArrPtr=srcArr->begin();
- int nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : ");
- int it=start;
- for(int i=0;i<nbOfElemsToSet;i++,srcArrIndexPtr++,it+=step)
- {
- if(it>=0 && it<nbOfTuples)
- {
- if(srcArrIndexPtr[1]-srcArrIndexPtr[0]==arrIndxInPtr[it+1]-arrIndxInPtr[it])
- std::copy(srcArrPtr+srcArrIndexPtr[0],srcArrPtr+srcArrIndexPtr[1],arrInOutPtr+arrIndxInPtr[it]);
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : On pos #" << i << " id (idsOfSelectBg[" << i << "]) is " << it << " arrIndxIn[id+1]-arrIndxIn[id]!=srcArrIndex[pos+1]-srcArrIndex[pos] !";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- }
- else
- {
- std::ostringstream oss; oss << "DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : On pos #" << i << " value is " << it << " not in [0," << nbOfTuples << ") !";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- }
-}
-
-
-/*!
- * Returns a C array which is a renumbering map in "Old to New" mode for the input array.
- * This map, if applied to \a start array, would make it sorted. For example, if
- * \a start array contents are [9,10,0,6,4,11,3,7] then the contents of the result array is
- * [5,6,0,3,2,7,1,4].
- * \param [in] start - pointer to the first element of the array for which the
- * permutation map is computed.
- * \param [in] end - pointer specifying the end of the array \a start, so that
- * the last value of \a start is \a end[ -1 ].
- * \return int * - the result permutation array that the caller is to delete as it is no
- * more needed.
- * \throw If there are equal values in the input array.
- */
-int *DataArrayInt::CheckAndPreparePermutation(const int *start, const int *end)
-{
- std::size_t sz=std::distance(start,end);
- int *ret=(int *)malloc(sz*sizeof(int));
- int *work=new int[sz];
- std::copy(start,end,work);
- std::sort(work,work+sz);
- if(std::unique(work,work+sz)!=work+sz)
- {
- delete [] work;
- free(ret);
- throw INTERP_KERNEL::Exception("Some elements are equals in the specified array !");
- }
- std::map<int,int> m;
- for(int *workPt=work;workPt!=work+sz;workPt++)
- m[*workPt]=(int)std::distance(work,workPt);
- int *iter2=ret;
- for(const int *iter=start;iter!=end;iter++,iter2++)
- *iter2=m[*iter];
- delete [] work;
- return ret;
-}
-
-/*!
- * Returns a new DataArrayInt containing an arithmetic progression
- * that is equal to the sequence returned by Python \c range(\a begin,\a end,\a step )
- * function.
- * \param [in] begin - the start value of the result sequence.
- * \param [in] end - limiting value, so that every value of the result array is less than
- * \a end.
- * \param [in] step - specifies the increment or decrement.
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- * array using decrRef() as it is no more needed.
- * \throw If \a step == 0.
- * \throw If \a end < \a begin && \a step > 0.
- * \throw If \a end > \a begin && \a step < 0.
- */
-DataArrayInt *DataArrayInt::Range(int begin, int end, int step)
-{
- int nbOfTuples=GetNumberOfItemGivenBESRelative(begin,end,step,"DataArrayInt::Range");
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(nbOfTuples,1);
- int *ptr=ret->getPointer();
- if(step>0)
- {
- for(int i=begin;i<end;i+=step,ptr++)
- *ptr=i;
- }
- else
- {
- for(int i=begin;i>end;i+=step,ptr++)
- *ptr=i;
- }
- return ret.retn();
-}
-
-/*!
- * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
- * Server side.
- */
-void DataArrayInt::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
-{
- tinyInfo.resize(2);
- if(isAllocated())
- {
- tinyInfo[0]=getNumberOfTuples();
- tinyInfo[1]=getNumberOfComponents();
- }
- else
- {
- tinyInfo[0]=-1;
- tinyInfo[1]=-1;
- }
-}
-
-/*!
- * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
- * Server side.
- */
-void DataArrayInt::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
-{
- if(isAllocated())
- {
- int nbOfCompo=getNumberOfComponents();
- tinyInfo.resize(nbOfCompo+1);
- tinyInfo[0]=getName();
- for(int i=0;i<nbOfCompo;i++)
- tinyInfo[i+1]=getInfoOnComponent(i);
- }
- else
- {
- tinyInfo.resize(1);
- tinyInfo[0]=getName();
- }
-}
-
-/*!
- * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
- * This method returns if a feeding is needed.
- */
-bool DataArrayInt::resizeForUnserialization(const std::vector<int>& tinyInfoI)
-{
- int nbOfTuple=tinyInfoI[0];
- int nbOfComp=tinyInfoI[1];
- if(nbOfTuple!=-1 || nbOfComp!=-1)
- {
- alloc(nbOfTuple,nbOfComp);
- return true;
- }
- return false;
-}
-
-/*!
- * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
- * This method returns if a feeding is needed.
- */
-void DataArrayInt::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS)
-{
- setName(tinyInfoS[0]);
- if(isAllocated())
- {
- int nbOfCompo=tinyInfoI[1];
- for(int i=0;i<nbOfCompo;i++)
- setInfoOnComponent(i,tinyInfoS[i+1]);
- }
-}
-
-DataArrayIntIterator::DataArrayIntIterator(DataArrayInt *da):DataArrayIterator<int>(da)
-{
-}
-
-DataArrayInt32Tuple::DataArrayInt32Tuple(int *pt, int nbOfComp):DataArrayTuple<int>(pt,nbOfComp)
-{
-}
-
-std::string DataArrayIntTuple::repr() const
-{
- std::ostringstream oss; oss << "(";
- for(int i=0;i<_nb_of_compo-1;i++)
- oss << _pt[i] << ", ";
- oss << _pt[_nb_of_compo-1] << ")";
- return oss.str();
-}
-
-int DataArrayIntTuple::intValue() const
-{
- return this->zeValue();
-}
-
-/*!
- * This method returns a newly allocated instance the caller should dealed with by a MEDCoupling::DataArrayInt::decrRef.
- * This method performs \b no copy of data. The content is only referenced using MEDCoupling::DataArrayInt::useArray with ownership set to \b false.
- * This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or
- * \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem.
- */
-DataArrayInt *DataArrayIntTuple::buildDAInt(int nbOfTuples, int nbOfCompo) const
-{
- return this->buildDA(nbOfTuples,nbOfCompo);
-}
DataArrayInt64 *DataArrayInt64::deepCopy() const
{
MEDCOUPLING_EXPORT T operator[](std::size_t id) const { return _pointer.getConstPointer()[id]; }
MEDCOUPLING_EXPORT T& operator[](std::size_t id) { return _pointer.getPointer()[id]; }
MEDCOUPLING_EXPORT bool isEqual(const MemArray<T>& other, T prec, std::string& reason) const;
- MEDCOUPLING_EXPORT void repr(int sl, std::ostream& stream) const;
- MEDCOUPLING_EXPORT bool reprHeader(int sl, std::ostream& stream) const;
- MEDCOUPLING_EXPORT void reprZip(int sl, std::ostream& stream) const;
- MEDCOUPLING_EXPORT void reprNotTooLong(int sl, std::ostream& stream) const;
+ MEDCOUPLING_EXPORT void repr(mcIdType sl, std::ostream& stream) const;
+ MEDCOUPLING_EXPORT bool reprHeader(mcIdType sl, std::ostream& stream) const;
+ MEDCOUPLING_EXPORT void reprZip(mcIdType sl, std::ostream& stream) const;
+ MEDCOUPLING_EXPORT void reprNotTooLong(mcIdType sl, std::ostream& stream) const;
MEDCOUPLING_EXPORT void fillWithValue(const T& val);
- MEDCOUPLING_EXPORT T *fromNoInterlace(int nbOfComp) const;
- MEDCOUPLING_EXPORT T *toNoInterlace(int nbOfComp) const;
+ MEDCOUPLING_EXPORT T *fromNoInterlace(std::size_t nbOfComp) const;
+ MEDCOUPLING_EXPORT T *toNoInterlace(std::size_t nbOfComp) const;
MEDCOUPLING_EXPORT void sort(bool asc);
- MEDCOUPLING_EXPORT void reverse(int nbOfComp);
+ MEDCOUPLING_EXPORT void reverse(std::size_t nbOfComp);
MEDCOUPLING_EXPORT void alloc(std::size_t nbOfElements);
MEDCOUPLING_EXPORT void reserve(std::size_t newNbOfElements);
MEDCOUPLING_EXPORT void reAlloc(std::size_t newNbOfElements);
void *_param_for_deallocator;
};
- class DataArrayInt32;
+ template <class T> class DataArrayTools
+ {
+ public:
+ MEDCOUPLING_EXPORT static void GetSlice(T start, T stop, T step, mcIdType sliceId, mcIdType nbOfSlices, T& startSlice, T& stopSlice);
+ MEDCOUPLING_EXPORT static mcIdType GetNumberOfItemGivenBES(T begin, T end, T step, const std::string& msg);
+ MEDCOUPLING_EXPORT static mcIdType GetNumberOfItemGivenBESRelative(T begin, T end, T step, const std::string& msg);
+ MEDCOUPLING_EXPORT static mcIdType GetPosOfItemGivenBESRelativeNoThrow(T value, T begin, T end, T step);
+ };
+
class DataArrayByte;
class DataArray : public RefCountObject, public TimeLabel
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDCOUPLING_EXPORT void setName(const std::string& name);
MEDCOUPLING_EXPORT void copyStringInfoFrom(const DataArray& other);
- MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds);
- MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other);
+ MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<std::size_t>& compoIds);
+ MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom2(const std::vector<std::size_t>& compoIds, const DataArray& other);
MEDCOUPLING_EXPORT bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const;
MEDCOUPLING_EXPORT bool areInfoEquals(const DataArray& other) const;
MEDCOUPLING_EXPORT std::string cppRepr(const std::string& varName) const;
MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info);
MEDCOUPLING_EXPORT std::vector<std::string> getVarsOnComponent() const;
MEDCOUPLING_EXPORT std::vector<std::string> getUnitsOnComponent() const;
- MEDCOUPLING_EXPORT std::string getInfoOnComponent(int i) const;
- MEDCOUPLING_EXPORT std::string getVarOnComponent(int i) const;
- MEDCOUPLING_EXPORT std::string getUnitOnComponent(int i) const;
- MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const std::string& info);
+ MEDCOUPLING_EXPORT std::string getInfoOnComponent(std::size_t i) const;
+ MEDCOUPLING_EXPORT std::string getVarOnComponent(std::size_t i) const;
+ MEDCOUPLING_EXPORT std::string getUnitOnComponent(std::size_t i) const;
+ MEDCOUPLING_EXPORT void setInfoOnComponent(std::size_t i, const std::string& info);
MEDCOUPLING_EXPORT std::size_t getNumberOfComponents() const { return _info_on_compo.size(); }
- MEDCOUPLING_EXPORT void setPartOfValuesBase3(const DataArray *aBase, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true);
+ MEDCOUPLING_EXPORT void setPartOfValuesBase3(const DataArray *aBase, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true);
MEDCOUPLING_EXPORT virtual void *getVoidStarPointer() = 0;
MEDCOUPLING_EXPORT virtual DataArray *deepCopy() const = 0;
MEDCOUPLING_EXPORT virtual DataArray *buildNewEmptyInstance() const = 0;
MEDCOUPLING_EXPORT virtual bool isAllocated() const = 0;
MEDCOUPLING_EXPORT virtual void checkAllocated() const = 0;
MEDCOUPLING_EXPORT virtual void desallocate() = 0;
- MEDCOUPLING_EXPORT virtual std::size_t getNumberOfTuples() const = 0;
- MEDCOUPLING_EXPORT virtual std::size_t getNbOfElems() const = 0;
+ MEDCOUPLING_EXPORT virtual mcIdType getNumberOfTuples() const = 0;
+ MEDCOUPLING_EXPORT virtual mcIdType getNbOfElems() const = 0;
MEDCOUPLING_EXPORT virtual std::size_t getNbOfElemAllocated() const = 0;
MEDCOUPLING_EXPORT virtual void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1) = 0;
MEDCOUPLING_EXPORT virtual void reAlloc(std::size_t newNbOfTuple) = 0;
- MEDCOUPLING_EXPORT virtual void renumberInPlace(const int *old2New) = 0;
- MEDCOUPLING_EXPORT virtual void renumberInPlaceR(const int *new2Old) = 0;
- MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt32 *tuplesSelec) = 0;
- MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) = 0;
- MEDCOUPLING_EXPORT virtual DataArray *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const = 0;
- MEDCOUPLING_EXPORT virtual DataArray *keepSelectedComponents(const std::vector<int>& compoIds) const = 0;
- MEDCOUPLING_EXPORT virtual DataArray *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const = 0;
- MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const = 0;
- MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const = 0;
- MEDCOUPLING_EXPORT virtual void rearrange(int newNbOfCompo) = 0;
- MEDCOUPLING_EXPORT virtual void circularPermutation(int nbOfShift=1) = 0;
- MEDCOUPLING_EXPORT virtual void circularPermutationPerTuple(int nbOfShift=1) = 0;
+ MEDCOUPLING_EXPORT virtual void renumberInPlace(const mcIdType *old2New) = 0;
+ MEDCOUPLING_EXPORT virtual void renumberInPlaceR(const mcIdType *new2Old) = 0;
+ MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValues(mcIdType tupleIdStart, const DataArray *aBase, const DataArrayIdType *tuplesSelec) = 0;
+ MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, const DataArray *aBase, mcIdType bg, mcIdType end2, mcIdType step) = 0;
+ MEDCOUPLING_EXPORT virtual DataArray *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const = 0;
+ MEDCOUPLING_EXPORT virtual DataArray *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const = 0;
+ MEDCOUPLING_EXPORT virtual DataArray *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const = 0;
+ MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const = 0;
+ MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const = 0;
+ MEDCOUPLING_EXPORT virtual void rearrange(std::size_t newNbOfCompo) = 0;
+ MEDCOUPLING_EXPORT virtual void circularPermutation(mcIdType nbOfShift=1) = 0;
+ MEDCOUPLING_EXPORT virtual void circularPermutationPerTuple(mcIdType nbOfShift=1) = 0;
MEDCOUPLING_EXPORT virtual void reversePerTuple() = 0;
- MEDCOUPLING_EXPORT void checkNbOfTuples(int nbOfTuples, const std::string& msg) const;
- MEDCOUPLING_EXPORT void checkNbOfComps(int nbOfCompo, const std::string& msg) const;
+ MEDCOUPLING_EXPORT void checkNbOfTuples(mcIdType nbOfTuples, const std::string& msg) const;
+ MEDCOUPLING_EXPORT void checkNbOfComps(std::size_t nbOfCompo, const std::string& msg) const;
MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const;
- MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const;
- MEDCOUPLING_EXPORT void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const;
- MEDCOUPLING_EXPORT static void GetSlice(int start, int stop, int step, int sliceId, int nbOfSlices, int& startSlice, int& stopSlice);
- MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg);
- MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg);
- MEDCOUPLING_EXPORT static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step);
+ MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(mcIdType nbOfTuples, std::size_t nbOfCompo, const std::string& msg) const;
+ MEDCOUPLING_EXPORT void checkNbOfElems(mcIdType nbOfElems, const std::string& msg) const;
+ MEDCOUPLING_EXPORT static void GetSlice(mcIdType start, mcIdType stop, mcIdType step, mcIdType sliceId, mcIdType nbOfSlices, mcIdType& startSlice, mcIdType& stopSlice);
+ MEDCOUPLING_EXPORT static mcIdType GetNumberOfItemGivenBES(mcIdType begin, mcIdType end, mcIdType step, const std::string& msg);
+ MEDCOUPLING_EXPORT static mcIdType GetNumberOfItemGivenBESRelative(mcIdType begin, mcIdType end, mcIdType step, const std::string& msg);
+ MEDCOUPLING_EXPORT static mcIdType GetPosOfItemGivenBESRelativeNoThrow(mcIdType value, mcIdType begin, mcIdType end, mcIdType step);
MEDCOUPLING_EXPORT static std::string GetVarNameFromInfo(const std::string& info);
MEDCOUPLING_EXPORT static std::string GetUnitFromInfo(const std::string& info);
MEDCOUPLING_EXPORT static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit);
DataArray() { }
~DataArray() { }
protected:
- MEDCOUPLING_EXPORT static void CheckValueInRange(int ref, int value, const std::string& msg);
- MEDCOUPLING_EXPORT static void CheckValueInRangeEx(int value, int start, int end, const std::string& msg);
- MEDCOUPLING_EXPORT static void CheckClosingParInRange(int ref, int value, const std::string& msg);
- MEDCOUPLING_EXPORT static int EffectiveCircPerm(int nbOfShift, int nbOfTuples);
+ MEDCOUPLING_EXPORT static void CheckValueInRange(mcIdType ref, mcIdType value, const std::string& msg);
+ MEDCOUPLING_EXPORT static void CheckValueInRangeEx(mcIdType value, mcIdType start, mcIdType end, const std::string& msg);
+ MEDCOUPLING_EXPORT static void CheckClosingParInRange(mcIdType ref, mcIdType value, const std::string& msg);
+ MEDCOUPLING_EXPORT static mcIdType EffectiveCircPerm(mcIdType nbOfShift, mcIdType nbOfTuples);
protected:
std::string _name;
std::vector<std::string> _info_on_compo;
namespace MEDCoupling
{
- class DataArrayInt32;
-
template<class T>
class DataArrayTemplate : public DataArray
{
std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT void updateTime() const { }
//
- MEDCOUPLING_EXPORT std::size_t getNumberOfTuples() const { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
- MEDCOUPLING_EXPORT std::size_t getNbOfElems() const { return _mem.getNbOfElem(); }
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuples() const { return ToIdType(_info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents()); }
+ MEDCOUPLING_EXPORT mcIdType getNbOfElems() const { return ToIdType(_mem.getNbOfElem()); }
MEDCOUPLING_EXPORT bool empty() const;
MEDCOUPLING_EXPORT void *getVoidStarPointer() { return getPointer(); }
MEDCOUPLING_EXPORT const T *getConstPointer() const { return _mem.getConstPointer(); }
MEDCOUPLING_EXPORT T *rwBegin() { return getPointer(); }
MEDCOUPLING_EXPORT T *rwEnd() { return getPointer()+getNbOfElems(); }
MEDCOUPLING_EXPORT void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1);
- MEDCOUPLING_EXPORT void useArray(const T *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo);
- MEDCOUPLING_EXPORT void useExternalArrayWithRWAccess(const T *array, int nbOfTuple, int nbOfCompo);
- MEDCOUPLING_EXPORT T getIJSafe(int tupleId, int compoId) const;
- MEDCOUPLING_EXPORT T getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; }
- MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, T newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); }
- MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, T newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; }
+ MEDCOUPLING_EXPORT void useArray(const T *array, bool ownership, DeallocType type, std::size_t nbOfTuple, std::size_t nbOfCompo);
+ MEDCOUPLING_EXPORT void useExternalArrayWithRWAccess(const T *array, std::size_t nbOfTuple, std::size_t nbOfCompo);
+ MEDCOUPLING_EXPORT T getIJSafe(std::size_t tupleId, std::size_t compoId) const;
+ MEDCOUPLING_EXPORT T getIJ(std::size_t tupleId, std::size_t compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; }
+ MEDCOUPLING_EXPORT void setIJ(std::size_t tupleId, std::size_t compoId, T newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); }
+ MEDCOUPLING_EXPORT void setIJSilent(std::size_t tupleId, std::size_t compoId, T newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; }
MEDCOUPLING_EXPORT T *getPointer() { return _mem.getPointer(); declareAsNew(); }
MEDCOUPLING_EXPORT void pack() const;
MEDCOUPLING_EXPORT bool isAllocated() const override;
MEDCOUPLING_EXPORT void checkAllocated() const;
MEDCOUPLING_EXPORT void desallocate();
MEDCOUPLING_EXPORT void reserve(std::size_t nbOfElems);
- MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo);
+ MEDCOUPLING_EXPORT void rearrange(std::size_t newNbOfCompo);
MEDCOUPLING_EXPORT void transpose();
MEDCOUPLING_EXPORT void pushBackSilent(T val);
MEDCOUPLING_EXPORT void pushBackValsSilent(const T *valsBg, const T *valsEnd);
MEDCOUPLING_EXPORT T front() const;
MEDCOUPLING_EXPORT T back() const;
MEDCOUPLING_EXPORT std::size_t getNbOfElemAllocated() const { return _mem.getNbOfElemAllocated(); }
- MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo);
+ MEDCOUPLING_EXPORT void allocIfNecessary(std::size_t nbOfTuple, std::size_t nbOfCompo);
MEDCOUPLING_EXPORT void deepCopyFrom(const DataArrayTemplate<T>& other);
MEDCOUPLING_EXPORT void reverse();
MEDCOUPLING_EXPORT void fillWithValue(T val);
MEDCOUPLING_EXPORT void reAlloc(std::size_t newNbOfTuple);
- MEDCOUPLING_EXPORT void renumberInPlace(const int *old2New);
- MEDCOUPLING_EXPORT void renumberInPlaceR(const int *new2Old);
+ MEDCOUPLING_EXPORT void renumberInPlace(const mcIdType *old2New);
+ MEDCOUPLING_EXPORT void renumberInPlaceR(const mcIdType *new2Old);
MEDCOUPLING_EXPORT void sort(bool asc=true);
- MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *renumber(const int *old2New) const;
- MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *renumberR(const int *new2Old) const;
- MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *renumberAndReduce(const int *old2New, int newNbOfTuple) const;
- MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *changeNbOfComponents(int newNbOfComp, T dftValue) const;
- MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *subArray(int tupleIdBg, int tupleIdEnd=-1) const;
+ MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *renumber(const mcIdType *old2New) const;
+ MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *renumberR(const mcIdType *new2Old) const;
+ MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *renumberAndReduce(const mcIdType *old2New, mcIdType newNbOfTuple) const;
+ MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *changeNbOfComponents(std::size_t newNbOfComp, T dftValue) const;
+ MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd=-1) const;
MEDCOUPLING_EXPORT MCAuto<typename Traits<T>::ArrayTypeCh> selectPartDef(const PartDefinition* pd) const;
- MEDCOUPLING_EXPORT void circularPermutation(int nbOfShift=1);
- MEDCOUPLING_EXPORT void circularPermutationPerTuple(int nbOfShift=1);
+ MEDCOUPLING_EXPORT void circularPermutation(mcIdType nbOfShift=1);
+ MEDCOUPLING_EXPORT void circularPermutationPerTuple(mcIdType nbOfShift=1);
MEDCOUPLING_EXPORT void reversePerTuple();
- MEDCOUPLING_EXPORT void setPartOfValues1(const typename Traits<T>::ArrayType *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true);
- MEDCOUPLING_EXPORT void setPartOfValuesSimple1(T a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp);
- MEDCOUPLING_EXPORT void setPartOfValues2(const typename Traits<T>::ArrayType *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true);
- MEDCOUPLING_EXPORT void setPartOfValuesSimple2(T a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp);
- MEDCOUPLING_EXPORT void setPartOfValues3(const typename Traits<T>::ArrayType *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true);
- MEDCOUPLING_EXPORT void setPartOfValuesSimple3(T a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp);
- MEDCOUPLING_EXPORT void setPartOfValues4(const typename Traits<T>::ArrayType *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true);
- MEDCOUPLING_EXPORT void setPartOfValuesSimple4(T a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp);
- MEDCOUPLING_EXPORT void setPartOfValuesAdv(const typename Traits<T>::ArrayType *a, const DataArrayInt32 *tuplesSelec);
- MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt32 *tuplesSelec);
- MEDCOUPLING_EXPORT void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step);
- MEDCOUPLING_EXPORT T getMaxValue(int& tupleId) const;
+ MEDCOUPLING_EXPORT void setPartOfValues1(const typename Traits<T>::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true);
+ MEDCOUPLING_EXPORT void setPartOfValuesSimple1(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp);
+ MEDCOUPLING_EXPORT void setPartOfValues2(const typename Traits<T>::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare=true);
+ MEDCOUPLING_EXPORT void setPartOfValuesSimple2(T a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp);
+ MEDCOUPLING_EXPORT void setPartOfValues3(const typename Traits<T>::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true);
+ MEDCOUPLING_EXPORT void setPartOfValuesSimple3(T a, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp);
+ MEDCOUPLING_EXPORT void setPartOfValues4(const typename Traits<T>::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare=true);
+ MEDCOUPLING_EXPORT void setPartOfValuesSimple4(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp);
+ MEDCOUPLING_EXPORT void setPartOfValuesAdv(const typename Traits<T>::ArrayType *a, const DataArrayIdType *tuplesSelec);
+ MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(mcIdType tupleIdStart, const DataArray *aBase, const DataArrayIdType *tuplesSelec);
+ MEDCOUPLING_EXPORT void setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, const DataArray *aBase, mcIdType bg, mcIdType end2, mcIdType step);
+ MEDCOUPLING_EXPORT T getMaxValue(mcIdType& tupleId) const;
MEDCOUPLING_EXPORT T getMaxValueInArray() const;
MEDCOUPLING_EXPORT T getMaxAbsValue(std::size_t& tupleId) const;
MEDCOUPLING_EXPORT T getMaxAbsValueInArray() const;
- MEDCOUPLING_EXPORT T getMinValue(int& tupleId) const;
+ MEDCOUPLING_EXPORT T getMinValue(mcIdType& tupleId) const;
MEDCOUPLING_EXPORT T getMinValueInArray() const;
- MEDCOUPLING_EXPORT void getTuple(int tupleId, T *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
+ MEDCOUPLING_EXPORT void getTuple(mcIdType tupleId, T *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
template<class InputIterator>
void insertAtTheEnd(InputIterator first, InputIterator last);
MEDCOUPLING_EXPORT static void SetArrayIn(typename Traits<T>::ArrayType *newArray, typename Traits<T>::ArrayType* &arrayToSet);
- MEDCOUPLING_EXPORT void writeOnPlace(std::size_t id, T element0, const T *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
+ MEDCOUPLING_EXPORT void writeOnPlace(std::size_t id, T element0, const T *others, mcIdType sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
MEDCOUPLING_EXPORT void fillWithZero();
public:
MEDCOUPLING_EXPORT MemArray<T>& accessToMemArray() { return _mem; }
protected:
typename Traits<T>::ArrayType *mySelectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const;
typename Traits<T>::ArrayType *mySelectByTupleId(const DataArrayIdType& di) const;
- typename Traits<T>::ArrayType *mySelectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const;
- typename Traits<T>::ArrayType *myKeepSelectedComponents(const std::vector<int>& compoIds) const;
- typename Traits<T>::ArrayType *mySelectByTupleIdSafeSlice(int bg, int end2, int step) const;
- typename Traits<T>::ArrayType *mySelectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const;
+ typename Traits<T>::ArrayType *mySelectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const;
+ typename Traits<T>::ArrayType *myKeepSelectedComponents(const std::vector<std::size_t>& compoIds) const;
+ typename Traits<T>::ArrayType *mySelectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const;
+ typename Traits<T>::ArrayType *mySelectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const;
protected:
MemArray<T> _mem;
};
{
public:
MEDCOUPLING_EXPORT MCAuto<DataArrayDouble> convertToDblArr() const;
- MEDCOUPLING_EXPORT MCAuto<DataArrayInt32> convertToIntArr() const;
+ MEDCOUPLING_EXPORT MCAuto<DataArrayInt> convertToIntArr() const;
MEDCOUPLING_EXPORT MCAuto<DataArrayFloat> convertToFloatArr() const;
- MEDCOUPLING_EXPORT void applyLin(T a, T b, int compoId);
+ MEDCOUPLING_EXPORT void applyLin(T a, T b, std::size_t compoId);
MEDCOUPLING_EXPORT void applyLin(T a, T b);
MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *negate() const;
MEDCOUPLING_EXPORT void addEqual(const typename Traits<T>::ArrayType *other);
MEDCOUPLING_EXPORT static typename Traits<T>::ArrayType *Multiply(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2);
MEDCOUPLING_EXPORT static typename Traits<T>::ArrayType *Meld(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2);
MEDCOUPLING_EXPORT static typename Traits<T>::ArrayType *Meld(const std::vector<const typename Traits<T>::ArrayType *>& arr);
- MEDCOUPLING_EXPORT MCAuto<DataArrayInt32> findIdsGreaterOrEqualTo(T val) const;
- MEDCOUPLING_EXPORT MCAuto<DataArrayInt32> findIdsGreaterThan(T val) const;
- MEDCOUPLING_EXPORT MCAuto<DataArrayInt32> findIdsLowerOrEqualTo(T val) const;
- MEDCOUPLING_EXPORT MCAuto<DataArrayInt32> findIdsLowerThan(T val) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *findIdsStrictlyNegative() const;
+ MEDCOUPLING_EXPORT MCAuto<DataArrayIdType> findIdsGreaterOrEqualTo(T val) const;
+ MEDCOUPLING_EXPORT MCAuto<DataArrayIdType> findIdsGreaterThan(T val) const;
+ MEDCOUPLING_EXPORT MCAuto<DataArrayIdType> findIdsLowerOrEqualTo(T val) const;
+ MEDCOUPLING_EXPORT MCAuto<DataArrayIdType> findIdsLowerThan(T val) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findIdsStrictlyNegative() const;
MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *fromNoInterlace() const;
MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *toNoInterlace() const;
MEDCOUPLING_EXPORT void meldWith(const typename Traits<T>::ArrayType *other);
- MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *duplicateEachTupleNTimes(int nbTimes) const;
+ MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *duplicateEachTupleNTimes(mcIdType nbTimes) const;
MEDCOUPLING_EXPORT void aggregate(const typename Traits<T>::ArrayType *other);
MEDCOUPLING_EXPORT void abs();
MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *computeAbs() const;
protected:
static typename Traits<T>::ArrayType *PerformCopyOrIncrRef(bool dCpy, const typename Traits<T>::ArrayType& self);
template<class OP>
- MCAuto<DataArrayInt32> findIdsAdv(const OP& op) const;
+ MCAuto<DataArrayIdType> findIdsAdv(const OP& op) const;
private:
template<class FCT>
void somethingEqual(const typename Traits<T>::ArrayType *other);
public:// abstract method overload
MEDCOUPLING_EXPORT DataArrayFloat *deepCopy() const;
MEDCOUPLING_EXPORT DataArrayFloat *buildNewEmptyInstance() const { return DataArrayFloat::New(); }
- MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const { return DataArrayTemplateFP<float>::mySelectByTupleRanges(ranges); }
- MEDCOUPLING_EXPORT DataArrayFloat *keepSelectedComponents(const std::vector<int>& compoIds) const { return DataArrayTemplateFP<float>::myKeepSelectedComponents(compoIds); }
+ MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const { return DataArrayTemplateFP<float>::mySelectByTupleRanges(ranges); }
+ MEDCOUPLING_EXPORT DataArrayFloat *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const { return DataArrayTemplateFP<float>::myKeepSelectedComponents(compoIds); }
MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
- MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplateFP<float>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
- MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplateFP<float>::mySelectByTupleIdSafeSlice(bg,end2,step); }
+ MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplateFP<float>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+ MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplateFP<float>::mySelectByTupleIdSafeSlice(bg,end2,step); }
MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const;
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
MEDCOUPLING_EXPORT DataArrayDouble *buildNewEmptyInstance() const { return DataArrayDouble::New(); }
MEDCOUPLING_EXPORT void checkMonotonic(bool increasing, double eps) const;
MEDCOUPLING_EXPORT bool isMonotonic(bool increasing, double eps) const;
- MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const std::string& nameInFile, DataArrayByte *byteArr) const;
+ MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, mcIdType indent, const std::string& nameInFile, DataArrayByte *byteArr) const;
MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const;
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const;
MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); }
- MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplateFP<double>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
- MEDCOUPLING_EXPORT DataArrayDouble *keepSelectedComponents(const std::vector<int>& compoIds) const { return DataArrayTemplateFP<double>::myKeepSelectedComponents(compoIds); }
- MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplateFP<double>::mySelectByTupleIdSafeSlice(bg,end2,step); }
- MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const { return DataArrayTemplateFP<double>::mySelectByTupleRanges(ranges); }
- MEDCOUPLING_EXPORT bool areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayInt32 *&tupleIds) const;
- MEDCOUPLING_EXPORT void findCommonTuples(double prec, int limitTupleId, DataArrayInt32 *&comm, DataArrayInt32 *&commIndex) const;
- MEDCOUPLING_EXPORT double minimalDistanceTo(const DataArrayDouble *other, int& thisTupleId, int& otherTupleId) const;
- MEDCOUPLING_EXPORT DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *findClosestTupleId(const DataArrayDouble *other) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const;
- MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayDouble *a, const std::vector<int>& compoIds);
+ MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplateFP<double>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+ MEDCOUPLING_EXPORT DataArrayDouble *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const { return DataArrayTemplateFP<double>::myKeepSelectedComponents(compoIds); }
+ MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplateFP<double>::mySelectByTupleIdSafeSlice(bg,end2,step); }
+ MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const { return DataArrayTemplateFP<double>::mySelectByTupleRanges(ranges); }
+ MEDCOUPLING_EXPORT bool areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayIdType *&tupleIds) const;
+ MEDCOUPLING_EXPORT void findCommonTuples(double prec, mcIdType limitTupleId, DataArrayIdType *&comm, DataArrayIdType *&commIndex) const;
+ MEDCOUPLING_EXPORT double minimalDistanceTo(const DataArrayDouble *other, mcIdType& thisTupleId, mcIdType& otherTupleId) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getDifferentValues(double prec, mcIdType limitTupleId=-1) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findClosestTupleId(const DataArrayDouble *other) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const;
+ MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayDouble *a, const std::vector<std::size_t>& compoIds);
MEDCOUPLING_EXPORT DataArrayDoubleIterator *iterator();
MEDCOUPLING_EXPORT void checkNoNullValues() const;
MEDCOUPLING_EXPORT void getMinMaxPerComponent(double *bounds) const;
MEDCOUPLING_EXPORT DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const;
- MEDCOUPLING_EXPORT void computeTupleIdsNearTuples(const DataArrayDouble *other, double eps, DataArrayInt32 *& c, DataArrayInt32 *& cI) const;
+ MEDCOUPLING_EXPORT void computeTupleIdsNearTuples(const DataArrayDouble *other, double eps, DataArrayIdType *& c, DataArrayIdType *& cI) const;
MEDCOUPLING_EXPORT void recenterForMaxPrecision(double eps);
- MEDCOUPLING_EXPORT double getMaxValue2(DataArrayInt32*& tupleIds) const;
- MEDCOUPLING_EXPORT double getMinValue2(DataArrayInt32*& tupleIds) const;
- MEDCOUPLING_EXPORT int count(double value, double eps) const;
+ MEDCOUPLING_EXPORT double getMaxValue2(DataArrayIdType*& tupleIds) const;
+ MEDCOUPLING_EXPORT double getMinValue2(DataArrayIdType*& tupleIds) const;
+ MEDCOUPLING_EXPORT mcIdType count(double value, double eps) const;
MEDCOUPLING_EXPORT double getAverageValue() const;
MEDCOUPLING_EXPORT double norm2() const;
MEDCOUPLING_EXPORT double normMax() const;
MEDCOUPLING_EXPORT void normMaxPerComponent(double * res) const;
MEDCOUPLING_EXPORT double normMin() const;
MEDCOUPLING_EXPORT void accumulate(double *res) const;
- MEDCOUPLING_EXPORT double accumulate(int compId) const;
- MEDCOUPLING_EXPORT DataArrayDouble *accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const;
+ MEDCOUPLING_EXPORT double accumulate(std::size_t compId) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *accumulatePerChunck(const mcIdType *bgOfIndex, const mcIdType *endOfIndex) const;
MEDCOUPLING_EXPORT MCAuto<DataArrayDouble> cumSum() const;
- MEDCOUPLING_EXPORT double distanceToTuple(const double *tupleBg, const double *tupleEnd, int& tupleId) const;
+ MEDCOUPLING_EXPORT double distanceToTuple(const double *tupleBg, const double *tupleEnd, mcIdType& tupleId) const;
MEDCOUPLING_EXPORT DataArrayDouble *fromPolarToCart() const;
MEDCOUPLING_EXPORT DataArrayDouble *fromCylToCart() const;
MEDCOUPLING_EXPORT DataArrayDouble *fromSpherToCart() const;
MEDCOUPLING_EXPORT DataArrayDouble *deviator() const;
MEDCOUPLING_EXPORT DataArrayDouble *magnitude() const;
MEDCOUPLING_EXPORT DataArrayDouble *maxPerTuple() const;
- MEDCOUPLING_EXPORT DataArrayDouble *maxPerTupleWithCompoId(DataArrayInt32* &compoIdOfMaxPerTuple) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *maxPerTupleWithCompoId(DataArrayIdType* &compoIdOfMaxPerTuple) const;
MEDCOUPLING_EXPORT DataArrayDouble *buildEuclidianDistanceDenseMatrix() const;
MEDCOUPLING_EXPORT DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const;
MEDCOUPLING_EXPORT void asArcOfCircle(double center[2], double& radius, double& ang) const;
MEDCOUPLING_EXPORT void applyInv(double numerator);
MEDCOUPLING_EXPORT void applyPow(double val);
MEDCOUPLING_EXPORT void applyRPow(double val);
- MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const;
- MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(std::size_t nbOfComp, FunctionToEvaluate func) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(std::size_t nbOfComp, const std::string& func, bool isSafe=true) const;
MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const;
MEDCOUPLING_EXPORT void applyFuncOnThis(const std::string& func, bool isSafe=true);
- MEDCOUPLING_EXPORT DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const;
- MEDCOUPLING_EXPORT DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *applyFuncCompo(std::size_t nbOfComp, const std::string& func, bool isSafe=true) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *applyFuncNamedCompo(std::size_t nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const;
MEDCOUPLING_EXPORT void applyFuncFast32(const std::string& func);
MEDCOUPLING_EXPORT void applyFuncFast64(const std::string& func);
MEDCOUPLING_EXPORT MCAuto<DataArrayDouble> symmetry3DPlane(const double point[3], const double normalVector[3]) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *findIdsInRange(double vmin, double vmax) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotInRange(double vmin, double vmax) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findIdsNotInRange(double vmin, double vmax) const;
MEDCOUPLING_EXPORT static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2);
MEDCOUPLING_EXPORT static DataArrayDouble *Aggregate(const std::vector<const DataArrayDouble *>& arr);
MEDCOUPLING_EXPORT static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2);
MEDCOUPLING_EXPORT static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2);
MEDCOUPLING_EXPORT void powEqual(const DataArrayDouble *other);
MEDCOUPLING_EXPORT std::vector<bool> toVectorOfBool(double eps) const;
- MEDCOUPLING_EXPORT static void Rotate2DAlg(const double *center, double angle, int nbNodes, const double *coordsIn, double *coordsOut);
- MEDCOUPLING_EXPORT static void Rotate3DAlg(const double *center, const double *vect, double angle, int nbNodes, const double *coordsIn, double *coordsOut);
- MEDCOUPLING_EXPORT static void Symmetry3DPlane(const double point[3], const double normalVector[3], int nbNodes, const double *coordsIn, double *coordsOut);
+ MEDCOUPLING_EXPORT static void Rotate2DAlg(const double *center, double angle, mcIdType nbNodes, const double *coordsIn, double *coordsOut);
+ MEDCOUPLING_EXPORT static void Rotate3DAlg(const double *center, const double *vect, double angle, mcIdType nbNodes, const double *coordsIn, double *coordsOut);
+ MEDCOUPLING_EXPORT static void Symmetry3DPlane(const double point[3], const double normalVector[3], mcIdType nbNodes, const double *coordsIn, double *coordsOut);
MEDCOUPLING_EXPORT static void GiveBaseForPlane(const double normalVector[3], double baseOfPlane[9]);
MEDCOUPLING_EXPORT static void ComputeIntegralOfSeg2IntoTri3(const double seg2[4], const double tri3[6], double coeffs[3], double& length);
public:
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
- MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
- MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
- public:
- template<int SPACEDIM>
- void findCommonTuplesAlg(const double *bbox, int nbNodes, int limitNodeId, double prec, DataArrayInt32 *c, DataArrayInt32 *cI) const;
- template<int SPACEDIM>
- static void FindClosestTupleIdAlg(const BBTreePts<SPACEDIM,int>& myTree, double dist, const double *pos, int nbOfTuples, const double *thisPt, int thisNbOfTuples, int *res);
- template<int SPACEDIM>
- static void FindTupleIdsNearTuplesAlg(const BBTreePts<SPACEDIM,int>& myTree, const double *pos, int nbOfTuples, double eps,
- DataArrayInt32 *c, DataArrayInt32 *cI);
+ MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI);
+ MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
+ public:
+ template<mcIdType SPACEDIM>
+ void findCommonTuplesAlg(const double *bbox, mcIdType nbNodes, mcIdType limitNodeId, double prec, DataArrayIdType *c, DataArrayIdType *cI) const;
+ template<mcIdType SPACEDIM>
+ static void FindClosestTupleIdAlg(const BBTreePts<SPACEDIM,mcIdType>& myTree, double dist, const double *pos, mcIdType nbOfTuples, const double *thisPt, mcIdType thisNbOfTuples, mcIdType *res);
+ template<mcIdType SPACEDIM>
+ static void FindTupleIdsNearTuplesAlg(const BBTreePts<SPACEDIM,mcIdType>& myTree, const double *pos, mcIdType nbOfTuples, double eps,
+ DataArrayIdType *c, DataArrayIdType *cI);
private:
~DataArrayDouble() { }
DataArrayDouble() { }
};
+}
+namespace MEDCoupling
+{
template<class T>
class DataArrayDiscrete : public DataArrayTemplateClassic<T>
{
public:
- MEDCOUPLING_EXPORT static typename Traits<T>::ArrayType *New();
+ typedef typename Traits<T>::ArrayType DataArrayType;
+ public:
+ MEDCOUPLING_EXPORT static DataArrayType *New();
+ MEDCOUPLING_EXPORT T intValue() const;
MEDCOUPLING_EXPORT bool isEqual(const DataArrayDiscrete<T>& other) const;
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayDiscrete<T>& other, std::string& reason) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayDiscrete<T>& other) const;
MEDCOUPLING_EXPORT bool isMonotonic(bool increasing) const;
MEDCOUPLING_EXPORT void checkStrictlyMonotonic(bool increasing) const;
MEDCOUPLING_EXPORT bool isStrictlyMonotonic(bool increasing) const;
- MEDCOUPLING_EXPORT int getHashCode() const;
+ MEDCOUPLING_EXPORT mcIdType getHashCode() const;
MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const;
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
- MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const;
+ MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, mcIdType indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const;
MEDCOUPLING_EXPORT void transformWithIndArr(const T *indArrBg, const T *indArrEnd);
- MEDCOUPLING_EXPORT void transformWithIndArr(const MapKeyVal<T>& m);
+ MEDCOUPLING_EXPORT void transformWithIndArr(const MapKeyVal<T, T>& m);
MEDCOUPLING_EXPORT DataArrayIdType *findIdsEqual(T val) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *transformWithIndArrR(const T *indArr2Bg, const T *indArrEnd) const;
+ MEDCOUPLING_EXPORT void splitByValueRange(const T *arrBg, const T *arrEnd,
+ DataArrayType *& castArr, DataArrayType *& rankInsideCast, DataArrayType *& castsPresent) const;
+ MEDCOUPLING_EXPORT bool isRange(T& strt, T& sttoopp, T& stteepp) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *invertArrayO2N2N2O(mcIdType newNbOfElem) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *invertArrayN2O2O2N(mcIdType oldNbOfElem) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *invertArrayO2N2N2OBis(mcIdType newNbOfElem) const;
+ MEDCOUPLING_EXPORT MCAuto< MapKeyVal<T, mcIdType> > invertArrayN2O2O2NOptimized() const;
+ MEDCOUPLING_EXPORT MCAuto< MapKeyVal<mcIdType, T> > giveN2OOptimized() const;
+ MEDCOUPLING_EXPORT MCAuto<DataArrayIdType> findIdForEach(const T *valsBg, const T *valsEnd) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *checkAndPreparePermutation() const;
+ MEDCOUPLING_EXPORT void changeSurjectiveFormat(T targetNb, DataArrayIdType *&arr, DataArrayIdType *&arrI) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *buildPermArrPerLevel() const;
+ MEDCOUPLING_EXPORT bool isIota(mcIdType sizeExpected) const;
+ MEDCOUPLING_EXPORT bool isUniform(T val) const;
+ MEDCOUPLING_EXPORT T checkUniformAndGuess() const;
+ MEDCOUPLING_EXPORT bool hasUniqueValues() const;
+ MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayType *a, const std::vector<std::size_t>& compoIds);
+ MEDCOUPLING_EXPORT DataArrayIdType *findIdsNotEqual(T val) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findIdsEqualTuple(const T *tupleBg, const T *tupleEnd) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findIdsEqualList(const T *valsBg, const T *valsEnd) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findIdsNotEqualList(const T *valsBg, const T *valsEnd) const;
+ MEDCOUPLING_EXPORT mcIdType findIdFirstEqual(T value) const;
+ MEDCOUPLING_EXPORT mcIdType findIdFirstEqual(const std::vector<T>& vals) const;
+ MEDCOUPLING_EXPORT mcIdType findIdFirstEqualTuple(const std::vector<T>& tupl) const;
+ MEDCOUPLING_EXPORT mcIdType findIdSequence(const std::vector<T>& vals) const;
+ MEDCOUPLING_EXPORT mcIdType changeValue(T oldValue, T newValue);
+ MEDCOUPLING_EXPORT mcIdType count(T value) const;
+ MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector<T>& tupl) const;
+ MEDCOUPLING_EXPORT bool presenceOfValue(T value) const;
+ MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector<T>& vals) const;
+ MEDCOUPLING_EXPORT void accumulate(T *res) const;
+ MEDCOUPLING_EXPORT T accumulate(std::size_t compId) const;
+ MEDCOUPLING_EXPORT DataArrayType *accumulatePerChunck(const mcIdType *bgOfIndex, const mcIdType *endOfIndex) const;
+ MEDCOUPLING_EXPORT void getMinMaxValues(T& minValue, T& maxValue) const;
+ MEDCOUPLING_EXPORT void applyInv(T numerator);
+ MEDCOUPLING_EXPORT void applyDivideBy(T val);
+ MEDCOUPLING_EXPORT void applyModulus(T val);
+ MEDCOUPLING_EXPORT void applyRModulus(T val);
+ MEDCOUPLING_EXPORT void applyPow(T val);
+ MEDCOUPLING_EXPORT void applyRPow(T val);
+ MEDCOUPLING_EXPORT DataArrayIdType *findIdsInRange(T vmin, T vmax) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findIdsNotInRange(T vmin, T vmax) const;
+ MEDCOUPLING_EXPORT bool checkAllIdsInRange(T vmin, T vmax) const;
+ MEDCOUPLING_EXPORT static DataArrayType *Aggregate(const DataArrayType *a1, const DataArrayType *a2, T offsetA2);
+ MEDCOUPLING_EXPORT static DataArrayType *Aggregate(const std::vector<const DataArrayType *>& arr);
+ MEDCOUPLING_EXPORT static DataArrayType *AggregateIndexes(const std::vector<const DataArrayType *>& arrs);
+ MEDCOUPLING_EXPORT static DataArrayType *BuildUnion(const std::vector<const DataArrayType *>& arr);
+ MEDCOUPLING_EXPORT static DataArrayType *BuildIntersection(const std::vector<const DataArrayType *>& arr);
+ MEDCOUPLING_EXPORT static void PutIntoToSkylineFrmt(const std::vector< std::vector<T> >& v, DataArrayType *& data, DataArrayIdType *& dataIndex);
+ MEDCOUPLING_EXPORT DataArrayIdType *buildComplement(mcIdType nbOfElement) const;
+ MEDCOUPLING_EXPORT DataArrayType *buildSubstraction(const DataArrayType *other) const;
+ MEDCOUPLING_EXPORT DataArrayType *buildSubstractionOptimized(const DataArrayType *other) const;
+ MEDCOUPLING_EXPORT DataArrayType *buildUnion(const DataArrayType *other) const;
+ MEDCOUPLING_EXPORT DataArrayType *buildIntersection(const DataArrayType *other) const;
+ MEDCOUPLING_EXPORT DataArrayType *buildUnique() const;
+ MEDCOUPLING_EXPORT DataArrayType *buildUniqueNotSorted() const;
+ MEDCOUPLING_EXPORT DataArrayType *deltaShiftIndex() const;
+ MEDCOUPLING_EXPORT void computeOffsets();
+ MEDCOUPLING_EXPORT void computeOffsetsFull();
+ MEDCOUPLING_EXPORT void findIdsRangesInListOfIds(const DataArrayType *listOfIds, DataArrayIdType *& rangeIdsFetched, DataArrayType *& idsInInputListThatFetch) const;
+ MEDCOUPLING_EXPORT DataArrayType *buildExplicitArrByRanges(const DataArrayType *offsets) const;
+ MEDCOUPLING_EXPORT DataArrayType *buildExplicitArrOfSliceOnScaledArr(T begin, T stop, T step) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findRangeIdForEachTuple(const DataArrayType *ranges) const;
+ MEDCOUPLING_EXPORT DataArrayType *findIdInRangeForEachTuple(const DataArrayType *ranges) const;
+ MEDCOUPLING_EXPORT void sortEachPairToMakeALinkedList();
+ MEDCOUPLING_EXPORT MCAuto<DataArrayType> fromLinkedListOfPairToList() const;
+ MEDCOUPLING_EXPORT DataArrayType *getDifferentValues() const;
+ MEDCOUPLING_EXPORT std::vector<DataArrayIdType *> partitionByDifferentValues(std::vector<T>& differentIds) const;
+ MEDCOUPLING_EXPORT std::vector< std::pair<mcIdType,mcIdType> > splitInBalancedSlices(mcIdType nbOfSlices) const;
+ MEDCOUPLING_EXPORT static DataArrayType *Modulus(const DataArrayType *a1, const DataArrayType *a2);
+ MEDCOUPLING_EXPORT void modulusEqual(const DataArrayType *other);
+ MEDCOUPLING_EXPORT static DataArrayType *Pow(const DataArrayType *a1, const DataArrayType *a2);
+ MEDCOUPLING_EXPORT void powEqual(const DataArrayType *other);
+ //MEDCOUPLING_EXPORT MemArray<T>& accessToMemArray() { return _mem; }
+ //MEDCOUPLING_EXPORT const MemArray<T>& accessToMemArray() const { return _mem; }
+ public:
+ MEDCOUPLING_EXPORT static DataArrayIdType *FindPermutationFromFirstToSecond(const DataArrayType *ids1, const DataArrayType *ids2);
+ MEDCOUPLING_EXPORT static mcIdType *CheckAndPreparePermutation(const T *start, const T *end);
+ MEDCOUPLING_EXPORT static DataArrayType *BuildListOfSwitchedOn(const std::vector<bool>& v);
+ MEDCOUPLING_EXPORT static DataArrayType *BuildListOfSwitchedOff(const std::vector<bool>& v);
+ MEDCOUPLING_EXPORT static DataArrayIdType *ConvertIndexArrayToO2N(mcIdType nbOfOldTuples, const mcIdType *arr, const mcIdType *arrIBg, const mcIdType *arrIEnd, mcIdType &newNbOfTuples);
+ MEDCOUPLING_EXPORT static DataArrayIdType *MakePartition(const std::vector<const DataArrayType *>& groups, mcIdType newNb, std::vector< std::vector<mcIdType> >& fidsOfGroups);
+ public:
+ MEDCOUPLING_EXPORT static void ExtractFromIndexedArrays(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd,
+ const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn,
+ DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut);
+ MEDCOUPLING_EXPORT static void ExtractFromIndexedArraysSlice(mcIdType idsOfSelectStart, mcIdType idsOfSelectStop, mcIdType idsOfSelectStep,
+ const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn,
+ DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut);
+ MEDCOUPLING_EXPORT static void SetPartOfIndexedArrays(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd,
+ const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn,
+ const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex,
+ DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut);
+ MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSlice(mcIdType start, mcIdType end, mcIdType step,
+ const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn,
+ const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex,
+ DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut);
+ MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSameIdx(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd,
+ DataArrayType *arrInOut, const DataArrayIdType *arrIndxIn,
+ const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex);
+ MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSameIdxSlice(mcIdType start, mcIdType end, mcIdType step,
+ DataArrayType *arrInOut, const DataArrayIdType *arrIndxIn,
+ const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex);
+ MEDCOUPLING_EXPORT static bool RemoveIdsFromIndexedArrays(const T *idsToRemoveBg, const T *idsToRemoveEnd,
+ DataArrayType *arr, DataArrayIdType *arrIndx, mcIdType offsetForRemoval=0);
+ MEDCOUPLING_EXPORT static DataArrayType *Range(T begin, T end, T step);
+ public:
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
+ MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI);
+ MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
protected:
template<class ALG>
void switchOnTupleAlg(T val, std::vector<bool>& vec, ALG algo) const;
{
friend class DataArrayDiscrete<Int32>;
public:
- MEDCOUPLING_EXPORT int intValue() const;
MEDCOUPLING_EXPORT DataArrayInt32 *deepCopy() const;//ok
MEDCOUPLING_EXPORT DataArrayInt32 *buildNewEmptyInstance() const { return DataArrayInt32::New(); }//ok
- MEDCOUPLING_EXPORT DataArrayInt32 *transformWithIndArrR(const int *indArr2Bg, const int *indArrEnd) const;
- MEDCOUPLING_EXPORT void splitByValueRange(const int *arrBg, const int *arrEnd,
- DataArrayInt32 *& castArr, DataArrayInt32 *& rankInsideCast, DataArrayInt32 *& castsPresent) const;
- MEDCOUPLING_EXPORT bool isRange(int& strt, int& sttoopp, int& stteepp) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *invertArrayO2N2N2O(int newNbOfElem) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *invertArrayN2O2O2N(int oldNbOfElem) const;
- MEDCOUPLING_EXPORT MCAuto< MapKeyVal<int> > invertArrayN2O2O2NOptimized() const;
- MEDCOUPLING_EXPORT MCAuto< MapKeyVal<int> > giveN2OOptimized() const;
- MEDCOUPLING_EXPORT DataArrayInt32 *invertArrayO2N2N2OBis(int newNbOfElem) const;
+ public:
MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); }
- MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate<int>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
- MEDCOUPLING_EXPORT DataArrayInt32 *keepSelectedComponents(const std::vector<int>& compoIds) const { return DataArrayTemplate<int>::myKeepSelectedComponents(compoIds); }
- MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplate<int>::mySelectByTupleIdSafeSlice(bg,end2,step); }
- MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const { return DataArrayTemplate<int>::mySelectByTupleRanges(ranges); }
- MEDCOUPLING_EXPORT DataArrayInt32 *checkAndPreparePermutation() const;
- MEDCOUPLING_EXPORT static DataArrayInt32 *FindPermutationFromFirstToSecond(const DataArrayInt32 *ids1, const DataArrayInt32 *ids2);
- MEDCOUPLING_EXPORT void changeSurjectiveFormat(int targetNb, DataArrayInt32 *&arr, DataArrayInt32 *&arrI) const;
- MEDCOUPLING_EXPORT static DataArrayInt32 *ConvertIndexArrayToO2N(int nbOfOldTuples, const int *arr, const int *arrIBg, const int *arrIEnd, int &newNbOfTuples);
- MEDCOUPLING_EXPORT DataArrayInt32 *buildPermArrPerLevel() const;
- MEDCOUPLING_EXPORT bool isIota(int sizeExpected) const;
- MEDCOUPLING_EXPORT bool isUniform(int val) const;
- MEDCOUPLING_EXPORT int checkUniformAndGuess() const;
- MEDCOUPLING_EXPORT bool hasUniqueValues() const;
- MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayInt32 *a, const std::vector<int>& compoIds);
+ MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+ MEDCOUPLING_EXPORT DataArrayInt32 *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const { return this->myKeepSelectedComponents(compoIds); }
+ MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return this->mySelectByTupleIdSafeSlice(bg,end2,step); }
+ MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const { return this->mySelectByTupleRanges(ranges); }
+ public:
MEDCOUPLING_EXPORT DataArrayInt32Iterator *iterator();
- MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotEqual(int val) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *findIdsEqualList(const int *valsBg, const int *valsEnd) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotEqualList(const int *valsBg, const int *valsEnd) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *findIdsEqualTuple(const int *tupleBg, const int *tupleEnd) const;
- MEDCOUPLING_EXPORT MCAuto<DataArrayInt32> findIdForEach(const int *valsBg, const int *valsEnd) const;
- MEDCOUPLING_EXPORT int changeValue(int oldValue, int newValue);
- MEDCOUPLING_EXPORT int findIdFirstEqualTuple(const std::vector<int>& tupl) const;
- MEDCOUPLING_EXPORT int findIdFirstEqual(int value) const;
- MEDCOUPLING_EXPORT int findIdFirstEqual(const std::vector<int>& vals) const;
- MEDCOUPLING_EXPORT int findIdSequence(const std::vector<int>& vals) const;
- MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector<int>& tupl) const;
- MEDCOUPLING_EXPORT bool presenceOfValue(int value) const;
- MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector<int>& vals) const;
- MEDCOUPLING_EXPORT int count(int value) const;
- MEDCOUPLING_EXPORT void accumulate(int *res) const;
- MEDCOUPLING_EXPORT int accumulate(int compId) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const;
- MEDCOUPLING_EXPORT void getMinMaxValues(int& minValue, int& maxValue) const;
- MEDCOUPLING_EXPORT void applyInv(int numerator);
- MEDCOUPLING_EXPORT void applyDivideBy(int val);
- MEDCOUPLING_EXPORT void applyModulus(int val);
- MEDCOUPLING_EXPORT void applyRModulus(int val);
- MEDCOUPLING_EXPORT void applyPow(int val);
- MEDCOUPLING_EXPORT void applyRPow(int val);
- MEDCOUPLING_EXPORT DataArrayInt32 *findIdsInRange(int vmin, int vmax) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotInRange(int vmin, int vmax) const;
- MEDCOUPLING_EXPORT bool checkAllIdsInRange(int vmin, int vmax) const;
- MEDCOUPLING_EXPORT static DataArrayInt32 *Aggregate(const DataArrayInt32 *a1, const DataArrayInt32 *a2, int offsetA2);
- MEDCOUPLING_EXPORT static DataArrayInt32 *Aggregate(const std::vector<const DataArrayInt32 *>& arr);
- MEDCOUPLING_EXPORT static DataArrayInt32 *AggregateIndexes(const std::vector<const DataArrayInt32 *>& arrs);
- MEDCOUPLING_EXPORT static DataArrayInt32 *MakePartition(const std::vector<const DataArrayInt32 *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups);
- MEDCOUPLING_EXPORT static DataArrayInt32 *BuildUnion(const std::vector<const DataArrayInt32 *>& arr);
- MEDCOUPLING_EXPORT static DataArrayInt32 *BuildIntersection(const std::vector<const DataArrayInt32 *>& arr);
- MEDCOUPLING_EXPORT static DataArrayInt32 *BuildListOfSwitchedOn(const std::vector<bool>& v);
- MEDCOUPLING_EXPORT static DataArrayInt32 *BuildListOfSwitchedOff(const std::vector<bool>& v);
- MEDCOUPLING_EXPORT static void PutIntoToSkylineFrmt(const std::vector< std::vector<int> >& v, DataArrayInt32 *& data, DataArrayInt32 *& dataIndex);
- MEDCOUPLING_EXPORT DataArrayInt32 *buildComplement(int nbOfElement) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *buildSubstraction(const DataArrayInt32 *other) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *buildSubstractionOptimized(const DataArrayInt32 *other) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *buildUnion(const DataArrayInt32 *other) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *buildIntersection(const DataArrayInt32 *other) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *buildUnique() const;
- MEDCOUPLING_EXPORT DataArrayInt32 *buildUniqueNotSorted() const;
- MEDCOUPLING_EXPORT DataArrayInt32 *deltaShiftIndex() const;
- MEDCOUPLING_EXPORT void computeOffsets();
- MEDCOUPLING_EXPORT void computeOffsetsFull();
- MEDCOUPLING_EXPORT void findIdsRangesInListOfIds(const DataArrayInt32 *listOfIds, DataArrayInt32 *& rangeIdsFetched, DataArrayInt32 *& idsInInputListThatFetch) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *buildExplicitArrByRanges(const DataArrayInt32 *offsets) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *buildExplicitArrOfSliceOnScaledArr(int begin, int stop, int step) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *findRangeIdForEachTuple(const DataArrayInt32 *ranges) const;
- MEDCOUPLING_EXPORT DataArrayInt32 *findIdInRangeForEachTuple(const DataArrayInt32 *ranges) const;
- MEDCOUPLING_EXPORT void sortEachPairToMakeALinkedList();
- MEDCOUPLING_EXPORT MCAuto<DataArrayInt32> fromLinkedListOfPairToList() const;
- MEDCOUPLING_EXPORT DataArrayInt32 *getDifferentValues() const;
- MEDCOUPLING_EXPORT std::vector<DataArrayInt32 *> partitionByDifferentValues(std::vector<int>& differentIds) const;
- MEDCOUPLING_EXPORT std::vector< std::pair<int,int> > splitInBalancedSlices(int nbOfSlices) const;
- MEDCOUPLING_EXPORT static DataArrayInt32 *Modulus(const DataArrayInt32 *a1, const DataArrayInt32 *a2);
- MEDCOUPLING_EXPORT void modulusEqual(const DataArrayInt32 *other);
- MEDCOUPLING_EXPORT static DataArrayInt32 *Pow(const DataArrayInt32 *a1, const DataArrayInt32 *a2);
- MEDCOUPLING_EXPORT void powEqual(const DataArrayInt32 *other);
- MEDCOUPLING_EXPORT MemArray<int>& accessToMemArray() { return _mem; }
- MEDCOUPLING_EXPORT const MemArray<int>& accessToMemArray() const { return _mem; }
- public:
- MEDCOUPLING_EXPORT static void ExtractFromIndexedArrays(const int *idsOfSelectBg, const int *idsOfSelectEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
- DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut);
- MEDCOUPLING_EXPORT static void ExtractFromIndexedArraysSlice(int idsOfSelectStart, int idsOfSelectStop, int idsOfSelectStep, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
- DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut);
- MEDCOUPLING_EXPORT static void SetPartOfIndexedArrays(const int *idsOfSelectBg, const int *idsOfSelectEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
- const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex,
- DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut);
- MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSlice(int start, int end, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
- const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex,
- DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut);
- MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSameIdx(const int *idsOfSelectBg, const int *idsOfSelectEnd, DataArrayInt *arrInOut, const DataArrayInt *arrIndxIn,
- const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex);
- MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSameIdxSlice(int start, int end, int step, DataArrayInt *arrInOut, const DataArrayInt *arrIndxIn,
- const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex);
- MEDCOUPLING_EXPORT static bool RemoveIdsFromIndexedArrays(const int *idsToRemoveBg, const int *idsToRemoveEnd, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0);
- MEDCOUPLING_EXPORT static int *CheckAndPreparePermutation(const int *start, const int *end);
- MEDCOUPLING_EXPORT static DataArrayInt32 *Range(int begin, int end, int step);
- public:
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
- MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
- MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
- MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
private:
~DataArrayInt32() { }
DataArrayInt32() { }
};
- class DataArrayInt64 : public DataArrayDiscrete<Int64>
+ class DataArrayInt64 : public DataArrayDiscreteSigned<Int64>
{
friend class DataArrayDiscrete<Int64>;
public:
MEDCOUPLING_EXPORT DataArrayInt64 *deepCopy() const;
MEDCOUPLING_EXPORT DataArrayInt64 *buildNewEmptyInstance() const { return DataArrayInt64::New(); }//ok
+ public:
MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); }
- MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate<Int64>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
- MEDCOUPLING_EXPORT DataArrayInt64 *keepSelectedComponents(const std::vector<int>& compoIds) const { return DataArrayTemplate<Int64>::myKeepSelectedComponents(compoIds); }
- MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplate<Int64>::mySelectByTupleIdSafeSlice(bg,end2,step); }
- MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const { return DataArrayTemplate<Int64>::mySelectByTupleRanges(ranges); }
+ MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplate<Int64>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+ MEDCOUPLING_EXPORT DataArrayInt64 *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const { return DataArrayTemplate<Int64>::myKeepSelectedComponents(compoIds); }
+ MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate<Int64>::mySelectByTupleIdSafeSlice(bg,end2,step); }
+ MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const { return DataArrayTemplate<Int64>::mySelectByTupleRanges(ranges); }
+ public:
+ MEDCOUPLING_EXPORT DataArrayInt64Iterator *iterator();
private:
~DataArrayInt64() { }
DataArrayInt64() { }
};
-
+}
+
+namespace MEDCoupling
+{
+
template<class T>
template<class OP>
- MCAuto<DataArrayInt> DataArrayTemplateClassic<T>::findIdsAdv(const OP& op) const
+ MCAuto<DataArrayIdType> DataArrayTemplateClassic<T>::findIdsAdv(const OP& op) const
{
this->checkAllocated();
if(this->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::findIdsAdv : this must have exactly one component !");
const T *cptr(this->begin());
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- int nbOfTuples(this->getNumberOfTuples());
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
+ mcIdType nbOfTuples=this->getNumberOfTuples();
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(op(*cptr))
ret->pushBackSilent(i);
return ret;
{
public:
MEDCOUPLING_EXPORT virtual DataArrayChar *buildEmptySpecializedDAChar() const = 0;
- MEDCOUPLING_EXPORT int getHashCode() const;
+ MEDCOUPLING_EXPORT mcIdType getHashCode() const;
MEDCOUPLING_EXPORT bool isEqual(const DataArrayChar& other) const;
MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayChar& other) const;
MEDCOUPLING_EXPORT DataArrayInt *convertToIntArr() const;
MEDCOUPLING_EXPORT DataArrayChar *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
MEDCOUPLING_EXPORT DataArrayChar *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); }
- MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate<char>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
- MEDCOUPLING_EXPORT DataArrayChar *keepSelectedComponents(const std::vector<int>& compoIds) const { return DataArrayTemplate<char>::myKeepSelectedComponents(compoIds); }
- MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplate<char>::mySelectByTupleIdSafeSlice(bg,end2,step); }
+ MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplate<char>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+ MEDCOUPLING_EXPORT DataArrayChar *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const { return DataArrayTemplate<char>::myKeepSelectedComponents(compoIds); }
+ MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate<char>::mySelectByTupleIdSafeSlice(bg,end2,step); }
MEDCOUPLING_EXPORT bool isUniform(char val) const;
MEDCOUPLING_EXPORT void meldWith(const DataArrayChar *other);
- MEDCOUPLING_EXPORT DataArray *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const { return DataArrayTemplate<char>::mySelectByTupleRanges(ranges); }
- MEDCOUPLING_EXPORT DataArrayInt *findIdsEqual(char val) const;
- MEDCOUPLING_EXPORT DataArrayInt *findIdsNotEqual(char val) const;
- MEDCOUPLING_EXPORT int findIdSequence(const std::vector<char>& vals) const;
- MEDCOUPLING_EXPORT int findIdFirstEqualTuple(const std::vector<char>& tupl) const;
- MEDCOUPLING_EXPORT int findIdFirstEqual(char value) const;
- MEDCOUPLING_EXPORT int findIdFirstEqual(const std::vector<char>& vals) const;
+ MEDCOUPLING_EXPORT DataArray *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const { return DataArrayTemplate<char>::mySelectByTupleRanges(ranges); }
+ MEDCOUPLING_EXPORT DataArrayIdType *findIdsEqual(char val) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findIdsNotEqual(char val) const;
+ MEDCOUPLING_EXPORT mcIdType findIdSequence(const std::vector<char>& vals) const;
+ MEDCOUPLING_EXPORT mcIdType findIdFirstEqualTuple(const std::vector<char>& tupl) const;
+ MEDCOUPLING_EXPORT mcIdType findIdFirstEqual(char value) const;
+ MEDCOUPLING_EXPORT mcIdType findIdFirstEqual(const std::vector<char>& vals) const;
MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector<char>& tupl) const;
MEDCOUPLING_EXPORT bool presenceOfValue(char value) const;
MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector<char>& vals) const;
- MEDCOUPLING_EXPORT DataArrayInt *findIdsInRange(char vmin, char vmax) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findIdsInRange(char vmin, char vmax) const;
MEDCOUPLING_EXPORT static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2);
MEDCOUPLING_EXPORT static DataArrayChar *Aggregate(const std::vector<const DataArrayChar *>& arr);
MEDCOUPLING_EXPORT static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2);
MEDCOUPLING_EXPORT MemArray<char>& accessToMemArray() { return _mem; }
MEDCOUPLING_EXPORT const MemArray<char>& accessToMemArray() const { return _mem; }
public:
- //MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+ //MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
//MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
- //MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
- //MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
+ //MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI);
+ //MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
protected:
DataArrayChar() { }
};
private:
typename Traits<T>::ArrayType *_da;
T *_pt;
- int _tuple_id;
- int _nb_comp;
- int _nb_tuple;
+ mcIdType _tuple_id;
+ std::size_t _nb_comp;
+ mcIdType _nb_tuple;
};
template<class T>
class DataArrayTuple
{
public:
- MEDCOUPLING_EXPORT DataArrayTuple(T *pt, int nbOfComp);
- MEDCOUPLING_EXPORT std::string repr() const;
- MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; }
+ MEDCOUPLING_EXPORT DataArrayTuple(T *pt, std::size_t nbOfComp);
+ //MEDCOUPLING_EXPORT std::string repr() const;
+ MEDCOUPLING_EXPORT std::size_t getNumberOfCompo() const { return _nb_of_compo; }
MEDCOUPLING_EXPORT const T *getConstPointer() const { return _pt; }
MEDCOUPLING_EXPORT T *getPointer() { return _pt; }
- MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *buildDA(int nbOfTuples, int nbOfCompo) const;
+ MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *buildDA(std::size_t nbOfTuples, std::size_t nbOfCompo) const;
protected:
T zeValue() const;
protected:
T *_pt;
- int _nb_of_compo;
+ std::size_t _nb_of_compo;
};
class DataArrayDoubleTuple;
class DataArrayDoubleTuple : public DataArrayTuple<double>
{
public:
- MEDCOUPLING_EXPORT DataArrayDoubleTuple(double *pt, int nbOfComp);
+ MEDCOUPLING_EXPORT DataArrayDoubleTuple(double *pt, std::size_t nbOfComp);
MEDCOUPLING_EXPORT std::string repr() const;
MEDCOUPLING_EXPORT double doubleValue() const;
- MEDCOUPLING_EXPORT DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *buildDADouble(std::size_t nbOfTuples, std::size_t nbOfCompo) const;
};
class DataArrayFloatTuple;
class DataArrayFloatTuple : public DataArrayTuple<float>
{
public:
- MEDCOUPLING_EXPORT DataArrayFloatTuple(float *pt, int nbOfComp);
+ MEDCOUPLING_EXPORT DataArrayFloatTuple(float *pt, std::size_t nbOfComp);
MEDCOUPLING_EXPORT std::string repr() const;
MEDCOUPLING_EXPORT float floatValue() const;
- MEDCOUPLING_EXPORT DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const;
+ MEDCOUPLING_EXPORT DataArrayFloat *buildDAFloat(std::size_t nbOfTuples, std::size_t nbOfCompo) const;
};
- class DataArrayIntIterator : public DataArrayIterator<int>
+ class DataArrayInt32Iterator : public DataArrayIterator<Int32>
+ {
+ public:
+ MEDCOUPLING_EXPORT DataArrayInt32Iterator(DataArrayInt32 *da);
+ MEDCOUPLING_EXPORT ~DataArrayInt32Iterator() { }
+ };
+
+ class DataArrayInt64Iterator : public DataArrayIterator<Int64>
{
public:
- MEDCOUPLING_EXPORT DataArrayIntIterator(DataArrayInt *da);
- MEDCOUPLING_EXPORT ~DataArrayIntIterator() { }
+ MEDCOUPLING_EXPORT DataArrayInt64Iterator(DataArrayInt64 *da);
+ MEDCOUPLING_EXPORT ~DataArrayInt64Iterator() { }
};
class DataArrayInt32Tuple : public DataArrayTuple<Int32>
{
public:
- MEDCOUPLING_EXPORT DataArrayInt32Tuple(int *pt, int nbOfComp);
+ MEDCOUPLING_EXPORT DataArrayInt32Tuple(Int32 *pt, std::size_t nbOfComp);
+ MEDCOUPLING_EXPORT std::string repr() const;
+ MEDCOUPLING_EXPORT Int32 intValue() const;
+ MEDCOUPLING_EXPORT DataArrayInt32 *buildDAInt(std::size_t nbOfTuples, std::size_t nbOfCompo) const;
+ };
+
+ class DataArrayInt64Tuple : public DataArrayTuple<Int64>
+ {
+ public:
+ MEDCOUPLING_EXPORT DataArrayInt64Tuple(Int64 *pt, std::size_t nbOfComp);
MEDCOUPLING_EXPORT std::string repr() const;
- MEDCOUPLING_EXPORT int intValue() const;
- MEDCOUPLING_EXPORT DataArrayInt32 *buildDAInt(int nbOfTuples, int nbOfCompo) const;
+ MEDCOUPLING_EXPORT Int64 intValue() const;
+ MEDCOUPLING_EXPORT DataArrayInt64 *buildDAInt(std::size_t nbOfTuples, std::size_t nbOfCompo) const;
};
typedef DataArrayInt32Tuple DataArrayIntTuple;
private:
DataArrayAsciiChar *_da;
char *_pt;
- int _tuple_id;
- int _nb_comp;
- int _nb_tuple;
+ mcIdType _tuple_id;
+ std::size_t _nb_comp;
+ mcIdType _nb_tuple;
};
class DataArrayAsciiCharTuple
{
public:
- MEDCOUPLING_EXPORT DataArrayAsciiCharTuple(char *pt, int nbOfComp);
+ MEDCOUPLING_EXPORT DataArrayAsciiCharTuple(char *pt, std::size_t nbOfComp);
MEDCOUPLING_EXPORT std::string repr() const;
- MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; }
+ MEDCOUPLING_EXPORT std::size_t getNumberOfCompo() const { return _nb_of_compo; }
MEDCOUPLING_EXPORT const char *getConstPointer() const { return _pt; }
MEDCOUPLING_EXPORT char *getPointer() { return _pt; }
MEDCOUPLING_EXPORT char asciiCharValue() const;
- MEDCOUPLING_EXPORT DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const;
+ MEDCOUPLING_EXPORT DataArrayAsciiChar *buildDAAsciiChar(std::size_t nbOfTuples, std::size_t nbOfCompo) const;
private:
char *_pt;
- int _nb_of_compo;
+ std::size_t _nb_of_compo;
};
class DataArrayByteTuple;
private:
DataArrayByte *_da;
char *_pt;
- int _tuple_id;
- int _nb_comp;
- int _nb_tuple;
+ mcIdType _tuple_id;
+ std::size_t _nb_comp;
+ mcIdType _nb_tuple;
};
class DataArrayByteTuple
{
public:
- MEDCOUPLING_EXPORT DataArrayByteTuple(char *pt, int nbOfComp);
+ MEDCOUPLING_EXPORT DataArrayByteTuple(char *pt, std::size_t nbOfComp);
MEDCOUPLING_EXPORT std::string repr() const;
- MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; }
+ MEDCOUPLING_EXPORT std::size_t getNumberOfCompo() const { return _nb_of_compo; }
MEDCOUPLING_EXPORT const char *getConstPointer() const { return _pt; }
MEDCOUPLING_EXPORT char *getPointer() { return _pt; }
MEDCOUPLING_EXPORT char byteValue() const;
- MEDCOUPLING_EXPORT DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const;
+ MEDCOUPLING_EXPORT DataArrayByte *buildDAByte(std::size_t nbOfTuples, std::size_t nbOfCompo) const;
private:
char *_pt;
- int _nb_of_compo;
+ std::size_t _nb_of_compo;
};
}
template<class InputIterator>
void DataArrayTemplate<T>::insertAtTheEnd(InputIterator first, InputIterator last)
{
- int nbCompo(this->getNumberOfComponents());
+ std::size_t nbCompo(this->getNumberOfComponents());
if(nbCompo==1)
this->_mem.insertAtTheEnd(first,last);
else if(nbCompo==0)
#include "MEDCouplingPartDefinition.hxx"
#include "InterpKernelAutoPtr.hxx"
#include "MCAuto.hxx"
+#include "MEDCouplingMap.txx"
#include <sstream>
#include <cstdlib>
* \return True if a not null pointer is present, False if not.
*/
template<class T>
- bool MemArray<T>::reprHeader(int sl, std::ostream& stream) const
+ bool MemArray<T>::reprHeader(mcIdType sl, std::ostream& stream) const
{
stream << "Number of tuples : ";
if(!_pointer.isNull())
* \param [in] sl is typically the number of components
*/
template<class T>
- void MemArray<T>::repr(int sl, std::ostream& stream) const
+ void MemArray<T>::repr(mcIdType sl, std::ostream& stream) const
{
if(reprHeader(sl,stream))
{
* \param [in] sl is typically the number of components
*/
template<class T>
- void MemArray<T>::reprZip(int sl, std::ostream& stream) const
+ void MemArray<T>::reprZip(mcIdType sl, std::ostream& stream) const
{
stream << "Number of tuples : ";
if(!_pointer.isNull())
* \param [in] sl is typically the number of components
*/
template<class T>
- void MemArray<T>::reprNotTooLong(int sl, std::ostream& stream) const
+ void MemArray<T>::reprNotTooLong(mcIdType sl, std::ostream& stream) const
{
if(reprHeader(sl,stream))
{
}
template<class T>
- T *MemArray<T>::fromNoInterlace(int nbOfComp) const
+ T *MemArray<T>::fromNoInterlace(std::size_t nbOfComp) const
{
if(nbOfComp<1)
throw INTERP_KERNEL::Exception("MemArray<T>::fromNoInterlace : number of components must be > 0 !");
T *ret=(T*)malloc(_nb_of_elem*sizeof(T));
T *w=ret;
for(std::size_t i=0;i<nbOfTuples;i++)
- for(int j=0;j<nbOfComp;j++,w++)
+ for(std::size_t j=0;j<nbOfComp;j++,w++)
*w=pt[j*nbOfTuples+i];
return ret;
}
template<class T>
- T *MemArray<T>::toNoInterlace(int nbOfComp) const
+ T *MemArray<T>::toNoInterlace(std::size_t nbOfComp) const
{
if(nbOfComp<1)
throw INTERP_KERNEL::Exception("MemArray<T>::toNoInterlace : number of components must be > 0 !");
std::size_t nbOfTuples=_nb_of_elem/nbOfComp;
T *ret=(T*)malloc(_nb_of_elem*sizeof(T));
T *w=ret;
- for(int i=0;i<nbOfComp;i++)
+ for(std::size_t i=0;i<nbOfComp;i++)
for(std::size_t j=0;j<nbOfTuples;j++,w++)
*w=pt[j*nbOfComp+i];
return ret;
}
template<class T>
- void MemArray<T>::reverse(int nbOfComp)
+ void MemArray<T>::reverse(std::size_t nbOfComp)
{
if(nbOfComp<1)
throw INTERP_KERNEL::Exception("MemArray<T>::reverse : only supported with 'this' array with ONE or more than ONE component !");
std::size_t nbOfTuples=_nb_of_elem/nbOfComp;
for(std::size_t i=0;i<nbOfTuples/2;i++,pt+=nbOfComp,pt2-=nbOfComp)
{
- for(int j=0;j<nbOfComp;j++)
+ for(std::size_t j=0;j<nbOfComp;j++)
std::swap(pt[j],pt2[j]);
}
}
//////////////////////////////////
template<class T>
- DataArrayTuple<T>::DataArrayTuple(T *pt, int nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
+ DataArrayTuple<T>::DataArrayTuple(T *pt, std::size_t nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
{
}
}
template<class T>
- typename Traits<T>::ArrayType *DataArrayTuple<T>::buildDA(int nbOfTuples, int nbOfCompo) const
+ typename Traits<T>::ArrayType *DataArrayTuple<T>::buildDA(std::size_t nbOfTuples, std::size_t nbOfCompo) const
{
if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1))
{
//////////////////////////////////
+ /*!
+ * This method is useful to slice work among a pool of threads or processes. \a begin, \a end \a step is the input whole slice of work to perform,
+ * typically it is a whole slice of tuples of DataArray or cells, nodes of a mesh...
+ *
+ * The input \a sliceId should be an id in [0, \a nbOfSlices) that specifies the slice of work.
+ *
+ * \param [in] start - the start of the input slice of the whole work to perform split into slices.
+ * \param [in] stop - the stop of the input slice of the whole work to perform split into slices.
+ * \param [in] step - the step (that can be <0) of the input slice of the whole work to perform split into slices.
+ * \param [in] sliceId - the slice id considered
+ * \param [in] nbOfSlices - the number of slices (typically the number of cores on which the work is expected to be sliced)
+ * \param [out] startSlice - the start of the slice considered
+ * \param [out] stopSlice - the stop of the slice consided
+ *
+ * \throw If \a step == 0
+ * \throw If \a nbOfSlices not > 0
+ * \throw If \a sliceId not in [0,nbOfSlices)
+ */
+ template <class T>
+ void DataArrayTools<T>::GetSlice(T start, T stop, T step, mcIdType sliceId, mcIdType nbOfSlices, T& startSlice, T& stopSlice)
+ {
+ if(nbOfSlices<=0)
+ {
+ std::ostringstream oss; oss << "DataArray::GetSlice : nbOfSlices (" << nbOfSlices << ") must be > 0 !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(sliceId<0 || sliceId>=nbOfSlices)
+ {
+ std::ostringstream oss; oss << "DataArray::GetSlice : sliceId (" << nbOfSlices << ") must be in [0 , nbOfSlices (" << nbOfSlices << ") ) !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ mcIdType nbElems=DataArrayTemplate<T>::GetNumberOfItemGivenBESRelative(start,stop,step,"DataArray::GetSlice");
+ mcIdType minNbOfElemsPerSlice=nbElems/nbOfSlices;
+ startSlice=start+minNbOfElemsPerSlice*step*sliceId;
+ if(sliceId<nbOfSlices-1)
+ stopSlice=start+minNbOfElemsPerSlice*step*(sliceId+1);
+ else
+ stopSlice=stop;
+ }
+
+ template <class T>
+ mcIdType DataArrayTools<T>::GetNumberOfItemGivenBES(T begin, T end, T step, const std::string& msg)
+ {
+ if(end<begin)
+ {
+ std::ostringstream oss; oss << msg << " : end before begin !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(end==begin)
+ return 0;
+ if(step<=0)
+ {
+ std::ostringstream oss; oss << msg << " : invalid step should be > 0 !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ return ToIdType((end-1-begin)/step+1);
+ }
+
+ template <class T>
+ mcIdType DataArrayTools<T>::GetNumberOfItemGivenBESRelative(T begin, T end, T step, const std::string& msg)
+ {
+ if(step==0)
+ throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES : step=0 is not allowed !");
+ if(end<begin && step>0)
+ {
+ std::ostringstream oss; oss << msg << " : end before begin whereas step is positive !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(begin<end && step<0)
+ {
+ std::ostringstream oss; oss << msg << " : invalid step should be > 0 !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(begin!=end)
+ return ToIdType((std::max(begin,end)-1-std::min(begin,end))/std::abs(step)+1);
+ else
+ return 0;
+ }
+
+ template <class T>
+ mcIdType DataArrayTools<T>::GetPosOfItemGivenBESRelativeNoThrow(T value, T begin, T end, T step)
+ {
+ if (step == 0)
+ return -1;
+
+ if((step>0 && begin<=value && value<end) ||
+ (step<0 && begin>=value && value>end))
+ {
+ mcIdType id = ToIdType((value-begin)/step);
+ if (begin + step * id == value)
+ return id;
+ else
+ return -1;
+ }
+ else
+ return -1;
+ }
+
+ //////////////////////////////////
+
template<class T>
MCAuto< typename Traits<T>::ArrayTypeCh > DataArrayTemplate<T>::NewFromStdVector(const typename std::vector<T>& v)
{
{
checkAllocated();
std::size_t sz(getNumberOfComponents());
- int nbTuples(getNumberOfTuples());
+ mcIdType nbTuples(getNumberOfTuples());
std::string name(getName());
std::vector<std::string> compNames(getInfoOnComponents());
std::vector< MCAuto< typename Traits<T>::ArrayTypeCh > > ret(sz);
part->setName(name);
part->setInfoOnComponent(0,compNames[i]);
T *otherPt(part->getPointer());
- for(int j=0;j<nbTuples;j++)
+ for(mcIdType j=0;j<nbTuples;j++)
otherPt[j]=thisPt[sz*j+i];
ret[i]=part;
}
* \param [in] nbOfCompo - new number of components in \a this.
*/
template<class T>
- void DataArrayTemplate<T>::useArray(const T *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo)
+ void DataArrayTemplate<T>::useArray(const T *array, bool ownership, DeallocType type, std::size_t nbOfTuple, std::size_t nbOfCompo)
{
_info_on_compo.resize(nbOfCompo);
- _mem.useArray(array,ownership,type,(std::size_t)nbOfTuple*nbOfCompo);
+ _mem.useArray(array,ownership,type,nbOfTuple*nbOfCompo);
declareAsNew();
}
template<class T>
- void DataArrayTemplate<T>::useExternalArrayWithRWAccess(const T *array, int nbOfTuple, int nbOfCompo)
+ void DataArrayTemplate<T>::useExternalArrayWithRWAccess(const T *array, std::size_t nbOfTuple, std::size_t nbOfCompo)
{
_info_on_compo.resize(nbOfCompo);
- _mem.useExternalArrayWithRWAccess(array,(std::size_t)nbOfTuple*nbOfCompo);
+ _mem.useExternalArrayWithRWAccess(array,nbOfTuple*nbOfCompo);
declareAsNew();
}
* \throw If condition <em>( 0 <= compoId < this->getNumberOfComponents() )</em> is violated.
*/
template<class T>
- T DataArrayTemplate<T>::getIJSafe(int tupleId, int compoId) const
+ T DataArrayTemplate<T>::getIJSafe(std::size_t tupleId, std::size_t compoId) const
{
checkAllocated();
- if(tupleId<0 || tupleId>=getNumberOfTuples())
+ if(ToIdType(tupleId)>=getNumberOfTuples())
{
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::getIJSafe : request for tupleId " << tupleId << " should be in [0," << getNumberOfTuples() << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- if(compoId<0 || compoId>=(int)getNumberOfComponents())
+ if(compoId>=getNumberOfComponents())
{
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::getIJSafe : request for compoId " << compoId << " should be in [0," << getNumberOfComponents() << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
template<class T>
void DataArrayTemplate<T>::reserve(std::size_t nbOfElems)
{
- int nbCompo(getNumberOfComponents());
+ std::size_t nbCompo(getNumberOfComponents());
if(nbCompo==1)
{
_mem.reserve(nbOfElems);
template<class T>
void DataArrayTemplate<T>::pushBackSilent(T val)
{
- int nbCompo(getNumberOfComponents());
+ std::size_t nbCompo(getNumberOfComponents());
if(nbCompo==1)
_mem.pushBack(val);
else if(nbCompo==0)
template<class T>
void DataArrayTemplate<T>::pushBackValsSilent(const T *valsBg, const T *valsEnd)
{
- int nbCompo(getNumberOfComponents());
+ std::size_t nbCompo(getNumberOfComponents());
if(nbCompo==1)
_mem.insertAtTheEnd(valsBg,valsEnd);
else if(nbCompo==0)
* \throw If \a nbOfTuple < 0 or \a nbOfCompo < 0.
*/
template<class T>
- void DataArrayTemplate<T>::allocIfNecessary(int nbOfTuple, int nbOfCompo)
+ void DataArrayTemplate<T>::allocIfNecessary(std::size_t nbOfTuple, std::size_t nbOfCompo)
{
if(isAllocated())
{
- if(nbOfTuple!=getNumberOfTuples() || nbOfCompo!=(int)getNumberOfComponents())
+ if(ToIdType(nbOfTuple)!=getNumberOfTuples() || nbOfCompo!=getNumberOfComponents())
alloc(nbOfTuple,nbOfCompo);
}
else
void DataArrayTemplate<T>::deepCopyFrom(const DataArrayTemplate<T>& other)
{
other.checkAllocated();
- int nbOfTuples(other.getNumberOfTuples()),nbOfComp(other.getNumberOfComponents());
+ mcIdType nbOfTuples(other.getNumberOfTuples());
+ std::size_t nbOfComp(other.getNumberOfComponents());
allocIfNecessary(nbOfTuples,nbOfComp);
- std::size_t nbOfElems((std::size_t)nbOfTuples*nbOfComp);
+ std::size_t nbOfElems(nbOfTuples*nbOfComp);
T *pt(getPointer());
const T *ptI(other.begin());
for(std::size_t i=0;i<nbOfElems;i++)
* giving a new position for i-th old value.
*/
template<class T>
- void DataArrayTemplate<T>::renumberInPlace(const int *old2New)
+ void DataArrayTemplate<T>::renumberInPlace(const mcIdType *old2New)
{
checkAllocated();
- int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
+ std::size_t nbOfCompo(getNumberOfComponents());
T *tmp(new T[nbTuples*nbOfCompo]);
const T *iptr(begin());
- for(int i=0;i<nbTuples;i++)
+ for(mcIdType i=0;i<nbTuples;i++)
{
- int v=old2New[i];
+ mcIdType v=old2New[i];
if(v>=0 && v<nbTuples)
std::copy(iptr+nbOfCompo*i,iptr+nbOfCompo*(i+1),tmp+nbOfCompo*v);
else
* is to delete using decrRef() as it is no more needed.
*/
template<class T>
- void DataArrayTemplate<T>::renumberInPlaceR(const int *new2Old)
+ void DataArrayTemplate<T>::renumberInPlaceR(const mcIdType *new2Old)
{
checkAllocated();
- int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
+ std::size_t nbOfCompo(getNumberOfComponents());
T *tmp(new T[nbTuples*nbOfCompo]);
const T *iptr(begin());
- for(int i=0;i<nbTuples;i++)
+ for(mcIdType i=0;i<nbTuples;i++)
{
- int v=new2Old[i];
+ mcIdType v=new2Old[i];
if(v>=0 && v<nbTuples)
std::copy(iptr+nbOfCompo*v,iptr+nbOfCompo*(v+1),tmp+nbOfCompo*i);
else
* \throw If \a this is not allocated.
*/
template<class T>
- typename Traits<T>::ArrayType *DataArrayTemplate<T>::renumber(const int *old2New) const
+ typename Traits<T>::ArrayType *DataArrayTemplate<T>::renumber(const mcIdType *old2New) const
{
checkAllocated();
- int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
+ std::size_t nbOfCompo(getNumberOfComponents());
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const T *iptr(begin());
T *optr(ret->getPointer());
- for(int i=0;i<nbTuples;i++)
+ for(mcIdType i=0;i<nbTuples;i++)
std::copy(iptr+nbOfCompo*i,iptr+nbOfCompo*(i+1),optr+nbOfCompo*old2New[i]);
ret->copyStringInfoFrom(*this);
return ret.retn();
* is to delete using decrRef() as it is no more needed.
*/
template<class T>
- typename Traits<T>::ArrayType *DataArrayTemplate<T>::renumberR(const int *new2Old) const
+ typename Traits<T>::ArrayType *DataArrayTemplate<T>::renumberR(const mcIdType *new2Old) const
{
checkAllocated();
- int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
+ std::size_t nbOfCompo(getNumberOfComponents());
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const T *iptr(getConstPointer());
T *optr(ret->getPointer());
- for(int i=0;i<nbTuples;i++)
+ for(mcIdType i=0;i<nbTuples;i++)
std::copy(iptr+nbOfCompo*new2Old[i],iptr+nbOfCompo*(new2Old[i]+1),optr+i*nbOfCompo);
ret->copyStringInfoFrom(*this);
return ret.retn();
* is to delete using decrRef() as it is no more needed.
*/
template<class T>
- typename Traits<T>::ArrayType *DataArrayTemplate<T>::renumberAndReduce(const int *old2New, int newNbOfTuple) const
+ typename Traits<T>::ArrayType *DataArrayTemplate<T>::renumberAndReduce(const mcIdType *old2New, mcIdType newNbOfTuple) const
{
checkAllocated();
- int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
+ std::size_t nbOfCompo(getNumberOfComponents());
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
ret->alloc(newNbOfTuple,nbOfCompo);
const T *iptr=getConstPointer();
T *optr=ret->getPointer();
- for(int i=0;i<nbTuples;i++)
+ for(mcIdType i=0;i<nbTuples;i++)
{
- int w=old2New[i];
+ mcIdType w=old2New[i];
if(w>=0)
std::copy(iptr+i*nbOfCompo,iptr+(i+1)*nbOfCompo,optr+w*nbOfCompo);
}
T *pt(ret->getPointer());
const T *srcPt(getConstPointer());
std::size_t i(0);
- for(const int *w=new2OldBg;w!=new2OldEnd;w++,i++)
+ for(const mcIdType *w=new2OldBg;w!=new2OldEnd;w++,i++)
std::copy(srcPt+(*w)*nbComp,srcPt+((*w)+1)*nbComp,pt+i*nbComp);
ret->copyStringInfoFrom(*this);
return ret.retn();
const SlicePartDefinition *spd(dynamic_cast<const SlicePartDefinition *>(pd));
if(spd)
{
- int a,b,c;
+ mcIdType a,b,c;
spd->getSlice(a,b,c);
- if(a==0 && b==(int)getNumberOfTuples() && c==1)
+ if(a==0 && b==getNumberOfTuples() && c==1)
{
DataArrayTemplate<T> *directRet(const_cast<DataArrayTemplate<T> *>(this));
directRet->incrRef();
const DataArrayPartDefinition *dpd(dynamic_cast<const DataArrayPartDefinition *>(pd));
if(dpd)
{
- MCAuto<DataArrayInt> arr(dpd->toDAI());
+ MCAuto<DataArrayIdType> arr(dpd->toDAI());
MCAuto<DataArray> ret2(selectByTupleIdSafe(arr->begin(),arr->end()));
return DynamicCastSafe<DataArray,typename Traits<T>::ArrayTypeCh>(ret2);
* \throw If \a new2OldEnd - \a new2OldBg > \a this->getNumberOfTuples().
*/
template<class T>
- typename Traits<T>::ArrayType *DataArrayTemplate<T>::mySelectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const
+ typename Traits<T>::ArrayType *DataArrayTemplate<T>::mySelectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const
{
checkAllocated();
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
- int nbComp(getNumberOfComponents()),oldNbOfTuples(getNumberOfTuples());
- ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp);
+ std::size_t nbComp(getNumberOfComponents());
+ mcIdType oldNbOfTuples(getNumberOfTuples());
+ ret->alloc(std::distance(new2OldBg,new2OldEnd),nbComp);
ret->copyStringInfoFrom(*this);
T *pt(ret->getPointer());
const T *srcPt(getConstPointer());
- int i(0);
- for(const int *w=new2OldBg;w!=new2OldEnd;w++,i++)
+ mcIdType i(0);
+ for(const mcIdType *w=new2OldBg;w!=new2OldEnd;w++,i++)
if(*w>=0 && *w<oldNbOfTuples)
std::copy(srcPt+(*w)*nbComp,srcPt+((*w)+1)*nbComp,pt+i*nbComp);
else
* \warning This method erases all (name and unit) component info set before!
*/
template<class T>
- void DataArrayTemplate<T>::rearrange(int newNbOfCompo)
+ void DataArrayTemplate<T>::rearrange(std::size_t newNbOfCompo)
{
checkAllocated();
if(newNbOfCompo<1)
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::rearrange : nbOfElems%newNbOfCompo!=0 !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- if(nbOfElems/newNbOfCompo>(std::size_t)std::numeric_limits<int>::max())
+ if(nbOfElems/newNbOfCompo>(std::size_t)std::numeric_limits<mcIdType>::max())
{
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::rearrange : the rearrangement leads to too high number of tuples (> 2147483647) !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
void DataArrayTemplate<T>::transpose()
{
checkAllocated();
- int nbOfTuples(getNumberOfTuples());
- rearrange(nbOfTuples);
+ rearrange(getNumberOfTuples());
}
/*!
* \throw If \a this is not allocated.
*/
template<class T>
- typename Traits<T>::ArrayType *DataArrayTemplate<T>::changeNbOfComponents(int newNbOfComp, T dftValue) const
+ typename Traits<T>::ArrayType *DataArrayTemplate<T>::changeNbOfComponents(std::size_t newNbOfComp, T dftValue) const
{
checkAllocated();
MCAuto<DataArray> ret0(buildNewEmptyInstance());
ret->alloc(getNumberOfTuples(),newNbOfComp);
const T *oldc(getConstPointer());
T *nc(ret->getPointer());
- int nbOfTuples(getNumberOfTuples()),oldNbOfComp(getNumberOfComponents());
- int dim(std::min(oldNbOfComp,newNbOfComp));
- for(int i=0;i<nbOfTuples;i++)
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t oldNbOfComp=getNumberOfComponents();
+ std::size_t dim(std::min(oldNbOfComp,newNbOfComp));
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
- int j=0;
+ std::size_t j=0;
for(;j<dim;j++)
nc[newNbOfComp*i+j]=oldc[i*oldNbOfComp+j];
for(;j<newNbOfComp;j++)
nc[newNbOfComp*i+j]=dftValue;
}
ret->setName(getName());
- for(int i=0;i<dim;i++)
+ for(std::size_t i=0;i<dim;i++)
ret->setInfoOnComponent(i,getInfoOnComponent(i));
ret->setName(getName());
return ret.retn();
* \endif
*/
template<class T>
- typename Traits<T>::ArrayType *DataArrayTemplate<T>::myKeepSelectedComponents(const std::vector<int>& compoIds) const
+ typename Traits<T>::ArrayType *DataArrayTemplate<T>::myKeepSelectedComponents(const std::vector<std::size_t>& compoIds) const
{
checkAllocated();
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
- std::size_t newNbOfCompo(compoIds.size());
- int oldNbOfCompo(getNumberOfComponents());
- for(std::vector<int>::const_iterator it=compoIds.begin();it!=compoIds.end();it++)
+ std::size_t newNbOfCompo=compoIds.size();
+ std::size_t oldNbOfCompo=getNumberOfComponents();
+ for(std::vector<std::size_t>::const_iterator it=compoIds.begin();it!=compoIds.end();it++)
if((*it)<0 || (*it)>=oldNbOfCompo)
{
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::keepSelectedComponents : invalid requested component : " << *it << " whereas it should be in [0," << oldNbOfCompo << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbOfTuples(getNumberOfTuples());
- ret->alloc(nbOfTuples,(int)newNbOfCompo);
+ mcIdType nbOfTuples(getNumberOfTuples());
+ ret->alloc(nbOfTuples,newNbOfCompo);
ret->copyPartOfStringInfoFrom(*this,compoIds);
const T *oldc(getConstPointer());
T *nc(ret->getPointer());
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
for(std::size_t j=0;j<newNbOfCompo;j++,nc++)
*nc=oldc[i*oldNbOfCompo+compoIds[j]];
return ret.retn();
* \sa DataArrayDouble::selectByTupleIdSafeSlice
*/
template<class T>
- typename Traits<T>::ArrayType *DataArrayTemplate<T>::subArray(int tupleIdBg, int tupleIdEnd) const
+ typename Traits<T>::ArrayType *DataArrayTemplate<T>::subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd) const
{
checkAllocated();
- int nbt(getNumberOfTuples());
+ mcIdType nbt=getNumberOfTuples();
if(tupleIdBg<0)
{
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::subArray : The tupleIdBg parameter must be greater than 0 !";
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << ":subArray : The tupleIdBg parameter is greater than number of tuples !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int trueEnd=tupleIdEnd;
+ mcIdType trueEnd=tupleIdEnd;
if(tupleIdEnd!=-1)
{
if(tupleIdEnd>nbt)
}
else
trueEnd=nbt;
- int nbComp(getNumberOfComponents());
+ std::size_t nbComp=getNumberOfComponents();
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
ret->alloc(trueEnd-tupleIdBg,nbComp);
* \sa DataArrayDouble::subArray.
*/
template<class T>
- typename Traits<T>::ArrayType *DataArrayTemplate<T>::mySelectByTupleIdSafeSlice(int bg, int end2, int step) const
+ typename Traits<T>::ArrayType *DataArrayTemplate<T>::mySelectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const
{
checkAllocated();
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
- int nbComp(getNumberOfComponents());
+ std::size_t nbComp(getNumberOfComponents());
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::selectByTupleIdSafeSlice : ";
- int newNbOfTuples(GetNumberOfItemGivenBESRelative(bg,end2,step,oss.str()));
+ mcIdType newNbOfTuples(GetNumberOfItemGivenBESRelative(bg,end2,step,oss.str()));
ret->alloc(newNbOfTuples,nbComp);
T *pt(ret->getPointer());
const T *srcPt(getConstPointer()+bg*nbComp);
- for(int i=0;i<newNbOfTuples;i++,srcPt+=step*nbComp)
+ for(mcIdType i=0;i<newNbOfTuples;i++,srcPt+=step*nbComp)
std::copy(srcPt,srcPt+nbComp,pt+i*nbComp);
ret->copyStringInfoFrom(*this);
return ret.retn();
* \endif
*/
template<class T>
- void DataArrayTemplate<T>::setPartOfValues1(const typename Traits<T>::ArrayType *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare)
+ void DataArrayTemplate<T>::setPartOfValues1(const typename Traits<T>::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare)
{
if(!a)
{
const char msg[]="DataArrayTemplate::setPartOfValues1";
checkAllocated();
a->checkAllocated();
- int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
- int newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg));
- int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples());
+ mcIdType newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
+ mcIdType newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg));
+ std::size_t nbComp(getNumberOfComponents());
+ mcIdType nbOfTuples(getNumberOfTuples());
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
- DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
+ DataArray::CheckValueInRangeEx(ToIdType(nbComp),bgComp,endComp,"invalid component value");
bool assignTech(true);
- if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
T *pt(getPointer()+bgTuples*nbComp+bgComp);
if(assignTech)
{
- for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
- for(int j=0;j<newNbOfComp;j++,srcPt++)
+ for(mcIdType i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+ for(mcIdType j=0;j<newNbOfComp;j++,srcPt++)
pt[j*stepComp]=*srcPt;
}
else
{
- for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+ for(mcIdType i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
{
const T*srcPt2=srcPt;
- for(int j=0;j<newNbOfComp;j++,srcPt2++)
+ for(mcIdType j=0;j<newNbOfComp;j++,srcPt2++)
pt[j*stepComp]=*srcPt2;
}
}
* \endif
*/
template<class T>
- void DataArrayTemplate<T>::setPartOfValuesSimple1(T a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp)
+ void DataArrayTemplate<T>::setPartOfValuesSimple1(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp)
{
const char msg[]="DataArrayTemplate::setPartOfValuesSimple1";
checkAllocated();
- int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
- int newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg));
- int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples());
+ mcIdType newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
+ mcIdType newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg));
+ std::size_t nbComp(getNumberOfComponents());
+ mcIdType nbOfTuples(getNumberOfTuples());
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
- DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
+ DataArray::CheckValueInRangeEx(ToIdType(nbComp),bgComp,endComp,"invalid component value");
T *pt=getPointer()+bgTuples*nbComp+bgComp;
- for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
- for(int j=0;j<newNbOfComp;j++)
+ for(mcIdType i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+ for(mcIdType j=0;j<newNbOfComp;j++)
pt[j*stepComp]=a;
}
* \endif
*/
template<class T>
- void DataArrayTemplate<T>::setPartOfValues2(const typename Traits<T>::ArrayType *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare)
+ void DataArrayTemplate<T>::setPartOfValues2(const typename Traits<T>::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare)
{
if(!a)
throw INTERP_KERNEL::Exception("DataArrayDouble::setPartOfValues2 : input DataArrayDouble is NULL !");
const char msg[]="DataArrayTemplate::setPartOfValues2";
checkAllocated();
a->checkAllocated();
- int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples());
- for(const int *z=bgComp;z!=endComp;z++)
- DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
- int newNbOfTuples((int)std::distance(bgTuples,endTuples));
- int newNbOfComp((int)std::distance(bgComp,endComp));
+ std::size_t nbComp(getNumberOfComponents());
+ mcIdType nbOfTuples(getNumberOfTuples());
+ for(const mcIdType *z=bgComp;z!=endComp;z++)
+ DataArray::CheckValueInRange(ToIdType(nbComp),*z,"invalid component id");
+ mcIdType newNbOfTuples(ToIdType(std::distance(bgTuples,endTuples)));
+ mcIdType newNbOfComp(ToIdType(std::distance(bgComp,endComp)));
bool assignTech(true);
- if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
const T *srcPt(a->getConstPointer());
if(assignTech)
{
- for(const int *w=bgTuples;w!=endTuples;w++)
+ for(const mcIdType *w=bgTuples;w!=endTuples;w++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
- for(const int *z=bgComp;z!=endComp;z++,srcPt++)
+ for(const mcIdType *z=bgComp;z!=endComp;z++,srcPt++)
{
pt[(std::size_t)(*w)*nbComp+(*z)]=*srcPt;
}
}
else
{
- for(const int *w=bgTuples;w!=endTuples;w++)
+ for(const mcIdType *w=bgTuples;w!=endTuples;w++)
{
const T *srcPt2=srcPt;
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
- for(const int *z=bgComp;z!=endComp;z++,srcPt2++)
+ for(const mcIdType *z=bgComp;z!=endComp;z++,srcPt2++)
{
pt[(std::size_t)(*w)*nbComp+(*z)]=*srcPt2;
}
* \endif
*/
template<class T>
- void DataArrayTemplate<T>::setPartOfValuesSimple2(T a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp)
+ void DataArrayTemplate<T>::setPartOfValuesSimple2(T a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp)
{
checkAllocated();
- int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples());
- for(const int *z=bgComp;z!=endComp;z++)
- DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
+ std::size_t nbComp=getNumberOfComponents();
+ mcIdType nbOfTuples=getNumberOfTuples();
+ for(const mcIdType *z=bgComp;z!=endComp;z++)
+ DataArray::CheckValueInRange(ToIdType(nbComp),*z,"invalid component id");
T *pt(getPointer());
- for(const int *w=bgTuples;w!=endTuples;w++)
- for(const int *z=bgComp;z!=endComp;z++)
+ for(const mcIdType *w=bgTuples;w!=endTuples;w++)
+ for(const mcIdType *z=bgComp;z!=endComp;z++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
pt[(std::size_t)(*w)*nbComp+(*z)]=a;
* \endif
*/
template<class T>
- void DataArrayTemplate<T>::setPartOfValues3(const typename Traits<T>::ArrayType *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare)
+ void DataArrayTemplate<T>::setPartOfValues3(const typename Traits<T>::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare)
{
if(!a)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValues3 : input DataArrayDouble is NULL !");
const char msg[]="DataArrayTemplate::setPartOfValues3";
checkAllocated();
a->checkAllocated();
- int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
- int nbComp=getNumberOfComponents();
- int nbOfTuples=getNumberOfTuples();
- DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
- int newNbOfTuples=(int)std::distance(bgTuples,endTuples);
+ mcIdType newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
+ std::size_t nbComp(getNumberOfComponents());
+ mcIdType nbOfTuples(getNumberOfTuples());
+ DataArray::CheckValueInRangeEx(ToIdType(nbComp),bgComp,endComp,"invalid component value");
+ mcIdType newNbOfTuples=ToIdType(std::distance(bgTuples,endTuples));
bool assignTech=true;
- if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
const T *srcPt(a->getConstPointer());
if(assignTech)
{
- for(const int *w=bgTuples;w!=endTuples;w++)
- for(int j=0;j<newNbOfComp;j++,srcPt++)
+ for(const mcIdType *w=bgTuples;w!=endTuples;w++)
+ for(mcIdType j=0;j<newNbOfComp;j++,srcPt++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
pt[(std::size_t)(*w)*nbComp+j*stepComp]=*srcPt;
}
else
{
- for(const int *w=bgTuples;w!=endTuples;w++)
+ for(const mcIdType *w=bgTuples;w!=endTuples;w++)
{
const T *srcPt2=srcPt;
- for(int j=0;j<newNbOfComp;j++,srcPt2++)
+ for(mcIdType j=0;j<newNbOfComp;j++,srcPt2++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
pt[(std::size_t)(*w)*nbComp+j*stepComp]=*srcPt2;
* \endif
*/
template<class T>
- void DataArrayTemplate<T>::setPartOfValuesSimple3(T a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp)
+ void DataArrayTemplate<T>::setPartOfValuesSimple3(T a, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp)
{
const char msg[]="DataArrayTemplate::setPartOfValuesSimple3";
checkAllocated();
- int newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg));
- int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples());
- DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
+ std::size_t newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg));
+ std::size_t nbComp(getNumberOfComponents());
+ mcIdType nbOfTuples(getNumberOfTuples());
+ DataArray::CheckValueInRangeEx(ToIdType(nbComp),bgComp,endComp,"invalid component value");
T *pt(getPointer()+bgComp);
- for(const int *w=bgTuples;w!=endTuples;w++)
- for(int j=0;j<newNbOfComp;j++)
+ for(const mcIdType *w=bgTuples;w!=endTuples;w++)
+ for(std::size_t j=0;j<newNbOfComp;j++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
pt[(std::size_t)(*w)*nbComp+j*stepComp]=a;
*
*/
template<class T>
- void DataArrayTemplate<T>::setPartOfValues4(const typename Traits<T>::ArrayType *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare)
+ void DataArrayTemplate<T>::setPartOfValues4(const typename Traits<T>::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare)
{if(!a)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValues4 : input DataArrayTemplate is NULL !");
const char msg[]="DataArrayTemplate::setPartOfValues4";
checkAllocated();
a->checkAllocated();
- int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
- int newNbOfComp((int)std::distance(bgComp,endComp));
- int nbComp(getNumberOfComponents());
- for(const int *z=bgComp;z!=endComp;z++)
- DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
- int nbOfTuples(getNumberOfTuples());
+ mcIdType newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
+ std::size_t newNbOfComp(std::distance(bgComp,endComp));
+ std::size_t nbComp(getNumberOfComponents());
+ for(const mcIdType *z=bgComp;z!=endComp;z++)
+ DataArray::CheckValueInRange(ToIdType(nbComp),*z,"invalid component id");
+ mcIdType nbOfTuples(getNumberOfTuples());
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
bool assignTech(true);
- if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==ToIdType(newNbOfTuples*newNbOfComp))
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
T *pt(getPointer()+bgTuples*nbComp);
if(assignTech)
{
- for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
- for(const int *z=bgComp;z!=endComp;z++,srcPt++)
+ for(mcIdType i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+ for(const mcIdType *z=bgComp;z!=endComp;z++,srcPt++)
pt[*z]=*srcPt;
}
else
{
- for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+ for(mcIdType i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
{
const T *srcPt2(srcPt);
- for(const int *z=bgComp;z!=endComp;z++,srcPt2++)
+ for(const mcIdType *z=bgComp;z!=endComp;z++,srcPt2++)
pt[*z]=*srcPt2;
}
}
}
template<class T>
- void DataArrayTemplate<T>::setPartOfValuesSimple4(T a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp)
+ void DataArrayTemplate<T>::setPartOfValuesSimple4(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp)
{
const char msg[]="DataArrayTemplate::setPartOfValuesSimple4";
checkAllocated();
- int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
- int nbComp(getNumberOfComponents());
- for(const int *z=bgComp;z!=endComp;z++)
- DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
- int nbOfTuples(getNumberOfTuples());
+ mcIdType newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
+ std::size_t nbComp(getNumberOfComponents());
+ for(const mcIdType *z=bgComp;z!=endComp;z++)
+ DataArray::CheckValueInRange(ToIdType(nbComp),*z,"invalid component id");
+ mcIdType nbOfTuples(getNumberOfTuples());
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
T *pt=getPointer()+bgTuples*nbComp;
- for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
- for(const int *z=bgComp;z!=endComp;z++)
+ for(mcIdType i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+ for(const mcIdType *z=bgComp;z!=endComp;z++)
pt[*z]=a;
}
* the corresponding (\a this or \a a) array.
*/
template<class T>
- void DataArrayTemplate<T>::setPartOfValuesAdv(const typename Traits<T>::ArrayType *a, const DataArrayInt *tuplesSelec)
+ void DataArrayTemplate<T>::setPartOfValuesAdv(const typename Traits<T>::ArrayType *a, const DataArrayIdType *tuplesSelec)
{
if(!a || !tuplesSelec)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValuesAdv : input DataArrayTemplate is NULL !");
throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValuesAdv : This and a do not have the same number of components !");
if(tuplesSelec->getNumberOfComponents()!=2)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValuesAdv : Expecting to have a tuple selector DataArrayInt instance with exactly 2 components !");
- int thisNt(getNumberOfTuples());
- int aNt(a->getNumberOfTuples());
+ mcIdType thisNt(getNumberOfTuples());
+ mcIdType aNt(a->getNumberOfTuples());
T *valsToSet(getPointer());
const T *valsSrc(a->getConstPointer());
- for(const int *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple+=2)
+ for(const mcIdType *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple+=2)
{
if(tuple[1]>=0 && tuple[1]<aNt)
{
* \a aBase array.
*/
template<class T>
- void DataArrayTemplate<T>::setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec)
+ void DataArrayTemplate<T>::setContigPartOfSelectedValues(mcIdType tupleIdStart, const DataArray *aBase, const DataArrayIdType *tuplesSelec)
{
if(!aBase || !tuplesSelec)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : input DataArray is NULL !");
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : This and a do not have the same number of components !");
if(tuplesSelec->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : Expecting to have a tuple selector DataArrayInt instance with exactly 1 component !");
- int thisNt(getNumberOfTuples());
- int aNt(a->getNumberOfTuples());
- int nbOfTupleToWrite(tuplesSelec->getNumberOfTuples());
+ mcIdType thisNt(getNumberOfTuples());
+ mcIdType aNt(a->getNumberOfTuples());
+ mcIdType nbOfTupleToWrite(tuplesSelec->getNumberOfTuples());
T *valsToSet(getPointer()+tupleIdStart*nbOfComp);
if(tupleIdStart+nbOfTupleToWrite>thisNt)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : invalid number range of values to write !");
const T *valsSrc=a->getConstPointer();
- for(const int *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple++,valsToSet+=nbOfComp)
+ for(const mcIdType *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple++,valsToSet+=nbOfComp)
{
if(*tuple>=0 && *tuple<aNt)
{
* for the array \a aBase.
*/
template<class T>
- void DataArrayTemplate<T>::setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step)
+ void DataArrayTemplate<T>::setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, const DataArray *aBase, mcIdType bg, mcIdType end2, mcIdType step)
{
if(!aBase)
{
a->checkAllocated();
std::size_t nbOfComp(getNumberOfComponents());
const char msg[]="DataArrayDouble::setContigPartOfSelectedValuesSlice";
- int nbOfTupleToWrite(DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg));
+ mcIdType nbOfTupleToWrite(DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg));
if(nbOfComp!=a->getNumberOfComponents())
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : This and a do not have the same number of components !");
- int thisNt(getNumberOfTuples()),aNt(a->getNumberOfTuples());
+ mcIdType thisNt(getNumberOfTuples());
+ mcIdType aNt(a->getNumberOfTuples());
T *valsToSet(getPointer()+tupleIdStart*nbOfComp);
if(tupleIdStart+nbOfTupleToWrite>thisNt)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : invalid number range of values to write !");
if(end2>aNt)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : invalid range of values to read !");
const T *valsSrc(a->getConstPointer()+bg*nbOfComp);
- for(int i=0;i<nbOfTupleToWrite;i++,valsToSet+=nbOfComp,valsSrc+=step*nbOfComp)
+ for(mcIdType i=0;i<nbOfTupleToWrite;i++,valsToSet+=nbOfComp,valsSrc+=step*nbOfComp)
{
std::copy(valsSrc,valsSrc+nbOfComp,valsToSet);
}
* \throw If \a this is not allocated.
*/
template<class T>
- typename Traits<T>::ArrayType *DataArrayTemplate<T>::mySelectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const
+ typename Traits<T>::ArrayType *DataArrayTemplate<T>::mySelectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const
{
checkAllocated();
- int nbOfComp(getNumberOfComponents()),nbOfTuplesThis(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
+ mcIdType nbOfTuplesThis(getNumberOfTuples());
if(ranges.empty())
{
MCAuto<DataArray> ret0(buildNewEmptyInstance());
ret->copyStringInfoFrom(*this);
return ret.retn();
}
- int ref(ranges.front().first),nbOfTuples(0);
+ mcIdType ref(ranges.front().first),nbOfTuples(0);
bool isIncreasing(true);
- for(std::vector<std::pair<int,int> >::const_iterator it=ranges.begin();it!=ranges.end();it++)
+ for(std::vector<std::pair<mcIdType,mcIdType> >::const_iterator it=ranges.begin();it!=ranges.end();it++)
{
if((*it).first<=(*it).second)
{
ret->copyStringInfoFrom(*this);
const T *src(getConstPointer());
T *work(ret->getPointer());
- for(std::vector<std::pair<int,int> >::const_iterator it=ranges.begin();it!=ranges.end();it++)
+ for(std::vector<std::pair<mcIdType,mcIdType> >::const_iterator it=ranges.begin();it!=ranges.end();it++)
work=std::copy(src+(*it).first*nbOfComp,src+(*it).second*nbOfComp,work);
return ret.retn();
}
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayTemplate::front : number of components not equal to one !");
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=getNumberOfTuples();
if(nbOfTuples<1)
throw INTERP_KERNEL::Exception("DataArrayTemplate::front : number of tuples must be >= 1 !");
return *(getConstPointer());
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayTemplate::back : number of components not equal to one !");
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=getNumberOfTuples();
if(nbOfTuples<1)
throw INTERP_KERNEL::Exception("DataArrayTemplate::back : number of tuples must be >= 1 !");
return *(getConstPointer()+nbOfTuples-1);
* \sa getMaxAbsValue, getMinValue
*/
template<class T>
- T DataArrayTemplate<T>::getMaxValue(int& tupleId) const
+ T DataArrayTemplate<T>::getMaxValue(mcIdType& tupleId) const
{
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before or call 'getMaxValueInArray' method !");
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=getNumberOfTuples();
if(nbOfTuples<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : array exists but number of tuples must be > 0 !");
const T *vals(getConstPointer());
const T *loc(std::max_element(vals,vals+nbOfTuples));
- tupleId=(int)std::distance(vals,loc);
+ tupleId=ToIdType(std::distance(vals,loc));
return *loc;
}
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxAbsValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before or call 'getMaxValueInArray' method !");
- std::size_t nbTuples(this->getNumberOfTuples());
+ mcIdType nbTuples(this->getNumberOfTuples());
if(nbTuples==0)
throw INTERP_KERNEL::Exception("DataArrayTemplate<T>::getMaxAbsValue : empty array !");
T ret((T)-1);
tupleId=0;
const T *pt(begin());
- for(std::size_t i=0;i<nbTuples;i++,pt++)
+ for(mcIdType i=0;i<nbTuples;i++,pt++)
{
- T cand(std::abs(*pt));
+ T cand((T)std::abs(*pt));
if(cand>ret)
{
ret=cand;
tupleId=i;
}
}
- return this->getIJ(tupleId,0);
+ return this->getIJ(ToIdType(tupleId),0);
}
/*!
* \throw If \a this->getNumberOfTuples() < 1
*/
template<class T>
- T DataArrayTemplate<T>::getMinValue(int& tupleId) const
+ T DataArrayTemplate<T>::getMinValue(mcIdType& tupleId) const
{
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::getMinValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before call 'getMinValueInArray' method !");
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=getNumberOfTuples();
if(nbOfTuples<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::getMinValue : array exists but number of tuples must be > 0 !");
const T *vals(getConstPointer());
const T *loc(std::min_element(vals,vals+nbOfTuples));
- tupleId=(int)std::distance(vals,loc);
+ tupleId=ToIdType(std::distance(vals,loc));
return *loc;
}
}
template<class T>
- void DataArrayTemplate<T>::circularPermutation(int nbOfShift)
+ void DataArrayTemplate<T>::circularPermutation(mcIdType nbOfShift)
{
checkAllocated();
- int nbOfCompo(getNumberOfComponents()),nbTuples(getNumberOfTuples());
- int effNbSh(EffectiveCircPerm(nbOfShift,nbTuples));
+ std::size_t nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
+ mcIdType effNbSh(EffectiveCircPerm(nbOfShift,nbTuples));
if(effNbSh==0)
return ;
T *work(getPointer());
}
template<class T>
- void DataArrayTemplate<T>::circularPermutationPerTuple(int nbOfShift)
+ void DataArrayTemplate<T>::circularPermutationPerTuple(mcIdType nbOfShift)
{
checkAllocated();
- int nbOfCompo(getNumberOfComponents()),nbTuples(getNumberOfTuples());
- int effNbSh(EffectiveCircPerm(nbOfShift,nbOfCompo));
+ std::size_t nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
+ mcIdType effNbSh(EffectiveCircPerm(nbOfShift,ToIdType(nbOfCompo)));
if(effNbSh==0)
return ;
T *work(getPointer());
- if(effNbSh<nbOfCompo-effNbSh)
+ if(effNbSh<ToIdType(nbOfCompo)-effNbSh)
{
typename INTERP_KERNEL::AutoPtr<T> buf(new T[effNbSh]);
- for(int i=0;i<nbTuples;i++,work+=nbOfCompo)
+ for(mcIdType i=0;i<nbTuples;i++,work+=nbOfCompo)
{
std::copy(work,work+effNbSh,(T *)buf);
std::copy(work+effNbSh,work+nbOfCompo,work);// ze big shift
else
{
typename INTERP_KERNEL::AutoPtr<T> buf(new T[nbOfCompo-effNbSh]);
- for(int i=0;i<nbTuples;i++,work+=nbOfCompo)
+ for(mcIdType i=0;i<nbTuples;i++,work+=nbOfCompo)
{
std::copy(work+effNbSh,work+nbOfCompo,(T *)buf);
std::copy(work,work+effNbSh,work+(nbOfCompo-effNbSh));// ze big shift
}
}
std::vector<std::string> sts(nbOfCompo);
- for(int i=0;i<nbOfCompo;i++)
+ for(std::size_t i=0;i<nbOfCompo;i++)
sts[i]=_info_on_compo[(i+effNbSh)%nbOfCompo];
setInfoOnComponents(sts);
}
void DataArrayTemplate<T>::reversePerTuple()
{
checkAllocated();
- int nbOfCompo(getNumberOfComponents()),nbTuples(getNumberOfTuples());
+ std::size_t nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
if(nbOfCompo<=1)
return ;
T *work(getPointer());
- for(int i=0;i<nbTuples;i++,work+=nbOfCompo)
+ for(mcIdType i=0;i<nbTuples;i++,work+=nbOfCompo)
std::reverse(work,work+nbOfCompo);
std::reverse(_info_on_compo.begin(),_info_on_compo.end());
}
//////////////////////////////
+ namespace
+ {
+ // local static function to copy arrays without warnings
+ template <class TIn, class TOut>
+ static void copyCast (const TIn *begin, const TIn *end, TOut* dest)
+ {
+ for (const TIn *src = begin; src != end; ++src, ++dest)
+ *dest=static_cast<TOut>(*src);
+ }
+ }
+
template<class T>
template<class U>
MCAuto< typename Traits<U>::ArrayType > DataArrayTemplateClassic<T>::convertToOtherTypeOfArr() const
const T *src(this->begin());
U *dest(ret->getPointer());
// to make Visual C++ happy : instead of std::size_t nbOfVals=getNbOfElems(); std::copy(src,src+nbOfVals,dest);
- //for(const T *src=this->begin();src!=this->end();src++,dest++)
- // *dest=(int)*src;
- std::copy(src,src+nbOfVals,dest);
+ copyCast(src, src+nbOfVals, dest);
+ //std::copy(src,src+nbOfVals,dest);
ret->copyStringInfoFrom(*this);
return ret;
}
* \throw If \a this is not allocated, or \a compoId is not in [0,\c this->getNumberOfComponents() ).
*/
template<class T>
- void DataArrayTemplateClassic<T>::applyLin(T a, T b, int compoId)
+ void DataArrayTemplateClassic<T>::applyLin(T a, T b, std::size_t compoId)
{
this->checkAllocated();
- T *ptr(this->getPointer()+compoId);
- int nbOfComp(this->getNumberOfComponents()),nbOfTuple(this->getNumberOfTuples());
- if(compoId<0 || compoId>=nbOfComp)
+ std::size_t nbOfComp=this->getNumberOfComponents();
+ if(compoId>=nbOfComp)
{
std::ostringstream oss; oss << "DataArrayDouble::applyLin : The compoId requested (" << compoId << ") is not valid ! Must be in [0," << nbOfComp << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- for(int i=0;i<nbOfTuple;i++,ptr+=nbOfComp)
+ T *ptr(this->getPointer()+compoId);
+ mcIdType nbOfTuple=this->getNumberOfTuples();
+ for(mcIdType i=0;i<nbOfTuple;i++,ptr+=nbOfComp)
*ptr=a*(*ptr)+b;
this->declareAsNew();
}
{
this->checkAllocated();
MCAuto<typename Traits<T>::ArrayType> newArr(Traits<T>::ArrayType::New());
- int nbOfTuples(this->getNumberOfTuples()),nbOfComp(this->getNumberOfComponents());
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ std::size_t nbOfComp(this->getNumberOfComponents());
newArr->alloc(nbOfTuples,nbOfComp);
const T *cptr(this->begin());
std::transform(cptr,cptr+nbOfTuples*nbOfComp,newArr->getPointer(),std::negate<T>());
const char *msg="Nb of tuples mismatch for DataArrayDouble::multiplyEqual !";
this->checkAllocated();
other->checkAllocated();
- int nbOfTuple(this->getNumberOfTuples()),nbOfTuple2(other->getNumberOfTuples());
- int nbOfComp(this->getNumberOfComponents()),nbOfComp2(other->getNumberOfComponents());
+ mcIdType nbOfTuple(this->getNumberOfTuples());
+ mcIdType nbOfTuple2(other->getNumberOfTuples());
+ std::size_t nbOfComp(this->getNumberOfComponents());
+ std::size_t nbOfComp2(other->getNumberOfComponents());
if(nbOfTuple==nbOfTuple2)
{
if(nbOfComp==nbOfComp2)
{
T *ptr(this->getPointer());
const T *ptrc(other->begin());
- for(int i=0;i<nbOfTuple;i++)
+ for(mcIdType i=0;i<nbOfTuple;i++)
std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(FCT(),*ptrc++));
}
else
{
T *ptr(this->getPointer());
const T *ptrc(other->begin());
- for(int i=0;i<nbOfTuple;i++)
+ for(mcIdType i=0;i<nbOfTuple;i++)
std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,FCT());
}
else
{
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DivSub : input DataArrayDouble instance is NULL !");
- int nbOfTuple1(a1->getNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples());
- int nbOfComp1(a1->getNumberOfComponents()),nbOfComp2(a2->getNumberOfComponents());
+ mcIdType nbOfTuple1(a1->getNumberOfTuples());
+ mcIdType nbOfTuple2(a2->getNumberOfTuples());
+ std::size_t nbOfComp1(a1->getNumberOfComponents());
+ std::size_t nbOfComp2(a2->getNumberOfComponents());
if(nbOfTuple2==nbOfTuple1)
{
if(nbOfComp1==nbOfComp2)
ret->alloc(nbOfTuple1,nbOfComp1);
const T *a2Ptr(a2->begin()),*a1Ptr(a1->begin());
T *res(ret->getPointer());
- for(int i=0;i<nbOfTuple1;i++)
+ for(mcIdType i=0;i<nbOfTuple1;i++)
res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind2nd(FCT(),a2Ptr[i]));
ret->copyStringInfoFrom(*a1);
return ret.retn();
ret->alloc(nbOfTuple1,nbOfComp1);
const T *a1ptr=a1->begin(),*a2ptr(a2->begin());
T *pt(ret->getPointer());
- for(int i=0;i<nbOfTuple1;i++)
+ for(mcIdType i=0;i<nbOfTuple1;i++)
pt=std::transform(a1ptr+i*nbOfComp1,a1ptr+(i+1)*nbOfComp1,a2ptr,pt,FCT());
ret->copyStringInfoFrom(*a1);
return ret.retn();
{
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DataArrayDouble::MulAdd : input DataArrayDouble instance is NULL !");
- int nbOfTuple(a1->getNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples());
- int nbOfComp(a1->getNumberOfComponents()),nbOfComp2(a2->getNumberOfComponents());
+ mcIdType nbOfTuple(a1->getNumberOfTuples());
+ mcIdType nbOfTuple2(a2->getNumberOfTuples());
+ std::size_t nbOfComp(a1->getNumberOfComponents());
+ std::size_t nbOfComp2(a2->getNumberOfComponents());
MCAuto<typename Traits<T>::ArrayType> ret=0;
if(nbOfTuple==nbOfTuple2)
{
}
else
{
- int nbOfCompMin,nbOfCompMax;
+ std::size_t nbOfCompMin,nbOfCompMax;
const typename Traits<T>::ArrayType *aMin, *aMax;
if(nbOfComp>nbOfComp2)
{
const T *aMinPtr(aMin->begin());
const T *aMaxPtr(aMax->begin());
T *res=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++)
+ for(mcIdType i=0;i<nbOfTuple;i++)
res=std::transform(aMaxPtr+i*nbOfCompMax,aMaxPtr+(i+1)*nbOfCompMax,res,std::bind2nd(FCT(),aMinPtr[i]));
ret->copyStringInfoFrom(*aMax);
}
{
if(nbOfComp==nbOfComp2)
{
- int nbOfTupleMax=std::max(nbOfTuple,nbOfTuple2);
+ mcIdType nbOfTupleMax=std::max(nbOfTuple,nbOfTuple2);
const typename Traits<T>::ArrayType *aMin(nbOfTuple>nbOfTuple2?a2:a1);
const typename Traits<T>::ArrayType *aMax(nbOfTuple>nbOfTuple2?a1:a2);
const T *aMinPtr(aMin->begin()),*aMaxPtr(aMax->begin());
ret=Traits<T>::ArrayType::New();
ret->alloc(nbOfTupleMax,nbOfComp);
T *res(ret->getPointer());
- for(int i=0;i<nbOfTupleMax;i++)
+ for(mcIdType i=0;i<nbOfTupleMax;i++)
res=std::transform(aMaxPtr+i*nbOfComp,aMaxPtr+(i+1)*nbOfComp,aMinPtr,res,FCT());
ret->copyStringInfoFrom(*aMax);
}
* \sa DataArrayInt::findIdsInRange
*/
template<class T>
- DataArrayInt *DataArrayTemplateClassic<T>::findIdsStrictlyNegative() const
+ DataArrayIdType *DataArrayTemplateClassic<T>::findIdsStrictlyNegative() const
{
LowerThan<T> lt((T)0);
- MCAuto<DataArrayInt> ret(findIdsAdv(lt));
+ MCAuto<DataArrayIdType> ret(findIdsAdv(lt));
return ret.retn();
}
template<class T>
- MCAuto<DataArrayInt> DataArrayTemplateClassic<T>::findIdsGreaterOrEqualTo(T val) const
+ MCAuto<DataArrayIdType> DataArrayTemplateClassic<T>::findIdsGreaterOrEqualTo(T val) const
{
GreatEqual<T> ge(val);
return findIdsAdv(ge);
}
template<class T>
- MCAuto<DataArrayInt> DataArrayTemplateClassic<T>::findIdsGreaterThan(T val) const
+ MCAuto<DataArrayIdType> DataArrayTemplateClassic<T>::findIdsGreaterThan(T val) const
{
GreaterThan<T> gt(val);
return findIdsAdv(gt);
}
template<class T>
- MCAuto<DataArrayInt> DataArrayTemplateClassic<T>::findIdsLowerOrEqualTo(T val) const
+ MCAuto<DataArrayIdType> DataArrayTemplateClassic<T>::findIdsLowerOrEqualTo(T val) const
{
LowerEqual<T> le(val);
return findIdsAdv(le);
}
template<class T>
- MCAuto<DataArrayInt> DataArrayTemplateClassic<T>::findIdsLowerThan(T val) const
+ MCAuto<DataArrayIdType> DataArrayTemplateClassic<T>::findIdsLowerThan(T val) const
{
LowerThan<T> lt(val);
return findIdsAdv(lt);
for(it=a.begin();it!=a.end();it++)
(*it)->checkAllocated();
it=a.begin();
- std::size_t nbOfTuples((*it)->getNumberOfTuples());
- std::vector<int> nbc(a.size());
+ mcIdType nbOfTuples((*it)->getNumberOfTuples());
+ std::vector<std::size_t> nbc(a.size());
std::vector<const T *> pts(a.size());
nbc[0]=(*it)->getNumberOfComponents();
pts[0]=(*it++)->getConstPointer();
- for(int i=1;it!=a.end();it++,i++)
+ for(mcIdType i=1;it!=a.end();it++,i++)
{
if(nbOfTuples!=(*it)->getNumberOfTuples())
throw INTERP_KERNEL::Exception("DataArrayDouble::Meld : mismatch of number of tuples !");
nbc[i]=(*it)->getNumberOfComponents();
pts[i]=(*it)->getConstPointer();
}
- int totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),0);
+ std::size_t totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),(std::size_t)0);
typename Traits<T>::ArrayType *ret(Traits<T>::ArrayType::New());
ret->alloc(nbOfTuples,totalNbOfComp);
T *retPtr(ret->getPointer());
- for(std::size_t i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
for(std::size_t j=0;j<a.size();j++)
{
retPtr=std::copy(pts[j],pts[j]+nbc[j],retPtr);
pts[j]+=nbc[j];
}
- int k=0;
- for(int i=0;i<(int)a.size();i++)
- for(int j=0;j<nbc[i];j++,k++)
+ std::size_t k=0;
+ for(std::size_t i=0;i<a.size();i++)
+ for(std::size_t j=0;j<nbc[i];j++,k++)
ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j));
return ret;
}
{
this->checkAllocated();
other->checkAllocated();
- std::size_t nbOfTuples(this->getNumberOfTuples());
+ mcIdType nbOfTuples(this->getNumberOfTuples());
if(nbOfTuples!=other->getNumberOfTuples())
throw INTERP_KERNEL::Exception("DataArrayDouble::meldWith : mismatch of number of tuples !");
- int nbOfComp1(this->getNumberOfComponents()),nbOfComp2(other->getNumberOfComponents());
+ std::size_t nbOfComp1=this->getNumberOfComponents();
+ std::size_t nbOfComp2=other->getNumberOfComponents();
T *newArr=(T *)malloc((nbOfTuples*(nbOfComp1+nbOfComp2))*sizeof(T));
T *w=newArr;
const T *inp1(this->begin()),*inp2(other->begin());
- for(std::size_t i=0;i<nbOfTuples;i++,inp1+=nbOfComp1,inp2+=nbOfComp2)
+ for(mcIdType i=0;i<nbOfTuples;i++,inp1+=nbOfComp1,inp2+=nbOfComp2)
{
w=std::copy(inp1,inp1+nbOfComp1,w);
w=std::copy(inp2,inp2+nbOfComp2,w);
}
this->useArray(newArr,true,DeallocType::C_DEALLOC,nbOfTuples,nbOfComp1+nbOfComp2);
- std::vector<int> compIds(nbOfComp2);
- for(int i=0;i<nbOfComp2;i++)
+ std::vector<std::size_t> compIds(nbOfComp2);
+ for(std::size_t i=0;i<nbOfComp2;i++)
compIds[i]=nbOfComp1+i;
this->copyPartOfStringInfoFrom2(compIds,*other);
}
* \throw if \a this is not allocated or if \a this has not number of components set to one or if \a nbTimes is lower than 1.
*/
template<class T>
- typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::duplicateEachTupleNTimes(int nbTimes) const
+ typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::duplicateEachTupleNTimes(mcIdType nbTimes) const
{
this->checkAllocated();
if(this->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::duplicateEachTupleNTimes : this should have only one component !");
if(nbTimes<1)
throw INTERP_KERNEL::Exception("DataArrayDouble::duplicateEachTupleNTimes : nb times should be >= 1 !");
- int nbTuples(this->getNumberOfTuples());
+ mcIdType nbTuples=this->getNumberOfTuples();
const T *inPtr(this->begin());
MCAuto<typename Traits<T>::ArrayType> ret(Traits<T>::ArrayType::New()); ret->alloc(nbTimes*nbTuples,1);
T *retPtr(ret->getPointer());
- for(int i=0;i<nbTuples;i++,inPtr++)
+ for(mcIdType i=0;i<nbTuples;i++,inPtr++)
{
T val(*inPtr);
- for(int j=0;j<nbTimes;j++,retPtr++)
+ for(mcIdType j=0;j<nbTimes;j++,retPtr++)
*retPtr=val;
}
ret->copyStringInfoFrom(*this);
{
this->checkAllocated();
MCAuto<typename Traits<T>::ArrayType> newArr(Traits<T>::ArrayType::New());
- int nbOfTuples(this->getNumberOfTuples());
- int nbOfComp(this->getNumberOfComponents());
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ std::size_t nbOfComp(this->getNumberOfComponents());
newArr->alloc(nbOfTuples,nbOfComp);
std::transform(this->begin(),this->end(),newArr->getPointer(),std::ptr_fun<T,T>(std::abs));
newArr->copyStringInfoFrom(*this);
typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::sumPerTuple() const
{
this->checkAllocated();
- std::size_t nbOfComp(this->getNumberOfComponents()),nbOfTuple(this->getNumberOfTuples());
+ std::size_t nbOfComp(this->getNumberOfComponents());
+ mcIdType nbOfTuple(this->getNumberOfTuples());
MCAuto<typename Traits<T>::ArrayType> ret(Traits<T>::ArrayType::New());
ret->alloc(nbOfTuple,1);
const T *src(this->begin());
T *dest(ret->getPointer());
- for(std::size_t i=0;i<nbOfTuple;i++,dest++,src+=nbOfComp)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest++,src+=nbOfComp)
*dest=std::accumulate(src,src+nbOfComp,(T)0);
return ret.retn();
}
if(this->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::iota : works only for arrays with only one component, you can call 'rearrange' method before !");
T *ptr(this->getPointer());
- std::size_t ntuples(this->getNumberOfTuples());
- for(std::size_t i=0;i<ntuples;i++)
+ mcIdType ntuples(this->getNumberOfTuples());
+ for(mcIdType i=0;i<ntuples;i++)
ptr[i]=init+(T)i;
this->declareAsNew();
}
{
DataArray::reprWithoutNameStream(stream);
ImplReprTraits<T>::SetPrecision(stream);
- this->_mem.repr(this->getNumberOfComponents(),stream);
+ this->_mem.repr(ToIdType(this->getNumberOfComponents()),stream);
}
template<class T>
{
DataArray::reprWithoutNameStream(stream);
ImplReprTraits<T>::SetPrecision(stream);
- this->_mem.reprZip(this->getNumberOfComponents(),stream);
+ this->_mem.reprZip(ToIdType(this->getNumberOfComponents()),stream);
}
template<class T>
{
DataArray::reprWithoutNameStream(stream);
ImplReprTraits<T>::SetPrecision(stream);
- this->_mem.reprNotTooLong(this->getNumberOfComponents(),stream);
+ this->_mem.reprNotTooLong(ToIdType(this->getNumberOfComponents()),stream);
}
/*!
return true;
}
+ /////////////////////////////////
+
+ /*!
+ * Returns the only one value in \a this, if and only if number of elements
+ * (nb of tuples * nb of components) is equal to 1, and that \a this is allocated.
+ * \return double - the sole value stored in \a this array.
+ * \throw If at least one of conditions stated above is not fulfilled.
+ */
+ template <class T>
+ T DataArrayDiscrete<T>::intValue() const
+ {
+ if(this->isAllocated())
+ {
+ if(this->getNbOfElems()==1)
+ {
+ return *this->getConstPointer();
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayInt::intValue : DataArrayInt instance is allocated but number of elements is not equal to 1 !");
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayInt::intValue : DataArrayInt instance is not allocated !");
+ }
+
/*!
* Equivalent to DataArrayInt::isEqual except that if false the reason of
* mismatch is given.
this->checkAllocated();
if(this->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of components of this should be equal to one !");
- int nbOfTuples(this->getNumberOfTuples());
- if(nbOfTuples!=(int)vec.size())
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ if(nbOfTuples!=ToIdType(vec.size()))
throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of tuples of this should be equal to size of input vector of bool !");
const T *pt(this->begin());
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
if(algo(pt[i],val))
vec[i]=true;
}
this->checkAllocated();
if(this->getNumberOfComponents()!=1 || other.getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' have to have exactly ONE component !");
- std::size_t nbTuple(this->getNumberOfTuples());
+ mcIdType nbTuple(this->getNumberOfTuples());
other.checkAllocated();
if(nbTuple!=other.getNumberOfTuples())
throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' must have the same number of tuple !");
ret->alloc(nbTuple,1);
ret->fillWithValue(-1);
const T *pt(this->begin());
- std::map<int,mcIdType> mm;
- for(std::size_t i=0;i<nbTuple;i++)
- mm[pt[i]]=(mcIdType)i;
+ std::map<mcIdType,mcIdType> mm;
+ for(mcIdType i=0;i<nbTuple;i++)
+ mm[ToIdType(pt[i])]=i;
pt=other.begin();
mcIdType *retToFill(ret->getPointer());
- for(std::size_t i=0;i<nbTuple;i++)
+ for(mcIdType i=0;i<nbTuple;i++)
{
- std::map<int,int>::const_iterator it=mm.find(pt[i]);
+ std::map<mcIdType,mcIdType>::const_iterator it=mm.find(ToIdType(pt[i]));
if(it==mm.end())
{
std::ostringstream oss; oss << "DataArrayInt::buildPermutationArr : Arrays mismatch : element (" << pt[i] << ") in 'other' not findable in 'this' !";
if(this->getNumberOfComponents()!=1 || partOfThis.getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::indicesOfSubPart : this and input array must be one component array !");
this->checkAllocated(); partOfThis.checkAllocated();
- std::size_t thisNbTuples(this->getNumberOfTuples()),nbTuples(partOfThis.getNumberOfTuples());
+ mcIdType thisNbTuples(this->getNumberOfTuples()),nbTuples(partOfThis.getNumberOfTuples());
const T *thisPt(this->begin()),*pt(partOfThis.begin());
MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
ret->alloc(nbTuples,1);
mcIdType *retPt(ret->getPointer());
- std::map<int,mcIdType> m;
- for(std::size_t i=0;i<thisNbTuples;i++,thisPt++)
- m[*thisPt]=(mcIdType)i;
- if(m.size()!=thisNbTuples)
+ std::map<mcIdType,mcIdType> m;
+ for(mcIdType i=0;i<thisNbTuples;i++,thisPt++)
+ m[ToIdType(*thisPt)]=i;
+ if(ToIdType(m.size())!=thisNbTuples)
throw INTERP_KERNEL::Exception("DataArrayInt::indicesOfSubPart : some elements appears more than once !");
- for(std::size_t i=0;i<nbTuples;i++,retPt++,pt++)
+ for(mcIdType i=0;i<nbTuples;i++,retPt++,pt++)
{
- std::map<int,mcIdType>::const_iterator it(m.find(*pt));
+ std::map<mcIdType,mcIdType>::const_iterator it(m.find(ToIdType(*pt)));
if(it!=m.end())
*retPt=(*it).second;
else
/*!
* Returns an integer value characterizing \a this array, which is useful for a quick
* comparison of many instances of DataArrayInt.
- * \return int - the hash value.
+ * \return mcIdType - the hash value.
* \throw If \a this is not allocated.
*/
template<class T>
- int DataArrayDiscrete<T>::getHashCode() const
+ mcIdType DataArrayDiscrete<T>::getHashCode() const
{
this->checkAllocated();
- std::size_t nbOfElems(this->getNbOfElems());
- int ret=nbOfElems*65536;
- int delta=3;
+ mcIdType nbOfElems=ToIdType(this->getNbOfElems());
+ mcIdType ret=nbOfElems*65536;
+ mcIdType delta=3;
if(nbOfElems>48)
delta=nbOfElems/8;
T ret0(0);
const T *pt(this->begin());
- for(std::size_t i=0;i<nbOfElems;i+=delta)
+ for(mcIdType i=0;i<nbOfElems;i+=delta)
ret0+=pt[i] & 0x1FFF;
- return ret+ret0;
+ return ToIdType(ret+ret0);
}
template<class T>
void DataArrayDiscrete<T>::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- std::size_t nbTuples(this->getNumberOfTuples()),nbComp(this->getNumberOfComponents());
+ mcIdType nbTuples(this->getNumberOfTuples());
+ std::size_t nbComp(this->getNumberOfComponents());
const T *data(this->getConstPointer());
stream << Traits<T>::ArrayTypeName << " *" << varName << "=" << Traits<T>::ArrayTypeName << "::New();" << std::endl;
if(nbTuples*nbComp>=1)
{
- stream << "const int " << varName << "Data[" << nbTuples*nbComp << "]={";
- std::copy(data,data+nbTuples*nbComp-1,std::ostream_iterator<int>(stream,","));
+ stream << "const mcIdType " << varName << "Data[" << nbTuples*nbComp << "]={";
+ std::copy(data,data+nbTuples*nbComp-1,std::ostream_iterator<T>(stream,","));
stream << data[nbTuples*nbComp-1] << "};" << std::endl;
stream << varName << "->useArray(" << varName << "Data,false,CPP_DEALLOC," << nbTuples << "," << nbComp << ");" << std::endl;
}
std::size_t nbOfCompo(this->getNumberOfComponents());
if(nbOfCompo>=1)
{
- std::size_t nbOfTuples(this->getNumberOfTuples());
+ mcIdType nbOfTuples(this->getNumberOfTuples());
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayDiscrete<T>::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const T *data(this->begin());
- std::size_t nbOfTuples(this->getNumberOfTuples()),nbOfCompo(this->getNumberOfComponents());
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ std::size_t nbOfCompo(this->getNumberOfComponents());
std::ostringstream oss2; oss2 << "[";
std::string oss2Str(oss2.str());
bool isFinished=true;
- for(int i=0;i<nbOfTuples && isFinished;i++)
+ for(mcIdType i=0;i<nbOfTuples && isFinished;i++)
{
if(nbOfCompo>1)
{
oss2 << "(";
- for(int j=0;j<nbOfCompo;j++,data++)
+ for(std::size_t j=0;j<nbOfCompo;j++,data++)
{
oss2 << *data;
if(j!=nbOfCompo-1) oss2 << ", ";
}
template<class T>
- void DataArrayDiscrete<T>::writeVTK(std::ostream& ofs, int indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const
+ void DataArrayDiscrete<T>::writeVTK(std::ostream& ofs, mcIdType indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const
{
static const char SPACE[4]={' ',' ',' ',' '};
this->checkAllocated();
else if(std::string(type)=="Int8")
{
INTERP_KERNEL::AutoPtr<char> tmp(new char[this->getNbOfElems()]);
- std::copy(this->begin(),this->end(),(char *)tmp);
+ copyCast(this->begin(),this->end(),(char *)tmp);
byteArr->insertAtTheEnd((char *)tmp,(char *)tmp+this->getNbOfElems());
byteArr->insertAtTheEnd(SPACE,SPACE+4);
}
else if(std::string(type)=="UInt8")
{
INTERP_KERNEL::AutoPtr<unsigned char> tmp(new unsigned char[this->getNbOfElems()]);
- std::copy(this->begin(),this->end(),(unsigned char *)tmp);
+ copyCast(this->begin(),this->end(),(unsigned char *)tmp);
byteArr->insertAtTheEnd((unsigned char *)tmp,(unsigned char *)tmp+this->getNbOfElems());
byteArr->insertAtTheEnd(SPACE,SPACE+4);
}
else
{
ofs << " RangeMin=\"" << this->getMinValueInArray() << "\" RangeMax=\"" << this->getMaxValueInArray() << "\" format=\"ascii\">\n" << idt;
- std::copy(this->begin(),this->end(),std::ostream_iterator<int>(ofs," "));
+ std::copy(this->begin(),this->end(),std::ostream_iterator<T>(ofs," "));
}
ofs << std::endl << idt << "</DataArray>\n";
}
this->checkAllocated();
if(this->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("Call transformWithIndArr method on DataArrayInt with only one component, you can call 'rearrange' method before !");
- std::size_t nbElemsIn(std::distance(indArrBg,indArrEnd)),nbOfTuples(this->getNumberOfTuples());
+ mcIdType nbElemsIn=ToIdType(std::distance(indArrBg,indArrEnd));
+ mcIdType nbOfTuples(this->getNumberOfTuples());
T *pt(this->getPointer());
- for(std::size_t i=0;i<nbOfTuples;i++,pt++)
+ for(mcIdType i=0;i<nbOfTuples;i++,pt++)
{
if(*pt>=0 && *pt<nbElemsIn)
*pt=indArrBg[*pt];
}
template<class T>
- void DataArrayDiscrete<T>::transformWithIndArr(const MapKeyVal<T>& m)
+ void DataArrayDiscrete<T>::transformWithIndArr(const MapKeyVal<T, T>& m)
{
this->checkAllocated();
if(this->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("Call transformWithIndArr method on DataArrayInt with only one component, you can call 'rearrange' method before !");
const typename std::map<T,T>& dat(m.data());
- std::size_t nbOfTuples(this->getNumberOfTuples());
+ mcIdType nbOfTuples(this->getNumberOfTuples());
T *pt(this->getPointer());
- for(std::size_t i=0;i<nbOfTuples;i++,pt++)
+ for(mcIdType i=0;i<nbOfTuples;i++,pt++)
{
typename std::map<T,T>::const_iterator it(dat.find(*pt));
if(it!=dat.end())
throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqual : the array must have only one component, you can call 'rearrange' method before !");
const T *cptr(this->getConstPointer());
MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
- std::size_t nbOfTuples(this->getNumberOfTuples());
- for(std::size_t i=0;i<nbOfTuples;i++,cptr++)
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr==val)
ret->pushBackSilent(ToIdType(i));
return ret.retn();
}
- ////////////////////////////////////
+ /*!
+ * Creates a one-dimensional DataArrayInt (\a res) whose contents are computed from
+ * values of \a this (\a a) and the given (\a indArr) arrays as follows:
+ * \a res[ \a indArr[ \a a[ i ]]] = i. I.e. for each value in place i \a v = \a a[ i ],
+ * new value in place \a indArr[ \a v ] is i.
+ * \param [in] indArrBg - the array holding indices within the result array to assign
+ * indices of values of \a this array pointing to values of \a indArrBg.
+ * \param [in] indArrEnd - specifies the end of the array \a indArrBg, so that
+ * the last value of \a indArrBg is \a indArrEnd[ -1 ].
+ * \return DataArrayInt * - the new instance of DataArrayInt.
+ * The caller is to delete this result array using decrRef() as it is no more
+ * needed.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ * \throw If any value of \a this array is not a valid index for \a indArrBg array.
+ * \throw If any value of \a indArrBg is not a valid index for \a this array.
+ */
+ template<class T>
+ DataArrayIdType *DataArrayDiscrete<T>::transformWithIndArrR(const T *indArrBg, const T *indArrEnd) const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("Call transformWithIndArrR method on DataArrayInt with only one component, you can call 'rearrange' method before !");
+ mcIdType nbElemsIn=ToIdType(std::distance(indArrBg,indArrEnd));
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ const T *pt=this->getConstPointer();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ ret->alloc(nbOfTuples,1);
+ ret->fillWithValue(-1);
+ mcIdType *tmp=ret->getPointer();
+ for(mcIdType i=0;i<nbOfTuples;i++,pt++)
+ {
+ if(*pt>=0 && *pt<nbElemsIn)
+ {
+ T pos=indArrBg[*pt];
+ if(pos>=0 && pos<nbOfTuples)
+ tmp[ToIdType(pos)]=i;
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::transformWithIndArrR : error on tuple #" << i << " value of new pos is " << pos << " ( indArrBg[" << *pt << "]) ! Should be in [0," << nbOfTuples << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::transformWithIndArrR : error on tuple #" << i << " value is " << *pt << " and indirectionnal array as a size equal to " << nbElemsIn << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ return ret.retn();
+ }
+
+ /*!
+ * Computes distribution of values of \a this one-dimensional array between given value
+ * ranges (casts). This method is typically useful for entity number splitting by types,
+ * for example.
+ * \warning The values contained in \a arrBg should be sorted ascendently. No
+ * check of this is be done. If not, the result is not warranted.
+ * \param [in] arrBg - the array of ascending values defining the value ranges. The i-th
+ * value of \a arrBg (\a arrBg[ i ]) gives the lowest value of the i-th range,
+ * and the greatest value of the i-th range equals to \a arrBg[ i+1 ] - 1. \a
+ * arrBg containing \a n values defines \a n-1 ranges. The last value of \a arrBg
+ * should be more than every value in \a this array.
+ * \param [in] arrEnd - specifies the end of the array \a arrBg, so that
+ * the last value of \a arrBg is \a arrEnd[ -1 ].
+ * \param [out] castArr - a new instance of DataArrayInt, of same size as \a this array
+ * (same number of tuples and components), the caller is to delete
+ * using decrRef() as it is no more needed.
+ * This array contains indices of ranges for every value of \a this array. I.e.
+ * the i-th value of \a castArr gives the index of range the i-th value of \a this
+ * belongs to. Or, in other words, this parameter contains for each tuple in \a
+ * this in which cast it holds.
+ * \param [out] rankInsideCast - a new instance of DataArrayInt, of same size as \a this
+ * array, the caller is to delete using decrRef() as it is no more needed.
+ * This array contains ranks of values of \a this array within ranges
+ * they belongs to. I.e. the i-th value of \a rankInsideCast gives the rank of
+ * the i-th value of \a this array within the \a castArr[ i ]-th range, to which
+ * the i-th value of \a this belongs to. Or, in other words, this param contains
+ * for each tuple its rank inside its cast. The rank is computed as difference
+ * between the value and the lowest value of range.
+ * \param [out] castsPresent - a new instance of DataArrayInt, containing indices of
+ * ranges (casts) to which at least one value of \a this array belongs.
+ * Or, in other words, this param contains the casts that \a this contains.
+ * The caller is to delete this array using decrRef() as it is no more needed.
+ *
+ * \b Example: If \a this contains [6,5,0,3,2,7,8,1,4] and \a arrBg contains [0,4,9] then
+ * the output of this method will be :
+ * - \a castArr : [1,1,0,0,0,1,1,0,1]
+ * - \a rankInsideCast: [2,1,0,3,2,3,4,1,0]
+ * - \a castsPresent : [0,1]
+ *
+ * I.e. values of \a this array belong to 2 ranges: #0 and #1. Value 6 belongs to the
+ * range #1 and its rank within this range is 2; etc.
+ *
+ * \throw If \a this->getNumberOfComponents() != 1.
+ * \throw If \a arrEnd - arrBg < 2.
+ * \throw If any value of \a this is not less than \a arrEnd[-1].
+ */
+ template<class T>
+ void DataArrayDiscrete<T>::splitByValueRange(const T *arrBg, const T *arrEnd,
+ DataArrayType *& castArr, DataArrayType *& rankInsideCast, DataArrayType *& castsPresent) const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("Call splitByValueRange method on DataArrayInt with only one component, you can call 'rearrange' method before !");
+ mcIdType nbOfTuples=this->getNumberOfTuples();
+ std::size_t nbOfCast=std::distance(arrBg,arrEnd);
+ if(nbOfCast<2)
+ throw INTERP_KERNEL::Exception("DataArrayInt::splitByValueRange : The input array giving the cast range values should be of size >=2 !");
+ nbOfCast--;
+ const T *work=this->getConstPointer();
+ typedef std::reverse_iterator<const T *> rintstart;
+ rintstart bg(arrEnd);//OK no problem because size of 'arr' is greater or equal 2
+ rintstart end2(arrBg);
+ MCAuto<DataArrayType> ret1=DataArrayType::New();
+ MCAuto<DataArrayType> ret2=DataArrayType::New();
+ MCAuto<DataArrayType> ret3=DataArrayType::New();
+ ret1->alloc(nbOfTuples,1);
+ ret2->alloc(nbOfTuples,1);
+ T *ret1Ptr=ret1->getPointer();
+ T *ret2Ptr=ret2->getPointer();
+ std::set<T> castsDetected;
+ for(mcIdType i=0;i<nbOfTuples;i++)
+ {
+ rintstart res=std::find_if(bg,end2,std::bind2nd(std::less_equal<T>(), work[i]));
+ std::size_t pos=std::distance(bg,res);
+ std::size_t pos2=nbOfCast-pos;
+ if(pos2<nbOfCast)
+ {
+ ret1Ptr[i]=static_cast<T>(pos2);
+ ret2Ptr[i]=work[i]-arrBg[pos2];
+ castsDetected.insert(ret1Ptr[i]);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::splitByValueRange : At rank #" << i << " the value is " << work[i] << " should be in [0," << *bg << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ ret3->alloc(castsDetected.size(),1);
+ std::copy(castsDetected.begin(),castsDetected.end(),ret3->getPointer());
+ castArr=ret1.retn();
+ rankInsideCast=ret2.retn();
+ castsPresent=ret3.retn();
+ }
+
+ /*!
+ * This method look at \a this if it can be considered as a range defined by the 3-tuple ( \a strt , \a sttoopp , \a stteepp ).
+ * If false is returned the tuple must be ignored. If true is returned \a this can be considered by a range( \a strt , \a sttoopp , \a stteepp ).
+ * This method works only if \a this is allocated and single component. If not an exception will be thrown.
+ *
+ * \param [out] strt - the start of the range (included) if true is returned.
+ * \param [out] sttoopp - the end of the range (not included) if true is returned.
+ * \param [out] stteepp - the step of the range if true is returned.
+ * \return the verdict of the check.
+ *
+ * \sa DataArray::GetNumberOfItemGivenBES
+ */
+ template<class T>
+ bool DataArrayDiscrete<T>::isRange(T& strt, T& sttoopp, T& stteepp) const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::isRange : this must be single component array !");
+ mcIdType nbTuples(this->getNumberOfTuples());
+ if(nbTuples==0)
+ { strt=0; sttoopp=0; stteepp=1; return true; }
+ const T *pt(this->begin());
+ strt=*pt;
+ if(nbTuples==1)
+ { sttoopp=strt+1; stteepp=1; return true; }
+ strt=*pt; sttoopp=pt[nbTuples-1];
+ if(strt==sttoopp)
+ return false;
+ if(sttoopp>strt)
+ {
+ sttoopp++;
+ T a(sttoopp-1-strt),tmp(strt);
+ if(a%(nbTuples-1)!=0)
+ return false;
+ stteepp=a/(FromIdType<T>(nbTuples)-1);
+ for(mcIdType i=0;i<nbTuples;i++,tmp+=stteepp)
+ if(pt[i]!=tmp)
+ return false;
+ return true;
+ }
+ else
+ {
+ sttoopp--;
+ T a(strt-sttoopp-1),tmp(strt);
+ if(a%(nbTuples-1)!=0)
+ return false;
+ stteepp=-(a/(FromIdType<T>(nbTuples)-1));
+ for(mcIdType i=0;i<nbTuples;i++,tmp+=stteepp)
+ if(pt[i]!=tmp)
+ return false;
+ return true;
+ }
+ }
+
+ /*!
+ * Creates a one-dimensional DataArrayInt of given length, whose contents are computed
+ * from values of \a this array, which is supposed to contain a renumbering map in
+ * "Old to New" mode. The result array contains a renumbering map in "New to Old" mode.
+ * To know how to use the renumbering maps see \ref numbering.
+ * \param [in] newNbOfElem - the number of tuples in the result array.
+ * \return DataArrayInt * - the new instance of DataArrayInt.
+ * The caller is to delete this result array using decrRef() as it is no more
+ * needed.
+ *
+ * \if ENABLE_EXAMPLES
+ * \ref cpp_mcdataarrayint_invertarrayo2n2n2o "Here is a C++ example".<br>
+ * \ref py_mcdataarrayint_invertarrayo2n2n2o "Here is a Python example".
+ * \endif
+ */
+ template<class T>
+ DataArrayIdType * DataArrayDiscrete<T>::invertArrayO2N2N2O(mcIdType newNbOfElem) const
+ {
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
+ ret->alloc(newNbOfElem,1);
+ mcIdType nbOfOldNodes(this->getNumberOfTuples());
+ const T *old2New(this->begin());
+ mcIdType *pt(ret->getPointer());
+ for(mcIdType i=0;i!=nbOfOldNodes;i++)
+ {
+ T newp(old2New[i]);
+ if(newp!=-1)
+ {
+ if(newp>=0 && newp<newNbOfElem)
+ pt[newp]=i;
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::invertArrayO2N2N2O : At place #" << i << " the newplace is " << newp << " must be in [0," << newNbOfElem << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ }
+ return ret.retn();
+ }
+
+ /*!
+ * Creates a one-dimensional DataArrayInt of given length, whose contents are computed
+ * from values of \a this array, which is supposed to contain a renumbering map in
+ * "New to Old" mode. The result array contains a renumbering map in "Old to New" mode.
+ * To know how to use the renumbering maps see \ref numbering.
+ * \param [in] newNbOfElem - the number of tuples in the result array.
+ * \return DataArrayInt * - the new instance of DataArrayInt.
+ * The caller is to delete this result array using decrRef() as it is no more
+ * needed.
+ *
+ * \if ENABLE_EXAMPLES
+ * \ref cpp_mcdataarrayint_invertarrayn2o2o2n "Here is a C++ example".
+ *
+ * \ref py_mcdataarrayint_invertarrayn2o2o2n "Here is a Python example".
+ * \sa invertArrayN2O2O2NOptimized
+ * \endif
+ */
+ template <class T>
+ DataArrayIdType *DataArrayDiscrete<T>::invertArrayN2O2O2N(mcIdType oldNbOfElem) const
+ {
+ this->checkAllocated();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ ret->alloc(oldNbOfElem,1);
+ const T *new2Old=this->getConstPointer();
+ mcIdType *pt=ret->getPointer();
+ std::fill(pt,pt+oldNbOfElem,-1);
+ mcIdType nbOfNewElems(this->getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfNewElems;i++)
+ {
+ T v(new2Old[i]);
+ if(v>=0 && v<oldNbOfElem)
+ pt[v]=i;
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::invertArrayN2O2O2N : in new id #" << i << " old value is " << v << " expected to be in [0," << oldNbOfElem << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ return ret.retn();
+ }
+
+ /*!
+ * This method is similar to DataArrayInt::invertArrayO2N2N2O except that
+ * Example : If \a this contains [0,1,2,0,3,4,5,4,6,4] this method will return [0,1,2,4,5,6,8] whereas DataArrayInt::invertArrayO2N2N2O returns [3,1,2,4,9,6,8]
+ */
+ template <class T>
+ DataArrayIdType *DataArrayDiscrete<T>::invertArrayO2N2N2OBis(mcIdType newNbOfElem) const
+ {
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ ret->alloc(newNbOfElem,1);
+ mcIdType nbOfOldNodes(this->getNumberOfTuples());
+ const T *old2New=this->getConstPointer();
+ mcIdType *pt=ret->getPointer();
+ for(mcIdType i=nbOfOldNodes-1;i>=0;i--)
+ {
+ T newp(old2New[i]);
+ if(newp!=-1)
+ {
+ if(newp>=0 && newp<newNbOfElem)
+ pt[newp]=i;
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::invertArrayO2N2N2OBis : At place #" << i << " the newplace is " << newp << " must be in [0," << newNbOfElem << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ }
+ return ret.retn();
+ }
+
+ /*!
+ * Creates a map, whose contents are computed
+ * from values of \a this array, which is supposed to contain a renumbering map in
+ * "New to Old" mode. The result array contains a renumbering map in "Old to New" mode.
+ * To know how to use the renumbering maps see \ref numbering.
+ * \param [in] newNbOfElem - the number of tuples in the result array.
+ * \return MapII - the new instance of Map.
+ *
+ * \if ENABLE_EXAMPLES
+ * \ref cpp_mcdataarrayint_invertarrayn2o2o2n "Here is a C++ example".
+ *
+ * \ref py_mcdataarrayint_invertarrayn2o2o2n "Here is a Python example".
+ * \sa invertArrayN2O2O2N, giveN2OOptimized, MEDCouplingPointSet::renumberNodesInConn
+ * \endif
+ */
+ template <class T>
+ MCAuto< MapKeyVal<T, mcIdType> > DataArrayDiscrete<T>::invertArrayN2O2O2NOptimized() const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::invertArrayN2O2O2NOptimized : single component expected !");
+ MCAuto< MapKeyVal<T, mcIdType> > ret(MapKeyVal<T, mcIdType>::New());
+ std::map<T, mcIdType>& m(ret->data());
+ const T *new2Old(this->begin());
+ mcIdType nbOfNewElems(this->getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfNewElems;i++)
+ {
+ T v(new2Old[i]);
+ m[v]=i;
+ }
+ return ret;
+ }
+
+ /*!
+ * Creates a map, whose contents are computed
+ * from values of \a this array, which is supposed to contain a renumbering map in
+ * "New to Old" mode. The result array contains a renumbering map in "New to Old" mode as C++ map for performance reasons.
+ *
+ * \sa invertArrayN2O2O2NOptimized, MEDCouplingPointSet::renumberNodesInConn
+ */
+ template <class T>
+ MCAuto< MapKeyVal<mcIdType, T> > DataArrayDiscrete<T>::giveN2OOptimized() const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::giveN2OOptimized : single component expected !");
+ MCAuto< MapKeyVal<mcIdType, T> > ret(MapKeyVal<mcIdType, T>::New());
+ std::map<mcIdType,T>& m(ret->data());
+ const T *new2Old(this->begin());
+ mcIdType nbOfNewElems(this->getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfNewElems;i++)
+ {
+ T v(new2Old[i]);
+ m[i]=v;
+ }
+ return ret;
+ }
+
+ /*!
+ * This method finds for each element \a ELT in [valsBg,valsEnd) elements in \a this equal to it. Associated to ELT
+ * this method will return the tuple id of last element found. If there is no element in \a this equal to ELT
+ * an exception will be thrown.
+ *
+ * In case of success this[ret]==vals. Samely ret->transformWithIndArr(this->begin(),this->end())==vals.
+ * Where \a vals is the [valsBg,valsEnd) array and \a ret the array returned by this method.
+ * This method can be seen as an extension of FindPermutationFromFirstToSecond.
+ * <br>
+ * \b Example: <br>
+ * - \a this: [17,27,2,10,-4,3,12,27,16]
+ * - \a val : [3,16,-4,27,17]
+ * - result: [5,8,4,7,0]
+ *
+ * \return - An array of size std::distance(valsBg,valsEnd)
+ *
+ * \sa DataArrayInt::FindPermutationFromFirstToSecond
+ */
+ template <class T>
+ MCAuto<DataArrayIdType> DataArrayDiscrete<T>::findIdForEach(const T *valsBg, const T *valsEnd) const
+ {
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
+ std::size_t nbOfTuplesOut(std::distance(valsBg,valsEnd));
+ ret->alloc(nbOfTuplesOut,1);
+ MCAuto< MapKeyVal<T, mcIdType> > zeMap(this->invertArrayN2O2O2NOptimized());
+ const std::map<T, mcIdType>& dat(zeMap->data());
+ mcIdType *ptToFeed(ret->getPointer());
+ for(const T *pt=valsBg;pt!=valsEnd;pt++)
+ {
+ typename std::map<T,mcIdType>::const_iterator it(dat.find(*pt));
+ if(it!=dat.end())
+ *ptToFeed++=(*it).second;
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::findIdForEach : error for element at place " << std::distance(valsBg,pt);
+ oss << " of input array value is " << *pt << " which is not in this !";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ }
+ return ret;
+ }
+ /*!
+ * Returns a new DataArrayInt containing a renumbering map in "Old to New" mode.
+ * This map, if applied to \a this array, would make it sorted. For example, if
+ * \a this array contents are [9,10,0,6,4,11,3,7] then the contents of the result array
+ * are [5,6,0,3,2,7,1,4]; if this result array (\a res) is used as an argument in call
+ * \a this->renumber(\a res) then the returned array contains [0,3,4,6,7,9,10,11].
+ * This method is useful for renumbering (in MED file for example). For more info
+ * on renumbering see \ref numbering.
+ * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ * array using decrRef() as it is no more needed.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ * \throw If there are equal values in \a this array.
+ */
+ template <class T>
+ DataArrayIdType *DataArrayDiscrete<T>::checkAndPreparePermutation() const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::checkAndPreparePermutation : number of components must == 1 !");
+ mcIdType nbTuples(this->getNumberOfTuples());
+ const T *pt=this->getConstPointer();
+ mcIdType *pt2=this->CheckAndPreparePermutation(pt,pt+nbTuples);
+ DataArrayIdType *ret=DataArrayIdType::New();
+ ret->useArray(pt2,true,DeallocType::C_DEALLOC,nbTuples,1);
+ return ret;
+ }
+
+ /*!
+ * Returns two arrays describing a surjective mapping from \a this set of values (\a A)
+ * onto a set of values of size \a targetNb (\a B). The surjective function is
+ * \a B[ \a A[ i ]] = i. That is to say that for each \a id in [0,\a targetNb), where \a
+ * targetNb < \a this->getNumberOfTuples(), there exists at least one tupleId (\a tid) so
+ * that <em> this->getIJ( tid, 0 ) == id</em>. <br>
+ * The first of out arrays returns indices of elements of \a this array, grouped by their
+ * place in the set \a B. The second out array is the index of the first one; it shows how
+ * many elements of \a A are mapped into each element of \a B. <br>
+ * For more info on
+ * mapping and its usage in renumbering see \ref numbering. <br>
+ * \b Example:
+ * - \a this: [0,3,2,3,2,2,1,2]
+ * - \a targetNb: 4
+ * - \a arr: [0, 6, 2,4,5,7, 1,3]
+ * - \a arrI: [0,1,2,6,8]
+ *
+ * This result means: <br>
+ * the element of \a B 0 encounters within \a A once (\a arrI[ 0+1 ] - \a arrI[ 0 ]) and
+ * its index within \a A is 0 ( \a arr[ 0:1 ] == \a arr[ \a arrI[ 0 ] : \a arrI[ 0+1 ]]);<br>
+ * the element of \a B 2 encounters within \a A 4 times (\a arrI[ 2+1 ] - \a arrI[ 2 ]) and
+ * its indices within \a A are [2,4,5,7] ( \a arr[ 2:6 ] == \a arr[ \a arrI[ 2 ] :
+ * \a arrI[ 2+1 ]]); <br> etc.
+ * \param [in] targetNb - the size of the set \a B. \a targetNb must be equal or more
+ * than the maximal value of \a A.
+ * \param [out] arr - a new instance of DataArrayInt returning indices of
+ * elements of \a this, grouped by their place in the set \a B. The caller is to delete
+ * this array using decrRef() as it is no more needed.
+ * \param [out] arrI - a new instance of DataArrayInt returning size of groups of equal
+ * elements of \a this. The caller is to delete this array using decrRef() as it
+ * is no more needed.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ * \throw If any value in \a this is more or equal to \a targetNb.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::changeSurjectiveFormat(T targetNb, DataArrayIdType *&arr, DataArrayIdType *&arrI) const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : number of components must == 1 !");
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ const T *input=this->getConstPointer();
+ std::vector< std::vector<mcIdType> > tmp(targetNb);
+ for(mcIdType i=0;i<nbOfTuples;i++)
+ {
+ T tmp2=input[i];
+ if(tmp2>=0 && tmp2<targetNb)
+ tmp[tmp2].push_back(i);
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::changeSurjectiveFormat : At pos " << i << " presence of element " << tmp2 << " ! should be in [0," << targetNb << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+
+ MCAuto<DataArrayIdType> retI(DataArrayIdType::New());
+ retI->alloc(targetNb+1,1);
+ mcIdType *retIPtr=retI->getPointer();
+ *retIPtr=0;
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=tmp.begin();it1!=tmp.end();it1++,retIPtr++)
+ retIPtr[1]=retIPtr[0]+ToIdType((*it1).size());
+ if(nbOfTuples!=retI->getIJ(ToIdType(targetNb),0))
+ throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : big problem should never happen !");
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
+ ret->alloc(nbOfTuples,1);
+ mcIdType *retPtr=ret->getPointer();
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=tmp.begin();it1!=tmp.end();it1++)
+ retPtr=std::copy((*it1).begin(),(*it1).end(),retPtr);
+ arr=ret.retn();
+ arrI=retI.retn();
+ }
+
+ /*!
+ * Returns a new DataArrayInt containing a renumbering map in "New to Old" mode,
+ * which if applied to \a this array would make it sorted ascendingly.
+ * For more info on renumbering see \ref numbering. <br>
+ * \b Example: <br>
+ * - \a this: [2,0,1,1,0,1,2,0,1,1,0,0]
+ * - result: [10,0,5,6,1,7,11,2,8,9,3,4]
+ * - after applying result to \a this: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2]
+ *
+ * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ * array using decrRef() as it is no more needed.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ */
+ template <class T>
+ DataArrayIdType *DataArrayDiscrete<T>::buildPermArrPerLevel() const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildPermArrPerLevel : number of components must == 1 !");
+ mcIdType nbOfTuples=this->getNumberOfTuples();
+ const T *pt=this->getConstPointer();
+ std::map<T,mcIdType> m;
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ ret->alloc(nbOfTuples,1);
+ mcIdType *opt=ret->getPointer();
+ for(mcIdType i=0;i<nbOfTuples;i++,pt++,opt++)
+ {
+ T val=*pt;
+ typename std::map<T,mcIdType>::iterator it=m.find(val);
+ if(it!=m.end())
+ {
+ *opt=(*it).second;
+ (*it).second++;
+ }
+ else
+ {
+ *opt=0;
+ m.insert(std::pair<T,mcIdType>(val,1));
+ }
+ }
+ mcIdType sum=0;
+ for(typename std::map<T,mcIdType>::iterator it=m.begin();it!=m.end();it++)
+ {
+ mcIdType vt=(*it).second;
+ (*it).second=sum;
+ sum+=vt;
+ }
+ pt=this->getConstPointer();
+ opt=ret->getPointer();
+ for(mcIdType i=0;i<nbOfTuples;i++,pt++,opt++)
+ *opt+=m[*pt];
+ //
+ return ret.retn();
+ }
+
+ /*!
+ * Checks if \a this array has the given size, and if its contents is equal to an array filled with
+ * iota(). This method is particularly useful for DataArrayInt instances that represent
+ * a renumbering array, to check if there is a real need in renumbering.
+ * This method checks than \a this can be considered as an identity mapping
+ * of a set having \a sizeExpected elements into itself.
+ *
+ * \param [in] sizeExpected - The number of elements expected.
+ * \return bool - \a true if \a this array contents == \a range( \a this->getNumberOfTuples())
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ */
+ template <class T>
+ bool DataArrayDiscrete<T>::isIota(mcIdType sizeExpected) const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ return false;
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ if(nbOfTuples!=sizeExpected)
+ return false;
+ const T *pt=this->getConstPointer();
+ for(mcIdType i=0;i<nbOfTuples;i++,pt++)
+ if(*pt!=i)
+ return false;
+ return true;
+ }
+
+ /*!
+ * Checks if all values in \a this array are equal to \a val.
+ * \param [in] val - value to check equality of array values to.
+ * \return bool - \a true if all values are \a val.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1
+ * \sa DataArrayInt::checkUniformAndGuess
+ */
+ template <class T>
+ bool DataArrayDiscrete<T>::isUniform(T val) const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::isUniform : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
+ const T *w(this->begin()),*end2(this->end());
+ for(;w!=end2;w++)
+ if(*w!=val)
+ return false;
+ return true;
+ }
+
+ /*!
+ * This method checks that \a this is uniform. If not and exception will be thrown.
+ * In case of uniformity the corresponding value is returned.
+ *
+ * \return mcIdType - the unique value contained in this
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1
+ * \throw If \a this is not uniform.
+ * \sa DataArrayInt::isUniform
+ */
+ template <class T>
+ T DataArrayDiscrete<T>::checkUniformAndGuess() const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
+ if(this->empty())
+ throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : this is empty !");
+ const T *w(this->begin()),*end2(this->end());
+ T ret(*w);
+ for(;w!=end2;w++)
+ if(*w!=ret)
+ throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : this is not uniform !");
+ return ret;
+ }
+
+ /*!
+ * Checks if all values in \a this array are unique.
+ * \return bool - \a true if condition above is true
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1
+ */
+ template <class T>
+ bool DataArrayDiscrete<T>::hasUniqueValues() const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::hasOnlyUniqueValues: must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
+ std::size_t nbOfElements(this->getNumberOfTuples());
+ std::set<T> s(this->begin(),this->end()); // in C++11, should use unordered_set (O(1) complexity)
+ if (s.size() != nbOfElements)
+ return false;
+ return true;
+ }
+
+ /*!
+ * Copy all components in a specified order from another DataArrayInt.
+ * The specified components become the first ones in \a this array.
+ * Both numerical and textual data is copied. The number of tuples in \a this and
+ * the other array can be different.
+ * \param [in] a - the array to copy data from.
+ * \param [in] compoIds - sequence of zero based indices of components, data of which is
+ * to be copied.
+ * \throw If \a a is NULL.
+ * \throw If \a compoIds.size() != \a a->getNumberOfComponents().
+ * \throw If \a compoIds[i] < 0 or \a compoIds[i] > \a this->getNumberOfComponents().
+ *
+ * \if ENABLE_EXAMPLES
+ * \ref py_mcdataarrayint_setselectedcomponents "Here is a Python example".
+ * \endif
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::setSelectedComponents(const DataArrayType *a, const std::vector<std::size_t>& compoIds)
+ {
+ if(!a)
+ throw INTERP_KERNEL::Exception("DataArrayInt::setSelectedComponents : input DataArrayInt is NULL !");
+ this->checkAllocated();
+ a->checkAllocated();
+ this->copyPartOfStringInfoFrom2(compoIds,*a);
+ std::size_t partOfCompoSz=compoIds.size();
+ std::size_t nbOfCompo = this->getNumberOfComponents();
+ mcIdType nbOfTuples=std::min(this->getNumberOfTuples(),a->getNumberOfTuples());
+ const T *ac=a->getConstPointer();
+ T *nc=this->getPointer();
+ for(mcIdType i=0;i<nbOfTuples;i++)
+ for(std::size_t j=0;j<partOfCompoSz;j++,ac++)
+ nc[nbOfCompo*i+compoIds[j]]=*ac;
+ }
+
+ /*!
+ * Creates a new DataArrayInt containing IDs (indices) of tuples holding value \b not
+ * equal to a given one.
+ * \param [in] val - the value to ignore within \a this.
+ * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ * array using decrRef() as it is no more needed.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ */
+ template <class T>
+ DataArrayIdType *DataArrayDiscrete<T>::findIdsNotEqual(T val) const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !");
+ const T *cptr(this->getConstPointer());
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
+ ret->alloc(0,1);
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
+ if(*cptr!=val)
+ ret->pushBackSilent(i);
+ return ret.retn();
+ }
+
+ /*!
+ * Creates a new DataArrayInt containing IDs (indices) of tuples holding tuple equal to those defined by [ \a tupleBg , \a tupleEnd )
+ * This method is an extension of DataArrayInt::findIdsEqual method.
+ *
+ * \param [in] tupleBg - the begin (included) of the input tuple to find within \a this.
+ * \param [in] tupleEnd - the end (excluded) of the input tuple to find within \a this.
+ * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ * array using decrRef() as it is no more needed.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != std::distance(tupleBg,tupleEnd).
+ * \throw If \a this->getNumberOfComponents() is equal to 0.
+ * \sa DataArrayInt::findIdsEqual
+ */
+ template <class T>
+ DataArrayIdType *DataArrayDiscrete<T>::findIdsEqualTuple(const T *tupleBg, const T *tupleEnd) const
+ {
+ std::size_t nbOfCompoExp=std::distance(tupleBg,tupleEnd);
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=nbOfCompoExp)
+ {
+ std::ostringstream oss; oss << "DataArrayInt::findIdsEqualTuple : mismatch of number of components. Input tuple has " << nbOfCompoExp << " whereas this array has " << this->getNumberOfComponents() << " components !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(nbOfCompoExp==0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualTuple : number of components should be > 0 !");
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
+ ret->alloc(0,1);
+ const T *bg(this->begin()),*end2(this->end()),*work(this->begin());
+ while(work!=end2)
+ {
+ work=std::search(work,end2,tupleBg,tupleEnd);
+ if(work!=end2)
+ {
+ std::ptrdiff_t pos=std::distance(bg,work);
+ if(pos%nbOfCompoExp==0)
+ ret->pushBackSilent(ToIdType(pos/nbOfCompoExp));
+ work++;
+ }
+ }
+ return ret.retn();
+ }
+
+ /*!
+ * Creates a new DataArrayInt containing IDs (indices) of tuples holding value equal to
+ * one of given values.
+ * \param [in] valsBg - an array of values to find within \a this array.
+ * \param [in] valsEnd - specifies the end of the array \a valsBg, so that
+ * the last value of \a valsBg is \a valsEnd[ -1 ].
+ * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ * array using decrRef() as it is no more needed.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ */
+ template <class T>
+ DataArrayIdType *DataArrayDiscrete<T>::findIdsEqualList(const T *valsBg, const T *valsEnd) const
+ {
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : the array must have only one component, you can call 'rearrange' method before !");
+ std::set<T> vals2(valsBg,valsEnd);
+ const T *cptr(this->getConstPointer());
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
+ if(vals2.find(*cptr)!=vals2.end())
+ ret->pushBackSilent(i);
+ return ret.retn();
+ }
+
+ /*!
+ * Creates a new DataArrayInt containing IDs (indices) of tuples holding values \b not
+ * equal to any of given values.
+ * \param [in] valsBg - an array of values to ignore within \a this array.
+ * \param [in] valsEnd - specifies the end of the array \a valsBg, so that
+ * the last value of \a valsBg is \a valsEnd[ -1 ].
+ * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ * array using decrRef() as it is no more needed.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ */
+ template <class T>
+ DataArrayIdType *DataArrayDiscrete<T>::findIdsNotEqualList(const T *valsBg, const T *valsEnd) const
+ {
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : the array must have only one component, you can call 'rearrange' method before !");
+ std::set<T> vals2(valsBg,valsEnd);
+ const T *cptr=this->getConstPointer();
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
+ if(vals2.find(*cptr)==vals2.end())
+ ret->pushBackSilent(i);
+ return ret.retn();
+ }
+
+ /*!
+ * This method expects to be called when number of components of this is equal to one.
+ * This method returns the tuple id, if it exists, of the first tuple equal to \b value.
+ * If not any tuple contains \b value -1 is returned.
+ * \sa DataArrayInt::presenceOfValue
+ */
+ template <class T>
+ mcIdType DataArrayDiscrete<T>::findIdFirstEqual(T value) const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
+ const T *cptr=this->getConstPointer();
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ const T *ret=std::find(cptr,cptr+nbOfTuples,value);
+ if(ret!=cptr+nbOfTuples)
+ return ToIdType(std::distance(cptr,ret));
+ return -1;
+ }
+
+ /*!
+ * This method expects to be called when number of components of this is equal to one.
+ * This method returns the tuple id, if it exists, of the first tuple so that the value is contained in \b vals.
+ * If not any tuple contains one of the values contained in 'vals' -1 is returned.
+ * \sa DataArrayInt::presenceOfValue
+ */
+ template <class T>
+ mcIdType DataArrayDiscrete<T>::findIdFirstEqual(const std::vector<T>& vals) const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
+ std::set<T> vals2(vals.begin(),vals.end());
+ const T *cptr=this->getConstPointer();
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ for(const T *w=cptr;w!=cptr+nbOfTuples;w++)
+ if(vals2.find(*w)!=vals2.end())
+ return ToIdType(std::distance(cptr,w));
+ return -1;
+ }
+
+ /*!
+ * This method is an extension of DataArrayInt::findIdFirstEqual method because this method works for DataArrayInt with
+ * any number of components excepted 0 (an INTERP_KERNEL::Exception is thrown in this case).
+ * This method searches in \b this is there is a tuple that matched the input parameter \b tupl.
+ * If any the tuple id is returned. If not -1 is returned.
+ *
+ * This method throws an INTERP_KERNEL::Exception if the number of components in \b this mismatches with the size of
+ * the input vector. An INTERP_KERNEL::Exception is thrown too if \b this is not allocated.
+ *
+ * \return tuple id where \b tupl is. -1 if no such tuple exists in \b this.
+ * \sa DataArrayInt::findIdSequence, DataArrayInt::presenceOfTuple.
+ */
+ template <class T>
+ mcIdType DataArrayDiscrete<T>::findIdFirstEqualTuple(const std::vector<T>& tupl) const
+ {
+ this->checkAllocated();
+ std::size_t nbOfCompo(this->getNumberOfComponents());
+ if(nbOfCompo==0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdFirstEqualTuple : 0 components in 'this' !");
+ if(nbOfCompo!=tupl.size())
+ {
+ std::ostringstream oss; oss << "DataArrayInt::findIdFirstEqualTuple : 'this' contains " << nbOfCompo << " components and searching for a tuple of length " << tupl.size() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ const T *cptr=this->getConstPointer();
+ std::size_t nbOfVals=this->getNbOfElems();
+ for(const T *work=cptr;work!=cptr+nbOfVals;)
+ {
+ work=std::search(work,cptr+nbOfVals,tupl.begin(),tupl.end());
+ if(work!=cptr+nbOfVals)
+ {
+ if(std::distance(cptr,work)%nbOfCompo!=0)
+ work++;
+ else
+ return ToIdType (std::distance(cptr,work)/nbOfCompo);
+ }
+ }
+ return -1;
+ }
+
+ /*!
+ * This method searches the sequence specified in input parameter \b vals in \b this.
+ * This works only for DataArrayInt having number of components equal to one (if not an INTERP_KERNEL::Exception will be thrown).
+ * This method differs from DataArrayInt::findIdFirstEqualTuple in that the position is internal raw data is not considered here contrary to DataArrayInt::findIdFirstEqualTuple.
+ * \sa DataArrayInt::findIdFirstEqualTuple
+ */
+ template <class T>
+ mcIdType DataArrayDiscrete<T>::findIdSequence(const std::vector<T>& vals) const
+ {
+ this->checkAllocated();
+ std::size_t nbOfCompo=this->getNumberOfComponents();
+ if(nbOfCompo!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdSequence : works only for DataArrayInt instance with one component !");
+ const T *cptr=this->getConstPointer();
+ std::size_t nbOfVals=this->getNbOfElems();
+ const T *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end());
+ if(loc!=cptr+nbOfVals)
+ return ToIdType(std::distance(cptr,loc));
+ return -1;
+ }
+
+ /*!
+ * Assigns \a newValue to all elements holding \a oldValue within \a this
+ * one-dimensional array.
+ * \param [in] oldValue - the value to replace.
+ * \param [in] newValue - the value to assign.
+ * \return mcIdType - number of replacements performed.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ */
+ template <class T>
+ mcIdType DataArrayDiscrete<T>::changeValue(T oldValue, T newValue)
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::changeValue : the array must have only one component, you can call 'rearrange' method before !");
+ if(oldValue==newValue)
+ return 0;
+ T *start(this->getPointer()),*end2(start+this->getNbOfElems());
+ mcIdType ret(0);
+ for(T *val=start;val!=end2;val++)
+ {
+ if(*val==oldValue)
+ {
+ *val=newValue;
+ ret++;
+ }
+ }
+ if(ret>0)
+ this->declareAsNew();
+ return ret;
+ }
+
+ /*!
+ * This method returns the number of values in \a this that are equals to input parameter \a value.
+ * This method only works for single component array.
+ *
+ * \return a value in [ 0, \c this->getNumberOfTuples() )
+ *
+ * \throw If \a this is not allocated
+ *
+ */
+ template <class T>
+ mcIdType DataArrayDiscrete<T>::count(T value) const
+ {
+ mcIdType ret=0;
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::count : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
+ const T *vals=this->begin();
+ std::size_t nbOfElements=this->getNumberOfTuples();
+ for(std::size_t i=0;i<nbOfElements;i++,vals++)
+ if(*vals==value)
+ ret++;
+ return ret;
+ }
+
+ /*!
+ * This method is an extension of DataArrayInt::presenceOfValue method because this method works for DataArrayInt with
+ * any number of components excepted 0 (an INTERP_KERNEL::Exception is thrown in this case).
+ * This method searches in \b this is there is a tuple that matched the input parameter \b tupl.
+ * This method throws an INTERP_KERNEL::Exception if the number of components in \b this mismatches with the size of
+ * the input vector. An INTERP_KERNEL::Exception is thrown too if \b this is not allocated.
+ * \sa DataArrayInt::findIdFirstEqualTuple
+ */
+ template <class T>
+ bool DataArrayDiscrete<T>::presenceOfTuple(const std::vector<T>& tupl) const
+ {
+ return this->findIdFirstEqualTuple(tupl)!=-1;
+ }
+
+
+ /*!
+ * Returns \a true if a given value is present within \a this one-dimensional array.
+ * \param [in] value - the value to find within \a this array.
+ * \return bool - \a true in case if \a value is present within \a this array.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ * \sa findIdFirstEqual()
+ */
+ template <class T>
+ bool DataArrayDiscrete<T>::presenceOfValue(T value) const
+ {
+ return this->findIdFirstEqual(value)!=-1;
+ }
+
+ /*!
+ * This method expects to be called when number of components of this is equal to one.
+ * This method returns true if it exists a tuple so that the value is contained in \b vals.
+ * If not any tuple contains one of the values contained in 'vals' false is returned.
+ * \sa DataArrayInt::findIdFirstEqual
+ */
+ template <class T>
+ bool DataArrayDiscrete<T>::presenceOfValue(const std::vector<T>& vals) const
+ {
+ return this->findIdFirstEqual(vals)!=-1;
+ }
+
+ /*!
+ * Accumulates values of each component of \a this array.
+ * \param [out] res - an array of length \a this->getNumberOfComponents(), allocated
+ * by the caller, that is filled by this method with sum value for each
+ * component.
+ * \throw If \a this is not allocated.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::accumulate(T *res) const
+ {
+ this->checkAllocated();
+ const T *ptr=this->getConstPointer();
+ mcIdType nbTuple(this->getNumberOfTuples());
+ std::size_t nbComps(this->getNumberOfComponents());
+ std::fill(res,res+nbComps,0);
+ for(mcIdType i=0;i<nbTuple;i++)
+ std::transform(ptr+i*nbComps,ptr+(i+1)*nbComps,res,res,std::plus<T>());
+ }
+
+ template <class T>
+ T DataArrayDiscrete<T>::accumulate(std::size_t compId) const
+ {
+ this->checkAllocated();
+ const T *ptr=this->getConstPointer();
+ mcIdType nbTuple(this->getNumberOfTuples());
+ std::size_t nbComps(this->getNumberOfComponents());
+ if(compId<0 || compId>=nbComps)
+ throw INTERP_KERNEL::Exception("DataArrayInt::accumulate : Invalid compId specified : No such nb of components !");
+ T ret=0;
+ for(mcIdType i=0;i<nbTuple;i++)
+ ret+=ptr[i*nbComps+compId];
+ return ret;
+ }
+
+ /*!
+ * This method accumulate using addition tuples in \a this using input index array [ \a bgOfIndex, \a endOfIndex ).
+ * The returned array will have same number of components than \a this and number of tuples equal to
+ * \c std::distance(bgOfIndex,endOfIndex) \b minus \b one.
+ *
+ * The input index array is expected to be ascendingly sorted in which the all referenced ids should be in [0, \c this->getNumberOfTuples).
+ *
+ * \param [in] bgOfIndex - begin (included) of the input index array.
+ * \param [in] endOfIndex - end (excluded) of the input index array.
+ * \return DataArrayInt * - the new instance having the same number of components than \a this.
+ *
+ * \throw If bgOfIndex or end is NULL.
+ * \throw If input index array is not ascendingly sorted.
+ * \throw If there is an id in [ \a bgOfIndex, \a endOfIndex ) not in [0, \c this->getNumberOfTuples).
+ * \throw If std::distance(bgOfIndex,endOfIndex)==0.
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::accumulatePerChunck(const mcIdType *bgOfIndex, const mcIdType *endOfIndex) const
+ {
+ if(!bgOfIndex || !endOfIndex)
+ throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : input pointer NULL !");
+ this->checkAllocated();
+ std::size_t nbCompo(this->getNumberOfComponents());
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ mcIdType sz=ToIdType(std::distance(bgOfIndex,endOfIndex));
+ if(sz<1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : invalid size of input index array !");
+ sz--;
+ MCAuto<DataArrayType> ret=DataArrayType::New(); ret->alloc(sz,nbCompo);
+ const mcIdType *w=bgOfIndex;
+ if(*w<0 || *w>=nbOfTuples)
+ throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : The first element of the input index not in [0,nbOfTuples) !");
+ const T *srcPt=this->begin()+(*w)*nbCompo;
+ T *tmp=ret->getPointer();
+ for(mcIdType i=0;i<sz;i++,tmp+=nbCompo,w++)
+ {
+ std::fill(tmp,tmp+nbCompo,0);
+ if(w[1]>=w[0])
+ {
+ for(mcIdType j=w[0];j<w[1];j++,srcPt+=nbCompo)
+ {
+ if(j>=0 && j<nbOfTuples)
+ std::transform(srcPt,srcPt+nbCompo,tmp,tmp,std::plus<T>());
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::accumulatePerChunck : At rank #" << i << " the input index array points to id " << j << " should be in [0," << nbOfTuples << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::accumulatePerChunck : At rank #" << i << " the input index array is not in ascendingly sorted.";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ ret->copyStringInfoFrom(*this);
+ return ret.retn();
+ }
+
+ /*!
+ * Returns in a single walk in \a this the min value and the max value in \a this.
+ * \a this is expected to be single component array.
+ *
+ * \param [out] minValue - the min value in \a this.
+ * \param [out] maxValue - the max value in \a this.
+ *
+ * \sa getMinValueInArray, getMinValue, getMaxValueInArray, getMaxValue
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::getMinMaxValues(T& minValue, T& maxValue) const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::getMinMaxValues : must be applied on DataArrayInt with only one component !");
+ std::size_t nbElements(this->getNumberOfTuples());
+ const T *pt(this->begin());
+ minValue=std::numeric_limits<T>::max(); maxValue=-std::numeric_limits<T>::max();
+ for(std::size_t i=0;i<nbElements;i++,pt++)
+ {
+ if(*pt<minValue)
+ minValue=*pt;
+ if(*pt>maxValue)
+ maxValue=*pt;
+ }
+ }
+
+ /*!
+ * Modify all elements of \a this array, so that
+ * an element _x_ becomes \f$ numerator / x \f$.
+ * \warning If an exception is thrown because of presence of 0 element in \a this
+ * array, all elements processed before detection of the zero element remain
+ * modified.
+ * \param [in] numerator - the numerator used to modify array elements.
+ * \throw If \a this is not allocated.
+ * \throw If there is an element equal to 0 in \a this array.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::applyInv(T numerator)
+ {
+ this->checkAllocated();
+ T *ptr=this->getPointer();
+ std::size_t nbOfElems=this->getNbOfElems();
+ for(std::size_t i=0;i<nbOfElems;i++,ptr++)
+ {
+ if(*ptr!=0)
+ {
+ *ptr=numerator/(*ptr);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::applyInv : presence of null value in tuple #" << i/(this->getNumberOfComponents()) << " component #" << i%(this->getNumberOfComponents());
+ oss << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ this->declareAsNew();
+ }
+
+ /*!
+ * Modify all elements of \a this array, so that
+ * an element _x_ becomes \f$ x / val \f$.
+ * \param [in] val - the denominator used to modify array elements.
+ * \throw If \a this is not allocated.
+ * \throw If \a val == 0.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::applyDivideBy(T val)
+ {
+ if(val==0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::applyDivideBy : Trying to divide by 0 !");
+ this->checkAllocated();
+ T *ptr=this->getPointer();
+ std::size_t nbOfElems=this->getNbOfElems();
+ std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::divides<T>(),val));
+ this->declareAsNew();
+ }
+
+ /*!
+ * Modify all elements of \a this array, so that
+ * an element _x_ becomes <em> x % val </em>.
+ * \param [in] val - the divisor used to modify array elements.
+ * \throw If \a this is not allocated.
+ * \throw If \a val <= 0.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::applyModulus(T val)
+ {
+ if(val<=0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::applyDivideBy : Trying to operate modulus on value <= 0 !");
+ this->checkAllocated();
+ T *ptr=this->getPointer();
+ std::size_t nbOfElems=this->getNbOfElems();
+ std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::modulus<T>(),val));
+ this->declareAsNew();
+ }
+
+ /*!
+ * Modify all elements of \a this array, so that
+ * an element _x_ becomes <em> val % x </em>.
+ * \warning If an exception is thrown because of presence of an element <= 0 in \a this
+ * array, all elements processed before detection of the zero element remain
+ * modified.
+ * \param [in] val - the divident used to modify array elements.
+ * \throw If \a this is not allocated.
+ * \throw If there is an element equal to or less than 0 in \a this array.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::applyRModulus(T val)
+ {
+ this->checkAllocated();
+ T *ptr=this->getPointer();
+ std::size_t nbOfElems=this->getNbOfElems();
+ for(std::size_t i=0;i<nbOfElems;i++,ptr++)
+ {
+ if(*ptr>0)
+ {
+ *ptr=val%(*ptr);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::applyRModulus : presence of value <=0 in tuple #" << i/(this->getNumberOfComponents()) << " component #" << i%(this->getNumberOfComponents());
+ oss << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ this->declareAsNew();
+ }
+
+ /*!
+ * Modify all elements of \a this array, so that
+ * an element _x_ becomes <em> val ^ x </em>.
+ * \param [in] val - the value used to apply pow on all array elements.
+ * \throw If \a this is not allocated.
+ * \throw If \a val < 0.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::applyPow(T val)
+ {
+ this->checkAllocated();
+ if(val<0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::applyPow : input pow in < 0 !");
+ T *ptr=this->getPointer();
+ std::size_t nbOfElems=this->getNbOfElems();
+ if(val==0)
+ {
+ std::fill(ptr,ptr+nbOfElems,1);
+ return ;
+ }
+ for(std::size_t i=0;i<nbOfElems;i++,ptr++)
+ {
+ T tmp=1;
+ for(T j=0;j<val;j++)
+ tmp*=*ptr;
+ *ptr=tmp;
+ }
+ this->declareAsNew();
+ }
+
+ /*!
+ * Modify all elements of \a this array, so that
+ * an element _x_ becomes \f$ val ^ x \f$.
+ * \param [in] val - the value used to apply pow on all array elements.
+ * \throw If \a this is not allocated.
+ * \throw If there is an element < 0 in \a this array.
+ * \warning If an exception is thrown because of presence of 0 element in \a this
+ * array, all elements processed before detection of the zero element remain
+ * modified.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::applyRPow(T val)
+ {
+ this->checkAllocated();
+ T *ptr=this->getPointer();
+ std::size_t nbOfElems=this->getNbOfElems();
+ for(std::size_t i=0;i<nbOfElems;i++,ptr++)
+ {
+ if(*ptr>=0)
+ {
+ T tmp=1;
+ for(T j=0;j<*ptr;j++)
+ tmp*=val;
+ *ptr=tmp;
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::applyRPow : presence of negative value in tuple #" << i/(this->getNumberOfComponents()) << " component #" << i%(this->getNumberOfComponents());
+ oss << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ this->declareAsNew();
+ }
+
+ /*!
+ * This method works only on data array with one component.
+ * This method returns a newly allocated array storing stored ascendantly tuple ids in \b this so that
+ * this[*id] in [\b vmin,\b vmax)
+ *
+ * \param [in] vmin begin of range. This value is included in range (included).
+ * \param [in] vmax end of range. This value is \b not included in range (excluded).
+ * \return a newly allocated data array that the caller should deal with.
+ *
+ * \sa DataArrayInt::findIdsNotInRange , DataArrayInt::findIdsStricltyNegative
+ */
+ template <class T>
+ DataArrayIdType *DataArrayDiscrete<T>::findIdsInRange(T vmin, T vmax) const
+ {
+ InRange<T> ir(vmin,vmax);
+ MCAuto<DataArrayIdType> ret(this->findIdsAdv(ir));
+ return ret.retn();
+ }
+
+ /*!
+ * This method works only on data array with one component.
+ * This method returns a newly allocated array storing stored ascendantly tuple ids in \b this so that
+ * this[*id] \b not in [\b vmin,\b vmax)
+ *
+ * \param [in] vmin begin of range. This value is \b not included in range (excluded).
+ * \param [in] vmax end of range. This value is included in range (included).
+ * \return a newly allocated data array that the caller should deal with.
+ *
+ * \sa DataArrayInt::findIdsInRange , DataArrayInt::findIdsStricltyNegative
+ */
+ template <class T>
+ DataArrayIdType *DataArrayDiscrete<T>::findIdsNotInRange(T vmin, T vmax) const
+ {
+ NotInRange<T> nir(vmin,vmax);
+ MCAuto<DataArrayIdType> ret(this->findIdsAdv(nir));
+ return ret.retn();
+ }
+
+ /*!
+ * This method works only on data array with one component.
+ * This method checks that all ids in \b this are in [ \b vmin, \b vmax ). If there is at least one element in \a this not in [ \b vmin, \b vmax ) an exception will be thrown.
+ *
+ * \param [in] vmin begin of range. This value is included in range (included).
+ * \param [in] vmax end of range. This value is \b not included in range (excluded).
+ * \return if all ids in \a this are so that (*this)[i]==i for all i in [ 0, \c this->getNumberOfTuples() ). */
+ template <class T>
+ bool DataArrayDiscrete<T>::checkAllIdsInRange(T vmin, T vmax) const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::checkAllIdsInRange : this must have exactly one component !");
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ bool ret=true;
+ const T *cptr=this->getConstPointer();
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
+ {
+ if(*cptr>=vmin && *cptr<vmax)
+ { ret=ret && *cptr==i; }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::checkAllIdsInRange : tuple #" << i << " has value " << *cptr << " should be in [" << vmin << "," << vmax << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ return ret;
+ }
+
+ /*!
+ * Returns a new DataArrayInt which contains a complement of elements of \a this
+ * one-dimensional array. I.e. the result array contains all elements from the range [0,
+ * \a nbOfElement) not present in \a this array.
+ * \param [in] nbOfElement - maximal size of the result array.
+ * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ * array using decrRef() as it is no more needed.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ * \throw If any element \a x of \a this array violates condition ( 0 <= \a x < \a
+ * nbOfElement ).
+ */
+ template <class T>
+ DataArrayIdType *DataArrayDiscrete<T>::buildComplement(mcIdType nbOfElement) const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : only single component allowed !");
+ std::vector<bool> tmp(nbOfElement);
+ const T *pt=this->getConstPointer();
+ std::size_t nbOfElements=this->getNumberOfTuples();
+ for(const T *w=pt;w!=pt+nbOfElements;w++)
+ if(*w>=0 && *w<nbOfElement)
+ tmp[*w]=true;
+ else
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : an element is not in valid range : [0,nbOfElement) !");
+ std::size_t nbOfRetVal=std::count(tmp.begin(),tmp.end(),false);
+ DataArrayIdType *ret=DataArrayIdType::New();
+ ret->alloc(nbOfRetVal,1);
+ mcIdType j=0;
+ mcIdType *retPtr=ret->getPointer();
+ for(mcIdType i=0;i<nbOfElement;i++)
+ if(!tmp[i])
+ retPtr[j++]=i;
+ return ret;
+ }
+
+ /*!
+ * Returns a new DataArrayInt containing elements of \a this one-dimensional missing
+ * from an \a other one-dimensional array.
+ * \param [in] other - a DataArrayInt containing elements not to include in the result array.
+ * \return DataArrayInt * - a new instance of DataArrayInt with one component. The
+ * caller is to delete this array using decrRef() as it is no more needed.
+ * \throw If \a other is NULL.
+ * \throw If \a other is not allocated.
+ * \throw If \a other->getNumberOfComponents() != 1.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ * \sa DataArrayInt::buildSubstractionOptimized()
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::buildSubstraction(const DataArrayType *other) const
+ {
+ if(!other)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : DataArrayInt pointer in input is NULL !");
+ this->checkAllocated();
+ other->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed !");
+ if(other->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed for other type !");
+ const T *pt=this->getConstPointer();
+ std::size_t nbOfElements=this->getNumberOfTuples();
+ std::set<T> s1(pt,pt+nbOfElements);
+ pt=other->getConstPointer();
+ nbOfElements=other->getNumberOfTuples();
+ std::set<T> s2(pt,pt+nbOfElements);
+ std::vector<T> r;
+ std::set_difference(s1.begin(),s1.end(),s2.begin(),s2.end(),std::back_insert_iterator< std::vector<T> >(r));
+ DataArrayType *ret=DataArrayType::New();
+ ret->alloc(r.size(),1);
+ std::copy(r.begin(),r.end(),ret->getPointer());
+ return ret;
+ }
+
+ /*!
+ * \a this is expected to have one component and to be sorted ascendingly (as for \a other).
+ * \a other is expected to be a part of \a this. If not DataArrayInt::buildSubstraction should be called instead.
+ *
+ * \param [in] other an array with one component and expected to be sorted ascendingly.
+ * \ret list of ids in \a this but not in \a other.
+ * \sa DataArrayInt::buildSubstraction
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::buildSubstractionOptimized(const DataArrayType *other) const
+ {
+ static const char *MSG="DataArrayInt::buildSubstractionOptimized : only single component allowed !";
+ if(!other) throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstractionOptimized : NULL input array !");
+ this->checkAllocated(); other->checkAllocated();
+ if(this->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception(MSG);
+ if(other->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception(MSG);
+ const T *pt1Bg(this->begin()),*pt1End(this->end()),*pt2Bg(other->begin()),*pt2End(other->end());
+ const T *work1(pt1Bg),*work2(pt2Bg);
+ MCAuto<DataArrayType> ret(DataArrayType::New()); ret->alloc(0,1);
+ for(;work1!=pt1End;work1++)
+ {
+ if(work2!=pt2End && *work1==*work2)
+ work2++;
+ else
+ ret->pushBackSilent(*work1);
+ }
+ return ret.retn();
+ }
+
+ /*!
+ * Returns a new DataArrayInt which contains all elements of \a this and a given
+ * one-dimensional arrays. The result array does not contain any duplicates
+ * and its values are sorted in ascending order.
+ * \param [in] other - an array to unite with \a this one.
+ * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ * array using decrRef() as it is no more needed.
+ * \throw If \a this or \a other is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ * \throw If \a other->getNumberOfComponents() != 1.
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::buildUnion(const DataArrayType *other) const
+ {
+ std::vector<const DataArrayType *>arrs(2);
+ arrs[0]=dynamic_cast<const DataArrayType *>(this); arrs[1]=other;
+ return DataArrayDiscrete<T>::BuildUnion(arrs);
+ }
+
+ /*!
+ * Returns a new DataArrayInt which contains elements present in both \a this and a given
+ * one-dimensional arrays. The result array does not contain any duplicates
+ * and its values are sorted in ascending order.
+ * \param [in] other - an array to intersect with \a this one.
+ * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ * array using decrRef() as it is no more needed.
+ * \throw If \a this or \a other is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ * \throw If \a other->getNumberOfComponents() != 1.
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::buildIntersection(const DataArrayType *other) const
+ {
+ std::vector<const DataArrayType *>arrs(2);
+ arrs[0]=dynamic_cast<const DataArrayType *>(this); arrs[1]=other;
+ return DataArrayDiscrete<T>::BuildIntersection(arrs);
+ }
+
+ /*!
+ * This method can be applied on allocated with one component DataArrayInt instance.
+ * This method is typically relevant for sorted arrays. All consecutive duplicated items in \a this will appear only once in returned DataArrayInt instance.
+ * Example : if \a this contains [1,2,2,3,3,3,3,4,5,5,7,7,7,19] the returned array will contain [1,2,3,4,5,7,19]
+ *
+ * \return a newly allocated array that contain the result of the unique operation applied on \a this.
+ * \throw if \a this is not allocated or if \a this has not exactly one component.
+ * \sa DataArrayInt::buildUniqueNotSorted
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::buildUnique() const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildUnique : only single component allowed !");
+ std::size_t nbOfElements=this->getNumberOfTuples();
+ MCAuto<DataArrayType> tmp=DataArrayType::New();
+ tmp->deepCopyFrom (*this);
+ T *data=tmp->getPointer();
+ T *last=std::unique(data,data+nbOfElements);
+ MCAuto<DataArrayType> ret=DataArrayType::New();
+ ret->alloc(std::distance(data,last),1);
+ std::copy(data,last,ret->getPointer());
+ return ret.retn();
+ }
+
+ /*!
+ * This method can be applied on allocated with one component DataArrayInt instance.
+ * This method keep elements only once by keeping the same order in \a this that is not expected to be sorted.
+ *
+ * \return a newly allocated array that contain the result of the unique operation applied on \a this.
+ *
+ * \throw if \a this is not allocated or if \a this has not exactly one component.
+ *
+ * \sa DataArrayInt::buildUnique
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::buildUniqueNotSorted() const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildUniqueNotSorted : only single component allowed !");
+ T minVal,maxVal;
+ this->getMinMaxValues(minVal,maxVal);
+ std::vector<bool> b(maxVal-minVal+1,false);
+ const T *ptBg(this->begin()),*endBg(this->end());
+ MCAuto<DataArrayType> ret(DataArrayType::New()); ret->alloc(0,1);
+ for(const T *pt=ptBg;pt!=endBg;pt++)
+ {
+ if(!b[*pt-minVal])
+ {
+ ret->pushBackSilent(*pt);
+ b[*pt-minVal]=true;
+ }
+ }
+ ret->copyStringInfoFrom(*this);
+ return ret.retn();
+ }
+
+ /*!
+ * Returns a new DataArrayInt which contains size of every of groups described by \a this
+ * "index" array. Such "index" array is returned for example by
+ * \ref MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity
+ * "MEDCouplingUMesh::buildDescendingConnectivity" and
+ * \ref MEDCoupling::MEDCouplingUMesh::getNodalConnectivityIndex
+ * "MEDCouplingUMesh::getNodalConnectivityIndex" etc.
+ * This method performs the reverse operation of DataArrayInt::computeOffsetsFull.
+ * \return DataArrayInt * - a new instance of DataArrayInt, whose number of tuples
+ * equals to \a this->getNumberOfComponents() - 1, and number of components is 1.
+ * The caller is to delete this array using decrRef() as it is no more needed.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ * \throw If \a this->getNumberOfTuples() < 2.
+ *
+ * \b Example: <br>
+ * - this contains [1,3,6,7,7,9,15]
+ * - result array contains [2,3,1,0,2,6],
+ * where 2 = 3 - 1, 3 = 6 - 3, 1 = 7 - 6 etc.
+ *
+ * \sa DataArrayInt::computeOffsetsFull
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::deltaShiftIndex() const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : only single component allowed !");
+ std::size_t nbOfElements=this->getNumberOfTuples();
+ if(nbOfElements<2)
+ throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : 1 tuple at least must be present in 'this' !");
+ const T *ptr=this->getConstPointer();
+ DataArrayType *ret=DataArrayType::New();
+ ret->alloc(nbOfElements-1,1);
+ T *out=ret->getPointer();
+ std::transform(ptr+1,ptr+nbOfElements,ptr,out,std::minus<T>());
+ return ret;
+ }
+
+ /*!
+ * Modifies \a this one-dimensional array so that value of each element \a x
+ * of \a this array (\a a) is computed as \f$ x_i = \sum_{j=0}^{i-1} a[ j ] \f$.
+ * Or: for each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number of tuples
+ * and components remains the same.<br>
+ * This method is useful for allToAllV in MPI with contiguous policy. This method
+ * differs from computeOffsetsFull() in that the number of tuples is \b not changed by
+ * this one.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ *
+ * \b Example: <br>
+ * - Before \a this contains [3,5,1,2,0,8]
+ * - After \a this contains [0,3,8,9,11,11]<br>
+ * Note that the last element 19 = 11 + 8 is missing because size of \a this
+ * array is retained and thus there is no space to store the last element.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::computeOffsets()
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsets : only single component allowed !");
+ std::size_t nbOfElements=this->getNumberOfTuples();
+ if(nbOfElements==0)
+ return ;
+ T *work=this->getPointer();
+ T tmp=work[0];
+ work[0]=0;
+ for(std::size_t i=1;i<nbOfElements;i++)
+ {
+ T tmp2=work[i];
+ work[i]=work[i-1]+tmp;
+ tmp=tmp2;
+ }
+ this->declareAsNew();
+ }
+
+ /*!
+ * Modifies \a this one-dimensional array so that value of each element \a x
+ * of \a this array (\a a) is computed as \f$ x_i = \sum_{j=0}^{i-1} a[ j ] \f$.
+ * Or: for each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number
+ * components remains the same and number of tuples is inceamented by one.<br>
+ * This method is useful for allToAllV in MPI with contiguous policy. This method
+ * differs from computeOffsets() in that the number of tuples is changed by this one.
+ * This method performs the reverse operation of DataArrayInt::deltaShiftIndex.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ *
+ * \b Example: <br>
+ * - Before \a this contains [3,5,1,2,0,8]
+ * - After \a this contains [0,3,8,9,11,11,19]<br>
+ * \sa DataArrayInt::deltaShiftIndex
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::computeOffsetsFull()
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsetsFull : only single component allowed !");
+ std::size_t nbOfElements=this->getNumberOfTuples();
+ T *ret=(T *)malloc((nbOfElements+1)*sizeof(T));
+ const T *work=this->getConstPointer();
+ ret[0]=0;
+ for(std::size_t i=0;i<nbOfElements;i++)
+ ret[i+1]=work[i]+ret[i];
+ this->useArray(ret,true,DeallocType::C_DEALLOC,nbOfElements+1,1);
+ this->declareAsNew();
+ }
+
+ /*!
+ * Returns two new DataArrayInt instances whose contents is computed from that of \a this and \a listOfIds arrays as follows.
+ * \a this is expected to be an offset format ( as returned by DataArrayInt::computeOffsetsFull ) that is to say with one component
+ * and ** sorted strictly increasingly **. \a listOfIds is expected to be sorted ascendingly (not strictly needed for \a listOfIds).
+ * This methods searches in \a this, considered as a set of contiguous \c this->getNumberOfComponents() ranges, all ids in \a listOfIds
+ * filling completely one of the ranges in \a this.
+ *
+ * \param [in] listOfIds a list of ids that has to be sorted ascendingly.
+ * \param [out] rangeIdsFetched the range ids fetched
+ * \param [out] idsInInputListThatFetch contains the list of ids in \a listOfIds that are \b fully included in a range in \a this. So
+ * \a idsInInputListThatFetch is a part of input \a listOfIds.
+ *
+ * \sa DataArrayInt::computeOffsetsFull
+ *
+ * \b Example: <br>
+ * - \a this : [0,3,7,9,15,18]
+ * - \a listOfIds contains [0,1,2,3,7,8,15,16,17]
+ * - \a rangeIdsFetched result array: [0,2,4]
+ * - \a idsInInputListThatFetch result array: [0,1,2,7,8,15,16,17]
+ * In this example id 3 in input \a listOfIds is alone so it do not appear in output \a idsInInputListThatFetch.
+ * <br>
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::findIdsRangesInListOfIds(const DataArrayType *listOfIds, DataArrayIdType *& rangeIdsFetched, DataArrayType *& idsInInputListThatFetch) const
+ {
+ if(!listOfIds)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : input list of ids is null !");
+ listOfIds->checkAllocated(); this->checkAllocated();
+ if(listOfIds->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : input list of ids must have exactly one component !");
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : this must have exactly one component !");
+ MCAuto<DataArrayIdType> ret0=DataArrayIdType::New(); ret0->alloc(0,1);
+ MCAuto<DataArrayType> ret1=DataArrayType::New(); ret1->alloc(0,1);
+ const T *tupPtr(listOfIds->begin()), *tupEnd(listOfIds->end());
+ const T *offBg(this->begin()),*offEnd(this->end()-1);
+ const T *offPtr(offBg);
+ while(tupPtr!=tupEnd && offPtr!=offEnd)
+ {
+ if(*tupPtr==*offPtr)
+ {
+ T i=offPtr[0];
+ while(i<offPtr[1] && *tupPtr==i && tupPtr!=tupEnd) { i++; tupPtr++; }
+ if(i==offPtr[1])
+ {
+ ret0->pushBackSilent(ToIdType(std::distance(offBg,offPtr)));
+ ret1->pushBackValsSilent(tupPtr-(offPtr[1]-offPtr[0]),tupPtr);
+ offPtr++;
+ }
+ }
+ else
+ { if(*tupPtr<*offPtr) tupPtr++; else offPtr++; }
+ }
+ rangeIdsFetched=ret0.retn();
+ idsInInputListThatFetch=ret1.retn();
+ }
+
+ /*!
+ * Returns a new DataArrayInt whose contents is computed from that of \a this and \a
+ * offsets arrays as follows. \a offsets is a one-dimensional array considered as an
+ * "index" array of a "iota" array, thus, whose each element gives an index of a group
+ * beginning within the "iota" array. And \a this is a one-dimensional array
+ * considered as a selector of groups described by \a offsets to include into the result array.
+ * \throw If \a offsets is NULL.
+ * \throw If \a offsets is not allocated.
+ * \throw If \a offsets->getNumberOfComponents() != 1.
+ * \throw If \a offsets is not monotonically increasing.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ * \throw If any element of \a this is not a valid index for \a offsets array.
+ *
+ * \b Example: <br>
+ * - \a this: [0,2,3]
+ * - \a offsets: [0,3,6,10,14,20]
+ * - result array: [0,1,2,6,7,8,9,10,11,12,13] == <br>
+ * \c range(0,3) + \c range(6,10) + \c range(10,14) ==<br>
+ * \c range( \a offsets[ \a this[0] ], offsets[ \a this[0]+1 ]) +
+ * \c range( \a offsets[ \a this[1] ], offsets[ \a this[1]+1 ]) +
+ * \c range( \a offsets[ \a this[2] ], offsets[ \a this[2]+1 ])
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::buildExplicitArrByRanges(const DataArrayType *offsets) const
+ {
+ if(!offsets)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : DataArrayInt pointer in input is NULL !");
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : only single component allowed !");
+ offsets->checkAllocated();
+ if(offsets->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : input array should have only single component !");
+ mcIdType othNbTuples=offsets->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=this->getNumberOfTuples();
+ T retNbOftuples=0;
+ const T *work=this->getConstPointer();
+ const T *offPtr=offsets->getConstPointer();
+ for(mcIdType i=0;i<nbOfTuples;i++)
+ {
+ T val=work[i];
+ if(val>=0 && val<othNbTuples)
+ {
+ T delta=offPtr[val+1]-offPtr[val];
+ if(delta>=0)
+ retNbOftuples+=delta;
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrByRanges : Tuple #" << val << " of offset array has a delta < 0 !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrByRanges : Tuple #" << i << " in this contains " << val;
+ oss << " whereas offsets array is of size " << othNbTuples+1 << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ MCAuto<DataArrayType> ret=DataArrayType::New();
+ ret->alloc(retNbOftuples,1);
+ T *retPtr=ret->getPointer();
+ for(mcIdType i=0;i<nbOfTuples;i++)
+ {
+ T val=work[i];
+ T start=offPtr[val];
+ T off=offPtr[val+1]-start;
+ for(T j=0;j<off;j++,retPtr++)
+ *retPtr=start+j;
+ }
+ return ret.retn();
+ }
+
+ /*!
+ * Returns a new DataArrayInt whose contents is computed using \a this that must be a
+ * scaled array (monotonically increasing).
+ from that of \a this and \a
+ * offsets arrays as follows. \a offsets is a one-dimensional array considered as an
+ * "index" array of a "iota" array, thus, whose each element gives an index of a group
+ * beginning within the "iota" array. And \a this is a one-dimensional array
+ * considered as a selector of groups described by \a offsets to include into the result array.
+ * \throw If \a is NULL.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ * \throw If \a this->getNumberOfTuples() == 0.
+ * \throw If \a this is not monotonically increasing.
+ * \throw If any element of ids in ( \a bg \a stop \a step ) points outside the scale in \a this.
+ *
+ * \b Example: <br>
+ * - \a bg , \a stop and \a step : (0,5,2)
+ * - \a this: [0,3,6,10,14,20]
+ * - result array: [0,0,0, 2,2,2,2, 4,4,4,4,4,4] == <br>
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::buildExplicitArrOfSliceOnScaledArr(T bg, T stop, T step) const
+ {
+ if(!this->isAllocated())
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : not allocated array !");
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : number of components is expected to be equal to one !");
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ if(nbOfTuples==0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : number of tuples must be != 0 !");
+ const T *ids(this->begin());
+ mcIdType nbOfEltsInSlc=DataArrayTools<T>::GetNumberOfItemGivenBESRelative(bg,stop,step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr");
+ T sz(0),pos(bg);
+ for(mcIdType i=0;i<nbOfEltsInSlc;i++,pos+=step)
+ {
+ if(pos>=0 && pos<nbOfTuples-1)
+ {
+ T delta(ids[pos+1]-ids[pos]);
+ sz+=delta;
+ if(delta<0)
+ {
+ std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrOfSliceOnScaledArr : At pos #" << i << " of input slice, value is " << pos << " and at this pos this is not monotonically increasing !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrOfSliceOnScaledArr : At pos #" << i << " of input slice, value is " << pos << " should be in [0," << nbOfTuples-1 << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ MCAuto<DataArrayType> ret(DataArrayType::New()); ret->alloc(sz,1);
+ T *retPtr(ret->getPointer());
+ pos=bg;
+ for(mcIdType i=0;i<nbOfEltsInSlc;i++,pos+=step)
+ {
+ T delta(ids[pos+1]-ids[pos]);
+ for(T j=0;j<delta;j++,retPtr++)
+ *retPtr=pos;
+ }
+ return ret.retn();
+ }
+
+ /*!
+ * Given in input ranges \a ranges, it returns a newly allocated DataArrayInt instance having one component and the same number of tuples than \a this.
+ * For each tuple at place **i** in \a this it tells which is the first range in \a ranges that contains value \c this->getIJ(i,0) and put the result
+ * in tuple **i** of returned DataArrayInt.
+ * If ranges overlapped (in theory it should not) this method do not detect it and always returns the first range.
+ *
+ * For example if \a this contains : [1,24,7,8,10,17] and \a ranges contains [(0,3),(3,8),(8,15),(15,22),(22,30)]
+ * The return DataArrayInt will contain : **[0,4,1,2,2,3]**
+ *
+ * \param [in] ranges typically come from output of MEDCouplingUMesh::ComputeRangesFromTypeDistribution. Each range is specified like this : 1st component is
+ * for lower value included and 2nd component is the upper value of corresponding range **excluded**.
+ * \throw If offsets is a null pointer or does not have 2 components or if \a this is not allocated or \a this do not have exactly one component. To finish an exception
+ * is thrown if no ranges in \a ranges contains value in \a this.
+ *
+ * \sa DataArrayInt::findIdInRangeForEachTuple
+ */
+ template <class T>
+ DataArrayIdType *DataArrayDiscrete<T>::findRangeIdForEachTuple(const DataArrayType *ranges) const
+ {
+ if(!ranges)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : null input pointer !");
+ if(ranges->getNumberOfComponents()!=2)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : input DataArrayInt instance should have 2 components !");
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : this should have only one component !");
+ mcIdType nbTuples(this->getNumberOfTuples());
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(nbTuples,1);
+ mcIdType nbOfRanges(ranges->getNumberOfTuples());
+ const T *rangesPtr=ranges->getConstPointer();
+ mcIdType *retPtr=ret->getPointer();
+ const T *inPtr=this->getConstPointer();
+ for(mcIdType i=0;i<nbTuples;i++,retPtr++)
+ {
+ T val=inPtr[i];
+ bool found=false;
+ for(mcIdType j=0;j<nbOfRanges && !found;j++)
+ if(val>=rangesPtr[2*j] && val<rangesPtr[2*j+1])
+ { *retPtr=j; found=true; }
+ if(found)
+ continue;
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::findRangeIdForEachTuple : tuple #" << i << " not found by any ranges !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ return ret.retn();
+ }
+
+ /*!
+ * Given in input ranges \a ranges, it returns a newly allocated DataArrayInt instance having one component and the same number of tuples than \a this.
+ * For each tuple at place **i** in \a this it tells which is the sub position of the first range in \a ranges that contains value \c this->getIJ(i,0) and put the result
+ * in tuple **i** of returned DataArrayInt.
+ * If ranges overlapped (in theory it should not) this method do not detect it and always returns the sub position of the first range.
+ *
+ * For example if \a this contains : [1,24,7,8,10,17] and \a ranges contains [(0,3),(3,8),(8,15),(15,22),(22,30)]
+ * The return DataArrayInt will contain : **[1,2,4,0,2,2]**
+ * This method is often called in pair with DataArrayInt::findRangeIdForEachTuple method.
+ *
+ * \param [in] ranges typically come from output of MEDCouplingUMesh::ComputeRangesFromTypeDistribution. Each range is specified like this : 1st component is
+ * for lower value included and 2nd component is the upper value of corresponding range **excluded**.
+ * \throw If offsets is a null pointer or does not have 2 components or if \a this is not allocated or \a this do not have exactly one component. To finish an exception
+ * is thrown if no ranges in \a ranges contains value in \a this.
+ * \sa DataArrayInt::findRangeIdForEachTuple
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::findIdInRangeForEachTuple(const DataArrayType *ranges) const
+ {
+ if(!ranges)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : null input pointer !");
+ if(ranges->getNumberOfComponents()!=2)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : input DataArrayInt instance should have 2 components !");
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : this should have only one component !");
+ mcIdType nbTuples=this->getNumberOfTuples();
+ MCAuto<DataArrayType> ret=DataArrayType::New(); ret->alloc(nbTuples,1);
+ mcIdType nbOfRanges=ranges->getNumberOfTuples();
+ const T *rangesPtr=ranges->getConstPointer();
+ T *retPtr=ret->getPointer();
+ const T *inPtr=this->getConstPointer();
+ for(mcIdType i=0;i<nbTuples;i++,retPtr++)
+ {
+ T val=inPtr[i];
+ bool found=false;
+ for(mcIdType j=0;j<nbOfRanges && !found;j++)
+ if(val>=rangesPtr[2*j] && val<rangesPtr[2*j+1])
+ { *retPtr=val-rangesPtr[2*j]; found=true; }
+ if(found)
+ continue;
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::findIdInRangeForEachTuple : tuple #" << i << " not found by any ranges !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ return ret.retn();
+ }
+
+ /*!
+ * \b WARNING this method is a \b non \a const \b method. This method works tuple by tuple. Each tuple is expected to be pairs (number of components must be equal to 2).
+ * This method rearrange each pair in \a this so that, tuple with id \b tid will be after the call \c this->getIJ(tid,0)==this->getIJ(tid-1,1) and \c this->getIJ(tid,1)==this->getIJ(tid+1,0).
+ * If it is impossible to reach such condition an exception will be thrown ! \b WARNING In case of throw \a this can be partially modified !
+ * If this method has correctly worked, \a this will be able to be considered as a linked list.
+ * This method does nothing if number of tuples is lower of equal to 1.
+ *
+ * This method is useful for users having an unstructured mesh having only SEG2 to rearrange internally the connectivity without any coordinates consideration.
+ *
+ * \sa MEDCouplingUMesh::orderConsecutiveCells1D, DataArrayInt::fromLinkedListOfPairToList
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::sortEachPairToMakeALinkedList()
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=2)
+ throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : Only works on DataArrayInt instance with nb of components equal to 2 !");
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ if(nbOfTuples<=1)
+ return ;
+ T *conn(this->getPointer());
+ for(mcIdType i=1;i<nbOfTuples;i++,conn+=2)
+ {
+ if(i>1)
+ {
+ if(conn[2]==conn[3])
+ {
+ std::ostringstream oss; oss << "DataArrayInt::sortEachPairToMakeALinkedList : In the tuple #" << i << " presence of a pair filled with same ids !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(conn[2]!=conn[1] && conn[3]==conn[1] && conn[2]!=conn[0])
+ std::swap(conn[2],conn[3]);
+ //not(conn[2]==conn[1] && conn[3]!=conn[1] && conn[3]!=conn[0])
+ if(conn[2]!=conn[1] || conn[3]==conn[1] || conn[3]==conn[0])
+ {
+ std::ostringstream oss; oss << "DataArrayInt::sortEachPairToMakeALinkedList : In the tuple #" << i << " something is invalid !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ else
+ {
+ if(conn[0]==conn[1] || conn[2]==conn[3])
+ throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : In the 2 first tuples presence of a pair filled with same ids !");
+ T tmp[4];
+ std::set<T> s;
+ s.insert(conn,conn+4);
+ if(s.size()!=3)
+ throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : This can't be considered as a linked list regarding 2 first tuples !");
+ if(std::count(conn,conn+4,conn[0])==2)
+ {
+ tmp[0]=conn[1];
+ tmp[1]=conn[0];
+ tmp[2]=conn[0];
+ if(conn[2]==conn[0])
+ { tmp[3]=conn[3]; }
+ else
+ { tmp[3]=conn[2];}
+ std::copy(tmp,tmp+4,conn);
+ }
+ else
+ {//here we are sure to have (std::count(conn,conn+4,conn[1])==2)
+ if(conn[1]==conn[3])
+ std::swap(conn[2],conn[3]);
+ }
+ }
+ }
+ }
+
+ /*!
+ * \a this is expected to be a correctly linked list of pairs.
+ *
+ * \sa DataArrayInt::sortEachPairToMakeALinkedList
+ */
+ template <class T>
+ MCAuto<typename Traits<T>::ArrayType> DataArrayDiscrete<T>::fromLinkedListOfPairToList() const
+ {
+ this->checkAllocated();
+ this->checkNbOfComps(2,"DataArrayInt::fromLinkedListOfPairToList : this is expected to have 2 components");
+ mcIdType nbTuples(this->getNumberOfTuples());
+ if(nbTuples<1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::fromLinkedListOfPairToList : no tuples in this ! Not a linked list !");
+ MCAuto<DataArrayType> ret(DataArrayType::New()); ret->alloc(nbTuples+1,1);
+ const T *thisPtr(this->begin());
+ T *retPtr(ret->getPointer());
+ retPtr[0]=thisPtr[0];
+ for(mcIdType i=0;i<nbTuples;i++)
+ {
+ retPtr[i+1]=thisPtr[2*i+1];
+ if(i<nbTuples-1)
+ if(thisPtr[2*i+1]!=thisPtr[2*(i+1)+0])
+ {
+ std::ostringstream oss; oss << "DataArrayInt::fromLinkedListOfPairToList : this is not a proper linked list of pair. The link is broken between tuple #" << i << " and tuple #" << i+1 << " ! Call sortEachPairToMakeALinkedList ?";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ }
+ return ret;
+ }
+
+ /*!
+ * This method returns all different values found in \a this. This method throws if \a this has not been allocated.
+ * But the number of components can be different from one.
+ * \return a newly allocated array (that should be dealt by the caller) containing different values in \a this.
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::getDifferentValues() const
+ {
+ this->checkAllocated();
+ std::set<T> ret;
+ ret.insert(this->begin(),this->end());
+ MCAuto<DataArrayType> ret2=DataArrayType::New();
+ ret2->alloc(ret.size(),1);
+ std::copy(ret.begin(),ret.end(),ret2->getPointer());
+ return ret2.retn();
+ }
+
+ /*!
+ * This method is a refinement of DataArrayInt::getDifferentValues because it returns not only different values in \a this but also, for each of
+ * them it tells which tuple id have this id.
+ * This method works only on arrays with one component (if it is not the case call DataArrayInt::rearrange(1) ).
+ * This method returns two arrays having same size.
+ * The instances of DataArrayInt in the returned vector have be specially allocated and computed by this method. Each of them should be dealt by the caller of this method.
+ * Example : if this is equal to [1,0,1,2,0,2,2,-3,2] -> differentIds=[-3,0,1,2] and returned array will be equal to [[7],[1,4],[0,2],[3,5,6,8]]
+ */
+ template <class T>
+ std::vector<DataArrayIdType *> DataArrayDiscrete<T>::partitionByDifferentValues(std::vector<T>& differentIds) const
+ {
+ this->checkAllocated();
+ if(this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::partitionByDifferentValues : this should have only one component !");
+ mcIdType id=0;
+ std::map<T,mcIdType> m,m2,m3;
+ for(const T *w=this->begin();w!=this->end();w++)
+ m[*w]++;
+ differentIds.resize(m.size());
+ std::vector<DataArrayIdType *> ret(m.size());
+ std::vector<mcIdType *> retPtr(m.size());
+ for(typename std::map<T,mcIdType>::const_iterator it=m.begin();it!=m.end();it++,id++)
+ {
+ m2[(*it).first]=id;
+ ret[id]=DataArrayIdType::New();
+ ret[id]->alloc((*it).second,1);
+ retPtr[id]=ret[id]->getPointer();
+ differentIds[id]=(*it).first;
+ }
+ id=0;
+ for(const T *w=this->begin();w!=this->end();w++,id++)
+ {
+ retPtr[m2[*w]][m3[*w]++]=id;
+ }
+ return ret;
+ }
+
+ /*!
+ * This method split ids in [0, \c this->getNumberOfTuples() ) using \a this array as a field of weight (>=0 each).
+ * The aim of this method is to return a set of \a nbOfSlices chunk of contiguous ids as balanced as possible.
+ *
+ * \param [in] nbOfSlices - number of slices expected.
+ * \return - a vector having a size equal to \a nbOfSlices giving the start (included) and the stop (excluded) of each chunks.
+ *
+ * \sa DataArray::GetSlice
+ * \throw If \a this is not allocated or not with exactly one component.
+ * \throw If an element in \a this if < 0.
+ */
+ template <class T>
+ std::vector< std::pair<mcIdType,mcIdType> > DataArrayDiscrete<T>::splitInBalancedSlices(mcIdType nbOfSlices) const
+ {
+ if(!this->isAllocated() || this->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : this array should have number of components equal to one and must be allocated !");
+ if(nbOfSlices<=0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : number of slices must be >= 1 !");
+ T sum(this->accumulate((std::size_t)0));
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ T sumPerSlc(sum/FromIdType<T>(nbOfSlices));
+ mcIdType pos(0);
+ const T *w(this->begin());
+ std::vector< std::pair<mcIdType,mcIdType> > ret(nbOfSlices);
+ for(mcIdType i=0;i<nbOfSlices;i++)
+ {
+ std::pair<mcIdType, mcIdType> p(pos,-1);
+ T locSum(0);
+ while(locSum<sumPerSlc && pos<nbOfTuples) { pos++; locSum+=*w++; }
+ if(i!=nbOfSlices-1)
+ p.second=pos;
+ else
+ p.second=nbOfTuples;
+ ret[i]=p;
+ }
+ return ret;
+ }
+
+ /*!
+ * Modify \a this array so that each value becomes a modulus of division of this value by
+ * a value of another DataArrayInt. There are 3 valid cases.
+ * 1. The arrays have same number of tuples and components. Then each value of
+ * \a this array is divided by the corresponding value of \a other one, i.e.:
+ * _a_ [ i, j ] %= _other_ [ i, j ].
+ * 2. The arrays have same number of tuples and \a other array has one component. Then
+ * _a_ [ i, j ] %= _other_ [ i, 0 ].
+ * 3. The arrays have same number of components and \a other array has one tuple. Then
+ * _a_ [ i, j ] %= _a2_ [ 0, j ].
+ *
+ * \warning No check of division by zero is performed!
+ * \param [in] other - a divisor array.
+ * \throw If \a other is NULL.
+ * \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
+ * \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
+ * \a other has number of both tuples and components not equal to 1.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::modulusEqual(const DataArrayType *other)
+ {
+ if(!other)
+ throw INTERP_KERNEL::Exception("DataArrayInt::modulusEqual : input DataArrayInt instance is NULL !");
+ const char *msg="Nb of tuples mismatch for DataArrayInt::modulusEqual !";
+ this->checkAllocated(); other->checkAllocated();
+ mcIdType nbOfTuple(this->getNumberOfTuples());
+ mcIdType nbOfTuple2(other->getNumberOfTuples());
+ std::size_t nbOfComp(this->getNumberOfComponents());
+ std::size_t nbOfComp2(other->getNumberOfComponents());
+ if(nbOfTuple==nbOfTuple2)
+ {
+ if(nbOfComp==nbOfComp2)
+ {
+ std::transform(this->begin(),this->end(),other->begin(),this->getPointer(),std::modulus<T>());
+ }
+ else if(nbOfComp2==1)
+ {
+ if(nbOfComp2==nbOfComp)
+ {
+ T *ptr=this->getPointer();
+ const T *ptrc=other->getConstPointer();
+ for(mcIdType i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::modulus<T>(),*ptrc++));
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else if(nbOfTuple2==1)
+ {
+ T *ptr=this->getPointer();
+ const T *ptrc=other->getConstPointer();
+ for(mcIdType i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::modulus<T>());
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ this->declareAsNew();
+ }
+
+ /*!
+ * Apply pow on values of another DataArrayInt to values of \a this one.
+ *
+ * \param [in] other - an array to pow to \a this one.
+ * \throw If \a other is NULL.
+ * \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples()
+ * \throw If \a this->getNumberOfComponents() != 1 or \a other->getNumberOfComponents() != 1
+ * \throw If there is a negative value in \a other.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::powEqual(const DataArrayType *other)
+ {
+ if(!other)
+ throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : input instance is null !");
+ mcIdType nbOfTuple=this->getNumberOfTuples();
+ mcIdType nbOfTuple2=other->getNumberOfTuples();
+ std::size_t nbOfComp=this->getNumberOfComponents();
+ std::size_t nbOfComp2=other->getNumberOfComponents();
+ if(nbOfTuple!=nbOfTuple2)
+ throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : number of tuples mismatches !");
+ if(nbOfComp!=1 || nbOfComp2!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : number of components of both arrays must be equal to 1 !");
+ T *ptr=this->getPointer();
+ const T *ptrc=other->begin();
+ for(mcIdType i=0;i<nbOfTuple;i++,ptrc++,ptr++)
+ {
+ if(*ptrc>=0)
+ {
+ T tmp=1;
+ for(T j=0;j<*ptrc;j++)
+ tmp*=*ptr;
+ *ptr=tmp;
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::powEqual : on tuple #" << i << " of other value is < 0 (" << *ptrc << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ this->declareAsNew();
+ }
+
+ ////////////////////////////////////
+ /*!
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ * Server side.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const
+ {
+ tinyInfo.resize(2);
+ if(this->isAllocated())
+ {
+ tinyInfo[0]=this->getNumberOfTuples();
+ tinyInfo[1]=ToIdType(this->getNumberOfComponents());
+ }
+ else
+ {
+ tinyInfo[0]=-1;
+ tinyInfo[1]=-1;
+ }
+ }
+
+ /*!
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ * Server side.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
+ {
+ if(this->isAllocated())
+ {
+ std::size_t nbOfCompo(this->getNumberOfComponents());
+ tinyInfo.resize(nbOfCompo+1);
+ tinyInfo[0]=this->getName();
+ for(std::size_t i=0;i<nbOfCompo;i++)
+ tinyInfo[i+1]=this->getInfoOnComponent(i);
+ }
+ else
+ {
+ tinyInfo.resize(1);
+ tinyInfo[0]=this->getName();
+ }
+ }
+
+ /*!
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ * This method returns if a feeding is needed.
+ */
+ template <class T>
+ bool DataArrayDiscrete<T>::resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI)
+ {
+ mcIdType nbOfTuple=tinyInfoI[0];
+ mcIdType nbOfComp=tinyInfoI[1];
+ if(nbOfTuple!=-1 || nbOfComp!=-1)
+ {
+ this->alloc(nbOfTuple,nbOfComp);
+ return true;
+ }
+ return false;
+ }
+
+ /*!
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ * This method returns if a feeding is needed.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<std::string>& tinyInfoS)
+ {
+ this->setName(tinyInfoS[0]);
+ if(this->isAllocated())
+ {
+ mcIdType nbOfCompo=tinyInfoI[1];
+ for(mcIdType i=0;i<nbOfCompo;i++)
+ this->setInfoOnComponent(i,tinyInfoS[i+1]);
+ }
+ }
+
+ ////////////////////////////////////
+
+ /*!
+ * Returns a new DataArrayInt that is the result of pow of two given arrays. There are 3
+ * valid cases.
+ *
+ * \param [in] a1 - an array to pow up.
+ * \param [in] a2 - another array to sum up.
+ * \return DataArrayInt * - the new instance of DataArrayInt.
+ * The caller is to delete this result array using decrRef() as it is no more
+ * needed.
+ * \throw If either \a a1 or \a a2 is NULL.
+ * \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples()
+ * \throw If \a a1->getNumberOfComponents() != 1 or \a a2->getNumberOfComponents() != 1.
+ * \throw If there is a negative value in \a a2.
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::Pow(const DataArrayType *a1, const DataArrayType *a2)
+ {
+ if(!a1 || !a2)
+ throw INTERP_KERNEL::Exception("DataArrayInt::Pow : at least one of input instances is null !");
+ mcIdType nbOfTuple=a1->getNumberOfTuples();
+ mcIdType nbOfTuple2=a2->getNumberOfTuples();
+ std::size_t nbOfComp=a1->getNumberOfComponents();
+ std::size_t nbOfComp2=a2->getNumberOfComponents();
+ if(nbOfTuple!=nbOfTuple2)
+ throw INTERP_KERNEL::Exception("DataArrayInt::Pow : number of tuples mismatches !");
+ if(nbOfComp!=1 || nbOfComp2!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::Pow : number of components of both arrays must be equal to 1 !");
+ MCAuto<DataArrayType> ret=DataArrayType::New(); ret->alloc(nbOfTuple,1);
+ const T *ptr1(a1->begin()),*ptr2(a2->begin());
+ T *ptr=ret->getPointer();
+ for(mcIdType i=0;i<nbOfTuple;i++,ptr1++,ptr2++,ptr++)
+ {
+ if(*ptr2>=0)
+ {
+ T tmp=1;
+ for(T j=0;j<*ptr2;j++)
+ tmp*=*ptr1;
+ *ptr=tmp;
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::Pow : on tuple #" << i << " of a2 value is < 0 (" << *ptr2 << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ return ret.retn();
+ }
+
+ /*!
+ * Returns a new DataArrayInt that is a modulus of two given arrays. There are 3
+ * valid cases.
+ * 1. The arrays have same number of tuples and components. Then each value of
+ * the result array (_a_) is a division of the corresponding values of \a a1 and
+ * \a a2, i.e.: _a_ [ i, j ] = _a1_ [ i, j ] % _a2_ [ i, j ].
+ * 2. The arrays have same number of tuples and one array, say _a2_, has one
+ * component. Then
+ * _a_ [ i, j ] = _a1_ [ i, j ] % _a2_ [ i, 0 ].
+ * 3. The arrays have same number of components and one array, say _a2_, has one
+ * tuple. Then
+ * _a_ [ i, j ] = _a1_ [ i, j ] % _a2_ [ 0, j ].
+ *
+ * Info on components is copied either from the first array (in the first case) or from
+ * the array with maximal number of elements (getNbOfElems()).
+ * \warning No check of division by zero is performed!
+ * \param [in] a1 - a dividend array.
+ * \param [in] a2 - a divisor array.
+ * \return DataArrayInt * - the new instance of DataArrayInt.
+ * The caller is to delete this result array using decrRef() as it is no more
+ * needed.
+ * \throw If either \a a1 or \a a2 is NULL.
+ * \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
+ * \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
+ * none of them has number of tuples or components equal to 1.
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::Modulus(const DataArrayType *a1, const DataArrayType *a2)
+ {
+ if(!a1 || !a2)
+ throw INTERP_KERNEL::Exception("DataArrayInt::Modulus : input DataArrayInt instance is NULL !");
+ mcIdType nbOfTuple1(a1->getNumberOfTuples());
+ mcIdType nbOfTuple2(a2->getNumberOfTuples());
+ std::size_t nbOfComp1(a1->getNumberOfComponents());
+ std::size_t nbOfComp2(a2->getNumberOfComponents());
+ if(nbOfTuple2==nbOfTuple1)
+ {
+ if(nbOfComp1==nbOfComp2)
+ {
+ MCAuto<DataArrayType> ret=DataArrayType::New();
+ ret->alloc(nbOfTuple2,nbOfComp1);
+ std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::modulus<T>());
+ ret->copyStringInfoFrom(*a1);
+ return ret.retn();
+ }
+ else if(nbOfComp2==1)
+ {
+ MCAuto<DataArrayType> ret=DataArrayType::New();
+ ret->alloc(nbOfTuple1,nbOfComp1);
+ const T *a2Ptr=a2->getConstPointer();
+ const T *a1Ptr=a1->getConstPointer();
+ T *res=ret->getPointer();
+ for(mcIdType i=0;i<nbOfTuple1;i++)
+ res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind2nd(std::modulus<T>(),a2Ptr[i]));
+ ret->copyStringInfoFrom(*a1);
+ return ret.retn();
+ }
+ else
+ {
+ a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Modulus !");
+ return 0;
+ }
+ }
+ else if(nbOfTuple2==1)
+ {
+ a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Modulus !");
+ MCAuto<DataArrayType> ret=DataArrayType::New();
+ ret->alloc(nbOfTuple1,nbOfComp1);
+ const T *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer();
+ T *pt=ret->getPointer();
+ for(mcIdType i=0;i<nbOfTuple1;i++)
+ pt=std::transform(a1ptr+i*nbOfComp1,a1ptr+(i+1)*nbOfComp1,a2ptr,pt,std::modulus<T>());
+ ret->copyStringInfoFrom(*a1);
+ return ret.retn();
+ }
+ else
+ {
+ a1->checkNbOfTuples(nbOfTuple2,"Nb of tuples mismatch for array Modulus !");//will always throw an exception
+ return 0;
+ }
+ }
+
+ /*!
+ * This method tries to find the permutation to apply to the first input \a ids1 to obtain the same array (without considering strings information) the second
+ * input array \a ids2.
+ * \a ids1 and \a ids2 are expected to be both a list of ids (both with number of components equal to one) not sorted and with values that can be negative.
+ * This method will throw an exception is no such permutation array can be obtained. It is typically the case if there is some ids in \a ids1 not in \a ids2 or
+ * inversely.
+ * In case of success both assertion will be true (no throw) :
+ * \c ids1->renumber(ret)->isEqual(ids2) where \a ret is the return of this method.
+ * \c ret->transformWithIndArr(ids2)->isEqual(ids1)
+ *
+ * \b Example:
+ * - \a ids1 : [3,1,103,4,6,10,-7,205]
+ * - \a ids2 : [-7,1,205,10,6,3,103,4]
+ * - \a return is : [5,1,6,7,4,3,0,2] because ids2[5]==ids1[0], ids2[1]==ids1[1], ids2[6]==ids1[2]...
+ *
+ * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ * array using decrRef() as it is no more needed.
+ * \throw If either ids1 or ids2 is null not allocated or not with one components.
+ *
+ * \sa DataArrayInt::findIdForEach
+ */
+ template<class T>
+ DataArrayIdType *DataArrayDiscrete<T>::FindPermutationFromFirstToSecond(const DataArrayType *ids1, const DataArrayType *ids2)
+ {
+ if(!ids1 || !ids2)
+ throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two input arrays must be not null !");
+ if(!ids1->isAllocated() || !ids2->isAllocated())
+ throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two input arrays must be allocated !");
+ if(ids1->getNumberOfComponents()!=1 || ids2->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two input arrays have exactly one component !");
+ if(ids1->getNumberOfTuples()!=ids2->getNumberOfTuples())
+ {
+ std::ostringstream oss; oss << "DataArrayInt::FindPermutationFromFirstToSecond : first array has " << ids1->getNumberOfTuples() << " tuples and the second one " << ids2->getNumberOfTuples() << " tuples ! No chance to find a permutation between the 2 arrays !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ MCAuto<DataArrayType> c1(ids1->deepCopy());
+ MCAuto<DataArrayType> c2(ids2->deepCopy());
+ c1->sort(true); c2->sort(true);
+ if(!c1->isEqualWithoutConsideringStr(*c2))
+ throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two arrays are not lying on same ids ! Impossible to find a permutation between the 2 arrays !");
+ MCAuto<DataArrayIdType> p1=ids1->checkAndPreparePermutation();
+ MCAuto<DataArrayIdType> p2=ids2->checkAndPreparePermutation();
+ p2=p2->invertArrayO2N2N2O(p2->getNumberOfTuples());
+ p2=p2->selectByTupleIdSafe(p1->begin(),p1->end());
+ return p2.retn();
+ }
+
+ /*!
+ * Returns a C array which is a renumbering map in "Old to New" mode for the input array.
+ * This map, if applied to \a start array, would make it sorted. For example, if
+ * \a start array contents are [9,10,0,6,4,11,3,7] then the contents of the result array is
+ * [5,6,0,3,2,7,1,4].
+ * \param [in] start - pointer to the first element of the array for which the
+ * permutation map is computed.
+ * \param [in] end - pointer specifying the end of the array \a start, so that
+ * the last value of \a start is \a end[ -1 ].
+ * \return mcIdType * - the result permutation array that the caller is to delete as it is no
+ * more needed.
+ * \throw If there are equal values in the input array.
+ */
+ template<class T>
+ mcIdType *DataArrayDiscrete<T>::CheckAndPreparePermutation(const T *start, const T *end)
+ {
+ std::size_t sz=std::distance(start,end);
+ mcIdType *ret=(mcIdType *)malloc(sz*sizeof(mcIdType));
+ T *work=new T[sz];
+ std::copy(start,end,work);
+ std::sort(work,work+sz);
+ if(std::unique(work,work+sz)!=work+sz)
+ {
+ delete [] work;
+ free(ret);
+ throw INTERP_KERNEL::Exception("Some elements are equals in the specified array !");
+ }
+ std::map<T,mcIdType> m;
+ for(T *workPt=work;workPt!=work+sz;workPt++)
+ m[*workPt]=ToIdType(std::distance(work,workPt));
+ mcIdType *iter2=ret;
+ for(const T *iter=start;iter!=end;iter++,iter2++)
+ *iter2=m[*iter];
+ delete [] work;
+ return ret;
+ }
+
+ /*!
+ * Returns a new DataArrayInt by concatenating two given arrays, so that (1) the number
+ * of tuples in the result array is <em> a1->getNumberOfTuples() + a2->getNumberOfTuples() -
+ * offsetA2</em> and (2)
+ * the number of component in the result array is same as that of each of given arrays.
+ * First \a offsetA2 tuples of \a a2 are skipped and thus are missing from the result array.
+ * Info on components is copied from the first of the given arrays. Number of components
+ * in the given arrays must be the same.
+ * \param [in] a1 - an array to include in the result array.
+ * \param [in] a2 - another array to include in the result array.
+ * \param [in] offsetA2 - number of tuples of \a a2 to skip.
+ * \return DataArrayInt * - the new instance of DataArrayInt.
+ * The caller is to delete this result array using decrRef() as it is no more
+ * needed.
+ * \throw If either \a a1 or \a a2 is NULL.
+ * \throw If \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents().
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::Aggregate(const DataArrayType *a1, const DataArrayType *a2, T offsetA2)
+ {
+ if(!a1 || !a2)
+ throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : input DataArrayInt instance is NULL !");
+ std::size_t nbOfComp(a1->getNumberOfComponents());
+ if(nbOfComp!=a2->getNumberOfComponents())
+ throw INTERP_KERNEL::Exception("Nb of components mismatch for array Aggregation !");
+ mcIdType nbOfTuple1(a1->getNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples());
+ MCAuto<DataArrayType> ret(DataArrayType::New());
+ ret->alloc(nbOfTuple1+nbOfTuple2-offsetA2,nbOfComp);
+ T *pt=std::copy(a1->begin(),a1->end(),ret->getPointer());
+ std::copy(a2->getConstPointer()+offsetA2*nbOfComp,a2->getConstPointer()+nbOfTuple2*nbOfComp,pt);
+ ret->copyStringInfoFrom(*a1);
+ return ret.retn();
+ }
+
+ /*!
+ * Returns a new DataArrayInt by concatenating all given arrays, so that (1) the number
+ * of tuples in the result array is a sum of the number of tuples of given arrays and (2)
+ * the number of component in the result array is same as that of each of given arrays.
+ * Info on components is copied from the first of the given arrays. Number of components
+ * in the given arrays must be the same.
+ * If the number of non null of elements in \a arr is equal to one the returned object is a copy of it
+ * not the object itself.
+ * \param [in] arr - a sequence of arrays to include in the result array.
+ * \return DataArrayInt * - the new instance of DataArrayInt.
+ * The caller is to delete this result array using decrRef() as it is no more
+ * needed.
+ * \throw If all arrays within \a arr are NULL.
+ * \throw If getNumberOfComponents() of arrays within \a arr.
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::Aggregate(const std::vector<const DataArrayType *>& arr)
+ {
+ std::vector<const DataArrayType *> a;
+ for(typename std::vector<const DataArrayType *>::const_iterator it4=arr.begin();it4!=arr.end();it4++)
+ if(*it4)
+ a.push_back(*it4);
+ if(a.empty())
+ throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : input list must be NON EMPTY !");
+ typename std::vector<const DataArrayType *>::const_iterator it=a.begin();
+ std::size_t nbOfComp((*it)->getNumberOfComponents());
+ mcIdType nbt((*it++)->getNumberOfTuples());
+ for(;it!=a.end();it++)
+ {
+ if((*it)->getNumberOfComponents()!=nbOfComp)
+ throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : Nb of components mismatch for array aggregation !");
+ nbt+=(*it)->getNumberOfTuples();
+ }
+ MCAuto<DataArrayType> ret=DataArrayType::New();
+ ret->alloc(nbt,nbOfComp);
+ T *pt=ret->getPointer();
+ for(it=a.begin();it!=a.end();it++)
+ pt=std::copy((*it)->getConstPointer(),(*it)->getConstPointer()+(*it)->getNbOfElems(),pt);
+ ret->copyStringInfoFrom(*(a[0]));
+ return ret.retn();
+ }
+
+ /*!
+ * This method takes as input a list of DataArrayInt instances \a arrs that represent each a packed index arrays.
+ * A packed index array is an allocated array with one component, and at least one tuple. The first element
+ * of each array in \a arrs must be 0. Each array in \a arrs is expected to be increasingly monotonic.
+ * This method is useful for users that want to aggregate a pair of DataArrayInt representing an indexed data (typically nodal connectivity index in unstructured meshes.
+ *
+ * \return DataArrayInt * - a new object to be managed by the caller.
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::AggregateIndexes(const std::vector<const DataArrayType *>& arrs)
+ {
+ mcIdType retSz=1;
+ for(typename std::vector<const DataArrayType *>::const_iterator it4=arrs.begin();it4!=arrs.end();it4++)
+ {
+ if(*it4)
+ {
+ (*it4)->checkAllocated();
+ if((*it4)->getNumberOfComponents()!=1)
+ {
+ std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with nb of compo != 1 at pos " << std::distance(arrs.begin(),it4) << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ mcIdType nbTupl((*it4)->getNumberOfTuples());
+ if(nbTupl<1)
+ {
+ std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with nb of tuples < 1 at pos " << std::distance(arrs.begin(),it4) << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if((*it4)->front()!=0)
+ {
+ std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with front value != 0 at pos " << std::distance(arrs.begin(),it4) << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ retSz+=nbTupl-1;
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a null instance at pos " << std::distance(arrs.begin(),it4) << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ if(arrs.empty())
+ throw INTERP_KERNEL::Exception("DataArrayInt::AggregateIndexes : input list must be NON EMPTY !");
+ MCAuto<DataArrayType> ret=DataArrayType::New();
+ ret->alloc(retSz,1);
+ T *pt=ret->getPointer(); *pt++=0;
+ for(typename std::vector<const DataArrayType *>::const_iterator it=arrs.begin();it!=arrs.end();it++)
+ pt=std::transform((*it)->begin()+1,(*it)->end(),pt,std::bind2nd(std::plus<T>(),pt[-1]));
+ ret->copyStringInfoFrom(*(arrs[0]));
+ return ret.retn();
+ }
+
+ /*!
+ * Returns a new DataArrayInt which contains all elements of given one-dimensional
+ * arrays. The result array does not contain any duplicates and its values
+ * are sorted in ascending order.
+ * \param [in] arr - sequence of DataArrayInt's to unite.
+ * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ * array using decrRef() as it is no more needed.
+ * \throw If any \a arr[i] is not allocated.
+ * \throw If \a arr[i]->getNumberOfComponents() != 1.
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::BuildUnion(const std::vector<const DataArrayType *>& arr)
+ {
+ std::vector<const DataArrayType *> a;
+ for(typename std::vector<const DataArrayType *>::const_iterator it4=arr.begin();it4!=arr.end();it4++)
+ if(*it4)
+ a.push_back(*it4);
+ for(typename std::vector<const DataArrayType *>::const_iterator it=a.begin();it!=a.end();it++)
+ {
+ (*it)->checkAllocated();
+ if((*it)->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::BuildUnion : only single component allowed !");
+ }
+ //
+ std::set<T> r;
+ for(typename std::vector<const DataArrayType *>::const_iterator it=a.begin();it!=a.end();it++)
+ {
+ const T *pt=(*it)->getConstPointer();
+ mcIdType nbOfTuples((*it)->getNumberOfTuples());
+ r.insert(pt,pt+nbOfTuples);
+ }
+ DataArrayType *ret=DataArrayType::New();
+ ret->alloc(r.size(),1);
+ std::copy(r.begin(),r.end(),ret->getPointer());
+ return ret;
+ }
+
+ /*!
+ * Returns a new DataArrayInt which contains elements present in each of given one-dimensional
+ * arrays. The result array does not contain any duplicates and its values
+ * are sorted in ascending order.
+ * \param [in] arr - sequence of DataArrayInt's to intersect.
+ * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ * array using decrRef() as it is no more needed.
+ * \throw If any \a arr[i] is not allocated.
+ * \throw If \a arr[i]->getNumberOfComponents() != 1.
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::BuildIntersection(const std::vector<const DataArrayType *>& arr)
+ {
+ std::vector<const DataArrayType *> a;
+ for(typename std::vector<const DataArrayType *>::const_iterator it4=arr.begin();it4!=arr.end();it4++)
+ if(*it4)
+ a.push_back(*it4);
+ for(typename std::vector<const DataArrayType *>::const_iterator it=a.begin();it!=a.end();it++)
+ {
+ (*it)->checkAllocated();
+ if((*it)->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::BuildIntersection : only single component allowed !");
+ }
+ //
+ std::set<T> r;
+ for(typename std::vector<const DataArrayType *>::const_iterator it=a.begin();it!=a.end();it++)
+ {
+ const T *pt=(*it)->getConstPointer();
+ mcIdType nbOfTuples((*it)->getNumberOfTuples());
+ std::set<T> s1(pt,pt+nbOfTuples);
+ if(it!=a.begin())
+ {
+ std::set<T> r2;
+ std::set_intersection(r.begin(),r.end(),s1.begin(),s1.end(),inserter(r2,r2.end()));
+ r=r2;
+ }
+ else
+ r=s1;
+ }
+ DataArrayType *ret(DataArrayType::New());
+ ret->alloc(r.size(),1);
+ std::copy(r.begin(),r.end(),ret->getPointer());
+ return ret;
+ }
+
+ /*!
+ * This method allows to put a vector of vector of integer into a more compact data structure (skyline).
+ * This method is not available into python because no available optimized data structure available to map std::vector< std::vector<mcIdType> >.
+ *
+ * \param [in] v the input data structure to be translate into skyline format.
+ * \param [out] data the first element of the skyline format. The user is expected to deal with newly allocated array.
+ * \param [out] dataIndex the second element of the skyline format.
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::PutIntoToSkylineFrmt(const std::vector< std::vector<T> >& v, DataArrayType *& data, DataArrayIdType *& dataIndex)
+ {
+ std::size_t sz(v.size());
+ MCAuto<DataArrayType> retDat(DataArrayType::New());
+ MCAuto<DataArrayIdType> retIdx(DataArrayIdType::New());
+ retIdx->alloc(sz+1,1);
+ mcIdType *ptid(retIdx->getPointer()); *ptid=0;
+ for(std::size_t i=0;i<sz;i++,ptid++)
+ ptid[1]=ptid[0]+ToIdType(v[i].size());
+ retDat->alloc(retIdx->back(),1);
+ T *pt=retDat->getPointer();
+ for(std::size_t i=0;i<sz;i++)
+ pt=std::copy(v[i].begin(),v[i].end(),pt);
+ data=retDat.retn(); dataIndex=retIdx.retn();
+ }
+
+ /*!
+ * This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn
+ * (\ref numbering-indirect).
+ * This method returns the result of the extraction ( specified by a set of ids in [\b idsOfSelectBg , \b idsOfSelectEnd ) ).
+ * The selection of extraction is done standardly in new2old format.
+ * This method returns indexed arrays (\ref numbering-indirect) using 2 arrays (arrOut,arrIndexOut).
+ *
+ * \param [in] idsOfSelectBg begin of set of ids of the input extraction (included)
+ * \param [in] idsOfSelectEnd end of set of ids of the input extraction (excluded)
+ * \param [in] arrIn arr origin array from which the extraction will be done.
+ * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn
+ * \param [out] arrOut the resulting array
+ * \param [out] arrIndexOut the index array of the resulting array \b arrOut
+ * \sa DataArrayInt::ExtractFromIndexedArraysSlice
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::ExtractFromIndexedArrays(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd,
+ const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn,
+ DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut)
+ {
+ if(!arrIn || !arrIndxIn)
+ throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : input pointer is NULL !");
+ arrIn->checkAllocated(); arrIndxIn->checkAllocated();
+ if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : input arrays must have exactly one component !");
+ std::size_t sz=std::distance(idsOfSelectBg,idsOfSelectEnd);
+ const T *arrInPtr=arrIn->begin();
+ const mcIdType *arrIndxPtr=arrIndxIn->begin();
+ mcIdType nbOfGrps=arrIndxIn->getNumberOfTuples()-1;
+ if(nbOfGrps<0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !");
+ mcIdType maxSizeOfArr(arrIn->getNumberOfTuples());
+ MCAuto<DataArrayType> arro=DataArrayType::New();
+ MCAuto<DataArrayIdType> arrIo=DataArrayIdType::New();
+ arrIo->alloc(sz+1,1);
+ const mcIdType *idsIt=idsOfSelectBg;
+ mcIdType *work=arrIo->getPointer();
+ *work++=0;
+ mcIdType lgth=0;
+ for(std::size_t i=0;i<sz;i++,work++,idsIt++)
+ {
+ if(*idsIt>=0 && *idsIt<nbOfGrps)
+ lgth+=arrIndxPtr[*idsIt+1]-arrIndxPtr[*idsIt];
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArrays : id located on pos #" << i << " value is " << *idsIt << " ! Must be in [0," << nbOfGrps << ") !";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ if(lgth>=work[-1])
+ *work=lgth;
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArrays : id located on pos #" << i << " value is " << *idsIt << " and at this pos arrIndxIn[" << *idsIt;
+ oss << "+1]-arrIndxIn[" << *idsIt << "] < 0 ! The input index array is bugged !";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ }
+ arro->alloc(lgth,1);
+ T *data=arro->getPointer();
+ idsIt=idsOfSelectBg;
+ for(std::size_t i=0;i<sz;i++,idsIt++)
+ {
+ if(arrIndxPtr[*idsIt]>=0 && arrIndxPtr[*idsIt+1]<=maxSizeOfArr)
+ data=std::copy(arrInPtr+arrIndxPtr[*idsIt],arrInPtr+arrIndxPtr[*idsIt+1],data);
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArrays : id located on pos #" << i << " value is " << *idsIt << " arrIndx[" << *idsIt << "] must be >= 0 and arrIndx[";
+ oss << *idsIt << "+1] <= " << maxSizeOfArr << " (the size of arrIn)!";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ }
+ arrOut=arro.retn();
+ arrIndexOut=arrIo.retn();
+ }
+
+ /*!
+ * This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn
+ * (\ref numbering-indirect).
+ * This method returns the result of the extraction ( specified by a set of ids with a slice given by \a idsOfSelectStart, \a idsOfSelectStop and \a idsOfSelectStep ).
+ * The selection of extraction is done standardly in new2old format.
+ * This method returns indexed arrays (\ref numbering-indirect) using 2 arrays (arrOut,arrIndexOut).
+ *
+ * \param [in] idsOfSelectStart begin of set of ids of the input extraction (included)
+ * \param [in] idsOfSelectStop end of set of ids of the input extraction (excluded)
+ * \param [in] idsOfSelectStep
+ * \param [in] arrIn arr origin array from which the extraction will be done.
+ * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn
+ * \param [out] arrOut the resulting array
+ * \param [out] arrIndexOut the index array of the resulting array \b arrOut
+ * \sa DataArrayInt::ExtractFromIndexedArrays
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::ExtractFromIndexedArraysSlice(mcIdType idsOfSelectStart, mcIdType idsOfSelectStop, mcIdType idsOfSelectStep,
+ const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn,
+ DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut)
+ {
+ if(!arrIn || !arrIndxIn)
+ throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : input pointer is NULL !");
+ arrIn->checkAllocated(); arrIndxIn->checkAllocated();
+ if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : input arrays must have exactly one component !");
+ mcIdType sz=DataArray::GetNumberOfItemGivenBESRelative(idsOfSelectStart,idsOfSelectStop,idsOfSelectStep,"MEDCouplingUMesh::ExtractFromIndexedArraysSlice : Input slice ");
+ const T *arrInPtr=arrIn->begin();
+ const mcIdType *arrIndxPtr=arrIndxIn->begin();
+ mcIdType nbOfGrps=arrIndxIn->getNumberOfTuples()-1;
+ if(nbOfGrps<0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !");
+ mcIdType maxSizeOfArr(arrIn->getNumberOfTuples());
+ MCAuto<DataArrayType> arro=DataArrayType::New();
+ MCAuto<DataArrayIdType> arrIo=DataArrayIdType::New();
+ arrIo->alloc(sz+1,1);
+ mcIdType idsIt=idsOfSelectStart;
+ mcIdType *work=arrIo->getPointer();
+ *work++=0;
+ mcIdType lgth=0;
+ for(mcIdType i=0;i<sz;i++,work++,idsIt+=idsOfSelectStep)
+ {
+ if(idsIt>=0 && idsIt<nbOfGrps)
+ lgth+=arrIndxPtr[idsIt+1]-arrIndxPtr[idsIt];
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " ! Must be in [0," << nbOfGrps << ") !";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ if(lgth>=work[-1])
+ *work=lgth;
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " and at this pos arrIndxIn[" << idsIt;
+ oss << "+1]-arrIndxIn[" << idsIt << "] < 0 ! The input index array is bugged !";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ }
+ arro->alloc(lgth,1);
+ T *data=arro->getPointer();
+ idsIt=idsOfSelectStart;
+ for(mcIdType i=0;i<sz;i++,idsIt+=idsOfSelectStep)
+ {
+ if(arrIndxPtr[idsIt]>=0 && arrIndxPtr[idsIt+1]<=maxSizeOfArr)
+ data=std::copy(arrInPtr+arrIndxPtr[idsIt],arrInPtr+arrIndxPtr[idsIt+1],data);
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " arrIndx[" << idsIt << "] must be >= 0 and arrIndx[";
+ oss << idsIt << "+1] <= " << maxSizeOfArr << " (the size of arrIn)!";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ }
+ arrOut=arro.retn();
+ arrIndexOut=arrIo.retn();
+ }
+
+ /*!
+ * This method works on an input pair (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn.
+ * This method builds an output pair (\b arrOut,\b arrIndexOut) that is a copy from \b arrIn for all cell ids \b not \b in [ \b idsOfSelectBg , \b idsOfSelectEnd ) and for
+ * cellIds \b in [ \b idsOfSelectBg , \b idsOfSelectEnd ) a copy coming from the corresponding values in input pair (\b srcArr, \b srcArrIndex).
+ * This method is an generalization of MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx that performs the same thing but by without building explicitly a result output arrays.
+ *
+ * \param [in] idsOfSelectBg begin of set of ids of the input extraction (included)
+ * \param [in] idsOfSelectEnd end of set of ids of the input extraction (excluded)
+ * \param [in] arrIn arr origin array from which the extraction will be done.
+ * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn
+ * \param [in] srcArr input array that will be used as source of copy for ids in [ \b idsOfSelectBg, \b idsOfSelectEnd )
+ * \param [in] srcArrIndex index array of \b srcArr
+ * \param [out] arrOut the resulting array
+ * \param [out] arrIndexOut the index array of the resulting array \b arrOut
+ *
+ * \sa DataArrayInt::SetPartOfIndexedArraysSameIdx
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::SetPartOfIndexedArrays(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd,
+ const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn,
+ const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex,
+ DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut)
+ {
+ if(arrIn==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArrays : presence of null pointer in input parameter !");
+ MCAuto<DataArrayType> arro=DataArrayType::New();
+ MCAuto<DataArrayIdType> arrIo=DataArrayIdType::New();
+ mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ std::vector<bool> v(nbOfTuples,true);
+ mcIdType offset=0;
+ const mcIdType *arrIndxInPtr=arrIndxIn->begin();
+ const mcIdType *srcArrIndexPtr=srcArrIndex->begin();
+ for(const mcIdType *it=idsOfSelectBg;it!=idsOfSelectEnd;it++,srcArrIndexPtr++)
+ {
+ if(*it>=0 && *it<nbOfTuples)
+ {
+ v[*it]=false;
+ offset+=(srcArrIndexPtr[1]-srcArrIndexPtr[0])-(arrIndxInPtr[*it+1]-arrIndxInPtr[*it]);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::SetPartOfIndexedArrays : On pos #" << std::distance(idsOfSelectBg,it) << " value is " << *it << " not in [0," << nbOfTuples << ") !";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ }
+ srcArrIndexPtr=srcArrIndex->begin();
+ arrIo->alloc(nbOfTuples+1,1);
+ arro->alloc(arrIn->getNumberOfTuples()+offset,1);
+ const T *arrInPtr=arrIn->begin();
+ const T *srcArrPtr=srcArr->begin();
+ mcIdType *arrIoPtr=arrIo->getPointer(); *arrIoPtr++=0;
+ T *arroPtr=arro->getPointer();
+ for(mcIdType ii=0;ii<nbOfTuples;ii++,arrIoPtr++)
+ {
+ if(v[ii])
+ {
+ arroPtr=std::copy(arrInPtr+arrIndxInPtr[ii],arrInPtr+arrIndxInPtr[ii+1],arroPtr);
+ *arrIoPtr=arrIoPtr[-1]+(arrIndxInPtr[ii+1]-arrIndxInPtr[ii]);
+ }
+ else
+ {
+ std::size_t pos=std::distance(idsOfSelectBg,std::find(idsOfSelectBg,idsOfSelectEnd,ii));
+ arroPtr=std::copy(srcArrPtr+srcArrIndexPtr[pos],srcArrPtr+srcArrIndexPtr[pos+1],arroPtr);
+ *arrIoPtr=arrIoPtr[-1]+(srcArrIndexPtr[pos+1]-srcArrIndexPtr[pos]);
+ }
+ }
+ arrOut=arro.retn();
+ arrIndexOut=arrIo.retn();
+ }
+
+ /*!
+ * This method works on an input pair (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn.
+ * This method builds an output pair (\b arrOut,\b arrIndexOut) that is a copy from \b arrIn for all cell ids \b not \b in [ \b idsOfSelectBg , \b idsOfSelectEnd ) and for
+ * cellIds \b in [\b idsOfSelectBg, \b idsOfSelectEnd) a copy coming from the corresponding values in input pair (\b srcArr, \b srcArrIndex).
+ * This method is an generalization of DataArrayInt::SetPartOfIndexedArraysSameIdx that performs the same thing but by without building explicitly a result output arrays.
+ *
+ * \param [in] start begin of set of ids of the input extraction (included)
+ * \param [in] end end of set of ids of the input extraction (excluded)
+ * \param [in] step step of the set of ids in range mode.
+ * \param [in] arrIn arr origin array from which the extraction will be done.
+ * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn
+ * \param [in] srcArr input array that will be used as source of copy for ids in [\b idsOfSelectBg, \b idsOfSelectEnd)
+ * \param [in] srcArrIndex index array of \b srcArr
+ * \param [out] arrOut the resulting array
+ * \param [out] arrIndexOut the index array of the resulting array \b arrOut
+ *
+ * \sa DataArrayInt::SetPartOfIndexedArraysSameIdx DataArrayInt::SetPartOfIndexedArrays
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::SetPartOfIndexedArraysSlice(mcIdType start, mcIdType end, mcIdType step,
+ const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn,
+ const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex,
+ DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut)
+ {
+ if(arrIn==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSlice : presence of null pointer in input parameter !");
+ MCAuto<DataArrayType> arro=DataArrayType::New();
+ MCAuto<DataArrayIdType> arrIo=DataArrayIdType::New();
+ mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType offset=0;
+ const mcIdType *arrIndxInPtr=arrIndxIn->begin();
+ const mcIdType *srcArrIndexPtr=srcArrIndex->begin();
+ mcIdType nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSlice : ");
+ mcIdType it=start;
+ for(mcIdType i=0;i<nbOfElemsToSet;i++,srcArrIndexPtr++,it+=step)
+ {
+ if(it>=0 && it<nbOfTuples)
+ offset+=(srcArrIndexPtr[1]-srcArrIndexPtr[0])-(arrIndxInPtr[it+1]-arrIndxInPtr[it]);
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::SetPartOfIndexedArraysSlice : On pos #" << i << " value is " << it << " not in [0," << nbOfTuples << ") !";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ }
+ srcArrIndexPtr=srcArrIndex->begin();
+ arrIo->alloc(nbOfTuples+1,1);
+ arro->alloc(arrIn->getNumberOfTuples()+offset,1);
+ const T *arrInPtr=arrIn->begin();
+ const T *srcArrPtr=srcArr->begin();
+ mcIdType *arrIoPtr=arrIo->getPointer(); *arrIoPtr++=0;
+ T *arroPtr=arro->getPointer();
+ for(mcIdType ii=0;ii<nbOfTuples;ii++,arrIoPtr++)
+ {
+ mcIdType pos=DataArray::GetPosOfItemGivenBESRelativeNoThrow(ii,start,end,step);
+ if(pos<0)
+ {
+ arroPtr=std::copy(arrInPtr+arrIndxInPtr[ii],arrInPtr+arrIndxInPtr[ii+1],arroPtr);
+ *arrIoPtr=arrIoPtr[-1]+(arrIndxInPtr[ii+1]-arrIndxInPtr[ii]);
+ }
+ else
+ {
+ arroPtr=std::copy(srcArrPtr+srcArrIndexPtr[pos],srcArrPtr+srcArrIndexPtr[pos+1],arroPtr);
+ *arrIoPtr=arrIoPtr[-1]+(srcArrIndexPtr[pos+1]-srcArrIndexPtr[pos]);
+ }
+ }
+ arrOut=arro.retn();
+ arrIndexOut=arrIo.retn();
+ }
+
+ /*!
+ * This method works on an input pair (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn.
+ * This method is an specialization of MEDCouplingUMesh::SetPartOfIndexedArrays in the case of assignment do not modify the index in \b arrIndxIn.
+ *
+ * \param [in] idsOfSelectBg begin of set of ids of the input extraction (included)
+ * \param [in] idsOfSelectEnd end of set of ids of the input extraction (excluded)
+ * \param [in,out] arrInOut arr origin array from which the extraction will be done.
+ * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn
+ * \param [in] srcArr input array that will be used as source of copy for ids in [ \b idsOfSelectBg , \b idsOfSelectEnd )
+ * \param [in] srcArrIndex index array of \b srcArr
+ *
+ * \sa DataArrayInt::SetPartOfIndexedArrays
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::SetPartOfIndexedArraysSameIdx(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd,
+ DataArrayType *arrInOut, const DataArrayIdType *arrIndxIn,
+ const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex)
+ {
+ if(arrInOut==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdx : presence of null pointer in input parameter !");
+ mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ const mcIdType *arrIndxInPtr=arrIndxIn->begin();
+ const mcIdType *srcArrIndexPtr=srcArrIndex->begin();
+ T *arrInOutPtr=arrInOut->getPointer();
+ const T *srcArrPtr=srcArr->begin();
+ for(const mcIdType *it=idsOfSelectBg;it!=idsOfSelectEnd;it++,srcArrIndexPtr++)
+ {
+ if(*it>=0 && *it<nbOfTuples)
+ {
+ if(srcArrIndexPtr[1]-srcArrIndexPtr[0]==arrIndxInPtr[*it+1]-arrIndxInPtr[*it])
+ std::copy(srcArrPtr+srcArrIndexPtr[0],srcArrPtr+srcArrIndexPtr[1],arrInOutPtr+arrIndxInPtr[*it]);
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::SetPartOfIndexedArraysSameIdx : On pos #" << std::distance(idsOfSelectBg,it) << " id (idsOfSelectBg[" << std::distance(idsOfSelectBg,it)<< "]) is " << *it << " arrIndxIn[id+1]-arrIndxIn[id]!=srcArrIndex[pos+1]-srcArrIndex[pos] !";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::SetPartOfIndexedArraysSameIdx : On pos #" << std::distance(idsOfSelectBg,it) << " value is " << *it << " not in [0," << nbOfTuples << ") !";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ }
+ }
+
+ /*!
+ * This method works on an input pair (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn.
+ * This method is an specialization of MEDCouplingUMesh::SetPartOfIndexedArrays in the case of assignment do not modify the index in \b arrIndxIn.
+ *
+ * \param [in] start begin of set of ids of the input extraction (included)
+ * \param [in] end end of set of ids of the input extraction (excluded)
+ * \param [in] step step of the set of ids in range mode.
+ * \param [in,out] arrInOut arr origin array from which the extraction will be done.
+ * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn
+ * \param [in] srcArr input array that will be used as source of copy for ids in [\b idsOfSelectBg, \b idsOfSelectEnd)
+ * \param [in] srcArrIndex index array of \b srcArr
+ *
+ * \sa DataArrayInt::SetPartOfIndexedArraysSlice DataArrayInt::SetPartOfIndexedArraysSameIdx
+ */
+ template <class T>
+ void DataArrayDiscrete<T>::SetPartOfIndexedArraysSameIdxSlice(mcIdType start, mcIdType end, mcIdType step,
+ DataArrayType *arrInOut, const DataArrayIdType *arrIndxIn,
+ const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex)
+ {
+ if(arrInOut==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : presence of null pointer in input parameter !");
+ mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ const mcIdType *arrIndxInPtr=arrIndxIn->begin();
+ const mcIdType *srcArrIndexPtr=srcArrIndex->begin();
+ T *arrInOutPtr=arrInOut->getPointer();
+ const T *srcArrPtr=srcArr->begin();
+ mcIdType nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : ");
+ mcIdType it=start;
+ for(mcIdType i=0;i<nbOfElemsToSet;i++,srcArrIndexPtr++,it+=step)
+ {
+ if(it>=0 && it<nbOfTuples)
+ {
+ if(srcArrIndexPtr[1]-srcArrIndexPtr[0]==arrIndxInPtr[it+1]-arrIndxInPtr[it])
+ std::copy(srcArrPtr+srcArrIndexPtr[0],srcArrPtr+srcArrIndexPtr[1],arrInOutPtr+arrIndxInPtr[it]);
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : On pos #" << i << " id (idsOfSelectBg[" << i << "]) is " << it << " arrIndxIn[id+1]-arrIndxIn[id]!=srcArrIndex[pos+1]-srcArrIndex[pos] !";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : On pos #" << i << " value is " << it << " not in [0," << nbOfTuples << ") !";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ }
+ }
+
+ /*!
+ * This method works on an input pair (\b arr, \b arrIndx) where \b arr indexes is in \b arrIndx.
+ * This method will not impact the size of inout parameter \b arrIndx but the size of \b arr will be modified in case of suppression.
+ *
+ * \param [in] idsToRemoveBg begin of set of ids to remove in \b arr (included)
+ * \param [in] idsToRemoveEnd end of set of ids to remove in \b arr (excluded)
+ * \param [in,out] arr array in which the remove operation will be done.
+ * \param [in,out] arrIndx array in the remove operation will modify
+ * \param [in] offsetForRemoval (by default 0) offset so that for each i in [0,arrIndx->getNumberOfTuples()-1) removal process will be performed in the following range [arr+arrIndx[i]+offsetForRemoval,arr+arr[i+1])
+ * \return true if \b arr and \b arrIndx have been modified, false if not.
+ */
+ template <class T>
+ bool DataArrayDiscrete<T>::RemoveIdsFromIndexedArrays(const T *idsToRemoveBg, const T *idsToRemoveEnd,
+ DataArrayType *arr, DataArrayIdType *arrIndx, mcIdType offsetForRemoval)
+ {
+ if(!arrIndx || !arr)
+ throw INTERP_KERNEL::Exception("DataArrayInt::RemoveIdsFromIndexedArrays : some input arrays are empty !");
+ if(offsetForRemoval<0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::RemoveIdsFromIndexedArrays : offsetForRemoval should be >=0 !");
+ std::set<T> s(idsToRemoveBg,idsToRemoveEnd);
+ mcIdType nbOfGrps=arrIndx->getNumberOfTuples()-1;
+ mcIdType *arrIPtr=arrIndx->getPointer();
+ *arrIPtr++=0;
+ mcIdType previousArrI=0;
+ const T *arrPtr=arr->begin();
+ std::vector<T> arrOut;//no utility to switch to DataArrayInt because copy always needed
+ for(mcIdType i=0;i<nbOfGrps;i++,arrIPtr++)
+ {
+ if(*arrIPtr-previousArrI>offsetForRemoval)
+ {
+ for(const T *work=arrPtr+previousArrI+offsetForRemoval;work!=arrPtr+*arrIPtr;work++)
+ {
+ if(s.find(*work)==s.end())
+ arrOut.push_back(*work);
+ }
+ }
+ previousArrI=*arrIPtr;
+ *arrIPtr=ToIdType(arrOut.size());
+ }
+ if(arr->getNumberOfTuples()==ToIdType(arrOut.size()))
+ return false;
+ arr->alloc(arrOut.size(),1);
+ std::copy(arrOut.begin(),arrOut.end(),arr->getPointer());
+ return true;
+ }
+
+ /*!
+ * Returns a new DataArrayInt containing an arithmetic progression
+ * that is equal to the sequence returned by Python \c range(\a begin,\a end,\a step )
+ * function.
+ * \param [in] begin - the start value of the result sequence.
+ * \param [in] end - limiting value, so that every value of the result array is less than
+ * \a end.
+ * \param [in] step - specifies the increment or decrement.
+ * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ * array using decrRef() as it is no more needed.
+ * \throw If \a step == 0.
+ * \throw If \a end < \a begin && \a step > 0.
+ * \throw If \a end > \a begin && \a step < 0.
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::Range(T begin, T end, T step)
+ {
+ mcIdType nbOfTuples=DataArrayTools<T>::GetNumberOfItemGivenBESRelative(begin,end,step,"DataArrayInt::Range");
+ MCAuto<DataArrayType> ret=DataArrayType::New();
+ ret->alloc(nbOfTuples,1);
+ T *ptr=ret->getPointer();
+ if(step>0)
+ {
+ for(T i=begin;i<end;i+=step,ptr++)
+ *ptr=i;
+ }
+ else
+ {
+ for(T i=begin;i>end;i+=step,ptr++)
+ *ptr=i;
+ }
+ return ret.retn();
+ }
+
+ /*!
+ * Returns a new DataArrayInt containing a renumbering map in "Old to New" mode computed
+ * from a zip representation of a surjective format (returned e.g. by
+ * \ref MEDCoupling::DataArrayDouble::findCommonTuples() "DataArrayDouble::findCommonTuples()"
+ * for example). The result array minimizes the permutation. <br>
+ * For more info on renumbering see \ref numbering. <br>
+ * \b Example: <br>
+ * - \a nbOfOldTuples: 10
+ * - \a arr : [0,3, 5,7,9]
+ * - \a arrIBg : [0,2,5]
+ * - \a newNbOfTuples: 7
+ * - result array : [0,1,2,0,3,4,5,4,6,4]
+ *
+ * \param [in] nbOfOldTuples - number of tuples in the initial array \a arr.
+ * \param [in] arr - the array of tuple indices grouped by \a arrIBg array.
+ * \param [in] arrIBg - the array dividing all indices stored in \a arr into groups of
+ * (indices of) equal values. Its every element (except the last one) points to
+ * the first element of a group of equal values.
+ * \param [in] arrIEnd - specifies the end of \a arrIBg, so that the last element of \a
+ * arrIBg is \a arrIEnd[ -1 ].
+ * \param [out] newNbOfTuples - number of tuples after surjection application.
+ * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ * array using decrRef() as it is no more needed.
+ * \throw If any value of \a arr breaks condition ( 0 <= \a arr[ i ] < \a nbOfOldTuples ).
+ */
+ template <class T>
+ DataArrayIdType *DataArrayDiscrete<T>::ConvertIndexArrayToO2N(mcIdType nbOfOldTuples, const mcIdType *arr, const mcIdType *arrIBg, const mcIdType *arrIEnd, mcIdType &newNbOfTuples)
+ {
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ ret->alloc(nbOfOldTuples,1);
+ mcIdType *pt=ret->getPointer();
+ std::fill(pt,pt+nbOfOldTuples,-1);
+ mcIdType nbOfGrps=ToIdType(std::distance(arrIBg,arrIEnd))-1;
+ const mcIdType *cIPtr=arrIBg;
+ for(mcIdType i=0;i<nbOfGrps;i++)
+ pt[arr[cIPtr[i]]]=-(i+2);
+ mcIdType newNb=0;
+ for(mcIdType iNode=0;iNode<nbOfOldTuples;iNode++)
+ {
+ if(pt[iNode]<0)
+ {
+ if(pt[iNode]==-1)
+ pt[iNode]=newNb++;
+ else
+ {
+ mcIdType grpId=-(pt[iNode]+2);
+ for(mcIdType j=cIPtr[grpId];j<cIPtr[grpId+1];j++)
+ {
+ if(arr[j]>=0 && arr[j]<nbOfOldTuples)
+ pt[arr[j]]=newNb;
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::ConvertIndexArrayToO2N : With element #" << j << " value is " << arr[j] << " should be in [0," << nbOfOldTuples << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ newNb++;
+ }
+ }
+ }
+ newNbOfTuples=newNb;
+ return ret.retn();
+ }
+
+ /*!
+ * Returns a new DataArrayInt which is a minimal partition of elements of \a groups.
+ * The i-th item of the result array is an ID of a set of elements belonging to a
+ * unique set of groups, which the i-th element is a part of. This set of elements
+ * belonging to a unique set of groups is called \a family, so the result array contains
+ * IDs of families each element belongs to.
+ *
+ * \b Example: if we have two groups of elements: \a group1 [0,4] and \a group2 [ 0,1,2 ],
+ * then there are 3 families:
+ * - \a family1 (with ID 1) contains element [0] belonging to ( \a group1 + \a group2 ),
+ * - \a family2 (with ID 2) contains elements [4] belonging to ( \a group1 ),
+ * - \a family3 (with ID 3) contains element [1,2] belonging to ( \a group2 ), <br>
+ * and the result array contains IDs of families [ 1,3,3,0,2 ]. <br> Note a family ID 0 which
+ * stands for the element #3 which is in none of groups.
+ *
+ * \param [in] groups - sequence of groups of element IDs.
+ * \param [in] newNb - total number of elements; it must be more than max ID of element
+ * in \a groups.
+ * \param [out] fidsOfGroups - IDs of families the elements of each group belong to.
+ * \return DataArrayInt * - a new instance of DataArrayInt containing IDs of families
+ * each element with ID from range [0, \a newNb ) belongs to. The caller is to
+ * delete this array using decrRef() as it is no more needed.
+ * \throw If any element ID in \a groups violates condition ( 0 <= ID < \a newNb ).
+ */
+ template <class T>
+ DataArrayIdType *DataArrayDiscrete<T>::MakePartition(const std::vector<const DataArrayType *>& groups, mcIdType newNb, std::vector< std::vector<mcIdType> >& fidsOfGroups)
+ {
+ std::vector<const DataArrayType *> groups2;
+ for(typename std::vector<const DataArrayType *>::const_iterator it4=groups.begin();it4!=groups.end();it4++)
+ if(*it4)
+ groups2.push_back(*it4);
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ ret->alloc(newNb,1);
+ mcIdType *retPtr=ret->getPointer();
+ std::fill(retPtr,retPtr+newNb,0);
+ mcIdType fid=1;
+ for(typename std::vector<const DataArrayType *>::const_iterator iter=groups2.begin();iter!=groups2.end();iter++)
+ {
+ const T *ptr=(*iter)->getConstPointer();
+ std::size_t nbOfElem=(*iter)->getNbOfElems();
+ mcIdType sfid=fid;
+ for(mcIdType j=0;j<sfid;j++)
+ {
+ bool found=false;
+ for(std::size_t i=0;i<nbOfElem;i++)
+ {
+ if(ptr[i]>=0 && ptr[i]<newNb)
+ {
+ if(retPtr[ptr[i]]==j)
+ {
+ retPtr[ptr[i]]=fid;
+ found=true;
+ }
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::MakePartition : In group \"" << (*iter)->getName() << "\" in tuple #" << i << " value = " << ptr[i] << " ! Should be in [0," << newNb;
+ oss << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ if(found)
+ fid++;
+ }
+ }
+ fidsOfGroups.clear();
+ fidsOfGroups.resize(groups2.size());
+ mcIdType grId=0;
+ for(typename std::vector<const DataArrayType *>::const_iterator iter=groups2.begin();iter!=groups2.end();iter++,grId++)
+ {
+ std::set<mcIdType> tmp;
+ const T *ptr=(*iter)->getConstPointer();
+ std::size_t nbOfElem=(*iter)->getNbOfElems();
+ for(const T *p=ptr;p!=ptr+nbOfElem;p++)
+ tmp.insert(retPtr[*p]);
+ fidsOfGroups[grId].insert(fidsOfGroups[grId].end(),tmp.begin(),tmp.end());
+ }
+ return ret.retn();
+ }
+
+}
+
+/// @cond INTERNAL
+namespace MEDCouplingImpl
+{
+ template <class T>
+ class OpSwitchedOn
+ {
+ public:
+ OpSwitchedOn(T *pt):_pt(pt),_cnt(0) { }
+ void operator()(const bool& b) { if(b) *_pt++=FromIdType<T>(_cnt); _cnt++; }
+ private:
+ T *_pt;
+ MEDCoupling::mcIdType _cnt;
+ };
+
+ template <class T>
+ class OpSwitchedOff
+ {
+ public:
+ OpSwitchedOff(T *pt):_pt(pt),_cnt(0) { }
+ void operator()(const bool& b) { if(!b) *_pt++=FromIdType<T>(_cnt); _cnt++; }
+ private:
+ T *_pt;
+ MEDCoupling::mcIdType _cnt;
+ };
+}
+/// @endcond
+
+namespace MEDCoupling
+{
+ /*!
+ * This method returns the list of ids in ascending mode so that v[id]==true.
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::BuildListOfSwitchedOn(const std::vector<bool>& v)
+ {
+ std::size_t sz(std::count(v.begin(),v.end(),true));
+ MCAuto<DataArrayType> ret(DataArrayType::New()); ret->alloc(sz,1);
+ std::for_each(v.begin(),v.end(),MEDCouplingImpl::OpSwitchedOn<T>(ret->getPointer()));
+ return ret.retn();
+ }
+
+ /*!
+ * This method returns the list of ids in ascending mode so that v[id]==false.
+ */
+ template <class T>
+ typename Traits<T>::ArrayType *DataArrayDiscrete<T>::BuildListOfSwitchedOff(const std::vector<bool>& v)
+ {
+ std::size_t sz(std::count(v.begin(),v.end(),false));
+ MCAuto<DataArrayType> ret(DataArrayType::New()); ret->alloc(sz,1);
+ std::for_each(v.begin(),v.end(),MEDCouplingImpl::OpSwitchedOff<T>(ret->getPointer()));
+ return ret.retn();
+ }
+}
+
+namespace MEDCoupling
+{
/*!
* This method compares content of input vector \a v and \a this.
* If for each id in \a this v[id]==True and for all other ids id2 not in \a this v[id2]==False, true is returned.
throw INTERP_KERNEL::Exception("DataArrayInt::isFittingWith : number of components of this should be equal to one !");
const T *w(this->begin()),*end2(this->end());
T refVal=-std::numeric_limits<T>::max();
- int i=0;
+ T i=0;
std::vector<bool>::const_iterator it(v.begin());
for(;it!=v.end();it++,i++)
{
/*!
* Returns an integer value characterizing \a this array, which is useful for a quick
- * comparison of many instances of DataArrayInt.
- * \return int - the hash value.
+ * comparison of many instances of DataArrayChar.
+ * \return mcIdType - the hash value.
* \throw If \a this is not allocated.
*/
-int DataArrayChar::getHashCode() const
+mcIdType DataArrayChar::getHashCode() const
{
checkAllocated();
std::size_t nbOfElems=getNbOfElems();
- int ret=nbOfElems*65536;
- int delta=3;
+ std::size_t ret=nbOfElems*65536;
+ std::size_t delta=3;
if(nbOfElems>48)
delta=nbOfElems/8;
- int ret0=0;
+ mcIdType ret0=0;
const char *pt=begin();
for(std::size_t i=0;i<nbOfElems;i+=delta)
ret0+=pt[i];
- return ret+ret0;
+ return ToIdType(ret)+ret0;
}
/*!
}
/*!
- * Creates a new DataArrayInt and assigns all (textual and numerical) data of \a this
+ * Creates a new DataArrayIdType and assigns all (textual and numerical) data of \a this
* array to the new one.
- * \return DataArrayInt * - the new instance of DataArrayChar.
+ * \return DataArrayIdType * - the new instance of DataArrayChar.
*/
DataArrayInt *DataArrayChar::convertToIntArr() const
{
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::isUniform : must be applied on DataArrayChar with only one component, you can call 'rearrange' method before !");
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
const char *w=getConstPointer();
const char *end2=w+nbOfTuples;
for(;w!=end2;w++)
throw INTERP_KERNEL::Exception("DataArrayChar::meldWith : DataArrayChar pointer in input is NULL !");
checkAllocated();
other->checkAllocated();
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
if(nbOfTuples!=other->getNumberOfTuples())
throw INTERP_KERNEL::Exception("DataArrayChar::meldWith : mismatch of number of tuples !");
- int nbOfComp1=getNumberOfComponents();
- int nbOfComp2=other->getNumberOfComponents();
+ std::size_t nbOfComp1=getNumberOfComponents();
+ std::size_t nbOfComp2=other->getNumberOfComponents();
char *newArr=(char *)malloc(nbOfTuples*(nbOfComp1+nbOfComp2)*sizeof(char));
char *w=newArr;
const char *inp1=getConstPointer();
const char *inp2=other->getConstPointer();
- for(int i=0;i<nbOfTuples;i++,inp1+=nbOfComp1,inp2+=nbOfComp2)
+ for(mcIdType i=0;i<nbOfTuples;i++,inp1+=nbOfComp1,inp2+=nbOfComp2)
{
w=std::copy(inp1,inp1+nbOfComp1,w);
w=std::copy(inp2,inp2+nbOfComp2,w);
}
useArray(newArr,true,DeallocType::C_DEALLOC,nbOfTuples,nbOfComp1+nbOfComp2);
- std::vector<int> compIds(nbOfComp2);
- for(int i=0;i<nbOfComp2;i++)
+ std::vector<std::size_t> compIds(nbOfComp2);
+ for(std::size_t i=0;i<nbOfComp2;i++)
compIds[i]=nbOfComp1+i;
copyPartOfStringInfoFrom2(compIds,*other);
}
/*!
- * Creates a new DataArrayChar containing IDs (indices) of tuples holding value equal to a
+ * Creates a new DataArrayIdType containing IDs (indices) of tuples holding value equal to a
* given one.
* \param [in] val - the value to find within \a this.
- * \return DataArrayChar * - a new instance of DataArrayChar. The caller is to delete this
+ * \return DataArrayIdType * - a new instance of DataArrayIdType. The caller is to delete this
* array using decrRef() as it is no more needed.
* \throw If \a this is not allocated.
* \throw If \a this->getNumberOfComponents() != 1.
*/
-DataArrayInt *DataArrayChar::findIdsEqual(char val) const
+DataArrayIdType *DataArrayChar::findIdsEqual(char val) const
{
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::findIdsEqual : the array must have only one component, you can call 'rearrange' method before !");
const char *cptr=getConstPointer();
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- int nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
+ mcIdType nbOfTuples=getNumberOfTuples();
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr==val)
ret->pushBackSilent(i);
return ret.retn();
}
/*!
- * Creates a new DataArrayChar containing IDs (indices) of tuples holding value \b not
+ * Creates a new DataArrayIdType containing IDs (indices) of tuples holding value \b not
* equal to a given one.
* \param [in] val - the value to ignore within \a this.
* \return DataArrayChar * - a new instance of DataArrayChar. The caller is to delete this
* \throw If \a this is not allocated.
* \throw If \a this->getNumberOfComponents() != 1.
*/
-DataArrayInt *DataArrayChar::findIdsNotEqual(char val) const
+DataArrayIdType *DataArrayChar::findIdsNotEqual(char val) const
{
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::findIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !");
const char *cptr=getConstPointer();
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- int nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
+ mcIdType nbOfTuples=getNumberOfTuples();
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr!=val)
ret->pushBackSilent(i);
return ret.retn();
* This method differs from DataArrayChar::findIdFirstEqualTuple in that the position is internal raw data is not considered here contrary to DataArrayChar::findIdFirstEqualTuple.
* \sa DataArrayChar::findIdFirstEqualTuple
*/
-int DataArrayChar::findIdSequence(const std::vector<char>& vals) const
+mcIdType DataArrayChar::findIdSequence(const std::vector<char>& vals) const
{
checkAllocated();
- int nbOfCompo=getNumberOfComponents();
- if(nbOfCompo!=1)
+ if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::findIdSequence : works only for DataArrayChar instance with one component !");
const char *cptr=getConstPointer();
std::size_t nbOfVals=getNbOfElems();
const char *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end());
if(loc!=cptr+nbOfVals)
- return std::distance(cptr,loc);
+ return ToIdType(std::distance(cptr,loc));
return -1;
}
* \return tuple id where \b tupl is. -1 if no such tuple exists in \b this.
* \sa DataArrayChar::findIdSequence.
*/
-int DataArrayChar::findIdFirstEqualTuple(const std::vector<char>& tupl) const
+mcIdType DataArrayChar::findIdFirstEqualTuple(const std::vector<char>& tupl) const
{
checkAllocated();
- int nbOfCompo=getNumberOfComponents();
+ std::size_t nbOfCompo=getNumberOfComponents();
if(nbOfCompo==0)
throw INTERP_KERNEL::Exception("DataArrayChar::findIdFirstEqualTuple : 0 components in 'this' !");
- if(nbOfCompo!=(int)tupl.size())
+ if(nbOfCompo!=tupl.size())
{
std::ostringstream oss; oss << "DataArrayChar::findIdFirstEqualTuple : 'this' contains " << nbOfCompo << " components and searching for a tuple of length " << tupl.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
if(std::distance(cptr,work)%nbOfCompo!=0)
work++;
else
- return std::distance(cptr,work)/nbOfCompo;
+ return ToIdType(std::distance(cptr,work)/nbOfCompo);
}
}
return -1;
* If not any tuple contains \b value -1 is returned.
* \sa DataArrayChar::presenceOfValue
*/
-int DataArrayChar::findIdFirstEqual(char value) const
+mcIdType DataArrayChar::findIdFirstEqual(char value) const
{
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
const char *cptr=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
const char *ret=std::find(cptr,cptr+nbOfTuples,value);
if(ret!=cptr+nbOfTuples)
- return std::distance(cptr,ret);
+ return ToIdType(std::distance(cptr,ret));
return -1;
}
* If not any tuple contains one of the values contained in 'vals' false is returned.
* \sa DataArrayChar::presenceOfValue
*/
-int DataArrayChar::findIdFirstEqual(const std::vector<char>& vals) const
+mcIdType DataArrayChar::findIdFirstEqual(const std::vector<char>& vals) const
{
checkAllocated();
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
+ throw INTERP_KERNEL::Exception("DataArrayChar::findIdFirstEqual : the array must have only one component, you can call 'rearrange' method before !");
std::set<char> vals2(vals.begin(),vals.end());
const char *cptr=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
for(const char *w=cptr;w!=cptr+nbOfTuples;w++)
if(vals2.find(*w)!=vals2.end())
- return std::distance(cptr,w);
+ return ToIdType(std::distance(cptr,w));
return -1;
}
* \param [in] vmax end of range. This value is \b not included in range.
* \return a newly allocated data array that the caller should deal with.
*/
-DataArrayInt *DataArrayChar::findIdsInRange(char vmin, char vmax) const
+DataArrayIdType *DataArrayChar::findIdsInRange(char vmin, char vmax) const
{
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::findIdsInRange : this must have exactly one component !");
const char *cptr=getConstPointer();
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
- int nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(0,1);
+ mcIdType nbOfTuples=getNumberOfTuples();
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr>=vmin && *cptr<vmax)
ret->pushBackSilent(i);
return ret.retn();
throw INTERP_KERNEL::Exception("DataArrayChar::Aggregate : input list must be NON EMPTY !");
std::vector<const DataArrayChar *>::const_iterator it=a.begin();
std::size_t nbOfComp((*it)->getNumberOfComponents());
- int nbt=(*it++)->getNumberOfTuples();
- for(int i=1;it!=a.end();it++,i++)
+ mcIdType nbt=(*it++)->getNumberOfTuples();
+ for(;it!=a.end();it++)
{
if((*it)->getNumberOfComponents()!=nbOfComp)
throw INTERP_KERNEL::Exception("DataArrayChar::Aggregate : Nb of components mismatch for array aggregation !");
for(it=a.begin();it!=a.end();it++)
(*it)->checkAllocated();
it=a.begin();
- int nbOfTuples=(*it)->getNumberOfTuples();
- std::vector<int> nbc(a.size());
+ mcIdType nbOfTuples=(*it)->getNumberOfTuples();
+ std::vector<std::size_t> nbc(a.size());
std::vector<const char *> pts(a.size());
nbc[0]=(*it)->getNumberOfComponents();
pts[0]=(*it++)->getConstPointer();
- for(int i=1;it!=a.end();it++,i++)
+ for(std::size_t i=1;it!=a.end();it++,i++)
{
if(nbOfTuples!=(*it)->getNumberOfTuples())
throw INTERP_KERNEL::Exception("DataArrayChar::meld : mismatch of number of tuples !");
nbc[i]=(*it)->getNumberOfComponents();
pts[i]=(*it)->getConstPointer();
}
- int totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),0);
+ std::size_t totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),(std::size_t)0);
DataArrayChar *ret=a[0]->buildEmptySpecializedDAChar();
ret->alloc(nbOfTuples,totalNbOfComp);
char *retPtr=ret->getPointer();
- for(int i=0;i<nbOfTuples;i++)
- for(int j=0;j<(int)a.size();j++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
+ for(std::size_t j=0;j<a.size();j++)
{
retPtr=std::copy(pts[j],pts[j]+nbc[j],retPtr);
pts[j]+=nbc[j];
}
- int k=0;
- for(int i=0;i<(int)a.size();i++)
- for(int j=0;j<nbc[i];j++,k++)
+ std::size_t k=0;
+ for(std::size_t i=0;i<a.size();i++)
+ for(std::size_t j=0;j<nbc[i];j++,k++)
ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j));
return ret;
}
void DataArrayByte::reprWithoutNameStream(std::ostream& stream) const
{
DataArray::reprWithoutNameStream(stream);
- if(_mem.reprHeader(getNumberOfComponents(),stream))
+ if(_mem.reprHeader(ToIdType(getNumberOfComponents()),stream))
{
const char *data=begin();
- int nbOfTuples=getNumberOfTuples();
- int nbCompo=getNumberOfComponents();
- for(int i=0;i<nbOfTuples;i++,data+=nbCompo)
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbCompo=getNumberOfComponents();
+ for(mcIdType i=0;i<nbOfTuples;i++,data+=nbCompo)
{
stream << "Tuple #" << i << " : ";
std::copy(data,data+nbCompo,std::ostream_iterator<int>(stream," "));//it is not a bug int here not char because it is not ASCII here contrary to DataArrayAsciiChar
void DataArrayByte::reprZipWithoutNameStream(std::ostream& stream) const
{
DataArray::reprWithoutNameStream(stream);
- _mem.reprZip(getNumberOfComponents(),stream);
+ _mem.reprZip(ToIdType(getNumberOfComponents()),stream);
}
void DataArrayByte::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
+ mcIdType nbTuples=getNumberOfTuples();
+ std::size_t nbComp=getNumberOfComponents();
const char *data=getConstPointer();
stream << "DataArrayByte *" << varName << "=DataArrayByte::New();" << std::endl;
if(nbTuples*nbComp>=1)
stream << "DataArrayByte C++ instance at " << this << ". ";
if(isAllocated())
{
- int nbOfCompo=(int)_info_on_compo.size();
+ std::size_t nbOfCompo=_info_on_compo.size();
if(nbOfCompo>=1)
{
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayByte::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const char *data=begin();
- int nbOfTuples=getNumberOfTuples();
- int nbOfCompo=(int)_info_on_compo.size();
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfCompo=_info_on_compo.size();
std::ostringstream oss2; oss2 << "[";
std::string oss2Str(oss2.str());
bool isFinished=true;
- for(int i=0;i<nbOfTuples && isFinished;i++)
+ for(mcIdType i=0;i<nbOfTuples && isFinished;i++)
{
if(nbOfCompo>1)
{
oss2 << "(";
- for(int j=0;j<nbOfCompo;j++,data++)
+ for(std::size_t j=0;j<nbOfCompo;j++,data++)
{
oss2 << (int)*data;
if(j!=nbOfCompo-1) oss2 << ", ";
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayByte::toVectorOfBool : this method can be used only if this has one component !");
- int nbt(getNumberOfTuples());
+ mcIdType nbt(getNumberOfTuples());
std::vector<bool> ret(nbt,false);
const char *pt(begin());
- for(int i=0;i<nbt;i++,pt++)
+ for(mcIdType i=0;i<nbt;i++,pt++)
if(*pt!=0)
ret[i]=true;
return ret;
return 0;
}
-DataArrayByteTuple::DataArrayByteTuple(char *pt, int nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
+DataArrayByteTuple::DataArrayByteTuple(char *pt, std::size_t nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
{
}
std::string DataArrayByteTuple::repr() const
{
std::ostringstream oss; oss << "(";
- for(int i=0;i<_nb_of_compo-1;i++)
+ for(std::size_t i=0;i<_nb_of_compo-1;i++)
oss << (int)_pt[i] << ", ";
oss << _pt[_nb_of_compo-1] << ")";
return oss.str();
* This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or
* \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem.
*/
-DataArrayByte *DataArrayByteTuple::buildDAByte(int nbOfTuples, int nbOfCompo) const
+DataArrayByte *DataArrayByteTuple::buildDAByte(std::size_t nbOfTuples, std::size_t nbOfCompo) const
{
if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1))
{
nbCompo=std::max(nbCompo,(*it).length());
if(nbCompo==0)
throw INTERP_KERNEL::Exception("DataArrayAsciiChar constructor with vector of strings ! All strings in not empty vector are empty !");
- int nbTuples=(int)vst.size();
- alloc(nbTuples,(int)nbCompo);
+ std::size_t nbTuples=vst.size();
+ alloc(nbTuples,nbCompo);
char *pt=getPointer();
- for(int i=0;i<nbTuples;i++,pt+=nbCompo)
+ for(std::size_t i=0;i<nbTuples;i++,pt+=nbCompo)
{
const std::string& tmp=vst[i];
std::size_t sz=tmp.length();
void DataArrayAsciiChar::reprWithoutNameStream(std::ostream& stream) const
{
DataArray::reprWithoutNameStream(stream);
- if(_mem.reprHeader(getNumberOfComponents(),stream))
+ if(_mem.reprHeader(ToIdType(getNumberOfComponents()),stream))
{
const char *data=begin();
- int nbOfTuples=getNumberOfTuples();
- int nbCompo=getNumberOfComponents();
- for(int i=0;i<nbOfTuples;i++,data+=nbCompo)
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbCompo=getNumberOfComponents();
+ for(mcIdType i=0;i<nbOfTuples;i++,data+=nbCompo)
{
stream << "Tuple #" << i << " : \"";
std::copy(data,data+nbCompo,std::ostream_iterator<char>(stream));
void DataArrayAsciiChar::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
+ mcIdType nbTuples=getNumberOfTuples();
+ std::size_t nbComp=getNumberOfComponents();
const char *data=getConstPointer();
stream << "DataArrayAsciiChar *" << varName << "=DataArrayAsciiChar::New();" << std::endl;
if(nbTuples*nbComp>=1)
stream << "DataArrayAsciiChar C++ instance at " << this << ". ";
if(isAllocated())
{
- int nbOfCompo=(int)_info_on_compo.size();
+ std::size_t nbOfCompo=_info_on_compo.size();
if(nbOfCompo>=1)
{
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayAsciiChar::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const char *data=begin();
- int nbOfTuples=getNumberOfTuples();
- int nbOfCompo=(int)_info_on_compo.size();
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfCompo=_info_on_compo.size();
std::ostringstream oss2; oss2 << "[";
std::string oss2Str(oss2.str());
bool isFinished=true;
- for(int i=0;i<nbOfTuples && isFinished;i++)
+ for(mcIdType i=0;i<nbOfTuples && isFinished;i++)
{
bool isAscii=true;
- for(int j=0;j<nbOfCompo;j++)
+ for(std::size_t j=0;j<nbOfCompo;j++)
if(data[j]<32) isAscii=false;
if(isAscii)
{
oss2 << "\'";
- for(int j=0;j<nbOfCompo;j++,data++)
+ for(std::size_t j=0;j<nbOfCompo;j++,data++)
oss2 << *data;
oss2 << "\'";
}
else
{
oss2 << "(";
- for(int j=0;j<nbOfCompo;j++,data++)
+ for(std::size_t j=0;j<nbOfCompo;j++,data++)
{
oss2 << (int)*data;
if(j!=nbOfCompo-1) oss2 << ", ";
return 0;
}
-DataArrayAsciiCharTuple::DataArrayAsciiCharTuple(char *pt, int nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
+DataArrayAsciiCharTuple::DataArrayAsciiCharTuple(char *pt, std::size_t nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
{
}
* This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or
* \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem.
*/
-DataArrayAsciiChar *DataArrayAsciiCharTuple::buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const
+DataArrayAsciiChar *DataArrayAsciiCharTuple::buildDAAsciiChar(std::size_t nbOfTuples, std::size_t nbOfCompo) const
{
if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1))
{
void DataArrayFloat::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- int nbTuples(getNumberOfTuples()),nbComp(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
+ std::size_t nbComp(getNumberOfComponents());
const float *data(begin());
stream.precision(7);
stream << "DataArrayFloat *" << varName << "=DataArrayFloat::New();" << std::endl;
stream << "DataArrayFloat C++ instance at " << this << ". ";
if(isAllocated())
{
- int nbOfCompo=(int)_info_on_compo.size();
+ std::size_t nbOfCompo=_info_on_compo.size();
if(nbOfCompo>=1)
{
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayFloat::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const float *data(begin());
- int nbOfTuples(getNumberOfTuples());
- int nbOfCompo=(int)_info_on_compo.size();
+ mcIdType nbOfTuples(getNumberOfTuples());
+ std::size_t nbOfCompo=_info_on_compo.size();
std::ostringstream oss2; oss2 << "[";
oss2.precision(7);
std::string oss2Str(oss2.str());
bool isFinished=true;
- for(int i=0;i<nbOfTuples && isFinished;i++)
+ for(mcIdType i=0;i<nbOfTuples && isFinished;i++)
{
if(nbOfCompo>1)
{
oss2 << "(";
- for(int j=0;j<nbOfCompo;j++,data++)
+ for(std::size_t j=0;j<nbOfCompo;j++,data++)
{
oss2 << *data;
if(j!=nbOfCompo-1) oss2 << ", ";
{
}
-DataArrayFloatTuple::DataArrayFloatTuple(float *pt, int nbOfComp):DataArrayTuple<float>(pt,nbOfComp)
+DataArrayFloatTuple::DataArrayFloatTuple(float *pt, std::size_t nbOfComp):DataArrayTuple<float>(pt,nbOfComp)
{
}
std::string DataArrayFloatTuple::repr() const
{
std::ostringstream oss; oss.precision(7); oss << "(";
- for(int i=0;i<_nb_of_compo-1;i++)
+ for(std::size_t i=0;i<_nb_of_compo-1;i++)
oss << _pt[i] << ", ";
oss << _pt[_nb_of_compo-1] << ")";
return oss.str();
* This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or
* \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem.
*/
-DataArrayFloat *DataArrayFloatTuple::buildDAFloat(int nbOfTuples, int nbOfCompo) const
+DataArrayFloat *DataArrayFloatTuple::buildDAFloat(std::size_t nbOfTuples, std::size_t nbOfCompo) const
{
return this->buildDA(nbOfTuples,nbOfCompo);
}
* to be compared. An interpolation using MEDCouplingRemapper class should be then used.
*/
void MEDCouplingMesh::checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec,
- DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const
{
cellCor=0;
nodeCor=0;
* \param [in] partBg - the array of node ids.
* \param [in] partEnd - end of \a partBg, i.e. a pointer to a (last+1)-th element
* of \a partBg.
- * \return DataArrayInt * - a new instance of DataArrayInt holding ids of found
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of found
* cells. The caller is to delete this array using decrRef() as it is no
* more needed.
*/
-DataArrayInt *MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const
+DataArrayIdType *MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds(const mcIdType *partBg, const mcIdType *partEnd) const
{
- std::vector<int> crest;
- std::set<int> p(partBg,partEnd);
- int nbOfCells=getNumberOfCells();
- for(int i=0;i<nbOfCells;i++)
+ std::vector<mcIdType> crest;
+ std::set<mcIdType> p(partBg,partEnd);
+ mcIdType nbOfCells=getNumberOfCells();
+ for(mcIdType i=0;i<nbOfCells;i++)
{
- std::vector<int> conn;
+ std::vector<mcIdType> conn;
getNodeIdsOfCell(i,conn);
bool cont=true;
- for(std::vector<int>::const_iterator iter=conn.begin();iter!=conn.end() && cont;iter++)
+ for(std::vector<mcIdType>::const_iterator iter=conn.begin();iter!=conn.end() && cont;iter++)
if(p.find(*iter)==p.end())
cont=false;
if(cont)
crest.push_back(i);
}
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)crest.size(),1);
+ DataArrayIdType *ret=DataArrayIdType::New();
+ ret->alloc(crest.size(),1);
std::copy(crest.begin(),crest.end(),ret->getPointer());
return ret;
}
*
* \sa MEDCouplingMesh::buildPart
*/
-MEDCouplingMesh *MEDCouplingMesh::buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const
+MEDCouplingMesh *MEDCouplingMesh::buildPartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
{
if(beginCellIds==0 && endCellIds==getNumberOfCells() && stepCellIds==1)
{
}
else
{
- MCAuto<DataArrayInt> cellIds=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds);
+ MCAuto<DataArrayIdType> cellIds=DataArrayIdType::Range(beginCellIds,endCellIds,stepCellIds);
return buildPart(cellIds->begin(),cellIds->end());
}
}
*
* \sa MEDCouplingMesh::buildPartAndReduceNodes
*/
-MEDCouplingMesh *MEDCouplingMesh::buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& arr) const
+MEDCouplingMesh *MEDCouplingMesh::buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType*& arr) const
{
- MCAuto<DataArrayInt> cellIds=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds);
+ MCAuto<DataArrayIdType> cellIds=DataArrayIdType::Range(beginCellIds,endCellIds,stepCellIds);
return buildPartAndReduceNodes(cellIds->begin(),cellIds->end(),arr);
}
* \throw if type is dynamic as \c INTERP_KERNEL::NORM_POLYHED , \c INTERP_KERNEL::NORM_POLYGON , \c INTERP_KERNEL::NORM_QPOLYG
* \throw if type is equal to \c INTERP_KERNEL::NORM_ERROR or to an unexisting geometric type.
*/
-int MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type)
+mcIdType MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(cm.isDynamic())
throw INTERP_KERNEL::Exception("MEDCouplingMesh::GetNumberOfNodesOfGeometricType : the input geometric type is dynamic ! Impossible to return a fixed number of nodes constituting it !");
- return (int) cm.getNumberOfNodes();
+ return ToIdType( cm.getNumberOfNodes());
}
/*!
* \ref py_mcumesh_getCellsContainingPoints "Here is a Python example".
* \endif
*/
-void MEDCouplingMesh::getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex) const
+void MEDCouplingMesh::getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const
{
- eltsIndex=DataArrayInt::New(); elts=DataArrayInt::New(); eltsIndex->alloc(nbOfPoints+1,1); eltsIndex->setIJ(0,0,0); elts->alloc(0,1);
- int *eltsIndexPtr(eltsIndex->getPointer());
+ eltsIndex=DataArrayIdType::New(); elts=DataArrayIdType::New(); eltsIndex->alloc(nbOfPoints+1,1); eltsIndex->setIJ(0,0,0); elts->alloc(0,1);
+ mcIdType *eltsIndexPtr(eltsIndex->getPointer());
int spaceDim(getSpaceDimension());
const double *work(pos);
- for(int i=0;i<nbOfPoints;i++,work+=spaceDim)
+ for(mcIdType i=0;i<nbOfPoints;i++,work+=spaceDim)
{
- std::vector<int> ret;
+ std::vector<mcIdType> ret;
getCellsContainingPoint(work,eps,ret);
elts->insertAtTheEnd(ret.begin(),ret.end());
eltsIndexPtr[i+1]=elts->getNumberOfTuples();
*
* \sa MEDCouplingMesh::getCellsContainingPoints, MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss
*/
-void MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, int nbOfPoints, double eps, MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex) const
+void MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, mcIdType nbOfPoints, double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const
{
this->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
}
} MEDCouplingMeshType;
// -- WARNING this enum must be synchronized with MEDCouplingCommon.i file ! --
- class DataArrayInt;
+ class DataArrayIdType;
class DataArrayByte;
class DataArrayDouble;
class MEDCouplingUMesh;
MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const = 0;
MEDCOUPLING_EXPORT virtual void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const = 0;
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const = 0;
MEDCOUPLING_EXPORT virtual void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor) const = 0;
+ DataArrayIdType *&cellCor) const = 0;
MEDCOUPLING_EXPORT virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec,
- DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const;
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const;
//
MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const = 0;
MEDCOUPLING_EXPORT virtual void checkConsistency(double eps=1e-12) const = 0;
- MEDCOUPLING_EXPORT virtual std::size_t getNumberOfCells() const = 0;
- MEDCOUPLING_EXPORT virtual int getNumberOfNodes() const = 0;
+ MEDCOUPLING_EXPORT virtual mcIdType getNumberOfCells() const = 0;
+ MEDCOUPLING_EXPORT virtual mcIdType getNumberOfNodes() const = 0;
MEDCOUPLING_EXPORT virtual int getSpaceDimension() const = 0;
MEDCOUPLING_EXPORT virtual int getMeshDimension() const = 0;
MEDCOUPLING_EXPORT virtual DataArrayDouble *getCoordinatesAndOwner() const = 0;
MEDCOUPLING_EXPORT virtual DataArrayDouble *computeCellCenterOfMass() const = 0;
MEDCOUPLING_EXPORT virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *computeNbOfNodesPerCell() const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *computeNbOfFacesPerCell() const = 0;
- MEDCOUPLING_EXPORT virtual std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0;
- MEDCOUPLING_EXPORT virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(std::size_t cellId) const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *computeNbOfNodesPerCell() const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *computeEffectiveNbOfNodesPerCell() const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *computeNbOfFacesPerCell() const = 0;
+ MEDCOUPLING_EXPORT virtual mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0;
+ MEDCOUPLING_EXPORT virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const = 0;
MEDCOUPLING_EXPORT virtual std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const = 0;
- MEDCOUPLING_EXPORT virtual void getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const;
- MEDCOUPLING_EXPORT virtual void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const = 0;
+ MEDCOUPLING_EXPORT virtual void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *getCellIdsFullyIncludedInNodeIds(const mcIdType *partBg, const mcIdType *partEnd) const;
+ MEDCOUPLING_EXPORT virtual void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const = 0;
MEDCOUPLING_EXPORT virtual std::string simpleRepr() const = 0;
MEDCOUPLING_EXPORT virtual std::string advancedRepr() const = 0;
// tools
MEDCOUPLING_EXPORT virtual const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const = 0;
- MEDCOUPLING_EXPORT virtual std::vector<int> getDistributionOfTypes() const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const = 0;
- MEDCOUPLING_EXPORT virtual void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType, bool smartPflKiller=true) const = 0;
+ MEDCOUPLING_EXPORT virtual std::vector<mcIdType> getDistributionOfTypes() const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const = 0;
+ MEDCOUPLING_EXPORT virtual void splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller=true) const = 0;
MEDCOUPLING_EXPORT virtual void getBoundingBox(double *bbox) const = 0;
MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const = 0;
MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const = 0;
- MEDCOUPLING_EXPORT virtual int getCellContainingPoint(const double *pos, double eps) const = 0;
- MEDCOUPLING_EXPORT virtual void getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const = 0;
- MEDCOUPLING_EXPORT virtual void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex) const;
- MEDCOUPLING_EXPORT virtual void getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, int nbOfPoints, double eps, MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex) const;
+ MEDCOUPLING_EXPORT virtual mcIdType getCellContainingPoint(const double *pos, double eps) const = 0;
+ MEDCOUPLING_EXPORT virtual void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const = 0;
+ MEDCOUPLING_EXPORT virtual void getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const;
+ MEDCOUPLING_EXPORT virtual void getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, mcIdType nbOfPoints, double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const;
MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, FunctionToEvaluate func) const;
MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const;
MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const;
MEDCOUPLING_EXPORT virtual void rotate(const double *center, const double *vector, double angle) = 0;
MEDCOUPLING_EXPORT virtual void translate(const double *vector) = 0;
MEDCOUPLING_EXPORT virtual void scale(const double *point, double factor) = 0;
- MEDCOUPLING_EXPORT virtual void renumberCells(const int *old2NewBg, bool check=true) = 0;
+ MEDCOUPLING_EXPORT virtual void renumberCells(const mcIdType *old2NewBg, bool check=true) = 0;
MEDCOUPLING_EXPORT virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const = 0;
- MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPart(const int *start, const int *end) const = 0;
- MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const = 0;
- MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
- MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& arr) const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType*& arr) const;
MEDCOUPLING_EXPORT virtual MEDCouplingUMesh *buildUnstructured() const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *simplexize(int policy) = 0;
- MEDCOUPLING_EXPORT virtual void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *simplexize(int policy) = 0;
+ MEDCOUPLING_EXPORT virtual void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const = 0;
MEDCOUPLING_EXPORT virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
MEDCOUPLING_EXPORT static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
MEDCOUPLING_EXPORT static MEDCouplingMesh *MergeMeshes(std::vector<const MEDCouplingMesh *>& meshes);
MEDCOUPLING_EXPORT static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type);
MEDCOUPLING_EXPORT static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type);
MEDCOUPLING_EXPORT static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type);
- MEDCOUPLING_EXPORT static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
+ MEDCOUPLING_EXPORT static mcIdType GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
MEDCOUPLING_EXPORT static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
MEDCOUPLING_EXPORT static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
//serialisation-unserialization
- MEDCOUPLING_EXPORT virtual void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const = 0;
- MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const = 0;
- MEDCOUPLING_EXPORT virtual void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const = 0;
- MEDCOUPLING_EXPORT virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ MEDCOUPLING_EXPORT virtual void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const = 0;
+ MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const = 0;
+ MEDCOUPLING_EXPORT virtual void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const = 0;
+ MEDCOUPLING_EXPORT virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings) = 0;
MEDCOUPLING_EXPORT std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
MEDCOUPLING_EXPORT std::string getVTKFileNameOf(const std::string& fileName) const;
const MEDCouplingFieldDouble *MEDCouplingMultiFields::getFieldWithId(int id) const
{
- if(id>=(int)_fs.size() || id < 0)
+ if(id>=ToIdType(_fs.size()) || id < 0)
throw INTERP_KERNEL::Exception("MEDCouplingMultiFields::getFieldWithId : invalid id outside boundaries !");
return _fs[id];
}
const MEDCouplingFieldDouble *MEDCouplingMultiFields::getFieldAtPos(int id) const
{
- if(id<0 || id>=(int)_fs.size())
+ if(id<0 || id>=ToIdType(_fs.size()))
{
std::ostringstream oss; oss << "MEDCouplingMultiFields::getFieldAtPos : Invalid given pos : should be >=0 and < " << _fs.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
tmp2[j]=0;
}
_fs[i]->setArrays(tmp2);
- std::vector<int> tinyInfo;
+ std::vector<mcIdType> tinyInfo;
std::vector<double> tinyInfo2;
other._fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationIntInformation2(tinyInfo);
other._fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationDbleInformation2(tinyInfo2);
{
}
-void MEDCouplingMultiFields::getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<double>& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const
+void MEDCouplingMultiFields::getTinySerializationInformation(std::vector<mcIdType>& tinyInfo, std::vector<double>& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const
{
std::vector<int> refs;
std::vector<MEDCouplingMesh *> ms=getDifferentMeshes(refs);
std::vector<DataArrayDouble *> fs=getDifferentArrays(refs2);
nbOfDiffArr=(int)fs.size();
//
- std::size_t sz=refs.size();//==_fs.size()
- int sz2=0;
- for(std::size_t i=0;i<sz;i++)
- sz2+=(int)refs2[i].size();
+ mcIdType sz=ToIdType(refs.size());//==_fs.size()
+ mcIdType sz2=0;
+ for(mcIdType i=0;i<sz;i++)
+ sz2+=ToIdType(refs2[i].size());
//
tinyInfo2.clear();
std::vector<int> doubleDaInd(sz);
std::vector<int> timeDiscrInt;
tinyInfo.resize(sz2+5*sz+3);
- tinyInfo[0]=(int)sz;
+ tinyInfo[0]=sz;
tinyInfo[1]=sz2;
- for(std::size_t i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
{
std::vector<double> tmp;
- std::vector<int> tmp2;
+ std::vector<mcIdType> tmp2;
_fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationDbleInformation2(tmp);
_fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationIntInformation2(tmp2);
- tinyInfo[3*sz+3+i]=(int)tmp.size();
- tinyInfo[4*sz+3+i]=(int)tmp2.size();
+ tinyInfo[3*sz+3+i]=ToIdType(tmp.size());
+ tinyInfo[4*sz+3+i]=ToIdType(tmp2.size());
tinyInfo2.insert(tinyInfo2.end(),tmp.begin(),tmp.end());
timeDiscrInt.insert(timeDiscrInt.end(),tmp2.begin(),tmp2.end());
}
- int sz3=(int)timeDiscrInt.size();
+ mcIdType sz3=ToIdType(timeDiscrInt.size());
tinyInfo[2]=sz3;
//
- for(std::size_t i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
tinyInfo[i+3]=refs[i];
- for(std::size_t i=0;i<sz;i++)
- tinyInfo[i+sz+3]=(int)refs2[i].size();
- for(std::size_t i=0;i<sz;i++)
- tinyInfo[i+2*sz+3]=(int)_fs[i]->getTimeDiscretization();
+ for(mcIdType i=0;i<sz;i++)
+ tinyInfo[i+sz+3]=ToIdType(refs2[i].size());
+ for(mcIdType i=0;i<sz;i++)
+ tinyInfo[i+2*sz+3]=ToIdType(_fs[i]->getTimeDiscretization());
int k=0;
- for(std::size_t i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
for(std::vector<int>::const_iterator it=refs2[i].begin();it!=refs2[i].end();it++,k++)
tinyInfo[5*sz+k+3]=*it;
tinyInfo.insert(tinyInfo.end(),timeDiscrInt.begin(),timeDiscrInt.end());//tinyInfo has lgth==sz3+sz2+5*sz+3
}
-void MEDCouplingMultiFields::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD,
+void MEDCouplingMultiFields::finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD,
const std::vector<MEDCouplingFieldTemplate *>& ft, const std::vector<MEDCouplingMesh *>& ms,
const std::vector<DataArrayDouble *>& das)
{
- int sz=tinyInfoI[0];
+ mcIdType sz=tinyInfoI[0];
_fs.resize(sz);
- int sz2=tinyInfoI[1];
+ mcIdType sz2=tinyInfoI[1];
// dealing with ft with no mesh set.
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
{
- int meshId=tinyInfoI[3+i];
+ mcIdType meshId=tinyInfoI[3+i];
if(meshId!=-1)
ft[i]->setMesh(ms[meshId]);
}
// dealing with fieldtemplate->fielddouble
- int k=0;
- int offI=0;
- int offD=0;
- for(int i=0;i<sz;i++)
+ mcIdType k=0;
+ mcIdType offI=0;
+ mcIdType offD=0;
+ for(mcIdType i=0;i<sz;i++)
{
_fs[i]=MEDCouplingFieldDouble::New(*ft[i],(TypeOfTimeDiscretization)tinyInfoI[2*sz+3+i]);
- int sz3=tinyInfoI[sz+i+3];
+ mcIdType sz3=tinyInfoI[sz+i+3];
std::vector<DataArrayDouble *> tmp(sz3);
- for(int j=0;j<sz3;j++,k++)
+ for(mcIdType j=0;j<sz3;j++,k++)
{
- int daId=tinyInfoI[5*sz+k+3];
+ mcIdType daId=tinyInfoI[5*sz+k+3];
if(daId!=-1)
tmp[j]=das[daId];
else
}
_fs[i]->setArrays(tmp);
// time discr tiny info
- int lgthI=tinyInfoI[4*sz+3+i];
- int lgthD=tinyInfoI[3*sz+3+i];
+ mcIdType lgthI=tinyInfoI[4*sz+3+i];
+ mcIdType lgthD=tinyInfoI[3*sz+3+i];
//
- std::vector<int> tdInfoI(tinyInfoI.begin()+sz2+5*sz+3+offI,tinyInfoI.begin()+sz2+5*sz+3+offI+lgthI);
+ std::vector<mcIdType> tdInfoI(tinyInfoI.begin()+sz2+5*sz+3+offI,tinyInfoI.begin()+sz2+5*sz+3+offI+lgthI);
std::vector<double> tdInfoD(tinyInfoD.begin()+offD,tinyInfoD.begin()+offD+lgthD);
_fs[i]->getTimeDiscretizationUnderGround()->finishUnserialization2(tdInfoI,tdInfoD);
//
#include "MEDCouplingRefCountObject.hxx"
#include "MEDCouplingTimeLabel.hxx"
#include "MCAuto.hxx"
+#include "MCType.hxx"
#include "InterpKernelException.hxx"
MEDCOUPLING_EXPORT void updateTime() const;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<double>& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const;
- MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD,
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<mcIdType>& tinyInfo, std::vector<double>& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const;
+ MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD,
const std::vector<MEDCouplingFieldTemplate *>& ft, const std::vector<MEDCouplingMesh *>& ms,
const std::vector<DataArrayDouble *>& das);
MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const;
public:
static const int MY_SPACEDIM=SPACEDIM;
static const int MY_MESHDIM=SPACEDIM;
- typedef int MyConnType;
+ typedef mcIdType MyConnType;
static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
public:
MEDCouplingNormalizedCartesianMesh(const MEDCoupling::MEDCouplingCMesh *mesh);
//INTERP_KERNEL::NormalizedCellType getTypeOfElement(int eltId) const;
//int getNumberOfNodesOfElement(int eltId) const;
//int getNumberOfNodes() const;
- unsigned long getNumberOfElements() const;
- unsigned long nbCellsAlongAxis(int axis) const;
+ mcIdType getNumberOfElements() const;
+ mcIdType nbCellsAlongAxis(int axis) const;
const double * getCoordsAlongAxis(int axis) const;
~MEDCouplingNormalizedCartesianMesh();
private:
}
template<int SPACEDIM>
-unsigned long MEDCouplingNormalizedCartesianMesh<SPACEDIM>::getNumberOfElements() const
+mcIdType MEDCouplingNormalizedCartesianMesh<SPACEDIM>::getNumberOfElements() const
{
return _mesh->getNumberOfCells();
}
template<int SPACEDIM>
-unsigned long MEDCouplingNormalizedCartesianMesh<SPACEDIM>::nbCellsAlongAxis(int axis) const
+mcIdType MEDCouplingNormalizedCartesianMesh<SPACEDIM>::nbCellsAlongAxis(int axis) const
{
return _mesh->getCoordsAt(axis)->getNumberOfTuples() - 1;
}
#define __PARAMEDMEM_MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_HXX__
#include "NormalizedUnstructuredMesh.hxx"
+#include "MCType.hxx"
namespace MEDCoupling
{
public:
static const int MY_SPACEDIM=SPACEDIM;
static const int MY_MESHDIM=MESHDIM;
- typedef int MyConnType;
+ typedef mcIdType MyConnType;
static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
public:
MEDCouplingNormalizedUnstructuredMesh(const MEDCoupling::MEDCouplingPointSet *mesh);
void getBoundingBox(double *boundingBox) const;
- INTERP_KERNEL::NormalizedCellType getTypeOfElement(int eltId) const;
- int getNumberOfNodesOfElement(int eltId) const;
- int getNumberOfElements() const;
- int getNumberOfNodes() const;
- const int *getConnectivityPtr() const;
+ INTERP_KERNEL::NormalizedCellType getTypeOfElement(mcIdType eltId) const;
+ mcIdType getNumberOfNodesOfElement(mcIdType eltId) const;
+ mcIdType getNumberOfElements() const;
+ mcIdType getNumberOfNodes() const;
+ const mcIdType *getConnectivityPtr() const;
const double *getCoordinatesPtr() const;
- const int *getConnectivityIndexPtr() const;
+ const mcIdType *getConnectivityIndexPtr() const;
void releaseTempArrays();
~MEDCouplingNormalizedUnstructuredMesh();
private:
void prepare();
private:
const MEDCoupling::MEDCouplingPointSet *_mesh;
- int *_conn_for_interp;
- int *_conn_index_for_interp;
+ mcIdType *_conn_for_interp;
+ mcIdType *_conn_index_for_interp;
};
#endif
}
const MEDCoupling::DataArrayDouble *array=_mesh->getCoords();
const double *ptr=array->getConstPointer();
- int nbOfPts=array->getNbOfElems()/SPACEDIM;
+ mcIdType nbOfPts=ToIdType(array->getNbOfElems())/SPACEDIM;
for(int j=0;j<SPACEDIM;j++)
{
const double *work=ptr+j;
- for(int i=0;i<nbOfPts;i++,work+=SPACEDIM)
+ for(mcIdType i=0;i<nbOfPts;i++,work+=SPACEDIM)
{
if(boundingBox[j]>*work)
boundingBox[j]=*work;
}
template<int SPACEDIM,int MESHDIM>
-INTERP_KERNEL::NormalizedCellType MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getTypeOfElement(int eltId) const
+INTERP_KERNEL::NormalizedCellType MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getTypeOfElement(mcIdType eltId) const
{
return _mesh->getTypeOfCell(eltId);
}
template<int SPACEDIM,int MESHDIM>
-int MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfNodesOfElement(int eltId) const
+mcIdType MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfNodesOfElement(mcIdType eltId) const
{
return _mesh->getNumberOfNodesInCell(eltId);
}
template<int SPACEDIM,int MESHDIM>
-int MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfElements() const
+mcIdType MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfElements() const
{
- return _mesh->getNumberOfCells();
+ return ToIdType(_mesh->getNumberOfCells());
}
template<int SPACEDIM,int MESHDIM>
-int MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfNodes() const
+mcIdType MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfNodes() const
{
return _mesh->getNumberOfNodes();
}
template<int SPACEDIM,int MESHDIM>
-const int *MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getConnectivityPtr() const
+const mcIdType *MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getConnectivityPtr() const
{
return _conn_for_interp;
}
}
template<int SPACEDIM,int MESHDIM>
-const int *MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getConnectivityIndexPtr() const
+const mcIdType *MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getConnectivityIndexPtr() const
{
return _conn_index_for_interp;
}
const MEDCoupling::MEDCouplingUMesh *m1(dynamic_cast<const MEDCoupling::MEDCouplingUMesh *>(_mesh));
if(m1)
{
- int nbOfCell=m1->getNumberOfCells();
- int initialConnSize=m1->getNodalConnectivity()->getNbOfElems();
- _conn_for_interp=new int[initialConnSize-nbOfCell];
- _conn_index_for_interp=new int[nbOfCell+1];
+ mcIdType nbOfCell=ToIdType(m1->getNumberOfCells());
+ mcIdType initialConnSize=ToIdType(m1->getNodalConnectivity()->getNbOfElems());
+ _conn_for_interp=new mcIdType[initialConnSize-nbOfCell];
+ _conn_index_for_interp=new mcIdType[nbOfCell+1];
_conn_index_for_interp[0]=0;
- const int *work_conn=m1->getNodalConnectivity()->getConstPointer()+1;
- const int *work_conn_index=m1->getNodalConnectivityIndex()->getConstPointer();
- int *work_conn_for_interp=_conn_for_interp;
- int *work_conn_index_for_interp=_conn_index_for_interp;
- for(int i=0;i<nbOfCell;i++)
+ const mcIdType *work_conn=m1->getNodalConnectivity()->getConstPointer()+1;
+ const mcIdType *work_conn_index=m1->getNodalConnectivityIndex()->getConstPointer();
+ mcIdType *work_conn_for_interp=_conn_for_interp;
+ mcIdType *work_conn_index_for_interp=_conn_index_for_interp;
+ for(mcIdType i=0;i<nbOfCell;i++)
{
- int nbOfValsToCopy=work_conn_index[1]-work_conn_index[0]-1;
+ mcIdType nbOfValsToCopy=work_conn_index[1]-work_conn_index[0]-1;
work_conn_for_interp=std::copy(work_conn,work_conn+nbOfValsToCopy,work_conn_for_interp);
work_conn_index_for_interp[1]=work_conn_index_for_interp[0]+nbOfValsToCopy;
work_conn_index++;
const MEDCoupling::MEDCoupling1DGTUMesh *m2(dynamic_cast<const MEDCoupling::MEDCoupling1DGTUMesh *>(_mesh));
if(m2)
{
- int nbOfCell(m2->getNumberOfCells());
- _conn_index_for_interp=new int[nbOfCell+1];
- const int *conni(m2->getNodalConnectivityIndex()->begin());
+ mcIdType nbOfCell=ToIdType(m2->getNumberOfCells());
+ _conn_index_for_interp=new mcIdType[nbOfCell+1];
+ const mcIdType *conni(m2->getNodalConnectivityIndex()->begin());
std::copy(conni,conni+nbOfCell+1,_conn_index_for_interp);
- _conn_for_interp=new int[m2->getNodalConnectivity()->getNumberOfTuples()];
+ _conn_for_interp=new mcIdType[m2->getNodalConnectivity()->getNumberOfTuples()];
std::copy(m2->getNodalConnectivity()->begin(),m2->getNodalConnectivity()->end(),_conn_for_interp);
return ;
}
const MEDCoupling::MEDCoupling1SGTUMesh *m3(dynamic_cast<const MEDCoupling::MEDCoupling1SGTUMesh *>(_mesh));
if(m3)
{
- int nbOfCell(m3->getNumberOfCells()),nbNodesPerCell(m3->getNumberOfNodesPerCell());
- _conn_index_for_interp=new int[nbOfCell+1]; _conn_index_for_interp[0]=0;
- int *work(_conn_index_for_interp);
- for(int i=0;i<nbOfCell;i++,work++)
+ mcIdType nbOfCell=ToIdType(m3->getNumberOfCells()),nbNodesPerCell(m3->getNumberOfNodesPerCell());
+ _conn_index_for_interp=new mcIdType[nbOfCell+1]; _conn_index_for_interp[0]=0;
+ mcIdType *work(_conn_index_for_interp);
+ for(mcIdType i=0;i<nbOfCell;i++,work++)
work[1]=work[0]+nbNodesPerCell;
- _conn_for_interp=new int[m3->getNodalConnectivity()->getNumberOfTuples()];
+ _conn_for_interp=new mcIdType[m3->getNodalConnectivity()->getNumberOfTuples()];
std::copy(m3->getNodalConnectivity()->begin(),m3->getNodalConnectivity()->end(),_conn_for_interp);
return ;
}
using namespace MEDCoupling;
-PartDefinition *PartDefinition::New(int start, int stop, int step)
+PartDefinition *PartDefinition::New(mcIdType start, mcIdType stop, mcIdType step)
{
return SlicePartDefinition::New(start,stop,step);
}
-PartDefinition *PartDefinition::New(DataArrayInt *listOfIds)
+PartDefinition *PartDefinition::New(DataArrayIdType *listOfIds)
{
return DataArrayPartDefinition::New(listOfIds);
}
-PartDefinition *PartDefinition::Unserialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI)
+PartDefinition *PartDefinition::Unserialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI)
{
if(tinyInt.empty())
{
{
}
-DataArrayPartDefinition *DataArrayPartDefinition::New(DataArrayInt *listOfIds)
+DataArrayPartDefinition *DataArrayPartDefinition::New(DataArrayIdType *listOfIds)
{
return new DataArrayPartDefinition(listOfIds);
}
what="DataArrayPartDefinition::isEqual : other is not DataArrayPartDefinition !";
return false;
}
- const DataArrayInt *arr0(_arr),*arr1(otherC->_arr);
+ const DataArrayIdType *arr0(_arr),*arr1(otherC->_arr);
if(!arr0 && !arr1)
return true;
if((arr0 && !arr1) || (!arr0 && arr1))
DataArrayPartDefinition *DataArrayPartDefinition::deepCopy() const
{
- const DataArrayInt *arr(_arr);
+ const DataArrayIdType *arr(_arr);
if(!arr)
throw INTERP_KERNEL::Exception("DataArrayPartDefinition::deepCopy : array is null !");
- return DataArrayPartDefinition::New(const_cast<DataArrayInt *>(arr));
+ return DataArrayPartDefinition::New(const_cast<DataArrayIdType *>(arr));
}
-int DataArrayPartDefinition::getNumberOfElems() const
+mcIdType DataArrayPartDefinition::getNumberOfElems() const
{
checkInternalArrayOK();
return _arr->getNumberOfTuples();
std::string DataArrayPartDefinition::getRepr() const
{
std::ostringstream oss; oss << "DataArray Part : ";
- const DataArrayInt *arr(_arr);
+ const DataArrayIdType *arr(_arr);
if(arr)
arr->reprQuickOverview(oss);
else
const SlicePartDefinition *spd(dynamic_cast<const SlicePartDefinition *>(other));
if(spd)
{//special case for optim
- int a(0),b(0),c(0);
+ mcIdType a(0),b(0),c(0);
spd->getSlice(a,b,c);
if(c==1)
{
- MCAuto<DataArrayInt> arr(DataArrayInt::New());
+ MCAuto<DataArrayIdType> arr(DataArrayIdType::New());
arr->alloc(_arr->getNumberOfTuples(),1);
- std::transform(_arr->begin(),_arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),a));
+ std::transform(_arr->begin(),_arr->end(),arr->getPointer(),std::bind2nd(std::plus<mcIdType>(),a));
return DataArrayPartDefinition::New(arr);
}
}
//
- MCAuto<DataArrayInt> arr1(other->toDAI());
- MCAuto<DataArrayInt> arr2(arr1->selectByTupleIdSafe(_arr->begin(),_arr->end()));
+ MCAuto<DataArrayIdType> arr1(other->toDAI());
+ MCAuto<DataArrayIdType> arr2(arr1->selectByTupleIdSafe(_arr->begin(),_arr->end()));
return DataArrayPartDefinition::New(arr2);
}
PartDefinition *DataArrayPartDefinition::tryToSimplify() const
{
checkConsistencyLight();
- int a(0),b(0),c(0);
+ mcIdType a(0),b(0),c(0);
if(_arr->isRange(a,b,c))
{
return SlicePartDefinition::New(a,b,c);
}
}
-void DataArrayPartDefinition::serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const
+void DataArrayPartDefinition::serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const
{
bigArraysI.push_back(_arr);
}
-DataArrayInt *DataArrayPartDefinition::toDAI() const
+DataArrayIdType *DataArrayPartDefinition::toDAI() const
{
checkInternalArrayOK();
- const DataArrayInt *arr(_arr);
- DataArrayInt *arr2(const_cast<DataArrayInt *>(arr));
+ const DataArrayIdType *arr(_arr);
+ DataArrayIdType *arr2(const_cast<DataArrayIdType *>(arr));
arr2->incrRef();
return arr2;
}
-DataArrayPartDefinition::DataArrayPartDefinition(DataArrayInt *listOfIds)
+DataArrayPartDefinition::DataArrayPartDefinition(DataArrayIdType *listOfIds)
{
CheckInternalArrayOK(listOfIds);
_arr=listOfIds;
CheckInternalArrayOK(_arr);
}
-void DataArrayPartDefinition::CheckInternalArrayOK(const DataArrayInt *listOfIds)
+void DataArrayPartDefinition::CheckInternalArrayOK(const DataArrayIdType *listOfIds)
{
if(!listOfIds || !listOfIds->isAllocated() || listOfIds->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayPartDefinition::CheckInternalArrayOK : Input list must be not null allocated and with one components !");
void DataArrayPartDefinition::updateTime() const
{
- if((const DataArrayInt *)_arr)
+ if((const DataArrayIdType *)_arr)
updateTimeWith(*_arr);
}
std::vector<const BigMemoryObject *> DataArrayPartDefinition::getDirectChildrenWithNull() const
{
- std::vector<const BigMemoryObject *> ret(1,(const DataArrayInt *)_arr);
+ std::vector<const BigMemoryObject *> ret(1,(const DataArrayIdType *)_arr);
return ret;
}
DataArrayPartDefinition *DataArrayPartDefinition::add1(const DataArrayPartDefinition *other) const
{
- MCAuto<DataArrayInt> a1(toDAI()),a2(other->toDAI());
- MCAuto<DataArrayInt> a3(DataArrayInt::Aggregate(a1,a2,0));
+ MCAuto<DataArrayIdType> a1(toDAI()),a2(other->toDAI());
+ MCAuto<DataArrayIdType> a3(DataArrayIdType::Aggregate(a1,a2,0));
a3->sort();
return DataArrayPartDefinition::New(a3);
}
DataArrayPartDefinition *DataArrayPartDefinition::add2(const SlicePartDefinition *other) const
{
- MCAuto<DataArrayInt> a1(toDAI()),a2(other->toDAI());
- MCAuto<DataArrayInt> a3(DataArrayInt::Aggregate(a1,a2,0));
+ MCAuto<DataArrayIdType> a1(toDAI()),a2(other->toDAI());
+ MCAuto<DataArrayIdType> a3(DataArrayIdType::Aggregate(a1,a2,0));
a3->sort();
return DataArrayPartDefinition::New(a3);
}
{
}
-SlicePartDefinition *SlicePartDefinition::New(int start, int stop, int step)
+SlicePartDefinition *SlicePartDefinition::New(mcIdType start, mcIdType stop, mcIdType step)
{
return new SlicePartDefinition(start,stop,step);
}
return SlicePartDefinition::New(_start,_stop,_step);
}
-DataArrayInt *SlicePartDefinition::toDAI() const
+DataArrayIdType *SlicePartDefinition::toDAI() const
{
- return DataArrayInt::Range(_start,_stop,_step);
+ return DataArrayIdType::Range(_start,_stop,_step);
}
-int SlicePartDefinition::getNumberOfElems() const
+mcIdType SlicePartDefinition::getNumberOfElems() const
{
return DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getNumberOfElems");
}
throw INTERP_KERNEL::Exception("SlicePartDefinition::composeWith : input PartDef must be not NULL !");
checkConsistencyLight();
other->checkConsistencyLight();
- MCAuto<DataArrayInt> arr(other->toDAI());
- MCAuto<DataArrayInt> arr1(arr->selectByTupleIdSafeSlice(_start,_stop,_step));
+ MCAuto<DataArrayIdType> arr(other->toDAI());
+ MCAuto<DataArrayIdType> arr1(arr->selectByTupleIdSafeSlice(_start,_stop,_step));
return DataArrayPartDefinition::New(arr1);
}
return ret;
}
-void SlicePartDefinition::serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const
+void SlicePartDefinition::serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const
{
tinyInt.push_back(_start);
tinyInt.push_back(_stop);
return oss.str();
}
-int SlicePartDefinition::getEffectiveStop() const
+mcIdType SlicePartDefinition::getEffectiveStop() const
{
- int nbElems(DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getEffectiveStop"));
+ mcIdType nbElems(DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getEffectiveStop"));
return _start+nbElems*_step;
}
-void SlicePartDefinition::getSlice(int& start, int& stop, int& step) const
+void SlicePartDefinition::getSlice(mcIdType& start, mcIdType& stop, mcIdType& step) const
{
start=_start;
stop=_stop;
step=_step;
}
-SlicePartDefinition::SlicePartDefinition(int start, int stop, int step):_start(start),_stop(stop),_step(step)
+SlicePartDefinition::SlicePartDefinition(mcIdType start, mcIdType stop, mcIdType step):_start(start),_stop(stop),_step(step)
{
}
DataArrayPartDefinition *SlicePartDefinition::add1(const DataArrayPartDefinition *other) const
{
- MCAuto<DataArrayInt> a1(toDAI()),a2(other->toDAI());
- MCAuto<DataArrayInt> a3(DataArrayInt::Aggregate(a1,a2,0));
+ MCAuto<DataArrayIdType> a1(toDAI()),a2(other->toDAI());
+ MCAuto<DataArrayIdType> a3(DataArrayIdType::Aggregate(a1,a2,0));
a3->sort();
return DataArrayPartDefinition::New(a3);
}
}
else
{
- MCAuto<DataArrayInt> a1(toDAI()),a2(other->toDAI());
- MCAuto<DataArrayInt> a3(DataArrayInt::Aggregate(a1,a2,0));
+ MCAuto<DataArrayIdType> a1(toDAI()),a2(other->toDAI());
+ MCAuto<DataArrayIdType> a3(DataArrayIdType::Aggregate(a1,a2,0));
a3->sort();
return DataArrayPartDefinition::New(a3);
}
class PartDefinition : public RefCountObject, public TimeLabel
{
public:
- MEDCOUPLING_EXPORT static PartDefinition *New(int start, int stop, int step);
- MEDCOUPLING_EXPORT static PartDefinition *New(DataArrayInt *listOfIds);
- MEDCOUPLING_EXPORT static PartDefinition *Unserialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI);
+ MEDCOUPLING_EXPORT static PartDefinition *New(mcIdType start, mcIdType stop, mcIdType step);
+ MEDCOUPLING_EXPORT static PartDefinition *New(DataArrayIdType *listOfIds);
+ MEDCOUPLING_EXPORT static PartDefinition *Unserialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI);
MEDCOUPLING_EXPORT virtual bool isEqual(const PartDefinition *other, std::string& what) const = 0;
MEDCOUPLING_EXPORT virtual PartDefinition *deepCopy() const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *toDAI() const = 0;
- MEDCOUPLING_EXPORT virtual int getNumberOfElems() const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *toDAI() const = 0;
+ MEDCOUPLING_EXPORT virtual mcIdType getNumberOfElems() const = 0;
MEDCOUPLING_EXPORT virtual PartDefinition *operator+(const PartDefinition& other) const = 0;
MEDCOUPLING_EXPORT virtual std::string getRepr() const = 0;
MEDCOUPLING_EXPORT virtual PartDefinition *composeWith(const PartDefinition *other) const = 0;
MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const = 0;
MEDCOUPLING_EXPORT virtual PartDefinition *tryToSimplify() const = 0;
- MEDCOUPLING_EXPORT virtual void serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const = 0;
+ MEDCOUPLING_EXPORT virtual void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const = 0;
protected:
virtual ~PartDefinition();
};
class DataArrayPartDefinition : public PartDefinition
{
public:
- MEDCOUPLING_EXPORT static DataArrayPartDefinition *New(DataArrayInt *listOfIds);
+ MEDCOUPLING_EXPORT static DataArrayPartDefinition *New(DataArrayIdType *listOfIds);
MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const;
MEDCOUPLING_EXPORT DataArrayPartDefinition *deepCopy() const;
- MEDCOUPLING_EXPORT DataArrayInt *toDAI() const;
- MEDCOUPLING_EXPORT int getNumberOfElems() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *toDAI() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const;
MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const;
MEDCOUPLING_EXPORT std::string getRepr() const;
MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const;
MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const;
- MEDCOUPLING_EXPORT void serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const;
+ MEDCOUPLING_EXPORT void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const;
private:
- DataArrayPartDefinition(DataArrayInt *listOfIds);
+ DataArrayPartDefinition(DataArrayIdType *listOfIds);
void checkInternalArrayOK() const;
- static void CheckInternalArrayOK(const DataArrayInt *listOfIds);
+ static void CheckInternalArrayOK(const DataArrayIdType *listOfIds);
MEDCOUPLING_EXPORT void updateTime() const;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
class SlicePartDefinition : public PartDefinition
{
public:
- MEDCOUPLING_EXPORT static SlicePartDefinition *New(int start, int stop, int step);
+ MEDCOUPLING_EXPORT static SlicePartDefinition *New(mcIdType start, mcIdType stop, mcIdType step);
MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const;
MEDCOUPLING_EXPORT SlicePartDefinition *deepCopy() const;
- MEDCOUPLING_EXPORT DataArrayInt *toDAI() const;
- MEDCOUPLING_EXPORT int getNumberOfElems() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *toDAI() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const;
MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const;
MEDCOUPLING_EXPORT std::string getRepr() const;
MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const;
MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const;
- MEDCOUPLING_EXPORT void serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const;
+ MEDCOUPLING_EXPORT void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const;
//specific method
- MEDCOUPLING_EXPORT int getEffectiveStop() const;
- MEDCOUPLING_EXPORT void getSlice(int& start, int& stop, int& step) const;
+ MEDCOUPLING_EXPORT mcIdType getEffectiveStop() const;
+ MEDCOUPLING_EXPORT void getSlice(mcIdType& start, mcIdType& stop, mcIdType& step) const;
private:
- SlicePartDefinition(int start, int stop, int step);
+ SlicePartDefinition(mcIdType start, mcIdType stop, mcIdType step);
MEDCOUPLING_EXPORT void updateTime() const;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
_coords->decrRef();
}
-int MEDCouplingPointSet::getNumberOfNodes() const
+mcIdType MEDCouplingPointSet::getNumberOfNodes() const
{
if(_coords)
return _coords->getNumberOfTuples();
int MEDCouplingPointSet::getSpaceDimension() const
{
if(_coords)
- return _coords->getNumberOfComponents();
+ return (int)_coords->getNumberOfComponents();
else
throw INTERP_KERNEL::Exception("Unable to get space dimension because no coordinates specified !");
}
* \ref py_mcpointset_getcoordinatesofnode "Here is a Python example".
* \endif
*/
-void MEDCouplingPointSet::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
+void MEDCouplingPointSet::getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const
{
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCoordinatesOfNode : no coordinates array set !");
- int nbNodes=getNumberOfNodes();
+ mcIdType nbNodes=getNumberOfNodes();
if(nodeId>=0 && nodeId<nbNodes)
{
const double *cooPtr=_coords->getConstPointer();
- int spaceDim=getSpaceDimension();
+ std::size_t spaceDim=getSpaceDimension();
coo.insert(coo.end(),cooPtr+spaceDim*nodeId,cooPtr+spaceDim*(nodeId+1));
}
else
* returned. Put -1 to this parameter to have all nodes returned.
* \param [out] areNodesMerged - is set to \a true if any coincident nodes found.
* \param [out] newNbOfNodes - returns number of unique nodes.
- * \return DataArrayInt * - the permutation array in "Old to New" mode. For more
+ * \return DataArrayIdType * - the permutation array in "Old to New" mode. For more
* info on "Old to New" mode see \ref numbering. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the coordinates array is not set.
*/
-DataArrayInt *MEDCouplingPointSet::buildPermArrayForMergeNode(double precision, int limitNodeId, bool& areNodesMerged, int& newNbOfNodes) const
+DataArrayIdType *MEDCouplingPointSet::buildPermArrayForMergeNode(double precision, mcIdType limitNodeId, bool& areNodesMerged, mcIdType& newNbOfNodes) const
{
- DataArrayInt *comm,*commI;
+ DataArrayIdType *comm,*commI;
findCommonNodes(precision,limitNodeId,comm,commI);
- int oldNbOfNodes=getNumberOfNodes();
- MCAuto<DataArrayInt> ret=buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes);
+ mcIdType oldNbOfNodes=getNumberOfNodes();
+ MCAuto<DataArrayIdType> ret=buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes);
areNodesMerged=(oldNbOfNodes!=newNbOfNodes);
comm->decrRef();
commI->decrRef();
* \ref py_mcpointset_findcommonnodes "Here is a Python example".
* \endif
*/
-void MEDCouplingPointSet::findCommonNodes(double prec, int limitNodeId, DataArrayInt *&comm, DataArrayInt *&commIndex) const
+void MEDCouplingPointSet::findCommonNodes(double prec, mcIdType limitNodeId, DataArrayIdType *&comm, DataArrayIdType *&commIndex) const
{
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findCommonNodes : no coords specified !");
* behavior is not warranted.
* \param [in] eps - the lowest distance between a point and a node (using infinite norm) at which the node is
* not returned by this method.
- * \return DataArrayInt * - a new instance of DataArrayInt holding ids of nodes
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of nodes
* close to the point. The caller is to delete this
* array using decrRef() as it is no more needed.
* \throw If the coordinates array is not set.
* \ref py_mcpointset_getnodeidsnearpoint "Here is a Python example".
* \endif
*/
-DataArrayInt *MEDCouplingPointSet::getNodeIdsNearPoint(const double *pos, double eps) const
+DataArrayIdType *MEDCouplingPointSet::getNodeIdsNearPoint(const double *pos, double eps) const
{
- DataArrayInt *c=0,*cI=0;
+ DataArrayIdType *c=0,*cI=0;
getNodeIdsNearPoints(pos,1,eps,c,cI);
- MCAuto<DataArrayInt> cITmp(cI);
+ MCAuto<DataArrayIdType> cITmp(cI);
return c;
}
* \ref py_mcpointset_getnodeidsnearpoints "Here is a Python example".
* \endif
*/
-void MEDCouplingPointSet::getNodeIdsNearPoints(const double *pos, int nbOfPoints, double eps, DataArrayInt *& c, DataArrayInt *& cI) const
+void MEDCouplingPointSet::getNodeIdsNearPoints(const double *pos, mcIdType nbOfPoints, double eps, DataArrayIdType *& c, DataArrayIdType *& cI) const
{
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getNodeIdsNearPoint : no coordiantes set !");
- int spaceDim=getSpaceDimension();
+ std::size_t spaceDim=getSpaceDimension();
MCAuto<DataArrayDouble> points=DataArrayDouble::New();
points->useArray(pos,false,DeallocType::CPP_DEALLOC,nbOfPoints,spaceDim);
_coords->computeTupleIdsNearTuples(points,eps,c,cI);
* @param commI in param in the same format than one returned by findCommonNodes method (\ref numbering-indirect).
* @return the old to new correspondence array.
*/
-DataArrayInt *MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex,
- int& newNbOfNodes) const
+DataArrayIdType *MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex,
+ mcIdType& newNbOfNodes) const
{
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat : no coords specified !");
- return DataArrayInt::ConvertIndexArrayToO2N(getNumberOfNodes(),comm->begin(),commIndex->begin(),commIndex->end(),newNbOfNodes);
+ return DataArrayIdType::ConvertIndexArrayToO2N(getNumberOfNodes(),comm->begin(),commIndex->begin(),commIndex->end(),newNbOfNodes);
}
/*!
* \ref py_mcumesh_renumberNodes "Here is a Python example".
* \endif
*/
-void MEDCouplingPointSet::renumberNodes(const int *newNodeNumbers, int newNbOfNodes)
+void MEDCouplingPointSet::renumberNodes(const mcIdType *newNodeNumbers, mcIdType newNbOfNodes)
{
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::renumberNodes : no coords specified !");
* \ref py_mcumesh_renumberNodes "Here is a Python example".
* \endif
*/
-void MEDCouplingPointSet::renumberNodesCenter(const int *newNodeNumbers, int newNbOfNodes)
+void MEDCouplingPointSet::renumberNodesCenter(const mcIdType *newNodeNumbers, mcIdType newNbOfNodes)
{
DataArrayDouble *newCoords=DataArrayDouble::New();
- std::vector<int> div(newNbOfNodes);
- int spaceDim=getSpaceDimension();
+ std::vector<mcIdType> div(newNbOfNodes);
+ std::size_t spaceDim=getSpaceDimension();
newCoords->alloc(newNbOfNodes,spaceDim);
newCoords->copyStringInfoFrom(*_coords);
newCoords->fillWithZero();
- int oldNbOfNodes=getNumberOfNodes();
+ mcIdType oldNbOfNodes=getNumberOfNodes();
double *ptToFill=newCoords->getPointer();
const double *oldCoordsPtr=_coords->getConstPointer();
- for(int i=0;i<oldNbOfNodes;i++)
+ for(mcIdType i=0;i<oldNbOfNodes;i++)
{
std::transform(oldCoordsPtr+i*spaceDim,oldCoordsPtr+(i+1)*spaceDim,ptToFill+newNodeNumbers[i]*spaceDim,
ptToFill+newNodeNumbers[i]*spaceDim,std::plus<double>());
div[newNodeNumbers[i]]++;
}
- for(int i=0;i<newNbOfNodes;i++)
+ for(mcIdType i=0;i<newNbOfNodes;i++)
ptToFill=std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind2nd(std::multiplies<double>(),1./(double)div[i]));
setCoords(newCoords);
newCoords->decrRef();
void MEDCouplingPointSet::zipCoords()
{
checkFullyDefined();
- DataArrayInt *traducer=zipCoordsTraducer();
+ DataArrayIdType *traducer=zipCoordsTraducer();
traducer->decrRef();
}
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCaracteristicDimension : Coordinates not set !");
const double *coords=_coords->getConstPointer();
- int nbOfValues=_coords->getNbOfElems();
+ std::size_t nbOfValues=_coords->getNbOfElems();
return std::abs(*std::max_element(coords,coords+nbOfValues,MEDCouplingCompAbs()));
}
*/
void MEDCouplingPointSet::rotate(const double *center, const double *vector, double angle)
{
- int spaceDim=getSpaceDimension();
+ std::size_t spaceDim=getSpaceDimension();
if(spaceDim==3)
rotate3D(center,vector,angle);
else if(spaceDim==2)
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::translate : no coordinates set !");
double *coords=_coords->getPointer();
- int nbNodes=getNumberOfNodes();
- int dim=getSpaceDimension();
- for(int i=0; i<nbNodes; i++)
- for(int idim=0; idim<dim;idim++)
+ mcIdType nbNodes=getNumberOfNodes();
+ std::size_t dim=getSpaceDimension();
+ for(mcIdType i=0; i<nbNodes; i++)
+ for(std::size_t idim=0; idim<dim;idim++)
coords[i*dim+idim]+=vector[idim];
_coords->declareAsNew();
updateTime();
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::scale : no coordinates set !");
double *coords=_coords->getPointer();
- int nbNodes=getNumberOfNodes();
- int dim=getSpaceDimension();
- for(int i=0;i<nbNodes;i++)
+ mcIdType nbNodes=getNumberOfNodes();
+ std::size_t dim=getSpaceDimension();
+ for(mcIdType i=0;i<nbNodes;i++)
{
std::transform(coords+i*dim,coords+(i+1)*dim,point,coords+i*dim,std::minus<double>());
std::transform(coords+i*dim,coords+(i+1)*dim,coords+i*dim,std::bind2nd(std::multiplies<double>(),factor));
* \param [in] nodeIdsToDuplicateBg begin of node ids (included) to be duplicated in connectivity only
* \param [in] nodeIdsToDuplicateEnd end of node ids (excluded) to be duplicated in connectivity only
*/
-void MEDCouplingPointSet::duplicateNodesInCoords(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd)
+void MEDCouplingPointSet::duplicateNodesInCoords(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd)
{
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : no coords set !");
* \throw If the magnitude of \a vec is zero.
* \throw If \a this->getSpaceDimension() != 3.
*/
-void MEDCouplingPointSet::findNodesOnPlane(const double *pt, const double *vec, double eps, std::vector<int>& nodes) const
+void MEDCouplingPointSet::findNodesOnPlane(const double *pt, const double *vec, double eps, std::vector<mcIdType>& nodes) const
{
if(getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : Invalid spacedim to be applied on this ! Must be equal to 3 !");
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : NULL point pointer specified !");
if(!vec)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : NULL vector pointer specified !");
- int nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfNodes=getNumberOfNodes();
double a=vec[0],b=vec[1],c=vec[2],d=-pt[0]*vec[0]-pt[1]*vec[1]-pt[2]*vec[2];
double deno=sqrt(a*a+b*b+c*c);
if(deno<std::numeric_limits<double>::min())
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : vector pointer specified has norm equal to 0. !");
const double *work=_coords->getConstPointer();
- for(int i=0;i<nbOfNodes;i++)
+ for(mcIdType i=0;i<nbOfNodes;i++)
{
if(std::abs(a*work[0]+b*work[1]+c*work[2]+d)/deno<eps)
nodes.push_back(i);
* \throw If the magnitude of \a vec is zero.
* \throw If ( \a this->getSpaceDimension() != 3 && \a this->getSpaceDimension() != 2 ).
*/
-void MEDCouplingPointSet::findNodesOnLine(const double *pt, const double *vec, double eps, std::vector<int>& nodes) const
+void MEDCouplingPointSet::findNodesOnLine(const double *pt, const double *vec, double eps, std::vector<mcIdType>& nodes) const
{
- int spaceDim=getSpaceDimension();
+ std::size_t spaceDim=getSpaceDimension();
if(spaceDim!=2 && spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnLine : Invalid spacedim to be applied on this ! Must be equal to 2 or 3 !");
if(!pt)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnLine : NULL point pointer specified !");
if(!vec)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnLine : NULL vector pointer specified !");
- int nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfNodes=getNumberOfNodes();
double den=0.;
- for(int i=0;i<spaceDim;i++)
+ for(std::size_t i=0;i<spaceDim;i++)
den+=vec[i]*vec[i];
double deno=sqrt(den);
if(deno<10.*eps)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnLine : Invalid given direction vector ! Norm is too small !");
INTERP_KERNEL::AutoPtr<double> vecn=new double[spaceDim];
- for(int i=0;i<spaceDim;i++)
+ for(std::size_t i=0;i<spaceDim;i++)
vecn[i]=vec[i]/deno;
const double *work=_coords->getConstPointer();
if(spaceDim==2)
{
- for(int i=0;i<nbOfNodes;i++)
+ for(mcIdType i=0;i<nbOfNodes;i++)
{
if(std::abs(vecn[0]*(work[1]-pt[1])-vecn[1]*(work[0]-pt[0]))<eps)
nodes.push_back(i);
}
else
{
- for(int i=0;i<nbOfNodes;i++)
+ for(mcIdType i=0;i<nbOfNodes;i++)
{
double a=vecn[0]*(work[1]-pt[1])-vecn[1]*(work[0]-pt[0]);
double b=vecn[1]*(work[2]-pt[2])-vecn[2]*(work[1]-pt[1]);
/*!
* First step of serialization process. Used by ParaMEDMEM and MEDCouplingCorba to transfert data between process.
*/
-void MEDCouplingPointSet::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+void MEDCouplingPointSet::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
{
int it,order;
double time=getTime(it,order);
/*!
* Third and final step of serialization process.
*/
-void MEDCouplingPointSet::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
+void MEDCouplingPointSet::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const
{
if(_coords)
{
* Second step of serialization process.
* @param tinyInfo must be equal to the result given by getTinySerializationInformation method.
*/
-void MEDCouplingPointSet::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
+void MEDCouplingPointSet::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
if(tinyInfo[2]>=0 && tinyInfo[1]>=1)
{
* Second and final unserialization process.
* @param tinyInfo must be equal to the result given by getTinySerializationInformation method.
*/
-void MEDCouplingPointSet::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
+void MEDCouplingPointSet::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
{
if(tinyInfo[2]>=0 && tinyInfo[1]>=1)
{
setDescription(littleStrings[1]);
a2->setName(littleStrings[2]);
setTimeUnit(littleStrings[3]);
- for(int i=0;i<tinyInfo[1];i++)
+ for(mcIdType i=0;i<tinyInfo[1];i++)
getCoords()->setInfoOnComponent(i,littleStrings[i+4]);
- setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]);
+ setTime(tinyInfoD[0],FromIdType<int>(tinyInfo[3]),FromIdType<int>(tinyInfo[4]));
}
else
{
setName(littleStrings[0]);
setDescription(littleStrings[1]);
setTimeUnit(littleStrings[2]);
- setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]);
+ setTime(tinyInfoD[0],FromIdType<int>(tinyInfo[3]),FromIdType<int>(tinyInfo[4]));
}
}
void MEDCouplingPointSet::rotate3D(const double *center, const double *vect, double angle)
{
double *coords(_coords->getPointer());
- int nbNodes(getNumberOfNodes());
+ mcIdType nbNodes(getNumberOfNodes());
DataArrayDouble::Rotate3DAlg(center,vect,angle,nbNodes,coords,coords);
}
* \param [in] srcMesh - source mesh
* \param [in] trgMesh - target mesh
* \param [in] eps - precision of the detection
- * \return DataArrayInt * - An array that gives for each cell of \a trgMesh, how many cells in \a srcMesh (regarding the precision of detection \a eps) can interacts.
+ * \return DataArrayIdType * - An array that gives for each cell of \a trgMesh, how many cells in \a srcMesh (regarding the precision of detection \a eps) can interacts.
*
* \throw If \a srcMesh and \a trgMesh have not the same space dimension.
*/
-DataArrayInt *MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps)
+DataArrayIdType *MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps)
{
if(!srcMesh || !trgMesh)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells : the input meshes must be not NULL !");
* \return MEDCouplingMesh * - a new instance of MEDCouplingMesh. The caller is to
* delete this mesh using decrRef() as it is no more needed.
*/
-MEDCouplingMesh *MEDCouplingPointSet::buildPart(const int *start, const int *end) const
+MEDCouplingMesh *MEDCouplingPointSet::buildPart(const mcIdType *start, const mcIdType *end) const
{
return buildPartOfMySelf(start,end,true);
}
* \param [in] start - an array of cell ids to include to the result mesh.
* \param [in] end - specifies the end of the array \a start, so that
* the last value of \a start is \a end[ -1 ].
- * \param [out] arr - a new DataArrayInt that is the "Old to New" renumbering
+ * \param [out] arr - a new DataArrayIdType that is the "Old to New" renumbering
* map. The caller is to delete this array using decrRef() as it is no more needed.
* \return MEDCouplingMesh * - a new instance of MEDCouplingMesh. The caller is to
* delete this mesh using decrRef() as it is no more needed.
*/
-MEDCouplingMesh *MEDCouplingPointSet::buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const
+MEDCouplingMesh *MEDCouplingPointSet::buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const
{
MCAuto<MEDCouplingPointSet> ret=buildPartOfMySelf(start,end,true);
arr=ret->zipCoordsTraducer();
*
* \sa MEDCouplingUMesh::buildPartOfMySelfSlice
*/
-MEDCouplingMesh *MEDCouplingPointSet::buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const
+MEDCouplingMesh *MEDCouplingPointSet::buildPartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
{
- if(beginCellIds==0 && endCellIds==getNumberOfCells() && stepCellIds==1)
+ if(beginCellIds==0 && endCellIds==ToIdType(getNumberOfCells()) && stepCellIds==1)
{
MEDCouplingMesh *ret(const_cast<MEDCouplingPointSet *>(this));
ret->incrRef();
*
* \sa MEDCouplingUMesh::buildPartOfMySelfSlice
*/
-MEDCouplingMesh *MEDCouplingPointSet::buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& arr) const
+MEDCouplingMesh *MEDCouplingPointSet::buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType*& arr) const
{
MCAuto<MEDCouplingPointSet> ret(buildPartOfMySelfSlice(beginCellIds,endCellIds,stepCellIds,true));
arr=ret->zipCoordsTraducer();
void MEDCouplingPointSet::rotate2D(const double *center, double angle)
{
double *coords(_coords->getPointer());
- int nbNodes(getNumberOfNodes());
+ mcIdType nbNodes(getNumberOfNodes());
DataArrayDouble::Rotate2DAlg(center,angle,nbNodes,coords,coords);
}
public:
static const int MY_SPACEDIM=3;
static const int MY_MESHDIM=2;
- typedef int MyConnType;
+ typedef mcIdType MyConnType;
static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
};
* If spaceDim==3 a projection will be done for each nodes on the middle plane containing these all nodes in [startConn;endConn).
* And after each projected nodes are moved to Oxy plane in order to consider these nodes as 2D nodes.
*/
-void MEDCouplingPointSet::project2DCellOnXY(const int *startConn, const int *endConn, std::vector<double>& res) const
+void MEDCouplingPointSet::project2DCellOnXY(const mcIdType *startConn, const mcIdType *endConn, std::vector<double>& res) const
{
const double *coords(_coords->getConstPointer());
- int spaceDim(getSpaceDimension());
- for(const int *it=startConn;it!=endConn;it++)
+ std::size_t spaceDim(getSpaceDimension());
+ for(const mcIdType *it=startConn;it!=endConn;it++)
res.insert(res.end(),coords+spaceDim*(*it),coords+spaceDim*(*it+1));
if(spaceDim==2)
return ;
if(spaceDim==3)
{
std::vector<double> cpy(res);
- int nbNodes=(int)std::distance(startConn,endConn);
- INTERP_KERNEL::PlanarIntersector<DummyClsMCPS,int>::Projection(&res[0],&cpy[0],nbNodes,nbNodes,1.e-12,0./*max distance*/,-1./*min dot*/,0.,true);
+ mcIdType nbNodes=ToIdType(std::distance(startConn,endConn));
+ INTERP_KERNEL::PlanarIntersector<DummyClsMCPS,mcIdType>::Projection(&res[0],&cpy[0],nbNodes,nbNodes,1.e-12,0./*max distance*/,-1./*min dot*/,0.,true);
res.resize(2*nbNodes);
- for(int i=0;i<nbNodes;i++)
+ for(mcIdType i=0;i<nbNodes;i++)
{
res[2*i]=cpy[3*i];
res[2*i+1]=cpy[3*i+1];
* This method compares 2 cells coming from two unstructured meshes : \a this and \a other.
* This method compares 2 cells having the same id 'cellId' in \a this and \a other.
*/
-bool MEDCouplingPointSet::areCellsFrom2MeshEqual(const MEDCouplingPointSet *other, int cellId, double prec) const
+bool MEDCouplingPointSet::areCellsFrom2MeshEqual(const MEDCouplingPointSet *other, mcIdType cellId, double prec) const
{
if(getTypeOfCell(cellId)!=other->getTypeOfCell(cellId))
return false;
- std::vector<int> c1,c2;
+ std::vector<mcIdType> c1,c2;
getNodeIdsOfCell(cellId,c1);
other->getNodeIdsOfCell(cellId,c2);
std::size_t sz(c1.size());
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::tryToShareSameCoordsPermute : No coords specified in other !");
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::tryToShareSameCoordsPermute : No coords specified in this whereas there is any in other !");
- int otherNbOfNodes=other.getNumberOfNodes();
+ mcIdType otherNbOfNodes=other.getNumberOfNodes();
MCAuto<DataArrayDouble> newCoords=MergeNodesArray(&other,this);
_coords->incrRef();
MCAuto<DataArrayDouble> oldCoords=_coords;
setCoords(newCoords);
bool areNodesMerged;
- int newNbOfNodes;
- MCAuto<DataArrayInt> da=buildPermArrayForMergeNode(epsilon,otherNbOfNodes,areNodesMerged,newNbOfNodes);
+ mcIdType newNbOfNodes;
+ MCAuto<DataArrayIdType> da=buildPermArrayForMergeNode(epsilon,otherNbOfNodes,areNodesMerged,newNbOfNodes);
if(!areNodesMerged)
{
setCoords(oldCoords);
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::tryToShareSameCoordsPermute fails : no nodes are mergeable with specified given epsilon !");
}
- int maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+otherNbOfNodes);
- const int *pt=std::find_if(da->getConstPointer()+otherNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater<int>(),maxId));
+ mcIdType maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+otherNbOfNodes);
+ const mcIdType *pt=std::find_if(da->getConstPointer()+otherNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater<mcIdType>(),maxId));
if(pt!=da->getConstPointer()+da->getNbOfElems())
{
setCoords(oldCoords);
setCoords(coords);
}
-MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelf(const int *begin, const int *end, bool keepCoords) const
+MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelf(const mcIdType *begin, const mcIdType *end, bool keepCoords) const
{
MCAuto<MEDCouplingPointSet> ret=buildPartOfMySelfKeepCoords(begin,end);
if(!keepCoords)
return ret.retn();
}
-MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfSlice(int start, int end, int step, bool keepCoords) const
+MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, bool keepCoords) const
{
MCAuto<MEDCouplingPointSet> ret=buildPartOfMySelfKeepCoordsSlice(start,end,step);
if(!keepCoords)
* \ref py_mcumesh_buildPartOfMySelfNode "Here is a Python example".
* \endif
*/
-MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const
+MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfNode(const mcIdType *begin, const mcIdType *end, bool fullyIn) const
{
- DataArrayInt *cellIdsKept=0;
+ DataArrayIdType *cellIdsKept=0;
fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept);
- MCAuto<DataArrayInt> cellIdsKept2(cellIdsKept);
+ MCAuto<DataArrayIdType> cellIdsKept2(cellIdsKept);
return buildPartOfMySelf(cellIdsKept->begin(),cellIdsKept->end(),true);
}
* \param [in] startCellId - specifies the cell id at which search for equal cells
* starts. By default it is 0, which means that all cells in \a this will be
* scanned.
- * \return DataArrayInt - a new instance of DataArrayInt, of length \a
+ * \return DataArrayIdType - a new instance of DataArrayIdType, of length \a
* this->getNumberOfCells() before call of this method. The caller is to
* delete this array using decrRef() as it is no more needed.
* \throw If the coordinates array is not set.
* \ref py_mcumesh_zipConnectivityTraducer "Here is a Python example".
* \endif
*/
-DataArrayInt *MEDCouplingPointSet::zipConnectivityTraducer(int compType, int startCellId)
+DataArrayIdType *MEDCouplingPointSet::zipConnectivityTraducer(int compType, mcIdType startCellId)
{
- DataArrayInt *commonCells=0,*commonCellsI=0;
+ DataArrayIdType *commonCells=0,*commonCellsI=0;
findCommonCells(compType,startCellId,commonCells,commonCellsI);
- MCAuto<DataArrayInt> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
- int newNbOfCells=-1;
- MCAuto<DataArrayInt> ret=DataArrayInt::ConvertIndexArrayToO2N(getNumberOfCells(),commonCells->begin(),commonCellsI->begin(),
+ MCAuto<DataArrayIdType> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
+ mcIdType newNbOfCells=-1;
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::ConvertIndexArrayToO2N(ToIdType(getNumberOfCells()),commonCells->begin(),commonCellsI->begin(),
commonCellsI->end(),newNbOfCells);
- MCAuto<DataArrayInt> ret2=ret->invertArrayO2N2N2O(newNbOfCells);
+ MCAuto<DataArrayIdType> ret2=ret->invertArrayO2N2N2O(newNbOfCells);
MCAuto<MEDCouplingPointSet> self=buildPartOfMySelf(ret2->begin(),ret2->end(),true);
shallowCopyConnectivityFrom(self);
return ret.retn();
bool MEDCouplingPointSet::areAllNodesFetched() const
{
checkFullyDefined();
- int nbNodes(getNumberOfNodes());
+ mcIdType nbNodes(getNumberOfNodes());
std::vector<bool> fetchedNodes(nbNodes,false);
computeNodeIdsAlg(fetchedNodes);
return std::find(fetchedNodes.begin(),fetchedNodes.end(),false)==fetchedNodes.end();
* \endif
*/
void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalWith : input is null !");
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalWith : other is not a PointSet mesh !");
MCAuto<MEDCouplingPointSet> m=dynamic_cast<MEDCouplingPointSet *>(mergeMyselfWith(otherC));
bool areNodesMerged;
- int newNbOfNodes;
- int oldNbOfNodes=getNumberOfNodes();
- MCAuto<DataArrayInt> da=m->buildPermArrayForMergeNode(prec,oldNbOfNodes,areNodesMerged,newNbOfNodes);
+ mcIdType newNbOfNodes;
+ mcIdType oldNbOfNodes=getNumberOfNodes();
+ MCAuto<DataArrayIdType> da=m->buildPermArrayForMergeNode(prec,oldNbOfNodes,areNodesMerged,newNbOfNodes);
//mergeNodes
if(!areNodesMerged && oldNbOfNodes != 0)
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : Nodes are incompatible ! ");
- const int *pt=std::find_if(da->getConstPointer()+oldNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater<int>(),oldNbOfNodes-1));
+ const mcIdType *pt=std::find_if(da->getConstPointer()+oldNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater<mcIdType>(),oldNbOfNodes-1));
if(pt!=da->getConstPointer()+da->getNbOfElems())
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some nodes in other are not in this !");
m->renumberNodes(da->getConstPointer(),newNbOfNodes);
//
- MCAuto<DataArrayInt> nodeCor2=da->subArray(oldNbOfNodes);
+ MCAuto<DataArrayIdType> nodeCor2=da->subArray(oldNbOfNodes);
da=m->mergeNodes(prec,areNodesMerged,newNbOfNodes);
//
da=m->zipConnectivityTraducer(cellCompPol);
- int nbCells=getNumberOfCells();
- if (nbCells != other->getNumberOfCells())
+ mcIdType nbCells=ToIdType(getNumberOfCells());
+ if (nbCells != ToIdType(other->getNumberOfCells()))
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !");
- int dan(da->getNumberOfTuples());
+ mcIdType dan(da->getNumberOfTuples());
if (dan)
{
- MCAuto<DataArrayInt> da1(DataArrayInt::New()),da2(DataArrayInt::New());
+ MCAuto<DataArrayIdType> da1(DataArrayIdType::New()),da2(DataArrayIdType::New());
da1->alloc(dan/2,1); da2->alloc(dan/2,1);
std::copy(da->getConstPointer(), da->getConstPointer()+dan/2, da1->getPointer());
std::copy(da->getConstPointer()+dan/2, da->getConstPointer()+dan, da2->getPointer());
if (!da1->isEqualWithoutConsideringStr(*da2))
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !");
}
- MCAuto<DataArrayInt> cellCor2=da->selectByTupleIdSafeSlice(nbCells,da->getNbOfElems(),1);
+ MCAuto<DataArrayIdType> cellCor2=da->selectByTupleIdSafeSlice(nbCells,ToIdType(da->getNbOfElems()),1);
nodeCor=nodeCor2->isIota(nodeCor2->getNumberOfTuples())?0:nodeCor2.retn();
cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
}
* \endif
*/
void MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor) const
+ DataArrayIdType *&cellCor) const
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith : input is null !");
if(_coords!=otherC->_coords)
throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : meshes do not share the same coordinates ! Use tryToShareSameCoordinates or call checkDeepEquivalWith !");
MCAuto<MEDCouplingPointSet> m=mergeMyselfWithOnSameCoords(otherC);
- MCAuto<DataArrayInt> da=m->zipConnectivityTraducer(cellCompPol);
- int maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+getNumberOfCells());
- const int *pt=std::find_if(da->getConstPointer()+getNumberOfCells(),da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater<int>(),maxId));
+ MCAuto<DataArrayIdType> da=m->zipConnectivityTraducer(cellCompPol);
+ mcIdType maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+getNumberOfCells());
+ const mcIdType *pt=std::find_if(da->getConstPointer()+getNumberOfCells(),da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater<mcIdType>(),maxId));
if(pt!=da->getConstPointer()+da->getNbOfElems())
{
throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !");
}
- MCAuto<DataArrayInt> cellCor2=da->selectByTupleIdSafeSlice(getNumberOfCells(),da->getNbOfElems(),1);
+ MCAuto<DataArrayIdType> cellCor2=da->selectByTupleIdSafeSlice(ToIdType(getNumberOfCells()),ToIdType(da->getNbOfElems()),1);
cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
}
const MEDCouplingPointSet *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkFastEquivalWith : fails because other is not a pointset mesh !");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(nbOfCells<1)
return ;
bool status=true;
* \param [in] fullyIn - if \c true, then cells whose all nodes are in the
* array \a begin are returned only, else cells whose any node is in the
* array \a begin are returned.
- * \return DataArrayInt * - a new instance of DataArrayInt holding ids of found
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of found
* cells. The caller is to delete this array using decrRef() as it is no more
* needed.
* \throw If the coordinates array is not set.
* \ref py_mcumesh_getCellIdsLyingOnNodes "Here is a Python example".
* \endif
*/
-DataArrayInt *MEDCouplingPointSet::getCellIdsLyingOnNodes(const int *begin, const int *end, bool fullyIn) const
+DataArrayIdType *MEDCouplingPointSet::getCellIdsLyingOnNodes(const mcIdType *begin, const mcIdType *end, bool fullyIn) const
{
- DataArrayInt *cellIdsKept=0;
+ DataArrayIdType *cellIdsKept=0;
fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept);
cellIdsKept->setName(getName());
return cellIdsKept;
* as last input argument).
* \param [in] partBg - the array of node ids.
* \param [in] partEnd - a pointer to a (last+1)-th element of \a partBg.
- * \return DataArrayInt * - a new instance of DataArrayInt holding ids of found
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of found
* cells. The caller is to delete this array using decrRef() as it is no
* more needed.
* \throw If the coordinates array is not set.
* \ref py_mcumesh_getCellIdsFullyIncludedInNodeIds "Here is a Python example".
* \endif
*/
-DataArrayInt *MEDCouplingPointSet::getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const
+DataArrayIdType *MEDCouplingPointSet::getCellIdsFullyIncludedInNodeIds(const mcIdType *partBg, const mcIdType *partEnd) const
{
return getCellIdsLyingOnNodes(partBg,partEnd,true);
}
* Removes unused nodes (the node coordinates array is shorten) and returns an array
* mapping between new and old node ids in "Old to New" mode. -1 values in the returned
* array mean that the corresponding old node is no more used.
- * \return DataArrayInt * - a new instance of DataArrayInt of length \a
+ * \return DataArrayIdType * - a new instance of DataArrayIdType of length \a
* this->getNumberOfNodes() before call of this method. The caller is to
* delete this array using decrRef() as it is no more needed.
* \throw If the coordinates array is not set.
* \ref py_mcumesh_zipCoordsTraducer "Here is a Python example".
* \endif
*/
-DataArrayInt *MEDCouplingPointSet::zipCoordsTraducer()
+DataArrayIdType *MEDCouplingPointSet::zipCoordsTraducer()
{
- int newNbOfNodes=-1;
- MCAuto<DataArrayInt> traducer=getNodeIdsInUse(newNbOfNodes);
+ mcIdType newNbOfNodes=-1;
+ MCAuto<DataArrayIdType> traducer=getNodeIdsInUse(newNbOfNodes);
renumberNodes(traducer->getConstPointer(),newNbOfNodes);
return traducer.retn();
}
* considered not coincident.
* \param [out] areNodesMerged - is set to \c true if any coincident nodes removed.
* \param [out] newNbOfNodes - number of nodes remaining after the removal.
- * \return DataArrayInt * - the permutation array in "Old to New" mode. For more
+ * \return DataArrayIdType * - the permutation array in "Old to New" mode. For more
* info on "Old to New" mode see \ref numbering. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the coordinates array is not set.
* \ref py_mcumesh_mergeNodes "Here is a Python example".
* \endif
*/
-DataArrayInt *MEDCouplingPointSet::mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes)
+DataArrayIdType *MEDCouplingPointSet::mergeNodes(double precision, bool& areNodesMerged, mcIdType& newNbOfNodes)
{
- MCAuto<DataArrayInt> ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes);
+ MCAuto<DataArrayIdType> ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes);
if(areNodesMerged)
renumberNodes(ret->begin(),newNbOfNodes);
return ret.retn();
* considered not coincident.
* \param [out] areNodesMerged - is set to \c true if any coincident nodes removed.
* \param [out] newNbOfNodes - number of nodes remaining after the removal.
- * \return DataArrayInt * - the permutation array in "Old to New" mode. For more
+ * \return DataArrayIdType * - the permutation array in "Old to New" mode. For more
* info on "Old to New" mode see \ref numbering. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the coordinates array is not set.
* \ref py_mcumesh_mergeNodes "Here is a Python example".
* \endif
*/
-DataArrayInt *MEDCouplingPointSet::mergeNodesCenter(double precision, bool& areNodesMerged, int& newNbOfNodes)
+DataArrayIdType *MEDCouplingPointSet::mergeNodesCenter(double precision, bool& areNodesMerged, mcIdType& newNbOfNodes)
{
- DataArrayInt *ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes);
+ DataArrayIdType *ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes);
if(areNodesMerged)
renumberNodesCenter(ret->getConstPointer(),newNbOfNodes);
return ret;
namespace MEDCoupling
{
- class DataArrayInt;
+ class DataArrayIdType;
class DataArrayDouble;
/*!
MEDCOUPLING_EXPORT void updateTime() const;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
- MEDCOUPLING_EXPORT int getNumberOfNodes() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const;
MEDCOUPLING_EXPORT int getSpaceDimension() const;
MEDCOUPLING_EXPORT void setCoords(const DataArrayDouble *coords);
MEDCOUPLING_EXPORT const DataArrayDouble *getCoords() const { return _coords; }
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const;
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const;
MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor) const;
+ DataArrayIdType *&cellCor) const;
MEDCOUPLING_EXPORT bool areCoordsEqualIfNotWhy(const MEDCouplingPointSet& other, double prec, std::string& reason) const;
MEDCOUPLING_EXPORT bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
MEDCOUPLING_EXPORT bool areCoordsEqualWithoutConsideringStr(const MEDCouplingPointSet& other, double prec) const;
MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const = 0;
MEDCOUPLING_EXPORT virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes);
- MEDCOUPLING_EXPORT virtual DataArrayInt *mergeNodesCenter(double precision, bool& areNodesMerged, int& newNbOfNodes);
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *mergeNodes(double precision, bool& areNodesMerged, mcIdType& newNbOfNodes);
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *mergeNodesCenter(double precision, bool& areNodesMerged, mcIdType& newNbOfNodes);
MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const = 0;
MEDCOUPLING_EXPORT virtual void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const = 0;
- MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
- MEDCOUPLING_EXPORT DataArrayInt *buildPermArrayForMergeNode(double precision, int limitNodeId, bool& areNodesMerged, int& newNbOfNodes) const;
- MEDCOUPLING_EXPORT DataArrayInt *getNodeIdsNearPoint(const double *pos, double eps) const;
- MEDCOUPLING_EXPORT void getNodeIdsNearPoints(const double *pos, int nbOfPoints, double eps, DataArrayInt *& c, DataArrayInt *& cI) const;
- MEDCOUPLING_EXPORT void findCommonNodes(double prec, int limitNodeId, DataArrayInt *&comm, DataArrayInt *&commIndex) const;
- MEDCOUPLING_EXPORT virtual void findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const = 0;
- MEDCOUPLING_EXPORT DataArrayInt *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex,
- int& newNbOfNodes) const;
+ MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *buildPermArrayForMergeNode(double precision, mcIdType limitNodeId, bool& areNodesMerged, mcIdType& newNbOfNodes) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsNearPoint(const double *pos, double eps) const;
+ MEDCOUPLING_EXPORT void getNodeIdsNearPoints(const double *pos, mcIdType nbOfPoints, double eps, DataArrayIdType *& c, DataArrayIdType *& cI) const;
+ MEDCOUPLING_EXPORT void findCommonNodes(double prec, mcIdType limitNodeId, DataArrayIdType *&comm, DataArrayIdType *&commIndex) const;
+ MEDCOUPLING_EXPORT virtual void findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const = 0;
+ MEDCOUPLING_EXPORT DataArrayIdType *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex,
+ mcIdType& newNbOfNodes) const;
MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const;
MEDCOUPLING_EXPORT void zipCoords();
MEDCOUPLING_EXPORT double getCaracteristicDimension() const;
MEDCOUPLING_EXPORT void scale(const double *point, double factor);
MEDCOUPLING_EXPORT void changeSpaceDimension(int newSpaceDim, double dftVal=0.);
MEDCOUPLING_EXPORT void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon);
- MEDCOUPLING_EXPORT void duplicateNodesInCoords(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd);
+ MEDCOUPLING_EXPORT void duplicateNodesInCoords(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd);
MEDCOUPLING_EXPORT virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon);
- MEDCOUPLING_EXPORT void findNodesOnPlane(const double *pt, const double *vec, double eps, std::vector<int>& nodes) const;
- MEDCOUPLING_EXPORT void findNodesOnLine(const double *pt, const double *vec, double eps, std::vector<int>& nodes) const;
+ MEDCOUPLING_EXPORT void findNodesOnPlane(const double *pt, const double *vec, double eps, std::vector<mcIdType>& nodes) const;
+ MEDCOUPLING_EXPORT void findNodesOnLine(const double *pt, const double *vec, double eps, std::vector<mcIdType>& nodes) const;
MEDCOUPLING_EXPORT static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
MEDCOUPLING_EXPORT static DataArrayDouble *MergeNodesArray(const std::vector<const MEDCouplingPointSet *>& ms);
MEDCOUPLING_EXPORT static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
- MEDCOUPLING_EXPORT static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const int *start, const int *end) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& arr) const;
- MEDCOUPLING_EXPORT DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const;
- MEDCOUPLING_EXPORT DataArrayInt *getCellIdsLyingOnNodes(const int *begin, const int *end, bool fullyIn) const;
- MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelf(const int *start, const int *end, bool keepCoords=true) const;
- MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step, bool keepCoords=true) const;
- MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const = 0;
- MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const = 0;
- MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfNode(const int *start, const int *end, bool fullyIn) const;
- MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *findBoundaryNodes() const = 0;
+ MEDCOUPLING_EXPORT static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType*& arr) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getCellIdsFullyIncludedInNodeIds(const mcIdType *partBg, const mcIdType *partEnd) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getCellIdsLyingOnNodes(const mcIdType *begin, const mcIdType *end, bool fullyIn) const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelf(const mcIdType *start, const mcIdType *end, bool keepCoords=true) const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, bool keepCoords=true) const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfNode(const mcIdType *start, const mcIdType *end, bool fullyIn) const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildFacePartOfMySelfNode(const mcIdType *start, const mcIdType *end, bool fullyIn) const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *findBoundaryNodes() const = 0;
MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const = 0;
- MEDCOUPLING_EXPORT virtual int getNumberOfNodesInCell(int cellId) const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *computeFetchedNodeIds() const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *getNodeIdsInUse(int& nbrOfNodesInUse) const = 0;
- MEDCOUPLING_EXPORT virtual void fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const = 0;
- MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const int *newNodeNumbersO2N) = 0;
- MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const INTERP_KERNEL::HashMap<int,int>& newNodeNumbersO2N) = 0;
- MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const std::map<int,int>& newNodeNumbersO2N) = 0;
- MEDCOUPLING_EXPORT virtual void renumberNodesWithOffsetInConn(int offset) = 0;
- MEDCOUPLING_EXPORT virtual void renumberNodes(const int *newNodeNumbers, int newNbOfNodes);
- MEDCOUPLING_EXPORT virtual void renumberNodesCenter(const int *newNodeNumbers, int newNbOfNodes);
- MEDCOUPLING_EXPORT virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const = 0;
+ MEDCOUPLING_EXPORT virtual mcIdType getNumberOfNodesInCell(mcIdType cellId) const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *computeFetchedNodeIds() const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const = 0;
+ MEDCOUPLING_EXPORT virtual void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const = 0;
+ MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const mcIdType *newNodeNumbersO2N) = 0;
+ MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const INTERP_KERNEL::HashMap<mcIdType,mcIdType>& newNodeNumbersO2N) = 0;
+ MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const std::map<mcIdType,mcIdType>& newNodeNumbersO2N) = 0;
+ MEDCOUPLING_EXPORT virtual void renumberNodesWithOffsetInConn(mcIdType offset) = 0;
+ MEDCOUPLING_EXPORT virtual void renumberNodes(const mcIdType *newNodeNumbers, mcIdType newNbOfNodes);
+ MEDCOUPLING_EXPORT virtual void renumberNodesCenter(const mcIdType *newNodeNumbers, mcIdType newNbOfNodes);
+ MEDCOUPLING_EXPORT virtual bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const = 0;
MEDCOUPLING_EXPORT virtual void invertOrientationOfAllCells() = 0;
MEDCOUPLING_EXPORT virtual void checkFullyDefined() const = 0;
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
- MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
+ MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings);
MEDCOUPLING_EXPORT virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *getCellsInBoundingBox(const double *bbox, double eps) const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) = 0;
MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *computeDiameterField() const = 0;
- MEDCOUPLING_EXPORT virtual DataArrayInt *zipCoordsTraducer();
- MEDCOUPLING_EXPORT virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0);
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *zipCoordsTraducer();
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *zipConnectivityTraducer(int compType, mcIdType startCellId=0);
MEDCOUPLING_EXPORT virtual bool areAllNodesFetched() const;
//tools
public:
- MEDCOUPLING_EXPORT bool areCellsFrom2MeshEqual(const MEDCouplingPointSet *other, int cellId, double prec) const;
+ MEDCOUPLING_EXPORT bool areCellsFrom2MeshEqual(const MEDCouplingPointSet *other, mcIdType cellId, double prec) const;
protected:
MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT static bool intersectsBoundingBox(const double* bb1, const double* bb2, int dim, double eps);
MEDCOUPLING_EXPORT static bool intersectsBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bb1, const double* bb2, int dim, double eps);
MEDCOUPLING_EXPORT void rotate2D(const double *center, double angle);
MEDCOUPLING_EXPORT void rotate3D(const double *center, const double *vect, double angle);
- MEDCOUPLING_EXPORT void project2DCellOnXY(const int *startConn, const int *endConn, std::vector<double>& res) const;
+ MEDCOUPLING_EXPORT void project2DCellOnXY(const mcIdType *startConn, const mcIdType *endConn, std::vector<double>& res) const;
MEDCOUPLING_EXPORT static bool isButterfly2DCell(const std::vector<double>& res, bool isQuad, double eps);
protected:
DataArrayDouble *_coords;
return prepareNotInterpKernelOnly();
}
-void MEDCouplingRemapper::setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, const std::vector<std::map<int,double> >& m)
+void MEDCouplingRemapper::setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, const std::vector<std::map<mcIdType,double> >& m)
{
MCAuto<MEDCouplingFieldTemplate> src,target;
BuildFieldTemplatesFrom(srcMesh,targetMesh,method,src,target);
setCrudeMatrixEx(src,target,m);
}
-void MEDCouplingRemapper::setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, const std::vector<std::map<int,double> >& m)
+void MEDCouplingRemapper::setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, const std::vector<std::map<mcIdType,double> >& m)
{
restartUsing(src,target);
- if(m.size()!=target->getNumberOfTuplesExpected())
+ if(ToIdType(m.size())!=target->getNumberOfTuplesExpected())
{
std::ostringstream oss; oss << "MEDCouplingRemapper::setMatrixEx : input matrix has " << m.size() << " rows whereas there are " << target->getNumberOfTuplesExpected() << " expected !";
throw INTERP_KERNEL::Exception(oss.str());
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
DataArrayDouble *array(srcField->getArray());
- int trgNbOfCompo=targetField->getNumberOfComponents();
+ std::size_t trgNbOfCompo=targetField->getNumberOfComponents();
if(array)
{
srcField->checkConsistencyLight();
- if(trgNbOfCompo!=srcField->getNumberOfTuplesExpected())
+ if(ToIdType(trgNbOfCompo)!=srcField->getNumberOfTuplesExpected())
throw INTERP_KERNEL::Exception("Number of components mismatch !");
}
else
computeDeno(srcField->getNature(),srcField,targetField);
double *resPointer(srcField->getArray()->getPointer());
const double *inputPointer=targetField->getArray()->getConstPointer();
- computeReverseProduct(inputPointer,trgNbOfCompo,dftValue,resPointer);
+ computeReverseProduct(inputPointer,(int)trgNbOfCompo,dftValue,resPointer);
}
/*!
if(trgSpaceDim!=srcSpaceDim)
if(trgSpaceDim!=-1 && srcSpaceDim!=-1)
throw INTERP_KERNEL::Exception("Incoherent space dimension detected between target and source.");
- int nbCols;
+ mcIdType nbCols;
if(srcMeshDim==1 && trgMeshDim==1 && srcSpaceDim==1)
{
MEDCouplingNormalizedUnstructuredMesh<1,1> source_mesh_wrapper(src_mesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh);
INTERP_KERNEL::Interpolation3D1D interpolation(*this);
- std::vector<std::map<int,double> > matrixTmp;
+ std::vector<std::map<mcIdType,double> > matrixTmp;
std::string revMethod(BuildMethodFrom(trgMeth,srcMeth));
nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod);
ReverseMatrix(matrixTmp,nbCols,_matrix);
- nbCols=matrixTmp.size();
+ nbCols=ToIdType(matrixTmp.size());
}
else if(srcMeshDim==2 && trgMeshDim==1 && srcSpaceDim==2)
{
MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh);
INTERP_KERNEL::Interpolation2D1D interpolation(*this);
- std::vector<std::map<int,double> > matrixTmp;
+ std::vector<std::map<mcIdType,double> > matrixTmp;
std::string revMethod(BuildMethodFrom(trgMeth,srcMeth));
nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod);
ReverseMatrix(matrixTmp,nbCols,_matrix);
- nbCols=matrixTmp.size();
+ nbCols=ToIdType(matrixTmp.size());
INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
if(!duplicateFaces.empty())
{
std::ostringstream oss; oss << "An unexpected situation happened ! For the following 1D Cells are part of edges shared by 2D cells :\n";
- for(std::map<int,std::set<int> >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++)
+ for(std::map<mcIdType,std::set<mcIdType> >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++)
{
oss << "1D Cell #" << (*it).first << " is part of common edge of following 2D cells ids : ";
- std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator<int>(oss," "));
+ std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator<mcIdType>(oss," "));
oss << std::endl;
}
}
MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh);
INTERP_KERNEL::Interpolation2D interpolation(*this);
- std::vector<std::map<int,double> > matrixTmp;
+ std::vector<std::map<mcIdType,double> > matrixTmp;
std::string revMethod(BuildMethodFrom(trgMeth,srcMeth));
nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod);
ReverseMatrix(matrixTmp,nbCols,_matrix);
- nbCols=matrixTmp.size();
+ nbCols=ToIdType(matrixTmp.size());
}
else
{
if(!duplicateFaces.empty())
{
std::ostringstream oss; oss << "An unexpected situation happened ! For the following 1D Cells are part of edges shared by 2D cells :\n";
- for(std::map<int,std::set<int> >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++)
+ for(std::map<mcIdType,std::set<mcIdType> >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++)
{
oss << "1D Cell #" << (*it).first << " is part of common edge of following 2D cells ids : ";
- std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator<int>(oss," "));
+ std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator<mcIdType>(oss," "));
oss << std::endl;
}
}
if(!duplicateFaces.empty())
{
std::ostringstream oss; oss << "An unexpected situation happened ! For the following 2D Cells are part of edges shared by 3D cells :\n";
- for(std::map<int,std::set<int> >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++)
+ for(std::map<mcIdType,std::set<mcIdType> >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++)
{
oss << "2D Cell #" << (*it).first << " is part of common face of following 3D cells ids : ";
- std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator<int>(oss," "));
+ std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator<mcIdType>(oss," "));
oss << std::endl;
}
}
MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh);
INTERP_KERNEL::Interpolation2D3D interpolation(*this);
- std::vector<std::map<int,double> > matrixTmp;
+ std::vector<std::map<mcIdType,double> > matrixTmp;
std::string revMethod(BuildMethodFrom(trgMeth,srcMeth));
nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod);
ReverseMatrix(matrixTmp,nbCols,_matrix);
- nbCols=matrixTmp.size();
+ nbCols=ToIdType(matrixTmp.size());
INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
if(!duplicateFaces.empty())
{
std::ostringstream oss; oss << "An unexpected situation happened ! For the following 2D Cells are part of edges shared by 3D cells :\n";
- for(std::map<int,std::set<int> >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++)
+ for(std::map<mcIdType,std::set<mcIdType> >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++)
{
oss << "2D Cell #" << (*it).first << " is part of common face of following 3D cells ids : ";
- std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator<int>(oss," "));
+ std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator<mcIdType>(oss," "));
oss << std::endl;
}
}
MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src2D);
MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(trg2D);
INTERP_KERNEL::Interpolation2D interpolation2D(*this);
- std::vector<std::map<int,double> > matrix2D;
- int nbCols2D=interpolation2D.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,matrix2D,methC);
+ std::vector<std::map<mcIdType,double> > matrix2D;
+ mcIdType nbCols2D=interpolation2D.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,matrix2D,methC);
MEDCouplingUMesh *s1D,*t1D;
double v[3];
MEDCouplingMappedExtrudedMesh::Project1DMeshes(src_mesh->getMesh1D(),target_mesh->getMesh1D(),getPrecision(),s1D,t1D,v);
MEDCouplingNormalizedUnstructuredMesh<1,1> s1DWrapper(s1D);
MEDCouplingNormalizedUnstructuredMesh<1,1> t1DWrapper(t1D);
- std::vector<std::map<int,double> > matrix1D;
+ std::vector<std::map<mcIdType,double> > matrix1D;
INTERP_KERNEL::Interpolation1D interpolation1D(*this);
if(interpolation1D.getIntersectionType()==INTERP_KERNEL::Geometric2D)// For intersection type of 1D, Geometric2D do not deal with it ! -> make interpolation1D not inherite from this
interpolation1D.setIntersectionType(INTERP_KERNEL::Triangulation);//
- int nbCols1D=interpolation1D.interpolateMeshes(s1DWrapper,t1DWrapper,matrix1D,methC);
+ mcIdType nbCols1D=interpolation1D.interpolateMeshes(s1DWrapper,t1DWrapper,matrix1D,methC);
s1D->decrRef();
t1D->decrRef();
buildFinalInterpolationMatrixByConvolution(matrix1D,matrix2D,src_mesh->getMesh3DIds()->getConstPointer(),nbCols2D,nbCols1D,
const int trgMeshDim=target_mesh->getMeshDimension();
if(srcMeshDim!=srcSpceDim || srcMeshDim!=trgMeshDim)
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyUC: space dimension of unstructured source mesh should be equal to mesh dimension of unstructured source mesh, and should also be equal to target cartesian dimension!");
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
switch(srcMeshDim)
{
case 1:
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss : The intersection type is not supported ! Only PointLocator is supported for Gauss->Gauss interpolation ! Please invoke setIntersectionType(PointLocator) on the MEDCouplingRemapper instance !");
MCAuto<DataArrayDouble> trgLoc=_target_ft->getLocalizationOfDiscr();
const double *trgLocPtr=trgLoc->begin();
- int trgSpaceDim=trgLoc->getNumberOfComponents();
- MCAuto<DataArrayInt> srcOffsetArr=_src_ft->getDiscretization()->getOffsetArr(_src_ft->getMesh());
+ mcIdType trgSpaceDim=ToIdType(trgLoc->getNumberOfComponents());
+ MCAuto<DataArrayIdType> srcOffsetArr=_src_ft->getDiscretization()->getOffsetArr(_src_ft->getMesh());
if(trgSpaceDim!=_src_ft->getMesh()->getSpaceDimension())
{
std::ostringstream oss; oss << "MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss : space dimensions mismatch between source and target !";
oss << _src_ft->getMesh()->getSpaceDimension() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- const int *srcOffsetArrPtr=srcOffsetArr->begin();
+ const mcIdType *srcOffsetArrPtr=srcOffsetArr->begin();
MCAuto<DataArrayDouble> srcLoc=_src_ft->getLocalizationOfDiscr();
const double *srcLocPtr=srcLoc->begin();
- MCAuto<DataArrayInt> eltsArr,eltsIndexArr;
- int trgNbOfGaussPts=trgLoc->getNumberOfTuples();
+ MCAuto<DataArrayIdType> eltsArr,eltsIndexArr;
+ mcIdType trgNbOfGaussPts=trgLoc->getNumberOfTuples();
_matrix.resize(trgNbOfGaussPts);
_src_ft->getMesh()->getCellsContainingPointsLinearPartOnlyOnNonDynType(trgLoc->begin(),trgNbOfGaussPts,getPrecision(),eltsArr,eltsIndexArr);
- const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin());
- MCAuto<DataArrayInt> nbOfSrcCellsShTrgPts(eltsIndexArr->deltaShiftIndex());
- MCAuto<DataArrayInt> ids0=nbOfSrcCellsShTrgPts->findIdsNotEqual(0);
- for(const int *trgId=ids0->begin();trgId!=ids0->end();trgId++)
+ const mcIdType *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin());
+ MCAuto<DataArrayIdType> nbOfSrcCellsShTrgPts(eltsIndexArr->deltaShiftIndex());
+ MCAuto<DataArrayIdType> ids0=nbOfSrcCellsShTrgPts->findIdsNotEqual(0);
+ for(const mcIdType *trgId=ids0->begin();trgId!=ids0->end();trgId++)
{
const double *ptTrg=trgLocPtr+trgSpaceDim*(*trgId);
- int srcCellId=elts[eltsIndex[*trgId]];
+ mcIdType srcCellId=elts[eltsIndex[*trgId]];
double dist=std::numeric_limits<double>::max();
- int srcEntry=-1;
- for(int srcId=srcOffsetArrPtr[srcCellId];srcId<srcOffsetArrPtr[srcCellId+1];srcId++)
+ mcIdType srcEntry=-1;
+ for(mcIdType srcId=srcOffsetArrPtr[srcCellId];srcId<srcOffsetArrPtr[srcCellId+1];srcId++)
{
const double *ptSrc=srcLocPtr+trgSpaceDim*srcId;
double tmp=0.;
- for(int i=0;i<trgSpaceDim;i++)
+ for(mcIdType i=0;i<trgSpaceDim;i++)
tmp+=(ptTrg[i]-ptSrc[i])*(ptTrg[i]-ptSrc[i]);
if(tmp<dist)
{ dist=tmp; srcEntry=srcId; }
}
if(ids0->getNumberOfTuples()!=trgNbOfGaussPts)
{
- MCAuto<DataArrayInt> orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0);
+ MCAuto<DataArrayIdType> orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0);
MCAuto<DataArrayDouble> orphanTrg=trgLoc->selectByTupleId(orphanTrgIds->begin(),orphanTrgIds->end());
- MCAuto<DataArrayInt> srcIdPerTrg=srcLoc->findClosestTupleId(orphanTrg);
- const int *srcIdPerTrgPtr=srcIdPerTrg->begin();
- for(const int *orphanTrgId=orphanTrgIds->begin();orphanTrgId!=orphanTrgIds->end();orphanTrgId++,srcIdPerTrgPtr++)
+ MCAuto<DataArrayIdType> srcIdPerTrg=srcLoc->findClosestTupleId(orphanTrg);
+ const mcIdType *srcIdPerTrgPtr=srcIdPerTrg->begin();
+ for(const mcIdType *orphanTrgId=orphanTrgIds->begin();orphanTrgId!=orphanTrgIds->end();orphanTrgId++,srcIdPerTrgPtr++)
_matrix[*orphanTrgId][*srcIdPerTrgPtr]=2.;
}
_deno_multiply.clear();
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
DataArrayDouble *array(targetField->getArray());
- int srcNbOfCompo(srcField->getNumberOfComponents());
+ std::size_t srcNbOfCompo(srcField->getNumberOfComponents());
if(array)
{
targetField->checkConsistencyLight();
computeDeno(srcField->getNature(),srcField,targetField);
double *resPointer(targetField->getArray()->getPointer());
const double *inputPointer(srcField->getArray()->getConstPointer());
- computeProduct(inputPointer,srcNbOfCompo,isDftVal,dftValue,resPointer);
+ computeProduct(inputPointer,(int)srcNbOfCompo,isDftVal,dftValue,resPointer);
}
void MEDCouplingRemapper::computeDeno(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField)
void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField)
{
_nature_of_deno=nat;
- _time_deno_update=getTimeOfThis();
+ std::size_t _time_deno_update=getTimeOfThis();
switch(_nature_of_deno)
{
case IntensiveMaximum:
denoPtr2[0]=std::accumulate(denoRPtr,denoRPtr+denoR->getNumberOfTuples(),0.);
}
int idx=0;
- for(std::vector<std::map<int,double> >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++)
- for(std::map<int,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
+ for(std::vector<std::map<mcIdType,double> >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
{
_deno_multiply[idx][(*iter2).first]=denoPtr[(*iter2).first];
_deno_reverse_multiply[(*iter2).first][idx]=denoRPtr[idx];
double *denoPtr2=deno->getArray()->getPointer();
denoPtr2[0]=std::accumulate(denoRPtr,denoRPtr+denoR->getNumberOfTuples(),0.);
}
- int idx=0;
- for(std::vector<std::map<int,double> >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++)
- for(std::map<int,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
+ mcIdType idx=0;
+ for(std::vector<std::map<mcIdType,double> >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
{
_deno_multiply[idx][(*iter2).first]=denoPtr[idx];
_deno_reverse_multiply[(*iter2).first][idx]=denoRPtr[(*iter2).first];
{
int idx=0;
double *tmp=new double[inputNbOfCompo];
- for(std::vector<std::map<int,double> >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++)
+ for(std::vector<std::map<mcIdType,double> >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++)
{
if((*iter1).empty())
{
}
else
std::fill(resPointer+idx*inputNbOfCompo,resPointer+(idx+1)*inputNbOfCompo,0.);
- std::map<int,double>::const_iterator iter3=_deno_multiply[idx].begin();
- for(std::map<int,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++,iter3++)
+ std::map<mcIdType,double>::const_iterator iter3=_deno_multiply[idx].begin();
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++,iter3++)
{
std::transform(inputPointer+(*iter2).first*inputNbOfCompo,inputPointer+((*iter2).first+1)*inputNbOfCompo,tmp,std::bind2nd(std::multiplies<double>(),(*iter2).second/(*iter3).second));
std::transform(tmp,tmp+inputNbOfCompo,resPointer+idx*inputNbOfCompo,resPointer+idx*inputNbOfCompo,std::plus<double>());
void MEDCouplingRemapper::computeReverseProduct(const double *inputPointer, int inputNbOfCompo, double dftValue, double *resPointer)
{
std::vector<bool> isReached(_deno_reverse_multiply.size(),false);
- int idx=0;
+ mcIdType idx=0;
double *tmp=new double[inputNbOfCompo];
std::fill(resPointer,resPointer+inputNbOfCompo*_deno_reverse_multiply.size(),0.);
- for(std::vector<std::map<int,double> >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++)
+ for(std::vector<std::map<mcIdType,double> >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++)
{
- for(std::map<int,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
{
isReached[(*iter2).first]=true;
std::transform(inputPointer+idx*inputNbOfCompo,inputPointer+(idx+1)*inputNbOfCompo,tmp,std::bind2nd(std::multiplies<double>(),(*iter2).second/_deno_reverse_multiply[(*iter2).first][idx]));
std::fill(resPointer+idx*inputNbOfCompo,resPointer+(idx+1)*inputNbOfCompo,dftValue);
}
-void MEDCouplingRemapper::ReverseMatrix(const std::vector<std::map<int,double> >& matIn, int nbColsMatIn, std::vector<std::map<int,double> >& matOut)
+void MEDCouplingRemapper::ReverseMatrix(const std::vector<std::map<mcIdType,double> >& matIn, mcIdType nbColsMatIn, std::vector<std::map<mcIdType,double> >& matOut)
{
matOut.resize(nbColsMatIn);
- int id=0;
- for(std::vector<std::map<int,double> >::const_iterator iter1=matIn.begin();iter1!=matIn.end();iter1++,id++)
- for(std::map<int,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
+ mcIdType id=0;
+ for(std::vector<std::map<mcIdType,double> >::const_iterator iter1=matIn.begin();iter1!=matIn.end();iter1++,id++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
matOut[(*iter2).first][id]=(*iter2).second;
}
-void MEDCouplingRemapper::ComputeRowSumAndColSum(const std::vector<std::map<int,double> >& matrixDeno,
- std::vector<std::map<int,double> >& deno, std::vector<std::map<int,double> >& denoReverse)
+void MEDCouplingRemapper::ComputeRowSumAndColSum(const std::vector<std::map<mcIdType,double> >& matrixDeno,
+ std::vector<std::map<mcIdType,double> >& deno, std::vector<std::map<mcIdType,double> >& denoReverse)
{
- std::map<int,double> values;
- int idx=0;
- for(std::vector<std::map<int,double> >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++)
+ std::map<mcIdType,double> values;
+ mcIdType idx=0;
+ for(std::vector<std::map<mcIdType,double> >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++)
{
double sum=0.;
- for(std::map<int,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
{
sum+=(*iter2).second;
values[(*iter2).first]+=(*iter2).second;
}
- for(std::map<int,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
deno[idx][(*iter2).first]=sum;
}
idx=0;
- for(std::vector<std::map<int,double> >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++)
+ for(std::vector<std::map<mcIdType,double> >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++)
{
- for(std::map<int,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
denoReverse[(*iter2).first][idx]=values[(*iter2).first];
}
}
-void MEDCouplingRemapper::ComputeColSumAndRowSum(const std::vector<std::map<int,double> >& matrixDeno,
- std::vector<std::map<int,double> >& deno, std::vector<std::map<int,double> >& denoReverse)
+void MEDCouplingRemapper::ComputeColSumAndRowSum(const std::vector<std::map<mcIdType,double> >& matrixDeno,
+ std::vector<std::map<mcIdType,double> >& deno, std::vector<std::map<mcIdType,double> >& denoReverse)
{
- std::map<int,double> values;
- int idx=0;
- for(std::vector<std::map<int,double> >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++)
+ std::map<mcIdType,double> values;
+ mcIdType idx=0;
+ for(std::vector<std::map<mcIdType,double> >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++)
{
double sum=0.;
- for(std::map<int,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
{
sum+=(*iter2).second;
values[(*iter2).first]+=(*iter2).second;
}
- for(std::map<int,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
denoReverse[(*iter2).first][idx]=sum;
}
idx=0;
- for(std::vector<std::map<int,double> >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++)
+ for(std::vector<std::map<mcIdType,double> >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++)
{
- for(std::map<int,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
deno[idx][(*iter2).first]=values[(*iter2).first];
}
}
-void MEDCouplingRemapper::buildFinalInterpolationMatrixByConvolution(const std::vector< std::map<int,double> >& m1D,
- const std::vector< std::map<int,double> >& m2D,
- const int *corrCellIdSrc, int nbOf2DCellsSrc, int nbOf1DCellsSrc,
- const int *corrCellIdTrg)
+void MEDCouplingRemapper::buildFinalInterpolationMatrixByConvolution(const std::vector< std::map<mcIdType,double> >& m1D,
+ const std::vector< std::map<mcIdType,double> >& m2D,
+ const mcIdType *corrCellIdSrc, mcIdType nbOf2DCellsSrc, mcIdType nbOf1DCellsSrc,
+ const mcIdType *corrCellIdTrg)
{
- int nbOf2DCellsTrg=m2D.size();
- int nbOf1DCellsTrg=m1D.size();
- int nbOf3DCellsTrg=nbOf2DCellsTrg*nbOf1DCellsTrg;
+ mcIdType nbOf2DCellsTrg=ToIdType(m2D.size());
+ mcIdType nbOf1DCellsTrg=ToIdType(m1D.size());
+ mcIdType nbOf3DCellsTrg=nbOf2DCellsTrg*nbOf1DCellsTrg;
_matrix.resize(nbOf3DCellsTrg);
- int id2R=0;
- for(std::vector< std::map<int,double> >::const_iterator iter2R=m2D.begin();iter2R!=m2D.end();iter2R++,id2R++)
+ mcIdType id2R=0;
+ for(std::vector< std::map<mcIdType,double> >::const_iterator iter2R=m2D.begin();iter2R!=m2D.end();iter2R++,id2R++)
{
- for(std::map<int,double>::const_iterator iter2C=(*iter2R).begin();iter2C!=(*iter2R).end();iter2C++)
+ for(std::map<mcIdType,double>::const_iterator iter2C=(*iter2R).begin();iter2C!=(*iter2R).end();iter2C++)
{
- int id1R=0;
- for(std::vector< std::map<int,double> >::const_iterator iter1R=m1D.begin();iter1R!=m1D.end();iter1R++,id1R++)
+ mcIdType id1R=0;
+ for(std::vector< std::map<mcIdType,double> >::const_iterator iter1R=m1D.begin();iter1R!=m1D.end();iter1R++,id1R++)
{
- for(std::map<int,double>::const_iterator iter1C=(*iter1R).begin();iter1C!=(*iter1R).end();iter1C++)
+ for(std::map<mcIdType,double>::const_iterator iter1C=(*iter1R).begin();iter1C!=(*iter1R).end();iter1C++)
{
_matrix[corrCellIdTrg[id1R*nbOf2DCellsTrg+id2R]][corrCellIdSrc[(*iter1C).first*nbOf2DCellsSrc+(*iter2C).first]]=(*iter1C).second*((*iter2C).second);
}
}
}
-void MEDCouplingRemapper::PrintMatrix(const std::vector<std::map<int,double> >& m)
+void MEDCouplingRemapper::PrintMatrix(const std::vector<std::map<mcIdType,double> >& m)
{
- int id=0;
- for(std::vector<std::map<int,double> >::const_iterator iter1=m.begin();iter1!=m.end();iter1++,id++)
+ mcIdType id=0;
+ for(std::vector<std::map<mcIdType,double> >::const_iterator iter1=m.begin();iter1!=m.end();iter1++,id++)
{
std::cout << "Target Cell # " << id << " : ";
- for(std::map<int,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
std::cout << "(" << (*iter2).first << "," << (*iter2).second << "), ";
std::cout << std::endl;
}
}
-const std::vector<std::map<int,double> >& MEDCouplingRemapper::getCrudeMatrix() const
+const std::vector<std::map<mcIdType,double> >& MEDCouplingRemapper::getCrudeMatrix() const
{
return _matrix;
}
/*!
* Returns the number of columns of matrix returned by MEDCouplingRemapper::getCrudeMatrix method.
*/
-int MEDCouplingRemapper::getNumberOfColsOfMatrix() const
+mcIdType MEDCouplingRemapper::getNumberOfColsOfMatrix() const
{
- return (int)_deno_reverse_multiply.size();
+ return ToIdType(_deno_reverse_multiply.size());
}
/*!
int MEDCouplingRemapper::nullifiedTinyCoeffInCrudeMatrixAbs(double maxValAbs)
{
int ret=0;
- std::vector<std::map<int,double> > matrixNew(_matrix.size());
- int i=0;
- for(std::vector<std::map<int,double> >::const_iterator it1=_matrix.begin();it1!=_matrix.end();it1++,i++)
+ std::vector<std::map<mcIdType,double> > matrixNew(_matrix.size());
+ mcIdType i=0;
+ for(std::vector<std::map<mcIdType,double> >::const_iterator it1=_matrix.begin();it1!=_matrix.end();it1++,i++)
{
- std::map<int,double>& rowNew=matrixNew[i];
- for(std::map<int,double>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
+ std::map<mcIdType,double>& rowNew=matrixNew[i];
+ for(std::map<mcIdType,double>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
{
if(fabs((*it2).second)>maxValAbs)
rowNew[(*it2).first]=(*it2).second;
double MEDCouplingRemapper::getMaxValueInCrudeMatrix() const
{
double ret=0.;
- for(std::vector<std::map<int,double> >::const_iterator it1=_matrix.begin();it1!=_matrix.end();it1++)
- for(std::map<int,double>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
+ for(std::vector<std::map<mcIdType,double> >::const_iterator it1=_matrix.begin();it1!=_matrix.end();it1++)
+ for(std::map<mcIdType,double>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
if(fabs((*it2).second)>ret)
ret=fabs((*it2).second);
return ret;
MEDCOUPLINGREMAPPER_EXPORT ~MEDCouplingRemapper();
MEDCOUPLINGREMAPPER_EXPORT int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method);
MEDCOUPLINGREMAPPER_EXPORT int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target);
- MEDCOUPLINGREMAPPER_EXPORT void setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, const std::vector<std::map<int,double> >& m);
- MEDCOUPLINGREMAPPER_EXPORT void setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, const std::vector<std::map<int,double> >& m);
+ MEDCOUPLINGREMAPPER_EXPORT void setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, const std::vector<std::map<mcIdType,double> >& m);
+ MEDCOUPLINGREMAPPER_EXPORT void setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, const std::vector<std::map<mcIdType,double> >& m);
MEDCOUPLINGREMAPPER_EXPORT void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue);
MEDCOUPLINGREMAPPER_EXPORT void partialTransfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField);
MEDCOUPLINGREMAPPER_EXPORT void reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue);
MEDCOUPLINGREMAPPER_EXPORT int nullifiedTinyCoeffInCrudeMatrix(double scaleFactor);
MEDCOUPLINGREMAPPER_EXPORT double getMaxValueInCrudeMatrix() const;
public:
- MEDCOUPLINGREMAPPER_EXPORT const std::vector<std::map<int,double> >& getCrudeMatrix() const;
- MEDCOUPLINGREMAPPER_EXPORT int getNumberOfColsOfMatrix() const;
- MEDCOUPLINGREMAPPER_EXPORT static void PrintMatrix(const std::vector<std::map<int,double> >& m);
+ MEDCOUPLINGREMAPPER_EXPORT const std::vector<std::map<mcIdType,double> >& getCrudeMatrix() const;
+ MEDCOUPLINGREMAPPER_EXPORT mcIdType getNumberOfColsOfMatrix() const;
+ MEDCOUPLINGREMAPPER_EXPORT static void PrintMatrix(const std::vector<std::map<mcIdType,double> >& m);
MEDCOUPLINGREMAPPER_EXPORT static std::string BuildMethodFrom(const std::string& meth1, const std::string& meth2);
MEDCOUPLINGREMAPPER_EXPORT void BuildFieldTemplatesFrom(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, MCAuto<MEDCouplingFieldTemplate>& src, MCAuto<MEDCouplingFieldTemplate>& target);
private:
void computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField);
void computeProduct(const double *inputPointer, int inputNbOfCompo, bool isDftVal, double dftValue, double *resPointer);
void computeReverseProduct(const double *inputPointer, int inputNbOfCompo, double dftValue, double *resPointer);
- void buildFinalInterpolationMatrixByConvolution(const std::vector< std::map<int,double> >& m1D,
- const std::vector< std::map<int,double> >& m2D,
- const int *corrCellIdSrc, int nbOf2DCellsSrc, int nbOf1DCellsSrc,
- const int *corrCellIdTrg);
- static void ReverseMatrix(const std::vector<std::map<int,double> >& matIn, int nbColsMatIn,
- std::vector<std::map<int,double> >& matOut);
- static void ComputeRowSumAndColSum(const std::vector<std::map<int,double> >& matrixDeno,
- std::vector<std::map<int,double> >& deno, std::vector<std::map<int,double> >& denoReverse);
- static void ComputeColSumAndRowSum(const std::vector<std::map<int,double> >& matrixDeno,
- std::vector<std::map<int,double> >& deno, std::vector<std::map<int,double> >& denoReverse);
+ void buildFinalInterpolationMatrixByConvolution(const std::vector< std::map<mcIdType,double> >& m1D,
+ const std::vector< std::map<mcIdType,double> >& m2D,
+ const mcIdType *corrCellIdSrc, mcIdType nbOf2DCellsSrc, mcIdType nbOf1DCellsSrc,
+ const mcIdType *corrCellIdTrg);
+ static void ReverseMatrix(const std::vector<std::map<mcIdType,double> >& matIn, mcIdType nbColsMatIn,
+ std::vector<std::map<mcIdType,double> >& matOut);
+ static void ComputeRowSumAndColSum(const std::vector<std::map<mcIdType,double> >& matrixDeno,
+ std::vector<std::map<mcIdType,double> >& deno, std::vector<std::map<mcIdType,double> >& denoReverse);
+ static void ComputeColSumAndRowSum(const std::vector<std::map<mcIdType,double> >& matrixDeno,
+ std::vector<std::map<mcIdType,double> >& deno, std::vector<std::map<mcIdType,double> >& denoReverse);
private:
MCAuto<MEDCouplingFieldTemplate> _src_ft;
MCAuto<MEDCouplingFieldTemplate> _target_ft;
using namespace MEDCoupling;
MEDCouplingSkyLineArray::MEDCouplingSkyLineArray():
- _super_index( DataArrayInt::New() ), _index( DataArrayInt::New() ), _values( DataArrayInt::New() )
+ _super_index( DataArrayIdType::New() ), _index( DataArrayIdType::New() ), _values( DataArrayIdType::New() )
{
}
return new MEDCouplingSkyLineArray();
}
-MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const std::vector<int>& index,
- const std::vector<int>& value )
+MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const std::vector<mcIdType>& index,
+ const std::vector<mcIdType>& value )
{
MEDCouplingSkyLineArray * ret = new MEDCouplingSkyLineArray();
ret->_index->reserve( index.size() );
return ret;
}
-MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( DataArrayInt* index, DataArrayInt* value )
+MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( DataArrayIdType* index, DataArrayIdType* value )
{
MEDCouplingSkyLineArray* ret = new MEDCouplingSkyLineArray();
ret->set(index, value);
* polyhedrons or polygons).
* The input arrays are deep copied, contrary to the other ctors.
*/
-MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( const DataArrayInt* c, const DataArrayInt* cI )
+MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI )
{
using namespace std;
MEDCouplingSkyLineArray* ret = new MEDCouplingSkyLineArray();
- const int * cP(c->begin()), * cIP(cI->begin());
- int prev = -1;
- if ((int)c->getNbOfElems() != *(cI->end()-1))
+ const mcIdType * cP(c->begin()), * cIP(cI->begin());
+ mcIdType prev = -1;
+ if (c->getNbOfElems() != *(cI->end()-1))
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::BuildFromDynamicConn: misformatted connectivity (wrong nb of tuples)!");
- for (std::size_t i=0; i < cI->getNbOfElems(); i++)
+ for (mcIdType i=0; i < cI->getNbOfElems(); i++)
{
- int j = cIP[i];
+ mcIdType j = cIP[i];
if (cIP[i] < prev)
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::BuildFromDynamicConn: misformatted connectivity (indices not monotonic ascending)!");
prev = cIP[i];
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::BuildFromDynamicConn: connectivity containing other types than POLYHED!");
}
- vector<int> superIdx, idx, vals;
- int cnt = 0, cnt2 = 0;
+ vector<mcIdType> superIdx, idx, vals;
+ mcIdType cnt = 0, cnt2 = 0;
superIdx.reserve(cI->getNbOfElems());
superIdx.push_back(0);
idx.push_back(0);
vals.resize(c->getNbOfElems()); // too much because of the type and the -1, but still better than push_back().
- for (std::size_t i=0; i < cI->getNbOfElems()-1; i++)
+ for (mcIdType i=0; i < cI->getNbOfElems()-1; i++)
{
- int start = cIP[i]+1, end = cIP[i+1];
- int * work = vals.data() + cnt;
- const int * w = cP+start;
- const int * w2 = find(w, cP+end, -1);
+ mcIdType start = cIP[i]+1, end = cIP[i+1];
+ mcIdType * work = vals.data() + cnt;
+ const mcIdType * w = cP+start;
+ const mcIdType * w2 = find(w, cP+end, -1);
while (w2 != cP+end)
{
copy(w, w2, work);
- int d = distance(w, w2);
+ mcIdType d = ToIdType(distance(w, w2));
cnt += d; work +=d;
idx.push_back(cnt); cnt2++;
w = w2+1; // skip the -1
w2 = find(w, cP+end, -1);
}
copy(w, cP+end, work);
- cnt += distance(w, cP+end);
+ cnt += ToIdType(distance(w, cP+end));
idx.push_back(cnt); cnt2++;
superIdx.push_back(cnt2);
}
* Convert a three-level SkyLineArray into a polyhedral connectivity.
* The super-packs are interpreted as cell description, and the packs represent the face connectivity.
*/
-void MEDCouplingSkyLineArray::convertToPolyhedronConn( MCAuto<DataArrayInt>& c, MCAuto<DataArrayInt>& cI) const
+void MEDCouplingSkyLineArray::convertToPolyhedronConn( MCAuto<DataArrayIdType>& c, MCAuto<DataArrayIdType>& cI) const
{
// TODO: in this case an iterator would be nice
using namespace std;
checkSuperIndex("convertToPolyhedronConn");
- const int * siP(_super_index->begin()), * iP(_index->begin()), *vP(_values->begin());
- int cnt = 0;
+ const mcIdType * siP(_super_index->begin()), * iP(_index->begin()), *vP(_values->begin());
+ mcIdType cnt = 0;
cI->alloc(_super_index->getNbOfElems(),1); // same number of super packs as number of cells
- int * cIVecP(cI->getPointer());
- MCAuto <DataArrayInt> dsi = _index->deltaShiftIndex();
- int sz = dsi->accumulate(0) + dsi->getNbOfElems(); // think about it: one slot for the type, -1 at the end of each face of the cell
+ mcIdType * cIVecP(cI->getPointer());
+ MCAuto <DataArrayIdType> dsi = _index->deltaShiftIndex();
+ mcIdType sz = dsi->accumulate((std::size_t)0) + ToIdType(dsi->getNbOfElems()); // think about it: one slot for the type, -1 at the end of each face of the cell
c->alloc(sz, 1);
- int * cVecP(c->getPointer());
+ mcIdType * cVecP(c->getPointer());
- for ( std::size_t i=0; i < _super_index->getNbOfElems()-1; i++)
+ for ( mcIdType i=0; i < _super_index->getNbOfElems()-1; i++)
{
cIVecP[i]= cnt;
- int endId = siP[i+1];
+ mcIdType endId = siP[i+1];
cVecP[cnt++] = INTERP_KERNEL::NORM_POLYHED;
- for (int j=siP[i]; j < endId; j++)
+ for (mcIdType j=siP[i]; j < endId; j++)
{
- int startId2 = iP[j], endId2 = iP[j+1];
+ mcIdType startId2 = iP[j], endId2 = iP[j+1];
copy(vP+startId2, vP+endId2, cVecP+cnt);
cnt += endId2-startId2;
if(j != endId-1)
}
-void MEDCouplingSkyLineArray::set( DataArrayInt* index, DataArrayInt* value )
+void MEDCouplingSkyLineArray::set( DataArrayIdType* index, DataArrayIdType* value )
{
_index=index;
_values=value;
- if ( (DataArrayInt*)_index ) _index->incrRef();
- else _index = DataArrayInt::New();
- if ( (DataArrayInt*)_values ) _values->incrRef();
- else _values = DataArrayInt::New();
+ if ( (DataArrayIdType*)_index ) _index->incrRef();
+ else _index = DataArrayIdType::New();
+ if ( (DataArrayIdType*)_values ) _values->incrRef();
+ else _values = DataArrayIdType::New();
}
-void MEDCouplingSkyLineArray::set3( DataArrayInt* superIndex, DataArrayInt* index, DataArrayInt* value )
+void MEDCouplingSkyLineArray::set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value )
{
_super_index=superIndex;
- if ( (DataArrayInt*)_super_index ) _super_index->incrRef();
- else _super_index = DataArrayInt::New();
+ if ( (DataArrayIdType*)_super_index ) _super_index->incrRef();
+ else _super_index = DataArrayIdType::New();
set(index, value);
}
-DataArrayInt* MEDCouplingSkyLineArray::getSuperIndexArray() const
+DataArrayIdType* MEDCouplingSkyLineArray::getSuperIndexArray() const
{
return const_cast<MEDCouplingSkyLineArray*>(this)->_super_index;
}
-DataArrayInt* MEDCouplingSkyLineArray::getIndexArray() const
+DataArrayIdType* MEDCouplingSkyLineArray::getIndexArray() const
{
return const_cast<MEDCouplingSkyLineArray*>(this)->_index;
}
-DataArrayInt* MEDCouplingSkyLineArray::getValuesArray() const
+DataArrayIdType* MEDCouplingSkyLineArray::getValuesArray() const
{
return const_cast<MEDCouplingSkyLineArray*>(this)->_values;
}
}
}
-void MEDCouplingSkyLineArray::validSuperIndex(const std::string& func, int superIndex) const
+void MEDCouplingSkyLineArray::validSuperIndex(const std::string& func, mcIdType superIndex) const
{
- if(superIndex < 0 || superIndex >= (int)_super_index->getNbOfElems())
+ if(superIndex < 0 || superIndex >= _super_index->getNbOfElems())
{
std::ostringstream oss;
oss << "MEDCouplingSkyLineArray::" << func << ": invalid super index!";
}
}
-void MEDCouplingSkyLineArray::validIndex(const std::string& func, int idx) const
+void MEDCouplingSkyLineArray::validIndex(const std::string& func, mcIdType idx) const
{
- if(idx < 0 || idx >= (int)_index->getNbOfElems())
+ if(idx < 0 || idx >= _index->getNbOfElems())
{
std::ostringstream oss;
oss << "MEDCouplingSkyLineArray::" << func << ": invalid index!";
}
}
-void MEDCouplingSkyLineArray::validSuperIndexAndIndex(const std::string& func, int superIndex, int index) const
+void MEDCouplingSkyLineArray::validSuperIndexAndIndex(const std::string& func, mcIdType superIndex, mcIdType index) const
{
validSuperIndex(func, superIndex);
- int idx = _super_index->begin()[superIndex] + index;
- if(idx < 0 || idx >= (int)_index->getNbOfElems())
+ mcIdType idx = _super_index->begin()[superIndex] + index;
+ if(idx < 0 || idx >= _index->getNbOfElems())
{
std::ostringstream oss;
oss << "MEDCouplingSkyLineArray::" << func << ": invalid index!";
{
std::ostringstream oss;
oss << "MEDCouplingSkyLineArray (" << this << ")" << std::endl;
- MCAuto<DataArrayInt> super_index = _super_index->deepCopy();
+ MCAuto<DataArrayIdType> super_index = _super_index->deepCopy();
if (_super_index->getNbOfElems())
oss << " Nb of super-packs: " << getSuperNumberOf() << std::endl;
else
{
oss << " Super-indices:" << std::endl;
oss << " ";
- const int * i = _super_index->begin();
+ const mcIdType * i = _super_index->begin();
for ( ; i != _super_index->end(); ++i )
oss << *i << " ";
oss << std::endl;
oss << " Indices:" << std::endl;
oss << " ";
- const int * i = _index->begin();
+ const mcIdType * i = _index->begin();
for ( ; i != _index->end(); ++i )
oss << *i << " ";
oss << std::endl;
oss << " Values:" << std::endl;
oss << " ";
- const int * v = _values->begin();
- int cnt = 0, cntI = 0;
+ const mcIdType * v = _values->begin();
+ mcIdType cnt = 0, cntI = 0;
i = _index->begin();
- for ( const int * si = super_index->begin()+1; v != _values->end(); ++v, ++cnt )
+ for ( const mcIdType * si = super_index->begin()+1; v != _values->end(); ++v, ++cnt )
{
if ( cnt == *i )
{
/**
* For a 2- or 3-level SkyLine array, return a copy of the absolute pack with given identifier.
*/
-void MEDCouplingSkyLineArray::getSimplePackSafe(const int absolutePackId, std::vector<int> & pack) const
+void MEDCouplingSkyLineArray::getSimplePackSafe(const mcIdType absolutePackId, std::vector<mcIdType> & pack) const
{
- if(absolutePackId < 0 || absolutePackId >= (int)_index->getNbOfElems())
+ if(absolutePackId < 0 || absolutePackId >= _index->getNbOfElems())
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::getPackSafe: invalid index!");
- const int * iP(_index->begin()), *vP(_values->begin());
- int sz = iP[absolutePackId+1]-iP[absolutePackId];
+ const mcIdType * iP(_index->begin()), *vP(_values->begin());
+ mcIdType sz = iP[absolutePackId+1]-iP[absolutePackId];
pack.resize(sz);
std::copy(vP+iP[absolutePackId], vP+iP[absolutePackId+1],pack.begin());
}
/**
* Same as getPackSafe, but directly returns a pointer to the internal data with the size of the pack.
*/
-const int * MEDCouplingSkyLineArray::getSimplePackSafePtr(const int absolutePackId, int & packSize) const
+const mcIdType * MEDCouplingSkyLineArray::getSimplePackSafePtr(const mcIdType absolutePackId, mcIdType & packSize) const
{
- if(absolutePackId < 0 || absolutePackId >= (int)_index->getNbOfElems())
+ if(absolutePackId < 0 || absolutePackId >= _index->getNbOfElems())
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::getPackSafe: invalid index!");
- const int * iP(_index->begin()), *vP(_values->begin());
+ const mcIdType * iP(_index->begin()), *vP(_values->begin());
packSize = iP[absolutePackId+1]-iP[absolutePackId];
return vP+iP[absolutePackId];
}
* \param[in] superPackIndices the list of super-packs that should be inspected
* \param[in] packBg the pack that the function is looking for in each of the provided super-pack
* \param[in] packEnd the pack that the function is looking for in each of the provided super-pack
- * \param[out] a vector of int, having the same size as superPackIndices and containing for each inspected super-pack
+ * \param[out] a vector of mcIdType, having the same size as superPackIndices and containing for each inspected super-pack
* the index of the first matching pack, or -1 if none found.
*/
-void MEDCouplingSkyLineArray::findPackIds(const std::vector<int> & superPackIndices,
- const int *packBg, const int *packEnd,
- std::vector<int>& out) const
+void MEDCouplingSkyLineArray::findPackIds(const std::vector<mcIdType> & superPackIndices,
+ const mcIdType *packBg, const mcIdType *packEnd,
+ std::vector<mcIdType>& out) const
{
using namespace std;
checkSuperIndex("findPackIds");
- int packSz = std::distance(packBg, packEnd);
+ mcIdType packSz = ToIdType(std::distance(packBg, packEnd));
if (!packSz)
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::findPackIds: void pack!");
out.resize(superPackIndices.size());
- int i = 0;
- const int * siP(_super_index->begin()), * iP(_index->begin()), *vP(_values->begin());
- for(vector<int>::const_iterator it=superPackIndices.begin(); it!=superPackIndices.end(); ++it, i++)
+ mcIdType i = 0;
+ const mcIdType * siP(_super_index->begin()), * iP(_index->begin()), *vP(_values->begin());
+ for(vector<mcIdType>::const_iterator it=superPackIndices.begin(); it!=superPackIndices.end(); ++it, i++)
{
out[i] = -1;
- const int sPackIdx = *it;
+ const mcIdType sPackIdx = *it;
// for each pack
- for (int idx=siP[sPackIdx], j=0; idx < siP[sPackIdx+1]; idx++, j++)
+ for (mcIdType idx=siP[sPackIdx], j=0; idx < siP[sPackIdx+1]; idx++, j++)
{
if (packSz == (iP[idx+1] - iP[idx]))
if (equal(&vP[iP[idx]], &vP[iP[idx+1]], packBg))
* \param[in] superIdx is the super-pack number
* \param[in] idx is the pack index inside the super-pack 'superIdx'.
*/
-void MEDCouplingSkyLineArray::deletePack(const int superIdx, const int idx)
+void MEDCouplingSkyLineArray::deletePack(const mcIdType superIdx, const mcIdType idx)
{
checkSuperIndex("deletePack");
validSuperIndexAndIndex("deletePack", superIdx, idx);
- int * vP = _values->getPointer();
- int * siP(_super_index->getPointer()), *iP(_index->getPointer());
- const int start = iP[siP[superIdx]+idx], end = iP[siP[superIdx]+idx+1];
+ mcIdType * vP = _values->getPointer();
+ mcIdType * siP(_super_index->getPointer()), *iP(_index->getPointer());
+ const mcIdType start = iP[siP[superIdx]+idx], end = iP[siP[superIdx]+idx+1];
// _values
std::copy(vP+end, vP+_values->getNbOfElems(), vP+start);
_values->reAlloc(_values->getNbOfElems() - (end-start));
// _index
- int nt = _index->getNbOfElems();
+ mcIdType nt = _index->getNbOfElems();
std::copy(iP+siP[superIdx]+idx+1, iP+nt, iP+siP[superIdx]+idx);
_index->reAlloc(nt-1); iP = _index->getPointer(); // better not forget this ...
- for(int ii = siP[superIdx]+idx; ii < nt-1; ii++)
+ for(mcIdType ii = siP[superIdx]+idx; ii < nt-1; ii++)
iP[ii] -= (end-start);
// _super_index
- for(int ii = superIdx+1; ii < (int)_super_index->getNbOfElems(); ii++)
+ for(mcIdType ii = superIdx+1; ii < _super_index->getNbOfElems(); ii++)
(siP[ii])--;
}
-void MEDCouplingSkyLineArray::deleteSimplePack(const int idx)
+void MEDCouplingSkyLineArray::deleteSimplePack(const mcIdType idx)
{
validIndex("deleteSimplePack", idx);
- int* iP(_index->getPointer());
- const int start(iP[idx]), end(iP[idx+1]);
+ mcIdType* iP(_index->getPointer());
+ const mcIdType start(iP[idx]), end(iP[idx+1]);
// _values
- int initValSz( _values->getNbOfElems() );
- int deltaSz( start-end ); // should be negative
- int *vP(_values->getPointer());
+ mcIdType initValSz=_values->getNbOfElems();
+ mcIdType deltaSz( start-end ); // should be negative
+ mcIdType *vP(_values->getPointer());
if (deltaSz < 0)
{
std::copy(vP+end, vP+initValSz, vP+start);
else
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::deleteSimplePack");
// _index
- int nt(_index->getNbOfElems());
+ mcIdType nt=_index->getNbOfElems();
std::copy(iP+idx+1, iP+nt, iP+idx);
- for(int ii = idx; ii < nt-1; ii++)
+ for(mcIdType ii = idx; ii < nt-1; ii++)
iP[ii] += deltaSz;
_index->reAlloc(nt-1);
}
-void MEDCouplingSkyLineArray::replaceSimplePacks(const DataArrayInt* idx, const std::vector<const DataArrayInt*>& packs)
+void MEDCouplingSkyLineArray::replaceSimplePacks(const DataArrayIdType* idx, const std::vector<const DataArrayIdType*>& packs)
{
if (idx->empty())
return;
- for (const int * id = idx->begin(); id != idx->end(); id++)
+ for (const mcIdType * id = idx->begin(); id != idx->end(); id++)
validIndex("deleteSimplePacks", *id);
- if (idx->getNbOfElems() != packs.size())
+ if (idx->getNbOfElems() != ToIdType( packs.size()))
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::deleteSimplePacks: size of list of pack is incorrect");
- // copy _index, _values into a deque<set<int>>
- std::deque< std::set<int> > valuesByIdx;
- int* vP(_values->getPointer());
- int* iP(_index->getPointer());
- std::size_t nt ( _index->getNbOfElems() );
- for (int ii = 0; ii < nt-1; ii++)
- valuesByIdx.push_back(std::set<int>(vP+iP[ii], vP+iP[ii+1]));
+ // copy _index, _values into a deque<set<mcIdType>>
+ std::deque< std::set<mcIdType> > valuesByIdx;
+ mcIdType* vP(_values->getPointer());
+ mcIdType* iP(_index->getPointer());
+ mcIdType nt = _index->getNbOfElems();
+ for (mcIdType ii = 0; ii < nt-1; ii++)
+ valuesByIdx.push_back(std::set<mcIdType>(vP+iP[ii], vP+iP[ii+1]));
- // modify the deque<set<int>> according to idx and packs
- int ii(0);
- for (const int *id = idx->begin(); id != idx->end(); id++)
+ // modify the deque<set<mcIdType>> according to idx and packs
+ mcIdType ii(0);
+ for (const mcIdType *id = idx->begin(); id != idx->end(); id++)
{
- valuesByIdx[*id] = std::set<int>(packs[ii]->begin(), packs[ii]->end());
+ valuesByIdx[*id] = std::set<mcIdType>(packs[ii]->begin(), packs[ii]->end());
ii++;
}
- // copy back the deque<set<int>> into _index, _values
- int valSz(0);
+ // copy back the deque<set<mcIdType>> into _index, _values
+ mcIdType valSz(0);
*iP = 0;
- for (std::deque< std::set<int> >::const_iterator values=valuesByIdx.begin();values!=valuesByIdx.end();values++)
+ for (std::deque< std::set<mcIdType> >::const_iterator values=valuesByIdx.begin();values!=valuesByIdx.end();values++)
{
- valSz += (*values).size();
+ valSz += ToIdType((*values).size());
*(++iP) = valSz;
}
_values->reAlloc(valSz);
}
}
-void MEDCouplingSkyLineArray::deleteSimplePacks(const DataArrayInt* idx)
+void MEDCouplingSkyLineArray::deleteSimplePacks(const DataArrayIdType* idx)
{
for (auto id = idx->begin(); id != idx->end(); id++)
validIndex("deleteSimplePacks", *id);
- std::set<int> packsToDelete(idx->begin(), idx->end());
+ std::set<mcIdType> packsToDelete(idx->begin(), idx->end());
// _values
- int* iP(_index->getPointer());
- int initValSz = _values->getNbOfElems();
- int *vP(_values->getPointer());
- int end_prec(0),start_prec(0);
- for(std::set<int>::const_iterator ii=packsToDelete.begin();ii!=packsToDelete.end();ii++)
+ mcIdType* iP(_index->getPointer());
+ mcIdType initValSz = _values->getNbOfElems();
+ mcIdType *vP(_values->getPointer());
+ mcIdType end_prec(0),start_prec(0);
+ for(std::set<mcIdType>::const_iterator ii=packsToDelete.begin();ii!=packsToDelete.end();ii++)
{
- int start = iP[*ii];
+ mcIdType start = iP[*ii];
if (end_prec != 0)
std::copy(vP+end_prec, vP+start, vP+start_prec);
start_prec += start-end_prec;
_values->reAlloc(initValSz-(end_prec-start_prec));
// _index
- int nt = _index->getNbOfElems();
- int offset = 0;
+ mcIdType nt = _index->getNbOfElems();
+ mcIdType offset = 0;
end_prec = 0;
start_prec = 0;
- int deleted = 0;
- for(std::set<int>::const_iterator ii=packsToDelete.begin();ii!=packsToDelete.end();ii++)
+ mcIdType deleted = 0;
+ for(std::set<mcIdType>::const_iterator ii=packsToDelete.begin();ii!=packsToDelete.end();ii++)
{
if (end_prec != 0)
{
std::copy(iP+end_prec, iP+*ii, iP+start_prec);
- for (int i=start_prec; i<*ii; i++)
+ for (mcIdType i=start_prec; i<*ii; i++)
iP[i] -= offset;
}
offset += iP[*ii+1] - iP[*ii];
if (end_prec != 0)
{
std::copy(iP+end_prec, iP+nt, iP+start_prec);
- for (int i=start_prec; i<nt; i++)
+ for (mcIdType i=start_prec; i<nt; i++)
iP[i] -= offset;
}
_index->reAlloc(nt-deleted);
/**!
* Insert a new pack in super-pack at index 'superIdx'. The pack is inserted at the end of the pack list of the chosen super-pack.
*/
-void MEDCouplingSkyLineArray::pushBackPack(const int superIdx, const int * packBg, const int * packEnd)
+void MEDCouplingSkyLineArray::pushBackPack(const mcIdType superIdx, const mcIdType * packBg, const mcIdType * packEnd)
{
using namespace std;
checkSuperIndex("pushBackPack");
validSuperIndex("pushBackPack", superIdx);
- int *siP(_super_index->getPointer()), *iP(_index->getPointer());
- const int sz(distance(packBg, packEnd));
+ mcIdType *siP(_super_index->getPointer()), *iP(_index->getPointer());
+ const mcIdType sz(ToIdType(distance(packBg, packEnd)));
// _values
_values->reAlloc(_values->getNbOfElems()+sz);
- int * vPE(_values->getPointer()+_values->getNbOfElems());
- int *vP(_values->getPointer());
+ mcIdType * vPE(_values->getPointer()+_values->getNbOfElems());
+ mcIdType *vP(_values->getPointer());
copy(vP+iP[siP[superIdx+1]], vPE-sz, vP+iP[siP[superIdx+1]]+sz);
// insert pack
copy(packBg, packEnd, vP+iP[siP[superIdx+1]]);
// _index
- int nt = _index->getNbOfElems();
+ mcIdType nt = ToIdType(_index->getNbOfElems());
_index->reAlloc(nt+1); iP = _index->getPointer();
copy(iP+siP[superIdx+1]+1, iP+nt, iP+siP[superIdx+1]+2);
iP[siP[superIdx+1]+1] = iP[siP[superIdx+1]] + sz;
- for(int ii = siP[superIdx+1]+2; ii < nt+1; ii++)
+ for(mcIdType ii = siP[superIdx+1]+2; ii < nt+1; ii++)
iP[ii] += sz;
// _super_index
- for(int ii = superIdx+1; ii < (int)_super_index->getNbOfElems(); ii++)
+ for(mcIdType ii = superIdx+1; ii < _super_index->getNbOfElems(); ii++)
(siP[ii])++;
}
* Replace pack with absolute index 'idx' with the provided new pack. Function can be used either
* for 2-level SkyLine or 3-level SkyLine.
*/
-void MEDCouplingSkyLineArray::replaceSimplePack(const int idx, const int * packBg, const int * packEnd)
+void MEDCouplingSkyLineArray::replaceSimplePack(const mcIdType idx, const mcIdType * packBg, const mcIdType * packEnd)
{
validIndex("replaceSimplePack", idx);
- int * iP(_index->getPointer());
- int newSz = std::distance(packBg, packEnd);
- const int start = iP[idx], end = iP[idx+1];
+ mcIdType * iP(_index->getPointer());
+ mcIdType newSz = ToIdType(std::distance(packBg, packEnd));
+ const mcIdType start = iP[idx], end = iP[idx+1];
// _values
- int initValSz = _values->getNbOfElems();
- int deltaSz = newSz-(end-start); // can be negative
+ mcIdType initValSz = _values->getNbOfElems();
+ mcIdType deltaSz = newSz-(end-start); // can be negative
if (deltaSz)
{
if (deltaSz > 0)
_values->reAlloc(initValSz+deltaSz);
- int *vP(_values->getPointer());
+ mcIdType *vP(_values->getPointer());
std::copy(vP+end, vP+initValSz, vP+end+deltaSz);
if (deltaSz < 0)
_values->reAlloc(initValSz+deltaSz);
std::copy(packBg, packEnd, _values->getPointer()+start);
// _index
- for(int ii = idx+1; ii < (int)_index->getNbOfElems(); ii++)
+ for(mcIdType ii = idx+1; ii < _index->getNbOfElems(); ii++)
iP[ii] += deltaSz;
}
* Replace pack with super index 'superIdx' and index 'idx' with the provided new pack.
* Function can be used only for 3-level SkyLine.
*/
-void MEDCouplingSkyLineArray::replacePack(const int superIdx, const int idx, const int *packBg, const int *packEnd)
+void MEDCouplingSkyLineArray::replacePack(const mcIdType superIdx, const mcIdType idx, const mcIdType *packBg, const mcIdType *packEnd)
{
checkSuperIndex("replacePack");
validSuperIndexAndIndex("replacePack", superIdx, idx);
- int * siP(_super_index->getPointer()), *iP(_index->getPointer());
- int newSz = std::distance(packBg, packEnd);
- const int start = iP[siP[superIdx]+idx], end = iP[siP[superIdx]+idx+1];
+ mcIdType * siP(_super_index->getPointer()), *iP(_index->getPointer());
+ mcIdType newSz = ToIdType(std::distance(packBg, packEnd));
+ const mcIdType start = iP[siP[superIdx]+idx], end = iP[siP[superIdx]+idx+1];
// _values
- int initValSz = _values->getNbOfElems();
- int deltaSz = newSz-(end-start); // can be negative
+ mcIdType initValSz = _values->getNbOfElems();
+ mcIdType deltaSz = newSz-(end-start); // can be negative
if (deltaSz)
{
if (deltaSz > 0)
_values->reAlloc(initValSz+deltaSz);
- int *vP(_values->getPointer());
+ mcIdType *vP(_values->getPointer());
std::copy(vP+end, vP+initValSz, vP+end+deltaSz);
if (deltaSz < 0)
_values->reAlloc(initValSz+deltaSz);
std::copy(packBg, packEnd, _values->getPointer()+start);
// _index
- for(int ii = siP[superIdx]+idx+1; ii < (int)_index->getNbOfElems(); ii++)
+ for(mcIdType ii = siP[superIdx]+idx+1; ii < _index->getNbOfElems(); ii++)
iP[ii] += deltaSz;
}
{
public:
static MEDCouplingSkyLineArray * New();
- static MEDCouplingSkyLineArray * New( const std::vector<int>& index, const std::vector<int>& value);
- static MEDCouplingSkyLineArray * New( DataArrayInt* index, DataArrayInt* value );
+ static MEDCouplingSkyLineArray * New( const std::vector<mcIdType>& index, const std::vector<mcIdType>& value);
+ static MEDCouplingSkyLineArray * New( DataArrayIdType* index, DataArrayIdType* value );
static MEDCouplingSkyLineArray * New( const MEDCouplingSkyLineArray & other );
- static MEDCouplingSkyLineArray * BuildFromPolyhedronConn( const DataArrayInt* c, const DataArrayInt* cI );
+ static MEDCouplingSkyLineArray * BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI );
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
- void set( DataArrayInt* index, DataArrayInt* value );
- void set3( DataArrayInt* superIndex, DataArrayInt* index, DataArrayInt* value );
+ void set( DataArrayIdType* index, DataArrayIdType* value );
+ void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value );
- int getSuperNumberOf() const { return _super_index->getNbOfElems()-1; }
- int getNumberOf() const { return _index->getNbOfElems()-1; }
- int getLength() const { return _values->getNbOfElems(); }
+ mcIdType getSuperNumberOf() const { return ToIdType(_super_index->getNbOfElems())-1; }
+ mcIdType getNumberOf() const { return ToIdType(_index->getNbOfElems())-1; }
+ mcIdType getLength() const { return ToIdType(_values->getNbOfElems()); }
- const int* getSuperIndex() const { return _super_index->begin(); }
- const int* getIndex() const { return _index->begin(); }
- const int* getValues() const { return _values->begin(); }
+ const mcIdType* getSuperIndex() const { return _super_index->begin(); }
+ const mcIdType* getIndex() const { return _index->begin(); }
+ const mcIdType* getValues() const { return _values->begin(); }
- DataArrayInt* getSuperIndexArray() const;
- DataArrayInt* getIndexArray() const;
- DataArrayInt* getValuesArray() const;
+ DataArrayIdType* getSuperIndexArray() const;
+ DataArrayIdType* getIndexArray() const;
+ DataArrayIdType* getValuesArray() const;
std::string simpleRepr() const;
- void getSimplePackSafe(const int absolutePackId, std::vector<int> & pack) const;
- const int * getSimplePackSafePtr(const int absolutePackId, int & packSize) const;
- void findPackIds(const std::vector<int> & superPackIndices, const int *packBg, const int *packEnd,
- std::vector<int>& out) const;
+ void getSimplePackSafe(const mcIdType absolutePackId, std::vector<mcIdType> & pack) const;
+ const mcIdType * getSimplePackSafePtr(const mcIdType absolutePackId, mcIdType & packSize) const;
+ void findPackIds(const std::vector<mcIdType> & superPackIndices, const mcIdType *packBg, const mcIdType *packEnd,
+ std::vector<mcIdType>& out) const;
- void deletePack(const int superIdx, const int idx);
- void deleteSimplePack(const int idx);
- void pushBackPack(const int superIdx, const int * packBg, const int * packEnd);
+ void deletePack(const mcIdType superIdx, const mcIdType idx);
+ void deleteSimplePack(const mcIdType idx);
+ void pushBackPack(const mcIdType superIdx, const mcIdType * packBg, const mcIdType * packEnd);
- void replaceSimplePack(const int idx, const int * packBg, const int * packEnd);
- void replacePack(const int superIdx, const int idx, const int * packBg, const int * packEnd);
+ void replaceSimplePack(const mcIdType idx, const mcIdType * packBg, const mcIdType * packEnd);
+ void replacePack(const mcIdType superIdx, const mcIdType idx, const mcIdType * packBg, const mcIdType * packEnd);
- void deleteSimplePacks(const DataArrayInt* idx);
- void replaceSimplePacks(const DataArrayInt* idx, const std::vector<const DataArrayInt*>& packs);
+ void deleteSimplePacks(const DataArrayIdType* idx);
+ void replaceSimplePacks(const DataArrayIdType* idx, const std::vector<const DataArrayIdType*>& packs);
- void convertToPolyhedronConn( MCAuto<DataArrayInt>& c, MCAuto<DataArrayInt>& cI) const;
+ void convertToPolyhedronConn( MCAuto<DataArrayIdType>& c, MCAuto<DataArrayIdType>& cI) const;
private:
MEDCouplingSkyLineArray();
~MEDCouplingSkyLineArray();
void checkSuperIndex(const std::string& func) const;
- void validSuperIndex(const std::string& func, int superIndex) const;
- void validIndex(const std::string& func, int index) const;
- void validSuperIndexAndIndex(const std::string& func, int superIndex, int index) const;
+ void validSuperIndex(const std::string& func, mcIdType superIndex) const;
+ void validIndex(const std::string& func, mcIdType index) const;
+ void validSuperIndexAndIndex(const std::string& func, mcIdType superIndex, mcIdType index) const;
MCAuto<DataArrayIdType> _super_index;
MCAuto<DataArrayIdType> _index;
return MEDCouplingMesh::isEqualIfNotWhy(other,prec,reason);
}
-INTERP_KERNEL::NormalizedCellType MEDCouplingStructuredMesh::getTypeOfCell(std::size_t cellId) const
+INTERP_KERNEL::NormalizedCellType MEDCouplingStructuredMesh::getTypeOfCell(mcIdType cellId) const
{
return GetGeoTypeGivenMeshDimension(getMeshDimension());
}
return ret2;
}
-std::size_t MEDCouplingStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
+mcIdType MEDCouplingStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
- std::size_t ret(getNumberOfCells());
+ mcIdType ret(getNumberOfCells());
if(type==getTypeOfCell(0))
return ret;
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0)));
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
-DataArrayInt *MEDCouplingStructuredMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
+DataArrayIdType *MEDCouplingStructuredMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
if(getTypeOfCell(0)==type)
{
ret->alloc(getNumberOfCells(),1);
return ret.retn();
}
-DataArrayInt *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const
+DataArrayIdType *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const
{
- int nbCells=getNumberOfCells();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ std::size_t nbCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbCells,1);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0));
- ret->fillWithValue((int)cm.getNumberOfNodes());
+ ret->fillWithValue(ToIdType(cm.getNumberOfNodes()));
return ret.retn();
}
-DataArrayInt *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const
+DataArrayIdType *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const
{
- int nbCells=getNumberOfCells();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ std::size_t nbCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbCells,1);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0));
- ret->fillWithValue((int)cm.getNumberOfSons());
+ ret->fillWithValue(ToIdType(cm.getNumberOfSons()));
return ret.retn();
}
* will be counted only once here whereas it will be counted several times in MEDCouplingMesh::computeNbOfNodesPerCell method.
* Here for structured mesh it returns exactly as MEDCouplingStructuredMesh::computeNbOfNodesPerCell does.
*
- * \return DataArrayInt * - new object to be deallocated by the caller.
+ * \return DataArrayIdType * - new object to be deallocated by the caller.
*/
-DataArrayInt *MEDCouplingStructuredMesh::computeEffectiveNbOfNodesPerCell() const
+DataArrayIdType *MEDCouplingStructuredMesh::computeEffectiveNbOfNodesPerCell() const
{
return computeNbOfNodesPerCell();
}
-void MEDCouplingStructuredMesh::getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const
+void MEDCouplingStructuredMesh::getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const
{
int meshDim=getMeshDimension();
- int tmpCell[3],tmpNode[3];
+ mcIdType tmpCell[3],tmpNode[3];
getSplitCellValues(tmpCell);
getSplitNodeValues(tmpNode);
- int tmp2[3];
+ mcIdType tmp2[3];
GetPosFromId(cellId,meshDim,tmpCell,tmp2);
switch(meshDim)
{
*/
int MEDCouplingStructuredMesh::getMeshDimension() const
{
- std::vector<int> ngs(getNodeGridStructure());
+ std::vector<mcIdType> ngs(getNodeGridStructure());
int ret(0),pos(0);
- for(std::vector<int>::const_iterator it=ngs.begin();it!=ngs.end();it++,pos++)
+ for(std::vector<mcIdType>::const_iterator it=ngs.begin();it!=ngs.end();it++,pos++)
{
if(*it<=0)
{
*/
int MEDCouplingStructuredMesh::getSpaceDimensionOnNodeStruct() const
{
- std::vector<int> nodeStr(getNodeGridStructure());
+ std::vector<mcIdType> nodeStr(getNodeGridStructure());
int spd1(0),pos(0);
- for(std::vector<int>::const_iterator it=nodeStr.begin();it!=nodeStr.end();it++,pos++)
+ for(std::vector<mcIdType>::const_iterator it=nodeStr.begin();it!=nodeStr.end();it++,pos++)
{
- int elt(*it);
+ mcIdType elt(*it);
if(elt<=0)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getSpaceDimensionOnNodeStruct : At pos #" << pos << " value of node grid structure is " << *it << " ! must be >=1 !";
return spd1;
}
-void MEDCouplingStructuredMesh::getSplitCellValues(int *res) const
+void MEDCouplingStructuredMesh::getSplitCellValues(mcIdType *res) const
{
- std::vector<int> strct(getCellGridStructure());
- std::vector<int> ret(MEDCouplingStructuredMesh::GetSplitVectFromStruct(strct));
+ std::vector<mcIdType> strct(getCellGridStructure());
+ std::vector<mcIdType> ret(MEDCouplingStructuredMesh::GetSplitVectFromStruct(strct));
std::copy(ret.begin(),ret.end(),res);
}
-void MEDCouplingStructuredMesh::getSplitNodeValues(int *res) const
+void MEDCouplingStructuredMesh::getSplitNodeValues(mcIdType *res) const
{
- std::vector<int> strct(getNodeGridStructure());
- std::vector<int> ret(MEDCouplingStructuredMesh::GetSplitVectFromStruct(strct));
+ std::vector<mcIdType> strct(getNodeGridStructure());
+ std::vector<mcIdType> ret(MEDCouplingStructuredMesh::GetSplitVectFromStruct(strct));
std::copy(ret.begin(),ret.end(),res);
}
/*!
* This method returns the number of cells of unstructured sub level mesh, without building it.
*/
-int MEDCouplingStructuredMesh::getNumberOfCellsOfSubLevelMesh() const
+mcIdType MEDCouplingStructuredMesh::getNumberOfCellsOfSubLevelMesh() const
{
- std::vector<int> cgs(getCellGridStructure());
+ std::vector<mcIdType> cgs(getCellGridStructure());
return GetNumberOfCellsOfSubLevelMesh(cgs,getMeshDimension());
}
/*!
* See MEDCouplingUMesh::getDistributionOfTypes for more information
*/
-std::vector<int> MEDCouplingStructuredMesh::getDistributionOfTypes() const
+std::vector<mcIdType> MEDCouplingStructuredMesh::getDistributionOfTypes() const
{
//only one type of cell
- std::vector<int> ret(3);
+ std::vector<mcIdType> ret(3);
ret[0]=getTypeOfCell(0);
ret[1]=getNumberOfCells();
ret[2]=-1; //ret[3*k+2]==-1 because it has no sense here
*
* See MEDCouplingUMesh::checkTypeConsistencyAndContig for more information
*/
-DataArrayInt *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
+DataArrayIdType *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(code.size()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : invalid input code should be exactly of size 3 !");
- if(code[0]!=(int)getTypeOfCell(0))
+ if(code[0]!=ToIdType(getTypeOfCell(0)))
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : Mismatch of geometric type ! Asking for " << code[0] << " whereas the geometric type is \a this is " << getTypeOfCell(0) << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
if(code[2]!=0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : single geo type mesh ! 0 or -1 is expected at pos #2 of input code !");
if(idsPerType.size()!=1)
- throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : input code points to DataArrayInt #0 whereas the size of idsPerType is not equal to 1 !");
- const DataArrayInt *pfl=idsPerType[0];
+ throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : input code points to DataArrayIdType #0 whereas the size of idsPerType is not equal to 1 !");
+ const DataArrayIdType *pfl=idsPerType[0];
if(!pfl)
- throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : the input code points to a NULL DataArrayInt at rank 0 !");
+ throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : the input code points to a NULL DataArrayIdType at rank 0 !");
if(pfl->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : input profile should have exactly one component !");
pfl->checkAllIdsInRange(0,nbOfCells);
pfl->incrRef();
- return const_cast<DataArrayInt *>(pfl);
+ return const_cast<DataArrayIdType *>(pfl);
}
/*!
* - After \a code contains [NORM_...,nbCells,0], \a idsInPflPerType [[0,1]] and \a idsPerType is [[1,2]] <br>
*/
-void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType, bool smartPflKiller) const
+void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller) const
{
if(!profile || !profile->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile is NULL or not allocated !");
if(profile->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile should have exactly one component !");
- int nbTuples(profile->getNumberOfTuples());
- int nbOfCells=getNumberOfCells();
+ mcIdType nbTuples(profile->getNumberOfTuples());
+ mcIdType nbOfCells=getNumberOfCells();
code.resize(3); idsInPflPerType.resize(1);
- code[0]=(int)getTypeOfCell(0); code[1]=nbOfCells;
+ code[0]=ToIdType(getTypeOfCell(0)); code[1]=nbOfCells;
idsInPflPerType.resize(1);
if(smartPflKiller && profile->isIota(nbOfCells))
{
profile->checkAllIdsInRange(0,nbOfCells);
idsPerType.resize(1);
idsPerType[0]=profile->deepCopy();
- idsInPflPerType[0]=DataArrayInt::Range(0,nbTuples,1);
+ idsInPflPerType[0]=DataArrayIdType::Range(0,nbTuples,1);
}
/*!
if((meshDim<0 || meshDim>3) || (spaceDim<0 || spaceDim>3))
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::build1SGTUnstructured : meshdim and spacedim must be in [1,2,3] !");
MCAuto<DataArrayDouble> coords(getCoordinatesAndOwner());
- int ns[3];
+ mcIdType ns[3];
getNodeGridStructure(ns);
- MCAuto<DataArrayInt> conn(Build1GTNodalConnectivity(ns,ns+spaceDim));
+ MCAuto<DataArrayIdType> conn(Build1GTNodalConnectivity(ns,ns+spaceDim));
MCAuto<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim)));
ret->setNodalConnectivity(conn); ret->setCoords(coords);
try
if(meshDim<1 || meshDim>3)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::build1SGTSubLevelMesh : meshdim must be in [2,3] !");
MCAuto<DataArrayDouble> coords(getCoordinatesAndOwner());
- int ns[3];
+ mcIdType ns[3];
getNodeGridStructure(ns);
- MCAuto<DataArrayInt> conn(Build1GTNodalConnectivityOfSubLevelMesh(ns,ns+meshDim));
+ MCAuto<DataArrayIdType> conn(Build1GTNodalConnectivityOfSubLevelMesh(ns,ns+meshDim));
MCAuto<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim-1)));
ret->setNodalConnectivity(conn); ret->setCoords(coords);
return ret.retn();
* \return MEDCouplingMesh * - a new instance of MEDCouplingUMesh. The caller is to
* delete this mesh using decrRef() as it is no more needed.
*/
-MEDCouplingMesh *MEDCouplingStructuredMesh::buildPart(const int *start, const int *end) const
+MEDCouplingMesh *MEDCouplingStructuredMesh::buildPart(const mcIdType *start, const mcIdType *end) const
{
MCAuto<MEDCouplingUMesh> um(buildUnstructured());
return um->buildPart(start,end);
}
-MEDCouplingMesh *MEDCouplingStructuredMesh::buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const
+MEDCouplingMesh *MEDCouplingStructuredMesh::buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const
{
- std::vector<int> cgs(getCellGridStructure());
- std::vector< std::pair<int,int> > cellPartFormat,nodePartFormat;
+ std::vector<mcIdType> cgs(getCellGridStructure());
+ std::vector< std::pair<mcIdType,mcIdType> > cellPartFormat,nodePartFormat;
if(IsPartStructured(start,end,cgs,cellPartFormat))
{
MCAuto<MEDCouplingStructuredMesh> ret(buildStructuredSubPart(cellPartFormat));
nodePartFormat=cellPartFormat;
- for(std::vector< std::pair<int,int> >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++)
+ for(std::vector< std::pair<mcIdType,mcIdType> >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++)
(*it).second++;
- MCAuto<DataArrayInt> tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat));
- MCAuto<DataArrayInt> tmp2(DataArrayInt::New()); tmp2->alloc(getNumberOfNodes(),1);
+ MCAuto<DataArrayIdType> tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat));
+ MCAuto<DataArrayIdType> tmp2(DataArrayIdType::New()); tmp2->alloc(getNumberOfNodes(),1);
tmp2->fillWithValue(-1);
- MCAuto<DataArrayInt> tmp3(DataArrayInt::New()); tmp3->alloc(tmp1->getNumberOfTuples(),1); tmp3->iota(0);
+ MCAuto<DataArrayIdType> tmp3(DataArrayIdType::New()); tmp3->alloc(tmp1->getNumberOfTuples(),1); tmp3->iota(0);
tmp2->setPartOfValues3(tmp3,tmp1->begin(),tmp1->end(),0,1,1);
arr=tmp2.retn();
return ret.retn();
}
}
-DataArrayInt *MEDCouplingStructuredMesh::simplexize(int policy)
+DataArrayIdType *MEDCouplingStructuredMesh::simplexize(int policy)
{
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::simplexize : not available for Cartesian mesh !");
}
throw INTERP_KERNEL::Exception("Expected a MEDCouplingStructuredMesh with meshDim == 2 !");
MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME));
MCAuto<DataArrayDouble> array(DataArrayDouble::New());
- int nbOfCells(getNumberOfCells());
+ mcIdType nbOfCells=getNumberOfCells();
array->alloc(nbOfCells,3);
double *vals(array->getPointer());
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{ vals[3*i]=0.; vals[3*i+1]=0.; vals[3*i+2]=1.; }
ret->setArray(array);
ret->setMesh(this);
return ret.retn();
}
-void MEDCouplingStructuredMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const
+void MEDCouplingStructuredMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const
{
- std::vector<int> ngs(getNodeGridStructure());
+ std::vector<mcIdType> ngs(getNodeGridStructure());
int dim(getSpaceDimension());
switch(dim)
{
}
}
-void MEDCouplingStructuredMesh::GetReverseNodalConnectivity1(const std::vector<int>& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx)
+void MEDCouplingStructuredMesh::GetReverseNodalConnectivity1(const std::vector<mcIdType>& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx)
{
- int nbNodes(ngs[0]);
+ mcIdType nbNodes(ngs[0]);
revNodalIndx->alloc(nbNodes+1,1);
if(nbNodes==0)
{ revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; }
if(nbNodes==1)
{ revNodal->alloc(1,1); revNodal->setIJ(0,0,0); revNodalIndx->setIJ(0,0,0); revNodalIndx->setIJ(1,0,1); return ; }
revNodal->alloc(2*(nbNodes-1),1);
- int *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer());
+ mcIdType *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer());
*rni++=0; *rni=1; *rn++=0;
- for(int i=1;i<nbNodes-1;i++,rni++)
+ for(mcIdType i=1;i<nbNodes-1;i++,rni++)
{
rn[0]=i-1; rn[1]=i;
rni[1]=rni[0]+2;
rn[0]=nbNodes-2; rni[1]=rni[0]+1;
}
-void MEDCouplingStructuredMesh::GetReverseNodalConnectivity2(const std::vector<int>& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx)
+void MEDCouplingStructuredMesh::GetReverseNodalConnectivity2(const std::vector<mcIdType>& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx)
{
- int nbNodesX(ngs[0]),nbNodesY(ngs[1]);
- int nbNodes(nbNodesX*nbNodesY);
+ mcIdType nbNodesX(ngs[0]),nbNodesY(ngs[1]);
+ mcIdType nbNodes(nbNodesX*nbNodesY);
if(nbNodesX==0 || nbNodesY==0)
{ revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; }
if(nbNodesX==1 || nbNodesY==1)
- { std::vector<int> ngs2(1); ngs2[0]=std::max(nbNodesX,nbNodesY); return GetReverseNodalConnectivity1(ngs2,revNodal,revNodalIndx); }
+ { std::vector<mcIdType> ngs2(1); ngs2[0]=std::max(nbNodesX,nbNodesY); return GetReverseNodalConnectivity1(ngs2,revNodal,revNodalIndx); }
revNodalIndx->alloc(nbNodes+1,1);
- int nbCellsX(nbNodesX-1),nbCellsY(nbNodesY-1);
+ mcIdType nbCellsX(nbNodesX-1),nbCellsY(nbNodesY-1);
revNodal->alloc(4*(nbNodesX-2)*(nbNodesY-2)+2*2*(nbNodesX-2)+2*2*(nbNodesY-2)+4,1);
- int *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer());
+ mcIdType *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer());
*rni++=0; *rni=1; *rn++=0;
- for(int i=1;i<nbNodesX-1;i++,rni++,rn+=2)
+ for(mcIdType i=1;i<nbNodesX-1;i++,rni++,rn+=2)
{
rn[0]=i-1; rn[1]=i;
rni[1]=rni[0]+2;
}
rni[1]=rni[0]+1; *rn++=nbCellsX-1;
rni++;
- for(int j=1;j<nbNodesY-1;j++)
+ for(mcIdType j=1;j<nbNodesY-1;j++)
{
- int off(nbCellsX*(j-1)),off2(nbCellsX*j);
+ mcIdType off(nbCellsX*(j-1)),off2(nbCellsX*j);
rni[1]=rni[0]+2; rn[0]=off; rn[1]=off2;
rni++; rn+=2;
- for(int i=1;i<nbNodesX-1;i++,rni++,rn+=4)
+ for(mcIdType i=1;i<nbNodesX-1;i++,rni++,rn+=4)
{
rn[0]=i-1+off; rn[1]=i+off; rn[2]=i-1+off2; rn[3]=i+off2;
rni[1]=rni[0]+4;
rni[1]=rni[0]+2; rn[0]=off+nbCellsX-1; rn[1]=off2+nbCellsX-1;
rni++; rn+=2;
}
- int off3(nbCellsX*(nbCellsY-1));
+ mcIdType off3(nbCellsX*(nbCellsY-1));
rni[1]=rni[0]+1;
rni++; *rn++=off3;
- for(int i=1;i<nbNodesX-1;i++,rni++,rn+=2)
+ for(mcIdType i=1;i<nbNodesX-1;i++,rni++,rn+=2)
{
rn[0]=i-1+off3; rn[1]=i+off3;
rni[1]=rni[0]+2;
rni[1]=rni[0]+1; rn[0]=nbCellsX*nbCellsY-1;
}
-void MEDCouplingStructuredMesh::GetReverseNodalConnectivity3(const std::vector<int>& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx)
+void MEDCouplingStructuredMesh::GetReverseNodalConnectivity3(const std::vector<mcIdType>& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx)
{
- int nbNodesX(ngs[0]),nbNodesY(ngs[1]),nbNodesZ(ngs[2]);
- int nbNodes(nbNodesX*nbNodesY*nbNodesZ);
+ mcIdType nbNodesX(ngs[0]),nbNodesY(ngs[1]),nbNodesZ(ngs[2]);
+ mcIdType nbNodes(nbNodesX*nbNodesY*nbNodesZ);
if(nbNodesX==0 || nbNodesY==0 || nbNodesZ==0)
{ revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; }
if(nbNodesX==1 || nbNodesY==1 || nbNodesZ==1)
{
- std::vector<int> ngs2(2);
- int pos(0);
+ std::vector<mcIdType> ngs2(2);
+ mcIdType pos(0);
bool pass(false);
for(int i=0;i<3;i++)
{
return GetReverseNodalConnectivity2(ngs2,revNodal,revNodalIndx);
}
revNodalIndx->alloc(nbNodes+1,1);
- int nbCellsX(nbNodesX-1),nbCellsY(nbNodesY-1),nbCellsZ(nbNodesZ-1);
+ mcIdType nbCellsX(nbNodesX-1),nbCellsY(nbNodesY-1),nbCellsZ(nbNodesZ-1);
revNodal->alloc(8*(nbNodesX-2)*(nbNodesY-2)*(nbNodesZ-2)+4*(2*(nbNodesX-2)*(nbNodesY-2)+2*(nbNodesX-2)*(nbNodesZ-2)+2*(nbNodesY-2)*(nbNodesZ-2))+2*4*(nbNodesX-2)+2*4*(nbNodesY-2)+2*4*(nbNodesZ-2)+8,1);
- int *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer());
+ mcIdType *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer());
*rni=0;
- for(int k=0;k<nbNodesZ;k++)
+ for(mcIdType k=0;k<nbNodesZ;k++)
{
bool factZ(k!=0 && k!=nbNodesZ-1);
- int offZ0((k-1)*nbCellsX*nbCellsY),offZ1(k*nbCellsX*nbCellsY);
- for(int j=0;j<nbNodesY;j++)
+ mcIdType offZ0((k-1)*nbCellsX*nbCellsY),offZ1(k*nbCellsX*nbCellsY);
+ for(mcIdType j=0;j<nbNodesY;j++)
{
bool factYZ(factZ && (j!=0 && j!=nbNodesY-1));
- int off00((j-1)*nbCellsX+offZ0),off01(j*nbCellsX+offZ0),off10((j-1)*nbCellsX+offZ1),off11(j*nbCellsX+offZ1);
- for(int i=0;i<nbNodesX;i++,rni++)
+ mcIdType off00((j-1)*nbCellsX+offZ0),off01(j*nbCellsX+offZ0),off10((j-1)*nbCellsX+offZ1),off11(j*nbCellsX+offZ1);
+ for(mcIdType i=0;i<nbNodesX;i++,rni++)
{
- int fact(factYZ && (i!=0 && i!=nbNodesX-1));
+ mcIdType fact(factYZ && (i!=0 && i!=nbNodesX-1));
if(fact)
{//most of points fall in this part of code
rn[0]=off00+i-1; rn[1]=off00+i; rn[2]=off01+i-1; rn[3]=off01+i;
}
else
{
- int *rnRef(rn);
+ mcIdType *rnRef(rn);
if(k>=1 && j>=1 && i>=1)
*rn++=off00+i-1;
if(k>=1 && j>=1 && i<nbCellsX)
*rn++=off11+i-1;
if(k<nbCellsZ && j<nbCellsY && i<nbCellsX)
*rn++=off11+i;
- rni[1]=rni[0]+(int)(std::distance(rnRef,rn));
+ rni[1]=rni[0]+ToIdType(std::distance(rnRef,rn));
}
}
}
}
/*!
- * \return DataArrayInt * - newly allocated instance of nodal connectivity compatible for MEDCoupling1SGTMesh instance
+ * \return DataArrayIdType * - newly allocated instance of nodal connectivity compatible for MEDCoupling1SGTMesh instance
*/
-DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity(const int *nodeStBg, const int *nodeStEnd)
+DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivity(const mcIdType *nodeStBg, const mcIdType *nodeStEnd)
{
- int zippedNodeSt[3];
- int dim(ZipNodeStructure(nodeStBg,nodeStEnd,zippedNodeSt));
+ mcIdType zippedNodeSt[3];
+ mcIdType dim(ZipNodeStructure(nodeStBg,nodeStEnd,zippedNodeSt));
switch(dim)
{
case 0:
{
- MCAuto<DataArrayInt> conn(DataArrayInt::New());
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New());
conn->alloc(1,1); conn->setIJ(0,0,0);
return conn.retn();
}
}
}
-DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(const int *nodeStBg, const int *nodeStEnd)
+DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(const mcIdType *nodeStBg, const mcIdType *nodeStEnd)
{
std::size_t dim(std::distance(nodeStBg,nodeStEnd));
switch(dim)
/*!
* This method returns the list of ids sorted ascendingly of entities that are in the corner in ghost zone.
- * The ids are returned in a newly created DataArrayInt having a single component.
+ * The ids are returned in a newly created DataArrayIdType having a single component.
*
* \param [in] st - The structure \b without ghost cells.
* \param [in] ghostLev - The size of the ghost zone (>=0)
- * \return DataArrayInt * - The DataArray containing all the ids the caller is to deallocate.
+ * \return DataArrayIdType * - The DataArray containing all the ids the caller is to deallocate.
*/
-DataArrayInt *MEDCouplingStructuredMesh::ComputeCornersGhost(const std::vector<int>& st, int ghostLev)
+DataArrayIdType *MEDCouplingStructuredMesh::ComputeCornersGhost(const std::vector<mcIdType>& st, mcIdType ghostLev)
{
if(ghostLev<0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ComputeCornersGhost : ghost lev must be >= 0 !");
std::size_t dim(st.size());
- MCAuto<DataArrayInt> ret(DataArrayInt::New());
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
switch(dim)
{
case 1:
{
ret->alloc(2*ghostLev,1);
- int *ptr(ret->getPointer());
- for(int i=0;i<ghostLev;i++,ptr++)
+ mcIdType *ptr(ret->getPointer());
+ for(mcIdType i=0;i<ghostLev;i++,ptr++)
*ptr=i;
- int offset(st[0]);
+ mcIdType offset(st[0]);
if(offset<0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ComputeCornersGhost : element in 1D structure must be >= 0 !");
- for(int i=0;i<ghostLev;i++,ptr++)
+ for(mcIdType i=0;i<ghostLev;i++,ptr++)
*ptr=offset+ghostLev+i;
break;
}
case 2:
{
- int offsetX(st[0]),offsetY(st[1]);
+ mcIdType offsetX(st[0]),offsetY(st[1]);
if(offsetX<0 || offsetY<0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ComputeCornersGhost : elements in 2D structure must be >= 0 !");
ret->alloc(4*ghostLev,1);
- int *ptr(ret->getPointer());
- for(int i=0;i<ghostLev;i++)
+ mcIdType *ptr(ret->getPointer());
+ for(mcIdType i=0;i<ghostLev;i++)
{
*ptr++=i*(2*ghostLev+offsetX+1);
*ptr++=offsetX+2*ghostLev-1+i*(2*ghostLev+offsetX-1);
}
- for(int i=0;i<ghostLev;i++)
+ for(mcIdType i=0;i<ghostLev;i++)
{
*ptr++=(2*ghostLev+offsetX)*(offsetY+ghostLev)+ghostLev-1+i*(2*ghostLev+offsetX-1);
*ptr++=(2*ghostLev+offsetX)*(offsetY+ghostLev)+offsetX+ghostLev+i*(2*ghostLev+offsetX+1);
}
case 3:
{
- int offsetX(st[0]),offsetY(st[1]),offsetZ(st[2]);
+ mcIdType offsetX(st[0]),offsetY(st[1]),offsetZ(st[2]);
if(offsetX<0 || offsetY<0 || offsetZ<0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ComputeCornersGhost : elements in 3D structure must be >= 0 !");
ret->alloc(8*ghostLev,1);
- int *ptr(ret->getPointer());
- int zeOffsetZ((offsetX+2*ghostLev)*(offsetY+2*ghostLev));
- for(int i=0;i<ghostLev;i++)
+ mcIdType *ptr(ret->getPointer());
+ mcIdType zeOffsetZ((offsetX+2*ghostLev)*(offsetY+2*ghostLev));
+ for(mcIdType i=0;i<ghostLev;i++)
{
*ptr++=i*(2*ghostLev+offsetX+1)+i*zeOffsetZ;
*ptr++=offsetX+2*ghostLev-1+i*(2*ghostLev+offsetX-1)+i*zeOffsetZ;
*ptr++=(2*ghostLev+offsetX)*(offsetY+ghostLev)+ghostLev-1+(ghostLev-i-1)*(2*ghostLev+offsetX-1)+i*zeOffsetZ;
*ptr++=(2*ghostLev+offsetX)*(offsetY+ghostLev)+offsetX+ghostLev+(ghostLev-i-1)*(2*ghostLev+offsetX+1)+i*zeOffsetZ;
}
- int j(0),zeOffsetZ2(zeOffsetZ*(offsetZ+ghostLev));
- for(int i=ghostLev-1;i>=0;i--,j++)
+ mcIdType j(0),zeOffsetZ2(zeOffsetZ*(offsetZ+ghostLev));
+ for(mcIdType i=ghostLev-1;i>=0;i--,j++)
{
*ptr++=i*(2*ghostLev+offsetX+1)+j*zeOffsetZ+zeOffsetZ2;
*ptr++=offsetX+2*ghostLev-1+i*(2*ghostLev+offsetX-1)+j*zeOffsetZ+zeOffsetZ2;
*
* \sa BuildExplicitIdsFrom,IsPartStructured
*/
-int MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(const std::vector< std::pair<int,int> >& partCompactFormat)
+mcIdType MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat)
{
- int ret(1);
+ mcIdType ret(1);
std::size_t ii(0);
- for(std::vector< std::pair<int,int> >::const_iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,ii++)
+ for(std::vector< std::pair<mcIdType,mcIdType> >::const_iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,ii++)
{
- int a((*it).first),b((*it).second);
+ mcIdType a((*it).first),b((*it).second);
if(a<0 || b<0 || b-a<0)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt : invalid input at dimension " << ii << " !";
return ret;
}
-int MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(const std::vector<int>& st)
+mcIdType MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(const std::vector<mcIdType>& st)
{
- int ret(1);
+ mcIdType ret(1);
bool isFetched(false);
for(std::size_t i=0;i<st.size();i++)
{
return isFetched?ret:0;
}
-void MEDCouplingStructuredMesh::FindTheWidestAxisOfGivenRangeInCompactFrmt(const std::vector< std::pair<int,int> >& partCompactFormat, int& axisId, int& sizeOfRange)
+void MEDCouplingStructuredMesh::FindTheWidestAxisOfGivenRangeInCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat, int& axisId, mcIdType& sizeOfRange)
{
- int dim((int)partCompactFormat.size());
- int ret(-1);
+ mcIdType dim(ToIdType(partCompactFormat.size()));
+ mcIdType ret(-1);
for(int i=0;i<dim;i++)
{
- int curDelta(partCompactFormat[i].second-partCompactFormat[i].first);
+ mcIdType curDelta(partCompactFormat[i].second-partCompactFormat[i].first);
if(curDelta<0)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::FindTheWidestAxisOfGivenRangeInCompactFrmt : at axis #" << i << " the range is invalid (first value < second value) !";
* \param [out] reducedCrit - The reduction of \a criterion on \a partCompactFormat.
* \return - The number of True in \a st (that is equal to those in \a reducedCrit)
*/
-int MEDCouplingStructuredMesh::FindMinimalPartOf(int minPatchLgth, const std::vector<int>& st, const std::vector<bool>& crit, std::vector<bool>& reducedCrit, std::vector< std::pair<int,int> >& partCompactFormat)
+mcIdType MEDCouplingStructuredMesh::FindMinimalPartOf(mcIdType minPatchLgth, const std::vector<mcIdType>& st, const std::vector<bool>& crit, std::vector<bool>& reducedCrit, std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat)
{
if(minPatchLgth<0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf : the input minPatchLgth has to be >=0 !");
- if((int)crit.size()!=DeduceNumberOfGivenStructure(st))
+ if(ToIdType(crit.size())!=DeduceNumberOfGivenStructure(st))
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf : size of vector of boolean is invalid regarding the declared structure !");
- int ret(-1);
- switch((int)st.size())
+ mcIdType ret(-1);
+ switch(st.size())
{
case 1:
{
default:
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf : only dimension 1, 2 and 3 are supported actually !");
}
- std::vector<int> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(partCompactFormat));
- int i(0);
- for(std::vector< std::pair<int,int> >::iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,i++)
+ std::vector<mcIdType> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(partCompactFormat));
+ mcIdType i(0);
+ for(std::vector< std::pair<mcIdType,mcIdType> >::iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,i++)
{
if(st[i]<minPatchLgth)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf : the input patch is tinier than the min length constraint !");
- int start((*it).first),stop((*it).second),middle((start+stop)/2);
+ mcIdType start((*it).first),stop((*it).second),middle((start+stop)/2);
if(stop-start<minPatchLgth)
{
(*it).first=middle-minPatchLgth/2;
* This method considers \a crit input parameter as a matrix having dimensions specified by \a st. This method returns for each axis
* the signature, that is to say the number of elems equal to true in \a crit along this axis.
*/
-std::vector< std::vector<int> > MEDCouplingStructuredMesh::ComputeSignaturePerAxisOf(const std::vector<int>& st, const std::vector<bool>& crit)
+std::vector< std::vector<mcIdType> > MEDCouplingStructuredMesh::ComputeSignaturePerAxisOf(const std::vector<mcIdType>& st, const std::vector<bool>& crit)
{
- int dim((int)st.size());
- std::vector< std::vector<int> > ret(dim);
+ std::size_t dim(st.size());
+ std::vector< std::vector<mcIdType> > ret(dim);
switch(dim)
{
case 1:
{
- int nx(st[0]);
+ mcIdType nx(st[0]);
ret[0].resize(nx);
- std::vector<int>& retX(ret[0]);
- for(int i=0;i<nx;i++)
+ std::vector<mcIdType>& retX(ret[0]);
+ for(mcIdType i=0;i<nx;i++)
retX[i]=crit[i]?1:0;
break;
}
case 2:
{
- int nx(st[0]),ny(st[1]);
+ mcIdType nx(st[0]),ny(st[1]);
ret[0].resize(nx); ret[1].resize(ny);
- std::vector<int>& retX(ret[0]);
- for(int i=0;i<nx;i++)
+ std::vector<mcIdType>& retX(ret[0]);
+ for(mcIdType i=0;i<nx;i++)
{
- int cnt(0);
- for(int j=0;j<ny;j++)
+ mcIdType cnt(0);
+ for(mcIdType j=0;j<ny;j++)
if(crit[j*nx+i])
cnt++;
retX[i]=cnt;
}
- std::vector<int>& retY(ret[1]);
- for(int j=0;j<ny;j++)
+ std::vector<mcIdType>& retY(ret[1]);
+ for(mcIdType j=0;j<ny;j++)
{
- int cnt(0);
- for(int i=0;i<nx;i++)
+ mcIdType cnt(0);
+ for(mcIdType i=0;i<nx;i++)
if(crit[j*nx+i])
cnt++;
retY[j]=cnt;
}
case 3:
{
- int nx(st[0]),ny(st[1]),nz(st[2]);
+ mcIdType nx(st[0]),ny(st[1]),nz(st[2]);
ret[0].resize(nx); ret[1].resize(ny); ret[2].resize(nz);
- std::vector<int>& retX(ret[0]);
- for(int i=0;i<nx;i++)
+ std::vector<mcIdType>& retX(ret[0]);
+ for(mcIdType i=0;i<nx;i++)
{
- int cnt(0);
- for(int k=0;k<nz;k++)
+ mcIdType cnt(0);
+ for(mcIdType k=0;k<nz;k++)
{
- int offz(k*nx*ny+i);
- for(int j=0;j<ny;j++)
+ mcIdType offz(k*nx*ny+i);
+ for(mcIdType j=0;j<ny;j++)
if(crit[offz+j*nx])
cnt++;
}
retX[i]=cnt;
}
- std::vector<int>& retY(ret[1]);
- for(int j=0;j<ny;j++)
+ std::vector<mcIdType>& retY(ret[1]);
+ for(mcIdType j=0;j<ny;j++)
{
- int cnt(0),offy(j*nx);
- for(int k=0;k<nz;k++)
+ mcIdType cnt(0),offy(j*nx);
+ for(mcIdType k=0;k<nz;k++)
{
- int offz(k*nx*ny+offy);
- for(int i=0;i<nx;i++)
+ mcIdType offz(k*nx*ny+offy);
+ for(mcIdType i=0;i<nx;i++)
if(crit[offz+i])
cnt++;
}
retY[j]=cnt;
}
- std::vector<int>& retZ(ret[2]);
- for(int k=0;k<nz;k++)
+ std::vector<mcIdType>& retZ(ret[2]);
+ for(mcIdType k=0;k<nz;k++)
{
- int cnt(0),offz(k*nx*ny);
- for(int j=0;j<ny;j++)
+ mcIdType cnt(0),offz(k*nx*ny);
+ for(mcIdType j=0;j<ny;j++)
{
- int offy(offz+j*nx);
- for(int i=0;i<nx;i++)
+ mcIdType offy(offz+j*nx);
+ for(mcIdType i=0;i<nx;i++)
if(crit[offy+i])
cnt++;
}
return ret;
}
-DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity1D(const int *nodeStBg)
+DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivity1D(const mcIdType *nodeStBg)
{
- std::size_t nbOfCells(*nodeStBg-1);
- MCAuto<DataArrayInt> conn(DataArrayInt::New());
+ mcIdType nbOfCells=*nodeStBg-1;
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New());
conn->alloc(2*nbOfCells,1);
- int *cp=conn->getPointer();
- for(std::size_t i=0;i<nbOfCells;i++)
+ mcIdType *cp=conn->getPointer();
+ for(mcIdType i=0;i<nbOfCells;i++)
{
cp[2*i+0]=i;
cp[2*i+1]=i+1;
return conn.retn();
}
-DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity2D(const int *nodeStBg)
+DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivity2D(const mcIdType *nodeStBg)
{
- std::size_t n1(nodeStBg[0]-1),n2(nodeStBg[1]-1);
- MCAuto<DataArrayInt> conn(DataArrayInt::New());
+ mcIdType n1(nodeStBg[0]-1),n2(nodeStBg[1]-1);
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New());
conn->alloc(4*n1*n2,1);
- int *cp(conn->getPointer());
+ mcIdType *cp(conn->getPointer());
std::size_t pos(0);
- for(std::size_t j=0;j<n2;j++)
- for(std::size_t i=0;i<n1;i++,pos++)
+ for(mcIdType j=0;j<n2;j++)
+ for(mcIdType i=0;i<n1;i++,pos++)
{
cp[4*pos+0]=i+1+j*(n1+1);
cp[4*pos+1]=i+j*(n1+1);
return conn.retn();
}
-DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity3D(const int *nodeStBg)
+DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivity3D(const mcIdType *nodeStBg)
{
- std::size_t n1(nodeStBg[0]-1),n2(nodeStBg[1]-1),n3(nodeStBg[2]-1);
- MCAuto<DataArrayInt> conn(DataArrayInt::New());
+ mcIdType n1(nodeStBg[0]-1),n2(nodeStBg[1]-1),n3(nodeStBg[2]-1);
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New());
conn->alloc(8*n1*n2*n3,1);
- int *cp(conn->getPointer());
+ mcIdType *cp(conn->getPointer());
std::size_t pos(0);
- for(std::size_t k=0;k<n3;k++)
- for(std::size_t j=0;j<n2;j++)
- for(std::size_t i=0;i<n1;i++,pos++)
+ for(mcIdType k=0;k<n3;k++)
+ for(mcIdType j=0;j<n2;j++)
+ for(mcIdType i=0;i<n1;i++,pos++)
{
- int tmp=(n1+1)*(n2+1);
+ mcIdType tmp=(n1+1)*(n2+1);
cp[8*pos+0]=i+1+j*(n1+1)+k*tmp;
cp[8*pos+1]=i+j*(n1+1)+k*tmp;
cp[8*pos+2]=i+(j+1)*(n1+1)+k*tmp;
return conn.retn();
}
-DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh3D(const int *nodeStBg)
+DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh3D(const mcIdType *nodeStBg)
{
- std::vector<int> ngs(3);
- int n0(nodeStBg[0]-1),n1(nodeStBg[1]-1),n2(nodeStBg[2]-1); ngs[0]=n0; ngs[1]=n1; ngs[2]=n2;
- int off0(nodeStBg[0]),off1(nodeStBg[0]*nodeStBg[1]);
- MCAuto<DataArrayInt> conn(DataArrayInt::New());
+ std::vector<mcIdType> ngs(3);
+ mcIdType n0(nodeStBg[0]-1),n1(nodeStBg[1]-1),n2(nodeStBg[2]-1); ngs[0]=n0; ngs[1]=n1; ngs[2]=n2;
+ mcIdType off0(nodeStBg[0]),off1(nodeStBg[0]*nodeStBg[1]);
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New());
conn->alloc(4*GetNumberOfCellsOfSubLevelMesh(ngs,3));
- int *cp(conn->getPointer());
+ mcIdType *cp(conn->getPointer());
//X
- for(int i=0;i<nodeStBg[0];i++)
- for(int j=0;j<n1;j++)
- for(int k=0;k<n2;k++,cp+=4)
+ for(mcIdType i=0;i<nodeStBg[0];i++)
+ for(mcIdType j=0;j<n1;j++)
+ for(mcIdType k=0;k<n2;k++,cp+=4)
{ cp[0]=k*off1+j*off0+i; cp[1]=(k+1)*off1+j*off0+i; cp[2]=(k+1)*off1+(j+1)*off0+i; cp[3]=k*off1+(j+1)*off0+i; }
//Y
- for(int j=0;j<nodeStBg[1];j++)
- for(int i=0;i<n0;i++)
- for(int k=0;k<n2;k++,cp+=4)
+ for(mcIdType j=0;j<nodeStBg[1];j++)
+ for(mcIdType i=0;i<n0;i++)
+ for(mcIdType k=0;k<n2;k++,cp+=4)
{ cp[0]=k*off1+j*off0+i; cp[1]=(k+1)*off1+j*off0+i; cp[2]=(k+1)*off1+j*off0+(i+1); cp[3]=k*off1+j*off0+(i+1); }
//Z
- for(int k=0;k<nodeStBg[2];k++)
- for(int i=0;i<n0;i++)
- for(int j=0;j<n1;j++,cp+=4)
+ for(mcIdType k=0;k<nodeStBg[2];k++)
+ for(mcIdType i=0;i<n0;i++)
+ for(mcIdType j=0;j<n1;j++,cp+=4)
{ cp[0]=k*off1+j*off0+i; cp[1]=k*off1+j*off0+(i+1); cp[2]=k*off1+(j+1)*off0+(i+1); cp[3]=k*off1+(j+1)*off0+i; }
return conn.retn();
}
/*!
* \sa MEDCouplingStructuredMesh::FindMinimalPartOf
*/
-int MEDCouplingStructuredMesh::FindMinimalPartOf1D(const std::vector<int>& st, const std::vector<bool>& crit, std::vector< std::pair<int,int> >& partCompactFormat)
+mcIdType MEDCouplingStructuredMesh::FindMinimalPartOf1D(const std::vector<mcIdType>& st, const std::vector<bool>& crit, std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat)
{
if(st.size()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf1D : the input size of st must be equal to 1 !");
- int nxMin(std::numeric_limits<int>::max()),nxMax(-std::numeric_limits<int>::max());
- int nx(st[0]),ret(0);
- for(int i=0;i<nx;i++)
+ mcIdType nxMin(std::numeric_limits<mcIdType>::max()),nxMax(-std::numeric_limits<mcIdType>::max());
+ mcIdType nx(st[0]),ret(0);
+ for(mcIdType i=0;i<nx;i++)
{
if(crit[i])
{
/*!
* \sa MEDCouplingStructuredMesh::FindMinimalPartOf
*/
-int MEDCouplingStructuredMesh::FindMinimalPartOf2D(const std::vector<int>& st, const std::vector<bool>& crit, std::vector< std::pair<int,int> >& partCompactFormat)
+mcIdType MEDCouplingStructuredMesh::FindMinimalPartOf2D(const std::vector<mcIdType>& st, const std::vector<bool>& crit, std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat)
{
if(st.size()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf2D : the input size of st must be equal to 2 !");
- int nxMin(std::numeric_limits<int>::max()),nxMax(-std::numeric_limits<int>::max()),nyMin(std::numeric_limits<int>::max()),nyMax(-std::numeric_limits<int>::max());
- int it(0),nx(st[0]),ny(st[1]);
- int ret(0);
- for(int i=0;i<ny;i++)
- for(int j=0;j<nx;j++,it++)
+ mcIdType nxMin(std::numeric_limits<mcIdType>::max()),nxMax(-std::numeric_limits<mcIdType>::max()),nyMin(std::numeric_limits<mcIdType>::max()),nyMax(-std::numeric_limits<mcIdType>::max());
+ mcIdType it(0),nx(st[0]),ny(st[1]);
+ mcIdType ret(0);
+ for(mcIdType i=0;i<ny;i++)
+ for(mcIdType j=0;j<nx;j++,it++)
{
if(crit[it])
{
/*!
* \sa MEDCouplingStructuredMesh::FindMinimalPartOf
*/
-int MEDCouplingStructuredMesh::FindMinimalPartOf3D(const std::vector<int>& st, const std::vector<bool>& crit, std::vector< std::pair<int,int> >& partCompactFormat)
+mcIdType MEDCouplingStructuredMesh::FindMinimalPartOf3D(const std::vector<mcIdType>& st, const std::vector<bool>& crit, std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat)
{
if(st.size()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf3D : the input size of st must be equal to 3 !");
- int nxMin(std::numeric_limits<int>::max()),nxMax(-std::numeric_limits<int>::max()),nyMin(std::numeric_limits<int>::max()),nyMax(-std::numeric_limits<int>::max()),nzMin(std::numeric_limits<int>::max()),nzMax(-std::numeric_limits<int>::max());
- int it(0),nx(st[0]),ny(st[1]),nz(st[2]);
- int ret(0);
- for(int i=0;i<nz;i++)
- for(int j=0;j<ny;j++)
- for(int k=0;k<nx;k++,it++)
+ mcIdType nxMin(std::numeric_limits<mcIdType>::max()),nxMax(-std::numeric_limits<mcIdType>::max()),nyMin(std::numeric_limits<mcIdType>::max()),nyMax(-std::numeric_limits<mcIdType>::max()),nzMin(std::numeric_limits<mcIdType>::max()),nzMax(-std::numeric_limits<mcIdType>::max());
+ mcIdType it(0),nx(st[0]),ny(st[1]),nz(st[2]);
+ mcIdType ret(0);
+ for(mcIdType i=0;i<nz;i++)
+ for(mcIdType j=0;j<ny;j++)
+ for(mcIdType k=0;k<nx;k++,it++)
{
if(crit[it])
{
* the meshDimension (or the zipped spaceDimension).
*
* \param [out] zipNodeSt - The zipped node structure
- * \return int - the
+ * \return mcIdType - the
*/
-int MEDCouplingStructuredMesh::ZipNodeStructure(const int *nodeStBg, const int *nodeStEnd, int zipNodeSt[3])
+int MEDCouplingStructuredMesh::ZipNodeStructure(const mcIdType *nodeStBg, const mcIdType *nodeStEnd, mcIdType zipNodeSt[3])
{
- int spaceDim((int)std::distance(nodeStBg,nodeStEnd));
+ std::size_t spaceDim(std::distance(nodeStBg,nodeStEnd));
if(spaceDim>3 || spaceDim<1)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ZipNodeStructure : spaceDim must in [1,2,3] !");
zipNodeSt[0]=0; zipNodeSt[1]=0; zipNodeSt[2]=0;
int zippedI(0);
- for(int i=0;i<spaceDim;i++)
+ for(std::size_t i=0;i<spaceDim;i++)
{
- int elt(nodeStBg[i]);
+ mcIdType elt(nodeStBg[i]);
if(elt<1)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::ZipNodeStructure : the input nodal structure at pos#" << i << "(" << nodeStBg[i] << ") is invalid !";
return zippedI;
}
-DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh2D(const int *nodeStBg)
+DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh2D(const mcIdType *nodeStBg)
{
- std::vector<int> ngs(2);
- int n0(nodeStBg[0]-1),n1(nodeStBg[1]-1); ngs[0]=n0; ngs[1]=n1;
- int off0(nodeStBg[0]);
- MCAuto<DataArrayInt> conn(DataArrayInt::New());
+ std::vector<mcIdType> ngs(2);
+ mcIdType n0(nodeStBg[0]-1),n1(nodeStBg[1]-1); ngs[0]=n0; ngs[1]=n1;
+ mcIdType off0(nodeStBg[0]);
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New());
conn->alloc(2*GetNumberOfCellsOfSubLevelMesh(ngs,2));
- int *cp(conn->getPointer());
+ mcIdType *cp(conn->getPointer());
//X
- for(int i=0;i<nodeStBg[0];i++)
- for(int j=0;j<n1;j++,cp+=2)
+ for(mcIdType i=0;i<nodeStBg[0];i++)
+ for(mcIdType j=0;j<n1;j++,cp+=2)
{ cp[0]=j*off0+i; cp[1]=(j+1)*off0+i; }
//Y
- for(int j=0;j<nodeStBg[1];j++)
- for(int i=0;i<n0;i++,cp+=2)
+ for(mcIdType j=0;j<nodeStBg[1];j++)
+ for(mcIdType i=0;i<n0;i++,cp+=2)
{ cp[0]=j*off0+i; cp[1]=j*off0+(i+1); }
return conn.retn();
}
* \param [in] i - a index of node coordinates array along X axis.
* \param [in] j - a index of node coordinates array along Y axis.
* \param [in] k - a index of node coordinates array along Z axis.
- * \return int - a cell id in \a this mesh.
+ * \return mcIdType - a cell id in \a this mesh.
*/
-int MEDCouplingStructuredMesh::getCellIdFromPos(int i, int j, int k) const
+mcIdType MEDCouplingStructuredMesh::getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const
{
- int tmp[3]={i,j,k};
- int tmp2[3];
- int meshDim(getMeshDimension());
+ mcIdType tmp[3]={i,j,k};
+ mcIdType tmp2[3];
+ mcIdType meshDim(getMeshDimension());
getSplitCellValues(tmp2);
- std::transform(tmp,tmp+meshDim,tmp2,tmp,std::multiplies<int>());
+ std::transform(tmp,tmp+meshDim,tmp2,tmp,std::multiplies<mcIdType>());
return std::accumulate(tmp,tmp+meshDim,0);
}
* \param [in] i - a index of node coordinates array along X axis.
* \param [in] j - a index of node coordinates array along Y axis.
* \param [in] k - a index of node coordinates array along Z axis.
- * \return int - a node id in \a this mesh.
+ * \return mcIdType - a node id in \a this mesh.
*/
-int MEDCouplingStructuredMesh::getNodeIdFromPos(int i, int j, int k) const
+mcIdType MEDCouplingStructuredMesh::getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const
{
- int tmp[3]={i,j,k};
- int tmp2[3];
- int spaceDim(getSpaceDimension());
+ mcIdType tmp[3]={i,j,k};
+ mcIdType tmp2[3];
+ mcIdType spaceDim(getSpaceDimension());
getSplitNodeValues(tmp2);
- std::transform(tmp,tmp+spaceDim,tmp2,tmp,std::multiplies<int>());
+ std::transform(tmp,tmp+spaceDim,tmp2,tmp,std::multiplies<mcIdType>());
return std::accumulate(tmp,tmp+spaceDim,0);
}
-std::size_t MEDCouplingStructuredMesh::getNumberOfCells() const
+mcIdType MEDCouplingStructuredMesh::getNumberOfCells() const
{
- std::vector<int> ngs(getNodeGridStructure());
- std::size_t ret(1);
+ std::vector<mcIdType> ngs(getNodeGridStructure());
+ mcIdType ret(1);
bool isCatched(false);
std::size_t ii(0);
- for(std::vector<int>::const_iterator it=ngs.begin();it!=ngs.end();it++,ii++)
+ for(std::vector<mcIdType>::const_iterator it=ngs.begin();it!=ngs.end();it++,ii++)
{
- int elt(*it);
+ mcIdType elt(*it);
if(elt<=0)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getNumberOfCells : at pos #" << ii << " the number of nodes in nodeStructure is " << *it << " ! Must be > 0 !";
return isCatched?ret:0;
}
-int MEDCouplingStructuredMesh::getNumberOfNodes() const
+mcIdType MEDCouplingStructuredMesh::getNumberOfNodes() const
{
- std::vector<int> ngs(getNodeGridStructure());
- int ret(1);
- for(std::vector<int>::const_iterator it=ngs.begin();it!=ngs.end();it++)
+ std::vector<mcIdType> ngs(getNodeGridStructure());
+ mcIdType ret(1);
+ for(std::vector<mcIdType>::const_iterator it=ngs.begin();it!=ngs.end();it++)
ret*=*it;
return ret;
}
* \return - A vector of size this->getMeshDimension()
* \throw if \a cellId not in [ 0, this->getNumberOfCells() )
*/
-std::vector<int> MEDCouplingStructuredMesh::getLocationFromCellId(int cellId) const
+std::vector<mcIdType> MEDCouplingStructuredMesh::getLocationFromCellId(mcIdType cellId) const
{
int meshDim(getMeshDimension());
- std::vector<int> ret(meshDim);
- std::vector<int> struc(getCellGridStructure());
- int nbCells(std::accumulate(struc.begin(),struc.end(),1,std::multiplies<int>()));
+ std::vector<mcIdType> ret(meshDim);
+ std::vector<mcIdType> struc(getCellGridStructure());
+ mcIdType nbCells(std::accumulate(struc.begin(),struc.end(),1,std::multiplies<mcIdType>()));
if(cellId<0 || cellId>=nbCells)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getLocationFromCellId : Input cell id (" << cellId << ") is invalid ! Should be in [0," << nbCells << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::vector<int> spt(GetSplitVectFromStruct(struc));
+ std::vector<mcIdType> spt(GetSplitVectFromStruct(struc));
GetPosFromId(cellId,meshDim,&spt[0],&ret[0]);
return ret;
}
* \return - A vector of size this->getSpaceDimension()
* \throw if \a cellId not in [ 0, this->getNumberOfNodes() )
*/
-std::vector<int> MEDCouplingStructuredMesh::getLocationFromNodeId(int nodeId) const
+std::vector<mcIdType> MEDCouplingStructuredMesh::getLocationFromNodeId(mcIdType nodeId) const
{
int spaceDim(getSpaceDimension());
- std::vector<int> ret(spaceDim);
- std::vector<int> struc(getNodeGridStructure());
- int nbNodes(std::accumulate(struc.begin(),struc.end(),1,std::multiplies<int>()));
+ std::vector<mcIdType> ret(spaceDim);
+ std::vector<mcIdType> struc(getNodeGridStructure());
+ mcIdType nbNodes(std::accumulate(struc.begin(),struc.end(),1,std::multiplies<mcIdType>()));
if(nodeId<0 || nodeId>=nbNodes)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getLocationFromNodeId : Input node id (" << nodeId << ") is invalid ! Should be in [0," << nbNodes << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::vector<int> spt(GetSplitVectFromStruct(struc));
+ std::vector<mcIdType> spt(GetSplitVectFromStruct(struc));
GetPosFromId(nodeId,spaceDim,&spt[0],&ret[0]);
return ret;
}
-void MEDCouplingStructuredMesh::GetPosFromId(int eltId, int meshDim, const int *split, int *res)
+void MEDCouplingStructuredMesh::GetPosFromId(mcIdType eltId, int meshDim, const mcIdType *split, mcIdType *res)
{
- int work(eltId);
+ mcIdType work(eltId);
for(int i=meshDim-1;i>=0;i--)
{
- int pos=work/split[i];
+ mcIdType pos=work/split[i];
work=work%split[i];
res[i]=pos;
}
}
-std::vector<int> MEDCouplingStructuredMesh::getCellGridStructure() const
+std::vector<mcIdType> MEDCouplingStructuredMesh::getCellGridStructure() const
{
- std::vector<int> ret(getNodeGridStructure());
- std::transform(ret.begin(),ret.end(),ret.begin(),std::bind2nd(std::plus<int>(),-1));
+ std::vector<mcIdType> ret(getNodeGridStructure());
+ std::transform(ret.begin(),ret.end(),ret.begin(),std::bind2nd(std::plus<mcIdType>(),-1));
return ret;
}
*/
double MEDCouplingStructuredMesh::computeSquareness() const
{
- std::vector<int> cgs(getCellGridStructure());
+ std::vector<mcIdType> cgs(getCellGridStructure());
if(cgs.empty())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::computeSquareness : empty mesh !");
std::size_t dim(cgs.size());
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::computeSquareness : A segment cannot be square !");
if(dim<4)
{
- int minAx(cgs[0]),maxAx(cgs[0]);
+ mcIdType minAx(cgs[0]),maxAx(cgs[0]);
for(std::size_t i=1;i<dim;i++)
{
minAx=std::min(minAx,cgs[i]);
* Given a struct \a strct it returns a split vector [1,strct[0],strct[0]*strct[1]...]
* This decomposition allows to quickly find i,j,k given a global id.
*/
-std::vector<int> MEDCouplingStructuredMesh::GetSplitVectFromStruct(const std::vector<int>& strct)
+std::vector<mcIdType> MEDCouplingStructuredMesh::GetSplitVectFromStruct(const std::vector<mcIdType>& strct)
{
- int spaceDim((int)strct.size());
- std::vector<int> res(spaceDim);
- for(int l=0;l<spaceDim;l++)
+ std::size_t spaceDim(strct.size());
+ std::vector<mcIdType> res(spaceDim);
+ for(std::size_t l=0;l<spaceDim;l++)
{
- int val=1;
- for(int p=0;p<spaceDim-l-1;p++)
+ mcIdType val=1;
+ for(std::size_t p=0;p<spaceDim-l-1;p++)
val*=strct[p];
res[spaceDim-l-1]=val;
}
*
* \sa MEDCouplingStructuredMesh::BuildExplicitIdsFrom, MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt
*/
-bool MEDCouplingStructuredMesh::IsPartStructured(const int *startIds, const int *stopIds, const std::vector<int>& st, std::vector< std::pair<int,int> >& partCompactFormat)
+bool MEDCouplingStructuredMesh::IsPartStructured(const mcIdType *startIds, const mcIdType *stopIds, const std::vector<mcIdType>& st, std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat)
{
int dim((int)st.size());
partCompactFormat.resize(dim);
if(dim<1 || dim>3)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::isPartStructured : input structure must be of dimension in [1,2,3] !");
- std::vector<int> tmp2(dim),tmp(dim),tmp3(dim),tmp4(dim); tmp2[0]=1;
+ std::vector<mcIdType> tmp2(dim),tmp(dim),tmp3(dim),tmp4(dim); tmp2[0]=1;
for(int i=1;i<dim;i++)
tmp2[i]=tmp2[i-1]*st[i-1];
std::size_t sz(std::distance(startIds,stopIds));
return true;
}
GetPosFromId(startIds[sz-1],dim,&tmp2[0],&tmp3[0]);
- int szExp(1);
+ mcIdType szExp(1);
for(int i=0;i<dim;i++)
{
if(tmp3[i]<0 || tmp3[i]>=st[i])
return false;
szExp*=tmp4[i];
}
- if(szExp!=(int)sz)
+ if(szExp!=ToIdType(sz))
return false;
- const int *w(startIds);
+ const mcIdType *w(startIds);
switch(dim)
{
case 3:
{
- for(int i=0;i<tmp4[2];i++)
+ for(mcIdType i=0;i<tmp4[2];i++)
{
- int a=tmp2[2]*(partCompactFormat[2].first+i);
- for(int j=0;j<tmp4[1];j++)
+ mcIdType a=tmp2[2]*(partCompactFormat[2].first+i);
+ for(mcIdType j=0;j<tmp4[1];j++)
{
- int b=tmp2[1]*(partCompactFormat[1].first+j);
- for(int k=0;k<tmp4[0];k++,w++)
+ mcIdType b=tmp2[1]*(partCompactFormat[1].first+j);
+ for(mcIdType k=0;k<tmp4[0];k++,w++)
{
if(partCompactFormat[0].first+k+b+a!=*w)
return false;
}
case 2:
{
- for(int j=0;j<tmp4[1];j++)
+ for(mcIdType j=0;j<tmp4[1];j++)
{
- int b=tmp2[1]*(partCompactFormat[1].first+j);
- for(int k=0;k<tmp4[0];k++,w++)
+ mcIdType b=tmp2[1]*(partCompactFormat[1].first+j);
+ for(mcIdType k=0;k<tmp4[0];k++,w++)
{
if(partCompactFormat[0].first+k+b!=*w)
return false;
}
case 1:
{
- for(int k=0;k<tmp4[0];k++,w++)
+ for(mcIdType k=0;k<tmp4[0];k++,w++)
{
if(partCompactFormat[0].first+k!=*w)
return false;
* \throw if an axis range is so that max<min
* \sa GetCompactFrmtFromDimensions
*/
-std::vector<int> MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(const std::vector< std::pair<int,int> >& partCompactFormat)
+std::vector<mcIdType> MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat)
{
- std::vector<int> ret(partCompactFormat.size());
+ std::vector<mcIdType> ret(partCompactFormat.size());
for(std::size_t i=0;i<partCompactFormat.size();i++)
{
if(partCompactFormat[i].first>partCompactFormat[i].second)
* \throw if there is an axis in \a dims that is < 0.
* \sa GetDimensionsFromCompactFrmt, ChangeReferenceFromGlobalOfCompactFrmt, ChangeReferenceToGlobalOfCompactFrmt
*/
-std::vector< std::pair<int,int> > MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(const std::vector<int>& dims)
+std::vector< std::pair<mcIdType,mcIdType> > MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(const std::vector<mcIdType>& dims)
{
std::size_t sz(dims.size());
- std::vector< std::pair<int,int> > ret(sz);
+ std::vector< std::pair<mcIdType,mcIdType> > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
if(dims[i]<0)
*
* \sa AreRangesIntersect
*/
-std::vector< std::pair<int,int> > MEDCouplingStructuredMesh::IntersectRanges(const std::vector< std::pair<int,int> >& r1, const std::vector< std::pair<int,int> >& r2)
+std::vector< std::pair<mcIdType,mcIdType> > MEDCouplingStructuredMesh::IntersectRanges(const std::vector< std::pair<mcIdType,mcIdType> >& r1, const std::vector< std::pair<mcIdType,mcIdType> >& r2)
{
std::size_t sz(r1.size());
if(sz!=r2.size())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::IntersectRanges : the two ranges must have the same dimension !");
- std::vector< std::pair<int,int> > ret(sz);
+ std::vector< std::pair<mcIdType,mcIdType> > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
if(r1[i].first>r1[i].second)
*
* \sa IntersectRanges
*/
-bool MEDCouplingStructuredMesh::AreRangesIntersect(const std::vector< std::pair<int,int> >& r1, const std::vector< std::pair<int,int> >& r2)
+bool MEDCouplingStructuredMesh::AreRangesIntersect(const std::vector< std::pair<mcIdType,mcIdType> >& r1, const std::vector< std::pair<mcIdType,mcIdType> >& r2)
{
std::size_t sz(r1.size());
if(sz!=r2.size())
}
/*!
- * This method is close to BuildExplicitIdsFrom except that instead of returning a DataArrayInt instance containing explicit ids it
+ * This method is close to BuildExplicitIdsFrom except that instead of returning a DataArrayIdType instance containing explicit ids it
* enable elems in the vector of booleans (for performance reasons). As it is method for performance, this method is \b not
* available in python.
*
*
* \sa MEDCouplingStructuredMesh::BuildExplicitIdsFrom, ExtractFieldOfBoolFrom
*/
-void MEDCouplingStructuredMesh::SwitchOnIdsFrom(const std::vector<int>& st, const std::vector< std::pair<int,int> >& partCompactFormat, std::vector<bool>& vectToSwitchOn)
+void MEDCouplingStructuredMesh::SwitchOnIdsFrom(const std::vector<mcIdType>& st, const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat, std::vector<bool>& vectToSwitchOn)
{
if(st.size()!=partCompactFormat.size())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::SwitchOnIdsFrom : input arrays must have the same size !");
- if((int)vectToSwitchOn.size()!=DeduceNumberOfGivenStructure(st))
+ if(ToIdType(vectToSwitchOn.size())!=DeduceNumberOfGivenStructure(st))
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::SwitchOnIdsFrom : invalid size of input vector of boolean regarding the structure !");
- std::vector<int> dims(GetDimensionsFromCompactFrmt(partCompactFormat));
+ std::vector<mcIdType> dims(GetDimensionsFromCompactFrmt(partCompactFormat));
switch(st.size())
{
case 3:
{
- for(int i=0;i<dims[2];i++)
+ for(mcIdType i=0;i<dims[2];i++)
{
- int a=(partCompactFormat[2].first+i)*st[0]*st[1];
- for(int j=0;j<dims[1];j++)
+ mcIdType a=(partCompactFormat[2].first+i)*st[0]*st[1];
+ for(mcIdType j=0;j<dims[1];j++)
{
- int b=(partCompactFormat[1].first+j)*st[0];
- for(int k=0;k<dims[0];k++)
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
+ for(mcIdType k=0;k<dims[0];k++)
vectToSwitchOn[partCompactFormat[0].first+k+b+a]=true;
}
}
}
case 2:
{
- for(int j=0;j<dims[1];j++)
+ for(mcIdType j=0;j<dims[1];j++)
{
- int b=(partCompactFormat[1].first+j)*st[0];
- for(int k=0;k<dims[0];k++)
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
+ for(mcIdType k=0;k<dims[0];k++)
vectToSwitchOn[partCompactFormat[0].first+k+b]=true;
}
break;
}
case 1:
{
- for(int k=0;k<dims[0];k++)
+ for(mcIdType k=0;k<dims[0];k++)
vectToSwitchOn[partCompactFormat[0].first+k]=true;
break;
}
*
* \sa MEDCouplingStructuredMesh::BuildExplicitIdsFrom, SwitchOnIdsFrom, ExtractFieldOfDoubleFrom
*/
-void MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom(const std::vector<int>& st, const std::vector<bool>& fieldOfBool, const std::vector< std::pair<int,int> >& partCompactFormat, std::vector<bool>& fieldOut)
+void MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom(const std::vector<mcIdType>& st, const std::vector<bool>& fieldOfBool, const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat, std::vector<bool>& fieldOut)
{
if(st.size()!=partCompactFormat.size())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom : input arrays must have the same size !");
- if((int)fieldOfBool.size()!=DeduceNumberOfGivenStructure(st))
+ if(ToIdType(fieldOfBool.size())!=DeduceNumberOfGivenStructure(st))
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom : invalid size of input field of boolean regarding the structure !");
- std::vector<int> dims(GetDimensionsFromCompactFrmt(partCompactFormat));
- int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims));
+ std::vector<mcIdType> dims(GetDimensionsFromCompactFrmt(partCompactFormat));
+ mcIdType nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims));
fieldOut.resize(nbOfTuplesOfOutField);
- int it(0);
+ mcIdType it(0);
switch(st.size())
{
case 3:
{
- for(int i=0;i<dims[2];i++)
+ for(mcIdType i=0;i<dims[2];i++)
{
- int a=(partCompactFormat[2].first+i)*st[0]*st[1];
- for(int j=0;j<dims[1];j++)
+ mcIdType a=(partCompactFormat[2].first+i)*st[0]*st[1];
+ for(mcIdType j=0;j<dims[1];j++)
{
- int b=(partCompactFormat[1].first+j)*st[0];
- for(int k=0;k<dims[0];k++)
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
+ for(mcIdType k=0;k<dims[0];k++)
fieldOut[it++]=fieldOfBool[partCompactFormat[0].first+k+b+a];
}
}
}
case 2:
{
- for(int j=0;j<dims[1];j++)
+ for(mcIdType j=0;j<dims[1];j++)
{
- int b=(partCompactFormat[1].first+j)*st[0];
- for(int k=0;k<dims[0];k++)
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
+ for(mcIdType k=0;k<dims[0];k++)
fieldOut[it++]=fieldOfBool[partCompactFormat[0].first+k+b];
}
break;
}
case 1:
{
- for(int k=0;k<dims[0];k++)
+ for(mcIdType k=0;k<dims[0];k++)
fieldOut[it++]=fieldOfBool[partCompactFormat[0].first+k];
break;
}
*
* \sa MEDCouplingStructuredMesh::BuildExplicitIdsFrom, SwitchOnIdsFrom, ExtractFieldOfBoolFrom
*/
-DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std::vector<int>& st, const DataArrayDouble *fieldOfDbl, const std::vector< std::pair<int,int> >& partCompactFormat)
+DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std::vector<mcIdType>& st, const DataArrayDouble *fieldOfDbl, const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat)
{
if(!fieldOfDbl || !fieldOfDbl->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : input array of double is NULL or not allocated!");
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : input arrays must have the same size !");
if(fieldOfDbl->getNumberOfTuples()!=DeduceNumberOfGivenStructure(st))
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : invalid size of input array of double regarding the structure !");
- std::vector<int> dims(GetDimensionsFromCompactFrmt(partCompactFormat));
- int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)),nbComp(fieldOfDbl->getNumberOfComponents());
+ std::vector<mcIdType> dims(GetDimensionsFromCompactFrmt(partCompactFormat));
+ mcIdType nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims));
+ std::size_t nbComp(fieldOfDbl->getNumberOfComponents());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfTuplesOfOutField,nbComp);
ret->copyStringInfoFrom(*fieldOfDbl);
double *ptRet(ret->getPointer());
{
case 3:
{
- for(int i=0;i<dims[2];i++)
+ for(mcIdType i=0;i<dims[2];i++)
{
- int a=(partCompactFormat[2].first+i)*st[0]*st[1];
- for(int j=0;j<dims[1];j++)
+ mcIdType a=(partCompactFormat[2].first+i)*st[0]*st[1];
+ for(mcIdType j=0;j<dims[1];j++)
{
- int b=(partCompactFormat[1].first+j)*st[0];
- for(int k=0;k<dims[0];k++)
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
+ for(mcIdType k=0;k<dims[0];k++)
ptRet=std::copy(fieldOfDblPtr+(partCompactFormat[0].first+k+b+a)*nbComp,fieldOfDblPtr+(partCompactFormat[0].first+k+b+a+1)*nbComp,ptRet);
}
}
}
case 2:
{
- for(int j=0;j<dims[1];j++)
+ for(mcIdType j=0;j<dims[1];j++)
{
- int b=(partCompactFormat[1].first+j)*st[0];
- for(int k=0;k<dims[0];k++)
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
+ for(mcIdType k=0;k<dims[0];k++)
ptRet=std::copy(fieldOfDblPtr+(partCompactFormat[0].first+k+b)*nbComp,fieldOfDblPtr+(partCompactFormat[0].first+k+b+1)*nbComp,ptRet);
}
break;
}
case 1:
{
- for(int k=0;k<dims[0];k++)
+ for(mcIdType k=0;k<dims[0];k++)
ptRet=std::copy(fieldOfDblPtr+(partCompactFormat[0].first+k)*nbComp,fieldOfDblPtr+(partCompactFormat[0].first+k+1)*nbComp,ptRet);
break;
}
* \param [in] partCompactFormat - the specification of the part.
* \param [in] other - the array that will be used to fill \a fieldOfDbl.
*/
-void MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(const std::vector<int>& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair<int,int> >& partCompactFormat, const DataArrayDouble *other)
+void MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(const std::vector<mcIdType>& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat, const DataArrayDouble *other)
{//to be optimized
- std::vector<int> facts(st.size(),1.);
+ std::vector<mcIdType> facts(st.size(),1);
MEDCouplingIMesh::CondenseFineToCoarse(st,other,partCompactFormat,facts,fieldOfDbl);
}
*
* \sa ChangeReferenceToGlobalOfCompactFrmt, BuildExplicitIdsFrom, SwitchOnIdsFrom, ExtractFieldOfBoolFrom, ExtractFieldOfDoubleFrom
*/
-void MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(const std::vector< std::pair<int,int> >& bigInAbs, const std::vector< std::pair<int,int> >& partOfBigInAbs, std::vector< std::pair<int,int> >& partOfBigRelativeToBig, bool check)
+void MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& bigInAbs, const std::vector< std::pair<mcIdType,mcIdType> >& partOfBigInAbs, std::vector< std::pair<mcIdType,mcIdType> >& partOfBigRelativeToBig, bool check)
{
std::size_t dim(bigInAbs.size());
if(dim!=partOfBigInAbs.size())
*
* \sa ChangeReferenceFromGlobalOfCompactFrmt
*/
-void MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(const std::vector< std::pair<int,int> >& bigInAbs, const std::vector< std::pair<int,int> >& partOfBigRelativeToBig, std::vector< std::pair<int,int> >& partOfBigInAbs, bool check)
+void MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& bigInAbs, const std::vector< std::pair<mcIdType,mcIdType> >& partOfBigRelativeToBig, std::vector< std::pair<mcIdType,mcIdType> >& partOfBigInAbs, bool check)
{
std::size_t dim(bigInAbs.size());
if(dim!=partOfBigRelativeToBig.size())
*
* \sa FindTranslationFrom
*/
-std::vector< std::pair<int,int> > MEDCouplingStructuredMesh::TranslateCompactFrmt(const std::vector< std::pair<int,int> >& part, const std::vector<int>& translation)
+std::vector< std::pair<mcIdType,mcIdType> > MEDCouplingStructuredMesh::TranslateCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& part, const std::vector<mcIdType>& translation)
{
std::size_t sz(part.size());
if(translation.size()!=sz)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::TranslateCompactFrmt : the sizes are not equal !");
- std::vector< std::pair<int,int> > ret(sz);
+ std::vector< std::pair<mcIdType,mcIdType> > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
ret[i].first=part[i].first+translation[i];
/*!
* \sa TranslateCompactFrmt
*/
-std::vector<int> MEDCouplingStructuredMesh::FindTranslationFrom(const std::vector< std::pair<int,int> >& startingFrom, const std::vector< std::pair<int,int> >& goingTo)
+std::vector<mcIdType> MEDCouplingStructuredMesh::FindTranslationFrom(const std::vector< std::pair<mcIdType,mcIdType> >& startingFrom, const std::vector< std::pair<mcIdType,mcIdType> >& goingTo)
{
std::size_t sz(startingFrom.size());
if(goingTo.size()!=sz)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindTranslationFrom : the sizes are not equal !");
- std::vector< int > ret(sz);
+ std::vector< mcIdType > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
ret[i]=goingTo[i].first-startingFrom[i].first;
* This method builds the explicit entity array from the structure in \a st and the range in \a partCompactFormat.
* If the range contains invalid values regarding structure an exception will be thrown.
*
- * \return DataArrayInt * - a new object.
+ * \return DataArrayIdType * - a new object.
* \sa MEDCouplingStructuredMesh::IsPartStructured, MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt, SwitchOnIdsFrom, ExtractFieldOfBoolFrom, ExtractFieldOfDoubleFrom, MultiplyPartOf
*/
-DataArrayInt *MEDCouplingStructuredMesh::BuildExplicitIdsFrom(const std::vector<int>& st, const std::vector< std::pair<int,int> >& partCompactFormat)
+DataArrayIdType *MEDCouplingStructuredMesh::BuildExplicitIdsFrom(const std::vector<mcIdType>& st, const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat)
{
if(st.size()!=partCompactFormat.size())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::BuildExplicitIdsFrom : input arrays must have the same size !");
- int nbOfItems(1);
- std::vector<int> dims(st.size());
+ mcIdType nbOfItems(1);
+ std::vector<mcIdType> dims(st.size());
for(std::size_t i=0;i<st.size();i++)
{
if(partCompactFormat[i].first<0 || partCompactFormat[i].first>st[i])
dims[i]=partCompactFormat[i].second-partCompactFormat[i].first;
nbOfItems*=dims[i];
}
- MCAuto<DataArrayInt> ret(DataArrayInt::New());
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
ret->alloc(nbOfItems,1);
- int *pt(ret->getPointer());
+ mcIdType *pt(ret->getPointer());
switch(st.size())
{
case 3:
{
- for(int i=0;i<dims[2];i++)
+ for(mcIdType i=0;i<dims[2];i++)
{
- int a=(partCompactFormat[2].first+i)*st[0]*st[1];
- for(int j=0;j<dims[1];j++)
+ mcIdType a=(partCompactFormat[2].first+i)*st[0]*st[1];
+ for(mcIdType j=0;j<dims[1];j++)
{
- int b=(partCompactFormat[1].first+j)*st[0];
- for(int k=0;k<dims[0];k++,pt++)
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
+ for(mcIdType k=0;k<dims[0];k++,pt++)
*pt=partCompactFormat[0].first+k+b+a;
}
}
}
case 2:
{
- for(int j=0;j<dims[1];j++)
+ for(mcIdType j=0;j<dims[1];j++)
{
- int b=(partCompactFormat[1].first+j)*st[0];
- for(int k=0;k<dims[0];k++,pt++)
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
+ for(mcIdType k=0;k<dims[0];k++,pt++)
*pt=partCompactFormat[0].first+k+b;
}
break;
}
case 1:
{
- for(int k=0;k<dims[0];k++,pt++)
+ for(mcIdType k=0;k<dims[0];k++,pt++)
*pt=partCompactFormat[0].first+k;
break;
}
*
* \sa BuildExplicitIdsFrom
*/
-void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector<int>& st, const std::vector< std::pair<int,int> >& part, double factor, DataArrayDouble *da)
+void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector<mcIdType>& st, const std::vector< std::pair<mcIdType,mcIdType> >& part, double factor, DataArrayDouble *da)
{
if(!da || !da->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::MultiplyPartOf : DataArrayDouble instance must be not NULL and allocated !");
if(st.size()!=part.size())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::MultiplyPartOf : input arrays must have the same size !");
- std::vector<int> dims(st.size());
+ std::vector<mcIdType> dims(st.size());
for(std::size_t i=0;i<st.size();i++)
{
if(part[i].first<0 || part[i].first>st[i])
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::MultiplyPartOf : invalid input range 3 !");
dims[i]=part[i].second-part[i].first;
}
- int nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st)),nbCompo(da->getNumberOfComponents());
+ mcIdType nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st));
+ std::size_t nbCompo(da->getNumberOfComponents());
if(da->getNumberOfTuples()!=nbOfTuplesExp)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::MultiplyPartOf : invalid nb of tuples ! Expected " << nbOfTuplesExp << " having " << da->getNumberOfTuples() << " !";
{
case 3:
{
- for(int i=0;i<dims[2];i++)
+ for(mcIdType i=0;i<dims[2];i++)
{
- int a=(part[2].first+i)*st[0]*st[1];
- for(int j=0;j<dims[1];j++)
+ mcIdType a=(part[2].first+i)*st[0]*st[1];
+ for(mcIdType j=0;j<dims[1];j++)
{
- int b=(part[1].first+j)*st[0];
- for(int k=0;k<dims[0];k++)
+ mcIdType b=(part[1].first+j)*st[0];
+ for(mcIdType k=0;k<dims[0];k++)
{
- int offset(part[0].first+k+b+a);
+ mcIdType offset(part[0].first+k+b+a);
std::transform(pt+nbCompo*offset,pt+nbCompo*(offset+1),pt+nbCompo*offset,std::bind2nd(std::multiplies<double>(),factor));
}
}
}
case 2:
{
- for(int j=0;j<dims[1];j++)
+ for(mcIdType j=0;j<dims[1];j++)
{
- int b=(part[1].first+j)*st[0];
- for(int k=0;k<dims[0];k++)
+ mcIdType b=(part[1].first+j)*st[0];
+ for(mcIdType k=0;k<dims[0];k++)
{
- int offset(part[0].first+k+b);
+ mcIdType offset(part[0].first+k+b);
std::transform(pt+nbCompo*offset,pt+nbCompo*(offset+1),pt+nbCompo*offset,std::bind2nd(std::multiplies<double>(),factor));
}
}
}
case 1:
{
- for(int k=0;k<dims[0];k++)
+ for(mcIdType k=0;k<dims[0];k++)
{
- int offset(part[0].first+k);
+ mcIdType offset(part[0].first+k);
std::transform(pt+nbCompo*offset,pt+nbCompo*(offset+1),pt+nbCompo*offset,std::bind2nd(std::multiplies<double>(),factor));
}
break;
*
* \sa MultiplyPartOf, PutInGhostFormat
*/
-void MEDCouplingStructuredMesh::MultiplyPartOfByGhost(const std::vector<int>& st, const std::vector< std::pair<int,int> >& part, int ghostSize, double factor, DataArrayDouble *da)
+void MEDCouplingStructuredMesh::MultiplyPartOfByGhost(const std::vector<mcIdType>& st, const std::vector< std::pair<mcIdType,mcIdType> >& part, mcIdType ghostSize, double factor, DataArrayDouble *da)
{
- std::vector<int> stWG;
- std::vector< std::pair<int,int> > partWG;
+ std::vector<mcIdType> stWG;
+ std::vector< std::pair<mcIdType,mcIdType> > partWG;
PutInGhostFormat(ghostSize,st,part,stWG,partWG);
MultiplyPartOf(stWG,partWG,factor,da);
}
*
* \sa MultiplyPartOf, PutInGhostFormat
*/
-void MEDCouplingStructuredMesh::PutInGhostFormat(int ghostSize, const std::vector<int>& st, const std::vector< std::pair<int,int> >& part, std::vector<int>& stWithGhost, std::vector< std::pair<int,int> >&partWithGhost)
+void MEDCouplingStructuredMesh::PutInGhostFormat(mcIdType ghostSize, const std::vector<mcIdType>& st, const std::vector< std::pair<mcIdType,mcIdType> >& part, std::vector<mcIdType>& stWithGhost, std::vector< std::pair<mcIdType,mcIdType> >&partWithGhost)
{
if(ghostSize<0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::PutInGhostFormat : ghost size must be >= 0 !");
if(part[i].first<0 || part[i].first>part[i].second || part[i].second>st[i])
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::PutInGhostFormat : the specified part is invalid ! The begin must be >= 0 and <= end ! The end must be <= to the size at considered dimension !");
stWithGhost.resize(st.size());
- std::transform(st.begin(),st.end(),stWithGhost.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
+ std::transform(st.begin(),st.end(),stWithGhost.begin(),std::bind2nd(std::plus<mcIdType>(),2*ghostSize));
partWithGhost=part;
ApplyGhostOnCompactFrmt(partWithGhost,ghostSize);
}
* \param [in,out] partBeforeFact - the part of a image mesh in compact format that will be put in ghost reference.
* \param [in] ghostSize - the ghost size of zone for all axis.
*/
-void MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(std::vector< std::pair<int,int> >& partBeforeFact, int ghostSize)
+void MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(std::vector< std::pair<mcIdType,mcIdType> >& partBeforeFact, mcIdType ghostSize)
{
if(ghostSize<0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt : ghost size must be >= 0 !");
}
}
-int MEDCouplingStructuredMesh::GetNumberOfCellsOfSubLevelMesh(const std::vector<int>& cgs, int mdim)
+mcIdType MEDCouplingStructuredMesh::GetNumberOfCellsOfSubLevelMesh(const std::vector<mcIdType>& cgs, int mdim)
{
- int ret(0);
+ mcIdType ret(0);
for(int i=0;i<mdim;i++)
{
- int locRet(1);
+ mcIdType locRet(1);
for(int j=0;j<mdim;j++)
if(j!=i)
locRet*=cgs[j];
class MEDCouplingStructuredMesh : public MEDCouplingMesh
{
public:
- MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(std::size_t cellId) const;
+ MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const;
MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
- MEDCOUPLING_EXPORT std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
- MEDCOUPLING_EXPORT DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
- MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const;
- MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const;
- MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const;
- MEDCOUPLING_EXPORT std::vector<int> getLocationFromCellId(int cellId) const;
- MEDCOUPLING_EXPORT std::vector<int> getLocationFromNodeId(int nodeId) const;
- MEDCOUPLING_EXPORT static void GetPosFromId(int eltId, int meshDim, const int *split, int *res);
- MEDCOUPLING_EXPORT static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
- MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getLocationFromCellId(mcIdType cellId) const;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getLocationFromNodeId(mcIdType nodeId) const;
+ MEDCOUPLING_EXPORT static void GetPosFromId(mcIdType eltId, int meshDim, const mcIdType *split, mcIdType *res);
+ MEDCOUPLING_EXPORT static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension( int meshDim);
+ MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other);
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
//tools
- MEDCOUPLING_EXPORT std::vector<int> getDistributionOfTypes() const;
- MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const;
- MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType, bool smartPflKiller=true) const;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getDistributionOfTypes() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller=true) const;
MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const int *start, const int *end) const;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const;
- MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy);
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy);
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
- MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const;
+ MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const;
//some useful methods
MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
- MEDCOUPLING_EXPORT int getCellIdFromPos(int i, int j, int k) const;
- MEDCOUPLING_EXPORT int getNodeIdFromPos(int i, int j, int k) const;
- MEDCOUPLING_EXPORT std::size_t getNumberOfCells() const;
- MEDCOUPLING_EXPORT int getNumberOfNodes() const;
+ MEDCOUPLING_EXPORT mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
+ MEDCOUPLING_EXPORT mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const;
MEDCOUPLING_EXPORT int getMeshDimension() const;
- MEDCOUPLING_EXPORT int getNumberOfCellsOfSubLevelMesh() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsOfSubLevelMesh() const;
MEDCOUPLING_EXPORT int getSpaceDimensionOnNodeStruct() const;
- MEDCOUPLING_EXPORT virtual void getNodeGridStructure(int *res) const = 0;
- MEDCOUPLING_EXPORT virtual void getSplitCellValues(int *res) const;
- MEDCOUPLING_EXPORT virtual void getSplitNodeValues(int *res) const;
- MEDCOUPLING_EXPORT virtual std::vector<int> getNodeGridStructure() const = 0;
- MEDCOUPLING_EXPORT std::vector<int> getCellGridStructure() const;
+ MEDCOUPLING_EXPORT virtual void getNodeGridStructure(mcIdType *res) const = 0;
+ MEDCOUPLING_EXPORT virtual void getSplitCellValues(mcIdType *res) const;
+ MEDCOUPLING_EXPORT virtual void getSplitNodeValues(mcIdType *res) const;
+ MEDCOUPLING_EXPORT virtual std::vector<mcIdType> getNodeGridStructure() const = 0;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getCellGridStructure() const;
MEDCOUPLING_EXPORT double computeSquareness() const;
- MEDCOUPLING_EXPORT virtual MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const = 0;
- MEDCOUPLING_EXPORT static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct);
- MEDCOUPLING_EXPORT static bool IsPartStructured(const int *startIds, const int *stopIds, const std::vector<int>& st, std::vector< std::pair<int,int> >& partCompactFormat);
- MEDCOUPLING_EXPORT static std::vector<int> GetDimensionsFromCompactFrmt(const std::vector< std::pair<int,int> >& partCompactFormat);
- MEDCOUPLING_EXPORT static std::vector< std::pair<int,int> > GetCompactFrmtFromDimensions(const std::vector<int>& dims);
- MEDCOUPLING_EXPORT static std::vector< std::pair<int,int> > IntersectRanges(const std::vector< std::pair<int,int> >& r1, const std::vector< std::pair<int,int> >& r2);
- MEDCOUPLING_EXPORT static bool AreRangesIntersect(const std::vector< std::pair<int,int> >& r1, const std::vector< std::pair<int,int> >& r2);
- MEDCOUPLING_EXPORT static void SwitchOnIdsFrom(const std::vector<int>& st, const std::vector< std::pair<int,int> >& partCompactFormat, std::vector<bool>& vectToSwitchOn);
- MEDCOUPLING_EXPORT static void ExtractFieldOfBoolFrom(const std::vector<int>& st, const std::vector<bool>& fieldOfBool, const std::vector< std::pair<int,int> >& partCompactFormat, std::vector<bool>& fieldOut);
- MEDCOUPLING_EXPORT static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<int>& st, const DataArrayDouble *fieldOfDbl, const std::vector< std::pair<int,int> >& partCompactFormat);
- MEDCOUPLING_EXPORT static void AssignPartOfFieldOfDoubleUsing(const std::vector<int>& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair<int,int> >& partCompactFormat, const DataArrayDouble *other);
- MEDCOUPLING_EXPORT static void ChangeReferenceFromGlobalOfCompactFrmt(const std::vector< std::pair<int,int> >& bigInAbs, const std::vector< std::pair<int,int> >& partOfBigInAbs, std::vector< std::pair<int,int> >& partOfBigRelativeToBig, bool check=true);
- MEDCOUPLING_EXPORT static void ChangeReferenceToGlobalOfCompactFrmt(const std::vector< std::pair<int,int> >& bigInAbs, const std::vector< std::pair<int,int> >& partOfBigRelativeToBig, std::vector< std::pair<int,int> >& partOfBigInAbs, bool check=true);
- MEDCOUPLING_EXPORT static std::vector< std::pair<int,int> > TranslateCompactFrmt(const std::vector< std::pair<int,int> >& part, const std::vector<int>& translation);
- MEDCOUPLING_EXPORT static std::vector<int> FindTranslationFrom(const std::vector< std::pair<int,int> >& startingFrom, const std::vector< std::pair<int,int> >& goingTo);
- MEDCOUPLING_EXPORT static DataArrayInt *BuildExplicitIdsFrom(const std::vector<int>& st, const std::vector< std::pair<int,int> >& partCompactFormat);
- MEDCOUPLING_EXPORT static void MultiplyPartOf(const std::vector<int>& st, const std::vector< std::pair<int,int> >& part, double factor, DataArrayDouble *da);
- MEDCOUPLING_EXPORT static void MultiplyPartOfByGhost(const std::vector<int>& st, const std::vector< std::pair<int,int> >& part, int ghostSize, double factor, DataArrayDouble *da);
- MEDCOUPLING_EXPORT static void PutInGhostFormat(int ghostSize, const std::vector<int>& st, const std::vector< std::pair<int,int> >& part, std::vector<int>& stWithGhost, std::vector< std::pair<int,int> >&partWithGhost);
- MEDCOUPLING_EXPORT static void ApplyGhostOnCompactFrmt(std::vector< std::pair<int,int> >& partBeforeFact, int ghostSize);
- MEDCOUPLING_EXPORT static DataArrayInt *Build1GTNodalConnectivity(const int *nodeStBg, const int *nodeStEnd);
- MEDCOUPLING_EXPORT static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(const int *nodeStBg, const int *nodeStEnd);
- MEDCOUPLING_EXPORT static DataArrayInt *ComputeCornersGhost(const std::vector<int>& st, int ghostLev);
- MEDCOUPLING_EXPORT static int DeduceNumberOfGivenRangeInCompactFrmt(const std::vector< std::pair<int,int> >& partCompactFormat);
- MEDCOUPLING_EXPORT static int DeduceNumberOfGivenStructure(const std::vector<int>& st);
- MEDCOUPLING_EXPORT static void FindTheWidestAxisOfGivenRangeInCompactFrmt(const std::vector< std::pair<int,int> >& partCompactFormat, int& axisId, int& sizeOfRange);
- MEDCOUPLING_EXPORT static int FindMinimalPartOf(int minPatchLgth, const std::vector<int>& st, const std::vector<bool>& crit, std::vector<bool>& reducedCrit, std::vector< std::pair<int,int> >& partCompactFormat);
- MEDCOUPLING_EXPORT static std::vector< std::vector<int> > ComputeSignaturePerAxisOf(const std::vector<int>& st, const std::vector<bool>& crit);
+ MEDCOUPLING_EXPORT virtual MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const = 0;
+ MEDCOUPLING_EXPORT static std::vector<mcIdType> GetSplitVectFromStruct(const std::vector<mcIdType>& strct);
+ MEDCOUPLING_EXPORT static bool IsPartStructured(const mcIdType *startIds, const mcIdType *stopIds, const std::vector<mcIdType>& st, std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat);
+ MEDCOUPLING_EXPORT static std::vector<mcIdType> GetDimensionsFromCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat);
+ MEDCOUPLING_EXPORT static std::vector< std::pair<mcIdType,mcIdType> > GetCompactFrmtFromDimensions(const std::vector<mcIdType>& dims);
+ MEDCOUPLING_EXPORT static std::vector< std::pair<mcIdType,mcIdType> > IntersectRanges(const std::vector< std::pair<mcIdType,mcIdType> >& r1, const std::vector< std::pair<mcIdType,mcIdType> >& r2);
+ MEDCOUPLING_EXPORT static bool AreRangesIntersect(const std::vector< std::pair<mcIdType,mcIdType> >& r1, const std::vector< std::pair<mcIdType,mcIdType> >& r2);
+ MEDCOUPLING_EXPORT static void SwitchOnIdsFrom(const std::vector<mcIdType>& st, const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat, std::vector<bool>& vectToSwitchOn);
+ MEDCOUPLING_EXPORT static void ExtractFieldOfBoolFrom(const std::vector<mcIdType>& st, const std::vector<bool>& fieldOfBool, const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat, std::vector<bool>& fieldOut);
+ MEDCOUPLING_EXPORT static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<mcIdType>& st, const DataArrayDouble *fieldOfDbl, const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat);
+ MEDCOUPLING_EXPORT static void AssignPartOfFieldOfDoubleUsing(const std::vector<mcIdType>& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat, const DataArrayDouble *other);
+ MEDCOUPLING_EXPORT static void ChangeReferenceFromGlobalOfCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& bigInAbs, const std::vector< std::pair<mcIdType,mcIdType> >& partOfBigInAbs, std::vector< std::pair<mcIdType,mcIdType> >& partOfBigRelativeToBig, bool check=true);
+ MEDCOUPLING_EXPORT static void ChangeReferenceToGlobalOfCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& bigInAbs, const std::vector< std::pair<mcIdType,mcIdType> >& partOfBigRelativeToBig, std::vector< std::pair<mcIdType,mcIdType> >& partOfBigInAbs, bool check=true);
+ MEDCOUPLING_EXPORT static std::vector< std::pair<mcIdType,mcIdType> > TranslateCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& part, const std::vector<mcIdType>& translation);
+ MEDCOUPLING_EXPORT static std::vector<mcIdType> FindTranslationFrom(const std::vector< std::pair<mcIdType,mcIdType> >& startingFrom, const std::vector< std::pair<mcIdType,mcIdType> >& goingTo);
+ MEDCOUPLING_EXPORT static DataArrayIdType *BuildExplicitIdsFrom(const std::vector<mcIdType>& st, const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat);
+ MEDCOUPLING_EXPORT static void MultiplyPartOf(const std::vector<mcIdType>& st, const std::vector< std::pair<mcIdType,mcIdType> >& part, double factor, DataArrayDouble *da);
+ MEDCOUPLING_EXPORT static void MultiplyPartOfByGhost(const std::vector<mcIdType>& st, const std::vector< std::pair<mcIdType,mcIdType> >& part, mcIdType ghostSize, double factor, DataArrayDouble *da);
+ MEDCOUPLING_EXPORT static void PutInGhostFormat(mcIdType ghostSize, const std::vector<mcIdType>& st, const std::vector< std::pair<mcIdType,mcIdType> >& part, std::vector<mcIdType>& stWithGhost, std::vector< std::pair<mcIdType,mcIdType> >&partWithGhost);
+ MEDCOUPLING_EXPORT static void ApplyGhostOnCompactFrmt(std::vector< std::pair<mcIdType,mcIdType> >& partBeforeFact, mcIdType ghostSize);
+ MEDCOUPLING_EXPORT static DataArrayIdType *Build1GTNodalConnectivity(const mcIdType *nodeStBg, const mcIdType *nodeStEnd);
+ MEDCOUPLING_EXPORT static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(const mcIdType *nodeStBg, const mcIdType *nodeStEnd);
+ MEDCOUPLING_EXPORT static DataArrayIdType *ComputeCornersGhost(const std::vector<mcIdType>& st, mcIdType ghostLev);
+ MEDCOUPLING_EXPORT static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat);
+ MEDCOUPLING_EXPORT static mcIdType DeduceNumberOfGivenStructure(const std::vector<mcIdType>& st);
+ MEDCOUPLING_EXPORT static void FindTheWidestAxisOfGivenRangeInCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat, int& axisId, mcIdType& sizeOfRange);
+ MEDCOUPLING_EXPORT static mcIdType FindMinimalPartOf(mcIdType minPatchLgth, const std::vector<mcIdType>& st, const std::vector<bool>& crit, std::vector<bool>& reducedCrit, std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat);
+ MEDCOUPLING_EXPORT static std::vector< std::vector<mcIdType> > ComputeSignaturePerAxisOf(const std::vector<mcIdType>& st, const std::vector<bool>& crit);
private:
- static int GetNumberOfCellsOfSubLevelMesh(const std::vector<int>& cgs, int mdim);
- static void GetReverseNodalConnectivity1(const std::vector<int>& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx);
- static void GetReverseNodalConnectivity2(const std::vector<int>& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx);
- static void GetReverseNodalConnectivity3(const std::vector<int>& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx);
- static DataArrayInt *Build1GTNodalConnectivity1D(const int *nodeStBg);
- static DataArrayInt *Build1GTNodalConnectivity2D(const int *nodeStBg);
- static DataArrayInt *Build1GTNodalConnectivity3D(const int *nodeStBg);
- static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh2D(const int *nodeStBg);
- static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh3D(const int *nodeStBg);
- static int FindMinimalPartOf1D(const std::vector<int>& st, const std::vector<bool>& crit, std::vector< std::pair<int,int> >& partCompactFormat);
- static int FindMinimalPartOf2D(const std::vector<int>& st, const std::vector<bool>& crit, std::vector< std::pair<int,int> >& partCompactFormat);
- static int FindMinimalPartOf3D(const std::vector<int>& st, const std::vector<bool>& crit, std::vector< std::pair<int,int> >& partCompactFormat);
+ static mcIdType GetNumberOfCellsOfSubLevelMesh(const std::vector<mcIdType>& cgs, int mdim);
+ static void GetReverseNodalConnectivity1(const std::vector<mcIdType>& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx);
+ static void GetReverseNodalConnectivity2(const std::vector<mcIdType>& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx);
+ static void GetReverseNodalConnectivity3(const std::vector<mcIdType>& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx);
+ static DataArrayIdType *Build1GTNodalConnectivity1D(const mcIdType *nodeStBg);
+ static DataArrayIdType *Build1GTNodalConnectivity2D(const mcIdType *nodeStBg);
+ static DataArrayIdType *Build1GTNodalConnectivity3D(const mcIdType *nodeStBg);
+ static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh2D(const mcIdType *nodeStBg);
+ static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh3D(const mcIdType *nodeStBg);
+ static mcIdType FindMinimalPartOf1D(const std::vector<mcIdType>& st, const std::vector<bool>& crit, std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat);
+ static mcIdType FindMinimalPartOf2D(const std::vector<mcIdType>& st, const std::vector<bool>& crit, std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat);
+ static mcIdType FindMinimalPartOf3D(const std::vector<mcIdType>& st, const std::vector<bool>& crit, std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat);
protected:
- static int ZipNodeStructure(const int *nodeStBg, const int *nodeStEnd, int zipNodeSt[3]);
+ static int ZipNodeStructure(const mcIdType *nodeStBg, const mcIdType *nodeStEnd, mcIdType zipNodeSt[3]);
protected:
MEDCOUPLING_EXPORT MEDCouplingStructuredMesh();
MEDCOUPLING_EXPORT MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCpy);
return ret;
}
-MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedComponents(const std::vector<int>& compoIds) const
+MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedComponents(const std::vector<std::size_t>& compoIds) const
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
return ret;
}
-void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds)
+void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<std::size_t>& compoIds)
{
std::vector<DataArrayDouble *> arrays1,arrays2;
getArrays(arrays1);
}
}
-void MEDCouplingTimeDiscretization::changeNbOfComponents(int newNbOfComp, double dftValue)
+void MEDCouplingTimeDiscretization::changeNbOfComponents(std::size_t newNbOfComp, double dftValue)
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
}
}
-void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, int nbOfCompo, double value)
+void MEDCouplingTimeDiscretization::setUniformValue(mcIdType nbOfTuple, int nbOfCompo, double value)
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
setArrays(arrays3,0);
}
-void MEDCouplingTimeDiscretization::setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value)
+void MEDCouplingTimeDiscretization::setOrCreateUniformValueOnAllComponents(mcIdType nbOfTuple, double value)
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingNoTimeLabel::getValueOnTime(int eltId, double time, double *value) const
+void MEDCouplingNoTimeLabel::getValueOnTime(mcIdType eltId, double time, double *value) const
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingNoTimeLabel::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
+void MEDCouplingNoTimeLabel::getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
/*!
* idem getTinySerializationIntInformation except that it is for multi field fetch
*/
-void MEDCouplingNoTimeLabel::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
+void MEDCouplingNoTimeLabel::getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const
{
tinyInfo.clear();
}
/*!
* idem finishUnserialization except that it is for multi field fetch
*/
-void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
+void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD)
{
_time_tolerance=tinyInfoD[0];
}
setTimeUnit(tUnit);
}
-void MEDCouplingWithTimeStep::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+void MEDCouplingWithTimeStep::getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const
{
MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
tinyInfo.push_back(_tk.getIteration());
tinyInfo.push_back(_tk.getTimeValue());
}
-void MEDCouplingWithTimeStep::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
+void MEDCouplingWithTimeStep::finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
{
MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
_tk.setTimeValue(tinyInfoD[1]);
- _tk.setIteration(tinyInfoI[2]);
- _tk.setOrder(tinyInfoI[3]);
+ _tk.setIteration(FromIdType<int>(tinyInfoI[2]));
+ _tk.setOrder(FromIdType<int>(tinyInfoI[3]));
}
/*!
* idem getTinySerializationIntInformation except that it is for multi field fetch
*/
-void MEDCouplingWithTimeStep::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
+void MEDCouplingWithTimeStep::getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const
{
tinyInfo.resize(2);
tinyInfo[0]=_tk.getIteration();
/*!
* idem finishUnserialization except that it is for multi field fetch
*/
-void MEDCouplingWithTimeStep::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
+void MEDCouplingWithTimeStep::finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD)
{
- _tk.setIteration(tinyInfoI[0]);
- _tk.setOrder(tinyInfoI[1]);
+ _tk.setIteration(FromIdType<int>(tinyInfoI[0]));
+ _tk.setOrder(FromIdType<int>(tinyInfoI[1]));
_time_tolerance=tinyInfoD[0];
_tk.setTimeValue(tinyInfoD[1]);
}
std::copy(vals.begin(),vals.end(),res);
}
-void MEDCouplingWithTimeStep::getValueOnTime(int eltId, double time, double *value) const
+void MEDCouplingWithTimeStep::getValueOnTime(mcIdType eltId, double time, double *value) const
{
if(std::fabs(time-_tk.getTimeValue())<=_time_tolerance)
if(_array)
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingWithTimeStep::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
+void MEDCouplingWithTimeStep::getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const
{
if(_tk.getIteration()==iteration && _tk.getOrder()==order)
if(_array)
_end.copyFrom(otherC->_end);
}
-void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const
{
MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
tinyInfo.push_back(_start.getIteration());
tinyInfo.push_back(_end.getTimeValue());
}
-void MEDCouplingConstOnTimeInterval::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
+void MEDCouplingConstOnTimeInterval::finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
{
MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
_start.setTimeValue(tinyInfoD[1]);
_end.setTimeValue(tinyInfoD[2]);
- _start.setIteration(tinyInfoI[2]);
- _start.setOrder(tinyInfoI[3]);
- _end.setIteration(tinyInfoI[4]);
- _end.setOrder(tinyInfoI[5]);
+ _start.setIteration(FromIdType<int>(tinyInfoI[2]));
+ _start.setOrder(FromIdType<int>(tinyInfoI[3]));
+ _end.setIteration(FromIdType<int>(tinyInfoI[4]));
+ _end.setOrder(FromIdType<int>(tinyInfoI[5]));
}
/*!
* idem getTinySerializationIntInformation except that it is for multi field fetch
*/
-void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
+void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const
{
tinyInfo.resize(4);
tinyInfo[0]=_start.getIteration();
/*!
* idem finishUnserialization except that it is for multi field fetch
*/
-void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
+void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD)
{
- _start.setIteration(tinyInfoI[0]);
- _start.setOrder(tinyInfoI[1]);
- _end.setIteration(tinyInfoI[2]);
- _end.setOrder(tinyInfoI[3]);
+ _start.setIteration(FromIdType<int>(tinyInfoI[0]));
+ _start.setOrder(FromIdType<int>(tinyInfoI[1]));
+ _end.setIteration(FromIdType<int>(tinyInfoI[2]));
+ _end.setOrder(FromIdType<int>(tinyInfoI[3]));
_time_tolerance=tinyInfoD[0];
_start.setTimeValue(tinyInfoD[1]);
_end.setTimeValue(tinyInfoD[2]);
return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
}
-void MEDCouplingConstOnTimeInterval::getValueOnTime(int eltId, double time, double *value) const
+void MEDCouplingConstOnTimeInterval::getValueOnTime(mcIdType eltId, double time, double *value) const
{
if(time>_start.getTimeValue()-_time_tolerance && time<_end.getTimeValue()+_time_tolerance)
if(_array)
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingConstOnTimeInterval::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
+void MEDCouplingConstOnTimeInterval::getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const
{
if(iteration>=_start.getIteration() && iteration<=_end.getIteration())
if(_array)
}
}
-void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const
{
MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
tinyInfo.push_back(_start.getIteration());
if(_end_array)
{
tinyInfo.push_back(_end_array->getNumberOfTuples());
- tinyInfo.push_back(_end_array->getNumberOfComponents());
+ tinyInfo.push_back(ToIdType(_end_array->getNumberOfComponents()));
}
else
{
void MEDCouplingTwoTimeSteps::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
{
- int nbOfCompo=_array->getNumberOfComponents();
- for(int i=0;i<nbOfCompo;i++)
+ std::size_t nbOfCompo=_array->getNumberOfComponents();
+ for(std::size_t i=0;i<nbOfCompo;i++)
tinyInfo.push_back(_array->getInfoOnComponent(i));
- for(int i=0;i<nbOfCompo;i++)
+ for(std::size_t i=0;i<nbOfCompo;i++)
tinyInfo.push_back(_end_array->getInfoOnComponent(i));
}
-void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays)
+void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI, std::vector<DataArrayDouble *>& arrays)
{
arrays.resize(2);
if(_array!=0)
arrays[1]=arr;
}
-void MEDCouplingTwoTimeSteps::checkForUnserialization(const std::vector<int>& tinyInfoI, const std::vector<DataArrayDouble *>& arrays)
+void MEDCouplingTwoTimeSteps::checkForUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<DataArrayDouble *>& arrays)
{
static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size two !";
if(arrays.size()!=2)
}
}
-void MEDCouplingTwoTimeSteps::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
+void MEDCouplingTwoTimeSteps::finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
{
MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
_start.setTimeValue(tinyInfoD[1]);
_end.setTimeValue(tinyInfoD[2]);
- _start.setIteration(tinyInfoI[2]);
- _start.setOrder(tinyInfoI[3]);
- _end.setIteration(tinyInfoI[4]);
- _end.setOrder(tinyInfoI[5]);
+ _start.setIteration(FromIdType<int>(tinyInfoI[2]));
+ _start.setOrder(FromIdType<int>(tinyInfoI[3]));
+ _end.setIteration(FromIdType<int>(tinyInfoI[4]));
+ _end.setOrder(FromIdType<int>(tinyInfoI[5]));
}
/*!
* idem getTinySerializationIntInformation except that it is for multi field fetch
*/
-void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
+void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const
{
tinyInfo.resize(4);
tinyInfo[0]=_start.getIteration();
/*!
* idem finishUnserialization except that it is for multi field fetch
*/
-void MEDCouplingTwoTimeSteps::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
+void MEDCouplingTwoTimeSteps::finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD)
{
- _start.setIteration(tinyInfoI[0]);
- _start.setOrder(tinyInfoI[1]);
- _end.setIteration(tinyInfoI[2]);
- _end.setOrder(tinyInfoI[3]);
+ _start.setIteration(FromIdType<int>(tinyInfoI[0]));
+ _start.setOrder(FromIdType<int>(tinyInfoI[1]));
+ _end.setIteration(FromIdType<int>(tinyInfoI[2]));
+ _end.setOrder(FromIdType<int>(tinyInfoI[3]));
_time_tolerance=tinyInfoD[0];
_start.setTimeValue(tinyInfoD[1]);
_end.setTimeValue(tinyInfoD[2]);
return true;
if(_end_array==0 || otherC->_end_array==0)
return false;
- int nbC1=_end_array->getNumberOfComponents();
- int nbC2=otherC->_end_array->getNumberOfComponents();
+ std::size_t nbC1=_end_array->getNumberOfComponents();
+ std::size_t nbC2=otherC->_end_array->getNumberOfComponents();
if(nbC1!=nbC2 && nbC2!=1)
return false;
return true;
std::transform(tmp.begin(),tmp.end(),res,res,std::plus<double>());
}
-void MEDCouplingLinearTime::getValueOnTime(int eltId, double time, double *value) const
+void MEDCouplingLinearTime::getValueOnTime(mcIdType eltId, double time, double *value) const
{
double alpha=(_end.getTimeValue()-time)/(_end.getTimeValue()-_start.getTimeValue());
- int nbComp;
if(_array)
_array->getTuple(eltId,value);
else
throw INTERP_KERNEL::Exception("No start array existing.");
- nbComp=_array->getNumberOfComponents();
+ std::size_t nbComp=_array->getNumberOfComponents();
std::transform(value,value+nbComp,value,std::bind2nd(std::multiplies<double>(),alpha));
std::vector<double> tmp(nbComp);
if(_end_array)
std::transform(tmp.begin(),tmp.end(),value,value,std::plus<double>());
}
-void MEDCouplingLinearTime::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const
+void MEDCouplingLinearTime::getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const
{
if(iteration==_start.getIteration() && order==_start.getOrder())
{
MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<T> *other) const;
MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<T> *other) const;
MEDCOUPLING_EXPORT virtual ~MEDCouplingTimeDiscretizationTemplate();
- MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+ MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
MEDCOUPLING_EXPORT virtual void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
- MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<typename Traits<T>::ArrayType *>& arrays);
- MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector<int>& tinyInfoI, const std::vector<typename Traits<T>::ArrayType *>& arrays);
- MEDCOUPLING_EXPORT virtual void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+ MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI, std::vector<typename Traits<T>::ArrayType *>& arrays);
+ MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<typename Traits<T>::ArrayType *>& arrays);
+ MEDCOUPLING_EXPORT virtual void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
protected:
MEDCOUPLING_EXPORT MEDCouplingTimeDiscretizationTemplate();
MEDCOUPLING_EXPORT MEDCouplingTimeDiscretizationTemplate(const MEDCouplingTimeDiscretizationTemplate<T>& other, bool deepCopy);
MEDCOUPLING_EXPORT virtual void divideEqual(const MEDCouplingTimeDiscretization *other) = 0;
MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const = 0;
MEDCOUPLING_EXPORT virtual void powEqual(const MEDCouplingTimeDiscretization *other) = 0;
- MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const = 0;
+ MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const = 0;
MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const = 0;
- MEDCOUPLING_EXPORT virtual void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) = 0;
+ MEDCOUPLING_EXPORT virtual void finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD) = 0;
MEDCOUPLING_EXPORT virtual void checkNoTimePresence() const = 0;
MEDCOUPLING_EXPORT virtual void checkTimePresence(double time) const = 0;
MEDCOUPLING_EXPORT virtual std::vector< const DataArrayDouble *> getArraysForTime(double time) const = 0;
MEDCOUPLING_EXPORT virtual void getValueForTime(double time, const std::vector<double>& vals, double *res) const = 0;
MEDCOUPLING_EXPORT virtual bool isBefore(const MEDCouplingTimeDiscretization *other) const;
MEDCOUPLING_EXPORT virtual bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const;
- MEDCOUPLING_EXPORT virtual void getValueOnTime(int eltId, double time, double *value) const = 0;
- MEDCOUPLING_EXPORT virtual void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const = 0;
+ MEDCOUPLING_EXPORT virtual void getValueOnTime(mcIdType eltId, double time, double *value) const = 0;
+ MEDCOUPLING_EXPORT virtual void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const = 0;
//
MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *computeVectorFieldCyl(const DataArrayDouble *coords, const double center[3], const double vect[3]) const;
MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *doublyContractedProduct() const;
MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *magnitude() const;
MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *negate() const;
MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *maxPerTuple() const;
- MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector<int>& compoIds) const;
- MEDCOUPLING_EXPORT virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds);
- MEDCOUPLING_EXPORT virtual void changeNbOfComponents(int newNbOfComp, double dftValue);
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const;
+ MEDCOUPLING_EXPORT virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<std::size_t>& compoIds);
+ MEDCOUPLING_EXPORT virtual void changeNbOfComponents(std::size_t newNbOfComp, double dftValue);
MEDCOUPLING_EXPORT virtual void sortPerTuple(bool asc);
- MEDCOUPLING_EXPORT virtual void setUniformValue(int nbOfTuple, int nbOfCompo, double value);
- MEDCOUPLING_EXPORT virtual void setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value);
+ MEDCOUPLING_EXPORT virtual void setUniformValue(mcIdType nbOfTuple, int nbOfCompo, double value);
+ MEDCOUPLING_EXPORT virtual void setOrCreateUniformValueOnAllComponents(mcIdType nbOfTuple, double value);
MEDCOUPLING_EXPORT virtual void applyLin(double a, double b, int compoId);
MEDCOUPLING_EXPORT virtual void applyLin(double a, double b);
MEDCOUPLING_EXPORT virtual void applyFunc(int nbOfComp, FunctionToEvaluate func);
MEDCOUPLING_EXPORT void setEndTimeValue(double time);
MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order);
MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order);
- MEDCOUPLING_EXPORT void getValueOnTime(int eltId, double time, double *value) const;
- MEDCOUPLING_EXPORT void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const;
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const;
+ MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const;
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
- MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
+ MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD);
public:
static const TypeOfTimeDiscretization DISCRETIZATION=NO_TIME;
MEDCOUPLING_EXPORT static const char REPR[];
MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
- MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
- MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
+ MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD);
MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const;
MEDCOUPLING_EXPORT void checkNoTimePresence() const;
MEDCOUPLING_EXPORT void checkTimePresence(double time) const;
MEDCOUPLING_EXPORT void setEndTimeValue(double time) { _tk.setTimeValue(time); }
MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const;
MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
- MEDCOUPLING_EXPORT void getValueOnTime(int eltId, double time, double *value) const;
- MEDCOUPLING_EXPORT void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const;
+ MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const;
+ MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const;
public:
static const TypeOfTimeDiscretization DISCRETIZATION=ONE_TIME;
MEDCOUPLING_EXPORT static const char REPR[];
public:
MEDCOUPLING_EXPORT MEDCouplingConstOnTimeInterval();
MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other);
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
- MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
- MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
+ MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD);
MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const;
MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const;
MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const;
MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
- MEDCOUPLING_EXPORT void getValueOnTime(int eltId, double time, double *value) const;
- MEDCOUPLING_EXPORT void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const;
+ MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const;
+ MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const;
MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh);
MEDCOUPLING_EXPORT std::string getStringRepr() const;
MEDCOUPLING_EXPORT void setEndOrder(int order) { _end.setOrder(order); }
MEDCOUPLING_EXPORT void setStartTimeValue(double time) { _start.setTimeValue(time); }
MEDCOUPLING_EXPORT void setEndTimeValue(double time) { _end.setTimeValue(time); }
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
- MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector<int>& tinyInfoI, const std::vector<DataArrayDouble *>& arrays);
- MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
+ MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<DataArrayDouble *>& arrays);
+ MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
- MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
+ MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD);
MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const;
MEDCOUPLING_EXPORT void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner);
protected:
MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
- MEDCOUPLING_EXPORT void getValueOnTime(int eltId, double time, double *value) const;
- MEDCOUPLING_EXPORT void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const;
+ MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const;
+ MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const;
MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
return true;
if(_array==0 || other->_array==0)
return false;
- int nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents());
- int nbMin(std::min(nbC1,nbC2));
+ std::size_t nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents());
+ std::size_t nbMin(std::min(nbC1,nbC2));
if(nbC1!=nbC2 && nbMin!=1)
return false;
return true;
return true;
if(_array==0 || other->_array==0)
return false;
- int nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents());
+ std::size_t nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents());
if(nbC1!=nbC2 && nbC2!=1)
return false;
return true;
}
template<class T>
- void MEDCouplingTimeDiscretizationTemplate<T>::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+ void MEDCouplingTimeDiscretizationTemplate<T>::getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const
{
if(_array)
{
tinyInfo.push_back(_array->getNumberOfTuples());
- tinyInfo.push_back(_array->getNumberOfComponents());
+ tinyInfo.push_back(ToIdType(_array->getNumberOfComponents()));
}
else
{
template<class T>
void MEDCouplingTimeDiscretizationTemplate<T>::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
{
- int nbOfCompo(_array->getNumberOfComponents());
- for(int i=0;i<nbOfCompo;i++)
+ std::size_t nbOfCompo(_array->getNumberOfComponents());
+ for(std::size_t i=0;i<nbOfCompo;i++)
tinyInfo.push_back(_array->getInfoOnComponent(i));
}
template<class T>
- void MEDCouplingTimeDiscretizationTemplate<T>::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<typename Traits<T>::ArrayType *>& arrays)
+ void MEDCouplingTimeDiscretizationTemplate<T>::resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI, std::vector<typename Traits<T>::ArrayType *>& arrays)
{
arrays.resize(1);
if(_array!=0)
}
template<class T>
- void MEDCouplingTimeDiscretizationTemplate<T>::checkForUnserialization(const std::vector<int>& tinyInfoI, const std::vector<typename Traits<T>::ArrayType *>& arrays)
+ void MEDCouplingTimeDiscretizationTemplate<T>::checkForUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<typename Traits<T>::ArrayType *>& arrays)
{
static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size one !";
if(arrays.size()!=1)
}
template<class T>
- void MEDCouplingTimeDiscretizationTemplate<T>::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
+ void MEDCouplingTimeDiscretizationTemplate<T>::finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
{
_time_tolerance=tinyInfoD[0];
- int nbOfCompo=_array->getNumberOfComponents();
- for(int i=0;i<nbOfCompo;i++)
+ std::size_t nbOfCompo=_array->getNumberOfComponents();
+ for(std::size_t i=0;i<nbOfCompo;i++)
_array->setInfoOnComponent(i,tinyInfoS[i]);
}
#include "MEDCoupling.hxx"
#include "MCType.hxx"
+#include <vector>
namespace MEDCoupling
{
class MEDCouplingFieldFloat;
class MEDCouplingFieldInt;
class DataArrayInt32Tuple;
+ class DataArrayInt64Tuple;
class DataArrayFloatTuple;
class DataArrayDoubleTuple;
+ class DataArrayByteTuple;
+ class DataArrayInt32Iterator;
+ class DataArrayInt64Iterator;
+ class DataArrayByteIterator;
template<>
struct MEDCOUPLING_EXPORT Traits<double>
typedef DataArrayInt32 ArrayTypeCh;
typedef MEDCouplingFieldInt FieldType;
typedef DataArrayInt32Tuple ArrayTuple;
+ typedef DataArrayInt32Iterator IteratorType;
};
template<>
typedef DataArrayInt64 ArrayType;
typedef DataArrayInt64 ArrayTypeCh;
//typedef MEDCouplingFieldInt64 FieldType;
- //typedef DataArrayInt64Tuple ArrayTuple;
+ typedef DataArrayInt64Tuple ArrayTuple;
+ typedef DataArrayInt64Iterator IteratorType;
};
template<>
static const char ArrayTypeName[];
typedef DataArrayByte ArrayTypeCh;
typedef DataArrayChar ArrayType;
+ typedef DataArrayByteTuple ArrayTuple;
+ typedef DataArrayByteIterator IteratorType;
};
}
/// @cond INTERNAL
const INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::MEDMEM_ORDER[N_MEDMEM_ORDER] = { INTERP_KERNEL::NORM_POINT1, INTERP_KERNEL::NORM_SEG2, INTERP_KERNEL::NORM_SEG3, INTERP_KERNEL::NORM_SEG4, INTERP_KERNEL::NORM_POLYL, INTERP_KERNEL::NORM_TRI3, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_TRI6, INTERP_KERNEL::NORM_TRI7, INTERP_KERNEL::NORM_QUAD8, INTERP_KERNEL::NORM_QUAD9, INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_QPOLYG, INTERP_KERNEL::NORM_TETRA4, INTERP_KERNEL::NORM_PYRA5, INTERP_KERNEL::NORM_PENTA6, INTERP_KERNEL::NORM_HEXA8, INTERP_KERNEL::NORM_HEXGP12, INTERP_KERNEL::NORM_TETRA10, INTERP_KERNEL::NORM_PYRA13, INTERP_KERNEL::NORM_PENTA15, INTERP_KERNEL::NORM_PENTA18, INTERP_KERNEL::NORM_HEXA20, INTERP_KERNEL::NORM_HEXA27, INTERP_KERNEL::NORM_POLYHED };
-const int MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER[INTERP_KERNEL::NORM_MAXTYPE+1]={1,3,21,5,9,7,22,34,23,28,-1,-1,-1,-1,10,14,13,-1,12,-1,24,-1,16,27,-1,26,-1,29,32,-1,25,42,36,4};
+const mcIdType MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER[INTERP_KERNEL::NORM_MAXTYPE+1]={1,3,21,5,9,7,22,34,23,28,-1,-1,-1,-1,10,14,13,-1,12,-1,24,-1,16,27,-1,26,-1,29,32,-1,25,42,36,4};
/// @endcond
MEDCouplingUMesh *MEDCouplingUMesh::New()
{
checkConnectivityFullyDefined();
MCAuto<MEDCouplingUMesh> ret=clone(false);
- MCAuto<DataArrayInt> c(getNodalConnectivity()->deepCopy()),ci(getNodalConnectivityIndex()->deepCopy());
+ MCAuto<DataArrayIdType> c(getNodalConnectivity()->deepCopy()),ci(getNodalConnectivityIndex()->deepCopy());
ret->setConnectivity(c,ci);
return ret.retn();
}
MEDCouplingPointSet::checkConsistencyLight();
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=_types.begin();iter!=_types.end();iter++)
{
- if((int)INTERP_KERNEL::CellModel::GetCellModel(*iter).getDimension()!=_mesh_dim)
+ if(ToIdType(INTERP_KERNEL::CellModel::GetCellModel(*iter).getDimension())!=_mesh_dim)
{
std::ostringstream message;
message << "Mesh invalid because dimension is " << _mesh_dim << " and there is presence of cell(s) with type " << (*iter);
if(_mesh_dim==-1)
return ;
int meshDim=getMeshDimension();
- int nbOfNodes=getNumberOfNodes();
- int nbOfCells=getNumberOfCells();
- const int *ptr=_nodal_connec->getConstPointer();
- const int *ptrI=_nodal_connec_index->getConstPointer();
- for(int i=0;i<nbOfCells;i++)
+ mcIdType nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfCells=getNumberOfCells();
+ const mcIdType *ptr=_nodal_connec->getConstPointer();
+ const mcIdType *ptrI=_nodal_connec_index->getConstPointer();
+ for(mcIdType i=0;i<nbOfCells;i++)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)ptr[ptrI[i]]);
- if((int)cm.getDimension()!=meshDim)
+ if(ToIdType(cm.getDimension())!=meshDim)
{
std::ostringstream oss;
oss << "MEDCouplingUMesh::checkConsistency : cell << #" << i<< " with type Type " << cm.getRepr() << " in 'this' whereas meshdim == " << meshDim << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int nbOfNodesInCell=ptrI[i+1]-ptrI[i]-1;
+ mcIdType nbOfNodesInCell=ptrI[i+1]-ptrI[i]-1;
if(!cm.isDynamic())
- if(nbOfNodesInCell!=(int)cm.getNumberOfNodes())
+ if(nbOfNodesInCell!=ToIdType(cm.getNumberOfNodes()))
{
std::ostringstream oss;
oss << "MEDCouplingUMesh::checkConsistency : cell #" << i << " with static Type '" << cm.getRepr() << "' has " << cm.getNumberOfNodes();
oss << " nodes. This should be even, and greater or equal than 4!! Looks very bad!";
throw INTERP_KERNEL::Exception(oss.str());
}
- for(const int *w=ptr+ptrI[i]+1;w!=ptr+ptrI[i+1];w++)
+ for(const mcIdType *w=ptr+ptrI[i]+1;w!=ptr+ptrI[i+1];w++)
{
- int nodeId=*w;
+ mcIdType nodeId=*w;
if(nodeId>=0)
{
if(nodeId>=nbOfNodes)
* \ref medcouplingpyexamplesUmeshStdBuild1 "Here is a Python example".
* \endif
*/
-void MEDCouplingUMesh::allocateCells(int nbOfCells)
+void MEDCouplingUMesh::allocateCells(mcIdType nbOfCells)
{
if(nbOfCells<0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::allocateCells : the input number of cells should be >= 0 !");
{
_nodal_connec->decrRef();
}
- _nodal_connec_index=DataArrayInt::New();
+ _nodal_connec_index=DataArrayIdType::New();
_nodal_connec_index->reserve(nbOfCells+1);
_nodal_connec_index->pushBackSilent(0);
- _nodal_connec=DataArrayInt::New();
+ _nodal_connec=DataArrayIdType::New();
_nodal_connec->reserve(2*nbOfCells);
_types.clear();
declareAsNew();
* \ref medcouplingpyexamplesUmeshStdBuild1 "Here is a Python example".
* \endif
*/
-void MEDCouplingUMesh::insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, const int *nodalConnOfCell)
+void MEDCouplingUMesh::insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, const mcIdType *nodalConnOfCell)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(_nodal_connec_index==0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::insertNextCell : nodal connectivity not set ! invoke allocateCells before calling insertNextCell !");
- if((int)cm.getDimension()==_mesh_dim)
+ if(ToIdType(cm.getDimension())==_mesh_dim)
{
if(!cm.isDynamic())
- if(size!=(int)cm.getNumberOfNodes())
+ if(size!=ToIdType(cm.getNumberOfNodes()))
{
std::ostringstream oss; oss << "MEDCouplingUMesh::insertNextCell : Trying to push a " << cm.getRepr() << " cell with a size of " << size;
oss << " ! Expecting " << cm.getNumberOfNodes() << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int idx=_nodal_connec_index->back();
- int val=idx+size+1;
+ mcIdType idx=_nodal_connec_index->back();
+ mcIdType val=idx+size+1;
_nodal_connec_index->pushBackSilent(val);
_nodal_connec->writeOnPlace(idx,type,nodalConnOfCell,size);
_types.insert(type);
{
std::vector<INTERP_KERNEL::NormalizedCellType> ret;
checkConnectivityFullyDefined();
- int nbOfCells(getNumberOfCells());
+ mcIdType nbOfCells=getNumberOfCells();
if(nbOfCells==0)
return ret;
if(getNodalConnectivityArrayLen()<1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getAllGeoTypesSorted : the connectivity in this seems invalid !");
- const int *c(_nodal_connec->begin()),*ci(_nodal_connec_index->begin());
+ const mcIdType *c(_nodal_connec->begin()),*ci(_nodal_connec_index->begin());
ret.push_back((INTERP_KERNEL::NormalizedCellType)c[*ci++]);
- for(int i=1;i<nbOfCells;i++,ci++)
+ for(mcIdType i=1;i<nbOfCells;i++,ci++)
if(ret.back()!=((INTERP_KERNEL::NormalizedCellType)c[*ci]))
ret.push_back((INTERP_KERNEL::NormalizedCellType)c[*ci]);
return ret;
* \ref py_mcumesh_getReverseNodalConnectivity "Here is a Python example".
* \endif
*/
-void MEDCouplingUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const
+void MEDCouplingUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const
{
checkFullyDefined();
- int nbOfNodes(getNumberOfNodes());
- int *revNodalIndxPtr=(int *)malloc((nbOfNodes+1)*sizeof(int));
+ mcIdType nbOfNodes(getNumberOfNodes());
+ mcIdType *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType));
revNodalIndx->useArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1);
std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0);
- const int *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin());
- int nbOfCells(getNumberOfCells()),nbOfEltsInRevNodal(0);
- for(int eltId=0;eltId<nbOfCells;eltId++)
+ const mcIdType *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin());
+ mcIdType nbOfCells(getNumberOfCells()),nbOfEltsInRevNodal(0);
+ for(mcIdType eltId=0;eltId<nbOfCells;eltId++)
{
- const int *strtNdlConnOfCurCell(conn+connIndex[eltId]+1),*endNdlConnOfCurCell(conn+connIndex[eltId+1]);
- for(const int *iter=strtNdlConnOfCurCell;iter!=endNdlConnOfCurCell;iter++)
+ const mcIdType *strtNdlConnOfCurCell(conn+connIndex[eltId]+1),*endNdlConnOfCurCell(conn+connIndex[eltId+1]);
+ for(const mcIdType *iter=strtNdlConnOfCurCell;iter!=endNdlConnOfCurCell;iter++)
if(*iter>=0)//for polyhedrons
{
nbOfEltsInRevNodal++;
revNodalIndxPtr[(*iter)+1]++;
}
}
- std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus<int>());
- int *revNodalPtr=(int *)malloc((nbOfEltsInRevNodal)*sizeof(int));
+ std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus<mcIdType>());
+ mcIdType *revNodalPtr=(mcIdType *)malloc(nbOfEltsInRevNodal*sizeof(mcIdType));
revNodal->useArray(revNodalPtr,true,DeallocType::C_DEALLOC,nbOfEltsInRevNodal,1);
std::fill(revNodalPtr,revNodalPtr+nbOfEltsInRevNodal,-1);
- for(int eltId=0;eltId<nbOfCells;eltId++)
+ for(mcIdType eltId=0;eltId<nbOfCells;eltId++)
{
- const int *strtNdlConnOfCurCell=conn+connIndex[eltId]+1;
- const int *endNdlConnOfCurCell=conn+connIndex[eltId+1];
- for(const int *iter=strtNdlConnOfCurCell;iter!=endNdlConnOfCurCell;iter++)
+ const mcIdType *strtNdlConnOfCurCell=conn+connIndex[eltId]+1;
+ const mcIdType *endNdlConnOfCurCell=conn+connIndex[eltId+1];
+ for(const mcIdType *iter=strtNdlConnOfCurCell;iter!=endNdlConnOfCurCell;iter++)
if(*iter>=0)//for polyhedrons
- *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind2nd(std::equal_to<int>(),-1))=eltId;
+ *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind2nd(std::equal_to<mcIdType>(),-1))=eltId;
}
}
* \endif
* \sa buildDescendingConnectivity2()
*/
-MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const
+MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const
{
return buildDescendingConnectivityGen<MinusOneSonsGenerator>(desc,descIndx,revDesc,revDescIndx,MEDCouplingFastNbrer);
}
* This method returns 4 arrays and a mesh as MEDCouplingUMesh::buildDescendingConnectivity does.
* \sa MEDCouplingUMesh::buildDescendingConnectivity
*/
-MEDCouplingUMesh *MEDCouplingUMesh::explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const
+MEDCouplingUMesh *MEDCouplingUMesh::explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const
{
checkFullyDefined();
if(getMeshDimension()!=3)
*
* \sa explode3DMeshTo1D, buildDescendingConnectiviy
*/
-MEDCouplingUMesh *MEDCouplingUMesh::explodeMeshIntoMicroEdges(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const
+MEDCouplingUMesh *MEDCouplingUMesh::explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const
{
checkFullyDefined();
switch(getMeshDimension())
* \endif
* \sa buildDescendingConnectivity()
*/
-MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const
+MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const
{
return buildDescendingConnectivityGen<MinusOneSonsGenerator>(desc,descIndx,revDesc,revDescIndx,MEDCouplingOrientationSensitiveNbrer);
}
* \param [out] neighborsIndx is an array of size this->getNumberOfCells()+1 newly allocated and should be
* dealt by the caller. This arrays allow to use the first output parameter \b neighbors (\ref numbering-indirect).
*/
-void MEDCouplingUMesh::computeNeighborsOfCells(DataArrayInt *&neighbors, DataArrayInt *&neighborsIndx) const
+void MEDCouplingUMesh::computeNeighborsOfCells(DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIndx) const
{
- MCAuto<DataArrayInt> desc=DataArrayInt::New();
- MCAuto<DataArrayInt> descIndx=DataArrayInt::New();
- MCAuto<DataArrayInt> revDesc=DataArrayInt::New();
- MCAuto<DataArrayInt> revDescIndx=DataArrayInt::New();
+ MCAuto<DataArrayIdType> desc=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> descIndx=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> revDesc=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> revDescIndx=DataArrayIdType::New();
MCAuto<MEDCouplingUMesh> meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
meshDM1=0;
ComputeNeighborsOfCellsAdv(desc,descIndx,revDesc,revDescIndx,neighbors,neighborsIndx);
}
-void MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne(const DataArrayInt *nodeNeigh, const DataArrayInt *nodeNeighI, MCAuto<DataArrayInt>& cellNeigh, MCAuto<DataArrayInt>& cellNeighIndex) const
+void MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI, MCAuto<DataArrayIdType>& cellNeigh, MCAuto<DataArrayIdType>& cellNeighIndex) const
{
if(!nodeNeigh || !nodeNeighI)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : null pointer !");
nodeNeigh->checkNbOfComps(1,"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : node neigh");
nodeNeighI->checkNbOfComps(1,"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : node neigh index");
nodeNeighI->checkNbOfTuples(1+getNumberOfNodes(),"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : invalid length");
- int nbCells(getNumberOfCells());
- const int *c(_nodal_connec->begin()),*ci(_nodal_connec_index->begin()),*ne(nodeNeigh->begin()),*nei(nodeNeighI->begin());
- cellNeigh=DataArrayInt::New(); cellNeigh->alloc(0,1); cellNeighIndex=DataArrayInt::New(); cellNeighIndex->alloc(1,1); cellNeighIndex->setIJ(0,0,0);
- for(int i=0;i<nbCells;i++)
+ mcIdType nbCells=getNumberOfCells();
+ const mcIdType *c(_nodal_connec->begin()),*ci(_nodal_connec_index->begin()),*ne(nodeNeigh->begin()),*nei(nodeNeighI->begin());
+ cellNeigh=DataArrayIdType::New(); cellNeigh->alloc(0,1); cellNeighIndex=DataArrayIdType::New(); cellNeighIndex->alloc(1,1); cellNeighIndex->setIJ(0,0,0);
+ for(mcIdType i=0;i<nbCells;i++)
{
- std::set<int> s;
- for(const int *it=c+ci[i]+1;it!=c+ci[i+1];it++)
+ std::set<mcIdType> s;
+ for(const mcIdType *it=c+ci[i]+1;it!=c+ci[i+1];it++)
if(*it>=0)
s.insert(ne+nei[*it],ne+nei[*it+1]);
s.erase(i);
* parameter allows to select the right part in this array. The number of tuples is equal to the last values in \b neighborsIndx.
* \param [out] neighborsIndx is an array of size this->getNumberOfCells()+1 newly allocated and should be dealt by the caller. This arrays allow to use the first output parameter \b neighbors.
*/
-void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descIndx, const DataArrayInt *revDesc, const DataArrayInt *revDescIndx,
- DataArrayInt *&neighbors, DataArrayInt *&neighborsIndx)
+void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descIndx, const DataArrayIdType *revDesc, const DataArrayIdType *revDescIndx,
+ DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIndx)
{
if(!desc || !descIndx || !revDesc || !revDescIndx)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeNeighborsOfCellsAdv some input array is empty !");
- const int *descPtr=desc->begin();
- const int *descIPtr=descIndx->begin();
- const int *revDescPtr=revDesc->begin();
- const int *revDescIPtr=revDescIndx->begin();
+ const mcIdType *descPtr=desc->begin();
+ const mcIdType *descIPtr=descIndx->begin();
+ const mcIdType *revDescPtr=revDesc->begin();
+ const mcIdType *revDescIPtr=revDescIndx->begin();
//
- int nbCells=descIndx->getNumberOfTuples()-1;
- MCAuto<DataArrayInt> out0=DataArrayInt::New();
- MCAuto<DataArrayInt> out1=DataArrayInt::New(); out1->alloc(nbCells+1,1);
- int *out1Ptr=out1->getPointer();
+ mcIdType nbCells=descIndx->getNumberOfTuples()-1;
+ MCAuto<DataArrayIdType> out0=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> out1=DataArrayIdType::New(); out1->alloc(nbCells+1,1);
+ mcIdType *out1Ptr=out1->getPointer();
*out1Ptr++=0;
out0->reserve(desc->getNumberOfTuples());
- for(int i=0;i<nbCells;i++,descIPtr++,out1Ptr++)
+ for(mcIdType i=0;i<nbCells;i++,descIPtr++,out1Ptr++)
{
- for(const int *w1=descPtr+descIPtr[0];w1!=descPtr+descIPtr[1];w1++)
+ for(const mcIdType *w1=descPtr+descIPtr[0];w1!=descPtr+descIPtr[1];w1++)
{
- std::set<int> s(revDescPtr+revDescIPtr[*w1],revDescPtr+revDescIPtr[(*w1)+1]);
+ std::set<mcIdType> s(revDescPtr+revDescIPtr[*w1],revDescPtr+revDescIPtr[(*w1)+1]);
s.erase(i);
out0->insertAtTheEnd(s.begin(),s.end());
}
/*!
* Explodes \a this into edges whatever its dimension.
*/
-MCAuto<MEDCouplingUMesh> MEDCouplingUMesh::explodeIntoEdges(MCAuto<DataArrayInt>& desc, MCAuto<DataArrayInt>& descIndex, MCAuto<DataArrayInt>& revDesc, MCAuto<DataArrayInt>& revDescIndx) const
+MCAuto<MEDCouplingUMesh> MEDCouplingUMesh::explodeIntoEdges(MCAuto<DataArrayIdType>& desc, MCAuto<DataArrayIdType>& descIndex, MCAuto<DataArrayIdType>& revDesc, MCAuto<DataArrayIdType>& revDescIndx) const
{
checkFullyDefined();
int mdim(getMeshDimension());
- desc=DataArrayInt::New(); descIndex=DataArrayInt::New(); revDesc=DataArrayInt::New(); revDescIndx=DataArrayInt::New();
+ desc=DataArrayIdType::New(); descIndex=DataArrayIdType::New(); revDesc=DataArrayIdType::New(); revDescIndx=DataArrayIdType::New();
MCAuto<MEDCouplingUMesh> mesh1D;
switch(mdim)
{
*
* \sa MEDCouplingUMesh::computeEnlargedNeighborsOfNodes
*/
-void MEDCouplingUMesh::computeNeighborsOfNodes(DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) const
+void MEDCouplingUMesh::computeNeighborsOfNodes(DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIdx) const
{
checkFullyDefined();
- int mdim(getMeshDimension()),nbNodes(getNumberOfNodes());
- MCAuto<DataArrayInt> desc(DataArrayInt::New()),descIndx(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescIndx(DataArrayInt::New());
+ mcIdType mdim(getMeshDimension()),nbNodes(getNumberOfNodes());
+ MCAuto<DataArrayIdType> desc(DataArrayIdType::New()),descIndx(DataArrayIdType::New()),revDesc(DataArrayIdType::New()),revDescIndx(DataArrayIdType::New());
MCConstAuto<MEDCouplingUMesh> mesh1D;
switch(mdim)
{
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computeNeighborsOfNodes : Mesh dimension supported are [3,2,1] !");
}
}
- desc=DataArrayInt::New(); descIndx=DataArrayInt::New(); revDesc=0; revDescIndx=0;
+ desc=DataArrayIdType::New(); descIndx=DataArrayIdType::New(); revDesc=0; revDescIndx=0;
mesh1D->getReverseNodalConnectivity(desc,descIndx);
- MCAuto<DataArrayInt> ret0(DataArrayInt::New());
+ MCAuto<DataArrayIdType> ret0(DataArrayIdType::New());
ret0->alloc(desc->getNumberOfTuples(),1);
- int *r0Pt(ret0->getPointer());
- const int *c1DPtr(mesh1D->getNodalConnectivity()->begin()),*rn(desc->begin()),*rni(descIndx->begin());
- for(int i=0;i<nbNodes;i++,rni++)
+ mcIdType *r0Pt(ret0->getPointer());
+ const mcIdType *c1DPtr(mesh1D->getNodalConnectivity()->begin()),*rn(desc->begin()),*rni(descIndx->begin());
+ for(mcIdType i=0;i<nbNodes;i++,rni++)
{
- for(const int *oneDCellIt=rn+rni[0];oneDCellIt!=rn+rni[1];oneDCellIt++)
+ for(const mcIdType *oneDCellIt=rn+rni[0];oneDCellIt!=rn+rni[1];oneDCellIt++)
*r0Pt++=c1DPtr[3*(*oneDCellIt)+1]==i?c1DPtr[3*(*oneDCellIt)+2]:c1DPtr[3*(*oneDCellIt)+1];
}
neighbors=ret0.retn();
*
* \sa MEDCouplingUMesh::computeNeighborsOfNodes
*/
-void MEDCouplingUMesh::computeEnlargedNeighborsOfNodes(MCAuto<DataArrayInt> &neighbors, MCAuto<DataArrayInt>& neighborsIdx) const
+void MEDCouplingUMesh::computeEnlargedNeighborsOfNodes(MCAuto<DataArrayIdType> &neighbors, MCAuto<DataArrayIdType>& neighborsIdx) const
{
checkFullyDefined();
- int nbOfNodes(getNumberOfNodes());
- const int *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin());
- int nbOfCells(getNumberOfCells());
- std::vector< std::set<int> > st0(nbOfNodes);
- for(int eltId=0;eltId<nbOfCells;eltId++)
- {
- const int *strtNdlConnOfCurCell(conn+connIndex[eltId]+1),*endNdlConnOfCurCell(conn+connIndex[eltId+1]);
- std::set<int> s(strtNdlConnOfCurCell,endNdlConnOfCurCell); s.erase(-1); //for polyhedrons
- for(std::set<int>::const_iterator iter2=s.begin();iter2!=s.end();iter2++)
+ mcIdType nbOfNodes(getNumberOfNodes());
+ const mcIdType *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin());
+ mcIdType nbOfCells=getNumberOfCells();
+ std::vector< std::set<mcIdType> > st0(nbOfNodes);
+ for(mcIdType eltId=0;eltId<nbOfCells;eltId++)
+ {
+ const mcIdType *strtNdlConnOfCurCell(conn+connIndex[eltId]+1),*endNdlConnOfCurCell(conn+connIndex[eltId+1]);
+ std::set<mcIdType> s(strtNdlConnOfCurCell,endNdlConnOfCurCell); s.erase(-1); //for polyhedrons
+ for(std::set<mcIdType>::const_iterator iter2=s.begin();iter2!=s.end();iter2++)
st0[*iter2].insert(s.begin(),s.end());
}
- neighborsIdx=DataArrayInt::New(); neighborsIdx->alloc(nbOfNodes+1,1); neighborsIdx->setIJ(0,0,0);
+ neighborsIdx=DataArrayIdType::New(); neighborsIdx->alloc(nbOfNodes+1,1); neighborsIdx->setIJ(0,0,0);
{
- int *neighIdx(neighborsIdx->getPointer());
- for(std::vector< std::set<int> >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++)
+ mcIdType *neighIdx(neighborsIdx->getPointer());
+ for(std::vector< std::set<mcIdType> >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++)
{
if ((*it).empty())
neighIdx[1]=neighIdx[0];
else
- neighIdx[1]=neighIdx[0]+(*it).size()-1;
+ neighIdx[1]=neighIdx[0]+ToIdType((*it).size())-1;
}
}
- neighbors=DataArrayInt::New(); neighbors->alloc(neighborsIdx->back(),1);
+ neighbors=DataArrayIdType::New(); neighbors->alloc(neighborsIdx->back(),1);
{
- const int *neighIdx(neighborsIdx->begin());
- int *neigh(neighbors->getPointer()),nodeId(0);
- for(std::vector< std::set<int> >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++,nodeId++)
+ const mcIdType *neighIdx(neighborsIdx->begin());
+ mcIdType *neigh(neighbors->getPointer()),nodeId(0);
+ for(std::vector< std::set<mcIdType> >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++,nodeId++)
{
- std::set<int> s(*it); s.erase(nodeId);
+ std::set<mcIdType> s(*it); s.erase(nodeId);
std::copy(s.begin(),s.end(),neigh+*neighIdx);
}
}
* \ref py_mcumesh_convertToPolyTypes "Here is a Python example".
* \endif
*/
-void MEDCouplingUMesh::convertToPolyTypes(const int *cellIdsToConvertBg, const int *cellIdsToConvertEnd)
+void MEDCouplingUMesh::convertToPolyTypes(const mcIdType *cellIdsToConvertBg, const mcIdType *cellIdsToConvertEnd)
{
checkFullyDefined();
int dim=getMeshDimension();
if(dim<2 || dim>3)
throw INTERP_KERNEL::Exception("Invalid mesh dimension : must be 2 or 3 !");
- int nbOfCells(getNumberOfCells());
+ mcIdType nbOfCells=getNumberOfCells();
if(dim==2)
{
- const int *connIndex=_nodal_connec_index->begin();
- int *conn=_nodal_connec->getPointer();
- for(const int *iter=cellIdsToConvertBg;iter!=cellIdsToConvertEnd;iter++)
+ const mcIdType *connIndex=_nodal_connec_index->begin();
+ mcIdType *conn=_nodal_connec->getPointer();
+ for(const mcIdType *iter=cellIdsToConvertBg;iter!=cellIdsToConvertEnd;iter++)
{
if(*iter>=0 && *iter<nbOfCells)
{
}
else
{
- int *connIndex(_nodal_connec_index->getPointer());
- const int *connOld(_nodal_connec->getConstPointer());
- MCAuto<DataArrayInt> connNew(DataArrayInt::New()),connNewI(DataArrayInt::New()); connNew->alloc(0,1); connNewI->alloc(1,1); connNewI->setIJ(0,0,0);
+ mcIdType *connIndex(_nodal_connec_index->getPointer());
+ const mcIdType *connOld(_nodal_connec->getConstPointer());
+ MCAuto<DataArrayIdType> connNew(DataArrayIdType::New()),connNewI(DataArrayIdType::New()); connNew->alloc(0,1); connNewI->alloc(1,1); connNewI->setIJ(0,0,0);
std::vector<bool> toBeDone(nbOfCells,false);
- for(const int *iter=cellIdsToConvertBg;iter!=cellIdsToConvertEnd;iter++)
+ for(const mcIdType *iter=cellIdsToConvertBg;iter!=cellIdsToConvertEnd;iter++)
{
if(*iter>=0 && *iter<nbOfCells)
toBeDone[*iter]=true;
throw INTERP_KERNEL::Exception(oss.str());
}
}
- for(int cellId=0;cellId<nbOfCells;cellId++)
+ for(mcIdType cellId=0;cellId<nbOfCells;cellId++)
{
- int pos(connIndex[cellId]),posP1(connIndex[cellId+1]);
- int lgthOld(posP1-pos-1);
+ mcIdType pos(connIndex[cellId]),posP1(connIndex[cellId+1]);
+ mcIdType lgthOld(posP1-pos-1);
if(toBeDone[cellId])
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)connOld[pos]);
unsigned nbOfFaces(cm.getNumberOfSons2(connOld+pos+1,lgthOld));
- int *tmp(new int[nbOfFaces*lgthOld+1]);
- int *work=tmp; *work++=INTERP_KERNEL::NORM_POLYHED;
+ mcIdType *tmp(new mcIdType[nbOfFaces*lgthOld+1]);
+ mcIdType *work=tmp; *work++=INTERP_KERNEL::NORM_POLYHED;
for(unsigned j=0;j<nbOfFaces;j++)
{
INTERP_KERNEL::NormalizedCellType type;
}
std::size_t newLgth(std::distance(tmp,work)-1);//-1 for last -1
connNew->pushBackValsSilent(tmp,tmp+newLgth);
- connNewI->pushBackSilent(connNewI->back()+(int)newLgth);
+ connNewI->pushBackSilent(connNewI->back()+ToIdType(newLgth));
delete [] tmp;
}
else
*/
void MEDCouplingUMesh::convertAllToPoly()
{
- int nbOfCells=getNumberOfCells();
- std::vector<int> cellIds(nbOfCells);
- for(int i=0;i<nbOfCells;i++)
+ mcIdType nbOfCells=getNumberOfCells();
+ std::vector<mcIdType> cellIds(nbOfCells);
+ for(mcIdType i=0;i<nbOfCells;i++)
cellIds[i]=i;
- convertToPolyTypes(&cellIds[0],&cellIds[0]+cellIds.size());
+ convertToPolyTypes(&cellIds[0],&cellIds[0]+ToIdType(cellIds.size()));
}
/*!
checkFullyDefined();
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertExtrudedPolyhedra works on umeshes with meshdim equal to 3 and spaceDim equal to 3 too!");
- int nbOfCells=getNumberOfCells();
- MCAuto<DataArrayInt> newCi=DataArrayInt::New();
+ mcIdType nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> newCi=DataArrayIdType::New();
newCi->alloc(nbOfCells+1,1);
- int *newci=newCi->getPointer();
- const int *ci=_nodal_connec_index->getConstPointer();
- const int *c=_nodal_connec->getConstPointer();
+ mcIdType *newci=newCi->getPointer();
+ const mcIdType *ci=_nodal_connec_index->getConstPointer();
+ const mcIdType *c=_nodal_connec->getConstPointer();
newci[0]=0;
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)c[ci[i]];
if(type==INTERP_KERNEL::NORM_POLYHED)
std::ostringstream oss; oss << "MEDCouplingUMesh::convertExtrudedPolyhedra : cell # " << i << " is a polhedron with 1 face but there is a mismatch of number of nodes in face should be even !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int n1=(int)(n2/2);
+ mcIdType n1=ToIdType(n2/2);
newci[i+1]=7*n1+2+newci[i];//6*n1 (nodal length) + n1+2 (number of faces) - 1 (number of '-1' separator is equal to number of faces -1) + 1 (for cell type)
}
else
newci[i+1]=(ci[i+1]-ci[i])+newci[i];
}
- MCAuto<DataArrayInt> newC=DataArrayInt::New();
+ MCAuto<DataArrayIdType> newC=DataArrayIdType::New();
newC->alloc(newci[nbOfCells],1);
- int *newc=newC->getPointer();
- for(int i=0;i<nbOfCells;i++)
+ mcIdType *newc=newC->getPointer();
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)c[ci[i]];
if(type==INTERP_KERNEL::NORM_POLYHED)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::unPolyze works on umeshes with meshdim equals to 0, 1 2 or 3 !");
if(mdim<=1)
return false;
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(nbOfCells<1)
return false;
- int initMeshLgth=getNodalConnectivityArrayLen();
- int *conn=_nodal_connec->getPointer();
- int *index=_nodal_connec_index->getPointer();
- int posOfCurCell=0;
- int newPos=0;
- int lgthOfCurCell;
+ mcIdType initMeshLgth=getNodalConnectivityArrayLen();
+ mcIdType *conn=_nodal_connec->getPointer();
+ mcIdType *index=_nodal_connec_index->getPointer();
+ mcIdType posOfCurCell=0;
+ mcIdType newPos=0;
+ mcIdType lgthOfCurCell;
bool ret=false;
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
lgthOfCurCell=index[i+1]-posOfCurCell;
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[posOfCurCell];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
INTERP_KERNEL::NormalizedCellType newType=INTERP_KERNEL::NORM_ERROR;
- int newLgth;
+ mcIdType newLgth;
if(cm.isDynamic())
{
switch(cm.getDimension())
{
case 2:
{
- INTERP_KERNEL::AutoPtr<int> tmp=new int[lgthOfCurCell-1];
- std::copy(conn+posOfCurCell+1,conn+posOfCurCell+lgthOfCurCell,(int *)tmp);
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=new mcIdType[lgthOfCurCell-1];
+ std::copy(conn+posOfCurCell+1,conn+posOfCurCell+lgthOfCurCell,(mcIdType *)tmp);
newType=INTERP_KERNEL::CellSimplify::tryToUnPoly2D(cm.isQuadratic(),tmp,lgthOfCurCell-1,conn+newPos+1,newLgth);
break;
}
case 3:
{
- int nbOfFaces,lgthOfPolyhConn;
- INTERP_KERNEL::AutoPtr<int> zipFullReprOfPolyh=INTERP_KERNEL::CellSimplify::getFullPolyh3DCell(type,conn+posOfCurCell+1,lgthOfCurCell-1,nbOfFaces,lgthOfPolyhConn);
+ mcIdType nbOfFaces,lgthOfPolyhConn;
+ INTERP_KERNEL::AutoPtr<mcIdType> zipFullReprOfPolyh=INTERP_KERNEL::CellSimplify::getFullPolyh3DCell(type,conn+posOfCurCell+1,lgthOfCurCell-1,nbOfFaces,lgthOfPolyhConn);
newType=INTERP_KERNEL::CellSimplify::tryToUnPoly3D(zipFullReprOfPolyh,nbOfFaces,lgthOfPolyhConn,conn+newPos+1,newLgth);
break;
}
MCAuto<DataArrayDouble> coords=getCoords()->deepCopy();
coords->recenterForMaxPrecision(eps);
//
- int nbOfCells=getNumberOfCells();
- const int *conn=_nodal_connec->getConstPointer();
- const int *index=_nodal_connec_index->getConstPointer();
- MCAuto<DataArrayInt> connINew=DataArrayInt::New();
+ mcIdType nbOfCells=getNumberOfCells();
+ const mcIdType *conn=_nodal_connec->getConstPointer();
+ const mcIdType *index=_nodal_connec_index->getConstPointer();
+ MCAuto<DataArrayIdType> connINew=DataArrayIdType::New();
connINew->alloc(nbOfCells+1,1);
- int *connINewPtr=connINew->getPointer(); *connINewPtr++=0;
- MCAuto<DataArrayInt> connNew=DataArrayInt::New(); connNew->alloc(0,1);
- MCAuto<DataArrayInt> E_Fi(DataArrayInt::New()), E_F(DataArrayInt::New()), F_Ei(DataArrayInt::New()), F_E(DataArrayInt::New());
+ mcIdType *connINewPtr=connINew->getPointer(); *connINewPtr++=0;
+ MCAuto<DataArrayIdType> connNew=DataArrayIdType::New(); connNew->alloc(0,1);
+ MCAuto<DataArrayIdType> E_Fi(DataArrayIdType::New()), E_F(DataArrayIdType::New()), F_Ei(DataArrayIdType::New()), F_E(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> m_faces(buildDescendingConnectivity(E_F, E_Fi, F_E, F_Ei));
bool changed=false;
- for(int i=0;i<nbOfCells;i++,connINewPtr++)
+ for(mcIdType i=0;i<nbOfCells;i++,connINewPtr++)
{
- if(conn[index[i]]==(int)INTERP_KERNEL::NORM_POLYHED)
+ if(conn[index[i]]==ToIdType(INTERP_KERNEL::NORM_POLYHED))
{
SimplifyPolyhedronCell(eps,coords, i,connNew, m_faces, E_Fi, E_F, F_Ei, F_E);
changed=true;
/*!
* This method returns all node ids used in the connectivity of \b this. The data array returned has to be dealt by the caller.
* The returned node ids are sorted ascendingly. This method is close to MEDCouplingUMesh::getNodeIdsInUse except
- * the format of the returned DataArrayInt instance.
+ * the format of the returned DataArrayIdType instance.
*
- * \return a newly allocated DataArrayInt sorted ascendingly of fetched node ids.
+ * \return a newly allocated DataArrayIdType sorted ascendingly of fetched node ids.
* \sa MEDCouplingUMesh::getNodeIdsInUse, areAllNodesFetched
*/
-DataArrayInt *MEDCouplingUMesh::computeFetchedNodeIds() const
+DataArrayIdType *MEDCouplingUMesh::computeFetchedNodeIds() const
{
checkConnectivityFullyDefined();
- const int *maxEltPt(std::max_element(_nodal_connec->begin(),_nodal_connec->end()));
- int maxElt(maxEltPt==_nodal_connec->end()?0:std::abs(*maxEltPt)+1);
+ const mcIdType *maxEltPt(std::max_element(_nodal_connec->begin(),_nodal_connec->end()));
+ mcIdType maxElt(maxEltPt==_nodal_connec->end()?0:std::abs(*maxEltPt)+1);
std::vector<bool> retS(maxElt,false);
computeNodeIdsAlg(retS);
- return DataArrayInt::BuildListOfSwitchedOn(retS);
+ return DataArrayIdType::BuildListOfSwitchedOn(retS);
}
/*!
*/
void MEDCouplingUMesh::computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const
{
- int nbOfNodes((int)nodeIdsInUse.size()),nbOfCells(getNumberOfCells());
- const int *connIndex(_nodal_connec_index->getConstPointer()),*conn(_nodal_connec->getConstPointer());
- for(int i=0;i<nbOfCells;i++)
- for(int j=connIndex[i]+1;j<connIndex[i+1];j++)
+ mcIdType nbOfNodes=ToIdType(nodeIdsInUse.size()),
+ nbOfCells=getNumberOfCells();
+ const mcIdType *connIndex(_nodal_connec_index->getConstPointer()),*conn(_nodal_connec->getConstPointer());
+ for(mcIdType i=0;i<nbOfCells;i++)
+ for(mcIdType j=connIndex[i]+1;j<connIndex[i+1];j++)
if(conn[j]>=0)
{
if(conn[j]<nbOfNodes)
struct MEDCouplingAccVisit
{
MEDCouplingAccVisit():_new_nb_of_nodes(0) { }
- int operator()(int val) { if(val!=-1) return _new_nb_of_nodes++; else return -1; }
- int _new_nb_of_nodes;
+ mcIdType operator()(mcIdType val) { if(val!=-1) return _new_nb_of_nodes++; else return -1; }
+ mcIdType _new_nb_of_nodes;
};
/// @endcond
* by excluding the unused nodes, for which the array holds -1. The result array is
* a mapping in "Old to New" mode.
* \param [out] nbrOfNodesInUse - number of node ids present in the nodal connectivity.
- * \return DataArrayInt * - a new instance of DataArrayInt. Its length is \a
+ * \return DataArrayIdType * - a new instance of DataArrayIdType. Its length is \a
* this->getNumberOfNodes(). It holds for each node of \a this mesh either -1
* if the node is unused or a new id else. The caller is to delete this
* array using decrRef() as it is no more needed.
* \endif
* \sa computeFetchedNodeIds, computeNodeIdsAlg()
*/
-DataArrayInt *MEDCouplingUMesh::getNodeIdsInUse(int& nbrOfNodesInUse) const
+DataArrayIdType *MEDCouplingUMesh::getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const
{
nbrOfNodesInUse=-1;
- int nbOfNodes(getNumberOfNodes());
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ mcIdType nbOfNodes(getNumberOfNodes());
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfNodes,1);
- int *traducer=ret->getPointer();
+ mcIdType *traducer=ret->getPointer();
std::fill(traducer,traducer+nbOfNodes,-1);
- int nbOfCells=getNumberOfCells();
- const int *connIndex=_nodal_connec_index->getConstPointer();
- const int *conn=_nodal_connec->getConstPointer();
- for(int i=0;i<nbOfCells;i++)
- for(int j=connIndex[i]+1;j<connIndex[i+1];j++)
+ mcIdType nbOfCells=getNumberOfCells();
+ const mcIdType *connIndex=_nodal_connec_index->getConstPointer();
+ const mcIdType *conn=_nodal_connec->getConstPointer();
+ for(mcIdType i=0;i<nbOfCells;i++)
+ for(mcIdType j=connIndex[i]+1;j<connIndex[i+1];j++)
if(conn[j]>=0)
{
if(conn[j]<nbOfNodes)
throw INTERP_KERNEL::Exception(oss.str());
}
}
- nbrOfNodesInUse=(int)std::count(traducer,traducer+nbOfNodes,1);
+ nbrOfNodesInUse=ToIdType(std::count(traducer,traducer+nbOfNodes,1));
std::transform(traducer,traducer+nbOfNodes,traducer,MEDCouplingAccVisit());
return ret.retn();
}
* \return a newly allocated array
* \sa MEDCouplingUMesh::computeEffectiveNbOfNodesPerCell
*/
-DataArrayInt *MEDCouplingUMesh::computeNbOfNodesPerCell() const
+DataArrayIdType *MEDCouplingUMesh::computeNbOfNodesPerCell() const
{
checkConnectivityFullyDefined();
- int nbOfCells=getNumberOfCells();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ mcIdType nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
- int *retPtr=ret->getPointer();
- const int *conn=getNodalConnectivity()->getConstPointer();
- const int *connI=getNodalConnectivityIndex()->getConstPointer();
- for(int i=0;i<nbOfCells;i++,retPtr++)
+ mcIdType *retPtr=ret->getPointer();
+ const mcIdType *conn=getNodalConnectivity()->getConstPointer();
+ const mcIdType *connI=getNodalConnectivityIndex()->getConstPointer();
+ for(mcIdType i=0;i<nbOfCells;i++,retPtr++)
{
- if(conn[connI[i]]!=(int)INTERP_KERNEL::NORM_POLYHED)
+ if(conn[connI[i]]!=ToIdType(INTERP_KERNEL::NORM_POLYHED))
*retPtr=connI[i+1]-connI[i]-1;
else
- *retPtr=connI[i+1]-connI[i]-1-std::count(conn+connI[i]+1,conn+connI[i+1],-1);
+ *retPtr=connI[i+1]-connI[i]-1-ToIdType(std::count(conn+connI[i]+1,conn+connI[i+1],-1));
}
return ret.retn();
}
* This method computes effective number of nodes per cell. That is to say nodes appearing several times in nodal connectivity of a cell,
* will be counted only once here whereas it will be counted several times in MEDCouplingUMesh::computeNbOfNodesPerCell method.
*
- * \return DataArrayInt * - new object to be deallocated by the caller.
+ * \return DataArrayIdType * - new object to be deallocated by the caller.
* \sa MEDCouplingUMesh::computeNbOfNodesPerCell
*/
-DataArrayInt *MEDCouplingUMesh::computeEffectiveNbOfNodesPerCell() const
+DataArrayIdType *MEDCouplingUMesh::computeEffectiveNbOfNodesPerCell() const
{
checkConnectivityFullyDefined();
- int nbOfCells=getNumberOfCells();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ mcIdType nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
- int *retPtr=ret->getPointer();
- const int *conn=getNodalConnectivity()->getConstPointer();
- const int *connI=getNodalConnectivityIndex()->getConstPointer();
- for(int i=0;i<nbOfCells;i++,retPtr++)
- {
- std::set<int> s(conn+connI[i]+1,conn+connI[i+1]);
- if(conn[connI[i]]!=(int)INTERP_KERNEL::NORM_POLYHED)
- *retPtr=(int)s.size();
+ mcIdType *retPtr=ret->getPointer();
+ const mcIdType *conn=getNodalConnectivity()->getConstPointer();
+ const mcIdType *connI=getNodalConnectivityIndex()->getConstPointer();
+ for(mcIdType i=0;i<nbOfCells;i++,retPtr++)
+ {
+ std::set<mcIdType> s(conn+connI[i]+1,conn+connI[i+1]);
+ if(conn[connI[i]]!=ToIdType(INTERP_KERNEL::NORM_POLYHED))
+ *retPtr=ToIdType(s.size());
else
{
s.erase(-1);
- *retPtr=(int)s.size();
+ *retPtr=ToIdType(s.size());
}
}
return ret.retn();
*
* \return a newly allocated array
*/
-DataArrayInt *MEDCouplingUMesh::computeNbOfFacesPerCell() const
+DataArrayIdType *MEDCouplingUMesh::computeNbOfFacesPerCell() const
{
checkConnectivityFullyDefined();
- int nbOfCells=getNumberOfCells();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ mcIdType nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
- int *retPtr=ret->getPointer();
- const int *conn=getNodalConnectivity()->getConstPointer();
- const int *connI=getNodalConnectivityIndex()->getConstPointer();
- for(int i=0;i<nbOfCells;i++,retPtr++,connI++)
+ mcIdType *retPtr=ret->getPointer();
+ const mcIdType *conn=getNodalConnectivity()->getConstPointer();
+ const mcIdType *connI=getNodalConnectivityIndex()->getConstPointer();
+ for(mcIdType i=0;i<nbOfCells;i++,retPtr++,connI++)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[*connI]);
*retPtr=cm.getNumberOfSons2(conn+connI[0]+1,connI[1]-connI[0]-1);
* Removes unused nodes (the node coordinates array is shorten) and returns an array
* mapping between new and old node ids in "Old to New" mode. -1 values in the returned
* array mean that the corresponding old node is no more used.
- * \return DataArrayInt * - a new instance of DataArrayInt of length \a
+ * \return DataArrayIdType * - a new instance of DataArrayIdType of length \a
* this->getNumberOfNodes() before call of this method. The caller is to
* delete this array using decrRef() as it is no more needed.
* \throw If the coordinates array is not set.
* \ref py_mcumesh_zipCoordsTraducer "Here is a Python example".
* \endif
*/
-DataArrayInt *MEDCouplingUMesh::zipCoordsTraducer()
+DataArrayIdType *MEDCouplingUMesh::zipCoordsTraducer()
{
return MEDCouplingPointSet::zipCoordsTraducer();
}
* This method stands if 'cell1' and 'cell2' are equals regarding 'compType' policy.
* The semantic of 'compType' is specified in MEDCouplingPointSet::zipConnectivityTraducer method.
*/
-int MEDCouplingUMesh::AreCellsEqual(const int *conn, const int *connI, int cell1, int cell2, int compType)
+int MEDCouplingUMesh::AreCellsEqual(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2, int compType)
{
switch(compType)
{
/*!
* This method is the last step of the MEDCouplingPointSet::zipConnectivityTraducer with policy 0.
*/
-int MEDCouplingUMesh::AreCellsEqualPolicy0(const int *conn, const int *connI, int cell1, int cell2)
+int MEDCouplingUMesh::AreCellsEqualPolicy0(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2)
{
if(connI[cell1+1]-connI[cell1]==connI[cell2+1]-connI[cell2])
return std::equal(conn+connI[cell1]+1,conn+connI[cell1+1],conn+connI[cell2]+1)?1:0;
/*!
* This method is the last step of the MEDCouplingPointSet::zipConnectivityTraducer with policy 1.
*/
-int MEDCouplingUMesh::AreCellsEqualPolicy1(const int *conn, const int *connI, int cell1, int cell2)
+int MEDCouplingUMesh::AreCellsEqualPolicy1(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2)
{
- int sz=connI[cell1+1]-connI[cell1];
+ mcIdType sz=connI[cell1+1]-connI[cell1];
if(sz==connI[cell2+1]-connI[cell2])
{
if(conn[connI[cell1]]==conn[connI[cell2]])
{
if(dim!=1)
{
- int sz1=2*(sz-1);
- INTERP_KERNEL::AutoPtr<int> tmp=new int[sz1];
- int *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],(int *)tmp);
+ mcIdType sz1=2*(sz-1);
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=new mcIdType[sz1];
+ mcIdType *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],(mcIdType *)tmp);
std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],work);
- work=std::search((int *)tmp,(int *)tmp+sz1,conn+connI[cell2]+1,conn+connI[cell2+1]);
+ work=std::search((mcIdType *)tmp,(mcIdType *)tmp+sz1,conn+connI[cell2]+1,conn+connI[cell2+1]);
return work!=tmp+sz1?1:0;
}
else
/*!
* This method is the last step of the MEDCouplingPointSet::zipConnectivityTraducer with policy 2.
*/
-int MEDCouplingUMesh::AreCellsEqualPolicy2(const int *conn, const int *connI, int cell1, int cell2)
+int MEDCouplingUMesh::AreCellsEqualPolicy2(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2)
{
if(connI[cell1+1]-connI[cell1]==connI[cell2+1]-connI[cell2])
{
if(conn[connI[cell1]]==conn[connI[cell2]])
{
- std::set<int> s1(conn+connI[cell1]+1,conn+connI[cell1+1]);
- std::set<int> s2(conn+connI[cell2]+1,conn+connI[cell2+1]);
+ std::set<mcIdType> s1(conn+connI[cell1]+1,conn+connI[cell1+1]);
+ std::set<mcIdType> s2(conn+connI[cell2]+1,conn+connI[cell2+1]);
return s1==s2?1:0;
}
}
/*!
* This method is less restrictive than AreCellsEqualPolicy2. Here the geometric type is absolutely not taken into account !
*/
-int MEDCouplingUMesh::AreCellsEqualPolicy2NoType(const int *conn, const int *connI, int cell1, int cell2)
+int MEDCouplingUMesh::AreCellsEqualPolicy2NoType(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2)
{
if(connI[cell1+1]-connI[cell1]==connI[cell2+1]-connI[cell2])
{
- std::set<int> s1(conn+connI[cell1]+1,conn+connI[cell1+1]);
- std::set<int> s2(conn+connI[cell2]+1,conn+connI[cell2+1]);
+ std::set<mcIdType> s1(conn+connI[cell1]+1,conn+connI[cell1+1]);
+ std::set<mcIdType> s2(conn+connI[cell2]+1,conn+connI[cell2+1]);
return s1==s2?1:0;
}
return 0;
/*!
* This method is the last step of the MEDCouplingPointSet::zipConnectivityTraducer with policy 7.
*/
-int MEDCouplingUMesh::AreCellsEqualPolicy7(const int *conn, const int *connI, int cell1, int cell2)
+int MEDCouplingUMesh::AreCellsEqualPolicy7(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2)
{
- int sz=connI[cell1+1]-connI[cell1];
+ mcIdType sz=connI[cell1+1]-connI[cell1];
if(sz==connI[cell2+1]-connI[cell2])
{
if(conn[connI[cell1]]==conn[connI[cell2]])
{
if(dim!=1)
{
- int sz1=2*(sz-1);
- INTERP_KERNEL::AutoPtr<int> tmp=new int[sz1];
- int *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],(int *)tmp);
+ mcIdType sz1=2*(sz-1);
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=new mcIdType[sz1];
+ mcIdType *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],(mcIdType *)tmp);
std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],work);
- work=std::search((int *)tmp,(int *)tmp+sz1,conn+connI[cell2]+1,conn+connI[cell2+1]);
+ work=std::search((mcIdType *)tmp,(mcIdType *)tmp+sz1,conn+connI[cell2]+1,conn+connI[cell2+1]);
if(work!=tmp+sz1)
return 1;
else
{
- std::reverse_iterator<int *> it1((int *)tmp+sz1);
- std::reverse_iterator<int *> it2((int *)tmp);
+ std::reverse_iterator<mcIdType *> it1((mcIdType *)tmp+sz1);
+ std::reverse_iterator<mcIdType *> it2((mcIdType *)tmp);
if(std::search(it1,it2,conn+connI[cell2]+1,conn+connI[cell2+1])!=it2)
return 2;
else
return 1;
if(!cm.isQuadratic())
{
- std::reverse_iterator<const int *> it1(conn+connI[cell1+1]);
- std::reverse_iterator<const int *> it2(conn+connI[cell1]+1);
+ std::reverse_iterator<const mcIdType *> it1(conn+connI[cell1+1]);
+ std::reverse_iterator<const mcIdType *> it2(conn+connI[cell1]+1);
if(std::equal(it1,it2,conn+connI[cell2]+1))
return 2;
return 0;
* \return the correspondence array old to new in a newly allocated array.
*
*/
-void MEDCouplingUMesh::findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const
+void MEDCouplingUMesh::findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const
{
- MCAuto<DataArrayInt> revNodal=DataArrayInt::New(),revNodalI=DataArrayInt::New();
+ MCAuto<DataArrayIdType> revNodal=DataArrayIdType::New(),revNodalI=DataArrayIdType::New();
getReverseNodalConnectivity(revNodal,revNodalI);
FindCommonCellsAlg(compType,startCellId,_nodal_connec,_nodal_connec_index,revNodal,revNodalI,commonCellsArr,commonCellsIArr);
}
-void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI,
- DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr)
+void MEDCouplingUMesh::FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI,
+ DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr)
{
- MCAuto<DataArrayInt> commonCells=DataArrayInt::New(),commonCellsI=DataArrayInt::New(); commonCells->alloc(0,1);
- int nbOfCells=nodalI->getNumberOfTuples()-1;
+ MCAuto<DataArrayIdType> commonCells=DataArrayIdType::New(),commonCellsI=DataArrayIdType::New(); commonCells->alloc(0,1);
+ mcIdType nbOfCells=nodalI->getNumberOfTuples()-1;
commonCellsI->reserve(1); commonCellsI->pushBackSilent(0);
- const int *revNodalPtr=revNodal->getConstPointer(),*revNodalIPtr=revNodalI->getConstPointer();
- const int *connPtr=nodal->getConstPointer(),*connIPtr=nodalI->getConstPointer();
+ const mcIdType *revNodalPtr=revNodal->getConstPointer(),*revNodalIPtr=revNodalI->getConstPointer();
+ const mcIdType *connPtr=nodal->getConstPointer(),*connIPtr=nodalI->getConstPointer();
std::vector<bool> isFetched(nbOfCells,false);
if(startCellId==0)
{
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
if(!isFetched[i])
{
- const int *connOfNode=std::find_if(connPtr+connIPtr[i]+1,connPtr+connIPtr[i+1],std::bind2nd(std::not_equal_to<int>(),-1));
- std::vector<int> v,v2;
+ const mcIdType *connOfNode=std::find_if(connPtr+connIPtr[i]+1,connPtr+connIPtr[i+1],std::bind2nd(std::not_equal_to<mcIdType>(),-1));
+ std::vector<mcIdType> v,v2;
if(connOfNode!=connPtr+connIPtr[i+1])
{
- const int *locRevNodal=std::find(revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],i);
+ const mcIdType *locRevNodal=std::find(revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],i);
v2.insert(v2.end(),locRevNodal,revNodalPtr+revNodalIPtr[*connOfNode+1]);
connOfNode++;
}
if(*connOfNode>=0)
{
v=v2;
- const int *locRevNodal=std::find(revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],i);
- std::vector<int>::iterator it=std::set_intersection(v.begin(),v.end(),locRevNodal,revNodalPtr+revNodalIPtr[*connOfNode+1],v2.begin());
+ const mcIdType *locRevNodal=std::find(revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],i);
+ std::vector<mcIdType>::iterator it=std::set_intersection(v.begin(),v.end(),locRevNodal,revNodalPtr+revNodalIPtr[*connOfNode+1],v2.begin());
v2.resize(std::distance(v2.begin(),it));
}
if(v2.size()>1)
{
if(AreCellsEqualInPool(v2,compType,connPtr,connIPtr,commonCells))
{
- int pos=commonCellsI->back();
+ mcIdType pos=commonCellsI->back();
commonCellsI->pushBackSilent(commonCells->getNumberOfTuples());
- for(const int *it=commonCells->begin()+pos;it!=commonCells->end();it++)
+ for(const mcIdType *it=commonCells->begin()+pos;it!=commonCells->end();it++)
isFetched[*it]=true;
}
}
}
else
{
- for(int i=startCellId;i<nbOfCells;i++)
+ for(mcIdType i=startCellId;i<nbOfCells;i++)
{
if(!isFetched[i])
{
- const int *connOfNode=std::find_if(connPtr+connIPtr[i]+1,connPtr+connIPtr[i+1],std::bind2nd(std::not_equal_to<int>(),-1));
- std::vector<int> v,v2;
+ const mcIdType *connOfNode=std::find_if(connPtr+connIPtr[i]+1,connPtr+connIPtr[i+1],std::bind2nd(std::not_equal_to<mcIdType>(),-1));
+ std::vector<mcIdType> v,v2;
if(connOfNode!=connPtr+connIPtr[i+1])
{
v2.insert(v2.end(),revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1]);
if(*connOfNode>=0)
{
v=v2;
- std::vector<int>::iterator it=std::set_intersection(v.begin(),v.end(),revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],v2.begin());
+ std::vector<mcIdType>::iterator it=std::set_intersection(v.begin(),v.end(),revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],v2.begin());
v2.resize(std::distance(v2.begin(),it));
}
if(v2.size()>1)
{
if(AreCellsEqualInPool(v2,compType,connPtr,connIPtr,commonCells))
{
- int pos=commonCellsI->back();
+ mcIdType pos=commonCellsI->back();
commonCellsI->pushBackSilent(commonCells->getNumberOfTuples());
- for(const int *it=commonCells->begin()+pos;it!=commonCells->end();it++)
+ for(const mcIdType *it=commonCells->begin()+pos;it!=commonCells->end();it++)
isFetched[*it]=true;
}
}
* \param [in] other - the mesh to compare with.
* \param [in] compType - specifies a cell comparison technique. For meaning of its
* valid values [0,1,2], see zipConnectivityTraducer().
- * \param [out] arr - a new instance of DataArrayInt returning correspondence
+ * \param [out] arr - a new instance of DataArrayIdType returning correspondence
* between cells of the two meshes. It contains \a other->getNumberOfCells()
* values. The caller is to delete this array using
* decrRef() as it is no more needed.
* \sa checkDeepEquivalOnSameNodesWith()
* \sa checkGeoEquivalWith()
*/
-bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayInt *& arr) const
+bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayIdType *& arr) const
{
MCAuto<MEDCouplingUMesh> mesh=MergeUMeshesOnSameCoords(this,other);
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
static const int possibleCompType[]={0,1,2};
if(std::find(possibleCompType,possibleCompType+sizeof(possibleCompType)/sizeof(int),compType)==possibleCompType+sizeof(possibleCompType)/sizeof(int))
{
oss << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
- MCAuto<DataArrayInt> o2n=mesh->zipConnectivityTraducer(compType,nbOfCells);
+ MCAuto<DataArrayIdType> o2n=mesh->zipConnectivityTraducer(compType,nbOfCells);
arr=o2n->subArray(nbOfCells);
arr->setName(other->getName());
- int tmp;
+ mcIdType tmp;
if(other->getNumberOfCells()==0)
return true;
return arr->getMaxValue(tmp)<nbOfCells;
* \param arr is an output parameter that returns a \b newly created instance. This array is of size 'other->getNumberOfCells()'.
* \return If \a other is fully included in 'this 'true is returned. If not false is returned.
*/
-bool MEDCouplingUMesh::areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayInt *& arr) const
+bool MEDCouplingUMesh::areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayIdType *& arr) const
{
MCAuto<MEDCouplingUMesh> mesh=MergeUMeshesOnSameCoords(this,other);
- DataArrayInt *commonCells=0,*commonCellsI=0;
- int thisNbCells=getNumberOfCells();
+ DataArrayIdType *commonCells=0,*commonCellsI=0;
+ mcIdType thisNbCells=getNumberOfCells();
mesh->findCommonCells(7,thisNbCells,commonCells,commonCellsI);
- MCAuto<DataArrayInt> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
- const int *commonCellsPtr=commonCells->getConstPointer(),*commonCellsIPtr=commonCellsI->getConstPointer();
- int otherNbCells=other->getNumberOfCells();
- MCAuto<DataArrayInt> arr2=DataArrayInt::New();
+ MCAuto<DataArrayIdType> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
+ const mcIdType *commonCellsPtr=commonCells->getConstPointer(),*commonCellsIPtr=commonCellsI->getConstPointer();
+ mcIdType otherNbCells=other->getNumberOfCells();
+ MCAuto<DataArrayIdType> arr2=DataArrayIdType::New();
arr2->alloc(otherNbCells,1);
arr2->fillWithZero();
- int *arr2Ptr=arr2->getPointer();
- int nbOfCommon=commonCellsI->getNumberOfTuples()-1;
- for(int i=0;i<nbOfCommon;i++)
+ mcIdType *arr2Ptr=arr2->getPointer();
+ mcIdType nbOfCommon=commonCellsI->getNumberOfTuples()-1;
+ for(mcIdType i=0;i<nbOfCommon;i++)
{
- int start=commonCellsPtr[commonCellsIPtr[i]];
+ mcIdType start=commonCellsPtr[commonCellsIPtr[i]];
if(start<thisNbCells)
{
- for(int j=commonCellsIPtr[i]+1;j!=commonCellsIPtr[i+1];j++)
+ for(mcIdType j=commonCellsIPtr[i]+1;j!=commonCellsIPtr[i+1];j++)
{
- int sig=commonCellsPtr[j]>0?1:-1;
- int val=std::abs(commonCellsPtr[j])-1;
+ mcIdType sig=commonCellsPtr[j]>0?1:-1;
+ mcIdType val=std::abs(commonCellsPtr[j])-1;
if(val>=thisNbCells)
arr2Ptr[val-thisNbCells]=sig*(start+1);
}
* \warning This method modifies can generate an unstructured mesh whose cells are not sorted by geometric type order.
* In view of the MED file writing, a renumbering of cells of returned unstructured mesh (using MEDCouplingUMesh::sortCellsInMEDFileFrmt) should be necessary.
*/
-MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfSlice(int start, int end, int step, bool keepCoords) const
+MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, bool keepCoords) const
{
if(getMeshDimension()!=-1)
return static_cast<MEDCouplingUMesh *>(MEDCouplingPointSet::buildPartOfMySelfSlice(start,end,step,keepCoords));
else
{
- int newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfSlice for -1 dimension mesh ");
+ mcIdType newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfSlice for -1 dimension mesh ");
if(newNbOfCells!=1)
throw INTERP_KERNEL::Exception("-1D mesh has only one cell !");
if(start!=0)
* \ref py_mcumesh_buildPartOfMySelf "Here is a Python example".
* \endif
*/
-MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelf(const int *begin, const int *end, bool keepCoords) const
+MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelf(const mcIdType *begin, const mcIdType *end, bool keepCoords) const
{
if(getMeshDimension()!=-1)
return static_cast<MEDCouplingUMesh *>(MEDCouplingPointSet::buildPartOfMySelf(begin,end,keepCoords));
* \param [in] otherOnSameCoordsThanThis an another mesh with same meshdimension than \b this with exactly the same number of cells than cell ids list in [\b cellIdsBg, \b cellIdsEnd ).
* Coordinate pointer of \b this and those of \b otherOnSameCoordsThanThis must be the same
*/
-void MEDCouplingUMesh::setPartOfMySelf(const int *cellIdsBg, const int *cellIdsEnd, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
+void MEDCouplingUMesh::setPartOfMySelf(const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
{
checkConnectivityFullyDefined();
otherOnSameCoordsThanThis.checkConnectivityFullyDefined();
oss << ", whereas other mesh dimension is set equal to " << otherOnSameCoordsThanThis.getMeshDimension() << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
- std::size_t nbOfCellsToModify(std::distance(cellIdsBg,cellIdsEnd));
+ mcIdType nbOfCellsToModify( ToIdType((std::distance(cellIdsBg,cellIdsEnd))));
if(nbOfCellsToModify!=otherOnSameCoordsThanThis.getNumberOfCells())
{
std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelf : cells ids length (" << nbOfCellsToModify << ") do not match the number of cells of other mesh (" << otherOnSameCoordsThanThis.getNumberOfCells() << ") !";
throw INTERP_KERNEL::Exception(oss.str());
}
- std::size_t nbOfCells(getNumberOfCells());
+ mcIdType nbOfCells(getNumberOfCells());
bool easyAssign(true);
- const int *connI(_nodal_connec_index->begin());
- const int *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->begin();
- for(const int *it=cellIdsBg;it!=cellIdsEnd && easyAssign;it++,connIOther++)
+ const mcIdType *connI(_nodal_connec_index->begin());
+ const mcIdType *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->begin();
+ for(const mcIdType *it=cellIdsBg;it!=cellIdsEnd && easyAssign;it++,connIOther++)
{
- if(*it>=0 && *it<(int)nbOfCells)
+ if(*it>=0 && *it<nbOfCells)
{
easyAssign=(connIOther[1]-connIOther[0])==(connI[*it+1]-connI[*it]);
}
}
if(easyAssign)
{
- DataArrayInt::SetPartOfIndexedArraysSameIdx(cellIdsBg,cellIdsEnd,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index);
+ DataArrayIdType::SetPartOfIndexedArraysSameIdx(cellIdsBg,cellIdsEnd,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index);
computeTypes();
}
else
{
- DataArrayInt *arrOut=0,*arrIOut=0;
- DataArrayInt::SetPartOfIndexedArrays(cellIdsBg,cellIdsEnd,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index,
+ DataArrayIdType *arrOut=0,*arrIOut=0;
+ DataArrayIdType::SetPartOfIndexedArrays(cellIdsBg,cellIdsEnd,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index,
arrOut,arrIOut);
- MCAuto<DataArrayInt> arrOutAuto(arrOut),arrIOutAuto(arrIOut);
+ MCAuto<DataArrayIdType> arrOutAuto(arrOut),arrIOutAuto(arrIOut);
setConnectivity(arrOut,arrIOut,true);
}
}
-void MEDCouplingUMesh::setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
+void MEDCouplingUMesh::setPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
{
checkConnectivityFullyDefined();
otherOnSameCoordsThanThis.checkConnectivityFullyDefined();
oss << ", whereas other mesh dimension is set equal to " << otherOnSameCoordsThanThis.getMeshDimension() << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int nbOfCellsToModify=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::setPartOfMySelfSlice : ");
- if(nbOfCellsToModify!=(int)otherOnSameCoordsThanThis.getNumberOfCells())
+ mcIdType nbOfCellsToModify=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::setPartOfMySelfSlice : ");
+ if(nbOfCellsToModify!=otherOnSameCoordsThanThis.getNumberOfCells())
{
std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelfSlice : cells ids length (" << nbOfCellsToModify << ") do not match the number of cells of other mesh (" << otherOnSameCoordsThanThis.getNumberOfCells() << ") !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
bool easyAssign=true;
- const int *connI=_nodal_connec_index->getConstPointer();
- const int *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->getConstPointer();
- int it=start;
- for(int i=0;i<nbOfCellsToModify && easyAssign;i++,it+=step,connIOther++)
+ const mcIdType *connI=_nodal_connec_index->getConstPointer();
+ const mcIdType *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->getConstPointer();
+ mcIdType it=start;
+ for(mcIdType i=0;i<nbOfCellsToModify && easyAssign;i++,it+=step,connIOther++)
{
if(it>=0 && it<nbOfCells)
{
}
if(easyAssign)
{
- DataArrayInt::SetPartOfIndexedArraysSameIdxSlice(start,end,step,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index);
+ DataArrayIdType::SetPartOfIndexedArraysSameIdxSlice(start,end,step,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index);
computeTypes();
}
else
{
- DataArrayInt *arrOut=0,*arrIOut=0;
- DataArrayInt::SetPartOfIndexedArraysSlice(start,end,step,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index,
+ DataArrayIdType *arrOut=0,*arrIOut=0;
+ DataArrayIdType::SetPartOfIndexedArraysSlice(start,end,step,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index,
arrOut,arrIOut);
- MCAuto<DataArrayInt> arrOutAuto(arrOut),arrIOutAuto(arrIOut);
+ MCAuto<DataArrayIdType> arrOutAuto(arrOut),arrIOutAuto(arrIOut);
setConnectivity(arrOut,arrIOut,true);
}
}
* \ref py_mcumesh_buildFacePartOfMySelfNode "Here is a Python example".
* \endif
*/
-MEDCouplingUMesh *MEDCouplingUMesh::buildFacePartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const
+MEDCouplingUMesh *MEDCouplingUMesh::buildFacePartOfMySelfNode(const mcIdType *begin, const mcIdType *end, bool fullyIn) const
{
- MCAuto<DataArrayInt> desc,descIndx,revDesc,revDescIndx;
- desc=DataArrayInt::New(); descIndx=DataArrayInt::New(); revDesc=DataArrayInt::New(); revDescIndx=DataArrayInt::New();
+ MCAuto<DataArrayIdType> desc,descIndx,revDesc,revDescIndx;
+ desc=DataArrayIdType::New(); descIndx=DataArrayIdType::New(); revDesc=DataArrayIdType::New(); revDescIndx=DataArrayIdType::New();
MCAuto<MEDCouplingUMesh> subMesh=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
desc=0; descIndx=0; revDesc=0; revDescIndx=0;
return static_cast<MEDCouplingUMesh*>(subMesh->buildPartOfMySelfNode(begin,end,fullyIn));
*/
MEDCouplingUMesh *MEDCouplingUMesh::buildBoundaryMesh(bool keepCoords) const
{
- DataArrayInt *desc=DataArrayInt::New();
- DataArrayInt *descIndx=DataArrayInt::New();
- DataArrayInt *revDesc=DataArrayInt::New();
- DataArrayInt *revDescIndx=DataArrayInt::New();
+ DataArrayIdType *desc=DataArrayIdType::New();
+ DataArrayIdType *descIndx=DataArrayIdType::New();
+ DataArrayIdType *revDesc=DataArrayIdType::New();
+ DataArrayIdType *revDescIndx=DataArrayIdType::New();
//
MCAuto<MEDCouplingUMesh> meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
revDesc->decrRef();
desc->decrRef();
descIndx->decrRef();
- int nbOfCells=meshDM1->getNumberOfCells();
- const int *revDescIndxC=revDescIndx->getConstPointer();
- std::vector<int> boundaryCells;
- for(int i=0;i<nbOfCells;i++)
+ mcIdType nbOfCells=meshDM1->getNumberOfCells();
+ const mcIdType *revDescIndxC=revDescIndx->getConstPointer();
+ std::vector<mcIdType> boundaryCells;
+ for(mcIdType i=0;i<nbOfCells;i++)
if(revDescIndxC[i+1]-revDescIndxC[i]==1)
boundaryCells.push_back(i);
revDescIndx->decrRef();
}
/*!
- * This method returns a newly created DataArrayInt instance containing ids of cells located in boundary.
+ * This method returns a newly created DataArrayIdType instance containing ids of cells located in boundary.
* A cell is detected to be on boundary if it contains one or more than one face having only one father.
* This method makes the assumption that \a this is fully defined (coords,connectivity). If not an exception will be thrown.
*/
-DataArrayInt *MEDCouplingUMesh::findCellIdsOnBoundary() const
+DataArrayIdType *MEDCouplingUMesh::findCellIdsOnBoundary() const
{
checkFullyDefined();
- MCAuto<DataArrayInt> desc=DataArrayInt::New();
- MCAuto<DataArrayInt> descIndx=DataArrayInt::New();
- MCAuto<DataArrayInt> revDesc=DataArrayInt::New();
- MCAuto<DataArrayInt> revDescIndx=DataArrayInt::New();
+ MCAuto<DataArrayIdType> desc=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> descIndx=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> revDesc=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> revDescIndx=DataArrayIdType::New();
//
buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx)->decrRef();
- desc=(DataArrayInt*)0; descIndx=(DataArrayInt*)0;
+ desc=(DataArrayIdType*)0; descIndx=(DataArrayIdType*)0;
//
- MCAuto<DataArrayInt> tmp=revDescIndx->deltaShiftIndex();
- MCAuto<DataArrayInt> faceIds=tmp->findIdsEqual(1); tmp=(DataArrayInt*)0;
- const int *revDescPtr=revDesc->getConstPointer();
- const int *revDescIndxPtr=revDescIndx->getConstPointer();
- int nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> tmp=revDescIndx->deltaShiftIndex();
+ MCAuto<DataArrayIdType> faceIds=tmp->findIdsEqual(1); tmp=(DataArrayIdType*)0;
+ const mcIdType *revDescPtr=revDesc->getConstPointer();
+ const mcIdType *revDescIndxPtr=revDescIndx->getConstPointer();
+ mcIdType nbOfCells=getNumberOfCells();
std::vector<bool> ret1(nbOfCells,false);
- int sz=0;
- for(const int *pt=faceIds->begin();pt!=faceIds->end();pt++)
+ mcIdType sz=0;
+ for(const mcIdType *pt=faceIds->begin();pt!=faceIds->end();pt++)
if(!ret1[revDescPtr[revDescIndxPtr[*pt]]])
{ ret1[revDescPtr[revDescIndxPtr[*pt]]]=true; sz++; }
//
- DataArrayInt *ret2=DataArrayInt::New();
+ DataArrayIdType *ret2=DataArrayIdType::New();
ret2->alloc(sz,1);
- int *ret2Ptr=ret2->getPointer();
+ mcIdType *ret2Ptr=ret2->getPointer();
sz=0;
for(std::vector<bool>::const_iterator it=ret1.begin();it!=ret1.end();it++,sz++)
if(*it)
* \param [out] cellIdsRk1 a newly allocated array containing the cell ids of s1 \b indexed into the \b cellIdsRk0 subset. To get the absolute ids of s1, simply invoke
* cellIdsRk1->transformWithIndArr(cellIdsRk0->begin(),cellIdsRk0->end());
*/
-void MEDCouplingUMesh::findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *&cellIdsRk0, DataArrayInt *&cellIdsRk1) const
+void MEDCouplingUMesh::findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayIdType *&cellIdsRk0, DataArrayIdType *&cellIdsRk1) const
{
if(getCoords()!=otherDimM1OnSameCoords.getCoords())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellIdsLyingOn : coordinates pointer are not the same ! Use tryToShareSameCoords method !");
otherDimM1OnSameCoords.checkConnectivityFullyDefined();
if(getMeshDimension()-1!=otherDimM1OnSameCoords.getMeshDimension())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellIdsLyingOn : invalid mesh dimension of input mesh regarding meshdimesion of this !");
- MCAuto<DataArrayInt> fetchedNodeIds1=otherDimM1OnSameCoords.computeFetchedNodeIds();
- MCAuto<DataArrayInt> s0arr=getCellIdsLyingOnNodes(fetchedNodeIds1->begin(),fetchedNodeIds1->end(),false);
+ MCAuto<DataArrayIdType> fetchedNodeIds1=otherDimM1OnSameCoords.computeFetchedNodeIds();
+ MCAuto<DataArrayIdType> s0arr=getCellIdsLyingOnNodes(fetchedNodeIds1->begin(),fetchedNodeIds1->end(),false);
MCAuto<MEDCouplingUMesh> thisPart=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(s0arr->begin(),s0arr->end(),true));
- MCAuto<DataArrayInt> descThisPart=DataArrayInt::New(),descIThisPart=DataArrayInt::New(),revDescThisPart=DataArrayInt::New(),revDescIThisPart=DataArrayInt::New();
+ MCAuto<DataArrayIdType> descThisPart=DataArrayIdType::New(),descIThisPart=DataArrayIdType::New(),revDescThisPart=DataArrayIdType::New(),revDescIThisPart=DataArrayIdType::New();
MCAuto<MEDCouplingUMesh> thisPartConsti=thisPart->buildDescendingConnectivity(descThisPart,descIThisPart,revDescThisPart,revDescIThisPart);
- const int *revDescThisPartPtr=revDescThisPart->getConstPointer(),*revDescIThisPartPtr=revDescIThisPart->getConstPointer();
- DataArrayInt *idsOtherInConsti=0;
+ const mcIdType *revDescThisPartPtr=revDescThisPart->getConstPointer(),*revDescIThisPartPtr=revDescIThisPart->getConstPointer();
+ DataArrayIdType *idsOtherInConsti=0;
bool b=thisPartConsti->areCellsIncludedIn(&otherDimM1OnSameCoords,2,idsOtherInConsti);
- MCAuto<DataArrayInt> idsOtherInConstiAuto(idsOtherInConsti);
+ MCAuto<DataArrayIdType> idsOtherInConstiAuto(idsOtherInConsti);
if(!b)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellIdsLyingOn : the given mdim-1 mesh in other is not a constituent of this !");
- std::set<int> s1;
- for(const int *idOther=idsOtherInConsti->begin();idOther!=idsOtherInConsti->end();idOther++)
+ std::set<mcIdType> s1;
+ for(const mcIdType *idOther=idsOtherInConsti->begin();idOther!=idsOtherInConsti->end();idOther++)
s1.insert(revDescThisPartPtr+revDescIThisPartPtr[*idOther],revDescThisPartPtr+revDescIThisPartPtr[*idOther+1]);
- MCAuto<DataArrayInt> s1arr_renum1=DataArrayInt::New(); s1arr_renum1->alloc((int)s1.size(),1); std::copy(s1.begin(),s1.end(),s1arr_renum1->getPointer());
+ MCAuto<DataArrayIdType> s1arr_renum1=DataArrayIdType::New(); s1arr_renum1->alloc(s1.size(),1); std::copy(s1.begin(),s1.end(),s1arr_renum1->getPointer());
s1arr_renum1->sort();
cellIdsRk0=s0arr.retn();
//cellIdsRk1=s_renum1.retn();
*/
MEDCouplingUMesh *MEDCouplingUMesh::computeSkin() const
{
- MCAuto<DataArrayInt> desc=DataArrayInt::New();
- MCAuto<DataArrayInt> descIndx=DataArrayInt::New();
- MCAuto<DataArrayInt> revDesc=DataArrayInt::New();
- MCAuto<DataArrayInt> revDescIndx=DataArrayInt::New();
+ MCAuto<DataArrayIdType> desc=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> descIndx=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> revDesc=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> revDescIndx=DataArrayIdType::New();
//
MCAuto<MEDCouplingUMesh> meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
revDesc=0; desc=0; descIndx=0;
- MCAuto<DataArrayInt> revDescIndx2=revDescIndx->deltaShiftIndex();
- MCAuto<DataArrayInt> part=revDescIndx2->findIdsEqual(1);
+ MCAuto<DataArrayIdType> revDescIndx2=revDescIndx->deltaShiftIndex();
+ MCAuto<DataArrayIdType> part=revDescIndx2->findIdsEqual(1);
return static_cast<MEDCouplingUMesh *>(meshDM1->buildPartOfMySelf(part->begin(),part->end(),true));
}
/*!
* Finds nodes lying on the boundary of \a this mesh.
- * \return DataArrayInt * - a new instance of DataArrayInt holding ids of found
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of found
* nodes. The caller is to delete this array using decrRef() as it is no
* more needed.
* \throw If the coordinates array is not set.
* \ref py_mcumesh_findBoundaryNodes "Here is a Python example".
* \endif
*/
-DataArrayInt *MEDCouplingUMesh::findBoundaryNodes() const
+DataArrayIdType *MEDCouplingUMesh::findBoundaryNodes() const
{
MCAuto<MEDCouplingUMesh> skin=computeSkin();
return skin->computeFetchedNodeIds();
* parameter is altered during the call.
* \param [out] nodeIdsToDuplicate node ids needed to be duplicated following the algorithm explain above.
* \param [out] cellIdsNeededToBeRenum cell ids in \b this in which the renumber of nodes should be performed.
- * \param [out] cellIdsNotModified cell ids int \b this that lies on \b otherDimM1OnSameCoords mesh whose connectivity do \b not need to be modified as it is the case for \b cellIdsNeededToBeRenum.
+ * \param [out] cellIdsNotModified cell ids mcIdType \b this that lies on \b otherDimM1OnSameCoords mesh whose connectivity do \b not need to be modified as it is the case for \b cellIdsNeededToBeRenum.
*
* \warning This method modifies param \b otherDimM1OnSameCoords (for speed reasons).
*/
-void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *& nodeIdsToDuplicate,
- DataArrayInt *& cellIdsNeededToBeRenum, DataArrayInt *& cellIdsNotModified) const
+void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayIdType *& nodeIdsToDuplicate,
+ DataArrayIdType *& cellIdsNeededToBeRenum, DataArrayIdType *& cellIdsNotModified) const
{
- typedef MCAuto<DataArrayInt> DAInt;
+ typedef MCAuto<DataArrayIdType> DAInt;
typedef MCAuto<MEDCouplingUMesh> MCUMesh;
checkFullyDefined();
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findNodesToDuplicate : the mesh given in other parameter must have this->getMeshDimension()-1 !");
// Checking star-shaped M1 group:
- DAInt dt0=DataArrayInt::New(),dit0=DataArrayInt::New(),rdt0=DataArrayInt::New(),rdit0=DataArrayInt::New();
+ DAInt dt0=DataArrayIdType::New(),dit0=DataArrayIdType::New(),rdt0=DataArrayIdType::New(),rdit0=DataArrayIdType::New();
MCUMesh meshM2 = otherDimM1OnSameCoords.buildDescendingConnectivity(dt0, dit0, rdt0, rdit0);
DAInt dsi = rdit0->deltaShiftIndex();
DAInt idsTmp0 = dsi->findIdsNotInRange(-1, 3);
MCUMesh meshM2Part = static_cast<MEDCouplingUMesh *>(meshM2->buildPartOfMySelf(xtremIdsM2->begin(), xtremIdsM2->end(),true));
DAInt xtrem = meshM2Part->computeFetchedNodeIds();
// Remove from the list points on the boundary of the M0 mesh (those need duplication!)
- dt0=DataArrayInt::New(),dit0=DataArrayInt::New(),rdt0=DataArrayInt::New(),rdit0=DataArrayInt::New();
+ dt0=DataArrayIdType::New(),dit0=DataArrayIdType::New(),rdt0=DataArrayIdType::New(),rdit0=DataArrayIdType::New();
MCUMesh m0desc = buildDescendingConnectivity(dt0, dit0, rdt0, rdit0); dt0=0; dit0=0; rdt0=0;
dsi = rdit0->deltaShiftIndex();
DAInt boundSegs = dsi->findIdsEqual(1); // boundary segs/faces of the M0 mesh
DAInt notDup = 0;
if (getMeshDimension() == 3)
{
- DAInt dnu1=DataArrayInt::New(), dnu2=DataArrayInt::New(), dnu3=DataArrayInt::New(), dnu4=DataArrayInt::New();
+ DAInt dnu1=DataArrayIdType::New(), dnu2=DataArrayIdType::New(), dnu3=DataArrayIdType::New(), dnu4=DataArrayIdType::New();
MCUMesh m0descSkinDesc = m0descSkin->buildDescendingConnectivity(dnu1, dnu2, dnu3, dnu4);
dnu1=0;dnu2=0;dnu3=0;dnu4=0;
- DataArrayInt * corresp=0;
+ DataArrayIdType * corresp=0;
meshM2->areCellsIncludedIn(m0descSkinDesc,2,corresp);
DAInt validIds = corresp->findIdsInRange(0, meshM2->getNumberOfCells());
corresp->decrRef();
//
MCUMesh m0Part2=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(cellsAroundGroup->begin(),cellsAroundGroup->end(),true));
- int nCells2 = m0Part2->getNumberOfCells();
- DAInt desc00=DataArrayInt::New(),descI00=DataArrayInt::New(),revDesc00=DataArrayInt::New(),revDescI00=DataArrayInt::New();
+ mcIdType nCells2 = m0Part2->getNumberOfCells();
+ DAInt desc00=DataArrayIdType::New(),descI00=DataArrayIdType::New(),revDesc00=DataArrayIdType::New(),revDescI00=DataArrayIdType::New();
MCUMesh m01=m0Part2->buildDescendingConnectivity(desc00,descI00,revDesc00,revDescI00);
// Neighbor information of the mesh without considering the crack (serves to count how many connex pieces it is made of)
- DataArrayInt *tmp00=0,*tmp11=0;
+ DataArrayIdType *tmp00=0,*tmp11=0;
MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc00,descI00,revDesc00,revDescI00, tmp00, tmp11);
DAInt neighInit00(tmp00);
DAInt neighIInit00(tmp11);
// Neighbor information of the mesh WITH the crack (some neighbors are removed):
- DataArrayInt *idsTmp=0;
+ DataArrayIdType *idsTmp=0;
m01->areCellsIncludedIn(&otherDimM1OnSameCoords,2,idsTmp);
DAInt ids(idsTmp);
// In the neighbor information remove the connection between high dimension cells and its low level constituents which are part
// of the frontier given in parameter (i.e. the cells of low dimension from the group delimiting the crack):
- DataArrayInt::RemoveIdsFromIndexedArrays(ids->begin(),ids->end(),desc00,descI00);
- DataArrayInt *tmp0=0,*tmp1=0;
+ DataArrayIdType::RemoveIdsFromIndexedArrays(ids->begin(),ids->end(),desc00,descI00);
+ DataArrayIdType *tmp0=0,*tmp1=0;
// Compute the neighbor of each cell in m0Part2, taking into account the broken link above. Two
// cells on either side of the crack (defined by the mesh of low dimension) are not neighbor anymore.
ComputeNeighborsOfCellsAdv(desc00,descI00,revDesc00,revDescI00,tmp0,tmp1);
DAInt neighI00(tmp1);
// For each initial connex part of the sub-mesh (or said differently for each independent crack):
- int seed = 0, nIter = 0;
- int nIterMax = nCells2+1; // Safety net for the loop
- DAInt hitCells = DataArrayInt::New(); hitCells->alloc(nCells2);
+ mcIdType seed = 0, nIter = 0;
+ mcIdType nIterMax = nCells2+1; // Safety net for the loop
+ DAInt hitCells = DataArrayIdType::New(); hitCells->alloc(nCells2);
hitCells->fillWithValue(-1);
- DAInt cellsToModifyConn0_torenum = DataArrayInt::New();
+ DAInt cellsToModifyConn0_torenum = DataArrayIdType::New();
cellsToModifyConn0_torenum->alloc(0,1);
while (nIter < nIterMax)
{
if (!t->getNumberOfTuples())
break;
// Connex zone without the crack (to compute the next seed really)
- int dnu;
+ mcIdType dnu;
DAInt connexCheck = MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(&seed, &seed+1, neighInit00,neighIInit00, -1, dnu);
- std::size_t cnt(0);
- for (int * ptr = connexCheck->getPointer(); cnt < connexCheck->getNumberOfTuples(); ptr++, cnt++)
+ mcIdType cnt(0);
+ for (mcIdType * ptr = connexCheck->getPointer(); cnt < connexCheck->getNumberOfTuples(); ptr++, cnt++)
hitCells->setIJ(*ptr,0,1);
// Connex zone WITH the crack (to identify cells lying on either part of the crack)
DAInt spreadZone = MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(&seed, &seed+1, neigh00,neighI00, -1, dnu);
- cellsToModifyConn0_torenum = DataArrayInt::Aggregate(cellsToModifyConn0_torenum, spreadZone, 0);
+ cellsToModifyConn0_torenum = DataArrayIdType::Aggregate(cellsToModifyConn0_torenum, spreadZone, 0);
// Compute next seed, i.e. a cell in another connex part, which was not covered by the previous iterations
DAInt comple = cellsToModifyConn0_torenum->buildComplement(nCells2);
DAInt nonHitCells = hitCells->findIdsEqual(-1);
* \param [in] nodeIdsToDuplicateBg begin of node ids (included) to be duplicated in connectivity only
* \param [in] nodeIdsToDuplicateEnd end of node ids (excluded) to be duplicated in connectivity only
*/
-void MEDCouplingUMesh::duplicateNodes(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd)
+void MEDCouplingUMesh::duplicateNodes(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd)
{
- int nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfNodes=getNumberOfNodes();
duplicateNodesInCoords(nodeIdsToDuplicateBg,nodeIdsToDuplicateEnd);
duplicateNodesInConn(nodeIdsToDuplicateBg,nodeIdsToDuplicateEnd,nbOfNodes);
}
*
* \sa renumberNodesInConn
*/
-void MEDCouplingUMesh::renumberNodesWithOffsetInConn(int offset)
+void MEDCouplingUMesh::renumberNodesWithOffsetInConn(mcIdType offset)
{
checkConnectivityFullyDefined();
- int *conn(getNodalConnectivity()->getPointer());
- const int *connIndex(getNodalConnectivityIndex()->getConstPointer());
- int nbOfCells(getNumberOfCells());
- for(int i=0;i<nbOfCells;i++)
- for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
+ mcIdType *conn(getNodalConnectivity()->getPointer());
+ const mcIdType *connIndex(getNodalConnectivityIndex()->getConstPointer());
+ mcIdType nbOfCells=getNumberOfCells();
+ for(mcIdType i=0;i<nbOfCells;i++)
+ for(mcIdType iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
- int& node=conn[iconn];
+ mcIdType& node=conn[iconn];
if(node>=0)//avoid polyhedron separator
{
node+=offset;
}
/*!
- * Same than renumberNodesInConn(const int *) except that here the format of old-to-new traducer is using map instead
+ * Same than renumberNodesInConn(const mcIdType *) except that here the format of old-to-new traducer is using map instead
* of array. This method is dedicated for renumbering from a big set of nodes the a tiny set of nodes which is the case during extraction
* of a big mesh.
*/
-void MEDCouplingUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap<int,int>& newNodeNumbersO2N)
+void MEDCouplingUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap<mcIdType,mcIdType>& newNodeNumbersO2N)
{
- this->renumberNodesInConnT< INTERP_KERNEL::HashMap<int,int> >(newNodeNumbersO2N);
+ this->renumberNodesInConnT< INTERP_KERNEL::HashMap<mcIdType,mcIdType> >(newNodeNumbersO2N);
}
/*!
- * Same than renumberNodesInConn(const int *) except that here the format of old-to-new traducer is using map instead
+ * Same than renumberNodesInConn(const mcIdType *) except that here the format of old-to-new traducer is using map instead
* of array. This method is dedicated for renumbering from a big set of nodes the a tiny set of nodes which is the case during extraction
* of a big mesh.
*/
-void MEDCouplingUMesh::renumberNodesInConn(const std::map<int,int>& newNodeNumbersO2N)
+void MEDCouplingUMesh::renumberNodesInConn(const std::map<mcIdType,mcIdType>& newNodeNumbersO2N)
{
- this->renumberNodesInConnT< std::map<int,int> >(newNodeNumbersO2N);
+ this->renumberNodesInConnT< std::map<mcIdType,mcIdType> >(newNodeNumbersO2N);
}
/*!
* \ref py_mcumesh_renumberNodesInConn "Here is a Python example".
* \endif
*/
-void MEDCouplingUMesh::renumberNodesInConn(const int *newNodeNumbersO2N)
+void MEDCouplingUMesh::renumberNodesInConn(const mcIdType *newNodeNumbersO2N)
{
checkConnectivityFullyDefined();
- int *conn=getNodalConnectivity()->getPointer();
- const int *connIndex=getNodalConnectivityIndex()->getConstPointer();
- int nbOfCells(getNumberOfCells());
- for(int i=0;i<nbOfCells;i++)
- for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
+ mcIdType *conn=getNodalConnectivity()->getPointer();
+ const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer();
+ mcIdType nbOfCells=getNumberOfCells();
+ for(mcIdType i=0;i<nbOfCells;i++)
+ for(mcIdType iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
- int& node=conn[iconn];
+ mcIdType& node=conn[iconn];
if(node>=0)//avoid polyhedron separator
{
node=newNodeNumbersO2N[node];
*
* \param [in] delta specifies the shift size applied to nodeId in nodal connectivity in \b this.
*/
-void MEDCouplingUMesh::shiftNodeNumbersInConn(int delta)
+void MEDCouplingUMesh::shiftNodeNumbersInConn(mcIdType delta)
{
checkConnectivityFullyDefined();
- int *conn=getNodalConnectivity()->getPointer();
- const int *connIndex=getNodalConnectivityIndex()->getConstPointer();
- int nbOfCells=getNumberOfCells();
- for(int i=0;i<nbOfCells;i++)
- for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
+ mcIdType *conn=getNodalConnectivity()->getPointer();
+ const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer();
+ mcIdType nbOfCells=getNumberOfCells();
+ for(mcIdType i=0;i<nbOfCells;i++)
+ for(mcIdType iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
- int& node=conn[iconn];
+ mcIdType& node=conn[iconn];
if(node>=0)//avoid polyhedron separator
{
node+=delta;
* \param [in] nodeIdsToDuplicateEnd end of node ids (excluded) to be duplicated in connectivity only
* \param [in] offset the offset applied to all node ids in connectivity that are in [ \a nodeIdsToDuplicateBg, \a nodeIdsToDuplicateEnd ).
*/
-void MEDCouplingUMesh::duplicateNodesInConn(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd, int offset)
+void MEDCouplingUMesh::duplicateNodesInConn(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd, mcIdType offset)
{
checkConnectivityFullyDefined();
- std::map<int,int> m;
- int val=offset;
- for(const int *work=nodeIdsToDuplicateBg;work!=nodeIdsToDuplicateEnd;work++,val++)
+ std::map<mcIdType,mcIdType> m;
+ mcIdType val=offset;
+ for(const mcIdType *work=nodeIdsToDuplicateBg;work!=nodeIdsToDuplicateEnd;work++,val++)
m[*work]=val;
- int *conn=getNodalConnectivity()->getPointer();
- const int *connIndex=getNodalConnectivityIndex()->getConstPointer();
- int nbOfCells=getNumberOfCells();
- for(int i=0;i<nbOfCells;i++)
- for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
+ mcIdType *conn=getNodalConnectivity()->getPointer();
+ const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer();
+ mcIdType nbOfCells=getNumberOfCells();
+ for(mcIdType i=0;i<nbOfCells;i++)
+ for(mcIdType iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
- int& node=conn[iconn];
+ mcIdType& node=conn[iconn];
if(node>=0)//avoid polyhedron separator
{
- std::map<int,int>::iterator it=m.find(node);
+ std::map<mcIdType,mcIdType>::iterator it=m.find(node);
if(it!=m.end())
node=(*it).second;
}
* \param [in] old2NewBg is expected to be a dynamically allocated pointer of size at least equal to this->getNumberOfCells()
* \param check
*/
-void MEDCouplingUMesh::renumberCells(const int *old2NewBg, bool check)
+void MEDCouplingUMesh::renumberCells(const mcIdType *old2NewBg, bool check)
{
checkConnectivityFullyDefined();
- int nbCells=getNumberOfCells();
- const int *array=old2NewBg;
+ mcIdType nbCells=getNumberOfCells();
+ const mcIdType *array=old2NewBg;
if(check)
- array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells);
+ array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells);
//
- const int *conn=_nodal_connec->getConstPointer();
- const int *connI=_nodal_connec_index->getConstPointer();
- MCAuto<DataArrayInt> o2n=DataArrayInt::New(); o2n->useArray(array,false,DeallocType::C_DEALLOC,nbCells,1);
- MCAuto<DataArrayInt> n2o=o2n->invertArrayO2N2N2O(nbCells);
- const int *n2oPtr=n2o->begin();
- MCAuto<DataArrayInt> newConn=DataArrayInt::New();
+ const mcIdType *conn=_nodal_connec->getConstPointer();
+ const mcIdType *connI=_nodal_connec_index->getConstPointer();
+ MCAuto<DataArrayIdType> o2n=DataArrayIdType::New(); o2n->useArray(array,false,DeallocType::C_DEALLOC,nbCells,1);
+ MCAuto<DataArrayIdType> n2o=o2n->invertArrayO2N2N2O(nbCells);
+ const mcIdType *n2oPtr=n2o->begin();
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New();
newConn->alloc(_nodal_connec->getNumberOfTuples(),_nodal_connec->getNumberOfComponents());
newConn->copyStringInfoFrom(*_nodal_connec);
- MCAuto<DataArrayInt> newConnI=DataArrayInt::New();
+ MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New();
newConnI->alloc(_nodal_connec_index->getNumberOfTuples(),_nodal_connec_index->getNumberOfComponents());
newConnI->copyStringInfoFrom(*_nodal_connec_index);
//
- int *newC=newConn->getPointer();
- int *newCI=newConnI->getPointer();
- int loc=0;
+ mcIdType *newC=newConn->getPointer();
+ mcIdType *newCI=newConnI->getPointer();
+ mcIdType loc=0;
newCI[0]=loc;
- for(int i=0;i<nbCells;i++)
+ for(mcIdType i=0;i<nbCells;i++)
{
- int pos=n2oPtr[i];
- int nbOfElts=connI[pos+1]-connI[pos];
+ mcIdType pos=n2oPtr[i];
+ mcIdType nbOfElts=connI[pos+1]-connI[pos];
newC=std::copy(conn+connI[pos],conn+connI[pos+1],newC);
loc+=nbOfElts;
newCI[i+1]=loc;
//
setConnectivity(newConn,newConnI);
if(check)
- free(const_cast<int *>(array));
+ free(const_cast<mcIdType *>(array));
}
/*!
* \param [in] eps - a factor used to increase size of the bounding box of cell
* before comparing it with \a bbox. This factor is multiplied by the maximal
* extent of the bounding box of cell to produce an addition to this bounding box.
- * \return DataArrayInt * - a new instance of DataArrayInt holding ids for found
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids for found
* cells. The caller is to delete this array using decrRef() as it is no more
* needed.
* \throw If the coordinates array is not set.
* \ref py_mcumesh_getCellsInBoundingBox "Here is a Python example".
* \endif
*/
-DataArrayInt *MEDCouplingUMesh::getCellsInBoundingBox(const double *bbox, double eps) const
+DataArrayIdType *MEDCouplingUMesh::getCellsInBoundingBox(const double *bbox, double eps) const
{
- MCAuto<DataArrayInt> elems=DataArrayInt::New(); elems->alloc(0,1);
+ MCAuto<DataArrayIdType> elems=DataArrayIdType::New(); elems->alloc(0,1);
if(getMeshDimension()==-1)
{
elems->pushBackSilent(0);
}
int dim=getSpaceDimension();
INTERP_KERNEL::AutoPtr<double> elem_bb=new double[2*dim];
- const int* conn = getNodalConnectivity()->getConstPointer();
- const int* conn_index= getNodalConnectivityIndex()->getConstPointer();
+ const mcIdType* conn = getNodalConnectivity()->getConstPointer();
+ const mcIdType* conn_index= getNodalConnectivityIndex()->getConstPointer();
const double* coords = getCoords()->getConstPointer();
- int nbOfCells=getNumberOfCells();
- for ( int ielem=0; ielem<nbOfCells;ielem++ )
+ mcIdType nbOfCells=getNumberOfCells();
+ for ( mcIdType ielem=0; ielem<nbOfCells;ielem++ )
{
for (int i=0; i<dim; i++)
{
elem_bb[i*2+1]=-std::numeric_limits<double>::max();
}
- for (int inode=conn_index[ielem]+1; inode<conn_index[ielem+1]; inode++)//+1 due to offset of cell type.
+ for (mcIdType inode=conn_index[ielem]+1; inode<conn_index[ielem+1]; inode++)//+1 due to offset of cell type.
{
- int node= conn[inode];
+ mcIdType node= conn[inode];
if(node>=0)//avoid polyhedron separator
{
for (int idim=0; idim<dim; idim++)
* Warning 'elems' is incremented during the call so if elems is not empty before call returned elements will be
* added in 'elems' parameter.
*/
-DataArrayInt *MEDCouplingUMesh::getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps)
+DataArrayIdType *MEDCouplingUMesh::getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps)
{
- MCAuto<DataArrayInt> elems=DataArrayInt::New(); elems->alloc(0,1);
+ MCAuto<DataArrayIdType> elems=DataArrayIdType::New(); elems->alloc(0,1);
if(getMeshDimension()==-1)
{
elems->pushBackSilent(0);
}
int dim=getSpaceDimension();
INTERP_KERNEL::AutoPtr<double> elem_bb=new double[2*dim];
- const int* conn = getNodalConnectivity()->getConstPointer();
- const int* conn_index= getNodalConnectivityIndex()->getConstPointer();
+ const mcIdType* conn = getNodalConnectivity()->getConstPointer();
+ const mcIdType* conn_index= getNodalConnectivityIndex()->getConstPointer();
const double* coords = getCoords()->getConstPointer();
- int nbOfCells=getNumberOfCells();
- for ( int ielem=0; ielem<nbOfCells;ielem++ )
+ mcIdType nbOfCells=getNumberOfCells();
+ for ( mcIdType ielem=0; ielem<nbOfCells;ielem++ )
{
for (int i=0; i<dim; i++)
{
elem_bb[i*2+1]=-std::numeric_limits<double>::max();
}
- for (int inode=conn_index[ielem]+1; inode<conn_index[ielem+1]; inode++)//+1 due to offset of cell type.
+ for (mcIdType inode=conn_index[ielem]+1; inode<conn_index[ielem+1]; inode++)//+1 due to offset of cell type.
{
- int node= conn[inode];
+ mcIdType node= conn[inode];
if(node>=0)//avoid polyhedron separator
{
for (int idim=0; idim<dim; idim++)
* \return INTERP_KERNEL::NormalizedCellType - enumeration item describing the cell type.
* \throw If \a cellId is invalid. Valid range is [0, \a this->getNumberOfCells() ).
*/
-INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::getTypeOfCell(std::size_t cellId) const
+INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::getTypeOfCell(mcIdType cellId) const
{
- const int *ptI(_nodal_connec_index->begin()),*pt(_nodal_connec->begin());
+ const mcIdType *ptI(_nodal_connec_index->begin()),*pt(_nodal_connec->begin());
if(cellId<_nodal_connec_index->getNbOfElems()-1)
return (INTERP_KERNEL::NormalizedCellType) pt[ptI[cellId]];
else
* \param [in] type the geometric type
* \return cell ids in this having geometric type \a type.
*/
-DataArrayInt *MEDCouplingUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
+DataArrayIdType *MEDCouplingUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(0,1);
checkConnectivityFullyDefined();
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=getNumberOfCells();
int mdim=getMeshDimension();
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
- if(mdim!=(int)cm.getDimension())
+ if(mdim!=ToIdType(cm.getDimension()))
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::giveCellsWithType : Mismatch between mesh dimension and dimension of the cell !");
- const int *ptI=_nodal_connec_index->getConstPointer();
- const int *pt=_nodal_connec->getConstPointer();
- for(int i=0;i<nbCells;i++)
+ const mcIdType *ptI=_nodal_connec_index->getConstPointer();
+ const mcIdType *pt=_nodal_connec->getConstPointer();
+ for(mcIdType i=0;i<nbCells;i++)
{
if((INTERP_KERNEL::NormalizedCellType)pt[ptI[i]]==type)
ret->pushBackSilent(i);
/*!
* Returns nb of cells having the geometric type \a type. No throw if no cells in \a this has the geometric type \a type.
*/
-std::size_t MEDCouplingUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
+mcIdType MEDCouplingUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
- const int *ptI(_nodal_connec_index->begin()),*pt(_nodal_connec->begin());
- std::size_t nbOfCells(getNumberOfCells()),ret(0);
- for(std::size_t i=0;i<nbOfCells;i++)
+ const mcIdType *ptI(_nodal_connec_index->begin()),*pt(_nodal_connec->begin());
+ mcIdType nbOfCells(getNumberOfCells()),ret(0);
+ for(mcIdType i=0;i<nbOfCells;i++)
if((INTERP_KERNEL::NormalizedCellType) pt[ptI[i]]==type)
ret++;
return ret;
* cleared before the appending.
* \throw If \a cellId is invalid. Valid range is [0, \a this->getNumberOfCells() ).
*/
-void MEDCouplingUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const
+void MEDCouplingUMesh::getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const
{
- const int *ptI(_nodal_connec_index->begin()),*pt(_nodal_connec->begin());
- for(const int *w=pt+ptI[cellId]+1;w!=pt+ptI[cellId+1];w++)
+ const mcIdType *ptI(_nodal_connec_index->begin()),*pt(_nodal_connec->begin());
+ for(const mcIdType *w=pt+ptI[cellId]+1;w!=pt+ptI[cellId+1];w++)
if(*w>=0)
conn.push_back(*w);
}
* This method analyzes the 3 arrays of \a this. For each the following behaviour is done : if the array is null a newly one is created
* with number of tuples set to 0, if not the array is taken as this in the returned instance.
*/
-MEDCouplingUMesh *MEDCouplingUMesh::buildSetInstanceFromThis(int spaceDim) const
+MEDCouplingUMesh *MEDCouplingUMesh::buildSetInstanceFromThis(std::size_t spaceDim) const
{
int mdim=getMeshDimension();
if(mdim<0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSetInstanceFromThis : invalid mesh dimension ! Should be >= 0 !");
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),mdim);
- MCAuto<DataArrayInt> tmp1,tmp2;
+ MCAuto<DataArrayIdType> tmp1,tmp2;
bool needToCpyCT=true;
if(!_nodal_connec)
{
- tmp1=DataArrayInt::New(); tmp1->alloc(0,1);
+ tmp1=DataArrayIdType::New(); tmp1->alloc(0,1);
needToCpyCT=false;
}
else
}
if(!_nodal_connec_index)
{
- tmp2=DataArrayInt::New(); tmp2->alloc(1,1); tmp2->setIJ(0,0,0);
+ tmp2=DataArrayIdType::New(); tmp2->alloc(1,1); tmp2->setIJ(0,0,0);
needToCpyCT=false;
}
else
return ret.retn();
}
-int MEDCouplingUMesh::getNumberOfNodesInCell(int cellId) const
+mcIdType MEDCouplingUMesh::getNumberOfNodesInCell(mcIdType cellId) const
{
- const int *ptI=_nodal_connec_index->getConstPointer();
- const int *pt=_nodal_connec->getConstPointer();
+ const mcIdType *ptI=_nodal_connec_index->getConstPointer();
+ const mcIdType *pt=_nodal_connec->getConstPointer();
if(pt[ptI[cellId]]!=INTERP_KERNEL::NORM_POLYHED)
return ptI[cellId+1]-ptI[cellId]-1;
else
- return (int)std::count_if(pt+ptI[cellId]+1,pt+ptI[cellId+1],std::bind2nd(std::not_equal_to<int>(),-1));
+ return ToIdType(std::count_if(pt+ptI[cellId]+1,pt+ptI[cellId+1],std::bind2nd(std::not_equal_to<mcIdType>(),-1)));
}
/*!
* \throw If the nodal connectivity of cells is not defined.
* \sa getAllGeoTypes()
*/
-std::set<INTERP_KERNEL::NormalizedCellType> MEDCouplingUMesh::getTypesOfPart(const int *begin, const int *end) const
+std::set<INTERP_KERNEL::NormalizedCellType> MEDCouplingUMesh::getTypesOfPart(const mcIdType *begin, const mcIdType *end) const
{
checkFullyDefined();
std::set<INTERP_KERNEL::NormalizedCellType> ret;
- const int *conn=_nodal_connec->getConstPointer();
- const int *connIndex=_nodal_connec_index->getConstPointer();
- for(const int *w=begin;w!=end;w++)
+ const mcIdType *conn=_nodal_connec->getConstPointer();
+ const mcIdType *connIndex=_nodal_connec_index->getConstPointer();
+ for(const mcIdType *w=begin;w!=end;w++)
ret.insert((INTERP_KERNEL::NormalizedCellType)conn[connIndex[*w]]);
return ret;
}
* \param [in] isComputingTypes - if \c true, the set of types constituting \a this
* mesh is updated.
*/
-void MEDCouplingUMesh::setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes)
+void MEDCouplingUMesh::setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes)
{
- DataArrayInt::SetArrayIn(conn,_nodal_connec);
- DataArrayInt::SetArrayIn(connIndex,_nodal_connec_index);
+ DataArrayIdType::SetArrayIn(conn,_nodal_connec);
+ DataArrayIdType::SetArrayIn(connIndex,_nodal_connec_index);
if(isComputingTypes)
computeTypes();
declareAsNew();
/*!
* Returns a number of cells constituting \a this mesh.
- * \return int - the number of cells in \a this mesh.
+ * \return mcIdType - the number of cells in \a this mesh.
* \throw If the nodal connectivity of cells is not defined.
*/
-std::size_t MEDCouplingUMesh::getNumberOfCells() const
+mcIdType MEDCouplingUMesh::getNumberOfCells() const
{
if(_nodal_connec_index)
return _nodal_connec_index->getNumberOfTuples()-1;
* Returns a length of the nodal connectivity array.
* This method is for test reason. Normally the integer returned is not useable by
* user. For more info see \ref MEDCouplingUMeshNodalConnectivity.
- * \return int - the length of the nodal connectivity array.
+ * \return mcIdType - the length of the nodal connectivity array.
*/
-int MEDCouplingUMesh::getNodalConnectivityArrayLen() const
+mcIdType MEDCouplingUMesh::getNodalConnectivityArrayLen() const
{
return _nodal_connec->getNbOfElems();
}
/*!
* First step of serialization process. Used by ParaMEDMEM and MEDCouplingCorba to transfert data between process.
*/
-void MEDCouplingUMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+void MEDCouplingUMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
{
MEDCouplingPointSet::getTinySerializationInformation(tinyInfoD,tinyInfo,littleStrings);
- tinyInfo.push_back(getMeshDimension());
+ tinyInfo.push_back(ToIdType(getMeshDimension()));
tinyInfo.push_back(getNumberOfCells());
if(_nodal_connec)
tinyInfo.push_back(getNodalConnectivityArrayLen());
/*!
* First step of unserialization process.
*/
-bool MEDCouplingUMesh::isEmptyMesh(const std::vector<int>& tinyInfo) const
+bool MEDCouplingUMesh::isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const
{
return tinyInfo[6]<=0;
}
* \param a2
* \param littleStrings
*/
-void MEDCouplingUMesh::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
+void MEDCouplingUMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
MEDCouplingPointSet::resizeForUnserialization(tinyInfo,a1,a2,littleStrings);
if(tinyInfo[5]!=-1)
/*!
* Third and final step of serialization process.
*/
-void MEDCouplingUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
+void MEDCouplingUMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const
{
MEDCouplingPointSet::serialize(a1,a2);
if(getMeshDimension()>-1)
{
- a1=DataArrayInt::New();
+ a1=DataArrayIdType::New();
a1->alloc(getNodalConnectivityArrayLen()+getNumberOfCells()+1,1);
- int *ptA1=a1->getPointer();
- const int *conn=getNodalConnectivity()->getConstPointer();
- const int *index=getNodalConnectivityIndex()->getConstPointer();
+ mcIdType *ptA1=a1->getPointer();
+ const mcIdType *conn=getNodalConnectivity()->getConstPointer();
+ const mcIdType *index=getNodalConnectivityIndex()->getConstPointer();
ptA1=std::copy(index,index+getNumberOfCells()+1,ptA1);
std::copy(conn,conn+getNodalConnectivityArrayLen(),ptA1);
}
* Second and final unserialization process.
* \param tinyInfo must be equal to the result given by getTinySerializationInformation method.
*/
-void MEDCouplingUMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
+void MEDCouplingUMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
{
MEDCouplingPointSet::unserialization(tinyInfoD,tinyInfo,a1,a2,littleStrings);
- setMeshDimension(tinyInfo[5]);
+ setMeshDimension(FromIdType<int>(tinyInfo[5]));
if(tinyInfo[7]!=-1)
{
// Connectivity
- const int *recvBuffer=a1->getConstPointer();
- MCAuto<DataArrayInt> myConnecIndex=DataArrayInt::New();
+ const mcIdType *recvBuffer=a1->getConstPointer();
+ MCAuto<DataArrayIdType> myConnecIndex=DataArrayIdType::New();
myConnecIndex->alloc(tinyInfo[6]+1,1);
std::copy(recvBuffer,recvBuffer+tinyInfo[6]+1,myConnecIndex->getPointer());
- MCAuto<DataArrayInt> myConnec=DataArrayInt::New();
+ MCAuto<DataArrayIdType> myConnec=DataArrayIdType::New();
myConnec->alloc(tinyInfo[7],1);
std::copy(recvBuffer+tinyInfo[6]+1,recvBuffer+tinyInfo[6]+1+tinyInfo[7],myConnec->getPointer());
setConnectivity(myConnec, myConnecIndex);
{
std::string name="MeasureOfMesh_";
name+=getName();
- int nbelem=getNumberOfCells();
+ mcIdType nbelem=getNumberOfCells();
MCAuto<MEDCouplingFieldDouble> field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
field->setName(name);
MCAuto<DataArrayDouble> array=DataArrayDouble::New();
field->synchronizeTimeWithMesh();
if(getMeshDimension()!=-1)
{
- int ipt;
+ mcIdType ipt;
INTERP_KERNEL::NormalizedCellType type;
int dim_space=getSpaceDimension();
const double *coords=getCoords()->getConstPointer();
- const int *connec=getNodalConnectivity()->getConstPointer();
- const int *connec_index=getNodalConnectivityIndex()->getConstPointer();
- for(int iel=0;iel<nbelem;iel++)
+ const mcIdType *connec=getNodalConnectivity()->getConstPointer();
+ const mcIdType *connec_index=getNodalConnectivityIndex()->getConstPointer();
+ for(mcIdType iel=0;iel<nbelem;iel++)
{
ipt=connec_index[iel];
type=(INTERP_KERNEL::NormalizedCellType)connec[ipt];
- area_vol[iel]=INTERP_KERNEL::computeVolSurfOfCell2<int,INTERP_KERNEL::ALL_C_MODE>(type,connec+ipt+1,connec_index[iel+1]-ipt-1,coords,dim_space);
+ area_vol[iel]=INTERP_KERNEL::computeVolSurfOfCell2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(type,connec+ipt+1,connec_index[iel+1]-ipt-1,coords,dim_space);
}
if(isAbs)
std::transform(area_vol,area_vol+nbelem,area_vol,std::ptr_fun<double,double>(fabs));
* \endif
* \sa getMeasureField()
*/
-DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const int *begin, const int *end) const
+DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const mcIdType *begin, const mcIdType *end) const
{
std::string name="PartMeasureOfMesh_";
name+=getName();
- int nbelem=(int)std::distance(begin,end);
+ std::size_t nbelem=std::distance(begin,end);
MCAuto<DataArrayDouble> array=DataArrayDouble::New();
array->setName(name);
array->alloc(nbelem,1);
double *area_vol=array->getPointer();
if(getMeshDimension()!=-1)
{
- int ipt;
+ mcIdType ipt;
INTERP_KERNEL::NormalizedCellType type;
int dim_space=getSpaceDimension();
const double *coords=getCoords()->getConstPointer();
- const int *connec=getNodalConnectivity()->getConstPointer();
- const int *connec_index=getNodalConnectivityIndex()->getConstPointer();
- for(const int *iel=begin;iel!=end;iel++)
+ const mcIdType *connec=getNodalConnectivity()->getConstPointer();
+ const mcIdType *connec_index=getNodalConnectivityIndex()->getConstPointer();
+ for(const mcIdType *iel=begin;iel!=end;iel++)
{
ipt=connec_index[*iel];
type=(INTERP_KERNEL::NormalizedCellType)connec[ipt];
- *area_vol++=INTERP_KERNEL::computeVolSurfOfCell2<int,INTERP_KERNEL::ALL_C_MODE>(type,connec+ipt+1,connec_index[*iel+1]-ipt-1,coords,dim_space);
+ *area_vol++=INTERP_KERNEL::computeVolSurfOfCell2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(type,connec+ipt+1,connec_index[*iel+1]-ipt-1,coords,dim_space);
}
if(isAbs)
std::transform(array->getPointer(),area_vol,array->getPointer(),std::ptr_fun<double,double>(fabs));
MCAuto<MEDCouplingFieldDouble> tmp=getMeasureField(isAbs);
std::string name="MeasureOnNodeOfMesh_";
name+=getName();
- int nbNodes=getNumberOfNodes();
+ mcIdType nbNodes=getNumberOfNodes();
MCAuto<DataArrayDouble> nnpc;
{
- MCAuto<DataArrayInt> tmp(computeNbOfNodesPerCell());
+ MCAuto<DataArrayIdType> tmp(computeNbOfNodesPerCell());
nnpc=tmp->convertToDblArr();
}
std::for_each(nnpc->rwBegin(),nnpc->rwEnd(),[](double& v) { v=1./v; });
double *valsToFill=array->getPointer();
std::fill(valsToFill,valsToFill+nbNodes,0.);
const double *values=tmp->getArray()->getConstPointer();
- MCAuto<DataArrayInt> da=DataArrayInt::New();
- MCAuto<DataArrayInt> daInd=DataArrayInt::New();
+ MCAuto<DataArrayIdType> da=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> daInd=DataArrayIdType::New();
getReverseNodalConnectivity(da,daInd);
- const int *daPtr=da->getConstPointer();
- const int *daIPtr=daInd->getConstPointer();
- for(int i=0;i<nbNodes;i++)
- for(const int *cell=daPtr+daIPtr[i];cell!=daPtr+daIPtr[i+1];cell++)
+ const mcIdType *daPtr=da->getConstPointer();
+ const mcIdType *daIPtr=daInd->getConstPointer();
+ for(mcIdType i=0;i<nbNodes;i++)
+ for(const mcIdType *cell=daPtr+daIPtr[i];cell!=daPtr+daIPtr[i+1];cell++)
valsToFill[i]+=nnpcPtr[*cell]*values[*cell];
ret->setMesh(this);
ret->setArray(array);
throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
MCAuto<DataArrayDouble> array=DataArrayDouble::New();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
int nbComp=getMeshDimension()+1;
array->alloc(nbOfCells,nbComp);
double *vals=array->getPointer();
- const int *connI=_nodal_connec_index->getConstPointer();
- const int *conn=_nodal_connec->getConstPointer();
+ const mcIdType *connI=_nodal_connec_index->getConstPointer();
+ const mcIdType *conn=_nodal_connec->getConstPointer();
const double *coords=_coords->getConstPointer();
if(getMeshDimension()==2)
{
{
MCAuto<DataArrayDouble> loc=computeCellCenterOfMass();
const double *locPtr=loc->getConstPointer();
- for(int i=0;i<nbOfCells;i++,vals+=3)
+ for(mcIdType i=0;i<nbOfCells;i++,vals+=3)
{
- int offset=connI[i];
+ mcIdType offset=connI[i];
INTERP_KERNEL::crossprod<3>(locPtr+3*i,coords+3*conn[offset+1],coords+3*conn[offset+2],vals);
double n=INTERP_KERNEL::norm<3>(vals);
std::transform(vals,vals+3,vals,std::bind2nd(std::multiplies<double>(),1./n));
{
MCAuto<MEDCouplingFieldDouble> isAbs=getMeasureField(false);
const double *isAbsPtr=isAbs->getArray()->begin();
- for(int i=0;i<nbOfCells;i++,isAbsPtr++)
+ for(mcIdType i=0;i<nbOfCells;i++,isAbsPtr++)
{ vals[3*i]=0.; vals[3*i+1]=0.; vals[3*i+2]=*isAbsPtr>0.?1.:-1.; }
}
}
else//meshdimension==1
{
double tmp[2];
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
- int offset=connI[i];
+ mcIdType offset=connI[i];
std::transform(coords+2*conn[offset+2],coords+2*conn[offset+2]+2,coords+2*conn[offset+1],tmp,std::minus<double>());
double n=INTERP_KERNEL::norm<2>(tmp);
std::transform(tmp,tmp+2,tmp,std::bind2nd(std::multiplies<double>(),1./n));
* \ref py_mcumesh_buildPartOrthogonalField "Here is a Python example".
* \endif
*/
-MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *begin, const int *end) const
+MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const mcIdType *begin, const mcIdType *end) const
{
if((getMeshDimension()!=2) && (getMeshDimension()!=1 || getSpaceDimension()!=2))
throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !");
MCAuto<DataArrayDouble> array=DataArrayDouble::New();
std::size_t nbelems=std::distance(begin,end);
int nbComp=getMeshDimension()+1;
- array->alloc((int)nbelems,nbComp);
+ array->alloc(nbelems,nbComp);
double *vals=array->getPointer();
- const int *connI=_nodal_connec_index->getConstPointer();
- const int *conn=_nodal_connec->getConstPointer();
+ const mcIdType *connI=_nodal_connec_index->getConstPointer();
+ const mcIdType *conn=_nodal_connec->getConstPointer();
const double *coords=_coords->getConstPointer();
if(getMeshDimension()==2)
{
{
MCAuto<DataArrayDouble> loc=getPartBarycenterAndOwner(begin,end);
const double *locPtr=loc->getConstPointer();
- for(const int *i=begin;i!=end;i++,vals+=3,locPtr+=3)
+ for(const mcIdType *i=begin;i!=end;i++,vals+=3,locPtr+=3)
{
- int offset=connI[*i];
+ mcIdType offset=connI[*i];
INTERP_KERNEL::crossprod<3>(locPtr,coords+3*conn[offset+1],coords+3*conn[offset+2],vals);
double n=INTERP_KERNEL::norm<3>(vals);
std::transform(vals,vals+3,vals,std::bind2nd(std::multiplies<double>(),1./n));
else//meshdimension==1
{
double tmp[2];
- for(const int *i=begin;i!=end;i++)
+ for(const mcIdType *i=begin;i!=end;i++)
{
- int offset=connI[*i];
+ mcIdType offset=connI[*i];
std::transform(coords+2*conn[offset+2],coords+2*conn[offset+2]+2,coords+2*conn[offset+1],tmp,std::minus<double>());
double n=INTERP_KERNEL::norm<2>(tmp);
std::transform(tmp,tmp+2,tmp,std::bind2nd(std::multiplies<double>(),1./n));
throw INTERP_KERNEL::Exception("Expected a umesh with only NORM_SEG2 type of elements for buildDirectionVectorField !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
MCAuto<DataArrayDouble> array=DataArrayDouble::New();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
int spaceDim=getSpaceDimension();
array->alloc(nbOfCells,spaceDim);
double *pt=array->getPointer();
const double *coo=getCoords()->getConstPointer();
- std::vector<int> conn;
+ std::vector<mcIdType> conn;
conn.reserve(2);
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
conn.resize(0);
getNodeIdsOfCell(i,conn);
/*!
* Creates a 2D mesh by cutting \a this 3D mesh with a plane. In addition to the mesh,
- * returns a new DataArrayInt, of length equal to the number of 2D cells in the result
+ * returns a new DataArrayIdType, of length equal to the number of 2D cells in the result
* mesh, holding, for each cell in the result mesh, an id of a 3D cell it comes
* from. If a result face is shared by two 3D cells, then the face in included twice in
* the result mesh.
* \param [in] vec - 3 components of a vector normal to the plane. Vector magnitude
* must be greater than 1e-6.
* \param [in] eps - half-thickness of the plane.
- * \param [out] cellIds - a new instance of DataArrayInt holding ids of 3D cells
+ * \param [out] cellIds - a new instance of DataArrayIdType holding ids of 3D cells
* producing correspondent 2D cells. The caller is to delete this array
* using decrRef() as it is no more needed.
* \return MEDCouplingUMesh * - a new instance of MEDCouplingUMesh. This mesh does
* \throw If the plane does not intersect any 3D cell of \a this mesh.
* \throw If \a this includes quadratic cells.
*/
-MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3D(const double *origin, const double *vec, double eps, DataArrayInt *&cellIds) const
+MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3D(const double *origin, const double *vec, double eps, DataArrayIdType *&cellIds) const
{
checkFullyDefined();
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D works on umeshes with meshdim equal to 3 and spaceDim equal to 3 too!");
- MCAuto<DataArrayInt> candidates=getCellIdsCrossingPlane(origin,vec,eps);
+ MCAuto<DataArrayIdType> candidates=getCellIdsCrossingPlane(origin,vec,eps);
if(candidates->empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D : No 3D cells in this intercepts the specified plane considering bounding boxes !");
- std::vector<int> nodes;
- DataArrayInt *cellIds1D=0;
+ std::vector<mcIdType> nodes;
+ DataArrayIdType *cellIds1D=0;
MCAuto<MEDCouplingUMesh> subMesh=static_cast<MEDCouplingUMesh*>(buildPartOfMySelf(candidates->begin(),candidates->end(),false));
subMesh->findNodesOnPlane(origin,vec,eps,nodes);
- MCAuto<DataArrayInt> desc1=DataArrayInt::New(),desc2=DataArrayInt::New();
- MCAuto<DataArrayInt> descIndx1=DataArrayInt::New(),descIndx2=DataArrayInt::New();
- MCAuto<DataArrayInt> revDesc1=DataArrayInt::New(),revDesc2=DataArrayInt::New();
- MCAuto<DataArrayInt> revDescIndx1=DataArrayInt::New(),revDescIndx2=DataArrayInt::New();
+ MCAuto<DataArrayIdType> desc1=DataArrayIdType::New(),desc2=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> descIndx1=DataArrayIdType::New(),descIndx2=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> revDesc1=DataArrayIdType::New(),revDesc2=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> revDescIndx1=DataArrayIdType::New(),revDescIndx2=DataArrayIdType::New();
MCAuto<MEDCouplingUMesh> mDesc2=subMesh->buildDescendingConnectivity(desc2,descIndx2,revDesc2,revDescIndx2);//meshDim==2 spaceDim==3
revDesc2=0; revDescIndx2=0;
MCAuto<MEDCouplingUMesh> mDesc1=mDesc2->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1);//meshDim==1 spaceDim==3
revDesc1=0; revDescIndx1=0;
mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D);
- MCAuto<DataArrayInt> cellIds1DTmp(cellIds1D);
+ MCAuto<DataArrayIdType> cellIds1DTmp(cellIds1D);
//
- std::vector<int> cut3DCurve(mDesc1->getNumberOfCells(),-2);
- for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++)
+ std::vector<mcIdType> cut3DCurve(mDesc1->getNumberOfCells(),-2);
+ for(const mcIdType *it=cellIds1D->begin();it!=cellIds1D->end();it++)
cut3DCurve[*it]=-1;
mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve);
- std::vector< std::pair<int,int> > cut3DSurf(mDesc2->getNumberOfCells());
+ std::vector< std::pair<mcIdType,mcIdType> > cut3DSurf(mDesc2->getNumberOfCells());
AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,mDesc2->getNodalConnectivity()->getConstPointer(),mDesc2->getNodalConnectivityIndex()->getConstPointer(),
mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(),
desc1->getConstPointer(),descIndx1->getConstPointer(),cut3DSurf);
- MCAuto<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New()),cellIds2(DataArrayInt::New());
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New()),connI(DataArrayIdType::New()),cellIds2(DataArrayIdType::New());
connI->pushBackSilent(0); conn->alloc(0,1); cellIds2->alloc(0,1);
subMesh->assemblyForSplitFrom3DSurf(cut3DSurf,desc2->getConstPointer(),descIndx2->getConstPointer(),conn,connI,cellIds2);
if(cellIds2->empty())
/*!
* Creates an 1D mesh by cutting \a this 2D mesh in 3D space with a plane. In
-addition to the mesh, returns a new DataArrayInt, of length equal to the number of 1D cells in the result mesh, holding, for each cell in the result mesh, an id of a 2D cell it comes
+addition to the mesh, returns a new DataArrayIdType, of length equal to the number of 1D cells in the result mesh, holding, for each cell in the result mesh, an id of a 2D cell it comes
from. If a result segment is shared by two 2D cells, then the segment in included twice in
the result mesh.
* \param [in] origin - 3 components of a point defining location of the plane.
* \param [in] vec - 3 components of a vector normal to the plane. Vector magnitude
* must be greater than 1e-6.
* \param [in] eps - half-thickness of the plane.
- * \param [out] cellIds - a new instance of DataArrayInt holding ids of faces
+ * \param [out] cellIds - a new instance of DataArrayIdType holding ids of faces
* producing correspondent segments. The caller is to delete this array
* using decrRef() as it is no more needed.
* \return MEDCouplingUMesh * - a new instance of MEDCouplingUMesh. This is an 1D
* \throw If the plane does not intersect any 2D cell of \a this mesh.
* \throw If \a this includes quadratic cells.
*/
-MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3DSurf(const double *origin, const double *vec, double eps, DataArrayInt *&cellIds) const
+MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3DSurf(const double *origin, const double *vec, double eps, DataArrayIdType *&cellIds) const
{
checkFullyDefined();
if(getMeshDimension()!=2 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3DSurf works on umeshes with meshdim equal to 2 and spaceDim equal to 3 !");
- MCAuto<DataArrayInt> candidates(getCellIdsCrossingPlane(origin,vec,eps));
+ MCAuto<DataArrayIdType> candidates(getCellIdsCrossingPlane(origin,vec,eps));
if(candidates->empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3DSurf : No 3D surf cells in this intercepts the specified plane considering bounding boxes !");
- std::vector<int> nodes;
- DataArrayInt *cellIds1D(0);
+ std::vector<mcIdType> nodes;
+ DataArrayIdType *cellIds1D(0);
MCAuto<MEDCouplingUMesh> subMesh(buildPartOfMySelf(candidates->begin(),candidates->end(),false));
subMesh->findNodesOnPlane(origin,vec,eps,nodes);
- MCAuto<DataArrayInt> desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New());
+ MCAuto<DataArrayIdType> desc1(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> mDesc1(subMesh->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1));//meshDim==1 spaceDim==3
mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D);
- MCAuto<DataArrayInt> cellIds1DTmp(cellIds1D);
+ MCAuto<DataArrayIdType> cellIds1DTmp(cellIds1D);
//
- std::vector<int> cut3DCurve(mDesc1->getNumberOfCells(),-2);
- for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++)
+ std::vector<mcIdType> cut3DCurve(mDesc1->getNumberOfCells(),-2);
+ for(const mcIdType *it=cellIds1D->begin();it!=cellIds1D->end();it++)
cut3DCurve[*it]=-1;
mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve);
- int ncellsSub=subMesh->getNumberOfCells();
- std::vector< std::pair<int,int> > cut3DSurf(ncellsSub);
+ mcIdType ncellsSub=subMesh->getNumberOfCells();
+ std::vector< std::pair<mcIdType,mcIdType> > cut3DSurf(ncellsSub);
AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,subMesh->getNodalConnectivity()->getConstPointer(),subMesh->getNodalConnectivityIndex()->getConstPointer(),
mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(),
desc1->getConstPointer(),descIndx1->getConstPointer(),cut3DSurf);
- MCAuto<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New()),cellIds2(DataArrayInt::New()); connI->pushBackSilent(0);
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New()),connI(DataArrayIdType::New()),cellIds2(DataArrayIdType::New()); connI->pushBackSilent(0);
conn->alloc(0,1);
- const int *nodal=subMesh->getNodalConnectivity()->getConstPointer();
- const int *nodalI=subMesh->getNodalConnectivityIndex()->getConstPointer();
- for(int i=0;i<ncellsSub;i++)
+ const mcIdType *nodal=subMesh->getNodalConnectivity()->getConstPointer();
+ const mcIdType *nodalI=subMesh->getNodalConnectivityIndex()->getConstPointer();
+ for(mcIdType i=0;i<ncellsSub;i++)
{
if(cut3DSurf[i].first!=-1 && cut3DSurf[i].second!=-1)
{
if(cut3DSurf[i].first!=-2)
{
- conn->pushBackSilent((int)INTERP_KERNEL::NORM_SEG2); conn->pushBackSilent(cut3DSurf[i].first); conn->pushBackSilent(cut3DSurf[i].second);
+ conn->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_SEG2)); conn->pushBackSilent(cut3DSurf[i].first); conn->pushBackSilent(cut3DSurf[i].second);
connI->pushBackSilent(conn->getNumberOfTuples());
cellIds2->pushBackSilent(i);
}
else
{
- int cellId3DSurf=cut3DSurf[i].second;
- int offset=nodalI[cellId3DSurf]+1;
- int nbOfEdges=nodalI[cellId3DSurf+1]-offset;
- for(int j=0;j<nbOfEdges;j++)
+ mcIdType cellId3DSurf=cut3DSurf[i].second;
+ mcIdType offset=nodalI[cellId3DSurf]+1;
+ mcIdType nbOfEdges=nodalI[cellId3DSurf+1]-offset;
+ for(mcIdType j=0;j<nbOfEdges;j++)
{
- conn->pushBackSilent((int)INTERP_KERNEL::NORM_SEG2); conn->pushBackSilent(nodal[offset+j]); conn->pushBackSilent(nodal[offset+(j+1)%nbOfEdges]);
+ conn->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_SEG2)); conn->pushBackSilent(nodal[offset+j]); conn->pushBackSilent(nodal[offset+(j+1)%nbOfEdges]);
connI->pushBackSilent(conn->getNumberOfTuples());
cellIds2->pushBackSilent(cellId3DSurf);
}
if(getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::clipSingle3DCellByPlane works only on mesh containing exactly one cell !");
//
- std::vector<int> nodes;
+ std::vector<mcIdType> nodes;
findNodesOnPlane(origin,vec,eps,nodes);
- MCAuto<DataArrayInt> desc1(DataArrayInt::New()),desc2(DataArrayInt::New()),descIndx1(DataArrayInt::New()),descIndx2(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDesc2(DataArrayInt::New()),revDescIndx1(DataArrayInt::New()),revDescIndx2(DataArrayInt::New());
+ MCAuto<DataArrayIdType> desc1(DataArrayIdType::New()),desc2(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),descIndx2(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDesc2(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New()),revDescIndx2(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> mDesc2(buildDescendingConnectivity(desc2,descIndx2,revDesc2,revDescIndx2));//meshDim==2 spaceDim==3
revDesc2=0; revDescIndx2=0;
MCAuto<MEDCouplingUMesh> mDesc1(mDesc2->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1));//meshDim==1 spaceDim==3
revDesc1=0; revDescIndx1=0;
- DataArrayInt *cellIds1D(0);
+ DataArrayIdType *cellIds1D(0);
mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D);
- MCAuto<DataArrayInt> cellIds1DTmp(cellIds1D);
- std::vector<int> cut3DCurve(mDesc1->getNumberOfCells(),-2);
- for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++)
+ MCAuto<DataArrayIdType> cellIds1DTmp(cellIds1D);
+ std::vector<mcIdType> cut3DCurve(mDesc1->getNumberOfCells(),-2);
+ for(const mcIdType *it=cellIds1D->begin();it!=cellIds1D->end();it++)
cut3DCurve[*it]=-1;
bool sameNbNodes;
{
- int oldNbNodes(mDesc1->getNumberOfNodes());
+ mcIdType oldNbNodes(mDesc1->getNumberOfNodes());
mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve);
sameNbNodes=(mDesc1->getNumberOfNodes()==oldNbNodes);
}
- std::vector< std::pair<int,int> > cut3DSurf(mDesc2->getNumberOfCells());
+ std::vector< std::pair<mcIdType,mcIdType> > cut3DSurf(mDesc2->getNumberOfCells());
AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,mDesc2->getNodalConnectivity()->begin(),mDesc2->getNodalConnectivityIndex()->begin(),
mDesc1->getNodalConnectivity()->begin(),mDesc1->getNodalConnectivityIndex()->begin(),
desc1->begin(),descIndx1->begin(),cut3DSurf);
- MCAuto<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New()),connI(DataArrayIdType::New());
connI->pushBackSilent(0); conn->alloc(0,1);
{
- MCAuto<DataArrayInt> cellIds2(DataArrayInt::New()); cellIds2->alloc(0,1);
+ MCAuto<DataArrayIdType> cellIds2(DataArrayIdType::New()); cellIds2->alloc(0,1);
assemblyForSplitFrom3DSurf(cut3DSurf,desc2->begin(),descIndx2->begin(),conn,connI,cellIds2);
if(cellIds2->empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D : No 3D cells in this intercepts the specified plane !");
}
- std::vector<std::vector<int> > res;
+ std::vector<std::vector<mcIdType> > res;
buildSubCellsFromCut(cut3DSurf,desc2->begin(),descIndx2->begin(),mDesc1->getCoords()->begin(),eps,res);
std::size_t sz(res.size());
- if(res.size()==mDesc1->getNumberOfCells() && sameNbNodes)
+ if(ToIdType(res.size())==mDesc1->getNumberOfCells() && sameNbNodes)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::clipSingle3DCellByPlane : cell is not clipped !");
for(std::size_t i=0;i<sz;i++)
{
- conn->pushBackSilent((int)INTERP_KERNEL::NORM_POLYGON);
+ conn->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_POLYGON));
conn->insertAtTheEnd(res[i].begin(),res[i].end());
connI->pushBackSilent(conn->getNumberOfTuples());
}
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("",2));
ret->setCoords(mDesc1->getCoords());
ret->setConnectivity(conn,connI,true);
- int nbCellsRet(ret->getNumberOfCells());
+ mcIdType nbCellsRet(ret->getNumberOfCells());
//
MCAuto<DataArrayDouble> vec2(DataArrayDouble::New()); vec2->alloc(1,3); std::copy(vec,vec+3,vec2->getPointer());
MCAuto<MEDCouplingFieldDouble> ortho(ret->buildOrthogonalField());
vec2->setPartOfValuesSimple1(vec[0],0,nbCellsRet,1,0,1,1); vec2->setPartOfValuesSimple1(vec[1],0,nbCellsRet,1,1,2,1); vec2->setPartOfValuesSimple1(vec[2],0,nbCellsRet,1,2,3,1);
MCAuto<DataArrayDouble> dott2(DataArrayDouble::Dot(occm,vec2));
//
- const int *cPtr(ret->getNodalConnectivity()->begin()),*ciPtr(ret->getNodalConnectivityIndex()->begin());
+ const mcIdType *cPtr(ret->getNodalConnectivity()->begin()),*ciPtr(ret->getNodalConnectivityIndex()->begin());
MCAuto<MEDCouplingUMesh> ret2(MEDCouplingUMesh::New("Clip3D",3));
ret2->setCoords(mDesc1->getCoords());
- MCAuto<DataArrayInt> conn2(DataArrayInt::New()),conn2I(DataArrayInt::New());
+ MCAuto<DataArrayIdType> conn2(DataArrayIdType::New()),conn2I(DataArrayIdType::New());
conn2I->pushBackSilent(0); conn2->alloc(0,1);
- std::vector<int> cell0(1,(int)INTERP_KERNEL::NORM_POLYHED);
- std::vector<int> cell1(1,(int)INTERP_KERNEL::NORM_POLYHED);
+ std::vector<mcIdType> cell0(1,ToIdType(INTERP_KERNEL::NORM_POLYHED));
+ std::vector<mcIdType> cell1(1,ToIdType(INTERP_KERNEL::NORM_POLYHED));
if(dott->getIJ(0,0)>0)
{
cell0.insert(cell0.end(),cPtr+1,cPtr+ciPtr[1]);
cell1.insert(cell1.end(),cPtr+1,cPtr+ciPtr[1]);
std::reverse_copy(cPtr+1,cPtr+ciPtr[1],std::inserter(cell0,cell0.end()));
}
- for(int i=1;i<nbCellsRet;i++)
+ for(mcIdType i=1;i<nbCellsRet;i++)
{
if(dott2->getIJ(i,0)<0)
{
* \param [in] vec - 3 components of a vector normal to the plane. Vector magnitude
* must be greater than 1e-6.
* \param [in] eps - half-thickness of the plane.
- * \return DataArrayInt * - a new instance of DataArrayInt holding ids of the found
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of the found
* cells. The caller is to delete this array using decrRef() as it is no more
* needed.
* \throw If the coordinates array is not set.
* \throw If magnitude of \a vec is less than 1e-6.
* \sa buildSlice3D()
*/
-DataArrayInt *MEDCouplingUMesh::getCellIdsCrossingPlane(const double *origin, const double *vec, double eps) const
+DataArrayIdType *MEDCouplingUMesh::getCellIdsCrossingPlane(const double *origin, const double *vec, double eps) const
{
checkFullyDefined();
if(getSpaceDimension()!=3)
double vec2[3];
vec2[0]=vec[1]; vec2[1]=-vec[0]; vec2[2]=0.;//vec2 is the result of cross product of vec with (0,0,1)
double angle=acos(vec[2]/normm);
- MCAuto<DataArrayInt> cellIds;
+ MCAuto<DataArrayIdType> cellIds;
double bbox[6];
if(angle>eps)
{
{
if(getMeshDimension()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::isContiguous1D : this method has a sense only for 1D mesh !");
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=getNumberOfCells();
if(nbCells<1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::isContiguous1D : this method has a sense for non empty mesh !");
- const int *connI(_nodal_connec_index->begin()),*conn(_nodal_connec->begin());
- int ref=conn[connI[0]+2];
- for(int i=1;i<nbCells;i++)
+ const mcIdType *connI(_nodal_connec_index->begin()),*conn(_nodal_connec->begin());
+ mcIdType ref=conn[connI[0]+2];
+ for(mcIdType i=1;i<nbCells;i++)
{
if(conn[connI[i]+1]!=ref)
return false;
MCAuto<MEDCouplingFieldDouble> f=buildDirectionVectorField();
const double *fPtr=f->getArray()->getConstPointer();
double tmp[3];
- for(std::size_t i=0;i<getNumberOfCells();i++)
+ for(mcIdType i=0;i<getNumberOfCells();i++)
{
const double *tmp1=fPtr+3*i;
tmp[0]=tmp1[1]*v[2]-tmp1[2]*v[1];
throw INTERP_KERNEL::Exception("UMesh::Projection 1D failed !");
}
const double *coo=getCoords()->getConstPointer();
- for(int i=0;i<getNumberOfNodes();i++)
+ for(mcIdType i=0;i<getNumberOfNodes();i++)
{
std::transform(coo+i*3,coo+i*3+3,pt,tmp,std::minus<double>());
std::transform(tmp,tmp+3,v,tmp,std::multiplies<double>());
* dimension - 1.
* \sa DataArrayDouble::distanceToTuple, MEDCouplingUMesh::distanceToPoints
*/
-double MEDCouplingUMesh::distanceToPoint(const double *ptBg, const double *ptEnd, int& cellId) const
+double MEDCouplingUMesh::distanceToPoint(const double *ptBg, const double *ptEnd, mcIdType& cellId) const
{
int meshDim=getMeshDimension(),spaceDim=getSpaceDimension();
if(meshDim!=spaceDim-1)
if(meshDim!=2 && meshDim!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoint : only mesh dimension 2 and 1 are implemented !");
checkFullyDefined();
- if((int)std::distance(ptBg,ptEnd)!=spaceDim)
+ if(ToIdType(std::distance(ptBg,ptEnd))!=spaceDim)
{ std::ostringstream oss; oss << "MEDCouplingUMesh::distanceToPoint : input point has to have dimension equal to the space dimension of this (" << spaceDim << ") !"; throw INTERP_KERNEL::Exception(oss.str()); }
- DataArrayInt *ret1=0;
+ DataArrayIdType *ret1=0;
MCAuto<DataArrayDouble> pts=DataArrayDouble::New(); pts->useArray(ptBg,false,DeallocType::C_DEALLOC,1,spaceDim);
MCAuto<DataArrayDouble> ret0=distanceToPoints(pts,ret1);
- MCAuto<DataArrayInt> ret1Safe(ret1);
+ MCAuto<DataArrayIdType> ret1Safe(ret1);
cellId=*ret1Safe->begin();
return *ret0->begin();
}
* \throw if mesh dimension of \a this is not equal to space dimension - 1.
* \sa DataArrayDouble::distanceToTuple, MEDCouplingUMesh::distanceToPoint
*/
-DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, DataArrayInt *& cellIds) const
+DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, DataArrayIdType *& cellIds) const
{
if(!pts)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : input points pointer is NULL !");
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints works only for spaceDim=meshDim+1 !");
if(meshDim!=2 && meshDim!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : only mesh dimension 2 and 1 are implemented !");
- if((int)pts->getNumberOfComponents()!=spaceDim)
+ if(ToIdType(pts->getNumberOfComponents())!=spaceDim)
{
std::ostringstream oss; oss << "MEDCouplingUMesh::distanceToPoints : input pts DataArrayDouble has " << pts->getNumberOfComponents() << " components whereas it should be equal to " << spaceDim << " (mesh spaceDimension) !";
throw INTERP_KERNEL::Exception(oss.str());
}
checkFullyDefined();
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=getNumberOfCells();
if(nbCells==0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : no cells in this !");
- int nbOfPts=pts->getNumberOfTuples();
+ mcIdType nbOfPts=pts->getNumberOfTuples();
MCAuto<DataArrayDouble> ret0=DataArrayDouble::New(); ret0->alloc(nbOfPts,1);
- MCAuto<DataArrayInt> ret1=DataArrayInt::New(); ret1->alloc(nbOfPts,1);
- const int *nc=_nodal_connec->begin(),*ncI=_nodal_connec_index->begin(); const double *coords=_coords->begin();
- double *ret0Ptr=ret0->getPointer(); int *ret1Ptr=ret1->getPointer(); const double *ptsPtr=pts->begin();
+ MCAuto<DataArrayIdType> ret1=DataArrayIdType::New(); ret1->alloc(nbOfPts,1);
+ const mcIdType *nc=_nodal_connec->begin(),*ncI=_nodal_connec_index->begin(); const double *coords=_coords->begin();
+ double *ret0Ptr=ret0->getPointer(); mcIdType *ret1Ptr=ret1->getPointer(); const double *ptsPtr=pts->begin();
MCAuto<DataArrayDouble> bboxArr(getBoundingBoxForBBTree());
const double *bbox(bboxArr->begin());
switch(spaceDim)
case 3:
{
BBTreeDst<3> myTree(bbox,0,0,nbCells);
- for(int i=0;i<nbOfPts;i++,ret0Ptr++,ret1Ptr++,ptsPtr+=3)
+ for(mcIdType i=0;i<nbOfPts;i++,ret0Ptr++,ret1Ptr++,ptsPtr+=3)
{
double x=std::numeric_limits<double>::max();
- std::vector<int> elems;
+ std::vector<mcIdType> elems;
myTree.getMinDistanceOfMax(ptsPtr,x);
myTree.getElemsWhoseMinDistanceToPtSmallerThan(ptsPtr,x,elems);
DistanceToPoint3DSurfAlg(ptsPtr,&elems[0],&elems[0]+elems.size(),coords,nc,ncI,*ret0Ptr,*ret1Ptr);
case 2:
{
BBTreeDst<2> myTree(bbox,0,0,nbCells);
- for(int i=0;i<nbOfPts;i++,ret0Ptr++,ret1Ptr++,ptsPtr+=2)
+ for(mcIdType i=0;i<nbOfPts;i++,ret0Ptr++,ret1Ptr++,ptsPtr+=2)
{
double x=std::numeric_limits<double>::max();
- std::vector<int> elems;
+ std::vector<mcIdType> elems;
myTree.getMinDistanceOfMax(ptsPtr,x);
myTree.getElemsWhoseMinDistanceToPtSmallerThan(ptsPtr,x,elems);
DistanceToPoint2DCurveAlg(ptsPtr,&elems[0],&elems[0]+elems.size(),coords,nc,ncI,*ret0Ptr,*ret1Ptr);
* faster.
* \param [in] pos - array of coordinates of the ball central point.
* \param [in] eps - ball radius.
- * \return int - a smallest id of cells being in contact with the ball, -1 in case
+ * \return mcIdType - a smallest id of cells being in contact with the ball, -1 in case
* if there are no such cells.
* \throw If the coordinates array is not set.
* \throw If \a this->getMeshDimension() != \a this->getSpaceDimension().
*/
-int MEDCouplingUMesh::getCellContainingPoint(const double *pos, double eps) const
+mcIdType MEDCouplingUMesh::getCellContainingPoint(const double *pos, double eps) const
{
- std::vector<int> elts;
+ std::vector<mcIdType> elts;
getCellsContainingPoint(pos,eps,elts);
if(elts.empty())
return -1;
* \ref py_mcumesh_getCellsContainingPoint "Here is a Python example".
* \endif
*/
-void MEDCouplingUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const
+void MEDCouplingUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const
{
- MCAuto<DataArrayInt> eltsUg,eltsIndexUg;
+ MCAuto<DataArrayIdType> eltsUg,eltsIndexUg;
getCellsContainingPoints(pos,1,eps,eltsUg,eltsIndexUg);
elts.clear(); elts.insert(elts.end(),eltsUg->begin(),eltsUg->end());
}
-void MEDCouplingUMesh::getCellsContainingPointsZeAlg(const double *pos, int nbOfPoints, double eps,
- MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex,
- std::function<bool(INTERP_KERNEL::NormalizedCellType,int)> sensibilityTo2DQuadraticLinearCellsFunc) const
+void MEDCouplingUMesh::getCellsContainingPointsZeAlg(const double *pos, mcIdType nbOfPoints, double eps,
+ MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex,
+ std::function<bool(INTERP_KERNEL::NormalizedCellType,mcIdType)> sensibilityTo2DQuadraticLinearCellsFunc) const
{
int spaceDim(getSpaceDimension()),mDim(getMeshDimension());
if(spaceDim==3)
* \ref py_mcumesh_getCellsContainingPoints "Here is a Python example".
* \endif
*/
-void MEDCouplingUMesh::getCellsContainingPoints(const double *pos, int nbOfPoints, double eps,
- MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex) const
+void MEDCouplingUMesh::getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps,
+ MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const
{
auto yesImSensibleTo2DQuadraticLinearCellsFunc([](INTERP_KERNEL::NormalizedCellType ct, int mdim) { return INTERP_KERNEL::CellModel::GetCellModel(ct).isQuadratic() && mdim == 2; } );
this->getCellsContainingPointsZeAlg(pos,nbOfPoints,eps,elts,eltsIndex,yesImSensibleTo2DQuadraticLinearCellsFunc);
*
* \sa MEDCouplingUMesh::getCellsContainingPoints, MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss
*/
-void MEDCouplingUMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, int nbOfPoints, double eps, MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex) const
+void MEDCouplingUMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, mcIdType nbOfPoints, double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const
{
- auto noImNotSensibleTo2DQuadraticLinearCellsFunc([](INTERP_KERNEL::NormalizedCellType,int) { return false; } );
+ auto noImNotSensibleTo2DQuadraticLinearCellsFunc([](INTERP_KERNEL::NormalizedCellType,mcIdType) { return false; } );
this->getCellsContainingPointsZeAlg(pos,nbOfPoints,eps,elts,eltsIndex,noImNotSensibleTo2DQuadraticLinearCellsFunc);
}
* \throw If \a this->getMeshDimension() != 2.
* \throw If \a this->getSpaceDimension() != 2 && \a this->getSpaceDimension() != 3.
*/
-void MEDCouplingUMesh::checkButterflyCells(std::vector<int>& cells, double eps) const
+void MEDCouplingUMesh::checkButterflyCells(std::vector<mcIdType>& cells, double eps) const
{
const char msg[]="Butterfly detection work only for 2D cells with spaceDim==2 or 3!";
if(getMeshDimension()!=2)
int spaceDim=getSpaceDimension();
if(spaceDim!=2 && spaceDim!=3)
throw INTERP_KERNEL::Exception(msg);
- const int *conn=_nodal_connec->getConstPointer();
- const int *connI=_nodal_connec_index->getConstPointer();
- int nbOfCells=getNumberOfCells();
+ const mcIdType *conn=_nodal_connec->getConstPointer();
+ const mcIdType *connI=_nodal_connec_index->getConstPointer();
+ mcIdType nbOfCells=getNumberOfCells();
std::vector<double> cell2DinS2;
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
- int offset=connI[i];
- int nbOfNodesForCell=connI[i+1]-offset-1;
+ mcIdType offset=connI[i];
+ mcIdType nbOfNodesForCell=connI[i+1]-offset-1;
if(nbOfNodesForCell<=3)
continue;
bool isQuad=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[offset]).isQuadratic();
* \return a newly allocated array containing cellIds that have been modified if any. If no cells have been impacted by this method NULL is returned.
* \sa MEDCouplingUMesh::colinearize2D
*/
-DataArrayInt *MEDCouplingUMesh::convexEnvelop2D()
+DataArrayIdType *MEDCouplingUMesh::convexEnvelop2D()
{
if(getMeshDimension()!=2 || getSpaceDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convexEnvelop2D works only for meshDim=2 and spaceDim=2 !");
checkFullyDefined();
const double *coords=getCoords()->getConstPointer();
- int nbOfCells=getNumberOfCells();
- MCAuto<DataArrayInt> nodalConnecIndexOut=DataArrayInt::New();
+ mcIdType nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> nodalConnecIndexOut=DataArrayIdType::New();
nodalConnecIndexOut->alloc(nbOfCells+1,1);
- MCAuto<DataArrayInt> nodalConnecOut(DataArrayInt::New());
- int *workIndexOut=nodalConnecIndexOut->getPointer();
+ MCAuto<DataArrayIdType> nodalConnecOut(DataArrayIdType::New());
+ mcIdType *workIndexOut=nodalConnecIndexOut->getPointer();
*workIndexOut=0;
- const int *nodalConnecIn=_nodal_connec->getConstPointer();
- const int *nodalConnecIndexIn=_nodal_connec_index->getConstPointer();
+ const mcIdType *nodalConnecIn=_nodal_connec->getConstPointer();
+ const mcIdType *nodalConnecIndexIn=_nodal_connec_index->getConstPointer();
std::set<INTERP_KERNEL::NormalizedCellType> types;
- MCAuto<DataArrayInt> isChanged(DataArrayInt::New());
+ MCAuto<DataArrayIdType> isChanged(DataArrayIdType::New());
isChanged->alloc(0,1);
- for(int i=0;i<nbOfCells;i++,workIndexOut++)
+ for(mcIdType i=0;i<nbOfCells;i++,workIndexOut++)
{
- int pos=nodalConnecOut->getNumberOfTuples();
+ mcIdType pos=nodalConnecOut->getNumberOfTuples();
if(BuildConvexEnvelopOf2DCellJarvis(coords,nodalConnecIn+nodalConnecIndexIn[i],nodalConnecIn+nodalConnecIndexIn[i+1],nodalConnecOut))
isChanged->pushBackSilent(i);
types.insert((INTERP_KERNEL::NormalizedCellType)nodalConnecOut->getIJ(pos,0));
else
throw INTERP_KERNEL::Exception("Invalid 2D mesh and 1D mesh because 2D mesh has quadratic cells and 1D is not fully quadratic !");
}
- int oldNbOfNodes(getNumberOfNodes());
+ mcIdType oldNbOfNodes(getNumberOfNodes());
MCAuto<DataArrayDouble> newCoords;
switch(policy)
{
{
checkFullyDefined();
bool ret=true;
- int nbOfCells=getNumberOfCells();
- for(int i=0;i<nbOfCells && ret;i++)
+ mcIdType nbOfCells=getNumberOfCells();
+ for(mcIdType i=0;i<nbOfCells && ret;i++)
{
INTERP_KERNEL::NormalizedCellType type=getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
{
checkFullyDefined();
bool ret=false;
- int nbOfCells=getNumberOfCells();
- for(int i=0;i<nbOfCells && !ret;i++)
+ mcIdType nbOfCells=getNumberOfCells();
+ for(mcIdType i=0;i<nbOfCells && !ret;i++)
{
INTERP_KERNEL::NormalizedCellType type=getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
void MEDCouplingUMesh::convertQuadraticCellsToLinear()
{
checkFullyDefined();
- int nbOfCells(getNumberOfCells());
- int delta=0;
- const int *iciptr=_nodal_connec_index->begin();
- for(int i=0;i<nbOfCells;i++)
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType delta=0;
+ const mcIdType *iciptr=_nodal_connec_index->begin();
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
}
if(delta==0)
return ;
- MCAuto<DataArrayInt> newConn(DataArrayInt::New()),newConnI(DataArrayInt::New());
- const int *icptr(_nodal_connec->begin());
+ MCAuto<DataArrayIdType> newConn(DataArrayIdType::New()),newConnI(DataArrayIdType::New());
+ const mcIdType *icptr(_nodal_connec->begin());
newConn->alloc(getNodalConnectivityArrayLen()-delta,1);
newConnI->alloc(nbOfCells+1,1);
- int *ocptr(newConn->getPointer()),*ociptr(newConnI->getPointer());
+ mcIdType *ocptr(newConn->getPointer()),*ociptr(newConnI->getPointer());
*ociptr=0;
_types.clear();
- for(int i=0;i<nbOfCells;i++,ociptr++)
+ for(mcIdType i=0;i<nbOfCells;i++,ociptr++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)icptr[iciptr[i]];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
INTERP_KERNEL::NormalizedCellType typel=cm.getLinearType();
_types.insert(typel);
const INTERP_KERNEL::CellModel& cml=INTERP_KERNEL::CellModel::GetCellModel(typel);
- int newNbOfNodes=cml.getNumberOfNodes();
+ mcIdType newNbOfNodes=cml.getNumberOfNodes();
if(cml.isDynamic())
newNbOfNodes=(iciptr[i+1]-iciptr[i]-1)/2;
- *ocptr++=(int)typel;
+ *ocptr++=ToIdType(typel);
ocptr=std::copy(icptr+iciptr[i]+1,icptr+iciptr[i]+newNbOfNodes+1,ocptr);
ociptr[1]=ociptr[0]+newNbOfNodes+1;
}
*
* \param [in] conversionType specifies the type of conversion expected. Only 0 (default) and 1 are supported presently. 0 those that creates the 'most' simple
* corresponding quadratic cells. 1 is those creating the 'most' complex.
- * \return a newly created DataArrayInt instance that the caller should deal with containing cell ids of converted cells.
+ * \return a newly created DataArrayIdType instance that the caller should deal with containing cell ids of converted cells.
*
* \throw if \a this is not fully defined. It throws too if \a conversionType is not in [0,1].
*
* \sa MEDCouplingUMesh::convertQuadraticCellsToLinear
*/
-DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic(int conversionType)
+DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic(int conversionType)
{
- DataArrayInt *conn=0,*connI=0;
+ DataArrayIdType *conn=0,*connI=0;
DataArrayDouble *coords=0;
std::set<INTERP_KERNEL::NormalizedCellType> types;
checkFullyDefined();
- MCAuto<DataArrayInt> ret,connSafe,connISafe;
+ MCAuto<DataArrayIdType> ret,connSafe,connISafe;
MCAuto<DataArrayDouble> coordsSafe;
int meshDim=getMeshDimension();
switch(conversionType)
*
* \sa buildDescendingConnectivity2
*/
-void MEDCouplingUMesh::splitSomeEdgesOf2DMesh(const DataArrayInt *nodeIdsToAdd, const DataArrayInt *nodeIdsIndexToAdd, const DataArrayInt *edgeIdsToBeSplit,
- const MEDCouplingUMesh *mesh1Desc, const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI)
+void MEDCouplingUMesh::splitSomeEdgesOf2DMesh(const DataArrayIdType *nodeIdsToAdd, const DataArrayIdType *nodeIdsIndexToAdd, const DataArrayIdType *edgeIdsToBeSplit,
+ const MEDCouplingUMesh *mesh1Desc, const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI)
{
if(!nodeIdsToAdd || !nodeIdsIndexToAdd || !edgeIdsToBeSplit || !mesh1Desc || !desc || !descI || !revDesc || !revDescI)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitSomeEdgesOf2DMesh : input pointers must be not NULL !");
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitSomeEdgesOf2DMesh : this must have spacedim=meshdim=2 !");
if(mesh1Desc->getSpaceDimension()!=2 || mesh1Desc->getMeshDimension()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitSomeEdgesOf2DMesh : mesh1Desc must be the explosion of this with spaceDim=2 and meshDim = 1 !");
- //DataArrayInt *out0(0),*outi0(0);
+ //DataArrayIdType *out0(0),*outi0(0);
//MEDCouplingUMesh::ExtractFromIndexedArrays(idsInDesc2DToBeRefined->begin(),idsInDesc2DToBeRefined->end(),dd3,dd4,out0,outi0);
- //MCAuto<DataArrayInt> out0s(out0),outi0s(outi0);
+ //MCAuto<DataArrayIdType> out0s(out0),outi0s(outi0);
//out0s=out0s->buildUnique(); out0s->sort(true);
}
#endif
* - INTERP_KERNEL::PLANAR_FACE_6 - to split HEXA8 into 6 TETRA4 (for 3D mesh only - see INTERP_KERNEL::SplittingPolicy for an image).
*
*
- * \return DataArrayInt * - a new instance of DataArrayInt holding, for each new cell,
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding, for each new cell,
* an id of old cell producing it. The caller is to delete this array using
* decrRef() as it is no more needed.
*
* \throw If the nodal connectivity of cells is not defined.
* \sa MEDCouplingUMesh::tetrahedrize, MEDCoupling1SGTUMesh::sortHexa8EachOther
*/
-DataArrayInt *MEDCouplingUMesh::simplexize(int policy)
+DataArrayIdType *MEDCouplingUMesh::simplexize(int policy)
{
switch(policy)
{
return simplexizePol0();
case 1:
return simplexizePol1();
- case (int) INTERP_KERNEL::PLANAR_FACE_5:
+ case INTERP_KERNEL::PLANAR_FACE_5:
return simplexizePlanarFace5();
- case (int) INTERP_KERNEL::PLANAR_FACE_6:
+ case INTERP_KERNEL::PLANAR_FACE_6:
return simplexizePlanarFace6();
default:
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexize : unrecognized policy ! Must be :\n - 0 or 1 (only available for meshdim=2) \n - PLANAR_FACE_5, PLANAR_FACE_6 (only for meshdim=3)");
int mdim=getMeshDimension();
if(mdim<1 || mdim>3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::areOnlySimplexCells : only available with meshes having a meshdim 1, 2 or 3 !");
- int nbCells=getNumberOfCells();
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
- for(int i=0;i<nbCells;i++)
+ mcIdType nbCells=getNumberOfCells();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
+ for(mcIdType i=0;i<nbCells;i++)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
if(!cm.isSimplex())
checkFullyDefined();
if(getMeshDimension()<=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertDegeneratedCells works on umeshes with meshdim equals to 2 or 3 !");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(nbOfCells<1)
return ;
- int initMeshLgth=getNodalConnectivityArrayLen();
- int *conn=_nodal_connec->getPointer();
- int *index=_nodal_connec_index->getPointer();
- int posOfCurCell=0;
- int newPos=0;
- int lgthOfCurCell;
- for(int i=0;i<nbOfCells;i++)
+ mcIdType initMeshLgth=getNodalConnectivityArrayLen();
+ mcIdType *conn=_nodal_connec->getPointer();
+ mcIdType *index=_nodal_connec_index->getPointer();
+ mcIdType posOfCurCell=0;
+ mcIdType newPos=0;
+ mcIdType lgthOfCurCell;
+ for(mcIdType i=0;i<nbOfCells;i++)
{
lgthOfCurCell=index[i+1]-posOfCurCell;
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[posOfCurCell];
- int newLgth;
+ mcIdType newLgth;
INTERP_KERNEL::NormalizedCellType newType=INTERP_KERNEL::CellSimplify::simplifyDegeneratedCell(type,conn+posOfCurCell+1,lgthOfCurCell-1,
conn+newPos+1,newLgth);
conn[newPos]=newType;
* - for a linear cell, all points in the connectivity are equal
* - for a quadratic cell, either the above, or a quadratic polygon with two (linear) points and two
* identical quadratic points
- * \return a new instance of DataArrayInt holding ids of removed cells. The caller is to delete
+ * \return a new instance of DataArrayIdType holding ids of removed cells. The caller is to delete
* this array using decrRef() as it is no more needed.
*/
-DataArrayInt *MEDCouplingUMesh::convertDegeneratedCellsAndRemoveFlatOnes()
+DataArrayIdType *MEDCouplingUMesh::convertDegeneratedCellsAndRemoveFlatOnes()
{
checkFullyDefined();
if(getMeshDimension()<=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertDegeneratedCells works on umeshes with meshdim equals to 2 or 3 !");
- int nbOfCells=getNumberOfCells();
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ mcIdType nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
if(nbOfCells<1)
return ret.retn();
- int initMeshLgth=getNodalConnectivityArrayLen();
- int *conn=_nodal_connec->getPointer();
- int *index=_nodal_connec_index->getPointer();
- int posOfCurCell=0;
- int newPos=0;
- int lgthOfCurCell, nbDelCells(0);
- for(int i=0;i<nbOfCells;i++)
+ mcIdType initMeshLgth=getNodalConnectivityArrayLen();
+ mcIdType *conn=_nodal_connec->getPointer();
+ mcIdType *index=_nodal_connec_index->getPointer();
+ mcIdType posOfCurCell=0;
+ mcIdType newPos=0;
+ mcIdType lgthOfCurCell, nbDelCells(0);
+ for(mcIdType i=0;i<nbOfCells;i++)
{
lgthOfCurCell=index[i+1]-posOfCurCell;
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[posOfCurCell];
- int newLgth;
+ mcIdType newLgth;
INTERP_KERNEL::NormalizedCellType newType=INTERP_KERNEL::CellSimplify::simplifyDegeneratedCell(type,conn+posOfCurCell+1,lgthOfCurCell-1,
conn+newPos+1,newLgth);
// Shall we delete the cell if it is completely degenerated:
}
if(newPos!=initMeshLgth)
_nodal_connec->reAlloc(newPos);
- const int nCellDel=ret->getNumberOfTuples();
+ const mcIdType nCellDel=ret->getNumberOfTuples();
if (nCellDel)
_nodal_connec_index->reAlloc(nbOfCells-nCellDel+1);
computeTypes();
if(getMeshDimension()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::removeDegenerated1DCells works on umeshes with meshdim equals to 1 !");
std::size_t nbCells(getNumberOfCells()),newSize(0),newSize2(0);
- const int *conn(getNodalConnectivity()->begin()),*conni(getNodalConnectivityIndex()->begin());
+ const mcIdType *conn(getNodalConnectivity()->begin()),*conni(getNodalConnectivityIndex()->begin());
{
for(std::size_t i=0;i<nbCells;i++)
{
}
if(newSize==nbCells)//no cells has been removed -> do nothing
return false;
- MCAuto<DataArrayInt> newConn(DataArrayInt::New()),newConnI(DataArrayInt::New()); newConnI->alloc(newSize+1,1); newConn->alloc(newSize2,1);
- int *newConnPtr(newConn->getPointer()),*newConnIPtr(newConnI->getPointer()); newConnIPtr[0]=0;
+ MCAuto<DataArrayIdType> newConn(DataArrayIdType::New()),newConnI(DataArrayIdType::New()); newConnI->alloc(newSize+1,1); newConn->alloc(newSize2,1);
+ mcIdType *newConnPtr(newConn->getPointer()),*newConnIPtr(newConnI->getPointer()); newConnIPtr[0]=0;
for(std::size_t i=0;i<nbCells;i++)
{
if(conn[conni[i]+1]!=conn[conni[i]+2])
* \ref py_mcumesh_are2DCellsNotCorrectlyOriented "Here is a Python example".
* \endif
*/
-void MEDCouplingUMesh::are2DCellsNotCorrectlyOriented(const double *vec, bool polyOnly, std::vector<int>& cells) const
+void MEDCouplingUMesh::are2DCellsNotCorrectlyOriented(const double *vec, bool polyOnly, std::vector<mcIdType>& cells) const
{
if(getMeshDimension()!=2 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply are2DCellsNotCorrectlyOriented on it : must be meshDim==2 and spaceDim==3 !");
- int nbOfCells=getNumberOfCells();
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
+ mcIdType nbOfCells=getNumberOfCells();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
const double *coordsPtr=_coords->begin();
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[connI[i]];
if(!polyOnly || (type==INTERP_KERNEL::NORM_POLYGON || type==INTERP_KERNEL::NORM_QPOLYG))
{
if(getMeshDimension()!=2 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply orientCorrectly2DCells on it : must be meshDim==2 and spaceDim==3 !");
- int nbOfCells(getNumberOfCells()),*conn(_nodal_connec->getPointer());
- const int *connI(_nodal_connec_index->begin());
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType *conn(_nodal_connec->getPointer());
+ const mcIdType *connI(_nodal_connec_index->begin());
const double *coordsPtr(_coords->begin());
bool isModified(false);
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
if(!polyOnly || (type==INTERP_KERNEL::NORM_POLYGON || type==INTERP_KERNEL::NORM_QPOLYG))
int mdim(getMeshDimension());
if(mdim!=2 && mdim!=1)
throw INTERP_KERNEL::Exception("Invalid mesh to apply changeOrientationOfCells on it : must be meshDim==2 or meshDim==1 !");
- int nbOfCells(getNumberOfCells()),*conn(_nodal_connec->getPointer());
- const int *connI(_nodal_connec_index->begin());
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType *conn(_nodal_connec->getPointer());
+ const mcIdType *connI(_nodal_connec_index->begin());
if(mdim==2)
{//2D
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
}
else
{//1D
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
* \ref py_mcumesh_arePolyhedronsNotCorrectlyOriented "Here is a Python example".
* \endif
*/
-void MEDCouplingUMesh::arePolyhedronsNotCorrectlyOriented(std::vector<int>& cells) const
+void MEDCouplingUMesh::arePolyhedronsNotCorrectlyOriented(std::vector<mcIdType>& cells) const
{
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply arePolyhedronsNotCorrectlyOriented on it : must be meshDim==3 and spaceDim==3 !");
- int nbOfCells=getNumberOfCells();
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
+ mcIdType nbOfCells=getNumberOfCells();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
const double *coordsPtr=_coords->begin();
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[connI[i]];
if(type==INTERP_KERNEL::NORM_POLYHED)
{
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply orientCorrectlyPolyhedrons on it : must be meshDim==3 and spaceDim==3 !");
- int nbOfCells=getNumberOfCells();
- int *conn=_nodal_connec->getPointer();
- const int *connI=_nodal_connec_index->begin();
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType *conn=_nodal_connec->getPointer();
+ const mcIdType *connI=_nodal_connec_index->begin();
const double *coordsPtr=_coords->begin();
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[connI[i]];
if(type==INTERP_KERNEL::NORM_POLYHED)
{
checkConnectivityFullyDefined();
std::set<INTERP_KERNEL::NormalizedCellType> gts(getAllGeoTypes());
- int *conn(_nodal_connec->getPointer());
- const int *conni(_nodal_connec_index->begin());
+ mcIdType *conn(_nodal_connec->getPointer());
+ const mcIdType *conni(_nodal_connec_index->begin());
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator gt=gts.begin();gt!=gts.end();gt++)
{
INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::OrientationInverter> oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(*gt));
- MCAuto<DataArrayInt> cwt(giveCellsWithType(*gt));
- for(const int *it=cwt->begin();it!=cwt->end();it++)
+ MCAuto<DataArrayIdType> cwt(giveCellsWithType(*gt));
+ for(const mcIdType *it=cwt->begin();it!=cwt->end();it++)
oi->operate(conn+conni[*it]+1,conn+conni[*it+1]);
}
updateTime();
* INTERP_KERNEL::NORM_PENTA6, INTERP_KERNEL::NORM_HEXGP12 etc) to respect the MED convention
* according to which the first facet of the cell should be oriented to have the normal vector
* pointing out of cell.
- * \return DataArrayInt * - a new instance of DataArrayInt holding ids of fixed
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of fixed
* cells. The caller is to delete this array using decrRef() as it is no more
* needed.
* \throw If \a this->getMeshDimension() != 3.
* \endif
* \sa MEDCouplingUMesh::findAndCorrectBadOriented3DCells
*/
-DataArrayInt *MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells()
+DataArrayIdType *MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells()
{
const char msg[]="check3DCellsWellOriented detection works only for 3D cells !";
if(getMeshDimension()!=3)
if(spaceDim!=3)
throw INTERP_KERNEL::Exception(msg);
//
- int nbOfCells=getNumberOfCells();
- int *conn=_nodal_connec->getPointer();
- const int *connI=_nodal_connec_index->begin();
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType *conn=_nodal_connec->getPointer();
+ const mcIdType *connI=_nodal_connec_index->begin();
const double *coo=getCoords()->begin();
- MCAuto<DataArrayInt> cells(DataArrayInt::New()); cells->alloc(0,1);
- for(int i=0;i<nbOfCells;i++)
+ MCAuto<DataArrayIdType> cells(DataArrayIdType::New()); cells->alloc(0,1);
+ for(mcIdType i=0;i<nbOfCells;i++)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
if(cm.isExtruded() && !cm.isDynamic() && !cm.isQuadratic())
* This method works only if \a this is a 3D mesh, that is to say a mesh with mesh dimension 3 and a space dimension 3.
* This method makes the hypothesis that \a this a coherent that is to say MEDCouplingUMesh::checkConsistency should throw no exception.
*
- * \return a newly allocated int array with one components containing cell ids renumbered to fit the convention of MED (MED file and MEDCoupling)
+ * \return a newly allocated mcIdType array with one components containing cell ids renumbered to fit the convention of MED (MED file and MEDCoupling)
* \sa MEDCouplingUMesh::orientCorrectlyPolyhedrons,
*/
-DataArrayInt *MEDCouplingUMesh::findAndCorrectBadOriented3DCells()
+DataArrayIdType *MEDCouplingUMesh::findAndCorrectBadOriented3DCells()
{
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply findAndCorrectBadOriented3DCells on it : must be meshDim==3 and spaceDim==3 !");
- int nbOfCells=getNumberOfCells();
- int *conn=_nodal_connec->getPointer();
- const int *connI=_nodal_connec_index->begin();
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType *conn=_nodal_connec->getPointer();
+ const mcIdType *connI=_nodal_connec_index->begin();
const double *coordsPtr=_coords->begin();
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
- for(int i=0;i<nbOfCells;i++)
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(0,1);
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[connI[i]];
switch(type)
{
if(getMeshDimension()!=2 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply getFastAveragePlaneOfThis on it : must be meshDim==2 and spaceDim==3 !");
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
const double *coordsPtr=_coords->begin();
- INTERP_KERNEL::areaVectorOfPolygon<int,INTERP_KERNEL::ALL_C_MODE>(conn+1,connI[1]-connI[0]-1,coordsPtr,vec);
+ INTERP_KERNEL::areaVectorOfPolygon<mcIdType,INTERP_KERNEL::ALL_C_MODE>(conn+1,connI[1]-connI[0]-1,coordsPtr,vec);
std::copy(coordsPtr+3*conn[1],coordsPtr+3*conn[1]+3,pos);
}
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getEdgeRatioField : MeshDimension must be equal to 2 or 3 !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
arr->alloc(nbOfCells,1);
double *pt=arr->getPointer();
ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef.
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
const double *coo=_coords->begin();
double tmp[12];
- for(int i=0;i<nbOfCells;i++,pt++)
+ for(mcIdType i=0;i<nbOfCells;i++,pt++)
{
INTERP_KERNEL::NormalizedCellType t=(INTERP_KERNEL::NormalizedCellType)*conn;
switch(t)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getAspectRatioField : MeshDimension must be equal to 2 or 3 !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
arr->alloc(nbOfCells,1);
double *pt=arr->getPointer();
ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef.
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
const double *coo=_coords->begin();
double tmp[12];
- for(int i=0;i<nbOfCells;i++,pt++)
+ for(mcIdType i=0;i<nbOfCells;i++,pt++)
{
INTERP_KERNEL::NormalizedCellType t=(INTERP_KERNEL::NormalizedCellType)*conn;
switch(t)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getWarpField : MeshDimension must be equal to 2 !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
arr->alloc(nbOfCells,1);
double *pt=arr->getPointer();
ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef.
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
const double *coo=_coords->begin();
double tmp[12];
- for(int i=0;i<nbOfCells;i++,pt++)
+ for(mcIdType i=0;i<nbOfCells;i++,pt++)
{
INTERP_KERNEL::NormalizedCellType t=(INTERP_KERNEL::NormalizedCellType)*conn;
switch(t)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getSkewField : MeshDimension must be equal to 2 !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
arr->alloc(nbOfCells,1);
double *pt=arr->getPointer();
ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef.
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
const double *coo=_coords->begin();
double tmp[12];
- for(int i=0;i<nbOfCells;i++,pt++)
+ for(mcIdType i=0;i<nbOfCells;i++,pt++)
{
INTERP_KERNEL::NormalizedCellType t=(INTERP_KERNEL::NormalizedCellType)*conn;
switch(t)
ret->setMesh(this);
std::set<INTERP_KERNEL::NormalizedCellType> types;
ComputeAllTypesInternal(types,_nodal_connec,_nodal_connec_index);
- int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells());
+ int spaceDim(getSpaceDimension());
+ mcIdType nbCells(getNumberOfCells());
MCAuto<DataArrayDouble> arr(DataArrayDouble::New());
arr->alloc(nbCells,1);
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=types.begin();it!=types.end();it++)
{
INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::DiameterCalculator> dc(INTERP_KERNEL::CellModel::GetCellModel(*it).buildInstanceOfDiameterCalulator(spaceDim));
- MCAuto<DataArrayInt> cellIds(giveCellsWithType(*it));
+ MCAuto<DataArrayIdType> cellIds(giveCellsWithType(*it));
dc->computeForListOfCellIdsUMeshFrmt(cellIds->begin(),cellIds->end(),_nodal_connec_index->begin(),_nodal_connec->begin(),getCoords()->begin(),arr->getPointer());
}
ret->setArray(arr);
DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTreeFast() const
{
checkFullyDefined();
- int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
+ int spaceDim(getSpaceDimension());
+ mcIdType nbOfCells(getNumberOfCells()), nbOfNodes(getNumberOfNodes());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
- for(int i=0;i<nbOfCells*spaceDim;i++)
+ for(mcIdType i=0;i<nbOfCells*spaceDim;i++)
{
bbox[2*i]=std::numeric_limits<double>::max();
bbox[2*i+1]=-std::numeric_limits<double>::max();
}
const double *coordsPtr(_coords->begin());
- const int *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin());
- for(int i=0;i<nbOfCells;i++)
+ const mcIdType *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin());
+ for(mcIdType i=0;i<nbOfCells;i++)
{
- int offset=connI[i]+1;
- int nbOfNodesForCell(connI[i+1]-offset),kk(0);
- for(int j=0;j<nbOfNodesForCell;j++)
+ mcIdType offset=connI[i]+1;
+ mcIdType nbOfNodesForCell(connI[i+1]-offset),kk(0);
+ for(mcIdType j=0;j<nbOfNodesForCell;j++)
{
- int nodeId=conn[offset+j];
+ mcIdType nodeId=conn[offset+j];
if(nodeId>=0 && nodeId<nbOfNodes)
{
for(int k=0;k<spaceDim;k++)
checkFullyDefined();
INTERP_KERNEL::QuadraticPlanarPrecision arcPrec(arcDetEps);
- int spaceDim(getSpaceDimension()),mDim(getMeshDimension()),nbOfCells(getNumberOfCells());
+ int spaceDim(getSpaceDimension()),mDim(getMeshDimension());
+ mcIdType nbOfCells=getNumberOfCells();
if(spaceDim!=2 || mDim!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic : This method should be applied on mesh with mesh dimension equal to 2 and space dimension also equal to 2!");
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
const double *coords(_coords->begin());
- const int *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin());
- for(int i=0;i<nbOfCells;i++,bbox+=4,connI++)
+ const mcIdType *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin());
+ for(mcIdType i=0;i<nbOfCells;i++,bbox+=4,connI++)
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[*connI]));
- int sz(connI[1]-connI[0]-1);
+ mcIdType sz(connI[1]-connI[0]-1);
std::vector<INTERP_KERNEL::Node *> nodes(sz);
INTERP_KERNEL::QuadraticPolygon *pol(0);
- for(int j=0;j<sz;j++)
+ for(mcIdType j=0;j<sz;j++)
{
- int nodeId(conn[*connI+1+j]);
+ mcIdType nodeId(conn[*connI+1+j]);
nodes[j]=new INTERP_KERNEL::Node(coords[nodeId*2],coords[nodeId*2+1]);
}
if(!cm.isQuadratic())
DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic(double arcDetEps) const
{
checkFullyDefined();
- int spaceDim(getSpaceDimension()),mDim(getMeshDimension()),nbOfCells(getNumberOfCells());
+ int spaceDim(getSpaceDimension()),mDim(getMeshDimension());
+ mcIdType nbOfCells=getNumberOfCells();
if(spaceDim!=2 || mDim!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic : This method should be applied on mesh with mesh dimension equal to 1 and space dimension also equal to 2!");
INTERP_KERNEL::QuadraticPlanarPrecision arcPrec(arcDetEps);
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
const double *coords(_coords->begin());
- const int *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin());
- for(int i=0;i<nbOfCells;i++,bbox+=4,connI++)
+ const mcIdType *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin());
+ for(mcIdType i=0;i<nbOfCells;i++,bbox+=4,connI++)
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[*connI]));
- int sz(connI[1]-connI[0]-1);
+ mcIdType sz(connI[1]-connI[0]-1);
std::vector<INTERP_KERNEL::Node *> nodes(sz);
INTERP_KERNEL::Edge *edge(0);
- for(int j=0;j<sz;j++)
+ for(mcIdType j=0;j<sz;j++)
{
- int nodeId(conn[*connI+1+j]);
+ mcIdType nodeId(conn[*connI+1+j]);
nodes[j]=new INTERP_KERNEL::Node(coords[nodeId*2],coords[nodeId*2+1]);
}
if(!cm.isQuadratic())
class ConnReader
{
public:
- ConnReader(const int *c, int val):_conn(c),_val(val) { }
- bool operator() (const int& pos) { return _conn[pos]!=_val; }
+ ConnReader(const mcIdType *c, mcIdType val):_conn(c),_val(val) { }
+ bool operator() (const mcIdType& pos) { return _conn[pos]!=_val; }
private:
- const int *_conn;
- int _val;
+ const mcIdType *_conn;
+ mcIdType _val;
};
class ConnReader2
{
public:
- ConnReader2(const int *c, int val):_conn(c),_val(val) { }
- bool operator() (const int& pos) { return _conn[pos]==_val; }
+ ConnReader2(const mcIdType *c, mcIdType val):_conn(c),_val(val) { }
+ bool operator() (const mcIdType& pos) { return _conn[pos]==_val; }
private:
- const int *_conn;
- int _val;
+ const mcIdType *_conn;
+ mcIdType _val;
};
}
* For every k in [0,n] ret[3*k+2]==-1 because it has no sense here.
* This parameter is kept only for compatibility with other method listed above.
*/
-std::vector<int> MEDCouplingUMesh::getDistributionOfTypes() const
+std::vector<mcIdType> MEDCouplingUMesh::getDistributionOfTypes() const
{
checkConnectivityFullyDefined();
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
- const int *work=connI;
- int nbOfCells=getNumberOfCells();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
+ const mcIdType *work=connI;
+ mcIdType nbOfCells=getNumberOfCells();
std::size_t n=getAllGeoTypes().size();
- std::vector<int> ret(3*n,-1); //ret[3*k+2]==-1 because it has no sense here
+ std::vector<mcIdType> ret(3*n,-1); //ret[3*k+2]==-1 because it has no sense here
std::set<INTERP_KERNEL::NormalizedCellType> types;
for(std::size_t i=0;work!=connI+nbOfCells;i++)
{
}
types.insert(typ);
ret[3*i]=typ;
- const int *work2=std::find_if(work+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,typ));
- ret[3*i+1]=(int)std::distance(work,work2);
+ const mcIdType *work2=std::find_if(work+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,typ));
+ ret[3*i+1]=ToIdType(std::distance(work,work2));
work=work2;
}
return ret;
*
* If all geometric types in \a code are exactly those in \a this null pointer is returned.
* If it exists a geometric type in \a this \b not in \a code \b no exception is thrown
- * and a DataArrayInt instance is returned that the user has the responsibility to deallocate.
+ * and a DataArrayIdType instance is returned that the user has the responsibility to deallocate.
*/
-DataArrayInt *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
+DataArrayIdType *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const
{
if(code.empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code is empty, should not !");
if(sz%3!=0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code size is NOT %3 !");
std::vector<INTERP_KERNEL::NormalizedCellType> types;
- int nb=0;
+ mcIdType nb=0;
bool isNoPflUsed=true;
for(std::size_t i=0;i<n;i++)
if(std::find(types.begin(),types.end(),(INTERP_KERNEL::NormalizedCellType)code[3*i])==types.end())
if(types.size()==_types.size())
return 0;
}
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nb,1);
- int *retPtr=ret->getPointer();
- const int *connI=_nodal_connec_index->begin();
- const int *conn=_nodal_connec->begin();
- int nbOfCells=getNumberOfCells();
- const int *i=connI;
+ mcIdType *retPtr=ret->getPointer();
+ const mcIdType *connI=_nodal_connec_index->begin();
+ const mcIdType *conn=_nodal_connec->begin();
+ mcIdType nbOfCells=getNumberOfCells();
+ const mcIdType *i=connI;
int kk=0;
for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it=types.begin();it!=types.end();it++,kk++)
{
- i=std::find_if(i,connI+nbOfCells,MEDCouplingImpl::ConnReader2(conn,(int)(*it)));
- int offset=(int)std::distance(connI,i);
- const int *j=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,(int)(*it)));
- int nbOfCellsOfCurType=(int)std::distance(i,j);
+ i=std::find_if(i,connI+nbOfCells,MEDCouplingImpl::ConnReader2(conn,ToIdType((*it))));
+ mcIdType offset=ToIdType(std::distance(connI,i));
+ const mcIdType *j=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType((*it))));
+ mcIdType nbOfCellsOfCurType=ToIdType(std::distance(i,j));
if(code[3*kk+2]==-1)
- for(int k=0;k<nbOfCellsOfCurType;k++)
+ for(mcIdType k=0;k<nbOfCellsOfCurType;k++)
*retPtr++=k+offset;
else
{
- int idInIdsPerType=code[3*kk+2];
- if(idInIdsPerType>=0 && idInIdsPerType<(int)idsPerType.size())
+ mcIdType idInIdsPerType=code[3*kk+2];
+ if(idInIdsPerType>=0 && idInIdsPerType<ToIdType(idsPerType.size()))
{
- const DataArrayInt *zePfl=idsPerType[idInIdsPerType];
+ const DataArrayIdType *zePfl=idsPerType[idInIdsPerType];
if(zePfl)
{
zePfl->checkAllocated();
if(zePfl->getNumberOfComponents()==1)
{
- for(const int *k=zePfl->begin();k!=zePfl->end();k++,retPtr++)
+ for(const mcIdType *k=zePfl->begin();k!=zePfl->end();k++,retPtr++)
{
if(*k>=0 && *k<nbOfCellsOfCurType)
*retPtr=(*k)+offset;
* This vector can be empty in case of all geometric type cells are fully covered in ascending in the given input \a profile.
* \throw if \a profile has not exactly one component. It throws too, if \a profile contains some values not in [0,getNumberOfCells()) or if \a this is not fully defined
*/
-void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType, bool smartPflKiller) const
+void MEDCouplingUMesh::splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller) const
{
if(!profile)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitProfilePerType : input profile is NULL !");
if(profile->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitProfilePerType : input profile should have exactly one component !");
checkConnectivityFullyDefined();
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
- int nbOfCells=getNumberOfCells();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
+ mcIdType nbOfCells=getNumberOfCells();
std::vector<INTERP_KERNEL::NormalizedCellType> types;
- std::vector<int> typeRangeVals(1);
- for(const int *i=connI;i!=connI+nbOfCells;)
+ std::vector<mcIdType> typeRangeVals(1);
+ for(const mcIdType *i=connI;i!=connI+nbOfCells;)
{
INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
if(std::find(types.begin(),types.end(),curType)!=types.end())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitProfilePerType : current mesh is not sorted by type !");
}
types.push_back(curType);
- i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,(int)curType));
- typeRangeVals.push_back((int)std::distance(connI,i));
+ i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType(curType)));
+ typeRangeVals.push_back(ToIdType(std::distance(connI,i)));
}
//
- DataArrayInt *castArr=0,*rankInsideCast=0,*castsPresent=0;
+ DataArrayIdType *castArr=0,*rankInsideCast=0,*castsPresent=0;
profile->splitByValueRange(&typeRangeVals[0],&typeRangeVals[0]+typeRangeVals.size(),castArr,rankInsideCast,castsPresent);
- MCAuto<DataArrayInt> tmp0=castArr;
- MCAuto<DataArrayInt> tmp1=rankInsideCast;
- MCAuto<DataArrayInt> tmp2=castsPresent;
+ MCAuto<DataArrayIdType> tmp0=castArr;
+ MCAuto<DataArrayIdType> tmp1=rankInsideCast;
+ MCAuto<DataArrayIdType> tmp2=castsPresent;
//
- int nbOfCastsFinal=castsPresent->getNumberOfTuples();
+ mcIdType nbOfCastsFinal=castsPresent->getNumberOfTuples();
code.resize(3*nbOfCastsFinal);
- std::vector< MCAuto<DataArrayInt> > idsInPflPerType2;
- std::vector< MCAuto<DataArrayInt> > idsPerType2;
- for(int i=0;i<nbOfCastsFinal;i++)
+ std::vector< MCAuto<DataArrayIdType> > idsInPflPerType2;
+ std::vector< MCAuto<DataArrayIdType> > idsPerType2;
+ for(mcIdType i=0;i<nbOfCastsFinal;i++)
{
- int castId=castsPresent->getIJ(i,0);
- MCAuto<DataArrayInt> tmp3=castArr->findIdsEqual(castId);
+ mcIdType castId=castsPresent->getIJ(i,0);
+ MCAuto<DataArrayIdType> tmp3=castArr->findIdsEqual(castId);
idsInPflPerType2.push_back(tmp3);
- code[3*i]=(int)types[castId];
+ code[3*i]=ToIdType(types[castId]);
code[3*i+1]=tmp3->getNumberOfTuples();
- MCAuto<DataArrayInt> tmp4=rankInsideCast->selectByTupleId(tmp3->begin(),tmp3->begin()+tmp3->getNumberOfTuples());
+ MCAuto<DataArrayIdType> tmp4=rankInsideCast->selectByTupleId(tmp3->begin(),tmp3->begin()+tmp3->getNumberOfTuples());
if(!smartPflKiller || !tmp4->isIota(typeRangeVals[castId+1]-typeRangeVals[castId]))
{
tmp4->copyStringInfoFrom(*profile);
idsPerType2.push_back(tmp4);
- code[3*i+2]=(int)idsPerType2.size()-1;
+ code[3*i+2]=ToIdType(idsPerType2.size())-1;
}
else
{
idsInPflPerType.resize(sz2);
for(std::size_t i=0;i<sz2;i++)
{
- DataArrayInt *locDa=idsInPflPerType2[i];
+ DataArrayIdType *locDa=idsInPflPerType2[i];
locDa->incrRef();
idsInPflPerType[i]=locDa;
}
idsPerType.resize(sz);
for(std::size_t i=0;i<sz;i++)
{
- DataArrayInt *locDa=idsPerType2[i];
+ DataArrayIdType *locDa=idsPerType2[i];
locDa->incrRef();
idsPerType[i]=locDa;
}
* The following equality should be verified 'nM1LevMesh->getMeshDimension()==this->getMeshDimension()-1'
* This method returns 5+2 elements. 'desc', 'descIndx', 'revDesc', 'revDescIndx' and 'meshnM1' behaves exactly as MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity except the content as described after. The returned array specifies the n-1 mesh reordered by type as MEDMEM does. 'nM1LevMeshIds' contains the ids in returned 'meshnM1'. Finally 'meshnM1Old2New' contains numbering old2new that is to say the cell #k in coarse 'nM1LevMesh' will have the number ret[k] in returned mesh 'nM1LevMesh' MEDMEM reordered.
*/
-MEDCouplingUMesh *MEDCouplingUMesh::emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh, DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *&revDesc, DataArrayInt *&revDescIndx, DataArrayInt *& nM1LevMeshIds, DataArrayInt *&meshnM1Old2New) const
+MEDCouplingUMesh *MEDCouplingUMesh::emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh, DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *&revDesc, DataArrayIdType *&revDescIndx, DataArrayIdType *& nM1LevMeshIds, DataArrayIdType *&meshnM1Old2New) const
{
checkFullyDefined();
nM1LevMesh->checkFullyDefined();
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::emulateMEDMEMBDC : The mesh passed as first argument should have a meshDim equal to this->getMeshDimension()-1 !" );
if(_coords!=nM1LevMesh->getCoords())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::emulateMEDMEMBDC : 'this' and mesh in first argument should share the same coords : Use tryToShareSameCoords method !");
- MCAuto<DataArrayInt> tmp0=DataArrayInt::New();
- MCAuto<DataArrayInt> tmp1=DataArrayInt::New();
+ MCAuto<DataArrayIdType> tmp0=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> tmp1=DataArrayIdType::New();
MCAuto<MEDCouplingUMesh> ret1=buildDescendingConnectivity(desc,descIndx,tmp0,tmp1);
- MCAuto<DataArrayInt> ret0=ret1->sortCellsInMEDFileFrmt();
+ MCAuto<DataArrayIdType> ret0=ret1->sortCellsInMEDFileFrmt();
desc->transformWithIndArr(ret0->begin(),ret0->begin()+ret0->getNbOfElems());
MCAuto<MEDCouplingUMesh> tmp=MEDCouplingUMesh::New();
tmp->setConnectivity(tmp0,tmp1);
tmp->renumberCells(ret0->begin(),false);
revDesc=tmp->getNodalConnectivity();
revDescIndx=tmp->getNodalConnectivityIndex();
- DataArrayInt *ret=0;
+ DataArrayIdType *ret=0;
if(!ret1->areCellsIncludedIn(nM1LevMesh,2,ret))
{
- int tmp2;
+ mcIdType tmp2;
ret->getMaxValue(tmp2);
ret->decrRef();
std::ostringstream oss; oss << "MEDCouplingUMesh::emulateMEDMEMBDC : input N-1 mesh present a cell not in descending mesh ... Id of cell is " << tmp2 << " !";
* Permutes the nodal connectivity arrays so that the cells are sorted by type, which is
* necessary for writing the mesh to MED file. Additionally returns a permutation array
* in "Old to New" mode.
- * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete
+ * \return DataArrayIdType * - a new instance of DataArrayIdType. The caller is to delete
* this array using decrRef() as it is no more needed.
* \throw If the nodal connectivity of cells is not defined.
*/
-DataArrayInt *MEDCouplingUMesh::sortCellsInMEDFileFrmt()
+DataArrayIdType *MEDCouplingUMesh::sortCellsInMEDFileFrmt()
{
checkConnectivityFullyDefined();
- MCAuto<DataArrayInt> ret=getRenumArrForMEDFileFrmt();
+ MCAuto<DataArrayIdType> ret=getRenumArrForMEDFileFrmt();
renumberCells(ret->begin(),false);
return ret.retn();
}
bool MEDCouplingUMesh::checkConsecutiveCellTypes() const
{
checkFullyDefined();
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
- int nbOfCells=getNumberOfCells();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
+ mcIdType nbOfCells=getNumberOfCells();
std::set<INTERP_KERNEL::NormalizedCellType> types;
- for(const int *i=connI;i!=connI+nbOfCells;)
+ for(const mcIdType *i=connI;i!=connI+nbOfCells;)
{
INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
if(types.find(curType)!=types.end())
return false;
types.insert(curType);
- i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,(int)curType));
+ i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType(curType)));
}
return true;
}
bool MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const
{
checkFullyDefined();
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
- int nbOfCells=getNumberOfCells();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
+ mcIdType nbOfCells=getNumberOfCells();
if(nbOfCells==0)
return true;
- int lastPos=-1;
+ mcIdType lastPos=-1;
std::set<INTERP_KERNEL::NormalizedCellType> sg;
- for(const int *i=connI;i!=connI+nbOfCells;)
+ for(const mcIdType *i=connI;i!=connI+nbOfCells;)
{
INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
const INTERP_KERNEL::NormalizedCellType *isTypeExists=std::find(orderBg,orderEnd,curType);
if(isTypeExists!=orderEnd)
{
- int pos=(int)std::distance(orderBg,isTypeExists);
+ mcIdType pos=ToIdType(std::distance(orderBg,isTypeExists));
if(pos<=lastPos)
return false;
lastPos=pos;
- i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,(int)curType));
+ i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType(curType)));
}
else
{
if(sg.find(curType)==sg.end())
{
- i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,(int)curType));
+ i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType(curType)));
sg.insert(curType);
}
else
}
/*!
- * This method returns 2 newly allocated DataArrayInt instances. The first is an array of size 'this->getNumberOfCells()' with one component,
+ * This method returns 2 newly allocated DataArrayIdType instances. The first is an array of size 'this->getNumberOfCells()' with one component,
* that tells for each cell the pos of its type in the array on type given in input parameter. The 2nd output parameter is an array with the same
* number of tuples than input type array and with one component. This 2nd output array gives type by type the number of occurrence of type in 'this'.
*/
-DataArrayInt *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayInt *&nbPerType) const
+DataArrayIdType *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayIdType *&nbPerType) const
{
checkConnectivityFullyDefined();
- int nbOfCells=getNumberOfCells();
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
- MCAuto<DataArrayInt> tmpa=DataArrayInt::New();
- MCAuto<DataArrayInt> tmpb=DataArrayInt::New();
+ mcIdType nbOfCells=getNumberOfCells();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
+ MCAuto<DataArrayIdType> tmpa=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> tmpb=DataArrayIdType::New();
tmpa->alloc(nbOfCells,1);
- tmpb->alloc((int)std::distance(orderBg,orderEnd),1);
+ tmpb->alloc(std::distance(orderBg,orderEnd),1);
tmpb->fillWithZero();
- int *tmp=tmpa->getPointer();
- int *tmp2=tmpb->getPointer();
- for(const int *i=connI;i!=connI+nbOfCells;i++)
+ mcIdType *tmp=tmpa->getPointer();
+ mcIdType *tmp2=tmpb->getPointer();
+ for(const mcIdType *i=connI;i!=connI+nbOfCells;i++)
{
const INTERP_KERNEL::NormalizedCellType *where=std::find(orderBg,orderEnd,(INTERP_KERNEL::NormalizedCellType)conn[*i]);
if(where!=orderEnd)
{
- int pos=(int)std::distance(orderBg,where);
+ mcIdType pos=ToIdType(std::distance(orderBg,where));
tmp2[pos]++;
tmp[std::distance(connI,i)]=pos;
}
*
* \sa MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec, MEDCouplingUMesh::sortCellsInMEDFileFrmt.
*/
-DataArrayInt *MEDCouplingUMesh::getRenumArrForMEDFileFrmt() const
+DataArrayIdType *MEDCouplingUMesh::getRenumArrForMEDFileFrmt() const
{
return getRenumArrForConsecutiveCellTypesSpec(MEDMEM_ORDER,MEDMEM_ORDER+N_MEDMEM_ORDER);
}
* The mesh after this call to MEDCouplingMesh::renumberCells will pass the test of MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder with the same inputs.
* The returned array minimizes the permutations that is to say the order of cells inside same geometric type remains the same.
*/
-DataArrayInt *MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const
+DataArrayIdType *MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const
{
- DataArrayInt *nbPerType=0;
- MCAuto<DataArrayInt> tmpa=getLevArrPerCellTypes(orderBg,orderEnd,nbPerType);
+ DataArrayIdType *nbPerType=0;
+ MCAuto<DataArrayIdType> tmpa=getLevArrPerCellTypes(orderBg,orderEnd,nbPerType);
nbPerType->decrRef();
return tmpa->buildPermArrPerLevel();
}
*
* \return the array giving the correspondence old to new.
*/
-DataArrayInt *MEDCouplingUMesh::rearrange2ConsecutiveCellTypes()
+DataArrayIdType *MEDCouplingUMesh::rearrange2ConsecutiveCellTypes()
{
checkFullyDefined();
computeTypes();
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
- int nbOfCells=getNumberOfCells();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
+ mcIdType nbOfCells=getNumberOfCells();
std::vector<INTERP_KERNEL::NormalizedCellType> types;
- for(const int *i=connI;i!=connI+nbOfCells && (types.size()!=_types.size());)
+ for(const mcIdType *i=connI;i!=connI+nbOfCells && (types.size()!=_types.size());)
if(std::find(types.begin(),types.end(),(INTERP_KERNEL::NormalizedCellType)conn[*i])==types.end())
{
INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
types.push_back(curType);
for(i++;i!=connI+nbOfCells && (INTERP_KERNEL::NormalizedCellType)conn[*i]==curType;i++);
}
- DataArrayInt *ret=DataArrayInt::New();
+ DataArrayIdType *ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
- int *retPtr=ret->getPointer();
+ mcIdType *retPtr=ret->getPointer();
std::fill(retPtr,retPtr+nbOfCells,-1);
- int newCellId=0;
+ mcIdType newCellId=0;
for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=types.begin();iter!=types.end();iter++)
{
- for(const int *i=connI;i!=connI+nbOfCells;i++)
+ for(const mcIdType *i=connI;i!=connI+nbOfCells;i++)
if((INTERP_KERNEL::NormalizedCellType)conn[*i]==(*iter))
retPtr[std::distance(connI,i)]=newCellId++;
}
std::vector<MEDCouplingUMesh *> MEDCouplingUMesh::splitByType() const
{
checkConnectivityFullyDefined();
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
- int nbOfCells=getNumberOfCells();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
+ mcIdType nbOfCells=getNumberOfCells();
std::vector<MEDCouplingUMesh *> ret;
- for(const int *i=connI;i!=connI+nbOfCells;)
+ for(const mcIdType *i=connI;i!=connI+nbOfCells;)
{
INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
- int beginCellId=(int)std::distance(connI,i);
- i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,(int)curType));
- int endCellId=(int)std::distance(connI,i);
- int sz=endCellId-beginCellId;
- int *cells=new int[sz];
- for(int j=0;j<sz;j++)
+ mcIdType beginCellId=ToIdType(std::distance(connI,i));
+ i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType(curType)));
+ mcIdType endCellId=ToIdType(std::distance(connI,i));
+ mcIdType sz=endCellId-beginCellId;
+ mcIdType *cells=new mcIdType[sz];
+ for(mcIdType j=0;j<sz;j++)
cells[j]=beginCellId+j;
MEDCouplingUMesh *m=(MEDCouplingUMesh *)buildPartOfMySelf(cells,cells+sz,true);
delete [] cells;
MEDCoupling1SGTUMesh *retC=dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh*)ret);
if(retC)
{
- MCAuto<DataArrayInt> c=convertNodalConnectivityToStaticGeoTypeMesh();
+ MCAuto<DataArrayIdType> c=convertNodalConnectivityToStaticGeoTypeMesh();
retC->setNodalConnectivity(c);
}
else
MEDCoupling1DGTUMesh *retD=dynamic_cast<MEDCoupling1DGTUMesh *>((MEDCoupling1GTUMesh*)ret);
if(!retD)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertIntoSingleGeoTypeMesh : Internal error !");
- DataArrayInt *c=0,*ci=0;
+ DataArrayIdType *c=0,*ci=0;
convertNodalConnectivityToDynamicGeoTypeMesh(c,ci);
- MCAuto<DataArrayInt> cs(c),cis(ci);
+ MCAuto<DataArrayIdType> cs(c),cis(ci);
retD->setNodalConnectivity(cs,cis);
}
return ret.retn();
}
-DataArrayInt *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() const
+DataArrayIdType *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() const
{
checkConnectivityFullyDefined();
if(_types.size()!=1)
oss << "this type is dynamic ! Only static geometric type is possible for that type ! call convertNodalConnectivityToDynamicGeoTypeMesh instead !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int nbCells=getNumberOfCells();
- int typi=(int)typ;
- int nbNodesPerCell=(int)cm.getNumberOfNodes();
- MCAuto<DataArrayInt> connOut=DataArrayInt::New(); connOut->alloc(nbCells*nbNodesPerCell,1);
- int *outPtr=connOut->getPointer();
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
+ mcIdType nbCells=getNumberOfCells();
+ mcIdType typi=ToIdType(typ);
+ mcIdType nbNodesPerCell=ToIdType(cm.getNumberOfNodes());
+ MCAuto<DataArrayIdType> connOut=DataArrayIdType::New(); connOut->alloc(nbCells*nbNodesPerCell,1);
+ mcIdType *outPtr=connOut->getPointer();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
nbNodesPerCell++;
- for(int i=0;i<nbCells;i++,connI++)
+ for(mcIdType i=0;i<nbCells;i++,connI++)
{
if(conn[connI[0]]==typi && connI[1]-connI[0]==nbNodesPerCell)
outPtr=std::copy(conn+connI[0]+1,conn+connI[1],outPtr);
* \param nodalConn
* \param nodalConnI
*/
-void MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh(DataArrayInt *&nodalConn, DataArrayInt *&nodalConnIndex) const
+void MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh(DataArrayIdType *&nodalConn, DataArrayIdType *&nodalConnIndex) const
{
static const char msg0[]="MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh : nodal connectivity in this are invalid ! Call checkConsistency !";
checkConnectivityFullyDefined();
if(_types.size()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh : current mesh does not contain exactly one geometric type !");
- int nbCells=getNumberOfCells(),lgth=_nodal_connec->getNumberOfTuples();
+ mcIdType nbCells=getNumberOfCells(),
+ lgth=_nodal_connec->getNumberOfTuples();
if(lgth<nbCells)
throw INTERP_KERNEL::Exception(msg0);
- MCAuto<DataArrayInt> c(DataArrayInt::New()),ci(DataArrayInt::New());
+ MCAuto<DataArrayIdType> c(DataArrayIdType::New()),ci(DataArrayIdType::New());
c->alloc(lgth-nbCells,1); ci->alloc(nbCells+1,1);
- int *cp(c->getPointer()),*cip(ci->getPointer());
- const int *incp(_nodal_connec->begin()),*incip(_nodal_connec_index->begin());
+ mcIdType *cp(c->getPointer()),*cip(ci->getPointer());
+ const mcIdType *incp(_nodal_connec->begin()),*incip(_nodal_connec_index->begin());
cip[0]=0;
- for(int i=0;i<nbCells;i++,cip++,incip++)
+ for(mcIdType i=0;i<nbCells;i++,cip++,incip++)
{
- int strt(incip[0]+1),stop(incip[1]);//+1 to skip geo type
- int delta(stop-strt);
+ mcIdType strt(incip[0]+1),stop(incip[1]);//+1 to skip geo type
+ mcIdType delta(stop-strt);
if(delta>=1)
{
if((strt>=0 && strt<lgth) && (stop>=0 && stop<=lgth))
*
* \param [in] ms meshes with same mesh dimension lying on the same coords and sorted by type following de the same geometric type order than
* those specified in MEDCouplingUMesh::sortCellsInMEDFileFrmt method.
- * \param [out] szOfCellGrpOfSameType is a newly allocated DataArrayInt instance whose number of tuples is equal to the number of chunks of same geotype
+ * \param [out] szOfCellGrpOfSameType is a newly allocated DataArrayIdType instance whose number of tuples is equal to the number of chunks of same geotype
* in all meshes in \b ms. The accumulation of all values of this array is equal to the number of cells of returned mesh.
- * \param [out] idInMsOfCellGrpOfSameType is a newly allocated DataArrayInt instance having the same size than \b szOfCellGrpOfSameType. This
+ * \param [out] idInMsOfCellGrpOfSameType is a newly allocated DataArrayIdType instance having the same size than \b szOfCellGrpOfSameType. This
* output array gives for each chunck of same type the corresponding mesh id in \b ms.
* \return A newly allocated unstructured mesh that is the result of the aggregation on same coords of all meshes in \b ms. This returned mesh
* is sorted by type following the geo cell types order of MEDCouplingUMesh::sortCellsInMEDFileFrmt method.
*/
MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(const std::vector<const MEDCouplingUMesh *>& ms,
- DataArrayInt *&szOfCellGrpOfSameType,
- DataArrayInt *&idInMsOfCellGrpOfSameType)
+ DataArrayIdType *&szOfCellGrpOfSameType,
+ DataArrayIdType *&idInMsOfCellGrpOfSameType)
{
std::vector<const MEDCouplingUMesh *> ms2;
for(std::vector<const MEDCouplingUMesh *>::const_iterator it=ms.begin();it!=ms.end();it++)
//
std::vector<const MEDCouplingUMesh *> m1ssmSingle;
std::vector< MCAuto<MEDCouplingUMesh> > m1ssmSingleAuto;
- int fake=0,rk=0;
- MCAuto<DataArrayInt> ret1(DataArrayInt::New()),ret2(DataArrayInt::New());
+ mcIdType fake=0,rk=0;
+ MCAuto<DataArrayIdType> ret1(DataArrayIdType::New()),ret2(DataArrayIdType::New());
ret1->alloc(0,1); ret2->alloc(0,1);
for(std::vector<const MEDCouplingUMesh *>::const_iterator it=ms2.begin();it!=ms2.end();it++,rk++)
{
}
}
MCAuto<MEDCouplingUMesh> m1ssmSingle2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmSingle);
- MCAuto<DataArrayInt> renum=m1ssmSingle2->sortCellsInMEDFileFrmt();
+ MCAuto<DataArrayIdType> renum=m1ssmSingle2->sortCellsInMEDFileFrmt();
std::vector<const MEDCouplingUMesh *> m1ssmfinal(m1ssm.size());
- for(std::size_t i=0;i<m1ssm.size();i++)
+ for(mcIdType i=0;i<ToIdType(m1ssm.size());i++)
m1ssmfinal[renum->getIJ(i,0)]=m1ssm[i];
MCAuto<MEDCouplingUMesh> ret0=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmfinal);
szOfCellGrpOfSameType=ret1->renumber(renum->begin());
}
/*!
- * This method returns a newly created DataArrayInt instance.
+ * This method returns a newly created DataArrayIdType instance.
* This method retrieves cell ids in [ \a begin, \a end ) that have the type \a type.
*/
-DataArrayInt *MEDCouplingUMesh::keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, const int *begin, const int *end) const
+DataArrayIdType *MEDCouplingUMesh::keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, const mcIdType *begin, const mcIdType *end) const
{
checkFullyDefined();
- const int *conn=_nodal_connec->begin();
- const int *connIndex=_nodal_connec_index->begin();
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- for(const int *w=begin;w!=end;w++)
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connIndex=_nodal_connec_index->begin();
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
+ for(const mcIdType *w=begin;w!=end;w++)
if((INTERP_KERNEL::NormalizedCellType)conn[connIndex[*w]]==type)
ret->pushBackSilent(*w);
return ret.retn();
* This method makes the assumption that da->getNumberOfTuples()<this->getNumberOfCells(). This method makes the assumption that ids contained in 'da'
* are in [0:getNumberOfCells())
*/
-DataArrayInt *MEDCouplingUMesh::convertCellArrayPerGeoType(const DataArrayInt *da) const
+DataArrayIdType *MEDCouplingUMesh::convertCellArrayPerGeoType(const DataArrayIdType *da) const
{
checkFullyDefined();
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
- int nbOfCells=getNumberOfCells();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
+ mcIdType nbOfCells=getNumberOfCells();
std::set<INTERP_KERNEL::NormalizedCellType> types(getAllGeoTypes());
- int *tmp=new int[nbOfCells];
+ mcIdType *tmp=new mcIdType[nbOfCells];
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=types.begin();iter!=types.end();iter++)
{
- int j=0;
- for(const int *i=connI;i!=connI+nbOfCells;i++)
+ mcIdType j=0;
+ for(const mcIdType *i=connI;i!=connI+nbOfCells;i++)
if((INTERP_KERNEL::NormalizedCellType)conn[*i]==(*iter))
tmp[std::distance(connI,i)]=j++;
}
- DataArrayInt *ret=DataArrayInt::New();
+ DataArrayIdType *ret=DataArrayIdType::New();
ret->alloc(da->getNumberOfTuples(),da->getNumberOfComponents());
ret->copyStringInfoFrom(*da);
- int *retPtr=ret->getPointer();
- const int *daPtr=da->begin();
- int nbOfElems=da->getNbOfElems();
- for(int k=0;k<nbOfElems;k++)
+ mcIdType *retPtr=ret->getPointer();
+ const mcIdType *daPtr=da->begin();
+ mcIdType nbOfElems=da->getNbOfElems();
+ for(mcIdType k=0;k<nbOfElems;k++)
retPtr[k]=tmp[daPtr[k]];
delete [] tmp;
return ret;
* cells whose ids is in 'idsPerGeoType' array.
* This method conserves coords and name of mesh.
*/
-MEDCouplingUMesh *MEDCouplingUMesh::keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, const int *idsPerGeoTypeBg, const int *idsPerGeoTypeEnd) const
+MEDCouplingUMesh *MEDCouplingUMesh::keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, const mcIdType *idsPerGeoTypeBg, const mcIdType *idsPerGeoTypeEnd) const
{
- std::vector<int> code=getDistributionOfTypes();
+ std::vector<mcIdType> code=getDistributionOfTypes();
std::size_t nOfTypesInThis=code.size()/3;
- int sz=0,szOfType=0;
+ mcIdType sz=0,szOfType=0;
for(std::size_t i=0;i<nOfTypesInThis;i++)
{
if(code[3*i]!=type)
else
szOfType=code[3*i+1];
}
- for(const int *work=idsPerGeoTypeBg;work!=idsPerGeoTypeEnd;work++)
+ for(const mcIdType *work=idsPerGeoTypeBg;work!=idsPerGeoTypeEnd;work++)
if(*work<0 || *work>=szOfType)
{
std::ostringstream oss; oss << "MEDCouplingUMesh::keepSpecifiedCells : Request on type " << type << " at place #" << std::distance(idsPerGeoTypeBg,work) << " value " << *work;
oss << ". It should be in [0," << szOfType << ") !";
throw INTERP_KERNEL::Exception(oss.str());
}
- MCAuto<DataArrayInt> idsTokeep=DataArrayInt::New(); idsTokeep->alloc(sz+(int)std::distance(idsPerGeoTypeBg,idsPerGeoTypeEnd),1);
- int *idsPtr=idsTokeep->getPointer();
- int offset=0;
+ MCAuto<DataArrayIdType> idsTokeep=DataArrayIdType::New(); idsTokeep->alloc(sz+std::distance(idsPerGeoTypeBg,idsPerGeoTypeEnd),1);
+ mcIdType *idsPtr=idsTokeep->getPointer();
+ mcIdType offset=0;
for(std::size_t i=0;i<nOfTypesInThis;i++)
{
if(code[3*i]!=type)
- for(int j=0;j<code[3*i+1];j++)
+ for(mcIdType j=0;j<code[3*i+1];j++)
*idsPtr++=offset+j;
else
- idsPtr=std::transform(idsPerGeoTypeBg,idsPerGeoTypeEnd,idsPtr,std::bind2nd(std::plus<int>(),offset));
+ idsPtr=std::transform(idsPerGeoTypeBg,idsPerGeoTypeEnd,idsPtr,std::bind2nd(std::plus<mcIdType>(),offset));
offset+=code[3*i+1];
}
MCAuto<MEDCouplingUMesh> ret=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(idsTokeep->begin(),idsTokeep->end(),true));
*/
std::vector<bool> MEDCouplingUMesh::getQuadraticStatus() const
{
- int ncell=getNumberOfCells();
+ mcIdType ncell=getNumberOfCells();
std::vector<bool> ret(ncell);
- const int *cI=getNodalConnectivityIndex()->begin();
- const int *c=getNodalConnectivity()->begin();
- for(int i=0;i<ncell;i++)
+ const mcIdType *cI=getNodalConnectivityIndex()->begin();
+ const mcIdType *c=getNodalConnectivity()->begin();
+ for(mcIdType i=0;i<ncell;i++)
{
INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)c[cI[i]];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
{
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
ret->alloc(nbOfCells,spaceDim);
ret->copyStringInfoFrom(*getCoords());
double *ptToFill=ret->getPointer();
- const int *nodal=_nodal_connec->begin();
- const int *nodalI=_nodal_connec_index->begin();
+ const mcIdType *nodal=_nodal_connec->begin();
+ const mcIdType *nodalI=_nodal_connec_index->begin();
const double *coor=_coords->begin();
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)nodal[nodalI[i]];
- INTERP_KERNEL::computeBarycenter2<int,INTERP_KERNEL::ALL_C_MODE>(type,nodal+nodalI[i]+1,nodalI[i+1]-nodalI[i]-1,coor,spaceDim,ptToFill);
+ INTERP_KERNEL::computeBarycenter2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(type,nodal+nodalI[i]+1,nodalI[i+1]-nodalI[i]-1,coor,spaceDim,ptToFill);
ptToFill+=spaceDim;
}
return ret.retn();
checkFullyDefined();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
- int nbOfCells=getNumberOfCells();
- int nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType nbOfNodes=getNumberOfNodes();
ret->alloc(nbOfCells,spaceDim);
double *ptToFill=ret->getPointer();
- const int *nodal=_nodal_connec->begin();
- const int *nodalI=_nodal_connec_index->begin();
+ const mcIdType *nodal=_nodal_connec->begin();
+ const mcIdType *nodalI=_nodal_connec_index->begin();
const double *coor=_coords->begin();
- for(int i=0;i<nbOfCells;i++,ptToFill+=spaceDim)
+ for(mcIdType i=0;i<nbOfCells;i++,ptToFill+=spaceDim)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)nodal[nodalI[i]];
std::fill(ptToFill,ptToFill+spaceDim,0.);
if(type!=INTERP_KERNEL::NORM_POLYHED)
{
- for(const int *conn=nodal+nodalI[i]+1;conn!=nodal+nodalI[i+1];conn++)
+ for(const mcIdType *conn=nodal+nodalI[i]+1;conn!=nodal+nodalI[i+1];conn++)
{
if(*conn>=0 && *conn<nbOfNodes)
std::transform(coor+spaceDim*conn[0],coor+spaceDim*(conn[0]+1),ptToFill,ptToFill,std::plus<double>());
throw INTERP_KERNEL::Exception(oss.str());
}
}
- int nbOfNodesInCell=nodalI[i+1]-nodalI[i]-1;
+ mcIdType nbOfNodesInCell=nodalI[i+1]-nodalI[i]-1;
if(nbOfNodesInCell>0)
std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind2nd(std::multiplies<double>(),1./(double)nbOfNodesInCell));
else
}
else
{
- std::set<int> s(nodal+nodalI[i]+1,nodal+nodalI[i+1]);
+ std::set<mcIdType> s(nodal+nodalI[i]+1,nodal+nodalI[i+1]);
s.erase(-1);
- for(std::set<int>::const_iterator it=s.begin();it!=s.end();it++)
+ for(std::set<mcIdType>::const_iterator it=s.begin();it!=s.end();it++)
{
if(*it>=0 && *it<nbOfNodes)
std::transform(coor+spaceDim*(*it),coor+spaceDim*((*it)+1),ptToFill,ptToFill,std::plus<double>());
* \ref py_mcumesh_getPartBarycenterAndOwner "Here is a Python example".
* \endif
*/
-DataArrayDouble *MEDCouplingUMesh::getPartBarycenterAndOwner(const int *begin, const int *end) const
+DataArrayDouble *MEDCouplingUMesh::getPartBarycenterAndOwner(const mcIdType *begin, const mcIdType *end) const
{
DataArrayDouble *ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
- int nbOfTuple=(int)std::distance(begin,end);
+ std::size_t nbOfTuple=std::distance(begin,end);
ret->alloc(nbOfTuple,spaceDim);
double *ptToFill=ret->getPointer();
double *tmp=new double[spaceDim];
- const int *nodal=_nodal_connec->begin();
- const int *nodalI=_nodal_connec_index->begin();
+ const mcIdType *nodal=_nodal_connec->begin();
+ const mcIdType *nodalI=_nodal_connec_index->begin();
const double *coor=_coords->begin();
- for(const int *w=begin;w!=end;w++)
+ for(const mcIdType *w=begin;w!=end;w++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)nodal[nodalI[*w]];
- INTERP_KERNEL::computeBarycenter2<int,INTERP_KERNEL::ALL_C_MODE>(type,nodal+nodalI[*w]+1,nodalI[*w+1]-nodalI[*w]-1,coor,spaceDim,ptToFill);
+ INTERP_KERNEL::computeBarycenter2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(type,nodal+nodalI[*w]+1,nodalI[*w+1]-nodalI[*w]-1,coor,spaceDim,ptToFill);
ptToFill+=spaceDim;
}
delete [] tmp;
DataArrayDouble *MEDCouplingUMesh::computePlaneEquationOf3DFaces() const
{
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
- int nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType nbOfNodes(getNumberOfNodes());
if(getSpaceDimension()!=3 || getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computePlaneEquationOf3DFaces : This method must be applied on a mesh having meshDimension equal 2 and a spaceDimension equal to 3 !");
ret->alloc(nbOfCells,4);
double *retPtr(ret->getPointer());
- const int *nodal(_nodal_connec->begin()),*nodalI(_nodal_connec_index->begin());
+ const mcIdType *nodal(_nodal_connec->begin()),*nodalI(_nodal_connec_index->begin());
const double *coor(_coords->begin());
- for(int i=0;i<nbOfCells;i++,nodalI++,retPtr+=4)
+ for(mcIdType i=0;i<nbOfCells;i++,nodalI++,retPtr+=4)
{
double matrix[16]={0,0,0,1,0,0,0,1,0,0,0,1,1,1,1,0},matrix2[16];
if(nodalI[1]-nodalI[0]>=4)
double aa_norm(sqrt(aa[0]*aa[0]+aa[1]*aa[1]+aa[2]*aa[2])),bb_norm(sqrt(bb[0]*bb[0]+bb[1]*bb[1]+bb[2]*bb[2]));
for(int j=0;j<3;j++)
{
- int nodeId(nodal[nodalI[0]+1+j]);
+ mcIdType nodeId(nodal[nodalI[0]+1+j]);
if(nodeId>=0 && nodeId<nbOfNodes)
std::copy(coor+nodeId*3,coor+(nodeId+1)*3,matrix+4*j);
else
}
//
double dd[3]={0.,0.,0.};
- for(int offset=nodalI[0]+1;offset<nodalI[1];offset++)
+ for(mcIdType offset=nodalI[0]+1;offset<nodalI[1];offset++)
std::transform(coor+3*nodal[offset],coor+3*(nodal[offset]+1),dd,dd,std::plus<double>());
- int nbOfNodesInCell(nodalI[1]-nodalI[0]-1);
+ mcIdType nbOfNodesInCell(nodalI[1]-nodalI[0]-1);
std::transform(dd,dd+3,dd,std::bind2nd(std::multiplies<double>(),1./(double)nbOfNodesInCell));
std::copy(dd,dd+3,matrix+4*2);
INTERP_KERNEL::inverseMatrix(matrix,4,matrix2);
if(name.empty())
ret->setName("Mesh");
ret->setCoords(da);
- int nbOfTuples(da->getNumberOfTuples());
- MCAuto<DataArrayInt> c(DataArrayInt::New()),cI(DataArrayInt::New());
+ mcIdType nbOfTuples(da->getNumberOfTuples());
+ MCAuto<DataArrayIdType> c(DataArrayIdType::New()),cI(DataArrayIdType::New());
c->alloc(2*nbOfTuples,1);
cI->alloc(nbOfTuples+1,1);
- int *cp(c->getPointer()),*cip(cI->getPointer());
+ mcIdType *cp(c->getPointer()),*cip(cI->getPointer());
*cip++=0;
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
*cp++=INTERP_KERNEL::NORM_POINT1;
*cp++=i;
const MEDCouplingUMesh *cur=a[i];
const DataArrayDouble *coo=cur->getCoords();
if(coo)
- spaceDim=coo->getNumberOfComponents();
+ spaceDim=int(coo->getNumberOfComponents());
}
if(spaceDim==-3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::MergeUMeshes : no spaceDim specified ! unable to perform merge !");
const DataArrayDouble *coords=meshes.front()->getCoords();
int meshDim=meshes.front()->getMeshDimension();
std::vector<const MEDCouplingUMesh *>::const_iterator iter=meshes.begin();
- int meshLgth=0;
- int meshIndexLgth=0;
+ mcIdType meshLgth=0;
+ mcIdType meshIndexLgth=0;
for(;iter!=meshes.end();iter++)
{
if(coords!=(*iter)->getCoords())
meshLgth+=(*iter)->getNodalConnectivityArrayLen();
meshIndexLgth+=(*iter)->getNumberOfCells();
}
- MCAuto<DataArrayInt> nodal=DataArrayInt::New();
+ MCAuto<DataArrayIdType> nodal=DataArrayIdType::New();
nodal->alloc(meshLgth,1);
- int *nodalPtr=nodal->getPointer();
- MCAuto<DataArrayInt> nodalIndex=DataArrayInt::New();
+ mcIdType *nodalPtr=nodal->getPointer();
+ MCAuto<DataArrayIdType> nodalIndex=DataArrayIdType::New();
nodalIndex->alloc(meshIndexLgth+1,1);
- int *nodalIndexPtr=nodalIndex->getPointer();
- int offset=0;
+ mcIdType *nodalIndexPtr=nodalIndex->getPointer();
+ mcIdType offset=0;
for(iter=meshes.begin();iter!=meshes.end();iter++)
{
- const int *nod=(*iter)->getNodalConnectivity()->begin();
- const int *index=(*iter)->getNodalConnectivityIndex()->begin();
- int nbOfCells=(*iter)->getNumberOfCells();
- int meshLgth2=(*iter)->getNodalConnectivityArrayLen();
+ const mcIdType *nod=(*iter)->getNodalConnectivity()->begin();
+ const mcIdType *index=(*iter)->getNodalConnectivityIndex()->begin();
+ mcIdType nbOfCells=(*iter)->getNumberOfCells();
+ mcIdType meshLgth2=(*iter)->getNodalConnectivityArrayLen();
nodalPtr=std::copy(nod,nod+meshLgth2,nodalPtr);
if(iter!=meshes.begin())
- nodalIndexPtr=std::transform(index+1,index+nbOfCells+1,nodalIndexPtr,std::bind2nd(std::plus<int>(),offset));
+ nodalIndexPtr=std::transform(index+1,index+nbOfCells+1,nodalIndexPtr,std::bind2nd(std::plus<mcIdType>(),offset));
else
nodalIndexPtr=std::copy(index,index+nbOfCells+1,nodalIndexPtr);
offset+=meshLgth2;
* \param [in] meshes - a vector of meshes (MEDCouplingUMesh) to concatenate.
* \param [in] compType - specifies a cell comparison technique. For meaning of its
* valid values [0,1,2], see zipConnectivityTraducer().
- * \param [in,out] corr - an array of DataArrayInt, of the same size as \a
+ * \param [in,out] corr - an array of DataArrayIdType, of the same size as \a
* meshes. The *i*-th array describes cell ids mapping for \a meshes[ *i* ]
* mesh. The caller is to delete each of the arrays using decrRef() as it is
* no more needed.
* \throw If the nodal connectivity of cells of any of \a meshes is not defined.
* \throw If the nodal connectivity any of \a meshes includes an invalid id.
*/
-MEDCouplingUMesh *MEDCouplingUMesh::FuseUMeshesOnSameCoords(const std::vector<const MEDCouplingUMesh *>& meshes, int compType, std::vector<DataArrayInt *>& corr)
+MEDCouplingUMesh *MEDCouplingUMesh::FuseUMeshesOnSameCoords(const std::vector<const MEDCouplingUMesh *>& meshes, int compType, std::vector<DataArrayIdType *>& corr)
{
//All checks are delegated to MergeUMeshesOnSameCoords
MCAuto<MEDCouplingUMesh> ret=MergeUMeshesOnSameCoords(meshes);
- MCAuto<DataArrayInt> o2n=ret->zipConnectivityTraducer(compType);
+ MCAuto<DataArrayIdType> o2n=ret->zipConnectivityTraducer(compType);
corr.resize(meshes.size());
std::size_t nbOfMeshes=meshes.size();
- int offset=0;
- const int *o2nPtr=o2n->begin();
+ mcIdType offset=0;
+ const mcIdType *o2nPtr=o2n->begin();
for(std::size_t i=0;i<nbOfMeshes;i++)
{
- DataArrayInt *tmp=DataArrayInt::New();
- int curNbOfCells=meshes[i]->getNumberOfCells();
+ DataArrayIdType *tmp=DataArrayIdType::New();
+ mcIdType curNbOfCells=meshes[i]->getNumberOfCells();
tmp->alloc(curNbOfCells,1);
std::copy(o2nPtr+offset,o2nPtr+offset+curNbOfCells,tmp->getPointer());
offset+=curNbOfCells;
}
MCAuto<DataArrayDouble> res=DataArrayDouble::Aggregate(coords);
std::vector<MEDCouplingUMesh *>::const_iterator it=meshes.begin();
- int offset=(*it)->getNumberOfNodes();
+ mcIdType offset=(*it)->getNumberOfNodes();
(*it++)->setCoords(res);
for(;it!=meshes.end();it++)
{
- int oldNumberOfNodes=(*it)->getNumberOfNodes();
+ mcIdType oldNumberOfNodes=(*it)->getNumberOfNodes();
(*it)->setCoords(res);
(*it)->shiftNodeNumbersInConn(offset);
offset+=oldNumberOfNodes;
if(!coo)
return;
//
- DataArrayInt *comm,*commI;
+ DataArrayIdType *comm,*commI;
coo->findCommonTuples(eps,-1,comm,commI);
- MCAuto<DataArrayInt> tmp1(comm),tmp2(commI);
- int oldNbOfNodes=coo->getNumberOfTuples();
- int newNbOfNodes;
- MCAuto<DataArrayInt> o2n=DataArrayInt::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes);
+ MCAuto<DataArrayIdType> tmp1(comm),tmp2(commI);
+ mcIdType oldNbOfNodes=coo->getNumberOfTuples();
+ mcIdType newNbOfNodes;
+ MCAuto<DataArrayIdType> o2n=DataArrayIdType::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes);
if(oldNbOfNodes==newNbOfNodes)
return ;
MCAuto<DataArrayDouble> newCoords=coo->renumberAndReduce(o2n->begin(),newNbOfNodes);
/*!
* This static operates only for coords in 3D. The polygon is specified by its connectivity nodes in [ \a begin , \a end ).
*/
-bool MEDCouplingUMesh::IsPolygonWellOriented(bool isQuadratic, const double *vec, const int *begin, const int *end, const double *coords)
+bool MEDCouplingUMesh::IsPolygonWellOriented(bool isQuadratic, const double *vec, const mcIdType *begin, const mcIdType *end, const double *coords)
{
std::size_t i, ip1;
double v[3]={0.,0.,0.};
// Same algorithm as above but also using intermediate quadratic points.
// (taking only linear points might lead to issues if the linearized version of the
// polygon is not convex or self-intersecting ... see testCellOrientation4)
- int hsz = sz/2;
+ std::size_t hsz = sz/2;
for(std::size_t j=0;j<sz;j++)
{
if (j%2) // current point i is quadratic, next point i+1 is standard
/*!
* The polyhedron is specified by its connectivity nodes in [ \a begin , \a end ).
*/
-bool MEDCouplingUMesh::IsPolyhedronWellOriented(const int *begin, const int *end, const double *coords)
+bool MEDCouplingUMesh::IsPolyhedronWellOriented(const mcIdType *begin, const mcIdType *end, const double *coords)
{
- std::vector<std::pair<int,int> > edges;
+ std::vector<std::pair<mcIdType,mcIdType> > edges;
std::size_t nbOfFaces=std::count(begin,end,-1)+1;
- const int *bgFace=begin;
+ const mcIdType *bgFace=begin;
for(std::size_t i=0;i<nbOfFaces;i++)
{
- const int *endFace=std::find(bgFace+1,end,-1);
+ const mcIdType *endFace=std::find(bgFace+1,end,-1);
std::size_t nbOfEdgesInFace=std::distance(bgFace,endFace);
for(std::size_t j=0;j<nbOfEdgesInFace;j++)
{
- std::pair<int,int> p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]);
+ std::pair<mcIdType,mcIdType> p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]);
if(std::find(edges.begin(),edges.end(),p1)!=edges.end())
return false;
edges.push_back(p1);
}
bgFace=endFace+1;
}
- return INTERP_KERNEL::calculateVolumeForPolyh2<int,INTERP_KERNEL::ALL_C_MODE>(begin,(int)std::distance(begin,end),coords)>-EPS_FOR_POLYH_ORIENTATION;
+ return INTERP_KERNEL::calculateVolumeForPolyh2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(begin,ToIdType(std::distance(begin,end)),coords)>-EPS_FOR_POLYH_ORIENTATION;
}
/*!
* The 3D extruded static cell (PENTA6,HEXA8,HEXAGP12...) its connectivity nodes in [ \a begin , \a end ).
*/
-bool MEDCouplingUMesh::Is3DExtrudedStaticCellWellOriented(const int *begin, const int *end, const double *coords)
+bool MEDCouplingUMesh::Is3DExtrudedStaticCellWellOriented(const mcIdType *begin, const mcIdType *end, const double *coords)
{
double vec0[3],vec1[3];
std::size_t sz=std::distance(begin,end);
if(sz%2!=0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Is3DExtrudedStaticCellWellOriented : the length of nodal connectivity of extruded cell is not even !");
- int nbOfNodes=(int)sz/2;
- INTERP_KERNEL::areaVectorOfPolygon<int,INTERP_KERNEL::ALL_C_MODE>(begin,nbOfNodes,coords,vec0);
+ mcIdType nbOfNodes=ToIdType(sz/2);
+ INTERP_KERNEL::areaVectorOfPolygon<mcIdType,INTERP_KERNEL::ALL_C_MODE>(begin,nbOfNodes,coords,vec0);
const double *pt0=coords+3*begin[0];
const double *pt1=coords+3*begin[nbOfNodes];
vec1[0]=pt1[0]-pt0[0]; vec1[1]=pt1[1]-pt0[1]; vec1[2]=pt1[2]-pt0[2];
return (vec0[0]*vec1[0]+vec0[1]*vec1[1]+vec0[2]*vec1[2])<0.;
}
-void MEDCouplingUMesh::CorrectExtrudedStaticCell(int *begin, int *end)
+void MEDCouplingUMesh::CorrectExtrudedStaticCell(mcIdType *begin, mcIdType *end)
{
std::size_t sz=std::distance(begin,end);
- INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=new mcIdType[sz];
std::size_t nbOfNodes(sz/2);
- std::copy(begin,end,(int *)tmp);
+ std::copy(begin,end,(mcIdType *)tmp);
for(std::size_t j=1;j<nbOfNodes;j++)
{
begin[j]=tmp[nbOfNodes-j];
}
}
-bool MEDCouplingUMesh::IsTetra4WellOriented(const int *begin, const int *end, const double *coords)
+bool MEDCouplingUMesh::IsTetra4WellOriented(const mcIdType *begin, const mcIdType *end, const double *coords)
{
std::size_t sz=std::distance(begin,end);
if(sz!=4)
return ((vec0[1]*vec1[2]-vec0[2]*vec1[1])*(pt3[0]-pt0[0])+(vec0[2]*vec1[0]-vec0[0]*vec1[2])*(pt3[1]-pt0[1])+(vec0[0]*vec1[1]-vec0[1]*vec1[0])*(pt3[2]-pt0[2]))<0;
}
-bool MEDCouplingUMesh::IsPyra5WellOriented(const int *begin, const int *end, const double *coords)
+bool MEDCouplingUMesh::IsPyra5WellOriented(const mcIdType *begin, const mcIdType *end, const double *coords)
{
std::size_t sz=std::distance(begin,end);
if(sz!=5)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::IsPyra5WellOriented : Pyra5 cell with not 5 nodes ! Call checkConsistency !");
double vec0[3];
- INTERP_KERNEL::areaVectorOfPolygon<int,INTERP_KERNEL::ALL_C_MODE>(begin,4,coords,vec0);
+ INTERP_KERNEL::areaVectorOfPolygon<mcIdType,INTERP_KERNEL::ALL_C_MODE>(begin,4,coords,vec0);
const double *pt0=coords+3*begin[0],*pt1=coords+3*begin[4];
return (vec0[0]*(pt1[0]-pt0[0])+vec0[1]*(pt1[1]-pt0[1])+vec0[2]*(pt1[2]-pt0[2]))<0.;
}
* \param [in] end end of nodal connectivity of a single polyhedron cell (excluded)
* \param [out] res the result is put at the end of the vector without any alteration of the data.
*/
-void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble *coords, int index, DataArrayInt *res, MEDCouplingUMesh *faces,
- DataArrayInt *E_Fi, DataArrayInt *E_F, DataArrayInt *F_Ei, DataArrayInt *F_E)
+void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble *coords, mcIdType index, DataArrayIdType *res, MEDCouplingUMesh *faces,
+ DataArrayIdType *E_Fi, DataArrayIdType *E_F, DataArrayIdType *F_Ei, DataArrayIdType *F_E)
{
- int nbFaces = E_Fi->getIJ(index + 1, 0) - E_Fi->getIJ(index, 0);
+ mcIdType nbFaces = E_Fi->getIJ(index + 1, 0) - E_Fi->getIJ(index, 0);
MCAuto<DataArrayDouble> v=DataArrayDouble::New(); v->alloc(nbFaces,3);
double *vPtr=v->getPointer();
MCAuto<DataArrayDouble> p=DataArrayDouble::New(); p->alloc(nbFaces,2);
double *pPtr=p->getPointer();
- int *e_fi = E_Fi->getPointer(), *e_f = E_F->getPointer(), *f_ei = F_Ei->getPointer(), *f_e = F_E->getPointer();
- const int *f_idx = faces->getNodalConnectivityIndex()->getPointer(), *f_cnn = faces->getNodalConnectivity()->getPointer();
- for(int i=0;i<nbFaces;i++,vPtr+=3,pPtr++)
+ mcIdType *e_fi = E_Fi->getPointer(), *e_f = E_F->getPointer(), *f_ei = F_Ei->getPointer(), *f_e = F_E->getPointer();
+ const mcIdType *f_idx = faces->getNodalConnectivityIndex()->getPointer(), *f_cnn = faces->getNodalConnectivity()->getPointer();
+ for(mcIdType i=0;i<nbFaces;i++,vPtr+=3,pPtr++)
{
- int face = e_f[e_fi[index] + i];
+ mcIdType face = e_f[e_fi[index] + i];
ComputeVecAndPtOfFace(eps, coords->begin(), f_cnn + f_idx[face] + 1, f_cnn + f_idx[face + 1], vPtr, pPtr);
// to differentiate faces going to different cells:
pPtr++, *pPtr = 0;
- for (int j = f_ei[face]; j < f_ei[face + 1]; j++)
- *pPtr += f_e[j];
+ for (mcIdType j = f_ei[face]; j < f_ei[face + 1]; j++)
+ *pPtr += FromIdType<double>(f_e[j]);
}
pPtr=p->getPointer(); vPtr=v->getPointer();
- DataArrayInt *comm1=0,*commI1=0;
+ DataArrayIdType *comm1=0,*commI1=0;
v->findCommonTuples(eps,-1,comm1,commI1);
- for (int i = 0; i < nbFaces; i++)
+ for (mcIdType i = 0; i < nbFaces; i++)
if (comm1->findIdFirstEqual(i) < 0)
{
comm1->pushBackSilent(i);
commI1->pushBackSilent(comm1->getNumberOfTuples());
}
- MCAuto<DataArrayInt> comm1Auto(comm1),commI1Auto(commI1);
- const int *comm1Ptr=comm1->begin();
- const int *commI1Ptr=commI1->begin();
- int nbOfGrps1=commI1Auto->getNumberOfTuples()-1;
- res->pushBackSilent((int)INTERP_KERNEL::NORM_POLYHED);
+ MCAuto<DataArrayIdType> comm1Auto(comm1),commI1Auto(commI1);
+ const mcIdType *comm1Ptr=comm1->begin();
+ const mcIdType *commI1Ptr=commI1->begin();
+ mcIdType nbOfGrps1=commI1Auto->getNumberOfTuples()-1;
+ res->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_POLYHED));
//
- for(int i=0;i<nbOfGrps1;i++)
+ for(mcIdType i=0;i<nbOfGrps1;i++)
{
- int vecId=comm1Ptr[commI1Ptr[i]];
+ mcIdType vecId=comm1Ptr[commI1Ptr[i]];
MCAuto<DataArrayDouble> tmpgrp2=p->selectByTupleId(comm1Ptr+commI1Ptr[i],comm1Ptr+commI1Ptr[i+1]);
- DataArrayInt *comm2=0,*commI2=0;
+ DataArrayIdType *comm2=0,*commI2=0;
tmpgrp2->findCommonTuples(eps,-1,comm2,commI2);
- for (int j = 0; j < commI1Ptr[i+1] - commI1Ptr[i]; j++)
+ for (mcIdType j = 0; j < commI1Ptr[i+1] - commI1Ptr[i]; j++)
if (comm2->findIdFirstEqual(j) < 0)
{
comm2->pushBackSilent(j);
commI2->pushBackSilent(comm2->getNumberOfTuples());
}
- MCAuto<DataArrayInt> comm2Auto(comm2),commI2Auto(commI2);
- const int *comm2Ptr=comm2->begin();
- const int *commI2Ptr=commI2->begin();
- int nbOfGrps2=commI2Auto->getNumberOfTuples()-1;
- for(int j=0;j<nbOfGrps2;j++)
+ MCAuto<DataArrayIdType> comm2Auto(comm2),commI2Auto(commI2);
+ const mcIdType *comm2Ptr=comm2->begin();
+ const mcIdType *commI2Ptr=commI2->begin();
+ mcIdType nbOfGrps2=commI2Auto->getNumberOfTuples()-1;
+ for(mcIdType j=0;j<nbOfGrps2;j++)
{
if(commI2Ptr[j+1] == commI2Ptr[j] + 1)
{
- int face = e_f[e_fi[index] + comm1Ptr[commI1Ptr[i] + comm2Ptr[commI2Ptr[j]]]]; //hmmm
+ mcIdType face = e_f[e_fi[index] + comm1Ptr[commI1Ptr[i] + comm2Ptr[commI2Ptr[j]]]]; //hmmm
res->insertAtTheEnd(f_cnn + f_idx[face] + 1, f_cnn + f_idx[face + 1]);
res->pushBackSilent(-1);
}
else
{
- int pointId=comm1Ptr[commI1Ptr[i]+comm2Ptr[commI2Ptr[j]]];
- MCAuto<DataArrayInt> ids2=comm2->selectByTupleIdSafeSlice(commI2Ptr[j],commI2Ptr[j+1],1);
+ mcIdType pointId=comm1Ptr[commI1Ptr[i]+comm2Ptr[commI2Ptr[j]]];
+ MCAuto<DataArrayIdType> ids2=comm2->selectByTupleIdSafeSlice(commI2Ptr[j],commI2Ptr[j+1],1);
ids2->transformWithIndArr(comm1Ptr+commI1Ptr[i],comm1Ptr+commI1Ptr[i+1]);
ids2->transformWithIndArr(e_f + e_fi[index], e_f + e_fi[index + 1]);
MCAuto<MEDCouplingUMesh> mm3=static_cast<MEDCouplingUMesh *>(faces->buildPartOfMySelf(ids2->begin(),ids2->end(),true));
- MCAuto<DataArrayInt> idsNodeTmp=mm3->zipCoordsTraducer();
- MCAuto<DataArrayInt> idsNode=idsNodeTmp->invertArrayO2N2N2O(mm3->getNumberOfNodes());
- const int *idsNodePtr=idsNode->begin();
+ MCAuto<DataArrayIdType> idsNodeTmp=mm3->zipCoordsTraducer();
+ MCAuto<DataArrayIdType> idsNode=idsNodeTmp->invertArrayO2N2N2O(mm3->getNumberOfNodes());
+ const mcIdType *idsNodePtr=idsNode->begin();
double center[3]; center[0]=pPtr[2*pointId]*vPtr[3*vecId]; center[1]=pPtr[2*pointId]*vPtr[3*vecId+1]; center[2]=pPtr[2*pointId]*vPtr[3*vecId+2];
double vec[3]; vec[0]=vPtr[3*vecId+1]; vec[1]=-vPtr[3*vecId]; vec[2]=0.;
double norm=vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2];
}
mm3->changeSpaceDimension(2);
MCAuto<MEDCouplingUMesh> mm4=mm3->buildSpreadZonesWithPoly();
- const int *conn4=mm4->getNodalConnectivity()->begin();
- const int *connI4=mm4->getNodalConnectivityIndex()->begin();
- int nbOfCells=mm4->getNumberOfCells();
- for(int k=0;k<nbOfCells;k++)
+ const mcIdType *conn4=mm4->getNodalConnectivity()->begin();
+ const mcIdType *connI4=mm4->getNodalConnectivityIndex()->begin();
+ mcIdType nbOfCells=mm4->getNumberOfCells();
+ for(mcIdType k=0;k<nbOfCells;k++)
{
int l=0;
- for(const int *work=conn4+connI4[k]+1;work!=conn4+connI4[k+1];work++,l++)
+ for(const mcIdType *work=conn4+connI4[k]+1;work!=conn4+connI4[k+1];work++,l++)
res->pushBackSilent(idsNodePtr[*work]);
res->pushBackSilent(-1);
}
* \param [out] v the normalized vector of size 3
* \param [out] p the pos of plane
*/
-void MEDCouplingUMesh::ComputeVecAndPtOfFace(double eps, const double *coords, const int *begin, const int *end, double *v, double *p)
+void MEDCouplingUMesh::ComputeVecAndPtOfFace(double eps, const double *coords, const mcIdType *begin, const mcIdType *end, double *v, double *p)
{
std::size_t nbPoints=std::distance(begin,end);
if(nbPoints<3)
* This method tries to obtain a well oriented polyhedron.
* If the algorithm fails, an exception will be thrown.
*/
-void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(int *begin, int *end, const double *coords)
+void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(mcIdType *begin, mcIdType *end, const double *coords)
{
- std::list< std::pair<int,int> > edgesOK,edgesFinished;
+ std::list< std::pair<mcIdType,mcIdType> > edgesOK,edgesFinished;
std::size_t nbOfFaces=std::count(begin,end,-1)+1;
std::vector<bool> isPerm(nbOfFaces,false);//field on faces False: I don't know, True : oriented
isPerm[0]=true;
- int *bgFace=begin,*endFace=std::find(begin+1,end,-1);
+ mcIdType *bgFace=begin,*endFace=std::find(begin+1,end,-1);
std::size_t nbOfEdgesInFace=std::distance(bgFace,endFace);
- for(std::size_t l=0;l<nbOfEdgesInFace;l++) { std::pair<int,int> p1(bgFace[l],bgFace[(l+1)%nbOfEdgesInFace]); edgesOK.push_back(p1); }
+ for(std::size_t l=0;l<nbOfEdgesInFace;l++) { std::pair<mcIdType,mcIdType> p1(bgFace[l],bgFace[(l+1)%nbOfEdgesInFace]); edgesOK.push_back(p1); }
//
while(std::find(isPerm.begin(),isPerm.end(),false)!=isPerm.end())
{
bool b;
for(std::size_t j=0;j<nbOfEdgesInFace;j++)
{
- std::pair<int,int> p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]);
- std::pair<int,int> p2(p1.second,p1.first);
+ std::pair<mcIdType,mcIdType> p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]);
+ std::pair<mcIdType,mcIdType> p2(p1.second,p1.first);
bool b1=std::find(edgesOK.begin(),edgesOK.end(),p1)!=edgesOK.end();
bool b2=std::find(edgesOK.begin(),edgesOK.end(),p2)!=edgesOK.end();
if(b1 || b2) { b=b2; isPerm[i]=true; smthChanged++; break; }
std::reverse(bgFace+1,endFace);
for(std::size_t j=0;j<nbOfEdgesInFace;j++)
{
- std::pair<int,int> p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]);
- std::pair<int,int> p2(p1.second,p1.first);
+ std::pair<mcIdType,mcIdType> p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]);
+ std::pair<mcIdType,mcIdType> p2(p1.second,p1.first);
if(std::find(edgesOK.begin(),edgesOK.end(),p1)!=edgesOK.end())
{ std::ostringstream oss; oss << "Face #" << j << " of polyhedron looks bad !"; throw INTERP_KERNEL::Exception(oss.str()); }
if(std::find(edgesFinished.begin(),edgesFinished.end(),p1)!=edgesFinished.end() || std::find(edgesFinished.begin(),edgesFinished.end(),p2)!=edgesFinished.end())
{ std::ostringstream oss; oss << "Face #" << j << " of polyhedron looks bad !"; throw INTERP_KERNEL::Exception(oss.str()); }
- std::list< std::pair<int,int> >::iterator it=std::find(edgesOK.begin(),edgesOK.end(),p2);
+ std::list< std::pair<mcIdType,mcIdType> >::iterator it=std::find(edgesOK.begin(),edgesOK.end(),p2);
if(it!=edgesOK.end())
{
edgesOK.erase(it);
}
if(!edgesOK.empty())
{ throw INTERP_KERNEL::Exception("The polyhedron looks too bad to be repaired : Some edges are shared only once !"); }
- if(INTERP_KERNEL::calculateVolumeForPolyh2<int,INTERP_KERNEL::ALL_C_MODE>(begin,(int)std::distance(begin,end),coords)<-EPS_FOR_POLYH_ORIENTATION)
+ if(INTERP_KERNEL::calculateVolumeForPolyh2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(begin,ToIdType(std::distance(begin,end)),coords)<-EPS_FOR_POLYH_ORIENTATION)
{//not lucky ! The first face was not correctly oriented : reorient all faces...
bgFace=begin;
for(std::size_t i=0;i<nbOfFaces;i++)
*
* \return a newly allocated array containing the connectivity of a polygon type enum included (NORM_POLYGON in pos#0)
*/
-DataArrayInt *MEDCouplingUMesh::buildUnionOf2DMesh() const
+DataArrayIdType *MEDCouplingUMesh::buildUnionOf2DMesh() const
{
if(getMeshDimension()!=2 || getSpaceDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildUnionOf2DMesh : meshdimension, spacedimension must be equal to 2 !");
MCAuto<MEDCouplingUMesh> skin(computeSkin());
- int oldNbOfNodes(skin->getNumberOfNodes());
- MCAuto<DataArrayInt> o2n(skin->zipCoordsTraducer());
- int nbOfNodesExpected(skin->getNumberOfNodes());
- MCAuto<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(oldNbOfNodes));
- int nbCells(skin->getNumberOfCells());
+ mcIdType oldNbOfNodes(skin->getNumberOfNodes());
+ MCAuto<DataArrayIdType> o2n(skin->zipCoordsTraducer());
+ mcIdType nbOfNodesExpected(skin->getNumberOfNodes());
+ MCAuto<DataArrayIdType> n2o(o2n->invertArrayO2N2N2O(oldNbOfNodes));
+ mcIdType nbCells=skin->getNumberOfCells();
if(nbCells==nbOfNodesExpected)
return buildUnionOf2DMeshLinear(skin,n2o);
else if(2*nbCells==nbOfNodesExpected)
*
* \return a newly allocated array containing the connectivity of a polygon type enum included (NORM_POLYHED in pos#0)
*/
-DataArrayInt *MEDCouplingUMesh::buildUnionOf3DMesh() const
+DataArrayIdType *MEDCouplingUMesh::buildUnionOf3DMesh() const
{
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildUnionOf3DMesh : meshdimension, spacedimension must be equal to 2 !");
MCAuto<MEDCouplingUMesh> m=computeSkin();
- const int *conn=m->getNodalConnectivity()->begin();
- const int *connI=m->getNodalConnectivityIndex()->begin();
- int nbOfCells=m->getNumberOfCells();
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(m->getNodalConnectivity()->getNumberOfTuples(),1);
- int *work=ret->getPointer(); *work++=INTERP_KERNEL::NORM_POLYHED;
+ const mcIdType *conn=m->getNodalConnectivity()->begin();
+ const mcIdType *connI=m->getNodalConnectivityIndex()->begin();
+ mcIdType nbOfCells=m->getNumberOfCells();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(m->getNodalConnectivity()->getNumberOfTuples(),1);
+ mcIdType *work=ret->getPointer(); *work++=INTERP_KERNEL::NORM_POLYHED;
if(nbOfCells<1)
return ret.retn();
work=std::copy(conn+connI[0]+1,conn+connI[1],work);
- for(int i=1;i<nbOfCells;i++)
+ for(mcIdType i=1;i<nbOfCells;i++)
{
*work++=-1;
work=std::copy(conn+connI[i]+1,conn+connI[i+1],work);
checkConnectivityFullyDefined();
int meshDim = this->getMeshDimension();
- MEDCoupling::DataArrayInt* indexr=MEDCoupling::DataArrayInt::New();
- MEDCoupling::DataArrayInt* revConn=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType* indexr=MEDCoupling::DataArrayIdType::New();
+ MEDCoupling::DataArrayIdType* revConn=MEDCoupling::DataArrayIdType::New();
this->getReverseNodalConnectivity(revConn,indexr);
- const int* indexr_ptr=indexr->begin();
- const int* revConn_ptr=revConn->begin();
+ const mcIdType* indexr_ptr=indexr->begin();
+ const mcIdType* revConn_ptr=revConn->begin();
- const MEDCoupling::DataArrayInt* index;
- const MEDCoupling::DataArrayInt* conn;
+ const MEDCoupling::DataArrayIdType* index;
+ const MEDCoupling::DataArrayIdType* conn;
conn=this->getNodalConnectivity(); // it includes a type as the 1st element!!!
index=this->getNodalConnectivityIndex();
- int nbCells=this->getNumberOfCells();
- const int* index_ptr=index->begin();
- const int* conn_ptr=conn->begin();
+ mcIdType nbCells=this->getNumberOfCells();
+ const mcIdType* index_ptr=index->begin();
+ const mcIdType* conn_ptr=conn->begin();
//creating graph arcs (cell to cell relations)
//arcs are stored in terms of (index,value) notation
//warning here one node have less than or equal effective number of cell with it
//but cell could have more than effective nodes
//because other equals nodes in other domain (with other global inode)
- std::vector <int> cell2cell_index(nbCells+1,0);
- std::vector <int> cell2cell;
+ std::vector <mcIdType> cell2cell_index(nbCells+1,0);
+ std::vector <mcIdType> cell2cell;
cell2cell.reserve(3*nbCells);
- for (int icell=0; icell<nbCells;icell++)
+ for (mcIdType icell=0; icell<nbCells;icell++)
{
- std::map<int,int > counter;
- for (int iconn=index_ptr[icell]+1; iconn<index_ptr[icell+1];iconn++)
+ std::map<mcIdType,mcIdType > counter;
+ for (mcIdType iconn=index_ptr[icell]+1; iconn<index_ptr[icell+1];iconn++)
{
- int inode=conn_ptr[iconn];
- for (int iconnr=indexr_ptr[inode]; iconnr<indexr_ptr[inode+1];iconnr++)
+ mcIdType inode=conn_ptr[iconn];
+ for (mcIdType iconnr=indexr_ptr[inode]; iconnr<indexr_ptr[inode+1];iconnr++)
{
- int icell2=revConn_ptr[iconnr];
- std::map<int,int>::iterator iter=counter.find(icell2);
+ mcIdType icell2=revConn_ptr[iconnr];
+ std::map<mcIdType,mcIdType>::iterator iter=counter.find(icell2);
if (iter!=counter.end()) (iter->second)++;
else counter.insert(std::make_pair(icell2,1));
}
}
- for (std::map<int,int>::const_iterator iter=counter.begin();
+ for (std::map<mcIdType,mcIdType>::const_iterator iter=counter.begin();
iter!=counter.end(); iter++)
if (iter->second >= meshDim)
{
indexr->decrRef();
revConn->decrRef();
cell2cell_index[0]=0;
- for (int icell=0; icell<nbCells;icell++)
+ for (mcIdType icell=0; icell<nbCells;icell++)
cell2cell_index[icell+1]=cell2cell_index[icell]+cell2cell_index[icell+1];
//filling up index and value to create skylinearray structure
void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(nbOfCells<=0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::writeVTK : the unstructured mesh has no cells !");
ofs << " <" << getVTKDataSetType() << ">\n";
}
ofs << " </Points>\n";
ofs << " <Cells>\n";
- const int *cPtr=_nodal_connec->begin();
- const int *cIPtr=_nodal_connec_index->begin();
- MCAuto<DataArrayInt> faceoffsets=DataArrayInt::New(); faceoffsets->alloc(nbOfCells,1);
- MCAuto<DataArrayInt> types=DataArrayInt::New(); types->alloc(nbOfCells,1);
- MCAuto<DataArrayInt> offsets=DataArrayInt::New(); offsets->alloc(nbOfCells,1);
- MCAuto<DataArrayInt> connectivity=DataArrayInt::New(); connectivity->alloc(_nodal_connec->getNumberOfTuples()-nbOfCells,1);
- int *w1=faceoffsets->getPointer(),*w2=types->getPointer(),*w3=offsets->getPointer(),*w4=connectivity->getPointer();
- int szFaceOffsets=0,szConn=0;
- for(int i=0;i<nbOfCells;i++,w1++,w2++,w3++)
+ const mcIdType *cPtr=_nodal_connec->begin();
+ const mcIdType *cIPtr=_nodal_connec_index->begin();
+ MCAuto<DataArrayIdType> faceoffsets=DataArrayIdType::New(); faceoffsets->alloc(nbOfCells,1);
+ MCAuto<DataArrayIdType> types=DataArrayIdType::New(); types->alloc(nbOfCells,1);
+ MCAuto<DataArrayIdType> offsets=DataArrayIdType::New(); offsets->alloc(nbOfCells,1);
+ MCAuto<DataArrayIdType> connectivity=DataArrayIdType::New(); connectivity->alloc(_nodal_connec->getNumberOfTuples()-nbOfCells,1);
+ mcIdType *w1=faceoffsets->getPointer(),*w2=types->getPointer(),*w3=offsets->getPointer(),*w4=connectivity->getPointer();
+ mcIdType szFaceOffsets=0,szConn=0;
+ for(mcIdType i=0;i<nbOfCells;i++,w1++,w2++,w3++)
{
*w2=cPtr[cIPtr[i]];
if((INTERP_KERNEL::NormalizedCellType)cPtr[cIPtr[i]]!=INTERP_KERNEL::NORM_POLYHED)
}
else
{
- int deltaFaceOffset=cIPtr[i+1]-cIPtr[i]+1;
+ mcIdType deltaFaceOffset=cIPtr[i+1]-cIPtr[i]+1;
*w1=szFaceOffsets+deltaFaceOffset; szFaceOffsets+=deltaFaceOffset;
- std::set<int> c(cPtr+cIPtr[i]+1,cPtr+cIPtr[i+1]); c.erase(-1);
- *w3=szConn+(int)c.size(); szConn+=(int)c.size();
+ std::set<mcIdType> c(cPtr+cIPtr[i]+1,cPtr+cIPtr[i+1]); c.erase(-1);
+ *w3=szConn+ToIdType(c.size()); szConn+=ToIdType(c.size());
w4=std::copy(c.begin(),c.end(),w4);
}
}
types->transformWithIndArr(MEDCOUPLING2VTKTYPETRADUCER,MEDCOUPLING2VTKTYPETRADUCER+INTERP_KERNEL::NORM_MAXTYPE+1);
types->writeVTK(ofs,8,"UInt8","types",byteData);
- offsets->writeVTK(ofs,8,"Int32","offsets",byteData);
+ std::string vtkTypeName = Traits<mcIdType>::VTKReprStr;
+ offsets->writeVTK(ofs,8,vtkTypeName,"offsets",byteData);
if(szFaceOffsets!=0)
{//presence of Polyhedra
connectivity->reAlloc(szConn);
- faceoffsets->writeVTK(ofs,8,"Int32","faceoffsets",byteData);
- MCAuto<DataArrayInt> faces=DataArrayInt::New(); faces->alloc(szFaceOffsets,1);
+ faceoffsets->writeVTK(ofs,8,vtkTypeName,"faceoffsets",byteData);
+ MCAuto<DataArrayIdType> faces=DataArrayIdType::New(); faces->alloc(szFaceOffsets,1);
w1=faces->getPointer();
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
if((INTERP_KERNEL::NormalizedCellType)cPtr[cIPtr[i]]==INTERP_KERNEL::NORM_POLYHED)
{
- int nbFaces=std::count(cPtr+cIPtr[i]+1,cPtr+cIPtr[i+1],-1)+1;
+ mcIdType nbFaces=ToIdType(std::count(cPtr+cIPtr[i]+1,cPtr+cIPtr[i+1],-1))+1;
*w1++=nbFaces;
- const int *w6=cPtr+cIPtr[i]+1,*w5=0;
- for(int j=0;j<nbFaces;j++)
+ const mcIdType *w6=cPtr+cIPtr[i]+1,*w5=0;
+ for(mcIdType j=0;j<nbFaces;j++)
{
w5=std::find(w6,cPtr+cIPtr[i+1],-1);
- *w1++=(int)std::distance(w6,w5);
+ *w1++=ToIdType(std::distance(w6,w5));
w1=std::copy(w6,w5,w1);
w6=w5+1;
}
}
- faces->writeVTK(ofs,8,"Int32","faces",byteData);
+ faces->writeVTK(ofs,8,vtkTypeName,"faces",byteData);
}
- connectivity->writeVTK(ofs,8,"Int32","connectivity",byteData);
+ connectivity->writeVTK(ofs,8,vtkTypeName,"connectivity",byteData);
ofs << " </Cells>\n";
ofs << " </Piece>\n";
ofs << " </" << getVTKDataSetType() << ">\n";
{ stream << std::endl << "Nodal connectivity NOT set !"; return ; }
if(!_nodal_connec_index->isAllocated())
{ stream << std::endl << "Nodal connectivity set but not allocated !"; return ; }
- int lgth=_nodal_connec_index->getNumberOfTuples();
- int cpt=_nodal_connec_index->getNumberOfComponents();
+ mcIdType lgth=_nodal_connec_index->getNumberOfTuples();
+ std::size_t cpt=_nodal_connec_index->getNumberOfComponents();
if(cpt!=1 || lgth<1)
return ;
stream << std::endl << "Number of cells : " << lgth-1 << ".";
* Provides a renumbering of the cells of this (which has to be a piecewise connected 1D line), so that
* the segments of the line are indexed in consecutive order (i.e. cells \a i and \a i+1 are neighbors).
* This doesn't modify the mesh. This method only works using nodal connectivity consideration. Coordinates of nodes are ignored here.
- * The caller is to deal with the resulting DataArrayInt.
+ * The caller is to deal with the resulting DataArrayIdType.
* \throw If the coordinate array is not set.
* \throw If the nodal connectivity of the cells is not defined.
* \throw If m1 is not a mesh of dimension 2, or m1 is not a mesh of dimension 1
* \throw If m2 is not a (piecewise) line (i.e. if a point has more than 2 adjacent segments)
*
- * \sa DataArrayInt::sortEachPairToMakeALinkedList
+ * \sa DataArrayIdType::sortEachPairToMakeALinkedList
*/
-DataArrayInt *MEDCouplingUMesh::orderConsecutiveCells1D() const
+DataArrayIdType *MEDCouplingUMesh::orderConsecutiveCells1D() const
{
checkFullyDefined();
if(getMeshDimension()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::orderConsecutiveCells1D works on unstructured mesh with meshdim = 1 !");
// Check that this is a line (and not a more complex 1D mesh) - each point is used at most by 2 segments:
- MCAuto<DataArrayInt> _d(DataArrayInt::New()),_dI(DataArrayInt::New());
- MCAuto<DataArrayInt> _rD(DataArrayInt::New()),_rDI(DataArrayInt::New());
+ MCAuto<DataArrayIdType> _d(DataArrayIdType::New()),_dI(DataArrayIdType::New());
+ MCAuto<DataArrayIdType> _rD(DataArrayIdType::New()),_rDI(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> m_points(buildDescendingConnectivity(_d, _dI, _rD, _rDI));
- const int *d(_d->begin()), *dI(_dI->begin());
- const int *rD(_rD->begin()), *rDI(_rDI->begin());
- MCAuto<DataArrayInt> _dsi(_rDI->deltaShiftIndex());
- const int * dsi(_dsi->begin());
- MCAuto<DataArrayInt> dsii = _dsi->findIdsNotInRange(0,3);
+ const mcIdType *d(_d->begin()), *dI(_dI->begin());
+ const mcIdType *rD(_rD->begin()), *rDI(_rDI->begin());
+ MCAuto<DataArrayIdType> _dsi(_rDI->deltaShiftIndex());
+ const mcIdType * dsi(_dsi->begin());
+ MCAuto<DataArrayIdType> dsii = _dsi->findIdsNotInRange(0,3);
m_points=0;
if (dsii->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::orderConsecutiveCells1D only work with a mesh being a (piecewise) connected line!");
- int nc(getNumberOfCells());
- MCAuto<DataArrayInt> result(DataArrayInt::New());
+ mcIdType nc=getNumberOfCells();
+ MCAuto<DataArrayIdType> result(DataArrayIdType::New());
result->alloc(nc,1);
// set of edges not used so far
- std::set<int> edgeSet;
- for (int i=0; i<nc; edgeSet.insert(i), i++);
+ std::set<mcIdType> edgeSet;
+ for (mcIdType i=0; i<nc; edgeSet.insert(i), i++);
- int startSeg=0;
- int newIdx=0;
+ mcIdType startSeg=0;
+ mcIdType newIdx=0;
// while we have points with only one neighbor segments
do
{
- std::list<int> linePiece;
+ std::list<mcIdType> linePiece;
// fills a list of consecutive segment linked to startSeg. This can go forward or backward.
for (int direction=0;direction<2;direction++) // direction=0 --> forward, direction=1 --> backward
{
// Fill the list forward (resp. backward) from the start segment:
- int activeSeg = startSeg;
- int prevPointId = -20;
- int ptId;
+ mcIdType activeSeg = startSeg;
+ mcIdType prevPointId = -20;
+ mcIdType ptId;
while (!edgeSet.empty())
{
if (!(direction == 1 && prevPointId==-20)) // prevent adding twice startSeg
edgeSet.erase(activeSeg);
}
- int ptId1 = d[dI[activeSeg]], ptId2 = d[dI[activeSeg]+1];
+ mcIdType ptId1 = d[dI[activeSeg]], ptId2 = d[dI[activeSeg]+1];
ptId = direction ? (ptId1 == prevPointId ? ptId2 : ptId1) : (ptId2 == prevPointId ? ptId1 : ptId2);
if (dsi[ptId] == 1) // hitting the end of the line
break;
prevPointId = ptId;
- int seg1 = rD[rDI[ptId]], seg2 = rD[rDI[ptId]+1];
+ mcIdType seg1 = rD[rDI[ptId]], seg2 = rD[rDI[ptId]+1];
activeSeg = (seg1 == activeSeg) ? seg2 : seg1;
}
}
// Done, save final piece into DA:
std::copy(linePiece.begin(), linePiece.end(), result->getPointer()+newIdx);
- newIdx += linePiece.size();
+ newIdx += ToIdType(linePiece.size());
// identify next valid start segment (one which is not consumed)
if(!edgeSet.empty())
* \b WARNING : is returned value is different from 0 a call to MEDCouplingUMesh::mergeNodes is necessary to
* avoid to have a non conform mesh.
*
- * \return int - the number of new nodes created (in most of cases 0).
+ * \return mcIdType - the number of new nodes created (in most of cases 0).
*
* \throw If \a this is not coherent.
* \throw If \a this has not spaceDim equal to 2.
* \throw If some subcells needed to be split are orphan.
* \sa MEDCouplingUMesh::conformize2D
*/
-int MEDCouplingUMesh::split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt, const DataArrayInt *midOptI)
+mcIdType MEDCouplingUMesh::split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt, const DataArrayIdType *midOptI)
{
if(!desc || !descI || !subNodesInSeg || !subNodesInSegI)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::split2DCells : the 4 first arrays must be not null !");
*
* \return false if the input connectivity represents already the convex hull, true if the input cell needs to be reordered.
*/
-bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, const int *nodalConnBg, const int *nodalConnEnd, DataArrayInt *nodalConnecOut)
+bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, DataArrayIdType *nodalConnecOut)
{
std::size_t sz=std::distance(nodalConnBg,nodalConnEnd);
if(sz>=4)
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)*nodalConnBg);
if(cm.getDimension()==2)
{
- const int *node=nodalConnBg+1;
- int startNode=*node++;
+ const mcIdType *node=nodalConnBg+1;
+ mcIdType startNode=*node++;
double refX=coords[2*startNode];
for(;node!=nodalConnEnd;node++)
{
refX=coords[2*startNode];
}
}
- std::vector<int> tmpOut; tmpOut.reserve(sz); tmpOut.push_back(startNode);
+ std::vector<mcIdType> tmpOut; tmpOut.reserve(sz); tmpOut.push_back(startNode);
refX=1e300;
double tmp1;
double tmp2[2];
double angle0=-M_PI/2;
//
- int nextNode=-1;
- int prevNode=-1;
+ mcIdType nextNode=-1;
+ mcIdType prevNode=-1;
double resRef;
double angleNext=0.;
while(nextNode!=startNode)
tmpOut.push_back(nextNode);
}
}
- std::vector<int> tmp3(2*(sz-1));
- std::vector<int>::iterator it=std::copy(nodalConnBg+1,nodalConnEnd,tmp3.begin());
+ std::vector<mcIdType> tmp3(2*(sz-1));
+ std::vector<mcIdType>::iterator it=std::copy(nodalConnBg+1,nodalConnEnd,tmp3.begin());
std::copy(nodalConnBg+1,nodalConnEnd,it);
if(std::search(tmp3.begin(),tmp3.end(),tmpOut.begin(),tmpOut.end())!=tmp3.end())
{
}
else
{
- nodalConnecOut->pushBackSilent((int)INTERP_KERNEL::NORM_POLYGON);
+ nodalConnecOut->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_POLYGON));
nodalConnecOut->insertAtTheEnd(tmpOut.begin(),tmpOut.end());
return true;
}
/*!
* This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arr indexes is in \b arrIndxIn.
* This method expects that these two input arrays come from the output of MEDCouplingUMesh::computeNeighborsOfCells method.
- * This method start from id 0 that will be contained in output DataArrayInt. It searches then all neighbors of id0 looking at arrIn[arrIndxIn[0]:arrIndxIn[0+1]].
+ * This method start from id 0 that will be contained in output DataArrayIdType. It searches then all neighbors of id0 looking at arrIn[arrIndxIn[0]:arrIndxIn[0+1]].
* Then it is repeated recursively until either all ids are fetched or no more ids are reachable step by step.
* A negative value in \b arrIn means that it is ignored.
* This method is useful to see if a mesh is contiguous regarding its connectivity. If it is not the case the size of returned array is different from arrIndxIn->getNumberOfTuples()-1.
* \return a newly allocated DataArray that stores all ids fetched by the gradually spread process.
* \sa MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed, MEDCouplingUMesh::partitionBySpreadZone
*/
-DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn)
+DataArrayIdType *MEDCouplingUMesh::ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn)
{
- int seed=0,nbOfDepthPeelingPerformed=0;
+ mcIdType seed=0,nbOfDepthPeelingPerformed=0;
return ComputeSpreadZoneGraduallyFromSeed(&seed,&seed+1,arrIn,arrIndxIn,-1,nbOfDepthPeelingPerformed);
}
/*!
* This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arr indexes is in \b arrIndxIn.
* This method expects that these two input arrays come from the output of MEDCouplingUMesh::computeNeighborsOfCells method.
- * This method start from id 0 that will be contained in output DataArrayInt. It searches then all neighbors of id0 regarding arrIn[arrIndxIn[0]:arrIndxIn[0+1]].
+ * This method start from id 0 that will be contained in output DataArrayIdType. It searches then all neighbors of id0 regarding arrIn[arrIndxIn[0]:arrIndxIn[0+1]].
* Then it is repeated recursively until either all ids are fetched or no more ids are reachable step by step.
* A negative value in \b arrIn means that it is ignored.
* This method is useful to see if a mesh is contiguous regarding its connectivity. If it is not the case the size of returned array is different from arrIndxIn->getNumberOfTuples()-1.
* \return a newly allocated DataArray that stores all ids fetched by the gradually spread process.
* \sa MEDCouplingUMesh::partitionBySpreadZone
*/
-DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(const int *seedBg, const int *seedEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling, int& nbOfDepthPeelingPerformed)
+DataArrayIdType *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(const mcIdType *seedBg, const mcIdType *seedEnd, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling, mcIdType& nbOfDepthPeelingPerformed)
{
nbOfDepthPeelingPerformed=0;
if(!arrIndxIn)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed : arrIndxIn input pointer is NULL !");
- int nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
if(nbOfTuples<=0)
{
- DataArrayInt *ret=DataArrayInt::New(); ret->alloc(0,1);
+ DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc(0,1);
return ret;
}
//
int spaceDim=getSpaceDimension();
if(mdim!=spaceDim)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSpreadZonesWithPoly : meshdimension and spacedimension do not match !");
- std::vector<DataArrayInt *> partition=partitionBySpreadZone();
- std::vector< MCAuto<DataArrayInt> > partitionAuto; partitionAuto.reserve(partition.size());
- std::copy(partition.begin(),partition.end(),std::back_insert_iterator<std::vector< MCAuto<DataArrayInt> > >(partitionAuto));
+ std::vector<DataArrayIdType *> partition=partitionBySpreadZone();
+ std::vector< MCAuto<DataArrayIdType> > partitionAuto; partitionAuto.reserve(partition.size());
+ std::copy(partition.begin(),partition.end(),std::back_insert_iterator<std::vector< MCAuto<DataArrayIdType> > >(partitionAuto));
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),mdim);
ret->setCoords(getCoords());
- ret->allocateCells((int)partition.size());
+ ret->allocateCells(ToIdType(partition.size()));
//
- for(std::vector<DataArrayInt *>::const_iterator it=partition.begin();it!=partition.end();it++)
+ for(std::vector<DataArrayIdType *>::const_iterator it=partition.begin();it!=partition.end();it++)
{
MCAuto<MEDCouplingUMesh> tmp=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf((*it)->begin(),(*it)->end(),true));
- MCAuto<DataArrayInt> cell;
+ MCAuto<DataArrayIdType> cell;
switch(mdim)
{
case 2:
* This method only needs a well defined connectivity. Coordinates are not considered here.
* This method returns a vector of \b newly allocated arrays that the caller has to deal with.
*/
-std::vector<DataArrayInt *> MEDCouplingUMesh::partitionBySpreadZone() const
+std::vector<DataArrayIdType *> MEDCouplingUMesh::partitionBySpreadZone() const
{
- DataArrayInt *neigh=0,*neighI=0;
+ DataArrayIdType *neigh=0,*neighI=0;
computeNeighborsOfCells(neigh,neighI);
- MCAuto<DataArrayInt> neighAuto(neigh),neighIAuto(neighI);
+ MCAuto<DataArrayIdType> neighAuto(neigh),neighIAuto(neighI);
return PartitionBySpreadZone(neighAuto,neighIAuto);
}
-std::vector<DataArrayInt *> MEDCouplingUMesh::PartitionBySpreadZone(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn)
+std::vector<DataArrayIdType *> MEDCouplingUMesh::PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn)
{
if(!arrIn || !arrIndxIn)
throw INTERP_KERNEL::Exception("PartitionBySpreadZone : null input pointers !");
arrIn->checkAllocated(); arrIndxIn->checkAllocated();
- int nbOfTuples(arrIndxIn->getNumberOfTuples());
+ mcIdType nbOfTuples(arrIndxIn->getNumberOfTuples());
if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1 || nbOfTuples<1)
throw INTERP_KERNEL::Exception("PartitionBySpreadZone : invalid arrays in input !");
- int nbOfCellsCur(nbOfTuples-1);
- std::vector<DataArrayInt *> ret;
+ mcIdType nbOfCellsCur(nbOfTuples-1);
+ std::vector<DataArrayIdType *> ret;
if(nbOfCellsCur<=0)
return ret;
std::vector<bool> fetchedCells(nbOfCellsCur,false);
- std::vector< MCAuto<DataArrayInt> > ret2;
- int seed=0;
+ std::vector< MCAuto<DataArrayIdType> > ret2;
+ mcIdType seed=0;
while(seed<nbOfCellsCur)
{
- int nbOfPeelPerformed=0;
+ mcIdType nbOfPeelPerformed=0;
ret2.push_back(ComputeSpreadZoneGraduallyFromSeedAlg(fetchedCells,&seed,&seed+1,arrIn,arrIndxIn,-1,nbOfPeelPerformed));
- seed=(int)std::distance(fetchedCells.begin(),std::find(fetchedCells.begin()+seed,fetchedCells.end(),false));
+ seed=ToIdType(std::distance(fetchedCells.begin(),std::find(fetchedCells.begin()+seed,fetchedCells.end(),false)));
}
- for(std::vector< MCAuto<DataArrayInt> >::iterator it=ret2.begin();it!=ret2.end();it++)
+ for(std::vector< MCAuto<DataArrayIdType> >::iterator it=ret2.begin();it!=ret2.end();it++)
ret.push_back((*it).retn());
return ret;
}
/*!
* This method returns given a distribution of cell type (returned for example by MEDCouplingUMesh::getDistributionOfTypes method and customized after) a
- * newly allocated DataArrayInt instance with 2 components ready to be interpreted as input of DataArrayInt::findRangeIdForEachTuple method.
+ * newly allocated DataArrayIdType instance with 2 components ready to be interpreted as input of DataArrayIdType::findRangeIdForEachTuple method.
*
* \param [in] code a code with the same format than those returned by MEDCouplingUMesh::getDistributionOfTypes except for the code[3*k+2] that should contain start id of chunck.
- * \return a newly allocated DataArrayInt to be managed by the caller.
+ * \return a newly allocated DataArrayIdType to be managed by the caller.
* \throw In case of \a code has not the right format (typically of size 3*n)
*/
-DataArrayInt *MEDCouplingUMesh::ComputeRangesFromTypeDistribution(const std::vector<int>& code)
+DataArrayIdType *MEDCouplingUMesh::ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code)
{
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
std::size_t nb=code.size()/3;
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeRangesFromTypeDistribution : invalid input code !");
- ret->alloc((int)nb,2);
- int *retPtr=ret->getPointer();
+ ret->alloc(nb,2);
+ mcIdType *retPtr=ret->getPointer();
for(std::size_t i=0;i<nb;i++,retPtr+=2)
{
retPtr[0]=code[3*i+2];
* \param [in] policy - the policy of splitting that must be in (PLANAR_FACE_5, PLANAR_FACE_6, GENERAL_24, GENERAL_48). The policy will be used only for INTERP_KERNEL::NORM_HEXA8 cells.
* For all other cells, the splitting policy will be ignored. See INTERP_KERNEL::SplittingPolicy for the images.
* \param [out] nbOfAdditionalPoints - number of nodes added to \c this->_coords. If > 0 a new coordinates object will be constructed result of the aggregation of the old one and the new points added.
- * \param [out] n2oCells - A new instance of DataArrayInt holding, for each new cell,
+ * \param [out] n2oCells - A new instance of DataArrayIdType holding, for each new cell,
* an id of old cell producing it. The caller is to delete this array using
* decrRef() as it is no more needed.
* \return MEDCoupling1SGTUMesh * - the mesh containing only INTERP_KERNEL::NORM_TETRA4 cells.
* \throw If \a this is not fully constituted with linear 3D cells.
* \sa MEDCouplingUMesh::simplexize, MEDCoupling1SGTUMesh::sortHexa8EachOther
*/
-MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayInt *& n2oCells, int& nbOfAdditionalPoints) const
+MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayIdType *& n2oCells, mcIdType& nbOfAdditionalPoints) const
{
INTERP_KERNEL::SplittingPolicy pol((INTERP_KERNEL::SplittingPolicy)policy);
checkConnectivityFullyDefined();
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tetrahedrize : only available for mesh with meshdim == 3 and spacedim == 3 !");
- int nbOfCells(getNumberOfCells()),nbNodes(getNumberOfNodes());
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType nbNodes(getNumberOfNodes());
MCAuto<MEDCoupling1SGTUMesh> ret0(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_TETRA4));
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfCells,1);
- int *retPt(ret->getPointer());
- MCAuto<DataArrayInt> newConn(DataArrayInt::New()); newConn->alloc(0,1);
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(nbOfCells,1);
+ mcIdType *retPt(ret->getPointer());
+ MCAuto<DataArrayIdType> newConn(DataArrayIdType::New()); newConn->alloc(0,1);
MCAuto<DataArrayDouble> addPts(DataArrayDouble::New()); addPts->alloc(0,1);
- const int *oldc(_nodal_connec->begin());
- const int *oldci(_nodal_connec_index->begin());
+ const mcIdType *oldc(_nodal_connec->begin());
+ const mcIdType *oldci(_nodal_connec_index->begin());
const double *coords(_coords->begin());
- for(int i=0;i<nbOfCells;i++,oldci++,retPt++)
+ for(mcIdType i=0;i<nbOfCells;i++,oldci++,retPt++)
{
- std::vector<int> a; std::vector<double> b;
+ std::vector<mcIdType> a; std::vector<double> b;
INTERP_KERNEL::SplitIntoTetras(pol,(INTERP_KERNEL::NormalizedCellType)oldc[oldci[0]],oldc+oldci[0]+1,oldc+oldci[1],coords,a,b);
- std::size_t nbOfTet(a.size()/4); *retPt=(int)nbOfTet;
- const int *aa(&a[0]);
+ std::size_t nbOfTet(a.size()/4); *retPt=ToIdType(nbOfTet);
+ const mcIdType *aa(&a[0]);
if(!b.empty())
{
- for(std::vector<int>::iterator it=a.begin();it!=a.end();it++)
+ for(std::vector<mcIdType>::iterator it=a.begin();it!=a.end();it++)
if(*it<0)
*it=(-(*(it))-1+nbNodes);
addPts->insertAtTheEnd(b.begin(),b.end());
- nbNodes+=(int)b.size()/3;
+ nbNodes+=ToIdType(b.size()/3);
}
for(std::size_t j=0;j<nbOfTet;j++,aa+=4)
newConn->insertAtTheEnd(aa,aa+4);
delete _cell;
}
-MEDCouplingUMeshCellIterator::MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mesh, MEDCouplingUMeshCell *itc, int bg, int end):_mesh(mesh),_cell(itc),
+MEDCouplingUMeshCellIterator::MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mesh, MEDCouplingUMeshCell *itc, mcIdType bg, mcIdType end):_mesh(mesh),_cell(itc),
_own_cell(false),_cell_id(bg-1),
_nb_cell(end)
{
_mesh->decrRef();
}
-MEDCouplingUMeshCellEntry::MEDCouplingUMeshCellEntry(MEDCouplingUMesh *mesh, INTERP_KERNEL::NormalizedCellType type, MEDCouplingUMeshCell *itc, int bg, int end):_mesh(mesh),_type(type),
+MEDCouplingUMeshCellEntry::MEDCouplingUMeshCellEntry(MEDCouplingUMesh *mesh, INTERP_KERNEL::NormalizedCellType type, MEDCouplingUMeshCell *itc, mcIdType bg, mcIdType end):_mesh(mesh),_type(type),
_itc(itc),
_bg(bg),_end(end)
{
return _type;
}
-int MEDCouplingUMeshCellEntry::getNumberOfElems() const
+mcIdType MEDCouplingUMeshCellEntry::getNumberOfElems() const
{
return _end-_bg;
}
MEDCouplingUMeshCellEntry *MEDCouplingUMeshCellByTypeIterator::nextt()
{
- const int *c=_mesh->getNodalConnectivity()->begin();
- const int *ci=_mesh->getNodalConnectivityIndex()->begin();
+ const mcIdType *c=_mesh->getNodalConnectivity()->begin();
+ const mcIdType *ci=_mesh->getNodalConnectivityIndex()->begin();
if(_cell_id<_nb_cell)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)c[ci[_cell_id]];
- int nbOfElems=(int)std::distance(ci+_cell_id,std::find_if(ci+_cell_id,ci+_nb_cell,MEDCouplingImpl::ConnReader(c,type)));
- int startId=_cell_id;
+ mcIdType nbOfElems=ToIdType(std::distance(ci+_cell_id,std::find_if(ci+_cell_id,ci+_nb_cell,MEDCouplingImpl::ConnReader(c,type))));
+ mcIdType startId=_cell_id;
_cell_id+=nbOfElems;
return new MEDCouplingUMeshCellEntry(_mesh,type,_cell,startId,_cell_id);
}
{
std::ostringstream oss; oss << "Cell Type " << INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)_conn[0]).getRepr();
oss << " : ";
- std::copy(_conn+1,_conn+_conn_lgth,std::ostream_iterator<int>(oss," "));
+ std::copy(_conn+1,_conn+_conn_lgth,std::ostream_iterator<mcIdType>(oss," "));
return oss.str();
}
else
return INTERP_KERNEL::NORM_ERROR;
}
-const int *MEDCouplingUMeshCell::getAllConn(int& lgth) const
+const mcIdType *MEDCouplingUMeshCell::getAllConn(mcIdType& lgth) const
{
lgth=_conn_lgth;
if(_conn_lgth!=NOTICABLE_FIRST_VAL)
MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
MEDCOUPLING_EXPORT void setMeshDimension(int meshDim);
- MEDCOUPLING_EXPORT void allocateCells(int nbOfCells=0);
- MEDCOUPLING_EXPORT void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, const int *nodalConnOfCell);
+ MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0);
+ MEDCOUPLING_EXPORT void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, const mcIdType *nodalConnOfCell);
MEDCOUPLING_EXPORT void finishInsertingCells();
MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator *cellIterator();
MEDCOUPLING_EXPORT MEDCouplingUMeshCellByTypeEntry *cellsByType();
MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
MEDCOUPLING_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getAllGeoTypesSorted() const;
- MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getTypesOfPart(const int *begin, const int *end) const;
- MEDCOUPLING_EXPORT void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true);
- MEDCOUPLING_EXPORT const DataArrayInt *getNodalConnectivity() const { return _nodal_connec; }
- MEDCOUPLING_EXPORT const DataArrayInt *getNodalConnectivityIndex() const { return _nodal_connec_index; }
- MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivity() { return _nodal_connec; }
- MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivityIndex() { return _nodal_connec_index; }
- MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(std::size_t cellId) const;
- MEDCOUPLING_EXPORT DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
- MEDCOUPLING_EXPORT std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
- MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const;
+ MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getTypesOfPart(const mcIdType *begin, const mcIdType *end) const;
+ MEDCOUPLING_EXPORT void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true);
+ MEDCOUPLING_EXPORT const DataArrayIdType *getNodalConnectivity() const { return _nodal_connec; }
+ MEDCOUPLING_EXPORT const DataArrayIdType *getNodalConnectivityIndex() const { return _nodal_connec_index; }
+ MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() { return _nodal_connec; }
+ MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivityIndex() { return _nodal_connec_index; }
+ MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const;
MEDCOUPLING_EXPORT std::string simpleRepr() const;
MEDCOUPLING_EXPORT std::string advancedRepr() const;
MEDCOUPLING_EXPORT std::string cppRepr() const;
MEDCOUPLING_EXPORT std::string reprConnectivityOfThis() const;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const;
- MEDCOUPLING_EXPORT int getNumberOfNodesInCell(int cellId) const;
- MEDCOUPLING_EXPORT std::size_t getNumberOfCells() const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSetInstanceFromThis(std::size_t spaceDim) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const;
MEDCOUPLING_EXPORT int getMeshDimension() const;
- MEDCOUPLING_EXPORT int getNodalConnectivityArrayLen() const;
+ MEDCOUPLING_EXPORT mcIdType getNodalConnectivityArrayLen() const;
MEDCOUPLING_EXPORT void computeTypes();
//! size of returned tinyInfo must be always the same.
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<int>& tinyInfo) const;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
- MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
+ MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
MEDCOUPLING_EXPORT std::string getVTKDataSetType() const;
MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
MEDCOUPLING_EXPORT void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const;
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
//tools
- MEDCOUPLING_EXPORT static int AreCellsEqual(const int *conn, const int *connI, int cell1, int cell2, int compType);
- MEDCOUPLING_EXPORT static int AreCellsEqualPolicy0(const int *conn, const int *connI, int cell1, int cell2);
- MEDCOUPLING_EXPORT static int AreCellsEqualPolicy1(const int *conn, const int *connI, int cell1, int cell2);
- MEDCOUPLING_EXPORT static int AreCellsEqualPolicy2(const int *conn, const int *connI, int cell1, int cell2);
- MEDCOUPLING_EXPORT static int AreCellsEqualPolicy2NoType(const int *conn, const int *connI, int cell1, int cell2);
- MEDCOUPLING_EXPORT static int AreCellsEqualPolicy7(const int *conn, const int *connI, int cell1, int cell2);
- MEDCOUPLING_EXPORT void convertToPolyTypes(const int *cellIdsToConvertBg, const int *cellIdsToConvertEnd);
+ MEDCOUPLING_EXPORT static int AreCellsEqual(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2, int compType);
+ MEDCOUPLING_EXPORT static int AreCellsEqualPolicy0(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2);
+ MEDCOUPLING_EXPORT static int AreCellsEqualPolicy1(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2);
+ MEDCOUPLING_EXPORT static int AreCellsEqualPolicy2(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2);
+ MEDCOUPLING_EXPORT static int AreCellsEqualPolicy2NoType(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2);
+ MEDCOUPLING_EXPORT static int AreCellsEqualPolicy7(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2);
+ MEDCOUPLING_EXPORT void convertToPolyTypes(const mcIdType *cellIdsToConvertBg, const mcIdType *cellIdsToConvertEnd);
MEDCOUPLING_EXPORT void convertAllToPoly();
MEDCOUPLING_EXPORT void convertExtrudedPolyhedra();
MEDCOUPLING_EXPORT bool unPolyze();
MEDCOUPLING_EXPORT void simplifyPolyhedra(double eps);
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
- MEDCOUPLING_EXPORT std::vector<DataArrayInt *> partitionBySpreadZone() const;
- MEDCOUPLING_EXPORT DataArrayInt *computeFetchedNodeIds() const;
- MEDCOUPLING_EXPORT DataArrayInt *getNodeIdsInUse(int& nbrOfNodesInUse) const;
+ MEDCOUPLING_EXPORT std::vector<DataArrayIdType *> partitionBySpreadZone() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const;
MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const;
- MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const;
- MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const;
- MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const;
- MEDCOUPLING_EXPORT DataArrayInt *zipCoordsTraducer();
- MEDCOUPLING_EXPORT void findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const;
- MEDCOUPLING_EXPORT bool areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayInt *& arr) const;
- MEDCOUPLING_EXPORT bool areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayInt *& arr) const;
- MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const;
- MEDCOUPLING_EXPORT MCAuto<MEDCouplingUMesh> explodeIntoEdges(MCAuto<DataArrayInt>& desc, MCAuto<DataArrayInt>& descIndex, MCAuto<DataArrayInt>& revDesc, MCAuto<DataArrayInt>& revDescIndx) const;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
- MEDCOUPLING_EXPORT void computeNeighborsOfCells(DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) const;
- MEDCOUPLING_EXPORT void computeCellNeighborhoodFromNodesOne(const DataArrayInt *nodeNeigh, const DataArrayInt *nodeNeighI, MCAuto<DataArrayInt>& cellNeigh, MCAuto<DataArrayInt>& cellNeighIndex) const;
- MEDCOUPLING_EXPORT static void ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI,
- DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx);
- MEDCOUPLING_EXPORT void computeNeighborsOfNodes(DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) const;
- MEDCOUPLING_EXPORT void computeEnlargedNeighborsOfNodes(MCAuto<DataArrayInt> &neighbors, MCAuto<DataArrayInt>& neighborsIdx) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *zipCoordsTraducer();
+ MEDCOUPLING_EXPORT void findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const;
+ MEDCOUPLING_EXPORT bool areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayIdType *& arr) const;
+ MEDCOUPLING_EXPORT bool areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayIdType *& arr) const;
+ MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const;
+ MEDCOUPLING_EXPORT MCAuto<MEDCouplingUMesh> explodeIntoEdges(MCAuto<DataArrayIdType>& desc, MCAuto<DataArrayIdType>& descIndex, MCAuto<DataArrayIdType>& revDesc, MCAuto<DataArrayIdType>& revDescIndx) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
+ MEDCOUPLING_EXPORT void computeNeighborsOfCells(DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIdx) const;
+ MEDCOUPLING_EXPORT void computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI, MCAuto<DataArrayIdType>& cellNeigh, MCAuto<DataArrayIdType>& cellNeighIndex) const;
+ MEDCOUPLING_EXPORT static void ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI,
+ DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIdx);
+ MEDCOUPLING_EXPORT void computeNeighborsOfNodes(DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIdx) const;
+ MEDCOUPLING_EXPORT void computeEnlargedNeighborsOfNodes(MCAuto<DataArrayIdType> &neighbors, MCAuto<DataArrayIdType>& neighborsIdx) const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelf(const int *begin, const int *end, bool keepCoords=true) const;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelfSlice(int start, int end, int step, bool keepCoords=true) const;
- MEDCOUPLING_EXPORT void setPartOfMySelf(const int *cellIdsBg, const int *cellIdsEnd, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
- MEDCOUPLING_EXPORT void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildFacePartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelf(const mcIdType *begin, const mcIdType *end, bool keepCoords=true) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, bool keepCoords=true) const;
+ MEDCOUPLING_EXPORT void setPartOfMySelf(const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
+ MEDCOUPLING_EXPORT void setPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildFacePartOfMySelfNode(const mcIdType *begin, const mcIdType *end, bool fullyIn) const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const;
- MEDCOUPLING_EXPORT DataArrayInt *findBoundaryNodes() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findBoundaryNodes() const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildBoundaryMesh(bool keepCoords) const;
- MEDCOUPLING_EXPORT DataArrayInt *findCellIdsOnBoundary() const;
- MEDCOUPLING_EXPORT void findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *&cellIdsRk0, DataArrayInt *&cellIdsRk1) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findCellIdsOnBoundary() const;
+ MEDCOUPLING_EXPORT void findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayIdType *&cellIdsRk0, DataArrayIdType *&cellIdsRk1) const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *computeSkin() const;
- MEDCOUPLING_EXPORT void findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *& nodeIdsToDuplicate,
- DataArrayInt *& cellIdsNeededToBeRenum, DataArrayInt *& cellIdsNotModified) const;
- MEDCOUPLING_EXPORT void duplicateNodes(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd);
- MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(int offset);
- MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap<int,int>& newNodeNumbersO2N);
- MEDCOUPLING_EXPORT void renumberNodesInConn(const int *newNodeNumbersO2N);
- MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map<int,int>& newNodeNumbersO2N) override;
- MEDCOUPLING_EXPORT void shiftNodeNumbersInConn(int delta);
- MEDCOUPLING_EXPORT void duplicateNodesInConn(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd, int offset);
- MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true);
- MEDCOUPLING_EXPORT DataArrayInt *getCellsInBoundingBox(const double *bbox, double eps) const;
- MEDCOUPLING_EXPORT DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
+ MEDCOUPLING_EXPORT void findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayIdType *& nodeIdsToDuplicate,
+ DataArrayIdType *& cellIdsNeededToBeRenum, DataArrayIdType *& cellIdsNotModified) const;
+ MEDCOUPLING_EXPORT void duplicateNodes(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd);
+ MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset);
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap<mcIdType,mcIdType>& newNodeNumbersO2N);
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N);
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map<mcIdType,mcIdType>& newNodeNumbersO2N) override;
+ MEDCOUPLING_EXPORT void shiftNodeNumbersInConn(mcIdType delta);
+ MEDCOUPLING_EXPORT void duplicateNodesInConn(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd, mcIdType offset);
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
+ MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
- MEDCOUPLING_EXPORT DataArrayDouble *getPartMeasureField(bool isAbs, const int *begin, const int *end) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getPartMeasureField(bool isAbs, const mcIdType *begin, const mcIdType *end) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildPartOrthogonalField(const int *begin, const int *end) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildPartOrthogonalField(const mcIdType *begin, const mcIdType *end) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildDirectionVectorField() const;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSlice3D(const double *origin, const double *vec, double eps, DataArrayInt *&cellIds) const;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSlice3DSurf(const double *origin, const double *vec, double eps, DataArrayInt *&cellIds) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSlice3D(const double *origin, const double *vec, double eps, DataArrayIdType *&cellIds) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSlice3DSurf(const double *origin, const double *vec, double eps, DataArrayIdType *&cellIds) const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingUMesh> clipSingle3DCellByPlane(const double origin[3], const double vec[3], double eps) const;
- MEDCOUPLING_EXPORT DataArrayInt *getCellIdsCrossingPlane(const double *origin, const double *vec, double eps) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getCellIdsCrossingPlane(const double *origin, const double *vec, double eps) const;
MEDCOUPLING_EXPORT bool isContiguous1D() const;
MEDCOUPLING_EXPORT void project1D(const double *pt, const double *v, double eps, double *res) const;
- MEDCOUPLING_EXPORT double distanceToPoint(const double *ptBg, const double *ptEnd, int& cellId) const;
- MEDCOUPLING_EXPORT DataArrayDouble *distanceToPoints(const DataArrayDouble *pts, DataArrayInt *& cellIds) const;
- MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const;
- MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const;
- MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex) const override;
- MEDCOUPLING_EXPORT void getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, int nbOfPoints, double eps, MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex) const override;
- MEDCOUPLING_EXPORT void checkButterflyCells(std::vector<int>& cells, double eps=1e-12) const;
- MEDCOUPLING_EXPORT DataArrayInt *convexEnvelop2D();
- MEDCOUPLING_EXPORT DataArrayInt *findAndCorrectBadOriented3DExtrudedCells();
- MEDCOUPLING_EXPORT DataArrayInt *findAndCorrectBadOriented3DCells();
+ MEDCOUPLING_EXPORT double distanceToPoint(const double *ptBg, const double *ptEnd, mcIdType& cellId) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *distanceToPoints(const DataArrayDouble *pts, DataArrayIdType *& cellIds) const;
+ MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const;
+ MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const;
+ MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const override;
+ MEDCOUPLING_EXPORT void getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, mcIdType nbOfPoints, double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const override;
+ MEDCOUPLING_EXPORT void checkButterflyCells(std::vector<mcIdType>& cells, double eps=1e-12) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *convexEnvelop2D();
+ MEDCOUPLING_EXPORT DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells();
+ MEDCOUPLING_EXPORT DataArrayIdType *findAndCorrectBadOriented3DCells();
MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTreeFast() const;
MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
MEDCOUPLING_EXPORT bool isFullyQuadratic() const;
MEDCOUPLING_EXPORT bool isPresenceOfQuadratic() const;
MEDCOUPLING_EXPORT void convertQuadraticCellsToLinear();
- MEDCOUPLING_EXPORT DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0);
+ MEDCOUPLING_EXPORT DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0);
MEDCOUPLING_EXPORT void tessellate2D(double eps);
- MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *tetrahedrize(int policy, DataArrayInt *& n2oCells, int& nbOfAdditionalPoints) const;
- MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy);
+ MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *tetrahedrize(int policy, DataArrayIdType *& n2oCells, mcIdType& nbOfAdditionalPoints) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy);
MEDCOUPLING_EXPORT bool areOnlySimplexCells() const;
MEDCOUPLING_EXPORT void convertDegeneratedCells();
- MEDCOUPLING_EXPORT DataArrayInt *convertDegeneratedCellsAndRemoveFlatOnes();
+ MEDCOUPLING_EXPORT DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes();
MEDCOUPLING_EXPORT bool removeDegenerated1DCells();
- MEDCOUPLING_EXPORT void are2DCellsNotCorrectlyOriented(const double *vec, bool polyOnly, std::vector<int>& cells) const;
+ MEDCOUPLING_EXPORT void are2DCellsNotCorrectlyOriented(const double *vec, bool polyOnly, std::vector<mcIdType>& cells) const;
MEDCOUPLING_EXPORT void orientCorrectly2DCells(const double *vec, bool polyOnly);
MEDCOUPLING_EXPORT void changeOrientationOfCells();
- MEDCOUPLING_EXPORT void arePolyhedronsNotCorrectlyOriented(std::vector<int>& cells) const;
+ MEDCOUPLING_EXPORT void arePolyhedronsNotCorrectlyOriented(std::vector<mcIdType>& cells) const;
MEDCOUPLING_EXPORT void orientCorrectlyPolyhedrons();
MEDCOUPLING_EXPORT void invertOrientationOfAllCells();
MEDCOUPLING_EXPORT void getFastAveragePlaneOfThis(double *vec, double *pos) const;
- MEDCOUPLING_EXPORT void attractSeg3MidPtsAroundNodes(double ratio, const int *nodeIdsBg, const int *nodeIdsEnd);
+ MEDCOUPLING_EXPORT void attractSeg3MidPtsAroundNodes(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd);
//Mesh quality
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getEdgeRatioField() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getAspectRatioField() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getSkewField() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const;
//utilities for MED File RW
- MEDCOUPLING_EXPORT std::vector<int> getDistributionOfTypes() const;
- MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const;
- MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType, bool smartPflKiller=true) const;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh, DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *&revDesc, DataArrayInt *&revDescIndx, DataArrayInt *& nM1LevMeshIds, DataArrayInt *&meshnM1Old2New) const;
- MEDCOUPLING_EXPORT DataArrayInt *sortCellsInMEDFileFrmt();
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getDistributionOfTypes() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller=true) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh, DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *&revDesc, DataArrayIdType *&revDescIndx, DataArrayIdType *& nM1LevMeshIds, DataArrayIdType *&meshnM1Old2New) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *sortCellsInMEDFileFrmt();
MEDCOUPLING_EXPORT bool checkConsecutiveCellTypes() const;
MEDCOUPLING_EXPORT bool checkConsecutiveCellTypesForMEDFileFrmt() const;
MEDCOUPLING_EXPORT bool checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const;
- MEDCOUPLING_EXPORT DataArrayInt *getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayInt *&nbPerType) const;
- MEDCOUPLING_EXPORT DataArrayInt *getRenumArrForMEDFileFrmt() const;
- MEDCOUPLING_EXPORT DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const;
- MEDCOUPLING_EXPORT DataArrayInt *rearrange2ConsecutiveCellTypes();
+ MEDCOUPLING_EXPORT DataArrayIdType *getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayIdType *&nbPerType) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getRenumArrForMEDFileFrmt() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *rearrange2ConsecutiveCellTypes();
MEDCOUPLING_EXPORT std::vector<MEDCouplingUMesh *> splitByType() const;
MEDCOUPLING_EXPORT MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
- MEDCOUPLING_EXPORT DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const;
- MEDCOUPLING_EXPORT void convertNodalConnectivityToDynamicGeoTypeMesh(DataArrayInt *&nodalConn, DataArrayInt *&nodalConnIndex) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const;
+ MEDCOUPLING_EXPORT void convertNodalConnectivityToDynamicGeoTypeMesh(DataArrayIdType *&nodalConn, DataArrayIdType *&nodalConnIndex) const;
MEDCOUPLING_EXPORT static MEDCouplingUMesh *AggregateSortedByTypeMeshesOnSameCoords(const std::vector<const MEDCouplingUMesh *>& ms,
- DataArrayInt *&szOfCellGrpOfSameType,
- DataArrayInt *&idInMsOfCellGrpOfSameType);
- MEDCOUPLING_EXPORT DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, const int *begin, const int *end) const;
- MEDCOUPLING_EXPORT DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, const int *idsPerGeoTypeBg, const int *idsPerGeoTypeEnd) const;
+ DataArrayIdType *&szOfCellGrpOfSameType,
+ DataArrayIdType *&idInMsOfCellGrpOfSameType);
+ MEDCOUPLING_EXPORT DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, const mcIdType *begin, const mcIdType *end) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, const mcIdType *idsPerGeoTypeBg, const mcIdType *idsPerGeoTypeEnd) const;
MEDCOUPLING_EXPORT std::vector<bool> getQuadraticStatus() const;
//
MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps) const;
MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
- MEDCOUPLING_EXPORT DataArrayDouble *getPartBarycenterAndOwner(const int *begin, const int *end) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getPartBarycenterAndOwner(const mcIdType *begin, const mcIdType *end) const;
MEDCOUPLING_EXPORT DataArrayDouble *computePlaneEquationOf3DFaces() const;
- MEDCOUPLING_EXPORT DataArrayInt *conformize2D(double eps);
- MEDCOUPLING_EXPORT DataArrayInt *colinearize2D(double eps);
- MEDCOUPLING_EXPORT DataArrayInt *colinearizeKeepingConform2D(double eps);
- MEDCOUPLING_EXPORT DataArrayInt *conformize3D(double eps);
- MEDCOUPLING_EXPORT int split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt=0, const DataArrayInt *midOptI=0);
+ MEDCOUPLING_EXPORT DataArrayIdType *conformize2D(double eps);
+ MEDCOUPLING_EXPORT DataArrayIdType *colinearize2D(double eps);
+ MEDCOUPLING_EXPORT DataArrayIdType *colinearizeKeepingConform2D(double eps);
+ MEDCOUPLING_EXPORT DataArrayIdType *conformize3D(double eps);
+ MEDCOUPLING_EXPORT mcIdType split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0);
MEDCOUPLING_EXPORT static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
MEDCOUPLING_EXPORT static MCAuto<MEDCouplingUMesh> Build1DMeshFromCoords(DataArrayDouble *da);
MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshes(const std::vector<const MEDCouplingUMesh *>& a);
MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const std::vector<const MEDCouplingUMesh *>& meshes);
- MEDCOUPLING_EXPORT static MEDCouplingUMesh *FuseUMeshesOnSameCoords(const std::vector<const MEDCouplingUMesh *>& meshes, int compType, std::vector<DataArrayInt *>& corr);
+ MEDCOUPLING_EXPORT static MEDCouplingUMesh *FuseUMeshesOnSameCoords(const std::vector<const MEDCouplingUMesh *>& meshes, int compType, std::vector<DataArrayIdType *>& corr);
MEDCOUPLING_EXPORT static void PutUMeshesOnSameAggregatedCoords(const std::vector<MEDCouplingUMesh *>& meshes);
MEDCOUPLING_EXPORT static void MergeNodesOnUMeshesSharingSameCoords(const std::vector<MEDCouplingUMesh *>& meshes, double eps);
- MEDCOUPLING_EXPORT static bool IsPolygonWellOriented(bool isQuadratic, const double *vec, const int *begin, const int *end, const double *coords);
- MEDCOUPLING_EXPORT static bool IsPolyhedronWellOriented(const int *begin, const int *end, const double *coords);
- MEDCOUPLING_EXPORT static bool Is3DExtrudedStaticCellWellOriented(const int *begin, const int *end, const double *coords);
- MEDCOUPLING_EXPORT static void CorrectExtrudedStaticCell(int *begin, int *end);
- MEDCOUPLING_EXPORT static bool IsTetra4WellOriented(const int *begin, const int *end, const double *coords);
- MEDCOUPLING_EXPORT static bool IsPyra5WellOriented(const int *begin, const int *end, const double *coords);
- MEDCOUPLING_EXPORT static void SimplifyPolyhedronCell(double eps, const DataArrayDouble *coords, int index, DataArrayInt *res, MEDCouplingUMesh *faces,
- DataArrayInt *E_Fi, DataArrayInt *E_F, DataArrayInt *F_Ei, DataArrayInt *F_E);
- MEDCOUPLING_EXPORT static void ComputeVecAndPtOfFace(double eps, const double *coords, const int *begin, const int *end, double *v, double *p);
- MEDCOUPLING_EXPORT static void TryToCorrectPolyhedronOrientation(int *begin, int *end, const double *coords);
- MEDCOUPLING_EXPORT static MEDCouplingUMesh *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, DataArrayInt *&cellNb1, DataArrayInt *&cellNb2);
+ MEDCOUPLING_EXPORT static bool IsPolygonWellOriented(bool isQuadratic, const double *vec, const mcIdType *begin, const mcIdType *end, const double *coords);
+ MEDCOUPLING_EXPORT static bool IsPolyhedronWellOriented(const mcIdType *begin, const mcIdType *end, const double *coords);
+ MEDCOUPLING_EXPORT static bool Is3DExtrudedStaticCellWellOriented(const mcIdType *begin, const mcIdType *end, const double *coords);
+ MEDCOUPLING_EXPORT static void CorrectExtrudedStaticCell(mcIdType *begin, mcIdType *end);
+ MEDCOUPLING_EXPORT static bool IsTetra4WellOriented(const mcIdType *begin, const mcIdType *end, const double *coords);
+ MEDCOUPLING_EXPORT static bool IsPyra5WellOriented(const mcIdType *begin, const mcIdType *end, const double *coords);
+ MEDCOUPLING_EXPORT static void SimplifyPolyhedronCell(double eps, const DataArrayDouble *coords, mcIdType index, DataArrayIdType *res, MEDCouplingUMesh *faces,
+ DataArrayIdType *E_Fi, DataArrayIdType *E_F, DataArrayIdType *F_Ei, DataArrayIdType *F_E);
+ MEDCOUPLING_EXPORT static void ComputeVecAndPtOfFace(double eps, const double *coords, const mcIdType *begin, const mcIdType *end, double *v, double *p);
+ MEDCOUPLING_EXPORT static void TryToCorrectPolyhedronOrientation(mcIdType *begin, mcIdType *end, const double *coords);
+ MEDCOUPLING_EXPORT static MEDCouplingUMesh *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, DataArrayIdType *&cellNb1, DataArrayIdType *&cellNb2);
MEDCOUPLING_EXPORT static void Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D,
- double eps, MEDCouplingUMesh *&splitMesh2D, MEDCouplingUMesh *&splitMesh1D, DataArrayInt *&cellIdInMesh2D, DataArrayInt *&cellIdInMesh1D);
- MEDCOUPLING_EXPORT static bool BuildConvexEnvelopOf2DCellJarvis(const double *coords, const int *nodalConnBg, const int *nodalConnEnd, DataArrayInt *nodalConnecOut);
- MEDCOUPLING_EXPORT static std::vector<DataArrayInt *> PartitionBySpreadZone(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn);
- MEDCOUPLING_EXPORT static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn);
- MEDCOUPLING_EXPORT static DataArrayInt *ComputeSpreadZoneGraduallyFromSeed(const int *seedBg, const int *seedEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling, int& nbOfDepthPeelingPerformed);
- MEDCOUPLING_EXPORT static void FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI,
- DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr);
- MEDCOUPLING_EXPORT DataArrayInt *buildUnionOf2DMesh() const;
- MEDCOUPLING_EXPORT DataArrayInt *buildUnionOf3DMesh() const;
- MEDCOUPLING_EXPORT DataArrayInt *orderConsecutiveCells1D() const;
+ double eps, MEDCouplingUMesh *&splitMesh2D, MEDCouplingUMesh *&splitMesh1D, DataArrayIdType *&cellIdInMesh2D, DataArrayIdType *&cellIdInMesh1D);
+ MEDCOUPLING_EXPORT static bool BuildConvexEnvelopOf2DCellJarvis(const double *coords, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, DataArrayIdType *nodalConnecOut);
+ MEDCOUPLING_EXPORT static std::vector<DataArrayIdType *> PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
+ MEDCOUPLING_EXPORT static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
+ MEDCOUPLING_EXPORT static DataArrayIdType *ComputeSpreadZoneGraduallyFromSeed(const mcIdType *seedBg, const mcIdType *seedEnd, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling, mcIdType& nbOfDepthPeelingPerformed);
+ MEDCOUPLING_EXPORT static void FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI,
+ DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr);
+ MEDCOUPLING_EXPORT DataArrayIdType *buildUnionOf2DMesh() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *buildUnionOf3DMesh() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *orderConsecutiveCells1D() const;
MEDCOUPLING_EXPORT MEDCouplingSkyLineArray* generateGraph() const;
private: // all private methods are impl in MEDCouplingUMesh_internal.cxx
void checkConnectivityFullyDefined() const;
void reprConnectivityOfThisLL(std::ostringstream& stream) const;
//tools
- DataArrayInt *simplexizePol0();
- DataArrayInt *simplexizePol1();
- DataArrayInt *simplexizePlanarFace5();
- DataArrayInt *simplexizePlanarFace6();
+ DataArrayIdType *simplexizePol0();
+ DataArrayIdType *simplexizePol1();
+ DataArrayIdType *simplexizePlanarFace5();
+ DataArrayIdType *simplexizePlanarFace6();
void tessellate2DInternal(double eps);
void tessellate2DCurveInternal(double eps);
- void subDivide2DMesh(const int *nodeSubdived, const int *nodeIndxSubdived, const int *desc, const int *descIndex);
- void fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const;
- void split3DCurveWithPlane(const double *origin, const double *vec, double eps, std::vector<int>& cut3DCurve);
- MEDCouplingUMesh *buildExtrudedMeshFromThisLowLev(int nbOfNodesOf1Lev, bool isQuad) const;
+ void subDivide2DMesh(const mcIdType *nodeSubdived, const mcIdType *nodeIndxSubdived, const mcIdType *desc, const mcIdType *descIndex);
+ void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const;
+ void split3DCurveWithPlane(const double *origin, const double *vec, double eps, std::vector<mcIdType>& cut3DCurve);
+ MEDCouplingUMesh *buildExtrudedMeshFromThisLowLev(mcIdType nbOfNodesOf1Lev, bool isQuad) const;
DataArrayDouble *fillExtCoordsUsingTranslation(const MEDCouplingUMesh *mesh1D, bool isQuad) const;
DataArrayDouble *fillExtCoordsUsingTranslAndAutoRotation(const MEDCouplingUMesh *mesh1D, bool isQuad) const;
DataArrayDouble *fillExtCoordsUsingTranslAndAutoRotation2D(const MEDCouplingUMesh *mesh1D, bool isQuad) const;
DataArrayDouble *fillExtCoordsUsingTranslAndAutoRotation3D(const MEDCouplingUMesh *mesh1D, bool isQuad) const;
- static bool AreCellsEqualInPool(const std::vector<int>& candidates, int compType, const int *conn, const int *connI, DataArrayInt *result) ;
- MEDCouplingUMesh *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const;
- MEDCouplingUMesh *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const;
- DataArrayInt *convertLinearCellsToQuadratic1D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
- DataArrayInt *convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayInt *desc, const DataArrayInt *descI, DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
- DataArrayInt *convertLinearCellsToQuadratic2D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
- DataArrayInt *convertLinearCellsToQuadratic2D1(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
- DataArrayInt *convertLinearCellsToQuadratic3D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
- DataArrayInt *convertLinearCellsToQuadratic3D1(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
- DataArrayInt *buildUnionOf2DMeshLinear(const MEDCouplingUMesh *skin, const DataArrayInt *n2o) const;
- DataArrayInt *buildUnionOf2DMeshQuadratic(const MEDCouplingUMesh *skin, const DataArrayInt *n2o) const;
+ static bool AreCellsEqualInPool(const std::vector<mcIdType>& candidates, int compType, const mcIdType *conn, const mcIdType *connI, DataArrayIdType *result) ;
+ MEDCouplingUMesh *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const;
+ MEDCouplingUMesh *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const;
+ DataArrayIdType *convertLinearCellsToQuadratic1D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
+ DataArrayIdType *convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayIdType *desc, const DataArrayIdType *descI, DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
+ DataArrayIdType *convertLinearCellsToQuadratic2D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
+ DataArrayIdType *convertLinearCellsToQuadratic2D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
+ DataArrayIdType *convertLinearCellsToQuadratic3D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
+ DataArrayIdType *convertLinearCellsToQuadratic3D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
+ DataArrayIdType *buildUnionOf2DMeshLinear(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const;
+ DataArrayIdType *buildUnionOf2DMeshQuadratic(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const;
template<int SPACEDIM>
- void getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints,
- double eps, MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex, std::function<bool(INTERP_KERNEL::NormalizedCellType,int)> sensibilityTo2DQuadraticLinearCellsFunc) const;
- void getCellsContainingPointsZeAlg(const double *pos, int nbOfPoints, double eps,
- MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex,
- std::function<bool(INTERP_KERNEL::NormalizedCellType,int)> sensibilityTo2DQuadraticLinearCellsFunc) const;
+ void getCellsContainingPointsAlg(const double *coords, const double *pos, mcIdType nbOfPoints,
+ double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex, std::function<bool(INTERP_KERNEL::NormalizedCellType,int)> sensibilityTo2DQuadraticLinearCellsFunc) const;
+ void getCellsContainingPointsZeAlg(const double *pos, mcIdType nbOfPoints, double eps,
+ MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex,
+ std::function<bool(INTERP_KERNEL::NormalizedCellType,mcIdType)> sensibilityTo2DQuadraticLinearCellsFunc) const;
/// @cond INTERNAL
static MEDCouplingUMesh *MergeUMeshesLL(const std::vector<const MEDCouplingUMesh *>& a);
- typedef int (*DimM1DescNbrer)(int id, unsigned nb, const INTERP_KERNEL::CellModel& cm, bool compute, const int *conn1, const int *conn2);
+ typedef mcIdType (*DimM1DescNbrer)(mcIdType id, mcIdType nb, const INTERP_KERNEL::CellModel& cm, bool compute, const mcIdType *conn1, const mcIdType *conn2);
template<class SonsGenerator>
- MEDCouplingUMesh *buildDescendingConnectivityGen(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx, DimM1DescNbrer nbrer) const;
- static void DistanceToPoint3DSurfAlg(const double *pt, const int *cellIdsBg, const int *cellIdsEnd, const double *coords, const int *nc, const int *ncI, double& ret0, int& cellId);
- static void DistanceToPoint2DCurveAlg(const double *pt, const int *cellIdsBg, const int *cellIdsEnd, const double *coords, const int *nc, const int *ncI, double& ret0, int& cellId);
- static DataArrayInt *ComputeSpreadZoneGraduallyFromSeedAlg(std::vector<bool>& fetched, const int *seedBg, const int *seedEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling, int& nbOfDepthPeelingPerformed);
- static void FillInCompact3DMode(int spaceDim, int nbOfNodesInCell, const int *conn, const double *coo, double *zipFrmt);
- static void AppendExtrudedCell(const int *connBg, const int *connEnd, int nbOfNodesPerLev, bool isQuad, std::vector<int>& ret);
- static void Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const MEDCouplingUMesh *m2Desc, double eps, std::vector< std::vector<int> >& intersectEdge1, std::vector< std::vector<int> >& colinear2, std::vector< std::vector<int> >& subDiv2, std::vector<double>& addCoo, std::map<int,int>& mergedNodes);
+ MEDCouplingUMesh *buildDescendingConnectivityGen(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx, DimM1DescNbrer nbrer) const;
+ static void DistanceToPoint3DSurfAlg(const double *pt, const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const double *coords, const mcIdType *nc, const mcIdType *ncI, double& ret0, mcIdType& cellId);
+ static void DistanceToPoint2DCurveAlg(const double *pt, const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const double *coords, const mcIdType *nc, const mcIdType *ncI, double& ret0, mcIdType& cellId);
+ static DataArrayIdType *ComputeSpreadZoneGraduallyFromSeedAlg(std::vector<bool>& fetched, const mcIdType *seedBg, const mcIdType *seedEnd, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling, mcIdType& nbOfDepthPeelingPerformed);
+ static void FillInCompact3DMode(int spaceDim, mcIdType nbOfNodesInCell, const mcIdType *conn, const double *coo, double *zipFrmt);
+ static void AppendExtrudedCell(const mcIdType *connBg, const mcIdType *connEnd, mcIdType nbOfNodesPerLev, bool isQuad, std::vector<mcIdType>& ret);
+ static void Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const MEDCouplingUMesh *m2Desc, double eps, std::vector< std::vector<mcIdType> >& intersectEdge1, std::vector< std::vector<mcIdType> >& colinear2, std::vector< std::vector<mcIdType> >& subDiv2, std::vector<double>& addCoo, std::map<mcIdType,mcIdType>& mergedNodes);
static void IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps,
- std::vector< std::vector<int> >& intersectEdge1, std::vector< std::vector<int> >& colinear2, std::vector< std::vector<int> >& subDiv2,
- MEDCouplingUMesh *& m1Desc, DataArrayInt *&desc1, DataArrayInt *&descIndx1, DataArrayInt *&revDesc1, DataArrayInt *&revDescIndx1,
+ std::vector< std::vector<mcIdType> >& intersectEdge1, std::vector< std::vector<mcIdType> >& colinear2, std::vector< std::vector<mcIdType> >& subDiv2,
+ MEDCouplingUMesh *& m1Desc, DataArrayIdType *&desc1, DataArrayIdType *&descIndx1, DataArrayIdType *&revDesc1, DataArrayIdType *&revDescIndx1,
std::vector<double>& addCoo,
- MEDCouplingUMesh *& m2Desc, DataArrayInt *&desc2, DataArrayInt *&descIndx2, DataArrayInt *&revDesc2, DataArrayInt *&revDescIndx2);
- static void BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, const std::vector<double>& addCoo, const std::vector< std::vector<int> >& subDiv, std::vector< std::vector<int> >& intersectEdge);
- static void BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const int *desc1, const int *descIndx1, const std::vector<std::vector<int> >& intesctEdges1, const std::vector< std::vector<int> >& colinear2,
- const MEDCouplingUMesh *m2, const int *desc2, const int *descIndx2, const std::vector<std::vector<int> >& intesctEdges2,
+ MEDCouplingUMesh *& m2Desc, DataArrayIdType *&desc2, DataArrayIdType *&descIndx2, DataArrayIdType *&revDesc2, DataArrayIdType *&revDescIndx2);
+ static void BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, const std::vector<double>& addCoo, const std::vector< std::vector<mcIdType> >& subDiv, std::vector< std::vector<mcIdType> >& intersectEdge);
+ static void BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const mcIdType *desc1, const mcIdType *descIndx1, const std::vector<std::vector<mcIdType> >& intesctEdges1, const std::vector< std::vector<mcIdType> >& colinear2,
+ const MEDCouplingUMesh *m2, const mcIdType *desc2, const mcIdType *descIndx2, const std::vector<std::vector<mcIdType> >& intesctEdges2,
const std::vector<double>& addCoords,
- std::vector<double>& addCoordsQuadratic, std::vector<int>& cr, std::vector<int>& crI, std::vector<int>& cNb1, std::vector<int>& cNb2);
- static void AssemblyForSplitFrom3DCurve(const std::vector<int>& cut3DCurve, std::vector<int>& nodesOnPlane, const int *nodal3DSurf, const int *nodalIndx3DSurf,
- const int *nodal3DCurve, const int *nodalIndx3DCurve,
- const int *desc, const int *descIndx, std::vector< std::pair<int,int> >& cut3DSurf);
- void assemblyForSplitFrom3DSurf(const std::vector< std::pair<int,int> >& cut3DSurf,
- const int *desc, const int *descIndx, DataArrayInt *nodalRes, DataArrayInt *nodalResIndx, DataArrayInt *cellIds) const;
- void buildSubCellsFromCut(const std::vector< std::pair<int,int> >& cut3DSurf, const int *desc, const int *descIndx, const double *coords, double eps, std::vector<std::vector<int> >& res) const;
- void split2DCellsLinear(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI);
- int split2DCellsQuadratic(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *mid, const DataArrayInt *midI);
- static bool Colinearize2DCell(const double *coords, const int *connBg, const int *connEnd, int offset, const std::map<int, bool>& forbiddenPoints, DataArrayInt *newConnOfCell, DataArrayDouble *appendedCoords);
- static void ComputeAllTypesInternal(std::set<INTERP_KERNEL::NormalizedCellType>& types, const DataArrayInt *nodalConnec, const DataArrayInt *nodalConnecIndex);
- static bool OrderPointsAlongLine(const double * coo, int startNode, int endNode,
- const int * c, const int * cI, const int *idsBg, const int *endBg,
- std::vector<int> & pointIds, std::vector<int> & hitSegs);
- static void ReplaceEdgeInFace(const int * sIdxConn, const int * sIdxConnE, int startNode, int endNode,
- const std::vector<int>& insidePoints, std::vector<int>& modifiedFace);
- void attractSeg3MidPtsAroundNodesUnderground(double ratio, const int *nodeIdsBg, const int *nodeIdsEnd);
- DataArrayInt *internalColinearize2D(double eps, bool stayConform);
+ std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& cr, std::vector<mcIdType>& crI, std::vector<mcIdType>& cNb1, std::vector<mcIdType>& cNb2);
+ static void AssemblyForSplitFrom3DCurve(const std::vector<mcIdType>& cut3DCurve, std::vector<mcIdType>& nodesOnPlane, const mcIdType *nodal3DSurf, const mcIdType *nodalIndx3DSurf,
+ const mcIdType *nodal3DCurve, const mcIdType *nodalIndx3DCurve,
+ const mcIdType *desc, const mcIdType *descIndx, std::vector< std::pair<mcIdType,mcIdType> >& cut3DSurf);
+ void assemblyForSplitFrom3DSurf(const std::vector< std::pair<mcIdType,mcIdType> >& cut3DSurf,
+ const mcIdType *desc, const mcIdType *descIndx, DataArrayIdType *nodalRes, DataArrayIdType *nodalResIndx, DataArrayIdType *cellIds) const;
+ void buildSubCellsFromCut(const std::vector< std::pair<mcIdType,mcIdType> >& cut3DSurf, const mcIdType *desc, const mcIdType *descIndx, const double *coords, double eps, std::vector<std::vector<mcIdType> >& res) const;
+ void split2DCellsLinear(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI);
+ mcIdType split2DCellsQuadratic(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *mid, const DataArrayIdType *midI);
+ static bool Colinearize2DCell(const double *coords, const mcIdType *connBg, const mcIdType *connEnd, mcIdType offset, const std::map<mcIdType, bool>& forbiddenPoints, DataArrayIdType *newConnOfCell, DataArrayDouble *appendedCoords);
+ static void ComputeAllTypesInternal(std::set<INTERP_KERNEL::NormalizedCellType>& types, const DataArrayIdType *nodalConnec, const DataArrayIdType *nodalConnecIndex);
+ static bool OrderPointsAlongLine(const double * coo, mcIdType startNode, mcIdType endNode,
+ const mcIdType * c, const mcIdType * cI, const mcIdType *idsBg, const mcIdType *endBg,
+ std::vector<mcIdType> & pointIds, std::vector<mcIdType> & hitSegs);
+ static void ReplaceEdgeInFace(const mcIdType * sIdxConn, const mcIdType * sIdxConnE, mcIdType startNode, mcIdType endNode,
+ const std::vector<mcIdType>& insidePoints, std::vector<mcIdType>& modifiedFace);
+ void attractSeg3MidPtsAroundNodesUnderground(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd);
+ DataArrayIdType *internalColinearize2D(double eps, bool stayConform);
template<class MAPCLS>
void renumberNodesInConnT(const MAPCLS& newNodeNumbersO2N);
public:
- MEDCOUPLING_EXPORT static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code);
+ MEDCOUPLING_EXPORT static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code);
MEDCOUPLING_EXPORT static const int N_MEDMEM_ORDER=25;
MEDCOUPLING_EXPORT static const INTERP_KERNEL::NormalizedCellType MEDMEM_ORDER[N_MEDMEM_ORDER];
- MEDCOUPLING_EXPORT static const int MEDCOUPLING2VTKTYPETRADUCER[INTERP_KERNEL::NORM_MAXTYPE+1];
+ MEDCOUPLING_EXPORT static const mcIdType MEDCOUPLING2VTKTYPETRADUCER[INTERP_KERNEL::NORM_MAXTYPE+1];
/// @endcond
private:
int _mesh_dim;
{
public:
MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mesh);
- MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mesh, MEDCouplingUMeshCell *itc, int bg, int end);
+ MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mesh, MEDCouplingUMeshCell *itc, mcIdType bg, mcIdType end);
MEDCOUPLING_EXPORT ~MEDCouplingUMeshCellIterator();
MEDCOUPLING_EXPORT MEDCouplingUMeshCell *nextt();
private:
MEDCouplingUMesh *_mesh;
MEDCouplingUMeshCell *_cell;
bool _own_cell;
- int _cell_id;
- int _nb_cell;
+ mcIdType _cell_id;
+ mcIdType _nb_cell;
};
class MEDCouplingUMeshCellByTypeIterator;
class MEDCouplingUMeshCellEntry
{
public:
- MEDCOUPLING_EXPORT MEDCouplingUMeshCellEntry(MEDCouplingUMesh *mesh, INTERP_KERNEL::NormalizedCellType type, MEDCouplingUMeshCell *itc, int bg, int end);
+ MEDCOUPLING_EXPORT MEDCouplingUMeshCellEntry(MEDCouplingUMesh *mesh, INTERP_KERNEL::NormalizedCellType type, MEDCouplingUMeshCell *itc, mcIdType bg, mcIdType end);
MEDCOUPLING_EXPORT ~MEDCouplingUMeshCellEntry();
MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getType() const;
- MEDCOUPLING_EXPORT int getNumberOfElems() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const;
MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator *iterator();
private:
MEDCouplingUMesh *_mesh;
INTERP_KERNEL::NormalizedCellType _type;
MEDCouplingUMeshCell *_itc;
- int _bg;
- int _end;
+ mcIdType _bg;
+ mcIdType _end;
};
class MEDCouplingUMeshCellByTypeIterator
private:
MEDCouplingUMesh *_mesh;
MEDCouplingUMeshCell *_cell;
- int _cell_id;
- int _nb_cell;
+ mcIdType _cell_id;
+ mcIdType _nb_cell;
};
class MEDCouplingUMeshCell
MEDCOUPLING_EXPORT void next();
MEDCOUPLING_EXPORT std::string repr() const;
MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getType() const;
- MEDCOUPLING_EXPORT const int *getAllConn(int& lgth) const;
+ MEDCOUPLING_EXPORT const mcIdType *getAllConn(mcIdType& lgth) const;
private:
- int *_conn;
- int *_conn_indx;
- int _conn_lgth;
+ mcIdType *_conn;
+ mcIdType *_conn_indx;
+ mcIdType _conn_lgth;
static const int NOTICABLE_FIRST_VAL=-7;
};
}
void MEDCoupling::MEDCouplingUMesh::renumberNodesInConnT(const MAPCLS& newNodeNumbersO2N)
{
checkConnectivityFullyDefined();
- int *conn(getNodalConnectivity()->getPointer());
- const int *connIndex(getNodalConnectivityIndex()->getConstPointer());
- int nbOfCells(getNumberOfCells());
- for(int i=0;i<nbOfCells;i++)
- for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
+ mcIdType *conn(getNodalConnectivity()->getPointer());
+ const mcIdType *connIndex(getNodalConnectivityIndex()->getConstPointer());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ for(mcIdType i=0;i<nbOfCells;i++)
+ for(mcIdType iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
- int& node=conn[iconn];
+ mcIdType& node=conn[iconn];
if(node>=0)//avoid polyhedron separator
{
auto it(newNodeNumbersO2N.find(node));
{
if(_nodal_connec!=0 && _nodal_connec_index!=0)
{
- int nbOfCells=getNumberOfCells();
- const int *c=_nodal_connec->getConstPointer();
- const int *ci=_nodal_connec_index->getConstPointer();
- for(int i=0;i<nbOfCells;i++)
+ mcIdType nbOfCells=getNumberOfCells();
+ const mcIdType *c=_nodal_connec->getConstPointer();
+ const mcIdType *ci=_nodal_connec_index->getConstPointer();
+ for(mcIdType i=0;i<nbOfCells;i++)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c[ci[i]]);
stream << "Cell #" << i << " " << cm.getRepr() << " : ";
/*!
* This method implements policy 0 of virtual method MEDCoupling::MEDCouplingUMesh::simplexize.
*/
-DataArrayInt *MEDCouplingUMesh::simplexizePol0()
+DataArrayIdType *MEDCouplingUMesh::simplexizePol0()
{
checkConnectivityFullyDefined();
if(getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePol0 : this policy is only available for mesh with meshdim == 2 !");
- int nbOfCells=getNumberOfCells();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4);
+ mcIdType nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4);
ret->alloc(nbOfCells+nbOfCutCells,1);
if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); }
- int *retPt=ret->getPointer();
- MCAuto<DataArrayInt> newConn=DataArrayInt::New();
- MCAuto<DataArrayInt> newConnI=DataArrayInt::New();
+ mcIdType *retPt=ret->getPointer();
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New();
newConnI->alloc(nbOfCells+nbOfCutCells+1,1);
newConn->alloc(getNodalConnectivityArrayLen()+3*nbOfCutCells,1);
- int *pt=newConn->getPointer();
- int *ptI=newConnI->getPointer();
+ mcIdType *pt=newConn->getPointer();
+ mcIdType *ptI=newConnI->getPointer();
ptI[0]=0;
- const int *oldc=_nodal_connec->begin();
- const int *ci=_nodal_connec_index->begin();
- for(int i=0;i<nbOfCells;i++,ci++)
+ const mcIdType *oldc=_nodal_connec->begin();
+ const mcIdType *ci=_nodal_connec_index->begin();
+ for(mcIdType i=0;i<nbOfCells;i++,ci++)
{
if((INTERP_KERNEL::NormalizedCellType)oldc[ci[0]]==INTERP_KERNEL::NORM_QUAD4)
{
- const int tmp[8]={(int)INTERP_KERNEL::NORM_TRI3,oldc[ci[0]+1],oldc[ci[0]+2],oldc[ci[0]+3],
- (int)INTERP_KERNEL::NORM_TRI3,oldc[ci[0]+1],oldc[ci[0]+3],oldc[ci[0]+4]};
+ const mcIdType tmp[8]={ToIdType(INTERP_KERNEL::NORM_TRI3),oldc[ci[0]+1],oldc[ci[0]+2],oldc[ci[0]+3],
+ ToIdType(INTERP_KERNEL::NORM_TRI3),oldc[ci[0]+1],oldc[ci[0]+3],oldc[ci[0]+4]};
pt=std::copy(tmp,tmp+8,pt);
ptI[1]=ptI[0]+4;
ptI[2]=ptI[0]+8;
/*!
* This method implements policy 1 of virtual method MEDCoupling::MEDCouplingUMesh::simplexize.
*/
-DataArrayInt *MEDCouplingUMesh::simplexizePol1()
+DataArrayIdType *MEDCouplingUMesh::simplexizePol1()
{
checkConnectivityFullyDefined();
if(getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePol0 : this policy is only available for mesh with meshdim == 2 !");
- int nbOfCells=getNumberOfCells();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4);
+ mcIdType nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4);
ret->alloc(nbOfCells+nbOfCutCells,1);
if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); }
- int *retPt=ret->getPointer();
- MCAuto<DataArrayInt> newConn=DataArrayInt::New();
- MCAuto<DataArrayInt> newConnI=DataArrayInt::New();
+ mcIdType *retPt=ret->getPointer();
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New();
newConnI->alloc(nbOfCells+nbOfCutCells+1,1);
newConn->alloc(getNodalConnectivityArrayLen()+3*nbOfCutCells,1);
- int *pt=newConn->getPointer();
- int *ptI=newConnI->getPointer();
+ mcIdType *pt=newConn->getPointer();
+ mcIdType *ptI=newConnI->getPointer();
ptI[0]=0;
- const int *oldc=_nodal_connec->begin();
- const int *ci=_nodal_connec_index->begin();
- for(int i=0;i<nbOfCells;i++,ci++)
+ const mcIdType *oldc=_nodal_connec->begin();
+ const mcIdType *ci=_nodal_connec_index->begin();
+ for(mcIdType i=0;i<nbOfCells;i++,ci++)
{
if((INTERP_KERNEL::NormalizedCellType)oldc[ci[0]]==INTERP_KERNEL::NORM_QUAD4)
{
- const int tmp[8]={(int)INTERP_KERNEL::NORM_TRI3,oldc[ci[0]+1],oldc[ci[0]+2],oldc[ci[0]+4],
- (int)INTERP_KERNEL::NORM_TRI3,oldc[ci[0]+2],oldc[ci[0]+3],oldc[ci[0]+4]};
+ const mcIdType tmp[8]={ToIdType(INTERP_KERNEL::NORM_TRI3),oldc[ci[0]+1],oldc[ci[0]+2],oldc[ci[0]+4],
+ ToIdType(INTERP_KERNEL::NORM_TRI3),oldc[ci[0]+2],oldc[ci[0]+3],oldc[ci[0]+4]};
pt=std::copy(tmp,tmp+8,pt);
ptI[1]=ptI[0]+4;
ptI[2]=ptI[0]+8;
/*!
* This method implements policy INTERP_KERNEL::PLANAR_FACE_5 of virtual method MEDCoupling::MEDCouplingUMesh::simplexize.
*/
-DataArrayInt *MEDCouplingUMesh::simplexizePlanarFace5()
+DataArrayIdType *MEDCouplingUMesh::simplexizePlanarFace5()
{
checkConnectivityFullyDefined();
if(getMeshDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePlanarFace5 : this policy is only available for mesh with meshdim == 3 !");
- int nbOfCells=getNumberOfCells();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8);
+ mcIdType nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8);
ret->alloc(nbOfCells+4*nbOfCutCells,1);
if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); }
- int *retPt=ret->getPointer();
- MCAuto<DataArrayInt> newConn=DataArrayInt::New();
- MCAuto<DataArrayInt> newConnI=DataArrayInt::New();
+ mcIdType *retPt=ret->getPointer();
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New();
newConnI->alloc(nbOfCells+4*nbOfCutCells+1,1);
newConn->alloc(getNodalConnectivityArrayLen()+16*nbOfCutCells,1);//21
- int *pt=newConn->getPointer();
- int *ptI=newConnI->getPointer();
+ mcIdType *pt=newConn->getPointer();
+ mcIdType *ptI=newConnI->getPointer();
ptI[0]=0;
- const int *oldc=_nodal_connec->begin();
- const int *ci=_nodal_connec_index->begin();
- for(int i=0;i<nbOfCells;i++,ci++)
+ const mcIdType *oldc=_nodal_connec->begin();
+ const mcIdType *ci=_nodal_connec_index->begin();
+ for(mcIdType i=0;i<nbOfCells;i++,ci++)
{
if((INTERP_KERNEL::NormalizedCellType)oldc[ci[0]]==INTERP_KERNEL::NORM_HEXA8)
{
for(int j=0;j<5;j++,pt+=5,ptI++)
{
- pt[0]=(int)INTERP_KERNEL::NORM_TETRA4;
+ pt[0]=ToIdType(INTERP_KERNEL::NORM_TETRA4);
pt[1]=oldc[ci[0]+INTERP_KERNEL::SPLIT_NODES_5_WO[4*j+0]+1]; pt[2]=oldc[ci[0]+INTERP_KERNEL::SPLIT_NODES_5_WO[4*j+1]+1]; pt[3]=oldc[ci[0]+INTERP_KERNEL::SPLIT_NODES_5_WO[4*j+2]+1]; pt[4]=oldc[ci[0]+INTERP_KERNEL::SPLIT_NODES_5_WO[4*j+3]+1];
*retPt++=i;
ptI[1]=ptI[0]+5;
/*!
* This method implements policy INTERP_KERNEL::PLANAR_FACE_6 of virtual method MEDCoupling::MEDCouplingUMesh::simplexize.
*/
-DataArrayInt *MEDCouplingUMesh::simplexizePlanarFace6()
+DataArrayIdType *MEDCouplingUMesh::simplexizePlanarFace6()
{
checkConnectivityFullyDefined();
if(getMeshDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePlanarFace6 : this policy is only available for mesh with meshdim == 3 !");
- int nbOfCells=getNumberOfCells();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8);
+ mcIdType nbOfCells=getNumberOfCells();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8);
ret->alloc(nbOfCells+5*nbOfCutCells,1);
if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); }
- int *retPt=ret->getPointer();
- MCAuto<DataArrayInt> newConn=DataArrayInt::New();
- MCAuto<DataArrayInt> newConnI=DataArrayInt::New();
+ mcIdType *retPt=ret->getPointer();
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New();
newConnI->alloc(nbOfCells+5*nbOfCutCells+1,1);
newConn->alloc(getNodalConnectivityArrayLen()+21*nbOfCutCells,1);
- int *pt=newConn->getPointer();
- int *ptI=newConnI->getPointer();
+ mcIdType *pt=newConn->getPointer();
+ mcIdType *ptI=newConnI->getPointer();
ptI[0]=0;
- const int *oldc=_nodal_connec->begin();
- const int *ci=_nodal_connec_index->begin();
- for(int i=0;i<nbOfCells;i++,ci++)
+ const mcIdType *oldc=_nodal_connec->begin();
+ const mcIdType *ci=_nodal_connec_index->begin();
+ for(mcIdType i=0;i<nbOfCells;i++,ci++)
{
if((INTERP_KERNEL::NormalizedCellType)oldc[ci[0]]==INTERP_KERNEL::NORM_HEXA8)
{
for(int j=0;j<6;j++,pt+=5,ptI++)
{
- pt[0]=(int)INTERP_KERNEL::NORM_TETRA4;
+ pt[0]=ToIdType(INTERP_KERNEL::NORM_TETRA4);
pt[1]=oldc[ci[0]+INTERP_KERNEL::SPLIT_NODES_6_WO[4*j+0]+1]; pt[2]=oldc[ci[0]+INTERP_KERNEL::SPLIT_NODES_6_WO[4*j+1]+1]; pt[3]=oldc[ci[0]+INTERP_KERNEL::SPLIT_NODES_6_WO[4*j+2]+1]; pt[4]=oldc[ci[0]+INTERP_KERNEL::SPLIT_NODES_6_WO[4*j+3]+1];
*retPt++=i;
ptI[1]=ptI[0]+5;
double epsa=fabs(eps);
if(epsa<std::numeric_limits<double>::min())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DInternal : epsilon is null ! Please specify a higher epsilon. If too tiny it can lead to a huge amount of nodes and memory !");
- MCAuto<DataArrayInt> desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New());
+ MCAuto<DataArrayIdType> desc1(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> mDesc(buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1));
revDesc1=0; revDescIndx1=0;
mDesc->tessellate2D(eps);
if(epsa<std::numeric_limits<double>::min())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DCurveInternal : epsilon is null ! Please specify a higher epsilon. If too tiny it can lead to a huge amount of nodes and memory !");
INTERP_KERNEL::QuadraticPlanarPrecision arcPrec(1.e-10); // RAII
- int nbCells=getNumberOfCells();
- int nbNodes=getNumberOfNodes();
- const int *conn=_nodal_connec->begin();
- const int *connI=_nodal_connec_index->begin();
+ mcIdType nbCells=getNumberOfCells();
+ mcIdType nbNodes=getNumberOfNodes();
+ const mcIdType *conn=_nodal_connec->begin();
+ const mcIdType *connI=_nodal_connec_index->begin();
const double *coords=_coords->begin();
std::vector<double> addCoo;
- std::vector<int> newConn;//no direct DataArrayInt because interface with Geometric2D
- MCAuto<DataArrayInt> newConnI(DataArrayInt::New());
+ std::vector<mcIdType> newConn;//no direct DataArrayIdType because interface with Geometric2D
+ MCAuto<DataArrayIdType> newConnI(DataArrayIdType::New());
newConnI->alloc(nbCells+1,1);
- int *newConnIPtr=newConnI->getPointer();
+ mcIdType *newConnIPtr=newConnI->getPointer();
*newConnIPtr=0;
- int tmp1[3];
+ mcIdType tmp1[3];
INTERP_KERNEL::Node *tmp2[3];
std::set<INTERP_KERNEL::NormalizedCellType> types;
- for(int i=0;i<nbCells;i++,newConnIPtr++)
+ for(mcIdType i=0;i<nbCells;i++,newConnIPtr++)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
if(cm.isQuadratic())
eac->tesselate(tmp1,nbNodes,epsa,newConn,addCoo);
types.insert((INTERP_KERNEL::NormalizedCellType)newConn[newConnIPtr[0]]);
delete eac;
- newConnIPtr[1]=(int)newConn.size();
+ newConnIPtr[1]=ToIdType(newConn.size());
}
else
{
newConnIPtr[1]=newConnIPtr[0]+3;
}
}
- if(addCoo.empty() && newConn.size()==_nodal_connec->getNumberOfTuples())//nothing happens during tessellation : no update needed
+ if(addCoo.empty() && ToIdType(newConn.size())==_nodal_connec->getNumberOfTuples())//nothing happens during tessellation : no update needed
return ;
_types=types;
- DataArrayInt::SetArrayIn(newConnI,_nodal_connec_index);
- MCAuto<DataArrayInt> newConnArr=DataArrayInt::New();
- newConnArr->alloc((int)newConn.size(),1);
+ DataArrayIdType::SetArrayIn(newConnI,_nodal_connec_index);
+ MCAuto<DataArrayIdType> newConnArr=DataArrayIdType::New();
+ newConnArr->alloc(newConn.size(),1);
std::copy(newConn.begin(),newConn.end(),newConnArr->getPointer());
- DataArrayInt::SetArrayIn(newConnArr,_nodal_connec);
+ DataArrayIdType::SetArrayIn(newConnArr,_nodal_connec);
MCAuto<DataArrayDouble> newCoords=DataArrayDouble::New();
- newCoords->alloc(nbNodes+((int)addCoo.size())/2,2);
+ newCoords->alloc(nbNodes+addCoo.size()/2,2);
double *work=std::copy(_coords->begin(),_coords->end(),newCoords->getPointer());
std::copy(addCoo.begin(),addCoo.end(),work);
DataArrayDouble::SetArrayIn(newCoords,_coords);
* \param desc is descending connectivity in format specified in MEDCouplingUMesh::buildDescendingConnectivity2
* \param descIndex is descending connectivity index in format specified in MEDCouplingUMesh::buildDescendingConnectivity2
*/
-void MEDCouplingUMesh::subDivide2DMesh(const int *nodeSubdived, const int *nodeIndxSubdived, const int *desc, const int *descIndex)
+void MEDCouplingUMesh::subDivide2DMesh(const mcIdType *nodeSubdived, const mcIdType *nodeIndxSubdived, const mcIdType *desc, const mcIdType *descIndex)
{
checkFullyDefined();
if(getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::subDivide2DMesh : works only on umesh with meshdim==2 !");
- int nbOfCells=getNumberOfCells();
- int *connI=_nodal_connec_index->getPointer();
- int newConnLgth=0;
- for(int i=0;i<nbOfCells;i++,connI++)
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType *connI=_nodal_connec_index->getPointer();
+ mcIdType newConnLgth=0;
+ for(mcIdType i=0;i<nbOfCells;i++,connI++)
{
- int offset=descIndex[i];
- int nbOfEdges=descIndex[i+1]-offset;
+ mcIdType offset=descIndex[i];
+ mcIdType nbOfEdges=descIndex[i+1]-offset;
//
bool ddirect=desc[offset+nbOfEdges-1]>0;
- int eedgeId=std::abs(desc[offset+nbOfEdges-1])-1;
- int ref=ddirect?nodeSubdived[nodeIndxSubdived[eedgeId+1]-1]:nodeSubdived[nodeIndxSubdived[eedgeId]+1];
- for(int j=0;j<nbOfEdges;j++)
+ mcIdType eedgeId=std::abs(desc[offset+nbOfEdges-1])-1;
+ mcIdType ref=ddirect?nodeSubdived[nodeIndxSubdived[eedgeId+1]-1]:nodeSubdived[nodeIndxSubdived[eedgeId]+1];
+ for(mcIdType j=0;j<nbOfEdges;j++)
{
bool direct=desc[offset+j]>0;
- int edgeId=std::abs(desc[offset+j])-1;
+ mcIdType edgeId=std::abs(desc[offset+j])-1;
if(!INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)nodeSubdived[nodeIndxSubdived[edgeId]]).isQuadratic())
{
- int id1=nodeSubdived[nodeIndxSubdived[edgeId]+1];
- int id2=nodeSubdived[nodeIndxSubdived[edgeId+1]-1];
- int ref2=direct?id1:id2;
+ mcIdType id1=nodeSubdived[nodeIndxSubdived[edgeId]+1];
+ mcIdType id2=nodeSubdived[nodeIndxSubdived[edgeId+1]-1];
+ mcIdType ref2=direct?id1:id2;
if(ref==ref2)
{
- int nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1;
+ mcIdType nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1;
newConnLgth+=nbOfSubNodes-1;
ref=direct?id2:id1;
}
connI[1]=newConnLgth;
}
//
- MCAuto<DataArrayInt> newConn=DataArrayInt::New();
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New();
newConn->alloc(newConnLgth,1);
- int *work=newConn->getPointer();
- for(int i=0;i<nbOfCells;i++)
+ mcIdType *work=newConn->getPointer();
+ for(mcIdType i=0;i<nbOfCells;i++)
{
*work++=INTERP_KERNEL::NORM_POLYGON;
- int offset=descIndex[i];
- int nbOfEdges=descIndex[i+1]-offset;
- for(int j=0;j<nbOfEdges;j++)
+ mcIdType offset=descIndex[i];
+ mcIdType nbOfEdges=descIndex[i+1]-offset;
+ for(mcIdType j=0;j<nbOfEdges;j++)
{
bool direct=desc[offset+j]>0;
- int edgeId=std::abs(desc[offset+j])-1;
+ mcIdType edgeId=std::abs(desc[offset+j])-1;
if(direct)
work=std::copy(nodeSubdived+nodeIndxSubdived[edgeId]+1,nodeSubdived+nodeIndxSubdived[edgeId+1]-1,work);
else
{
- int nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1;
- std::reverse_iterator<const int *> it(nodeSubdived+nodeIndxSubdived[edgeId+1]);
+ mcIdType nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1;
+ std::reverse_iterator<const mcIdType *> it(nodeSubdived+nodeIndxSubdived[edgeId+1]);
work=std::copy(it,it+nbOfSubNodes-1,work);
}
}
}
- DataArrayInt::SetArrayIn(newConn,_nodal_connec);
+ DataArrayIdType::SetArrayIn(newConn,_nodal_connec);
_types.clear();
if(nbOfCells>0)
_types.insert(INTERP_KERNEL::NORM_POLYGON);
* \param [in] fullyIn input that specifies if all node ids must be in [ \a begin,\a end ) array to consider cell to be in.
* \param [in,out] cellIdsKeptArr array where all candidate cell ids are put at the end.
*/
-void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const
+void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const
{
- MCAuto<DataArrayInt> cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1);
+ MCAuto<DataArrayIdType> cellIdsKept=DataArrayIdType::New(); cellIdsKept->alloc(0,1);
checkConnectivityFullyDefined();
- int tmp=-1;
- int sz=getNodalConnectivity()->getMaxValue(tmp); sz=std::max(sz,0)+1;
+ mcIdType tmp=-1;
+ mcIdType sz=getNodalConnectivity()->getMaxValue(tmp); sz=std::max(sz,ToIdType(0))+1;
std::vector<bool> fastFinder(sz,false);
- for(const int *work=begin;work!=end;work++)
+ for(const mcIdType *work=begin;work!=end;work++)
if(*work>=0 && *work<sz)
fastFinder[*work]=true;
- int nbOfCells=getNumberOfCells();
- const int *conn=getNodalConnectivity()->getConstPointer();
- const int *connIndex=getNodalConnectivityIndex()->getConstPointer();
- for(int i=0;i<nbOfCells;i++)
+ mcIdType nbOfCells=getNumberOfCells();
+ const mcIdType *conn=getNodalConnectivity()->getConstPointer();
+ const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer();
+ for(mcIdType i=0;i<nbOfCells;i++)
{
- int ref=0,nbOfHit=0;
- for(const int *work2=conn+connIndex[i]+1;work2!=conn+connIndex[i+1];work2++)
+ mcIdType ref=0,nbOfHit=0;
+ for(const mcIdType *work2=conn+connIndex[i]+1;work2!=conn+connIndex[i+1];work2++)
if(*work2>=0)
{
ref++;
* if cut3DCurve[i]==-1, it means that cell#i has been already detected to be fully part of plane defined by ('origin','vec').
* This method will throw an exception if \a this contains a non linear segment.
*/
-void MEDCouplingUMesh::split3DCurveWithPlane(const double *origin, const double *vec, double eps, std::vector<int>& cut3DCurve)
+void MEDCouplingUMesh::split3DCurveWithPlane(const double *origin, const double *vec, double eps, std::vector<mcIdType>& cut3DCurve)
{
checkFullyDefined();
if(getMeshDimension()!=1 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::split3DCurveWithPlane works on umeshes with meshdim equal to 1 and spaceDim equal to 3 !");
- int ncells=getNumberOfCells();
- int nnodes=getNumberOfNodes();
+ mcIdType ncells=getNumberOfCells();
+ mcIdType nnodes=getNumberOfNodes();
double vec2[3],vec3[3],vec4[3];
double normm=sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]);
if(normm<1e-6)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::split3DCurveWithPlane : parameter 'vec' should have a norm2 greater than 1e-6 !");
vec2[0]=vec[0]/normm; vec2[1]=vec[1]/normm; vec2[2]=vec[2]/normm;
- const int *conn=_nodal_connec->getConstPointer();
- const int *connI=_nodal_connec_index->getConstPointer();
+ const mcIdType *conn=_nodal_connec->getConstPointer();
+ const mcIdType *connI=_nodal_connec_index->getConstPointer();
const double *coo=_coords->getConstPointer();
std::vector<double> addCoo;
- for(int i=0;i<ncells;i++)
+ for(mcIdType i=0;i<ncells;i++)
{
- if(conn[connI[i]]==(int)INTERP_KERNEL::NORM_SEG2)
+ if(conn[connI[i]]==ToIdType(INTERP_KERNEL::NORM_SEG2))
{
if(cut3DCurve[i]==-2)
{
- int st=conn[connI[i]+1],endd=conn[connI[i]+2];
+ mcIdType st=conn[connI[i]+1],endd=conn[connI[i]+2];
vec3[0]=coo[3*endd]-coo[3*st]; vec3[1]=coo[3*endd+1]-coo[3*st+1]; vec3[2]=coo[3*endd+2]-coo[3*st+2];
double normm2=sqrt(vec3[0]*vec3[0]+vec3[1]*vec3[1]+vec3[2]*vec3[2]);
double colin=std::abs((vec3[0]*vec2[0]+vec3[1]*vec2[1]+vec3[2]*vec2[2])/normm2);
double pos=-(vec4[0]*vec2[0]+vec4[1]*vec2[1]+vec4[2]*vec2[2])/((vec3[0]*vec2[0]+vec3[1]*vec2[1]+vec3[2]*vec2[2]));
if(pos>eps && pos<1-eps)
{
- int nNode=((int)addCoo.size())/3;
+ mcIdType nNode=ToIdType(addCoo.size())/3;
vec4[0]=st2[0]+pos*vec3[0]; vec4[1]=st2[1]+pos*vec3[1]; vec4[2]=st2[2]+pos*vec3[2];
addCoo.insert(addCoo.end(),vec4,vec4+3);
cut3DCurve[i]=nnodes+nNode;
}
if(!addCoo.empty())
{
- int newNbOfNodes=nnodes+((int)addCoo.size())/3;
+ mcIdType newNbOfNodes=nnodes+ToIdType(addCoo.size())/3;
MCAuto<DataArrayDouble> coo2=DataArrayDouble::New();
coo2->alloc(newNbOfNodes,3);
double *tmp=coo2->getPointer();
*/
DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslation(const MEDCouplingUMesh *mesh1D, bool isQuad) const
{
- int oldNbOfNodes=getNumberOfNodes();
- int nbOf1DCells=mesh1D->getNumberOfCells();
- int spaceDim=getSpaceDimension();
+ mcIdType oldNbOfNodes=getNumberOfNodes();
+ mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells());
+ std::size_t spaceDim=getSpaceDimension();
DataArrayDouble *ret=DataArrayDouble::New();
std::vector<bool> isQuads;
- int nbOfLevsInVec=isQuad?2*nbOf1DCells+1:nbOf1DCells+1;
+ mcIdType nbOfLevsInVec=isQuad?2*nbOf1DCells+1:nbOf1DCells+1;
ret->alloc(oldNbOfNodes*nbOfLevsInVec,spaceDim);
double *retPtr=ret->getPointer();
const double *coords=getCoords()->getConstPointer();
double *work=std::copy(coords,coords+spaceDim*oldNbOfNodes,retPtr);
- std::vector<int> v;
+ std::vector<mcIdType> v;
std::vector<double> c;
double vec[3];
v.reserve(3);
c.reserve(6);
- for(int i=0;i<nbOf1DCells;i++)
+ for(mcIdType i=0;i<nbOf1DCells;i++)
{
v.resize(0);
mesh1D->getNodeIdsOfCell(i,v);
mesh1D->getCoordinatesOfNode(v[isQuad?2:1],c);
mesh1D->getCoordinatesOfNode(v[0],c);
std::transform(c.begin(),c.begin()+spaceDim,c.begin()+spaceDim,vec,std::minus<double>());
- for(int j=0;j<oldNbOfNodes;j++)
+ for(mcIdType j=0;j<oldNbOfNodes;j++)
work=std::transform(vec,vec+spaceDim,retPtr+spaceDim*(i*oldNbOfNodes+j),work,std::plus<double>());
if(isQuad)
{
mesh1D->getCoordinatesOfNode(v[1],c);
mesh1D->getCoordinatesOfNode(v[0],c);
std::transform(c.begin(),c.begin()+spaceDim,c.begin()+spaceDim,vec,std::minus<double>());
- for(int j=0;j<oldNbOfNodes;j++)
+ for(mcIdType j=0;j<oldNbOfNodes;j++)
work=std::transform(vec,vec+spaceDim,retPtr+spaceDim*(i*oldNbOfNodes+j),work,std::plus<double>());
}
}
{
if(isQuad)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D : not implemented for quadratic cells !");
- int oldNbOfNodes=getNumberOfNodes();
- int nbOf1DCells=mesh1D->getNumberOfCells();
+ mcIdType oldNbOfNodes=getNumberOfNodes();
+ mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells());
if(nbOf1DCells<2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !");
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- int nbOfLevsInVec=nbOf1DCells+1;
+ mcIdType nbOfLevsInVec=nbOf1DCells+1;
ret->alloc(oldNbOfNodes*nbOfLevsInVec,2);
double *retPtr=ret->getPointer();
retPtr=std::copy(getCoords()->getConstPointer(),getCoords()->getConstPointer()+getCoords()->getNbOfElems(),retPtr);
MCAuto<DataArrayDouble> tmp2=getCoords()->deepCopy();
tmp->setCoords(tmp2);
const double *coo1D=mesh1D->getCoords()->getConstPointer();
- const int *conn1D=mesh1D->getNodalConnectivity()->getConstPointer();
- const int *connI1D=mesh1D->getNodalConnectivityIndex()->getConstPointer();
- for(int i=1;i<nbOfLevsInVec;i++)
+ const mcIdType *conn1D=mesh1D->getNodalConnectivity()->getConstPointer();
+ const mcIdType *connI1D=mesh1D->getNodalConnectivityIndex()->getConstPointer();
+ for(mcIdType i=1;i<nbOfLevsInVec;i++)
{
const double *begin=coo1D+2*conn1D[connI1D[i-1]+1];
const double *end=coo1D+2*conn1D[connI1D[i-1]+2];
{
if(isQuad)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D : not implemented for quadratic cells !");
- int oldNbOfNodes=getNumberOfNodes();
- int nbOf1DCells=mesh1D->getNumberOfCells();
+ mcIdType oldNbOfNodes=getNumberOfNodes();
+ mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells());
if(nbOf1DCells<2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !");
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- int nbOfLevsInVec=nbOf1DCells+1;
+ mcIdType nbOfLevsInVec=nbOf1DCells+1;
ret->alloc(oldNbOfNodes*nbOfLevsInVec,3);
double *retPtr=ret->getPointer();
retPtr=std::copy(getCoords()->getConstPointer(),getCoords()->getConstPointer()+getCoords()->getNbOfElems(),retPtr);
MCAuto<DataArrayDouble> tmp2=getCoords()->deepCopy();
tmp->setCoords(tmp2);
const double *coo1D=mesh1D->getCoords()->getConstPointer();
- const int *conn1D=mesh1D->getNodalConnectivity()->getConstPointer();
- const int *connI1D=mesh1D->getNodalConnectivityIndex()->getConstPointer();
- for(int i=1;i<nbOfLevsInVec;i++)
+ const mcIdType *conn1D=mesh1D->getNodalConnectivity()->getConstPointer();
+ const mcIdType *connI1D=mesh1D->getNodalConnectivityIndex()->getConstPointer();
+ for(mcIdType i=1;i<nbOfLevsInVec;i++)
{
const double *begin=coo1D+3*conn1D[connI1D[i-1]+1];
const double *end=coo1D+3*conn1D[connI1D[i-1]+2];
* the coords sorted slice by slice.
* \param isQuad specifies presence of quadratic cells.
*/
-MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMeshFromThisLowLev(int nbOfNodesOf1Lev, bool isQuad) const
+MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMeshFromThisLowLev(mcIdType nbOfNodesOf1Lev, bool isQuad) const
{
- int nbOf1DCells(getNumberOfNodes()/nbOfNodesOf1Lev-1);
- int nbOf2DCells(getNumberOfCells());
- int nbOf3DCells(nbOf2DCells*nbOf1DCells);
+ mcIdType nbOf1DCells(getNumberOfNodes()/nbOfNodesOf1Lev-1);
+ mcIdType nbOf2DCells=getNumberOfCells();
+ mcIdType nbOf3DCells(nbOf2DCells*nbOf1DCells);
MEDCouplingUMesh *ret(MEDCouplingUMesh::New("Extruded",getMeshDimension()+1));
- const int *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin());
- MCAuto<DataArrayInt> newConn(DataArrayInt::New()),newConnI(DataArrayInt::New());
+ const mcIdType *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin());
+ MCAuto<DataArrayIdType> newConn(DataArrayIdType::New()),newConnI(DataArrayIdType::New());
newConnI->alloc(nbOf3DCells+1,1);
- int *newConnIPtr(newConnI->getPointer());
+ mcIdType *newConnIPtr(newConnI->getPointer());
*newConnIPtr++=0;
- std::vector<int> newc;
- for(int j=0;j<nbOf2DCells;j++)
+ std::vector<mcIdType> newc;
+ for(mcIdType j=0;j<nbOf2DCells;j++)
{
AppendExtrudedCell(conn+connI[j],conn+connI[j+1],nbOfNodesOf1Lev,isQuad,newc);
- *newConnIPtr++=(int)newc.size();
+ *newConnIPtr++=ToIdType(newc.size());
}
- newConn->alloc((int)(newc.size())*nbOf1DCells,1);
- int *newConnPtr(newConn->getPointer());
- int deltaPerLev(isQuad?2*nbOfNodesOf1Lev:nbOfNodesOf1Lev);
+ newConn->alloc(newc.size()*nbOf1DCells,1);
+ mcIdType *newConnPtr(newConn->getPointer());
+ mcIdType deltaPerLev(isQuad?2*nbOfNodesOf1Lev:nbOfNodesOf1Lev);
newConnIPtr=newConnI->getPointer();
- for(int iz=0;iz<nbOf1DCells;iz++)
+ for(mcIdType iz=0;iz<nbOf1DCells;iz++)
{
if(iz!=0)
- std::transform(newConnIPtr+1,newConnIPtr+1+nbOf2DCells,newConnIPtr+1+iz*nbOf2DCells,std::bind2nd(std::plus<int>(),newConnIPtr[iz*nbOf2DCells]));
- const int *posOfTypeOfCell(newConnIPtr);
- for(std::vector<int>::const_iterator iter=newc.begin();iter!=newc.end();iter++,newConnPtr++)
+ std::transform(newConnIPtr+1,newConnIPtr+1+nbOf2DCells,newConnIPtr+1+iz*nbOf2DCells,std::bind2nd(std::plus<mcIdType>(),newConnIPtr[iz*nbOf2DCells]));
+ const mcIdType *posOfTypeOfCell(newConnIPtr);
+ for(std::vector<mcIdType>::const_iterator iter=newc.begin();iter!=newc.end();iter++,newConnPtr++)
{
- int icell((int)(iter-newc.begin()));//std::distance unfortunately cannot been called here in C++98
+ mcIdType icell(ToIdType(iter-newc.begin()));//std::distance unfortunately cannot been called here in C++98
if(icell!=*posOfTypeOfCell)
{
if(*iter!=-1)
* If in 'candidates' pool -1 value is considered as an empty value.
* WARNING this method returns only ONE set of result !
*/
-bool MEDCouplingUMesh::AreCellsEqualInPool(const std::vector<int>& candidates, int compType, const int *conn, const int *connI, DataArrayInt *result)
+bool MEDCouplingUMesh::AreCellsEqualInPool(const std::vector<mcIdType>& candidates, int compType, const mcIdType *conn, const mcIdType *connI, DataArrayIdType *result)
{
if(candidates.size()<1)
return false;
bool ret=false;
- std::vector<int>::const_iterator iter=candidates.begin();
- int start=(*iter++);
+ std::vector<mcIdType>::const_iterator iter=candidates.begin();
+ mcIdType start=(*iter++);
for(;iter!=candidates.end();iter++)
{
int status=AreCellsEqual(conn,connI,start,*iter,compType);
* Keeps from \a this only cells which constituing point id are in the ids specified by [ \a begin,\a end ).
* The return newly allocated mesh will share the same coordinates as \a this.
*/
-MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const
+MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const
{
checkConnectivityFullyDefined();
- int ncell=getNumberOfCells();
+ mcIdType ncell=getNumberOfCells();
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New();
ret->_mesh_dim=_mesh_dim;
ret->setCoords(_coords);
std::size_t nbOfElemsRet=std::distance(begin,end);
- int *connIndexRet=(int *)malloc((nbOfElemsRet+1)*sizeof(int));
+ mcIdType *connIndexRet=(mcIdType *)malloc((nbOfElemsRet+1)*sizeof(mcIdType));
connIndexRet[0]=0;
- const int *conn=_nodal_connec->getConstPointer();
- const int *connIndex=_nodal_connec_index->getConstPointer();
- int newNbring=0;
- for(const int *work=begin;work!=end;work++,newNbring++)
+ const mcIdType *conn=_nodal_connec->getConstPointer();
+ const mcIdType *connIndex=_nodal_connec_index->getConstPointer();
+ mcIdType newNbring=0;
+ for(const mcIdType *work=begin;work!=end;work++,newNbring++)
{
if(*work>=0 && *work<ncell)
connIndexRet[newNbring+1]=connIndexRet[newNbring]+connIndex[*work+1]-connIndex[*work];
throw INTERP_KERNEL::Exception(oss.str());
}
}
- int *connRet=(int *)malloc(connIndexRet[nbOfElemsRet]*sizeof(int));
- int *connRetWork=connRet;
+ mcIdType *connRet=(mcIdType *)malloc(connIndexRet[nbOfElemsRet]*sizeof(mcIdType));
+ mcIdType *connRetWork=connRet;
std::set<INTERP_KERNEL::NormalizedCellType> types;
- for(const int *work=begin;work!=end;work++)
+ for(const mcIdType *work=begin;work!=end;work++)
{
types.insert((INTERP_KERNEL::NormalizedCellType)conn[connIndex[*work]]);
connRetWork=std::copy(conn+connIndex[*work],conn+connIndex[*work+1],connRetWork);
}
- MCAuto<DataArrayInt> connRetArr=DataArrayInt::New();
+ MCAuto<DataArrayIdType> connRetArr=DataArrayIdType::New();
connRetArr->useArray(connRet,true,DeallocType::C_DEALLOC,connIndexRet[nbOfElemsRet],1);
- MCAuto<DataArrayInt> connIndexRetArr=DataArrayInt::New();
- connIndexRetArr->useArray(connIndexRet,true,DeallocType::C_DEALLOC,(int)nbOfElemsRet+1,1);
+ MCAuto<DataArrayIdType> connIndexRetArr=DataArrayIdType::New();
+ connIndexRetArr->useArray(connIndexRet,true,DeallocType::C_DEALLOC,nbOfElemsRet+1,1);
ret->setConnectivity(connRetArr,connIndexRetArr,false);
ret->_types=types;
ret->copyTinyInfoFrom(this);
* This is the low algorithm of MEDCouplingUMesh::buildPartOfMySelfSlice.
* CellIds are given using range specified by a start an end and step.
*/
-MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const
+MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
{
checkFullyDefined();
- int ncell=getNumberOfCells();
+ mcIdType ncell=getNumberOfCells();
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New();
ret->_mesh_dim=_mesh_dim;
ret->setCoords(_coords);
- int newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice : ");
- MCAuto<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(newNbOfCells+1,1);
- int *newConnIPtr=newConnI->getPointer(); *newConnIPtr=0;
- int work=start;
- const int *conn=_nodal_connec->getConstPointer();
- const int *connIndex=_nodal_connec_index->getConstPointer();
- for(int i=0;i<newNbOfCells;i++,newConnIPtr++,work+=step)
+ mcIdType newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice : ");
+ MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New(); newConnI->alloc(newNbOfCells+1,1);
+ mcIdType *newConnIPtr=newConnI->getPointer(); *newConnIPtr=0;
+ mcIdType work=start;
+ const mcIdType *conn=_nodal_connec->getConstPointer();
+ const mcIdType *connIndex=_nodal_connec_index->getConstPointer();
+ for(mcIdType i=0;i<newNbOfCells;i++,newConnIPtr++,work+=step)
{
if(work>=0 && work<ncell)
{
throw INTERP_KERNEL::Exception(oss.str());
}
}
- MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(newConnIPtr[0],1);
- int *newConnPtr=newConn->getPointer();
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(newConnIPtr[0],1);
+ mcIdType *newConnPtr=newConn->getPointer();
std::set<INTERP_KERNEL::NormalizedCellType> types;
work=start;
- for(int i=0;i<newNbOfCells;i++,newConnIPtr++,work+=step)
+ for(mcIdType i=0;i<newNbOfCells;i++,newConnIPtr++,work+=step)
{
types.insert((INTERP_KERNEL::NormalizedCellType)conn[connIndex[work]]);
newConnPtr=std::copy(conn+connIndex[work],conn+connIndex[work+1],newConnPtr);
}
-int MEDCouplingFastNbrer(int id, unsigned nb, const INTERP_KERNEL::CellModel& cm, bool compute, const int *conn1, const int *conn2)
+mcIdType MEDCouplingFastNbrer(mcIdType id, mcIdType nb, const INTERP_KERNEL::CellModel& cm, bool compute, const mcIdType *conn1, const mcIdType *conn2)
{
return id;
}
-int MEDCouplingOrientationSensitiveNbrer(int id, unsigned nb, const INTERP_KERNEL::CellModel& cm, bool compute, const int *conn1, const int *conn2)
+mcIdType MEDCouplingOrientationSensitiveNbrer(mcIdType id, mcIdType nb, const INTERP_KERNEL::CellModel& cm, bool compute, const mcIdType *conn1, const mcIdType *conn2)
{
if(!compute)
return id+1;
/*!
* Implements \a conversionType 0 for meshes with meshDim = 1, of MEDCouplingUMesh::convertLinearCellsToQuadratic method.
- * \return a newly created DataArrayInt instance that the caller should deal with containing cell ids of converted cells.
+ * \return a newly created DataArrayIdType instance that the caller should deal with containing cell ids of converted cells.
* \sa MEDCouplingUMesh::convertLinearCellsToQuadratic.
*/
-DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic1D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
+DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic1D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
{
MCAuto<DataArrayDouble> bary=computeCellCenterOfMass();
- MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(0,1);
- MCAuto<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
- int nbOfCells=getNumberOfCells();
- int nbOfNodes=getNumberOfNodes();
- const int *cPtr=_nodal_connec->begin();
- const int *icPtr=_nodal_connec_index->begin();
- int lastVal=0,offset=nbOfNodes;
- for(int i=0;i<nbOfCells;i++,icPtr++)
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(0,1);
+ MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(0,1);
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType nbOfNodes=getNumberOfNodes();
+ const mcIdType *cPtr=_nodal_connec->begin();
+ const mcIdType *icPtr=_nodal_connec_index->begin();
+ mcIdType lastVal=0,offset=nbOfNodes;
+ for(mcIdType i=0;i<nbOfCells;i++,icPtr++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
if(type==INTERP_KERNEL::NORM_SEG2)
{
types.insert(INTERP_KERNEL::NORM_SEG3);
- newConn->pushBackSilent((int)INTERP_KERNEL::NORM_SEG3);
+ newConn->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_SEG3));
newConn->pushBackValsSilent(cPtr+icPtr[0]+1,cPtr+icPtr[0]+3);
newConn->pushBackSilent(offset++);
lastVal+=4;
return ret.retn();
}
-DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayInt *desc, const DataArrayInt *descI, DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
+DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayIdType *desc, const DataArrayIdType *descI, DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
{
- MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(0,1);
- MCAuto<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(0,1);
+ MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(0,1);
//
- const int *descPtr(desc->begin()),*descIPtr(descI->begin());
- DataArrayInt *conn1D=0,*conn1DI=0;
+ const mcIdType *descPtr(desc->begin()),*descIPtr(descI->begin());
+ DataArrayIdType *conn1D=0,*conn1DI=0;
std::set<INTERP_KERNEL::NormalizedCellType> types1D;
DataArrayDouble *coordsTmp=0;
- MCAuto<DataArrayInt> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0;
+ MCAuto<DataArrayIdType> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0;
MCAuto<DataArrayDouble> coordsTmpSafe(coordsTmp);
- MCAuto<DataArrayInt> conn1DSafe(conn1D),conn1DISafe(conn1DI);
- const int *c1DPtr=conn1D->begin();
- const int *c1DIPtr=conn1DI->begin();
- int nbOfCells=getNumberOfCells();
- const int *cPtr=_nodal_connec->begin();
- const int *icPtr=_nodal_connec_index->begin();
- int lastVal=0;
- for(int i=0;i<nbOfCells;i++,icPtr++,descIPtr++)
+ MCAuto<DataArrayIdType> conn1DSafe(conn1D),conn1DISafe(conn1DI);
+ const mcIdType *c1DPtr=conn1D->begin();
+ const mcIdType *c1DIPtr=conn1DI->begin();
+ mcIdType nbOfCells=getNumberOfCells();
+ const mcIdType *cPtr=_nodal_connec->begin();
+ const mcIdType *icPtr=_nodal_connec_index->begin();
+ mcIdType lastVal=0;
+ for(mcIdType i=0;i<nbOfCells;i++,icPtr++,descIPtr++)
{
INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
INTERP_KERNEL::NormalizedCellType typ2=cm.getQuadraticType();
types.insert(typ2); newConn->pushBackSilent(typ2);
newConn->pushBackValsSilent(cPtr+icPtr[0]+1,cPtr+icPtr[1]);
- for(const int *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++)
+ for(const mcIdType *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++)
newConn->pushBackSilent(c1DPtr[c1DIPtr[*d]+3]);
lastVal+=(icPtr[1]-icPtr[0])+(descIPtr[1]-descIPtr[0]);
newConnI->pushBackSilent(lastVal);
/*!
* Implements \a conversionType 0 for meshes with meshDim = 2, of MEDCouplingUMesh::convertLinearCellsToQuadratic method.
- * \return a newly created DataArrayInt instance that the caller should deal with containing cell ids of converted cells.
+ * \return a newly created DataArrayIdType instance that the caller should deal with containing cell ids of converted cells.
* \sa MEDCouplingUMesh::convertLinearCellsToQuadratic.
*/
-DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
+DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
{
- MCAuto<DataArrayInt> desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New());
+ MCAuto<DataArrayIdType> desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0;
return convertLinearCellsToQuadratic2DAnd3D0(m1D,desc,descI,conn,connI,coords,types);
}
-DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
+DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
{
- MCAuto<DataArrayInt> desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New());
+ MCAuto<DataArrayIdType> desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0;
//
- MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(0,1);
- MCAuto<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(0,1);
+ MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(0,1);
//
MCAuto<DataArrayDouble> bary=computeCellCenterOfMass();
- const int *descPtr(desc->begin()),*descIPtr(descI->begin());
- DataArrayInt *conn1D=0,*conn1DI=0;
+ const mcIdType *descPtr(desc->begin()),*descIPtr(descI->begin());
+ DataArrayIdType *conn1D=0,*conn1DI=0;
std::set<INTERP_KERNEL::NormalizedCellType> types1D;
DataArrayDouble *coordsTmp=0;
- MCAuto<DataArrayInt> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0;
+ MCAuto<DataArrayIdType> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0;
MCAuto<DataArrayDouble> coordsTmpSafe(coordsTmp);
- MCAuto<DataArrayInt> conn1DSafe(conn1D),conn1DISafe(conn1DI);
- const int *c1DPtr=conn1D->begin();
- const int *c1DIPtr=conn1DI->begin();
- int nbOfCells=getNumberOfCells();
- const int *cPtr=_nodal_connec->begin();
- const int *icPtr=_nodal_connec_index->begin();
- int lastVal=0,offset=coordsTmpSafe->getNumberOfTuples();
- for(int i=0;i<nbOfCells;i++,icPtr++,descIPtr++)
+ MCAuto<DataArrayIdType> conn1DSafe(conn1D),conn1DISafe(conn1DI);
+ const mcIdType *c1DPtr=conn1D->begin();
+ const mcIdType *c1DIPtr=conn1DI->begin();
+ mcIdType nbOfCells=getNumberOfCells();
+ const mcIdType *cPtr=_nodal_connec->begin();
+ const mcIdType *icPtr=_nodal_connec_index->begin();
+ mcIdType lastVal=0;
+ mcIdType offset=coordsTmpSafe->getNumberOfTuples();
+ for(mcIdType i=0;i<nbOfCells;i++,icPtr++,descIPtr++)
{
INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
INTERP_KERNEL::NormalizedCellType typ2=cm.getQuadraticType2();
types.insert(typ2); newConn->pushBackSilent(typ2);
newConn->pushBackValsSilent(cPtr+icPtr[0]+1,cPtr+icPtr[1]);
- for(const int *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++)
+ for(const mcIdType *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++)
newConn->pushBackSilent(c1DPtr[c1DIPtr[*d]+3]);
newConn->pushBackSilent(offset+ret->getNumberOfTuples());
lastVal+=(icPtr[1]-icPtr[0])+(descIPtr[1]-descIPtr[0])+1;
/*!
* Implements \a conversionType 0 for meshes with meshDim = 3, of MEDCouplingUMesh::convertLinearCellsToQuadratic method.
- * \return a newly created DataArrayInt instance that the caller should deal with containing cell ids of converted cells.
+ * \return a newly created DataArrayIdType instance that the caller should deal with containing cell ids of converted cells.
* \sa MEDCouplingUMesh::convertLinearCellsToQuadratic.
*/
-DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
+DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic3D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
{
- MCAuto<DataArrayInt> desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New());
+ MCAuto<DataArrayIdType> desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> m1D=explode3DMeshTo1D(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0;
return convertLinearCellsToQuadratic2DAnd3D0(m1D,desc,descI,conn,connI,coords,types);
}
-DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
+DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
{
- MCAuto<DataArrayInt> desc2(DataArrayInt::New()),desc2I(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New());
+ MCAuto<DataArrayIdType> desc2(DataArrayIdType::New()),desc2I(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> m2D=buildDescendingConnectivityGen<MinusOneSonsGeneratorBiQuadratic>(desc2,desc2I,tmp2,tmp3,MEDCouplingFastNbrer); tmp2=0; tmp3=0;
- MCAuto<DataArrayInt> desc1(DataArrayInt::New()),desc1I(DataArrayInt::New()),tmp4(DataArrayInt::New()),tmp5(DataArrayInt::New());
+ MCAuto<DataArrayIdType> desc1(DataArrayIdType::New()),desc1I(DataArrayIdType::New()),tmp4(DataArrayIdType::New()),tmp5(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> m1D=explode3DMeshTo1D(desc1,desc1I,tmp4,tmp5); tmp4=0; tmp5=0;
//
- MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(0,1);
- MCAuto<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
- MCAuto<DataArrayInt> ret=DataArrayInt::New(),ret2=DataArrayInt::New(); ret->alloc(0,1); ret2->alloc(0,1);
+ MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(0,1);
+ MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(),ret2=DataArrayIdType::New(); ret->alloc(0,1); ret2->alloc(0,1);
//
MCAuto<DataArrayDouble> bary=computeCellCenterOfMass();
- const int *descPtr(desc1->begin()),*descIPtr(desc1I->begin()),*desc2Ptr(desc2->begin()),*desc2IPtr(desc2I->begin());
- DataArrayInt *conn1D=0,*conn1DI=0,*conn2D=0,*conn2DI=0;
+ const mcIdType *descPtr(desc1->begin()),*descIPtr(desc1I->begin()),*desc2Ptr(desc2->begin()),*desc2IPtr(desc2I->begin());
+ DataArrayIdType *conn1D=0,*conn1DI=0,*conn2D=0,*conn2DI=0;
std::set<INTERP_KERNEL::NormalizedCellType> types1D,types2D;
DataArrayDouble *coordsTmp=0,*coordsTmp2=0;
- MCAuto<DataArrayInt> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=DataArrayInt::New(); ret1D->alloc(0,1);
- MCAuto<DataArrayInt> conn1DSafe(conn1D),conn1DISafe(conn1DI);
+ MCAuto<DataArrayIdType> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=DataArrayIdType::New(); ret1D->alloc(0,1);
+ MCAuto<DataArrayIdType> conn1DSafe(conn1D),conn1DISafe(conn1DI);
MCAuto<DataArrayDouble> coordsTmpSafe(coordsTmp);
- MCAuto<DataArrayInt> ret2D=m2D->convertLinearCellsToQuadratic2D1(conn2D,conn2DI,coordsTmp2,types2D); ret2D=DataArrayInt::New(); ret2D->alloc(0,1);
+ MCAuto<DataArrayIdType> ret2D=m2D->convertLinearCellsToQuadratic2D1(conn2D,conn2DI,coordsTmp2,types2D); ret2D=DataArrayIdType::New(); ret2D->alloc(0,1);
MCAuto<DataArrayDouble> coordsTmp2Safe(coordsTmp2);
- MCAuto<DataArrayInt> conn2DSafe(conn2D),conn2DISafe(conn2DI);
- const int *c1DPtr=conn1D->begin(),*c1DIPtr=conn1DI->begin(),*c2DPtr=conn2D->begin(),*c2DIPtr=conn2DI->begin();
- int nbOfCells=getNumberOfCells();
- const int *cPtr=_nodal_connec->begin();
- const int *icPtr=_nodal_connec_index->begin();
- int lastVal=0,offset=coordsTmpSafe->getNumberOfTuples();
- for(int i=0;i<nbOfCells;i++,icPtr++,descIPtr++,desc2IPtr++)
+ MCAuto<DataArrayIdType> conn2DSafe(conn2D),conn2DISafe(conn2DI);
+ const mcIdType *c1DPtr=conn1D->begin(),*c1DIPtr=conn1DI->begin(),*c2DPtr=conn2D->begin(),*c2DIPtr=conn2DI->begin();
+ mcIdType nbOfCells=getNumberOfCells();
+ const mcIdType *cPtr=_nodal_connec->begin();
+ const mcIdType *icPtr=_nodal_connec_index->begin();
+ mcIdType lastVal=0;
+ mcIdType offset=coordsTmpSafe->getNumberOfTuples();
+ for(mcIdType i=0;i<nbOfCells;i++,icPtr++,descIPtr++,desc2IPtr++)
{
INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
}
types.insert(typ2); newConn->pushBackSilent(typ2);
newConn->pushBackValsSilent(cPtr+icPtr[0]+1,cPtr+icPtr[1]);
- for(const int *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++)
+ for(const mcIdType *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++)
newConn->pushBackSilent(c1DPtr[c1DIPtr[*d]+3]);
- for(const int *d=desc2Ptr+desc2IPtr[0];d!=desc2Ptr+desc2IPtr[1];d++)
+ for(const mcIdType *d=desc2Ptr+desc2IPtr[0];d!=desc2Ptr+desc2IPtr[1];d++)
{
- int nodeId2=c2DPtr[c2DIPtr[(*d)+1]-1];
- int tmpPos=newConn->getNumberOfTuples();
+ mcIdType nodeId2=c2DPtr[c2DIPtr[(*d)+1]-1];
+ mcIdType tmpPos=newConn->getNumberOfTuples();
newConn->pushBackSilent(nodeId2);
ret2D->pushBackSilent(nodeId2); ret1D->pushBackSilent(tmpPos);
}
newConn->pushBackValsSilent(cPtr+icPtr[0],cPtr+icPtr[1]);
}
}
- MCAuto<DataArrayInt> diffRet2D=ret2D->getDifferentValues();
- MCAuto<DataArrayInt> o2nRet2D=diffRet2D->invertArrayN2O2O2N(coordsTmp2Safe->getNumberOfTuples());
+ MCAuto<DataArrayIdType> diffRet2D=ret2D->getDifferentValues();
+ MCAuto<DataArrayIdType> o2nRet2D=diffRet2D->invertArrayN2O2O2N(coordsTmp2Safe->getNumberOfTuples());
coordsTmp2Safe=coordsTmp2Safe->selectByTupleId(diffRet2D->begin(),diffRet2D->end());
MCAuto<DataArrayDouble> tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end());
std::vector<const DataArrayDouble *> v(3); v[0]=coordsTmpSafe; v[1]=coordsTmp2Safe; v[2]=tmp;
- int *c=newConn->getPointer();
- const int *cI(newConnI->begin());
- for(const int *elt=ret1D->begin();elt!=ret1D->end();elt++)
+ mcIdType *c=newConn->getPointer();
+ const mcIdType *cI(newConnI->begin());
+ for(const mcIdType *elt=ret1D->begin();elt!=ret1D->end();elt++)
c[*elt]=o2nRet2D->getIJ(c[*elt],0)+offset;
offset=coordsTmp2Safe->getNumberOfTuples();
- for(const int *elt=ret->begin();elt!=ret->end();elt++)
+ for(const mcIdType *elt=ret->begin();elt!=ret->end();elt++)
c[cI[(*elt)+1]-1]+=offset;
coords=DataArrayDouble::Aggregate(v); conn=newConn.retn(); connI=newConnI.retn();
return ret.retn();
}
-DataArrayInt *MEDCouplingUMesh::buildUnionOf2DMeshLinear(const MEDCouplingUMesh *skin, const DataArrayInt *n2o) const
+DataArrayIdType *MEDCouplingUMesh::buildUnionOf2DMeshLinear(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const
{
- int nbOfNodesExpected(skin->getNumberOfNodes());
- const int *n2oPtr(n2o->begin());
- MCAuto<DataArrayInt> revNodal(DataArrayInt::New()),revNodalI(DataArrayInt::New());
+ mcIdType nbOfNodesExpected(skin->getNumberOfNodes());
+ const mcIdType *n2oPtr(n2o->begin());
+ MCAuto<DataArrayIdType> revNodal(DataArrayIdType::New()),revNodalI(DataArrayIdType::New());
skin->getReverseNodalConnectivity(revNodal,revNodalI);
- const int *revNodalPtr(revNodal->begin()),*revNodalIPtr(revNodalI->begin());
- const int *nodalPtr(skin->getNodalConnectivity()->begin());
- const int *nodalIPtr(skin->getNodalConnectivityIndex()->begin());
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfNodesExpected+1,1);
- int *work(ret->getPointer()); *work++=INTERP_KERNEL::NORM_POLYGON;
+ const mcIdType *revNodalPtr(revNodal->begin()),*revNodalIPtr(revNodalI->begin());
+ const mcIdType *nodalPtr(skin->getNodalConnectivity()->begin());
+ const mcIdType *nodalIPtr(skin->getNodalConnectivityIndex()->begin());
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(nbOfNodesExpected+1,1);
+ mcIdType *work(ret->getPointer()); *work++=INTERP_KERNEL::NORM_POLYGON;
if(nbOfNodesExpected<1)
return ret.retn();
- int prevCell(0),prevNode(nodalPtr[nodalIPtr[0]+1]);
+ mcIdType prevCell(0),prevNode(nodalPtr[nodalIPtr[0]+1]);
*work++=n2oPtr[prevNode];
- for(int i=1;i<nbOfNodesExpected;i++)
+ for(mcIdType i=1;i<nbOfNodesExpected;i++)
{
if(nodalIPtr[prevCell+1]-nodalIPtr[prevCell]==3)
{
- std::set<int> conn(nodalPtr+nodalIPtr[prevCell]+1,nodalPtr+nodalIPtr[prevCell]+3);
+ std::set<mcIdType> conn(nodalPtr+nodalIPtr[prevCell]+1,nodalPtr+nodalIPtr[prevCell]+3);
conn.erase(prevNode);
if(conn.size()==1)
{
- int curNode(*(conn.begin()));
+ mcIdType curNode(*(conn.begin()));
*work++=n2oPtr[curNode];
- std::set<int> shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]);
+ std::set<mcIdType> shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]);
shar.erase(prevCell);
if(shar.size()==1)
{
return ret.retn();
}
-DataArrayInt *MEDCouplingUMesh::buildUnionOf2DMeshQuadratic(const MEDCouplingUMesh *skin, const DataArrayInt *n2o) const
+DataArrayIdType *MEDCouplingUMesh::buildUnionOf2DMeshQuadratic(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const
{
- int nbOfNodesExpected(skin->getNumberOfNodes());
- int nbOfTurn(nbOfNodesExpected/2);
- const int *n2oPtr(n2o->begin());
- MCAuto<DataArrayInt> revNodal(DataArrayInt::New()),revNodalI(DataArrayInt::New());
+ mcIdType nbOfNodesExpected(skin->getNumberOfNodes());
+ mcIdType nbOfTurn(nbOfNodesExpected/2);
+ const mcIdType *n2oPtr(n2o->begin());
+ MCAuto<DataArrayIdType> revNodal(DataArrayIdType::New()),revNodalI(DataArrayIdType::New());
skin->getReverseNodalConnectivity(revNodal,revNodalI);
- const int *revNodalPtr(revNodal->begin()),*revNodalIPtr(revNodalI->begin());
- const int *nodalPtr(skin->getNodalConnectivity()->begin());
- const int *nodalIPtr(skin->getNodalConnectivityIndex()->begin());
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfNodesExpected+1,1);
- int *work(ret->getPointer()); *work++=INTERP_KERNEL::NORM_QPOLYG;
+ const mcIdType *revNodalPtr(revNodal->begin()),*revNodalIPtr(revNodalI->begin());
+ const mcIdType *nodalPtr(skin->getNodalConnectivity()->begin());
+ const mcIdType *nodalIPtr(skin->getNodalConnectivityIndex()->begin());
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(nbOfNodesExpected+1,1);
+ mcIdType *work(ret->getPointer()); *work++=INTERP_KERNEL::NORM_QPOLYG;
if(nbOfNodesExpected<1)
return ret.retn();
- int prevCell(0),prevNode(nodalPtr[nodalIPtr[0]+1]);
+ mcIdType prevCell(0),prevNode(nodalPtr[nodalIPtr[0]+1]);
*work=n2oPtr[prevNode]; work[nbOfTurn]=n2oPtr[nodalPtr[nodalIPtr[0]+3]]; work++;
- for(int i=1;i<nbOfTurn;i++)
+ for(mcIdType i=1;i<nbOfTurn;i++)
{
if(nodalIPtr[prevCell+1]-nodalIPtr[prevCell]==4)
{
- std::set<int> conn(nodalPtr+nodalIPtr[prevCell]+1,nodalPtr+nodalIPtr[prevCell]+3);
+ std::set<mcIdType> conn(nodalPtr+nodalIPtr[prevCell]+1,nodalPtr+nodalIPtr[prevCell]+3);
conn.erase(prevNode);
if(conn.size()==1)
{
- int curNode(*(conn.begin()));
+ mcIdType curNode(*(conn.begin()));
*work=n2oPtr[curNode];
- std::set<int> shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]);
+ std::set<mcIdType> shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]);
shar.erase(prevCell);
if(shar.size()==1)
{
- int curCell(*(shar.begin()));
+ mcIdType curCell(*(shar.begin()));
work[nbOfTurn]=n2oPtr[nodalPtr[nodalIPtr[curCell]+3]];
prevCell=curCell;
prevNode=curNode;
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::MergeUMeshes : input array must be NON EMPTY !");
std::vector<const MEDCouplingUMesh *>::const_iterator it=a.begin();
int meshDim=(*it)->getMeshDimension();
- int nbOfCells=(*it)->getNumberOfCells();
- int meshLgth=(*it++)->getNodalConnectivityArrayLen();
+ mcIdType nbOfCells=ToIdType((*it)->getNumberOfCells());
+ mcIdType meshLgth=(*it++)->getNodalConnectivityArrayLen();
for(;it!=a.end();it++)
{
if(meshDim!=(*it)->getMeshDimension())
throw INTERP_KERNEL::Exception("Mesh dimensions mismatches, MergeUMeshes impossible !");
- nbOfCells+=(*it)->getNumberOfCells();
+ nbOfCells+=ToIdType((*it)->getNumberOfCells());
meshLgth+=(*it)->getNodalConnectivityArrayLen();
}
std::vector<const MEDCouplingPointSet *> aps(a.size());
MCAuto<DataArrayDouble> pts=MergeNodesArray(aps);
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New("merge",meshDim);
ret->setCoords(pts);
- MCAuto<DataArrayInt> c=DataArrayInt::New();
+ MCAuto<DataArrayIdType> c=DataArrayIdType::New();
c->alloc(meshLgth,1);
- int *cPtr=c->getPointer();
- MCAuto<DataArrayInt> cI=DataArrayInt::New();
+ mcIdType *cPtr=c->getPointer();
+ MCAuto<DataArrayIdType> cI=DataArrayIdType::New();
cI->alloc(nbOfCells+1,1);
- int *cIPtr=cI->getPointer();
+ mcIdType *cIPtr=cI->getPointer();
*cIPtr++=0;
- int offset=0;
- int offset2=0;
+ mcIdType offset=0;
+ mcIdType offset2=0;
for(it=a.begin();it!=a.end();it++)
{
- int curNbOfCell=(*it)->getNumberOfCells();
- const int *curCI=(*it)->_nodal_connec_index->begin();
- const int *curC=(*it)->_nodal_connec->begin();
- cIPtr=std::transform(curCI+1,curCI+curNbOfCell+1,cIPtr,std::bind2nd(std::plus<int>(),offset));
- for(int j=0;j<curNbOfCell;j++)
+ mcIdType curNbOfCell=ToIdType((*it)->getNumberOfCells());
+ const mcIdType *curCI=(*it)->_nodal_connec_index->begin();
+ const mcIdType *curC=(*it)->_nodal_connec->begin();
+ cIPtr=std::transform(curCI+1,curCI+curNbOfCell+1,cIPtr,std::bind2nd(std::plus<mcIdType>(),offset));
+ for(mcIdType j=0;j<curNbOfCell;j++)
{
- const int *src=curC+curCI[j];
+ const mcIdType *src=curC+curCI[j];
*cPtr++=*src++;
for(;src!=curC+curCI[j+1];src++,cPtr++)
{
* \param [out] cellId that corresponds to minimal distance. If the closer node is not linked to any cell in \a this -1 is returned.
* \sa MEDCouplingUMesh::distanceToPoint, MEDCouplingUMesh::distanceToPoints
*/
-void MEDCouplingUMesh::DistanceToPoint3DSurfAlg(const double *pt, const int *cellIdsBg, const int *cellIdsEnd, const double *coords, const int *nc, const int *ncI, double& ret0, int& cellId)
+void MEDCouplingUMesh::DistanceToPoint3DSurfAlg(const double *pt, const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const double *coords, const mcIdType *nc, const mcIdType *ncI, double& ret0, mcIdType& cellId)
{
cellId=-1;
ret0=std::numeric_limits<double>::max();
- for(const int *zeCell=cellIdsBg;zeCell!=cellIdsEnd;zeCell++)
+ for(const mcIdType *zeCell=cellIdsBg;zeCell!=cellIdsEnd;zeCell++)
{
switch((INTERP_KERNEL::NormalizedCellType)nc[ncI[*zeCell]])
{
* \param [out] cellId that corresponds to minimal distance. If the closer node is not linked to any cell in \a this -1 is returned.
* \sa MEDCouplingUMesh::distanceToPoint, MEDCouplingUMesh::distanceToPoints
*/
-void MEDCouplingUMesh::DistanceToPoint2DCurveAlg(const double *pt, const int *cellIdsBg, const int *cellIdsEnd, const double *coords, const int *nc, const int *ncI, double& ret0, int& cellId)
+void MEDCouplingUMesh::DistanceToPoint2DCurveAlg(const double *pt, const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const double *coords, const mcIdType *nc, const mcIdType *ncI, double& ret0, mcIdType& cellId)
{
cellId=-1;
ret0=std::numeric_limits<double>::max();
- for(const int *zeCell=cellIdsBg;zeCell!=cellIdsEnd;zeCell++)
+ for(const mcIdType *zeCell=cellIdsBg;zeCell!=cellIdsEnd;zeCell++)
{
switch((INTERP_KERNEL::NormalizedCellType)nc[ncI[*zeCell]])
{
}
}
}
-DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg(std::vector<bool>& fetched, const int *seedBg, const int *seedEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling, int& nbOfDepthPeelingPerformed)
+DataArrayIdType *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg(std::vector<bool>& fetched, const mcIdType *seedBg, const mcIdType *seedEnd, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling, mcIdType& nbOfDepthPeelingPerformed)
{
nbOfDepthPeelingPerformed=0;
if(!seedBg || !seedEnd || !arrIn || !arrIndxIn)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg : some input pointer is NULL !");
- int nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
std::vector<bool> fetched2(nbOfTuples,false);
int i=0;
- for(const int *seedElt=seedBg;seedElt!=seedEnd;seedElt++,i++)
+ for(const mcIdType *seedElt=seedBg;seedElt!=seedEnd;seedElt++,i++)
{
if(*seedElt>=0 && *seedElt<nbOfTuples)
{ fetched[*seedElt]=true; fetched2[*seedElt]=true; }
else
{ std::ostringstream oss; oss << "MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg : At pos #" << i << " of seeds value is " << *seedElt << "! Should be in [0," << nbOfTuples << ") !"; throw INTERP_KERNEL::Exception(oss.str()); }
}
- const int *arrInPtr=arrIn->begin();
- const int *arrIndxPtr=arrIndxIn->begin();
- int targetNbOfDepthPeeling=nbOfDepthPeeling!=-1?nbOfDepthPeeling:std::numeric_limits<int>::max();
- std::vector<int> idsToFetch1(seedBg,seedEnd);
- std::vector<int> idsToFetch2;
- std::vector<int> *idsToFetch=&idsToFetch1;
- std::vector<int> *idsToFetchOther=&idsToFetch2;
+ const mcIdType *arrInPtr=arrIn->begin();
+ const mcIdType *arrIndxPtr=arrIndxIn->begin();
+ mcIdType targetNbOfDepthPeeling=nbOfDepthPeeling!=-1?nbOfDepthPeeling:std::numeric_limits<mcIdType>::max();
+ std::vector<mcIdType> idsToFetch1(seedBg,seedEnd);
+ std::vector<mcIdType> idsToFetch2;
+ std::vector<mcIdType> *idsToFetch=&idsToFetch1;
+ std::vector<mcIdType> *idsToFetchOther=&idsToFetch2;
while(!idsToFetch->empty() && nbOfDepthPeelingPerformed<targetNbOfDepthPeeling)
{
- for(std::vector<int>::const_iterator it=idsToFetch->begin();it!=idsToFetch->end();it++)
- for(const int *it2=arrInPtr+arrIndxPtr[*it];it2!=arrInPtr+arrIndxPtr[*it+1];it2++)
+ for(std::vector<mcIdType>::const_iterator it=idsToFetch->begin();it!=idsToFetch->end();it++)
+ for(const mcIdType *it2=arrInPtr+arrIndxPtr[*it];it2!=arrInPtr+arrIndxPtr[*it+1];it2++)
if(!fetched[*it2])
{ fetched[*it2]=true; fetched2[*it2]=true; idsToFetchOther->push_back(*it2); }
std::swap(idsToFetch,idsToFetchOther);
idsToFetchOther->clear();
nbOfDepthPeelingPerformed++;
}
- int lgth=(int)std::count(fetched2.begin(),fetched2.end(),true);
+ mcIdType lgth=ToIdType(std::count(fetched2.begin(),fetched2.end(),true));
i=0;
- MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(lgth,1);
- int *retPtr=ret->getPointer();
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(lgth,1);
+ mcIdType *retPtr=ret->getPointer();
for(std::vector<bool>::const_iterator it=fetched2.begin();it!=fetched2.end();it++,i++)
if(*it)
*retPtr++=i;
* This method put in zip format into parameter 'zipFrmt' in full interlace mode.
* This format is often asked by INTERP_KERNEL algorithms to avoid many indirections into coordinates array.
*/
-void MEDCouplingUMesh::FillInCompact3DMode(int spaceDim, int nbOfNodesInCell, const int *conn, const double *coo, double *zipFrmt)
+void MEDCouplingUMesh::FillInCompact3DMode(int spaceDim, mcIdType nbOfNodesInCell, const mcIdType *conn, const double *coo, double *zipFrmt)
{
double *w=zipFrmt;
if(spaceDim==3)
* \param isQuad specifies the policy of connectivity.
* @ret in/out parameter in which the result will be append
*/
-void MEDCouplingUMesh::AppendExtrudedCell(const int *connBg, const int *connEnd, int nbOfNodesPerLev, bool isQuad, std::vector<int>& ret)
+void MEDCouplingUMesh::AppendExtrudedCell(const mcIdType *connBg, const mcIdType *connEnd, mcIdType nbOfNodesPerLev, bool isQuad, std::vector<mcIdType>& ret)
{
INTERP_KERNEL::NormalizedCellType flatType=(INTERP_KERNEL::NormalizedCellType)connBg[0];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(flatType);
ret.push_back(cm.getExtrudedType());
- int deltaz=isQuad?2*nbOfNodesPerLev:nbOfNodesPerLev;
+ mcIdType deltaz=isQuad?2*nbOfNodesPerLev:nbOfNodesPerLev;
switch(flatType)
{
case INTERP_KERNEL::NORM_POINT1:
}
case INTERP_KERNEL::NORM_SEG2:
{
- int conn[4]={connBg[1],connBg[2],connBg[2]+deltaz,connBg[1]+deltaz};
+ mcIdType conn[4]={connBg[1],connBg[2],connBg[2]+deltaz,connBg[1]+deltaz};
ret.insert(ret.end(),conn,conn+4);
break;
}
case INTERP_KERNEL::NORM_SEG3:
{
- int conn[8]={connBg[1],connBg[3],connBg[3]+deltaz,connBg[1]+deltaz,connBg[2],connBg[3]+nbOfNodesPerLev,connBg[2]+deltaz,connBg[1]+nbOfNodesPerLev};
+ mcIdType conn[8]={connBg[1],connBg[3],connBg[3]+deltaz,connBg[1]+deltaz,connBg[2],connBg[3]+nbOfNodesPerLev,connBg[2]+deltaz,connBg[1]+nbOfNodesPerLev};
ret.insert(ret.end(),conn,conn+8);
break;
}
case INTERP_KERNEL::NORM_QUAD4:
{
- int conn[8]={connBg[1],connBg[2],connBg[3],connBg[4],connBg[1]+deltaz,connBg[2]+deltaz,connBg[3]+deltaz,connBg[4]+deltaz};
+ mcIdType conn[8]={connBg[1],connBg[2],connBg[3],connBg[4],connBg[1]+deltaz,connBg[2]+deltaz,connBg[3]+deltaz,connBg[4]+deltaz};
ret.insert(ret.end(),conn,conn+8);
break;
}
case INTERP_KERNEL::NORM_TRI3:
{
- int conn[6]={connBg[1],connBg[2],connBg[3],connBg[1]+deltaz,connBg[2]+deltaz,connBg[3]+deltaz};
+ mcIdType conn[6]={connBg[1],connBg[2],connBg[3],connBg[1]+deltaz,connBg[2]+deltaz,connBg[3]+deltaz};
ret.insert(ret.end(),conn,conn+6);
break;
}
case INTERP_KERNEL::NORM_TRI6:
{
- int conn[15]={connBg[1],connBg[2],connBg[3],connBg[1]+deltaz,connBg[2]+deltaz,connBg[3]+deltaz,connBg[4],connBg[5],connBg[6],connBg[4]+deltaz,connBg[5]+deltaz,connBg[6]+deltaz,
+ mcIdType conn[15]={connBg[1],connBg[2],connBg[3],connBg[1]+deltaz,connBg[2]+deltaz,connBg[3]+deltaz,connBg[4],connBg[5],connBg[6],connBg[4]+deltaz,connBg[5]+deltaz,connBg[6]+deltaz,
connBg[1]+nbOfNodesPerLev,connBg[2]+nbOfNodesPerLev,connBg[3]+nbOfNodesPerLev};
ret.insert(ret.end(),conn,conn+15);
break;
}
case INTERP_KERNEL::NORM_QUAD8:
{
- int conn[20]={
+ mcIdType conn[20]={
connBg[1],connBg[2],connBg[3],connBg[4],connBg[1]+deltaz,connBg[2]+deltaz,connBg[3]+deltaz,connBg[4]+deltaz,
connBg[5],connBg[6],connBg[7],connBg[8],connBg[5]+deltaz,connBg[6]+deltaz,connBg[7]+deltaz,connBg[8]+deltaz,
connBg[1]+nbOfNodesPerLev,connBg[2]+nbOfNodesPerLev,connBg[3]+nbOfNodesPerLev,connBg[4]+nbOfNodesPerLev
}
case INTERP_KERNEL::NORM_POLYGON:
{
- std::back_insert_iterator< std::vector<int> > ii(ret);
+ std::back_insert_iterator< std::vector<mcIdType> > ii(ret);
std::copy(connBg+1,connEnd,ii);
*ii++=-1;
- std::reverse_iterator<const int *> rConnBg(connEnd);
- std::reverse_iterator<const int *> rConnEnd(connBg+1);
- std::transform(rConnBg,rConnEnd,ii,std::bind2nd(std::plus<int>(),deltaz));
+ std::reverse_iterator<const mcIdType *> rConnBg(connEnd);
+ std::reverse_iterator<const mcIdType *> rConnEnd(connBg+1);
+ std::transform(rConnBg,rConnEnd,ii,std::bind2nd(std::plus<mcIdType>(),deltaz));
std::size_t nbOfRadFaces=std::distance(connBg+1,connEnd);
for(std::size_t i=0;i<nbOfRadFaces;i++)
{
*ii++=-1;
- int conn[4]={connBg[(i+1)%nbOfRadFaces+1],connBg[i+1],connBg[i+1]+deltaz,connBg[(i+1)%nbOfRadFaces+1]+deltaz};
+ mcIdType conn[4]={connBg[(i+1)%nbOfRadFaces+1],connBg[i+1],connBg[i+1]+deltaz,connBg[(i+1)%nbOfRadFaces+1]+deltaz};
std::copy(conn,conn+4,ii);
}
break;
* \param [in] descIndx is the descending connectivity index 3DSurf->3DCurve
* \param [out] cut3DSuf input/output param.
*/
-void MEDCouplingUMesh::AssemblyForSplitFrom3DCurve(const std::vector<int>& cut3DCurve, std::vector<int>& nodesOnPlane, const int *nodal3DSurf, const int *nodalIndx3DSurf,
- const int *nodal3DCurve, const int *nodalIndx3DCurve,
- const int *desc, const int *descIndx,
- std::vector< std::pair<int,int> >& cut3DSurf)
+void MEDCouplingUMesh::AssemblyForSplitFrom3DCurve(const std::vector<mcIdType>& cut3DCurve, std::vector<mcIdType>& nodesOnPlane, const mcIdType *nodal3DSurf, const mcIdType *nodalIndx3DSurf,
+ const mcIdType *nodal3DCurve, const mcIdType *nodalIndx3DCurve,
+ const mcIdType *desc, const mcIdType *descIndx,
+ std::vector< std::pair<mcIdType,mcIdType> >& cut3DSurf)
{
- std::set<int> nodesOnP(nodesOnPlane.begin(),nodesOnPlane.end());
- int nbOf3DSurfCell=(int)cut3DSurf.size();
- for(int i=0;i<nbOf3DSurfCell;i++)
+ std::set<mcIdType> nodesOnP(nodesOnPlane.begin(),nodesOnPlane.end());
+ mcIdType nbOf3DSurfCell=ToIdType(cut3DSurf.size());
+ for(mcIdType i=0;i<nbOf3DSurfCell;i++)
{
- std::vector<int> res;
- int offset=descIndx[i];
- int nbOfSeg=descIndx[i+1]-offset;
- for(int j=0;j<nbOfSeg;j++)
+ std::vector<mcIdType> res;
+ mcIdType offset=descIndx[i];
+ mcIdType nbOfSeg=descIndx[i+1]-offset;
+ for(mcIdType j=0;j<nbOfSeg;j++)
{
- int edgeId=desc[offset+j];
- int status=cut3DCurve[edgeId];
+ mcIdType edgeId=desc[offset+j];
+ mcIdType status=cut3DCurve[edgeId];
if(status!=-2)
{
if(status>-1)
case 1:
case 0:
{
- std::set<int> s1(nodal3DSurf+nodalIndx3DSurf[i]+1,nodal3DSurf+nodalIndx3DSurf[i+1]);
- std::set_intersection(nodesOnP.begin(),nodesOnP.end(),s1.begin(),s1.end(),std::back_insert_iterator< std::vector<int> >(res));
+ std::set<mcIdType> s1(nodal3DSurf+nodalIndx3DSurf[i]+1,nodal3DSurf+nodalIndx3DSurf[i+1]);
+ std::set_intersection(nodesOnP.begin(),nodesOnP.end(),s1.begin(),s1.end(),std::back_insert_iterator< std::vector<mcIdType> >(res));
if(res.size()==2)
{
cut3DSurf[i].first=res[0]; cut3DSurf[i].second=res[1];
}
default:
{// case when plane is on a multi colinear edge of a polyhedron
- if((int)res.size()==2*nbOfSeg)
+ if(ToIdType(res.size())==2*nbOfSeg)
{
cut3DSurf[i].first=-2; cut3DSurf[i].second=i;
}
* \param desc is the descending connectivity 3D->3DSurf
* \param descIndx is the descending connectivity index 3D->3DSurf
*/
-void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pair<int,int> >& cut3DSurf,
- const int *desc, const int *descIndx,
- DataArrayInt *nodalRes, DataArrayInt *nodalResIndx, DataArrayInt *cellIds) const
+void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pair<mcIdType,mcIdType> >& cut3DSurf,
+ const mcIdType *desc, const mcIdType *descIndx,
+ DataArrayIdType *nodalRes, DataArrayIdType *nodalResIndx, DataArrayIdType *cellIds) const
{
checkFullyDefined();
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::assemblyForSplitFrom3DSurf works on umeshes with meshdim equal to 3 and spaceDim equal to 3 too!");
- const int *nodal3D(_nodal_connec->begin()),*nodalIndx3D(_nodal_connec_index->begin());
- int nbOfCells(getNumberOfCells());
- for(int i=0;i<nbOfCells;i++)
+ const mcIdType *nodal3D(_nodal_connec->begin()),*nodalIndx3D(_nodal_connec_index->begin());
+ mcIdType nbOfCells=getNumberOfCells();
+ for(mcIdType i=0;i<nbOfCells;i++)
{
- std::map<int, std::set<int> > m;
- int offset=descIndx[i];
- int nbOfFaces=descIndx[i+1]-offset;
- int start=-1;
- int end=-1;
+ std::map<mcIdType, std::set<mcIdType> > m;
+ mcIdType offset=descIndx[i];
+ mcIdType nbOfFaces=descIndx[i+1]-offset;
+ mcIdType start=-1;
+ mcIdType end=-1;
for(int j=0;j<nbOfFaces;j++)
{
- const std::pair<int,int>& p=cut3DSurf[desc[offset+j]];
+ const std::pair<mcIdType,mcIdType>& p=cut3DSurf[desc[offset+j]];
if(p.first!=-1 && p.second!=-1)
{
if(p.first!=-2)
else
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)nodal3D[nodalIndx3D[i]]);
- int sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1;
- INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
+ mcIdType sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=new mcIdType[sz];
INTERP_KERNEL::NormalizedCellType cmsId;
unsigned nbOfNodesSon=cm.fillSonCellNodalConnectivity2(j,nodal3D+nodalIndx3D[i]+1,sz,tmp,cmsId);
start=tmp[0]; end=tmp[nbOfNodesSon-1];
}
if(m.empty())
continue;
- std::vector<int> conn(1,(int)INTERP_KERNEL::NORM_POLYGON);
- int prev=end;
+ std::vector<mcIdType> conn(1,ToIdType(INTERP_KERNEL::NORM_POLYGON));
+ mcIdType prev=end;
while(end!=start)
{
- std::map<int, std::set<int> >::const_iterator it=m.find(start);
- const std::set<int>& s=(*it).second;
- std::set<int> s2; s2.insert(prev);
- std::set<int> s3;
+ std::map<mcIdType, std::set<mcIdType> >::const_iterator it=m.find(start);
+ const std::set<mcIdType>& s=(*it).second;
+ std::set<mcIdType> s2; s2.insert(prev);
+ std::set<mcIdType> s3;
std::set_difference(s.begin(),s.end(),s2.begin(),s2.end(),inserter(s3,s3.begin()));
if(s3.size()==1)
{
- int val=*s3.begin();
+ mcIdType val=*s3.begin();
conn.push_back(start);
prev=start;
start=val;
}
-void MEDCouplingUMesh::ComputeAllTypesInternal(std::set<INTERP_KERNEL::NormalizedCellType>& types, const DataArrayInt *nodalConnec, const DataArrayInt *nodalConnecIndex)
+void MEDCouplingUMesh::ComputeAllTypesInternal(std::set<INTERP_KERNEL::NormalizedCellType>& types, const DataArrayIdType *nodalConnec, const DataArrayIdType *nodalConnecIndex)
{
if(nodalConnec && nodalConnecIndex)
{
types.clear();
- const int *conn(nodalConnec->begin()),*connIndex(nodalConnecIndex->begin());
- int nbOfElem(nodalConnecIndex->getNbOfElems()-1);
+ const mcIdType *conn(nodalConnec->begin()),*connIndex(nodalConnecIndex->begin());
+ mcIdType nbOfElem=ToIdType(nodalConnecIndex->getNbOfElems())-1;
if(nbOfElem>0)
- for(const int *pt=connIndex;pt!=connIndex+nbOfElem;pt++)
+ for(const mcIdType *pt=connIndex;pt!=connIndex+nbOfElem;pt++)
types.insert((INTERP_KERNEL::NormalizedCellType)conn[*pt]);
}
}
* \throw if there is a point in [\a nodeIdsBg, \a nodeIdsEnd ) that is a mid point of a seg3
* \warning in case of throw the coordinates may be partially modified before the exception arises
*/
-void MEDCouplingUMesh::attractSeg3MidPtsAroundNodes(double ratio, const int *nodeIdsBg, const int *nodeIdsEnd)
+void MEDCouplingUMesh::attractSeg3MidPtsAroundNodes(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd)
{
checkFullyDefined();
int mdim(getMeshDimension());
{
MCAuto<MEDCouplingUMesh> edges;
{
- MCAuto<DataArrayInt> a,b,c,d;
+ MCAuto<DataArrayIdType> a,b,c,d;
edges=this->explodeIntoEdges(a,b,c,d);
}
return edges->attractSeg3MidPtsAroundNodesUnderground(ratio,nodeIdsBg,nodeIdsEnd);
/*!
* \a this is expected to have meshdim==1.
*/
-void MEDCouplingUMesh::attractSeg3MidPtsAroundNodesUnderground(double ratio, const int *nodeIdsBg, const int *nodeIdsEnd)
+void MEDCouplingUMesh::attractSeg3MidPtsAroundNodesUnderground(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd)
{
int spaceDim(getSpaceDimension());
double *coords(getCoords()->getPointer());
auto nbNodes(getNumberOfNodes());
- auto nbCells(getNumberOfCells());
+ std::size_t nbCells(getNumberOfCells());
std::vector<bool> fastFinder(nbNodes,false);
for(auto work=nodeIdsBg;work!=nodeIdsEnd;work++)
if(*work>=0 && *work<nbNodes)
fastFinder[*work]=true;
- MCAuto<DataArrayInt> cellsIds(getCellIdsLyingOnNodes(nodeIdsBg,nodeIdsEnd,false));
- const int *nc(_nodal_connec->begin()),*nci(_nodal_connec_index->begin());
- for(auto cellId=0;cellId<nbCells;cellId++,nci++)
+ MCAuto<DataArrayIdType> cellsIds(getCellIdsLyingOnNodes(nodeIdsBg,nodeIdsEnd,false));
+ const mcIdType *nc(_nodal_connec->begin()),*nci(_nodal_connec_index->begin());
+ for(std::size_t cellId=0;cellId<nbCells;cellId++,nci++)
{
- const int *isSelected(std::find_if(nc+nci[0]+1,nc+nci[1],[&fastFinder](int v) { return fastFinder[v]; }));
+ const mcIdType *isSelected(std::find_if(nc+nci[0]+1,nc+nci[1],[&fastFinder](mcIdType v) { return fastFinder[v]; }));
if(isSelected!=nc+nci[1])
{
if((INTERP_KERNEL::NormalizedCellType)nc[nci[0]]==INTERP_KERNEL::NORM_SEG3 && nci[1]-nci[0]==4)
{
public:
MinusOneSonsGenerator(const INTERP_KERNEL::CellModel& cm):_cm(cm) { }
- unsigned getNumberOfSons2(const int *conn, int lgth) const { return _cm.getNumberOfSons2(conn,lgth); }
- unsigned fillSonCellNodalConnectivity2(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, INTERP_KERNEL::NormalizedCellType& typeOfSon) const { return _cm.fillSonCellNodalConnectivity2(sonId,nodalConn,lgth,sonNodalConn,typeOfSon); }
+ unsigned getNumberOfSons2(const mcIdType *conn, mcIdType lgth) const { return _cm.getNumberOfSons2(conn,lgth); }
+ unsigned fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, INTERP_KERNEL::NormalizedCellType& typeOfSon) const { return _cm.fillSonCellNodalConnectivity2(sonId,nodalConn,lgth,sonNodalConn,typeOfSon); }
static const int DELTA=1;
private:
const INTERP_KERNEL::CellModel& _cm;
{
public:
MinusOneSonsGeneratorBiQuadratic(const INTERP_KERNEL::CellModel& cm):_cm(cm) { }
- unsigned getNumberOfSons2(const int *conn, int lgth) const { return _cm.getNumberOfSons2(conn,lgth); }
- unsigned fillSonCellNodalConnectivity2(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, INTERP_KERNEL::NormalizedCellType& typeOfSon) const { return _cm.fillSonCellNodalConnectivity4(sonId,nodalConn,lgth,sonNodalConn,typeOfSon); }
+ unsigned getNumberOfSons2(const mcIdType *conn, mcIdType lgth) const { return _cm.getNumberOfSons2(conn,lgth); }
+ unsigned fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, INTERP_KERNEL::NormalizedCellType& typeOfSon) const { return _cm.fillSonCellNodalConnectivity4(sonId,nodalConn,lgth,sonNodalConn,typeOfSon); }
static const int DELTA=1;
private:
const INTERP_KERNEL::CellModel& _cm;
{
public:
MinusTwoSonsGenerator(const INTERP_KERNEL::CellModel& cm):_cm(cm) { }
- unsigned getNumberOfSons2(const int *conn, int lgth) const { return _cm.getNumberOfEdgesIn3D(conn,lgth); }
- unsigned fillSonCellNodalConnectivity2(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, INTERP_KERNEL::NormalizedCellType& typeOfSon) const { return _cm.fillSonEdgesNodalConnectivity3D(sonId,nodalConn,lgth,sonNodalConn,typeOfSon); }
+ unsigned getNumberOfSons2(const mcIdType *conn, mcIdType lgth) const { return _cm.getNumberOfEdgesIn3D(conn,lgth); }
+ unsigned fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, INTERP_KERNEL::NormalizedCellType& typeOfSon) const { return _cm.fillSonEdgesNodalConnectivity3D(sonId,nodalConn,lgth,sonNodalConn,typeOfSon); }
static const int DELTA=2;
private:
const INTERP_KERNEL::CellModel& _cm;
{
public:
MicroEdgesGenerator2D(const INTERP_KERNEL::CellModel& cm):_cm(cm) { }
- unsigned getNumberOfSons2(const int *conn, int lgth) const { return _cm.getNumberOfMicroEdges(); }
- unsigned fillSonCellNodalConnectivity2(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, INTERP_KERNEL::NormalizedCellType& typeOfSon) const { return _cm.fillMicroEdgeNodalConnectivity(sonId,nodalConn,sonNodalConn,typeOfSon); }
+ unsigned getNumberOfSons2(const mcIdType *conn, mcIdType lgth) const { return _cm.getNumberOfMicroEdges(); }
+ unsigned fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, INTERP_KERNEL::NormalizedCellType& typeOfSon) const { return _cm.fillMicroEdgeNodalConnectivity(sonId,nodalConn,sonNodalConn,typeOfSon); }
static const int DELTA=1;
private:
const INTERP_KERNEL::CellModel& _cm;
{
public:
MicroEdgesGenerator3D(const INTERP_KERNEL::CellModel& cm):_cm(cm) { }
- unsigned getNumberOfSons2(const int *conn, int lgth) const { return _cm.getNumberOfMicroEdges(); }
- unsigned fillSonCellNodalConnectivity2(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, INTERP_KERNEL::NormalizedCellType& typeOfSon) const { return _cm.fillMicroEdgeNodalConnectivity(sonId,nodalConn,sonNodalConn,typeOfSon); }
+ unsigned getNumberOfSons2(const mcIdType *conn, mcIdType lgth) const { return _cm.getNumberOfMicroEdges(); }
+ unsigned fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, INTERP_KERNEL::NormalizedCellType& typeOfSon) const { return _cm.fillMicroEdgeNodalConnectivity(sonId,nodalConn,sonNodalConn,typeOfSon); }
static const int DELTA=2;
private:
const INTERP_KERNEL::CellModel& _cm;
};
-int MEDCouplingFastNbrer(int id, unsigned nb, const INTERP_KERNEL::CellModel& cm, bool compute, const int *conn1, const int *conn2);
-int MEDCouplingOrientationSensitiveNbrer(int id, unsigned nb, const INTERP_KERNEL::CellModel& cm, bool compute, const int *conn1, const int *conn2);
+mcIdType MEDCouplingFastNbrer(mcIdType id, mcIdType nb, const INTERP_KERNEL::CellModel& cm, bool compute, const mcIdType *conn1, const mcIdType *conn2);
+mcIdType MEDCouplingOrientationSensitiveNbrer(mcIdType id, mcIdType nb, const INTERP_KERNEL::CellModel& cm, bool compute, const mcIdType *conn1, const mcIdType *conn2);
namespace MEDCoupling
{
public:
static const int MY_SPACEDIM=SPACEDIMM;
static const int MY_MESHDIM=8;
- typedef int MyConnType;
+ typedef mcIdType MyConnType;
static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
// begin
// useless, but for windows compilation ...
const double* getCoordinatesPtr() const { return 0; }
- const int* getConnectivityPtr() const { return 0; }
- const int* getConnectivityIndexPtr() const { return 0; }
- INTERP_KERNEL::NormalizedCellType getTypeOfElement(int) const { return (INTERP_KERNEL::NormalizedCellType)0; }
+ const MyConnType* getConnectivityPtr() const { return 0; }
+ const MyConnType* getConnectivityIndexPtr() const { return 0; }
+ INTERP_KERNEL::NormalizedCellType getTypeOfElement(MyConnType) const { return (INTERP_KERNEL::NormalizedCellType)0; }
// end
};
}
template<int SPACEDIM>
-void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints,
- double eps, MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex, std::function<bool(INTERP_KERNEL::NormalizedCellType,int)> sensibilityTo2DQuadraticLinearCellsFunc) const
+void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const double *pos, mcIdType nbOfPoints,
+ double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex, std::function<bool(INTERP_KERNEL::NormalizedCellType,int)> sensibilityTo2DQuadraticLinearCellsFunc) const
{
// Override precision for this method only:
INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
- elts=DataArrayInt::New(); eltsIndex=DataArrayInt::New(); eltsIndex->alloc(nbOfPoints+1,1); eltsIndex->setIJ(0,0,0); elts->alloc(0,1);
- int *eltsIndexPtr(eltsIndex->getPointer());
+ elts=DataArrayIdType::New(); eltsIndex=DataArrayIdType::New(); eltsIndex->alloc(nbOfPoints+1,1); eltsIndex->setIJ(0,0,0); elts->alloc(0,1);
+ mcIdType *eltsIndexPtr(eltsIndex->getPointer());
MCAuto<DataArrayDouble> bboxArr(getBoundingBoxForBBTree(eps));
const double *bbox(bboxArr->begin());
- int nbOfCells=getNumberOfCells();
- const int *conn=_nodal_connec->getConstPointer();
- const int *connI=_nodal_connec_index->getConstPointer();
+ mcIdType nbOfCells=getNumberOfCells();
+ const mcIdType *conn=_nodal_connec->getConstPointer();
+ const mcIdType *connI=_nodal_connec_index->getConstPointer();
double bb[2*SPACEDIM];
- BBTree<SPACEDIM,int> myTree(&bbox[0],0,0,nbOfCells,-eps);
- for(int i=0;i<nbOfPoints;i++)
+ BBTree<SPACEDIM,mcIdType> myTree(&bbox[0],0,0,nbOfCells,-eps);
+ for(mcIdType i=0;i<nbOfPoints;i++)
{
eltsIndexPtr[i+1]=eltsIndexPtr[i];
for(int j=0;j<SPACEDIM;j++)
bb[2*j]=pos[SPACEDIM*i+j];
bb[2*j+1]=pos[SPACEDIM*i+j];
}
- std::vector<int> candidates;
+ std::vector<mcIdType> candidates;
myTree.getIntersectingElems(bb,candidates);
- for(std::vector<int>::const_iterator iter=candidates.begin();iter!=candidates.end();iter++)
+ for(std::vector<mcIdType>::const_iterator iter=candidates.begin();iter!=candidates.end();iter++)
{
- int sz(connI[(*iter)+1]-connI[*iter]-1);
+ mcIdType sz(connI[(*iter)+1]-connI[*iter]-1);
INTERP_KERNEL::NormalizedCellType ct((INTERP_KERNEL::NormalizedCellType)conn[connI[*iter]]);
bool status(false);
// [ABN] : point locator algorithms are only properly working for linear cells.
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getCellsContainingPointsAlg : not implemented yet for POLYGON and QPOLYGON in spaceDim 3 !");
std::vector<INTERP_KERNEL::Node *> nodes(sz);
INTERP_KERNEL::QuadraticPolygon *pol(0);
- for(int j=0;j<sz;j++)
+ for(mcIdType j=0;j<sz;j++)
{
- int nodeId(conn[connI[*iter]+1+j]);
+ mcIdType nodeId(conn[connI[*iter]+1+j]);
nodes[j]=new INTERP_KERNEL::Node(coords[nodeId*SPACEDIM],coords[nodeId*SPACEDIM+1]);
}
if(!INTERP_KERNEL::CellModel::GetCellModel(ct).isQuadratic())
* For speed reasons no check of this will be done.
*/
template<class SonsGenerator>
-MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivityGen(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx, DimM1DescNbrer nbrer) const
+MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivityGen(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx, DimM1DescNbrer nbrer) const
{
if(!desc || !descIndx || !revDesc || !revDescIndx)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildDescendingConnectivityGen : present of a null pointer in input !");
checkConnectivityFullyDefined();
- int nbOfCells=getNumberOfCells();
- int nbOfNodes=getNumberOfNodes();
- MCAuto<DataArrayInt> revNodalIndx=DataArrayInt::New(); revNodalIndx->alloc(nbOfNodes+1,1); revNodalIndx->fillWithZero();
- int *revNodalIndxPtr=revNodalIndx->getPointer();
- const int *conn=_nodal_connec->getConstPointer();
- const int *connIndex=_nodal_connec_index->getConstPointer();
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType nbOfNodes=getNumberOfNodes();
+ MCAuto<DataArrayIdType> revNodalIndx=DataArrayIdType::New(); revNodalIndx->alloc(nbOfNodes+1,1); revNodalIndx->fillWithZero();
+ mcIdType *revNodalIndxPtr=revNodalIndx->getPointer();
+ const mcIdType *conn=_nodal_connec->getConstPointer();
+ const mcIdType *connIndex=_nodal_connec_index->getConstPointer();
std::string name="Mesh constituent of "; name+=getName();
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(name,getMeshDimension()-SonsGenerator::DELTA);
ret->setCoords(getCoords());
ret->allocateCells(2*nbOfCells);
descIndx->alloc(nbOfCells+1,1);
- MCAuto<DataArrayInt> revDesc2(DataArrayInt::New()); revDesc2->reserve(2*nbOfCells);
- int *descIndxPtr=descIndx->getPointer(); *descIndxPtr++=0;
- for(int eltId=0;eltId<nbOfCells;eltId++,descIndxPtr++)
+ MCAuto<DataArrayIdType> revDesc2(DataArrayIdType::New()); revDesc2->reserve(2*nbOfCells);
+ mcIdType *descIndxPtr=descIndx->getPointer(); *descIndxPtr++=0;
+ for(mcIdType eltId=0;eltId<nbOfCells;eltId++,descIndxPtr++)
{
- int pos=connIndex[eltId];
- int posP1=connIndex[eltId+1];
+ mcIdType pos=connIndex[eltId];
+ mcIdType posP1=connIndex[eltId+1];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[pos]);
SonsGenerator sg(cm);
unsigned nbOfSons=sg.getNumberOfSons2(conn+pos+1,posP1-pos-1);
- INTERP_KERNEL::AutoPtr<int> tmp=new int[posP1-pos];
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=new mcIdType[posP1-pos];
for(unsigned i=0;i<nbOfSons;i++)
{
INTERP_KERNEL::NormalizedCellType cmsId;
ret->insertNextCell(cmsId,nbOfNodesSon,tmp);
revDesc2->pushBackSilent(eltId);
}
- descIndxPtr[0]=descIndxPtr[-1]+(int)nbOfSons;
+ descIndxPtr[0]=descIndxPtr[-1]+ToIdType(nbOfSons);
}
- int nbOfCellsM1=ret->getNumberOfCells();
- std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus<int>());
- MCAuto<DataArrayInt> revNodal=DataArrayInt::New(); revNodal->alloc(revNodalIndx->back(),1);
+ mcIdType nbOfCellsM1=ret->getNumberOfCells();
+ std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus<mcIdType>());
+ MCAuto<DataArrayIdType> revNodal=DataArrayIdType::New(); revNodal->alloc(revNodalIndx->back(),1);
std::fill(revNodal->getPointer(),revNodal->getPointer()+revNodalIndx->back(),-1);
- int *revNodalPtr=revNodal->getPointer();
- const int *connM1=ret->getNodalConnectivity()->getConstPointer();
- const int *connIndexM1=ret->getNodalConnectivityIndex()->getConstPointer();
- for(int eltId=0;eltId<nbOfCellsM1;eltId++)
+ mcIdType *revNodalPtr=revNodal->getPointer();
+ const mcIdType *connM1=ret->getNodalConnectivity()->getConstPointer();
+ const mcIdType *connIndexM1=ret->getNodalConnectivityIndex()->getConstPointer();
+ for(mcIdType eltId=0;eltId<nbOfCellsM1;eltId++)
{
- const int *strtNdlConnOfCurCell=connM1+connIndexM1[eltId]+1;
- const int *endNdlConnOfCurCell=connM1+connIndexM1[eltId+1];
- for(const int *iter=strtNdlConnOfCurCell;iter!=endNdlConnOfCurCell;iter++)
+ const mcIdType *strtNdlConnOfCurCell=connM1+connIndexM1[eltId]+1;
+ const mcIdType *endNdlConnOfCurCell=connM1+connIndexM1[eltId+1];
+ for(const mcIdType *iter=strtNdlConnOfCurCell;iter!=endNdlConnOfCurCell;iter++)
if(*iter>=0)//for polyhedrons
- *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind2nd(std::equal_to<int>(),-1))=eltId;
+ *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind2nd(std::equal_to<mcIdType>(),-1))=eltId;
}
//
- DataArrayInt *commonCells=0,*commonCellsI=0;
+ DataArrayIdType *commonCells=0,*commonCellsI=0;
FindCommonCellsAlg(3,0,ret->getNodalConnectivity(),ret->getNodalConnectivityIndex(),revNodal,revNodalIndx,commonCells,commonCellsI);
- MCAuto<DataArrayInt> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
- const int *commonCellsPtr(commonCells->getConstPointer()),*commonCellsIPtr(commonCellsI->getConstPointer());
- int newNbOfCellsM1=-1;
- MCAuto<DataArrayInt> o2nM1=DataArrayInt::ConvertIndexArrayToO2N(nbOfCellsM1,commonCells->begin(),
+ MCAuto<DataArrayIdType> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
+ const mcIdType *commonCellsPtr(commonCells->getConstPointer()),*commonCellsIPtr(commonCellsI->getConstPointer());
+ mcIdType newNbOfCellsM1=-1;
+ MCAuto<DataArrayIdType> o2nM1=DataArrayIdType::ConvertIndexArrayToO2N(nbOfCellsM1,commonCells->begin(),
commonCellsI->begin(),commonCellsI->end(),newNbOfCellsM1);
std::vector<bool> isImpacted(nbOfCellsM1,false);
- for(const int *work=commonCellsI->begin();work!=commonCellsI->end()-1;work++)
- for(int work2=work[0];work2!=work[1];work2++)
+ for(const mcIdType *work=commonCellsI->begin();work!=commonCellsI->end()-1;work++)
+ for(mcIdType work2=work[0];work2!=work[1];work2++)
isImpacted[commonCellsPtr[work2]]=true;
- const int *o2nM1Ptr=o2nM1->getConstPointer();
- MCAuto<DataArrayInt> n2oM1=o2nM1->invertArrayO2N2N2OBis(newNbOfCellsM1);
- const int *n2oM1Ptr=n2oM1->getConstPointer();
+ const mcIdType *o2nM1Ptr=o2nM1->getConstPointer();
+ MCAuto<DataArrayIdType> n2oM1=o2nM1->invertArrayO2N2N2OBis(newNbOfCellsM1);
+ const mcIdType *n2oM1Ptr=n2oM1->getConstPointer();
MCAuto<MEDCouplingUMesh> ret2=static_cast<MEDCouplingUMesh *>(ret->buildPartOfMySelf(n2oM1->begin(),n2oM1->end(),true));
ret2->copyTinyInfoFrom(this);
desc->alloc(descIndx->back(),1);
- int *descPtr=desc->getPointer();
+ mcIdType *descPtr=desc->getPointer();
const INTERP_KERNEL::CellModel& cmsDft=INTERP_KERNEL::CellModel::GetCellModel(INTERP_KERNEL::NORM_POINT1);
- for(int i=0;i<nbOfCellsM1;i++,descPtr++)
+ for(mcIdType i=0;i<nbOfCellsM1;i++,descPtr++)
{
if(!isImpacted[i])
*descPtr=nbrer(o2nM1Ptr[i],0,cmsDft,false,0,0);
}
revDesc->reserve(newNbOfCellsM1);
revDescIndx->alloc(newNbOfCellsM1+1,1);
- int *revDescIndxPtr=revDescIndx->getPointer(); *revDescIndxPtr++=0;
- const int *revDesc2Ptr=revDesc2->getConstPointer();
- for(int i=0;i<newNbOfCellsM1;i++,revDescIndxPtr++)
+ mcIdType *revDescIndxPtr=revDescIndx->getPointer(); *revDescIndxPtr++=0;
+ const mcIdType *revDesc2Ptr=revDesc2->getConstPointer();
+ for(mcIdType i=0;i<newNbOfCellsM1;i++,revDescIndxPtr++)
{
- int oldCellIdM1=n2oM1Ptr[i];
+ mcIdType oldCellIdM1=n2oM1Ptr[i];
if(!isImpacted[oldCellIdM1])
{
revDesc->pushBackSilent(revDesc2Ptr[oldCellIdM1]);
}
else
{
- for(int j=commonCellsIPtr[0];j<commonCellsIPtr[1];j++)
+ for(mcIdType j=commonCellsIPtr[0];j<commonCellsIPtr[1];j++)
revDesc->pushBackSilent(revDesc2Ptr[commonCellsPtr[j]]);
revDescIndxPtr[0]=revDescIndxPtr[-1]+commonCellsIPtr[1]-commonCellsIPtr[0];
commonCellsIPtr++;
/// @cond INTERNAL
-int InternalAddPoint(const INTERP_KERNEL::Edge *e, int id, const double *coo, int startId, int endId, DataArrayDouble& addCoo, int& nodesCnter)
+mcIdType InternalAddPoint(const INTERP_KERNEL::Edge *e, mcIdType id, const double *coo, mcIdType startId, mcIdType endId, DataArrayDouble& addCoo, mcIdType& nodesCnter)
{
if(id!=-1)
return id;
else
{
- int ret(nodesCnter++);
+ mcIdType ret(nodesCnter++);
double newPt[2];
e->getMiddleOfPoints(coo+2*startId,coo+2*endId,newPt);
addCoo.insertAtTheEnd(newPt,newPt+2);
}
}
-int InternalAddPointOriented(const INTERP_KERNEL::Edge *e, int id, const double *coo, int startId, int endId, DataArrayDouble& addCoo, int& nodesCnter)
+mcIdType InternalAddPointOriented(const INTERP_KERNEL::Edge *e, mcIdType id, const double *coo, mcIdType startId, mcIdType endId, DataArrayDouble& addCoo, mcIdType& nodesCnter)
{
if(id!=-1)
return id;
else
{
- int ret(nodesCnter++);
+ mcIdType ret(nodesCnter++);
double newPt[2];
e->getMiddleOfPointsOriented(coo+2*startId,coo+2*endId,newPt);
addCoo.insertAtTheEnd(newPt,newPt+2);
}
-void EnterTheResultOf2DCellFirst(const INTERP_KERNEL::Edge *e, int start, int stp, int nbOfEdges, bool linOrArc, const double *coords, const int *connBg, int offset, DataArrayInt *newConnOfCell, DataArrayDouble *appendedCoords, std::vector<int>& middles)
+void EnterTheResultOf2DCellFirst(const INTERP_KERNEL::Edge *e, int start, int stp, int nbOfEdges, bool linOrArc, const double *coords, const mcIdType *connBg, mcIdType offset, DataArrayIdType *newConnOfCell, DataArrayDouble *appendedCoords, std::vector<mcIdType>& middles)
{
- int tmp[3];
+ mcIdType tmp[3];
int trueStart(start>=0?start:nbOfEdges+start);
- tmp[0]=linOrArc?(int)INTERP_KERNEL::NORM_QPOLYG:(int)INTERP_KERNEL::NORM_POLYGON; tmp[1]=connBg[trueStart]; tmp[2]=connBg[stp];
+ tmp[0]=ToIdType(linOrArc?INTERP_KERNEL::NORM_QPOLYG:INTERP_KERNEL::NORM_POLYGON); tmp[1]=connBg[trueStart]; tmp[2]=connBg[stp];
newConnOfCell->insertAtTheEnd(tmp,tmp+3);
if(linOrArc)
{
if(stp-start>1)
{
- int tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2);
+ mcIdType tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2);
InternalAddPointOriented(e,-1,coords,tmp[1],tmp[2],*appendedCoords,tmp2);
middles.push_back(tmp3+offset);
}
}
}
-void EnterTheResultOf2DCellMiddle(const INTERP_KERNEL::Edge *e, int start, int stp, int nbOfEdges, bool linOrArc, const double *coords, const int *connBg, int offset, DataArrayInt *newConnOfCell, DataArrayDouble *appendedCoords, std::vector<int>& middles)
+void EnterTheResultOf2DCellMiddle(const INTERP_KERNEL::Edge *e, int start, int stp, int nbOfEdges, bool linOrArc, const double *coords, const mcIdType *connBg, mcIdType offset, DataArrayIdType *newConnOfCell, DataArrayDouble *appendedCoords, std::vector<mcIdType>& middles)
{
- int tmpSrt(newConnOfCell->back()),tmpEnd(connBg[stp]);
+ mcIdType tmpSrt(newConnOfCell->back()),tmpEnd(connBg[stp]);
newConnOfCell->pushBackSilent(tmpEnd);
if(linOrArc)
{
if(stp-start>1)
{
- int tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2);
+ mcIdType tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2);
InternalAddPointOriented(e,-1,coords,tmpSrt,tmpEnd,*appendedCoords,tmp2);
middles.push_back(tmp3+offset);
}
}
}
-void EnterTheResultOf2DCellEnd(const INTERP_KERNEL::Edge *e, int start, int stp, int nbOfEdges, bool linOrArc, const double *coords, const int *connBg, int offset, DataArrayInt *newConnOfCell, DataArrayDouble *appendedCoords, std::vector<int>& middles)
+void EnterTheResultOf2DCellEnd(const INTERP_KERNEL::Edge *e, int start, int stp, int nbOfEdges, bool linOrArc, const double *coords, const mcIdType *connBg, mcIdType offset, DataArrayIdType *newConnOfCell, DataArrayDouble *appendedCoords, std::vector<mcIdType>& middles)
{
// only the quadratic point to deal with:
if(linOrArc)
{
if(stp-start>1) // if we are covering more than one segment we need to create a new mid point
{
- int tmpSrt(connBg[start]),tmpEnd(connBg[stp % nbOfEdges]); // % to handle last seg.
- int tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2);
+ mcIdType tmpSrt(connBg[start]),tmpEnd(connBg[stp % nbOfEdges]); // % to handle last seg.
+ mcIdType tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2);
InternalAddPointOriented(e,-1,coords,tmpSrt,tmpEnd,*appendedCoords,tmp2);
middles.push_back(tmp3+offset);
}
}
}
-void IKGeo2DInternalMapper2(INTERP_KERNEL::Node *n, const std::map<MCAuto<INTERP_KERNEL::Node>,int>& m, int forbVal0, int forbVal1, std::vector<int>& isect)
+void IKGeo2DInternalMapper2(INTERP_KERNEL::Node *n, const std::map<MCAuto<INTERP_KERNEL::Node>,mcIdType>& m, mcIdType forbVal0, mcIdType forbVal1, std::vector<mcIdType>& isect)
{
MCAuto<INTERP_KERNEL::Node> nTmp(n); nTmp->incrRef();
- std::map<MCAuto<INTERP_KERNEL::Node>,int>::const_iterator it(m.find(nTmp));
+ std::map<MCAuto<INTERP_KERNEL::Node>,mcIdType>::const_iterator it(m.find(nTmp));
if(it==m.end())
throw INTERP_KERNEL::Exception("Internal error in remapping !");
- int v((*it).second);
+ mcIdType v((*it).second);
if(v==forbVal0 || v==forbVal1)
return ;
if(std::find(isect.begin(),isect.end(),v)==isect.end())
isect.push_back(v);
}
-bool IKGeo2DInternalMapper(const INTERP_KERNEL::ComposedEdge& c, const std::map<MCAuto<INTERP_KERNEL::Node>,int>& m, int forbVal0, int forbVal1, std::vector<int>& isect)
+bool IKGeo2DInternalMapper(const INTERP_KERNEL::ComposedEdge& c, const std::map<MCAuto<INTERP_KERNEL::Node>,mcIdType>& m, mcIdType forbVal0, mcIdType forbVal1, std::vector<mcIdType>& isect)
{
int sz(c.size());
if(sz<=1)
namespace MEDCoupling
{
- INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge2(INTERP_KERNEL::NormalizedCellType typ, const int *bg, const double *coords2D, std::map< MCAuto<INTERP_KERNEL::Node>,int>& m)
+ INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge2(INTERP_KERNEL::NormalizedCellType typ, const mcIdType *bg, const double *coords2D, std::map< MCAuto<INTERP_KERNEL::Node>,mcIdType>& m)
{
INTERP_KERNEL::Edge *ret(0);
MCAuto<INTERP_KERNEL::Node> n0(new INTERP_KERNEL::Node(coords2D[2*bg[0]],coords2D[2*bg[0]+1])),n1(new INTERP_KERNEL::Node(coords2D[2*bg[1]],coords2D[2*bg[1]+1]));
return ret;
}
- INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge(INTERP_KERNEL::NormalizedCellType typ, std::map<int, INTERP_KERNEL::NodeWithUsage >& mapp2, const int *bg)
+ INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge(INTERP_KERNEL::NormalizedCellType typ, std::map<mcIdType, INTERP_KERNEL::NodeWithUsage >& mapp2, const mcIdType *bg)
{
INTERP_KERNEL::Edge *ret=0;
* The input mesh 'mDesc' must be so that mDim==1 and spaceDim==2.
* 'mapp' returns a mapping between local numbering in submesh (represented by a Node*) and the global node numbering in 'mDesc'.
*/
- INTERP_KERNEL::QuadraticPolygon *MEDCouplingUMeshBuildQPFromMesh(const MEDCouplingUMesh *mDesc, const std::vector<int>& candidates,
- std::map<INTERP_KERNEL::Node *,int>& mapp)
+ INTERP_KERNEL::QuadraticPolygon *MEDCouplingUMeshBuildQPFromMesh(const MEDCouplingUMesh *mDesc, const std::vector<mcIdType>& candidates,
+ std::map<INTERP_KERNEL::Node *,mcIdType>& mapp)
{
mapp.clear();
- std::map<int, INTERP_KERNEL::NodeWithUsage > mapp2; // the last var is a flag specifying if node is an extreme node of the seg (LINEAR) or only a middle for SEG3 (QUADRATIC_ONLY).
+ std::map<mcIdType, INTERP_KERNEL::NodeWithUsage > mapp2; // the last var is a flag specifying if node is an extreme node of the seg (LINEAR) or only a middle for SEG3 (QUADRATIC_ONLY).
const double *coo=mDesc->getCoords()->getConstPointer();
- const int *c=mDesc->getNodalConnectivity()->getConstPointer();
- const int *cI=mDesc->getNodalConnectivityIndex()->getConstPointer();
- std::set<int> s;
- for(std::vector<int>::const_iterator it=candidates.begin();it!=candidates.end();it++)
+ const mcIdType *c=mDesc->getNodalConnectivity()->getConstPointer();
+ const mcIdType *cI=mDesc->getNodalConnectivityIndex()->getConstPointer();
+ std::set<mcIdType> s;
+ for(std::vector<mcIdType>::const_iterator it=candidates.begin();it!=candidates.end();it++)
s.insert(c+cI[*it]+1,c+cI[(*it)+1]);
- for(std::set<int>::const_iterator it2=s.begin();it2!=s.end();it2++)
+ for(std::set<mcIdType>::const_iterator it2=s.begin();it2!=s.end();it2++)
{
INTERP_KERNEL::Node *n=new INTERP_KERNEL::Node(coo[2*(*it2)],coo[2*(*it2)+1]);
mapp2[*it2]=INTERP_KERNEL::NodeWithUsage(n,INTERP_KERNEL::USAGE_UNKNOWN);
}
INTERP_KERNEL::QuadraticPolygon *ret=new INTERP_KERNEL::QuadraticPolygon;
- for(std::vector<int>::const_iterator it=candidates.begin();it!=candidates.end();it++)
+ for(std::vector<mcIdType>::const_iterator it=candidates.begin();it!=candidates.end();it++)
{
INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)c[cI[*it]];
ret->pushBack(MEDCouplingUMeshBuildQPFromEdge(typ,mapp2,c+cI[*it]+1));
}
- for(std::map<int, INTERP_KERNEL::NodeWithUsage >::const_iterator it2=mapp2.begin();it2!=mapp2.end();it2++)
+ for(std::map<mcIdType, INTERP_KERNEL::NodeWithUsage >::const_iterator it2=mapp2.begin();it2!=mapp2.end();it2++)
{
if((*it2).second.second == INTERP_KERNEL::USAGE_LINEAR)
mapp[(*it2).second.first]=(*it2).first;
return ret;
}
- INTERP_KERNEL::QuadraticPolygon *MEDCouplingUMeshBuildQPFromMeshWithTree(const MEDCouplingUMesh *mDesc, const std::vector<int>& candidates,
- std::map<INTERP_KERNEL::Node *,int>& mapp,
- const BBTreePts<2,int> & nodeTree,
- const std::map<int, INTERP_KERNEL::Node *>& mapRev)
+ INTERP_KERNEL::QuadraticPolygon *MEDCouplingUMeshBuildQPFromMeshWithTree(const MEDCouplingUMesh *mDesc, const std::vector<mcIdType>& candidates,
+ std::map<INTERP_KERNEL::Node *,mcIdType>& mapp,
+ const BBTreePts<2,mcIdType> & nodeTree,
+ const std::map<mcIdType, INTERP_KERNEL::Node *>& mapRev)
{
mapp.clear();
- std::map<int, INTERP_KERNEL::NodeWithUsage > mapp2; // the last var is a flag specifying if node is an extreme node of the seg (LINEAR) or only a middle for SEG3 (QUADRATIC_ONLY).
+ std::map<mcIdType, INTERP_KERNEL::NodeWithUsage > mapp2; // the last var is a flag specifying if node is an extreme node of the seg (LINEAR) or only a middle for SEG3 (QUADRATIC_ONLY).
const double *coo=mDesc->getCoords()->getConstPointer();
- const int *c=mDesc->getNodalConnectivity()->getConstPointer();
- const int *cI=mDesc->getNodalConnectivityIndex()->getConstPointer();
- std::set<int> s;
- for(std::vector<int>::const_iterator it=candidates.begin();it!=candidates.end();it++)
+ const mcIdType *c=mDesc->getNodalConnectivity()->getConstPointer();
+ const mcIdType *cI=mDesc->getNodalConnectivityIndex()->getConstPointer();
+ std::set<mcIdType> s;
+ for(std::vector<mcIdType>::const_iterator it=candidates.begin();it!=candidates.end();it++)
s.insert(c+cI[*it]+1,c+cI[(*it)+1]);
- for(std::set<int>::const_iterator it2=s.begin();it2!=s.end();it2++)
+ for(std::set<mcIdType>::const_iterator it2=s.begin();it2!=s.end();it2++)
{
INTERP_KERNEL::Node *n;
// Look for a potential node to merge
- std::vector<int> candNode;
+ std::vector<mcIdType> candNode;
nodeTree.getElementsAroundPoint(coo+2*(*it2), candNode);
if (candNode.size() > 2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::MEDCouplingUMeshBuildQPFromMeshWithTree(): some nodes are not properly merged (within eps) in input mesh!");
mapp2[*it2]=INTERP_KERNEL::NodeWithUsage(n,INTERP_KERNEL::USAGE_UNKNOWN);
}
INTERP_KERNEL::QuadraticPolygon *ret=new INTERP_KERNEL::QuadraticPolygon;
- for(std::vector<int>::const_iterator it=candidates.begin();it!=candidates.end();it++)
+ for(std::vector<mcIdType>::const_iterator it=candidates.begin();it!=candidates.end();it++)
{
INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)c[cI[*it]];
ret->pushBack(MEDCouplingUMeshBuildQPFromEdge(typ,mapp2,c+cI[*it]+1)); // this call will set quad points to false in the map
}
- for(std::map<int, INTERP_KERNEL::NodeWithUsage >::const_iterator it2=mapp2.begin();it2!=mapp2.end();it2++)
+ for(std::map<mcIdType, INTERP_KERNEL::NodeWithUsage >::const_iterator it2=mapp2.begin();it2!=mapp2.end();it2++)
{
if((*it2).second.second == INTERP_KERNEL::USAGE_LINEAR)
mapp[(*it2).second.first]=(*it2).first;
return ret;
}
- INTERP_KERNEL::Node *MEDCouplingUMeshBuildQPNode(int nodeId, const double *coo1, int offset1, const double *coo2, int offset2, const std::vector<double>& addCoo)
+ INTERP_KERNEL::Node *MEDCouplingUMeshBuildQPNode(mcIdType nodeId, const double *coo1, mcIdType offset1, const double *coo2, mcIdType offset2, const std::vector<double>& addCoo)
{
if(nodeId>=offset2)
{
- int locId=nodeId-offset2;
+ mcIdType locId=nodeId-offset2;
return new INTERP_KERNEL::Node(addCoo[2*locId],addCoo[2*locId+1]);
}
if(nodeId>=offset1)
{
- int locId=nodeId-offset1;
+ mcIdType locId=nodeId-offset1;
return new INTERP_KERNEL::Node(coo2[2*locId],coo2[2*locId+1]);
}
return new INTERP_KERNEL::Node(coo1[2*nodeId],coo1[2*nodeId+1]);
/**
* Construct a mapping between set of Nodes and the standard MEDCoupling connectivity format (c, cI).
*/
- void MEDCouplingUMeshBuildQPFromMesh3(const double *coo1, int offset1, const double *coo2, int offset2, const std::vector<double>& addCoo,
- const int *desc1Bg, const int *desc1End, const std::vector<std::vector<int> >& intesctEdges1,
- /*output*/std::map<INTERP_KERNEL::Node *,int>& mapp, std::map<int,INTERP_KERNEL::Node *>& mappRev)
+ void MEDCouplingUMeshBuildQPFromMesh3(const double *coo1, mcIdType offset1, const double *coo2, mcIdType offset2, const std::vector<double>& addCoo,
+ const mcIdType *desc1Bg, const mcIdType *desc1End, const std::vector<std::vector<mcIdType> >& intesctEdges1,
+ /*output*/std::map<INTERP_KERNEL::Node *,mcIdType>& mapp, std::map<mcIdType,INTERP_KERNEL::Node *>& mappRev)
{
- for(const int *desc1=desc1Bg;desc1!=desc1End;desc1++)
+ for(const mcIdType *desc1=desc1Bg;desc1!=desc1End;desc1++)
{
- int eltId1=abs(*desc1)-1;
- for(std::vector<int>::const_iterator it1=intesctEdges1[eltId1].begin();it1!=intesctEdges1[eltId1].end();it1++)
+ mcIdType eltId1=std::abs(*desc1)-1;
+ for(std::vector<mcIdType>::const_iterator it1=intesctEdges1[eltId1].begin();it1!=intesctEdges1[eltId1].end();it1++)
{
- std::map<int,INTERP_KERNEL::Node *>::const_iterator it=mappRev.find(*it1);
+ std::map<mcIdType,INTERP_KERNEL::Node *>::const_iterator it=mappRev.find(*it1);
if(it==mappRev.end())
{
INTERP_KERNEL::Node *node=MEDCouplingUMeshBuildQPNode(*it1,coo1,offset1,coo2,offset2,addCoo);
* \a appendedCoords is a DataArrayDouble instance with number of components equal to one (even if the items are pushed by pair).
* \param forbiddenPoints the list of points that should not be removed in the process
*/
-bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const int *connBg, const int *connEnd, int offset,
- const std::map<int, bool>& forbiddenPoints,
- DataArrayInt *newConnOfCell, DataArrayDouble *appendedCoords)
+bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const mcIdType *connBg, const mcIdType *connEnd, mcIdType offset,
+ const std::map<mcIdType, bool>& forbiddenPoints,
+ DataArrayIdType *newConnOfCell, DataArrayDouble *appendedCoords)
{
std::size_t sz(std::distance(connBg,connEnd));
if(sz<3)//3 because 2+1(for the cell type) and 2 is the minimal number of edges of 2D cell.
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Colinearize2DCell : the input cell has invalid format !");
sz--;
- INTERP_KERNEL::AutoPtr<int> tmpConn(new int[sz]);
- INTERP_KERNEL::AutoPtr<int> tmpConn2(new int[sz]);
+ INTERP_KERNEL::AutoPtr<mcIdType> tmpConn(new mcIdType[sz]);
+ INTERP_KERNEL::AutoPtr<mcIdType> tmpConn2(new mcIdType[sz]);
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)connBg[0]));
- unsigned nbs(cm.getNumberOfSons2(connBg+1,sz));
+ unsigned nbs(cm.getNumberOfSons2(connBg+1,ToIdType(sz)));
unsigned nbOfHit(0); // number of fusions operated
int posBaseElt(0),posEndElt(0),nbOfTurn(0);
- const unsigned int maxNbOfHit = cm.isQuadratic() ? nbs-2 : nbs-3; // a quad cell is authorized to end up with only two edges, a linear one has to keep 3 at least
+ const std::size_t maxNbOfHit = cm.isQuadratic() ? nbs-2 : nbs-3; // a quad cell is authorized to end up with only two edges, a linear one has to keep 3 at least
INTERP_KERNEL::NormalizedCellType typeOfSon;
- std::vector<int> middles;
+ std::vector<mcIdType> middles;
bool ret(false);
for(;(nbOfTurn+nbOfHit)<nbs;nbOfTurn++)
{
- cm.fillSonCellNodalConnectivity2(posBaseElt,connBg+1,sz,tmpConn,typeOfSon);
- std::map<MCAuto<INTERP_KERNEL::Node>,int> m;
+ cm.fillSonCellNodalConnectivity2(posBaseElt,connBg+1,ToIdType(sz),tmpConn,typeOfSon);
+ std::map<MCAuto<INTERP_KERNEL::Node>,mcIdType> m;
INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpConn,coords,m));
posEndElt = posBaseElt+1;
{
for(unsigned i=1;i<nbs && nbOfHit<maxNbOfHit;i++) // 2nd condition is to avoid ending with a cell with one single edge
{
- cm.fillSonCellNodalConnectivity2(nbs-i,connBg+1,sz,tmpConn2,typeOfSon);
+ cm.fillSonCellNodalConnectivity2(nbs-i,connBg+1,ToIdType(sz),tmpConn2,typeOfSon);
// Identify common point:
- int commPoint = std::find((int *)tmpConn, tmpConn+2, tmpConn2[0]) != tmpConn+2 ? tmpConn2[0] : tmpConn2[1];
+ mcIdType commPoint = std::find((mcIdType *)tmpConn, tmpConn+2, tmpConn2[0]) != tmpConn+2 ? tmpConn2[0] : tmpConn2[1];
auto itE(forbiddenPoints.end());
if (forbiddenPoints.find(commPoint) != itE) // is the junction point in the list of points we can not remove?
break;
if(!isColinear)
break;
// Update last connectivity
- std::copy((int *)tmpConn2, tmpConn2+sz, (int *)tmpConn);
+ std::copy((mcIdType *)tmpConn2, tmpConn2+sz, (mcIdType *)tmpConn);
}
}
// Now move forward:
const unsigned fwdStart = (nbOfTurn == 0 ? 0 : posBaseElt); // the first element to be inspected going forward
for(unsigned j=fwdStart+1;j<nbs && nbOfHit<maxNbOfHit;j++) // 2nd condition is to avoid ending with a cell with one single edge
{
- cm.fillSonCellNodalConnectivity2((int)j,connBg+1,sz,tmpConn2,typeOfSon); // get edge #j's connectivity
+ cm.fillSonCellNodalConnectivity2(j,connBg+1,ToIdType(sz),tmpConn2,typeOfSon); // get edge #j's connectivity
// Identify common point:
- int commPoint = std::find((int *)tmpConn, tmpConn+2, tmpConn2[0]) != tmpConn+2 ? tmpConn2[0] : tmpConn2[1];
+ mcIdType commPoint = std::find((mcIdType *)tmpConn, tmpConn+2, tmpConn2[0]) != tmpConn+2 ? tmpConn2[0] : tmpConn2[1];
auto itE(forbiddenPoints.end());
if (forbiddenPoints.find(commPoint) != itE) // is the junction point in the list of points we can not remove?
break;
if(!isColinear)
break;
// Update last connectivity
- std::copy((int *)tmpConn2, tmpConn2+sz, (int *)tmpConn);
+ std::copy((mcIdType *)tmpConn2, tmpConn2+sz, (mcIdType *)tmpConn);
}
//push [posBaseElt,posEndElt) in newConnOfCell using e
// The if clauses below are (voluntary) not mutually exclusive: on a quad cell with 2 edges, the end of the connectivity is also its beginning!
if(nbOfTurn==0)
// at the beginning of the connectivity (insert type)
- EnterTheResultOf2DCellFirst(e,posBaseElt,posEndElt,(int)nbs,cm.isQuadratic(),coords,connBg+1,offset,newConnOfCell,appendedCoords,middles);
+ EnterTheResultOf2DCellFirst(e,posBaseElt,posEndElt,nbs,cm.isQuadratic(),coords,connBg+1,offset,newConnOfCell,appendedCoords,middles);
else if((nbOfHit+nbOfTurn) != (nbs-1))
// in the middle
- EnterTheResultOf2DCellMiddle(e,posBaseElt,posEndElt,(int)nbs,cm.isQuadratic(),coords,connBg+1,offset,newConnOfCell,appendedCoords,middles);
+ EnterTheResultOf2DCellMiddle(e,posBaseElt,posEndElt,nbs,cm.isQuadratic(),coords,connBg+1,offset,newConnOfCell,appendedCoords,middles);
if ((nbOfHit+nbOfTurn) == (nbs-1))
// at the end (only quad points to deal with)
- EnterTheResultOf2DCellEnd(e,posBaseElt,posEndElt,(int)nbs,cm.isQuadratic(),coords,connBg+1,offset,newConnOfCell,appendedCoords,middles);
+ EnterTheResultOf2DCellEnd(e,posBaseElt,posEndElt,nbs,cm.isQuadratic(),coords,connBg+1,offset,newConnOfCell,appendedCoords,middles);
posBaseElt=posEndElt;
e->decrRef();
}
-bool IsColinearOfACellOf(const std::vector< std::vector<int> >& intersectEdge1, const std::vector<int>& candidates, int start, int stop, int& retVal)
+bool IsColinearOfACellOf(const std::vector< std::vector<mcIdType> >& intersectEdge1, const std::vector<mcIdType>& candidates, mcIdType start, mcIdType stop, mcIdType& retVal)
{
if(candidates.empty())
return false;
- for(std::vector<int>::const_iterator it=candidates.begin();it!=candidates.end();it++)
+ for(std::vector<mcIdType>::const_iterator it=candidates.begin();it!=candidates.end();it++)
{
- const std::vector<int>& pool(intersectEdge1[*it]);
- int tmp[2]; tmp[0]=start; tmp[1]=stop;
+ const std::vector<mcIdType>& pool(intersectEdge1[*it]);
+ mcIdType tmp[2]; tmp[0]=start; tmp[1]=stop;
if(std::search(pool.begin(),pool.end(),tmp,tmp+2)!=pool.end())
{
retVal=*it+1;
*/
void MEDCouplingUMesh::BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2,
const std::vector<double>& addCoo,
- const std::vector< std::vector<int> >& subDiv, std::vector< std::vector<int> >& intersectEdge)
+ const std::vector< std::vector<mcIdType> >& subDiv, std::vector< std::vector<mcIdType> >& intersectEdge)
{
- int offset1=m1->getNumberOfNodes();
- int ncell2=m2->getNumberOfCells();
- const int *c=m2->getNodalConnectivity()->begin();
- const int *cI=m2->getNodalConnectivityIndex()->begin();
+ mcIdType offset1=m1->getNumberOfNodes();
+ mcIdType ncell2=m2->getNumberOfCells();
+ const mcIdType *c=m2->getNodalConnectivity()->begin();
+ const mcIdType *cI=m2->getNodalConnectivityIndex()->begin();
const double *coo=m2->getCoords()->begin();
const double *cooBis=m1->getCoords()->begin();
- int offset2=offset1+m2->getNumberOfNodes();
+ mcIdType offset2=offset1+m2->getNumberOfNodes();
intersectEdge.resize(ncell2);
- for(int i=0;i<ncell2;i++,cI++)
+ for(mcIdType i=0;i<ncell2;i++,cI++)
{
- const std::vector<int>& divs=subDiv[i];
- int nnode=cI[1]-cI[0]-1;
- std::map<int, INTERP_KERNEL::NodeWithUsage > mapp2;
- std::map<INTERP_KERNEL::Node *, int> mapp22;
- for(int j=0;j<nnode;j++)
+ const std::vector<mcIdType>& divs=subDiv[i];
+ mcIdType nnode=cI[1]-cI[0]-1;
+ std::map<mcIdType, INTERP_KERNEL::NodeWithUsage > mapp2;
+ std::map<INTERP_KERNEL::Node *, mcIdType> mapp22;
+ for(mcIdType j=0;j<nnode;j++)
{
INTERP_KERNEL::Node *nn=new INTERP_KERNEL::Node(coo[2*c[(*cI)+j+1]],coo[2*c[(*cI)+j+1]+1]);
- int nnid=c[(*cI)+j+1];
+ mcIdType nnid=c[(*cI)+j+1];
mapp2[nnid]=INTERP_KERNEL::NodeWithUsage(nn,INTERP_KERNEL::USAGE_UNKNOWN);
mapp22[nn]=nnid+offset1;
}
INTERP_KERNEL::Edge *e=MEDCouplingUMeshBuildQPFromEdge((INTERP_KERNEL::NormalizedCellType)c[*cI],mapp2,c+(*cI)+1);
- for(std::map<int, INTERP_KERNEL::NodeWithUsage >::const_iterator it=mapp2.begin();it!=mapp2.end();it++)
+ for(std::map<mcIdType, INTERP_KERNEL::NodeWithUsage >::const_iterator it=mapp2.begin();it!=mapp2.end();it++)
((*it).second.first)->decrRef();
std::vector<INTERP_KERNEL::Node *> addNodes(divs.size());
- std::map<INTERP_KERNEL::Node *,int> mapp3;
+ std::map<INTERP_KERNEL::Node *,mcIdType> mapp3;
for(std::size_t j=0;j<divs.size();j++)
{
- int id=divs[j];
+ mcIdType id=divs[j];
INTERP_KERNEL::Node *tmp=0;
if(id<offset1)
tmp=new INTERP_KERNEL::Node(cooBis[2*id],cooBis[2*id+1]);
}
}
-MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std::vector< std::vector<int> >& intersectEdge2, const DataArrayDouble *coords1, const std::vector<double>& addCoo, const std::map<int,int>& mergedNodes, const std::vector< std::vector<int> >& colinear2, const std::vector< std::vector<int> >& intersectEdge1,
- MCAuto<DataArrayInt>& idsInRetColinear, MCAuto<DataArrayInt>& idsInMesh1DForIdsInRetColinear)
+MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std::vector< std::vector<mcIdType> >& intersectEdge2, const DataArrayDouble *coords1, const std::vector<double>& addCoo, const std::map<mcIdType,mcIdType>& mergedNodes, const std::vector< std::vector<mcIdType> >& colinear2, const std::vector< std::vector<mcIdType> >& intersectEdge1,
+ MCAuto<DataArrayIdType>& idsInRetColinear, MCAuto<DataArrayIdType>& idsInMesh1DForIdsInRetColinear)
{
- idsInRetColinear=DataArrayInt::New(); idsInRetColinear->alloc(0,1);
- idsInMesh1DForIdsInRetColinear=DataArrayInt::New(); idsInMesh1DForIdsInRetColinear->alloc(0,1);
- int nCells(mesh1D->getNumberOfCells());
- if(nCells!=(int)intersectEdge2.size())
+ idsInRetColinear=DataArrayIdType::New(); idsInRetColinear->alloc(0,1);
+ idsInMesh1DForIdsInRetColinear=DataArrayIdType::New(); idsInMesh1DForIdsInRetColinear->alloc(0,1);
+ mcIdType nCells=mesh1D->getNumberOfCells();
+ if(nCells!=ToIdType(intersectEdge2.size()))
throw INTERP_KERNEL::Exception("BuildMesh1DCutFrom : internal error # 1 !");
const DataArrayDouble *coo2(mesh1D->getCoords());
- const int *c(mesh1D->getNodalConnectivity()->begin()),*ci(mesh1D->getNodalConnectivityIndex()->begin());
+ const mcIdType *c(mesh1D->getNodalConnectivity()->begin()),*ci(mesh1D->getNodalConnectivityIndex()->begin());
const double *coo2Ptr(coo2->begin());
- int offset1(coords1->getNumberOfTuples());
- int offset2(offset1+coo2->getNumberOfTuples());
- int offset3(offset2+addCoo.size()/2);
+ mcIdType offset1(coords1->getNumberOfTuples());
+ mcIdType offset2(offset1+coo2->getNumberOfTuples());
+ mcIdType offset3(offset2+ToIdType(addCoo.size())/2);
std::vector<double> addCooQuad;
- MCAuto<DataArrayInt> cOut(DataArrayInt::New()),ciOut(DataArrayInt::New()); cOut->alloc(0,1); ciOut->alloc(1,1); ciOut->setIJ(0,0,0);
- int tmp[4],cicnt(0),kk(0);
- for(int i=0;i<nCells;i++)
+ MCAuto<DataArrayIdType> cOut(DataArrayIdType::New()),ciOut(DataArrayIdType::New()); cOut->alloc(0,1); ciOut->alloc(1,1); ciOut->setIJ(0,0,0);
+ mcIdType tmp[4],cicnt(0),kk(0);
+ for(mcIdType i=0;i<nCells;i++)
{
- std::map<MCAuto<INTERP_KERNEL::Node>,int> m;
+ std::map<MCAuto<INTERP_KERNEL::Node>,mcIdType> m;
INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coo2Ptr,m));
- const std::vector<int>& subEdges(intersectEdge2[i]);
- int nbSubEdge(subEdges.size()/2);
- for(int j=0;j<nbSubEdge;j++,kk++)
+ const std::vector<mcIdType>& subEdges(intersectEdge2[i]);
+ mcIdType nbSubEdge=ToIdType(subEdges.size()/2);
+ for(mcIdType j=0;j<nbSubEdge;j++,kk++)
{
MCAuto<INTERP_KERNEL::Node> n1(MEDCouplingUMeshBuildQPNode(subEdges[2*j],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)),n2(MEDCouplingUMeshBuildQPNode(subEdges[2*j+1],coords1->begin(),offset1,coo2Ptr,offset2,addCoo));
MCAuto<INTERP_KERNEL::Edge> e2(e->buildEdgeLyingOnMe(n1,n2));
INTERP_KERNEL::Edge *e2Ptr(e2);
- std::map<int,int>::const_iterator itm;
+ std::map<mcIdType,mcIdType>::const_iterator itm;
if(dynamic_cast<INTERP_KERNEL::EdgeArcCircle *>(e2Ptr))
{
tmp[0]=INTERP_KERNEL::NORM_SEG3;
tmp[1]=itm!=mergedNodes.end()?(*itm).second:subEdges[2*j];
itm=mergedNodes.find(subEdges[2*j+1]);
tmp[2]=itm!=mergedNodes.end()?(*itm).second:subEdges[2*j+1];
- tmp[3]=offset3+(int)addCooQuad.size()/2;
+ tmp[3]=offset3+ToIdType(addCooQuad.size()/2);
double tmp2[2];
e2->getBarycenter(tmp2); addCooQuad.insert(addCooQuad.end(),tmp2,tmp2+2);
cicnt+=4;
cOut->insertAtTheEnd(tmp,tmp+3);
ciOut->pushBackSilent(cicnt);
}
- int tmp00;
+ mcIdType tmp00;
if(IsColinearOfACellOf(intersectEdge1,colinear2[i],tmp[1],tmp[2],tmp00))
{
idsInRetColinear->pushBackSilent(kk);
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New(mesh1D->getName(),1));
ret->setConnectivity(cOut,ciOut,true);
MCAuto<DataArrayDouble> arr3(DataArrayDouble::New());
- arr3->useArray(&addCoo[0],false,DeallocType::C_DEALLOC,(int)addCoo.size()/2,2);
- MCAuto<DataArrayDouble> arr4(DataArrayDouble::New()); arr4->useArray(&addCooQuad[0],false,DeallocType::C_DEALLOC,(int)addCooQuad.size()/2,2);
+ arr3->useArray(&addCoo[0],false,DeallocType::C_DEALLOC,addCoo.size()/2,2);
+ MCAuto<DataArrayDouble> arr4(DataArrayDouble::New()); arr4->useArray(&addCooQuad[0],false,DeallocType::C_DEALLOC,addCooQuad.size()/2,2);
std::vector<const DataArrayDouble *> coordss(4);
coordss[0]=coords1; coordss[1]=mesh1D->getCoords(); coordss[2]=arr3; coordss[3]=arr4;
MCAuto<DataArrayDouble> arr(DataArrayDouble::Aggregate(coordss));
return ret.retn();
}
-MEDCouplingUMesh *BuildRefined2DCellLinear(const DataArrayDouble *coords, const int *descBg, const int *descEnd, const std::vector< std::vector<int> >& intersectEdge1)
+MEDCouplingUMesh *BuildRefined2DCellLinear(const DataArrayDouble *coords, const mcIdType *descBg, const mcIdType *descEnd, const std::vector< std::vector<mcIdType> >& intersectEdge1)
{
- std::vector<int> allEdges;
- for(const int *it2(descBg);it2!=descEnd;it2++)
+ std::vector<mcIdType> allEdges;
+ for(const mcIdType *it2(descBg);it2!=descEnd;it2++)
{
- const std::vector<int>& edge1(intersectEdge1[std::abs(*it2)-1]);
+ const std::vector<mcIdType>& edge1(intersectEdge1[std::abs(*it2)-1]);
if(*it2>0)
allEdges.insert(allEdges.end(),edge1.begin(),edge1.end());
else
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("",2));
ret->setCoords(coords);
ret->allocateCells(1);
- std::vector<int> connOut(nbOfEdgesOf2DCellSplit);
+ std::vector<mcIdType> connOut(nbOfEdgesOf2DCellSplit);
for(std::size_t kk=0;kk<nbOfEdgesOf2DCellSplit;kk++)
connOut[kk]=allEdges[2*kk];
- ret->insertNextCell(INTERP_KERNEL::NORM_POLYGON,connOut.size(),&connOut[0]);
+ ret->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(connOut.size()),&connOut[0]);
return ret.retn();
}
-MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, const MEDCouplingUMesh *mesh2D, int cellIdInMesh2D, const int *descBg, const int *descEnd, const std::vector< std::vector<int> >& intersectEdge1)
+MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, const MEDCouplingUMesh *mesh2D, mcIdType cellIdInMesh2D, const mcIdType *descBg, const mcIdType *descEnd, const std::vector< std::vector<mcIdType> >& intersectEdge1)
{
- const int *c(mesh2D->getNodalConnectivity()->begin()),*ci(mesh2D->getNodalConnectivityIndex()->begin());
+ const mcIdType *c(mesh2D->getNodalConnectivity()->begin()),*ci(mesh2D->getNodalConnectivityIndex()->begin());
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c[ci[cellIdInMesh2D]]));
- std::size_t ii(0);
+ int ii(0);
unsigned sz(cm.getNumberOfSons2(c+ci[cellIdInMesh2D]+1,ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]-1));
if(sz!=std::distance(descBg,descEnd))
throw INTERP_KERNEL::Exception("BuildRefined2DCellQuadratic : internal error 1 !");
- INTERP_KERNEL::AutoPtr<int> tmpPtr(new int[ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]]);
- std::vector<int> allEdges,centers;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmpPtr(new mcIdType[ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]]);
+ std::vector<mcIdType> allEdges,centers;
const double *coordsPtr(coords->begin());
MCAuto<DataArrayDouble> addCoo(DataArrayDouble::New()); addCoo->alloc(0,1);
- int offset(coords->getNumberOfTuples());
- for(const int *it2(descBg);it2!=descEnd;it2++,ii++)
+ mcIdType offset(coords->getNumberOfTuples());
+ for(const mcIdType *it2(descBg);it2!=descEnd;it2++,ii++)
{
INTERP_KERNEL::NormalizedCellType typeOfSon;
cm.fillSonCellNodalConnectivity2(ii,c+ci[cellIdInMesh2D]+1,ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]-1,tmpPtr,typeOfSon);
- const std::vector<int>& edge1(intersectEdge1[std::abs(*it2)-1]);
+ const std::vector<mcIdType>& edge1(intersectEdge1[std::abs(*it2)-1]);
if(*it2>0)
allEdges.insert(allEdges.end(),edge1.begin(),edge1.end());
else
centers.push_back(tmpPtr[2]);//special case where no subsplit of edge -> reuse the original center.
else
{//the current edge has been subsplit -> create corresponding centers.
- std::size_t nbOfCentersToAppend(edge1.size()/2);
- std::map< MCAuto<INTERP_KERNEL::Node>,int> m;
+ mcIdType nbOfCentersToAppend=ToIdType(edge1.size()/2);
+ std::map< MCAuto<INTERP_KERNEL::Node>,mcIdType> m;
MCAuto<INTERP_KERNEL::Edge> ee(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpPtr,coordsPtr,m));
- std::vector<int>::const_iterator it3(allEdges.end()-edge1.size());
- for(std::size_t k=0;k<nbOfCentersToAppend;k++)
+ std::vector<mcIdType>::const_iterator it3(allEdges.end()-edge1.size());
+ for(mcIdType k=0;k<nbOfCentersToAppend;k++)
{
double tmpp[2];
const double *aa(coordsPtr+2*(*it3++));
ret->setCoords(addCoo);
}
ret->allocateCells(1);
- std::vector<int> connOut(nbOfEdgesOf2DCellSplit);
+ std::vector<mcIdType> connOut(nbOfEdgesOf2DCellSplit);
for(std::size_t kk=0;kk<nbOfEdgesOf2DCellSplit;kk++)
connOut[kk]=allEdges[2*kk];
connOut.insert(connOut.end(),centers.begin(),centers.end());
- ret->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,connOut.size(),&connOut[0]);
+ ret->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,ToIdType(connOut.size()),&connOut[0]);
return ret.retn();
}
*
* \param [in] mesh2D - The origin 2D mesh. \b Warning \b coords are not those of \a mesh2D. But mesh2D->getCoords()==coords[:mesh2D->getNumberOfNodes()]
*/
-MEDCouplingUMesh *BuildRefined2DCell(const DataArrayDouble *coords, const MEDCouplingUMesh *mesh2D, int cellIdInMesh2D, const int *descBg, const int *descEnd, const std::vector< std::vector<int> >& intersectEdge1)
+MEDCouplingUMesh *BuildRefined2DCell(const DataArrayDouble *coords, const MEDCouplingUMesh *mesh2D, mcIdType cellIdInMesh2D, const mcIdType *descBg, const mcIdType *descEnd, const std::vector< std::vector<mcIdType> >& intersectEdge1)
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(mesh2D->getTypeOfCell(cellIdInMesh2D)));
if(!cm.isQuadratic())
return BuildRefined2DCellQuadratic(coords,mesh2D,cellIdInMesh2D,descBg,descEnd,intersectEdge1);
}
-void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector<int>& conn, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edges)
+void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector<mcIdType>& conn, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edges)
{
bool isQuad(false);
for(std::vector< MCAuto<INTERP_KERNEL::Edge> >::const_iterator it=edges.begin();it!=edges.end();it++)
isQuad=true;
}
if(!isQuad)
- mesh2D->insertNextCell(INTERP_KERNEL::NORM_POLYGON,conn.size(),&conn[0]);
+ mesh2D->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(conn.size()),&conn[0]);
else
{
const double *coo(mesh2D->getCoords()->begin());
std::size_t sz(conn.size());
std::vector<double> addCoo;
- std::vector<int> conn2(conn);
- int offset(mesh2D->getNumberOfNodes());
+ std::vector<mcIdType> conn2(conn);
+ mcIdType offset(mesh2D->getNumberOfNodes());
for(std::size_t i=0;i<sz;i++)
{
double tmp[2];
edges[(i+1)%sz]->getMiddleOfPoints(coo+2*conn[i],coo+2*conn[(i+1)%sz],tmp);// tony a chier i+1 -> i
addCoo.insert(addCoo.end(),tmp,tmp+2);
- conn2.push_back(offset+(int)i);
+ conn2.push_back(offset+ToIdType(i));
}
mesh2D->getCoords()->rearrange(1);
mesh2D->getCoords()->pushBackValsSilent(&addCoo[0],&addCoo[0]+addCoo.size());
mesh2D->getCoords()->rearrange(2);
- mesh2D->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,conn2.size(),&conn2[0]);
+ mesh2D->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,ToIdType(conn2.size()),&conn2[0]);
}
}
* This method cuts in 2 parts the input 2D cell given using boundaries description (\a edge1Bis and \a edge1BisPtr) using
* a set of edges defined in \a splitMesh1D.
*/
-void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vector<int>& edge1Bis, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edge1BisPtr,
- std::vector< std::vector<int> >& out0, std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& out1)
+void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vector<mcIdType>& edge1Bis, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edge1BisPtr,
+ std::vector< std::vector<mcIdType> >& out0, std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& out1)
{
std::size_t nb(edge1Bis.size()/2);
std::size_t nbOfEdgesOf2DCellSplit(nb/2);
- int iEnd(splitMesh1D->getNumberOfCells());
+ mcIdType iEnd=splitMesh1D->getNumberOfCells();
if(iEnd==0)
throw INTERP_KERNEL::Exception("BuildMesh2DCutInternal2 : internal error ! input 1D mesh must have at least one cell !");
std::size_t ii,jj;
- const int *cSplitPtr(splitMesh1D->getNodalConnectivity()->begin()),*ciSplitPtr(splitMesh1D->getNodalConnectivityIndex()->begin());
+ const mcIdType *cSplitPtr(splitMesh1D->getNodalConnectivity()->begin()),*ciSplitPtr(splitMesh1D->getNodalConnectivityIndex()->begin());
for(ii=0;ii<nb && edge1Bis[2*ii]!=cSplitPtr[ciSplitPtr[0]+1];ii++);
for(jj=ii;jj<nb && edge1Bis[2*jj+1]!=cSplitPtr[ciSplitPtr[iEnd-1]+2];jj++);
//
if(jj==nb)
{//the edges splitMesh1D[iStart:iEnd] does not fully cut the current 2D cell -> single output cell
out0.resize(1); out1.resize(1);
- std::vector<int>& connOut(out0[0]);
+ std::vector<mcIdType>& connOut(out0[0]);
connOut.resize(nbOfEdgesOf2DCellSplit);
std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr(out1[0]);
edgesPtr.resize(nbOfEdgesOf2DCellSplit);
{
// [i,iEnd[ contains the
out0.resize(2); out1.resize(2);
- std::vector<int>& connOutLeft(out0[0]);
- std::vector<int>& connOutRight(out0[1]);//connOutLeft should end with edge1Bis[2*ii] and connOutRight should end with edge1Bis[2*jj+1]
+ std::vector<mcIdType>& connOutLeft(out0[0]);
+ std::vector<mcIdType>& connOutRight(out0[1]);//connOutLeft should end with edge1Bis[2*ii] and connOutRight should end with edge1Bis[2*jj+1]
std::vector< MCAuto<INTERP_KERNEL::Edge> >& eleft(out1[0]);
std::vector< MCAuto<INTERP_KERNEL::Edge> >& eright(out1[1]);
for(std::size_t k=ii;k<jj+1;k++)
{ connOutLeft.push_back(edge1Bis[2*k+1]); eleft.push_back(edge1BisPtr[2*k+1]); }
std::vector< MCAuto<INTERP_KERNEL::Edge> > ees(iEnd);
- for(int ik=0;ik<iEnd;ik++)
+ for(mcIdType ik=0;ik<iEnd;ik++)
{
- std::map< MCAuto<INTERP_KERNEL::Node>,int> m;
+ std::map< MCAuto<INTERP_KERNEL::Node>,mcIdType> m;
MCAuto<INTERP_KERNEL::Edge> ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cSplitPtr[ciSplitPtr[ik]],cSplitPtr+ciSplitPtr[ik]+1,splitMesh1D->getCoords()->begin(),m));
ees[ik]=ee;
}
- for(int ik=iEnd-1;ik>=0;ik--)
+ for(mcIdType ik=iEnd-1;ik>=0;ik--)
connOutLeft.push_back(cSplitPtr[ciSplitPtr[ik]+1]);
for(std::size_t k=jj+1;k<nbOfEdgesOf2DCellSplit+ii;k++)
{ connOutRight.push_back(edge1Bis[2*k+1]); eright.push_back(edge1BisPtr[2*k+1]); }
eleft.insert(eleft.end(),ees.rbegin(),ees.rend());
- for(int ik=0;ik<iEnd;ik++)
+ for(mcIdType ik=0;ik<iEnd;ik++)
connOutRight.push_back(cSplitPtr[ciSplitPtr[ik]+2]);
eright.insert(eright.end(),ees.begin(),ees.end());
}
{
public:
CellInfo() { }
- CellInfo(const std::vector<int>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr);
+ CellInfo(const std::vector<mcIdType>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr);
public:
- std::vector<int> _edges;
+ std::vector<mcIdType> _edges;
std::vector< MCAuto<INTERP_KERNEL::Edge> > _edges_ptr;
};
-CellInfo::CellInfo(const std::vector<int>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr)
+CellInfo::CellInfo(const std::vector<mcIdType>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr)
{
std::size_t nbe(edges.size());
- std::vector<int> edges2(2*nbe); std::vector< MCAuto<INTERP_KERNEL::Edge> > edgesPtr2(2*nbe);
+ std::vector<mcIdType> edges2(2*nbe); std::vector< MCAuto<INTERP_KERNEL::Edge> > edgesPtr2(2*nbe);
for(std::size_t i=0;i<nbe;i++)
{
edges2[2*i]=edges[i]; edges2[2*i+1]=edges[(i+1)%nbe];
class EdgeInfo
{
public:
- EdgeInfo(int istart, int iend, const MCAuto<MEDCouplingUMesh>& mesh):_istart(istart),_iend(iend),_mesh(mesh),_left(-7),_right(-7) { }
- EdgeInfo(int istart, int iend, int pos, const MCAuto<INTERP_KERNEL::Edge>& edge):_istart(istart),_iend(iend),_edge(edge),_left(pos),_right(pos+1) { }
- bool isInMyRange(int pos) const { return pos>=_istart && pos<_iend; }
- void somethingHappendAt(int pos, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newRight);
- void feedEdgeInfoAt(double eps, const MEDCouplingUMesh *mesh2D, int offset, int neighbors[2]) const;
+ EdgeInfo(mcIdType istart, mcIdType iend, const MCAuto<MEDCouplingUMesh>& mesh):_istart(istart),_iend(iend),_mesh(mesh),_left(-7),_right(-7) { }
+ EdgeInfo(mcIdType istart, mcIdType iend, mcIdType pos, const MCAuto<INTERP_KERNEL::Edge>& edge):_istart(istart),_iend(iend),_edge(edge),_left(pos),_right(pos+1) { }
+ bool isInMyRange(mcIdType pos) const { return pos>=_istart && pos<_iend; }
+ void somethingHappendAt(mcIdType pos, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newRight);
+ void feedEdgeInfoAt(double eps, const MEDCouplingUMesh *mesh2D, mcIdType offset, mcIdType neighbors[2]) const;
private:
- int _istart;
- int _iend;
+ mcIdType _istart;
+ mcIdType _iend;
MCAuto<MEDCouplingUMesh> _mesh;
MCAuto<INTERP_KERNEL::Edge> _edge;
- int _left; // index (local numbering) of the left 2D cell bordering the edge '_edge'
- int _right; // same as above, right side.
+ mcIdType _left; // index (local numbering) of the left 2D cell bordering the edge '_edge'
+ mcIdType _right; // same as above, right side.
};
/*
* Update indices of left and right 2D cell bordering the current edge.
*/
-void EdgeInfo::somethingHappendAt(int pos, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newRight)
+void EdgeInfo::somethingHappendAt(mcIdType pos, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newRight)
{
const MEDCouplingUMesh *mesh(_mesh);
if(mesh)
}
}
-void EdgeInfo::feedEdgeInfoAt(double eps, const MEDCouplingUMesh *mesh2D, int offset, int neighbors[2]) const
+void EdgeInfo::feedEdgeInfoAt(double eps, const MEDCouplingUMesh *mesh2D, mcIdType offset, mcIdType neighbors[2]) const
{
const MEDCouplingUMesh *mesh(_mesh);
if(!mesh)
else
{
MCAuto<DataArrayDouble> barys(mesh->computeCellCenterOfMass());
- int cellId(mesh2D->getCellContainingPoint(barys->begin(),eps));
+ mcIdType cellId(mesh2D->getCellContainingPoint(barys->begin(),eps));
if(cellId==-1)
throw INTERP_KERNEL::Exception("EdgeInfo::feedEdgeInfoAt : internal error !");
neighbors[0]=offset+cellId; neighbors[1]=offset+cellId;
class VectorOfCellInfo
{
public:
- VectorOfCellInfo(const std::vector<int>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr);
+ VectorOfCellInfo(const std::vector<mcIdType>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr);
std::size_t size() const { return _pool.size(); }
- int getPositionOf(double eps, const MEDCouplingUMesh *mesh) const;
- void setMeshAt(std::size_t pos, const MCAuto<MEDCouplingUMesh>& mesh, int istart, int iend, const MCAuto<MEDCouplingUMesh>& mesh1DInCase, const std::vector< std::vector<int> >& edges, const std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& edgePtrs);
- const std::vector<int>& getConnOf(int pos) const { return get(pos)._edges; }
- const std::vector< MCAuto<INTERP_KERNEL::Edge> >& getEdgePtrOf(int pos) const { return get(pos)._edges_ptr; }
+ mcIdType getPositionOf(double eps, const MEDCouplingUMesh *mesh) const;
+ void setMeshAt(mcIdType pos, const MCAuto<MEDCouplingUMesh>& mesh, mcIdType istart, mcIdType iend, const MCAuto<MEDCouplingUMesh>& mesh1DInCase, const std::vector< std::vector<mcIdType> >& edges, const std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& edgePtrs);
+ const std::vector<mcIdType>& getConnOf(mcIdType pos) const { return get(pos)._edges; }
+ const std::vector< MCAuto<INTERP_KERNEL::Edge> >& getEdgePtrOf(mcIdType pos) const { return get(pos)._edges_ptr; }
MCAuto<MEDCouplingUMesh> getZeMesh() const { return _ze_mesh; }
- void feedEdgeInfoAt(double eps, int pos, int offset, int neighbors[2]) const;
+ void feedEdgeInfoAt(double eps, mcIdType pos, mcIdType offset, mcIdType neighbors[2]) const;
private:
- int getZePosOfEdgeGivenItsGlobalId(int pos) const;
- void updateEdgeInfo(int pos, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newRight);
- const CellInfo& get(int pos) const;
- CellInfo& get(int pos);
+ mcIdType getZePosOfEdgeGivenItsGlobalId(mcIdType pos) const;
+ void updateEdgeInfo(mcIdType pos, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newRight);
+ const CellInfo& get(mcIdType pos) const;
+ CellInfo& get(mcIdType pos);
private:
- std::vector<CellInfo> _pool; // for a newly created 2D cell, the list of edges (int) and edges ptr constiuing it
+ std::vector<CellInfo> _pool; // for a newly created 2D cell, the list of edges ToIdType( and edges ptr constiuing it
MCAuto<MEDCouplingUMesh> _ze_mesh; // the aggregated mesh
std::vector<EdgeInfo> _edge_info; // for each new edge added when cuting the 2D cell, the information on left and right bordering 2D cell
};
-VectorOfCellInfo::VectorOfCellInfo(const std::vector<int>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr):_pool(1)
+VectorOfCellInfo::VectorOfCellInfo(const std::vector<mcIdType>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr):_pool(1)
{
_pool[0]._edges=edges;
_pool[0]._edges_ptr=edgesPtr;
}
-int VectorOfCellInfo::getPositionOf(double eps, const MEDCouplingUMesh *mesh) const
+mcIdType VectorOfCellInfo::getPositionOf(double eps, const MEDCouplingUMesh *mesh) const
{
if(_pool.empty())
throw INTERP_KERNEL::Exception("VectorOfCellSplitter::getPositionOf : empty !");
return zeMesh->getCellContainingPoint(barys->begin(),eps);
}
-void VectorOfCellInfo::setMeshAt(std::size_t pos, const MCAuto<MEDCouplingUMesh>& mesh, int istart, int iend,
- const MCAuto<MEDCouplingUMesh>& mesh1DInCase, const std::vector< std::vector<int> >& edges,
+void VectorOfCellInfo::setMeshAt(mcIdType pos, const MCAuto<MEDCouplingUMesh>& mesh, mcIdType istart, mcIdType iend,
+ const MCAuto<MEDCouplingUMesh>& mesh1DInCase, const std::vector< std::vector<mcIdType> >& edges,
const std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& edgePtrs)
{
get(pos);//to check pos
_edge_info.push_back(EdgeInfo(istart,iend,pos,edgePtrs[0].back()));
//
std::vector<CellInfo> pool(_pool.size()-1+sz);
- for(std::size_t i=0;i<pos;i++)
+ for(mcIdType i=0;i<pos;i++)
pool[i]=_pool[i];
for(std::size_t j=0;j<sz;j++)
pool[pos+j]=CellInfo(edges[j],edgePtrs[j]);
- for(int i=pos+1;i<(int)_pool.size();i++)
+ for(std::size_t i=pos+1;i<_pool.size();i++)
pool[i+sz-1]=_pool[i];
_pool=pool;
//
_ze_mesh=MEDCouplingUMesh::MergeUMeshesOnSameCoords(ms2);
}
-void VectorOfCellInfo::feedEdgeInfoAt(double eps, int pos, int offset, int neighbors[2]) const
+void VectorOfCellInfo::feedEdgeInfoAt(double eps, mcIdType pos, mcIdType offset, mcIdType neighbors[2]) const
{
_edge_info[getZePosOfEdgeGivenItsGlobalId(pos)].feedEdgeInfoAt(eps,_ze_mesh,offset,neighbors);
}
-int VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId(int pos) const
+mcIdType VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId(mcIdType pos) const
{
if(pos<0)
throw INTERP_KERNEL::Exception("VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId : invalid id ! Must be >=0 !");
- int ret(0);
+ mcIdType ret(0);
for(std::vector<EdgeInfo>::const_iterator it=_edge_info.begin();it!=_edge_info.end();it++,ret++)
{
if((*it).isInMyRange(pos))
throw INTERP_KERNEL::Exception("VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId : invalid id !");
}
-void VectorOfCellInfo::updateEdgeInfo(int pos, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newRight)
+void VectorOfCellInfo::updateEdgeInfo(mcIdType pos, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newRight)
{
get(pos);//to perform the sanity check;
if(_edge_info.empty())
_edge_info[i].somethingHappendAt(pos,newLeft,newRight);
}
-const CellInfo& VectorOfCellInfo::get(int pos) const
+const CellInfo& VectorOfCellInfo::get(mcIdType pos) const
{
- if(pos<0 || pos>=(int)_pool.size())
+ if(pos<0 || pos>=ToIdType(_pool.size()))
throw INTERP_KERNEL::Exception("VectorOfCellSplitter::get const : invalid pos !");
return _pool[pos];
}
-CellInfo& VectorOfCellInfo::get(int pos)
+CellInfo& VectorOfCellInfo::get(mcIdType pos)
{
- if(pos<0 || pos>=(int)_pool.size())
+ if(pos<0 || pos>=ToIdType(_pool.size()))
throw INTERP_KERNEL::Exception("VectorOfCellSplitter::get : invalid pos !");
return _pool[pos];
}
*
* \param [in] allEdges a list of pairs (beginNode, endNode). Represents all edges (already cut) in the single 2D cell being handled here. Linked with \a allEdgesPtr to get the equation of edge.
*/
-MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, MEDCouplingUMesh *splitMesh1D, const std::vector<int>& allEdges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& allEdgesPtr, int offset,
- MCAuto<DataArrayInt>& idsLeftRight)
+MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, MEDCouplingUMesh *splitMesh1D, const std::vector<mcIdType>& allEdges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& allEdgesPtr, mcIdType offset,
+ MCAuto<DataArrayIdType>& idsLeftRight)
{
- int nbCellsInSplitMesh1D(splitMesh1D->getNumberOfCells());
+ mcIdType nbCellsInSplitMesh1D=splitMesh1D->getNumberOfCells();
if(nbCellsInSplitMesh1D==0)
throw INTERP_KERNEL::Exception("BuildMesh2DCutInternal : internal error ! input 1D mesh must have at least one cell !");
- const int *cSplitPtr(splitMesh1D->getNodalConnectivity()->begin()),*ciSplitPtr(splitMesh1D->getNodalConnectivityIndex()->begin());
+ const mcIdType *cSplitPtr(splitMesh1D->getNodalConnectivity()->begin()),*ciSplitPtr(splitMesh1D->getNodalConnectivityIndex()->begin());
std::size_t nb(allEdges.size()),jj;
if(nb%2!=0)
throw INTERP_KERNEL::Exception("BuildMesh2DCutFrom : internal error 2 !");
- std::vector<int> edge1Bis(nb*2);
+ std::vector<mcIdType> edge1Bis(nb*2);
std::vector< MCAuto<INTERP_KERNEL::Edge> > edge1BisPtr(nb*2);
std::copy(allEdges.begin(),allEdges.end(),edge1Bis.begin());
std::copy(allEdges.begin(),allEdges.end(),edge1Bis.begin()+nb);
std::copy(allEdgesPtr.begin(),allEdgesPtr.end(),edge1BisPtr.begin());
std::copy(allEdgesPtr.begin(),allEdgesPtr.end(),edge1BisPtr.begin()+nb);
//
- idsLeftRight=DataArrayInt::New(); idsLeftRight->alloc(nbCellsInSplitMesh1D*2); idsLeftRight->fillWithValue(-2); idsLeftRight->rearrange(2);
- int *idsLeftRightPtr(idsLeftRight->getPointer());
+ idsLeftRight=DataArrayIdType::New(); idsLeftRight->alloc(nbCellsInSplitMesh1D*2); idsLeftRight->fillWithValue(-2); idsLeftRight->rearrange(2);
+ mcIdType *idsLeftRightPtr(idsLeftRight->getPointer());
VectorOfCellInfo pool(edge1Bis,edge1BisPtr);
// Compute contiguous parts of splitMesh1D. We can not make the full assumption that segments are consecutive in the connectivity
// (even if the user correctly called orderConsecutiveCells1D()). Indeed the tool might be a closed line whose junction point is in
// splitMesh1D. There can be only one such a point, and if this happens this is necessarily at the start
// of the connectivity.
- MCAuto <DataArrayInt> renumb(DataArrayInt::New());
+ MCAuto <DataArrayIdType> renumb(DataArrayIdType::New());
renumb->alloc(nbCellsInSplitMesh1D,1);
- const int * renumbP(renumb->begin());
+ const mcIdType * renumbP(renumb->begin());
- int i, first=cSplitPtr[1];
+ mcIdType i, first=cSplitPtr[1];
// Follow 1D line backward as long as it is connected:
for (i=nbCellsInSplitMesh1D-1; cSplitPtr[ciSplitPtr[i]+2] == first; i--)
first=cSplitPtr[ciSplitPtr[i]+1];
// pool. The neighbourhood information detained by pool._edge_info is also updated so that left and right
// adjacent 2D cell of a 1D piece is kept up to date.
// And so on and so forth.
- for(int iStart=0;iStart<nbCellsInSplitMesh1D;)
+ for(mcIdType iStart=0;iStart<nbCellsInSplitMesh1D;)
{// split [0:nbCellsInSplitMesh1D) in contiguous parts [iStart:iEnd)
- int iEnd(iStart);
+ mcIdType iEnd(iStart);
for(;iEnd<nbCellsInSplitMesh1D;)
{
for(jj=0;jj<nb && edge1Bis[2*jj+1]!=cSplitPtr[ciSplitPtr[iEnd]+2];jj++);
iEnd++;
MCAuto<MEDCouplingUMesh> partOfSplitMesh1D(static_cast<MEDCouplingUMesh *>(splitMesh1D->buildPartOfMySelfSlice(iStart,iEnd,1,true)));
- int pos(pool.getPositionOf(eps,partOfSplitMesh1D));
+ mcIdType pos(pool.getPositionOf(eps,partOfSplitMesh1D));
//
MCAuto<MEDCouplingUMesh>retTmp(MEDCouplingUMesh::New("",2));
retTmp->setCoords(splitMesh1D->getCoords());
retTmp->allocateCells();
- std::vector< std::vector<int> > out0;
+ std::vector< std::vector<mcIdType> > out0;
std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > > out1;
BuildMesh2DCutInternal2(partOfSplitMesh1D,pool.getConnOf(pos),pool.getEdgePtrOf(pos),out0,out1);
//
iStart=iEnd;
}
- for(int mm=0;mm<nbCellsInSplitMesh1D;mm++)
+ for(mcIdType mm=0;mm<nbCellsInSplitMesh1D;mm++)
pool.feedEdgeInfoAt(eps,renumbP[mm],offset,idsLeftRightPtr+2*mm);
return pool.getZeMesh().retn();
/*
* splitMesh1D is an input parameter but might have its cells renumbered.
*/
-MEDCouplingUMesh *BuildMesh2DCutFrom(double eps, int cellIdInMesh2D, const MEDCouplingUMesh *mesh2DDesc, MEDCouplingUMesh *splitMesh1D,
- const int *descBg, const int *descEnd, const std::vector< std::vector<int> >& intersectEdge1, int offset,
- MCAuto<DataArrayInt>& idsLeftRight)
+MEDCouplingUMesh *BuildMesh2DCutFrom(double eps, mcIdType cellIdInMesh2D, const MEDCouplingUMesh *mesh2DDesc, MEDCouplingUMesh *splitMesh1D,
+ const mcIdType *descBg, const mcIdType *descEnd, const std::vector< std::vector<mcIdType> >& intersectEdge1, mcIdType offset,
+ MCAuto<DataArrayIdType>& idsLeftRight)
{
- const int *cdescPtr(mesh2DDesc->getNodalConnectivity()->begin()),*cidescPtr(mesh2DDesc->getNodalConnectivityIndex()->begin());
+ const mcIdType *cdescPtr(mesh2DDesc->getNodalConnectivity()->begin()),*cidescPtr(mesh2DDesc->getNodalConnectivityIndex()->begin());
//
- std::vector<int> allEdges;
+ std::vector<mcIdType> allEdges;
std::vector< MCAuto<INTERP_KERNEL::Edge> > allEdgesPtr; // for each sub edge in splitMesh2D the uncut Edge object of the original mesh2D
- for(const int *it(descBg);it!=descEnd;it++) // for all edges in the descending connectivity of the 2D mesh in relative Fortran mode
+ for(const mcIdType *it(descBg);it!=descEnd;it++) // for all edges in the descending connectivity of the 2D mesh in relative Fortran mode
{
- int edgeId(std::abs(*it)-1);
- std::map< MCAuto<INTERP_KERNEL::Node>,int> m;
+ mcIdType edgeId(std::abs(*it)-1);
+ std::map< MCAuto<INTERP_KERNEL::Node>,mcIdType> m;
MCAuto<INTERP_KERNEL::Edge> ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cdescPtr[cidescPtr[edgeId]],cdescPtr+cidescPtr[edgeId]+1,mesh2DDesc->getCoords()->begin(),m));
- const std::vector<int>& edge1(intersectEdge1[edgeId]);
+ const std::vector<mcIdType>& edge1(intersectEdge1[edgeId]);
if(*it>0)
allEdges.insert(allEdges.end(),edge1.begin(),edge1.end());
else
return BuildMesh2DCutInternal(eps,splitMesh1D,allEdges,allEdgesPtr,offset,idsLeftRight);
}
-bool AreEdgeEqual(const double *coo2D, const INTERP_KERNEL::CellModel& typ1, const int *conn1, const INTERP_KERNEL::CellModel& typ2, const int *conn2, double eps)
+bool AreEdgeEqual(const double *coo2D, const INTERP_KERNEL::CellModel& typ1, const mcIdType *conn1, const INTERP_KERNEL::CellModel& typ2, const mcIdType *conn2, double eps)
{
if(!typ1.isQuadratic() && !typ2.isQuadratic())
{//easy case comparison not
*
* \param [in] cellIdInMesh1DSplitRelative is in Fortran mode using sign to specify direction.
*/
-int FindRightCandidateAmong(const MEDCouplingUMesh *mesh2DSplit, const int *candidatesIn2DBg, const int *candidatesIn2DEnd, const MEDCouplingUMesh *mesh1DSplit, int cellIdInMesh1DSplitRelative, double eps)
+mcIdType FindRightCandidateAmong(const MEDCouplingUMesh *mesh2DSplit, const mcIdType *candidatesIn2DBg, const mcIdType *candidatesIn2DEnd, const MEDCouplingUMesh *mesh1DSplit, mcIdType cellIdInMesh1DSplitRelative, double eps)
{
if(candidatesIn2DEnd==candidatesIn2DBg)
throw INTERP_KERNEL::Exception("FindRightCandidateAmong : internal error 1 !");
const double *coo(mesh2DSplit->getCoords()->begin());
if(std::distance(candidatesIn2DBg,candidatesIn2DEnd)==1)
return *candidatesIn2DBg;
- int edgeId(std::abs(cellIdInMesh1DSplitRelative)-1);
+ mcIdType edgeId(std::abs(cellIdInMesh1DSplitRelative)-1);
MCAuto<MEDCouplingUMesh> cur1D(static_cast<MEDCouplingUMesh *>(mesh1DSplit->buildPartOfMySelf(&edgeId,&edgeId+1,true)));
if(cellIdInMesh1DSplitRelative<0)
cur1D->changeOrientationOfCells();
- const int *c1D(cur1D->getNodalConnectivity()->begin());
+ const mcIdType *c1D(cur1D->getNodalConnectivity()->begin());
const INTERP_KERNEL::CellModel& ref1DType(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c1D[0]));
- for(const int *it=candidatesIn2DBg;it!=candidatesIn2DEnd;it++)
+ for(const mcIdType *it=candidatesIn2DBg;it!=candidatesIn2DEnd;it++)
{
MCAuto<MEDCouplingUMesh> cur2D(static_cast<MEDCouplingUMesh *>(mesh2DSplit->buildPartOfMySelf(it,it+1,true)));
- const int *c(cur2D->getNodalConnectivity()->begin()),*ci(cur2D->getNodalConnectivityIndex()->begin());
+ const mcIdType *c(cur2D->getNodalConnectivity()->begin()),*ci(cur2D->getNodalConnectivityIndex()->begin());
const INTERP_KERNEL::CellModel &cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c[ci[0]]));
unsigned sz(cm.getNumberOfSons2(c+ci[0]+1,ci[1]-ci[0]-1));
- INTERP_KERNEL::AutoPtr<int> tmpPtr(new int[ci[1]-ci[0]]);
+ INTERP_KERNEL::AutoPtr<mcIdType> tmpPtr(new mcIdType[ci[1]-ci[0]]);
for(unsigned it2=0;it2<sz;it2++)
{
INTERP_KERNEL::NormalizedCellType typeOfSon;
}
/*!
- * \param [out] intersectEdge1 - for each cell in \a m1Desc returns the result of the split. The result is given using pair of int given resp start and stop.
+ * \param [out] intersectEdge1 - for each cell in \a m1Desc returns the result of the split. The result is given using pair of mcIdType given resp start and stop.
* So for all edge \a i in \a m1Desc \a intersectEdge1[i] is of length 2*n where n is the number of sub edges.
* And for each j in [1,n) intersect[i][2*(j-1)+1]==intersect[i][2*j].
* \param [out] subDiv2 - for each cell in \a m2Desc returns nodes that split it using convention \a m1Desc first, then \a m2Desc, then addCoo
* \param [out] mergedNodes - gives all pair of nodes of \a m2Desc that have same location than some nodes in \a m1Desc. key is id in \a m2Desc offsetted and value is id in \a m1Desc.
*/
void MEDCouplingUMesh::Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const MEDCouplingUMesh *m2Desc, double eps,
- std::vector< std::vector<int> >& intersectEdge1, std::vector< std::vector<int> >& colinear2, std::vector< std::vector<int> >& subDiv2, std::vector<double>& addCoo, std::map<int,int>& mergedNodes)
+ std::vector< std::vector<mcIdType> >& intersectEdge1, std::vector< std::vector<mcIdType> >& colinear2, std::vector< std::vector<mcIdType> >& subDiv2, std::vector<double>& addCoo, std::map<mcIdType,mcIdType>& mergedNodes)
{
static const int SPACEDIM=2;
INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
- const int *c1(m1Desc->getNodalConnectivity()->begin()),*ci1(m1Desc->getNodalConnectivityIndex()->begin());
+ const mcIdType *c1(m1Desc->getNodalConnectivity()->begin()),*ci1(m1Desc->getNodalConnectivityIndex()->begin());
// Build BB tree of all edges in the tool mesh (second mesh)
MCAuto<DataArrayDouble> bbox1Arr(m1Desc->getBoundingBoxForBBTree(eps)),bbox2Arr(m2Desc->getBoundingBoxForBBTree(eps));
const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin());
- int nDescCell1(m1Desc->getNumberOfCells()),nDescCell2(m2Desc->getNumberOfCells());
+ mcIdType nDescCell1=m1Desc->getNumberOfCells(),nDescCell2=m2Desc->getNumberOfCells();
intersectEdge1.resize(nDescCell1);
colinear2.resize(nDescCell2);
subDiv2.resize(nDescCell2);
- BBTree<SPACEDIM,int> myTree(bbox2,0,0,m2Desc->getNumberOfCells(),-eps);
- BBTreePts<SPACEDIM,int> treeNodes2(m2Desc->getCoords()->begin(),0,0,m2Desc->getCoords()->getNumberOfTuples(),eps);
+ BBTree<SPACEDIM,mcIdType> myTree(bbox2,0,0,m2Desc->getNumberOfCells(),-eps);
+ BBTreePts<SPACEDIM,mcIdType> treeNodes2(m2Desc->getCoords()->begin(),0,0,m2Desc->getCoords()->getNumberOfTuples(),eps);
- std::vector<int> candidates1(1);
- int offset1(m1Desc->getNumberOfNodes());
- int offset2(offset1+m2Desc->getNumberOfNodes());
- for(int i=0;i<nDescCell1;i++) // for all edges in the first mesh
+ std::vector<mcIdType> candidates1(1);
+ mcIdType offset1(m1Desc->getNumberOfNodes());
+ mcIdType offset2(offset1+m2Desc->getNumberOfNodes());
+ for(mcIdType i=0;i<nDescCell1;i++) // for all edges in the first mesh
{
- std::vector<int> candidates2; // edges of mesh2 candidate for intersection
+ std::vector<mcIdType> candidates2; // edges of mesh2 candidate for intersection
myTree.getIntersectingElems(bbox1+i*2*SPACEDIM,candidates2);
if(!candidates2.empty()) // candidates2 holds edges from the second mesh potentially intersecting current edge i in mesh1
{
- std::map<INTERP_KERNEL::Node *,int> map1,map2;
- std::map<int, INTERP_KERNEL::Node *> revMap2;
+ std::map<INTERP_KERNEL::Node *,mcIdType> map1,map2;
+ std::map<mcIdType, INTERP_KERNEL::Node *> revMap2;
// pol2 is not necessarily a closed polygon: just a set of (quadratic) edges (same as candidates2) in the Geometric DS format
INTERP_KERNEL::QuadraticPolygon *pol2=MEDCouplingUMeshBuildQPFromMesh(m2Desc,candidates2,map2);
// Build revMap2
* Documentation about parameters colinear2 and subDiv2 can be found in method QuadraticPolygon::splitAbs().
*/
void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps,
- std::vector< std::vector<int> >& intersectEdge1, std::vector< std::vector<int> >& colinear2, std::vector< std::vector<int> >& subDiv2,
- MEDCouplingUMesh *& m1Desc, DataArrayInt *&desc1, DataArrayInt *&descIndx1, DataArrayInt *&revDesc1, DataArrayInt *&revDescIndx1,
+ std::vector< std::vector<mcIdType> >& intersectEdge1, std::vector< std::vector<mcIdType> >& colinear2, std::vector< std::vector<mcIdType> >& subDiv2,
+ MEDCouplingUMesh *& m1Desc, DataArrayIdType *&desc1, DataArrayIdType *&descIndx1, DataArrayIdType *&revDesc1, DataArrayIdType *&revDescIndx1,
std::vector<double>& addCoo,
- MEDCouplingUMesh *& m2Desc, DataArrayInt *&desc2, DataArrayInt *&descIndx2, DataArrayInt *&revDesc2, DataArrayInt *&revDescIndx2)
+ MEDCouplingUMesh *& m2Desc, DataArrayIdType *&desc2, DataArrayIdType *&descIndx2, DataArrayIdType *&revDesc2, DataArrayIdType *&revDescIndx2)
{
// Build desc connectivity
- desc1=DataArrayInt::New(); descIndx1=DataArrayInt::New(); revDesc1=DataArrayInt::New(); revDescIndx1=DataArrayInt::New();
- desc2=DataArrayInt::New();
- descIndx2=DataArrayInt::New();
- revDesc2=DataArrayInt::New();
- revDescIndx2=DataArrayInt::New();
- MCAuto<DataArrayInt> dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1);
- MCAuto<DataArrayInt> dd5(desc2),dd6(descIndx2),dd7(revDesc2),dd8(revDescIndx2);
+ desc1=DataArrayIdType::New(); descIndx1=DataArrayIdType::New(); revDesc1=DataArrayIdType::New(); revDescIndx1=DataArrayIdType::New();
+ desc2=DataArrayIdType::New();
+ descIndx2=DataArrayIdType::New();
+ revDesc2=DataArrayIdType::New();
+ revDescIndx2=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1);
+ MCAuto<DataArrayIdType> dd5(desc2),dd6(descIndx2),dd7(revDesc2),dd8(revDescIndx2);
m1Desc=m1->buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1);
m2Desc=m2->buildDescendingConnectivity2(desc2,descIndx2,revDesc2,revDescIndx2);
MCAuto<MEDCouplingUMesh> dd9(m1Desc),dd10(m2Desc);
- std::map<int,int> notUsedMap;
+ std::map<mcIdType,mcIdType> notUsedMap;
Intersect1DMeshes(m1Desc,m2Desc,eps,intersectEdge1,colinear2,subDiv2,addCoo,notUsedMap);
m1Desc->incrRef(); desc1->incrRef(); descIndx1->incrRef(); revDesc1->incrRef(); revDescIndx1->incrRef();
m2Desc->incrRef(); desc2->incrRef(); descIndx2->incrRef(); revDesc2->incrRef(); revDescIndx2->incrRef();
* @param[out] cNb1, cNb2 correspondence arrays giving for the merged mesh the initial cells IDs in m1 / m2
* TODO: describe input parameters
*/
-void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const int *desc1, const int *descIndx1,
- const std::vector<std::vector<int> >& intesctEdges1, const std::vector< std::vector<int> >& colinear2,
- const MEDCouplingUMesh *m2, const int *desc2, const int *descIndx2, const std::vector<std::vector<int> >& intesctEdges2,
+void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const mcIdType *desc1, const mcIdType *descIndx1,
+ const std::vector<std::vector<mcIdType> >& intesctEdges1, const std::vector< std::vector<mcIdType> >& colinear2,
+ const MEDCouplingUMesh *m2, const mcIdType *desc2, const mcIdType *descIndx2, const std::vector<std::vector<mcIdType> >& intesctEdges2,
const std::vector<double>& addCoords,
- std::vector<double>& addCoordsQuadratic, std::vector<int>& cr, std::vector<int>& crI, std::vector<int>& cNb1, std::vector<int>& cNb2)
+ std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& cr, std::vector<mcIdType>& crI, std::vector<mcIdType>& cNb1, std::vector<mcIdType>& cNb2)
{
static const int SPACEDIM=2;
const double *coo1(m1->getCoords()->begin());
- const int *conn1(m1->getNodalConnectivity()->begin()),*connI1(m1->getNodalConnectivityIndex()->begin());
- int offset1(m1->getNumberOfNodes());
+ const mcIdType *conn1(m1->getNodalConnectivity()->begin()),*connI1(m1->getNodalConnectivityIndex()->begin());
+ mcIdType offset1(m1->getNumberOfNodes());
const double *coo2(m2->getCoords()->begin());
- const int *conn2(m2->getNodalConnectivity()->begin()),*connI2(m2->getNodalConnectivityIndex()->begin());
- int offset2(offset1+m2->getNumberOfNodes());
- int offset3(offset2+((int)addCoords.size())/2);
+ const mcIdType *conn2(m2->getNodalConnectivity()->begin()),*connI2(m2->getNodalConnectivityIndex()->begin());
+ mcIdType offset2(offset1+m2->getNumberOfNodes());
+ mcIdType offset3(offset2+ToIdType(addCoords.size())/2);
MCAuto<DataArrayDouble> bbox1Arr(m1->getBoundingBoxForBBTree(eps)),bbox2Arr(m2->getBoundingBoxForBBTree(eps));
const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin());
// Here a BBTree on 2D-cells, not on segments:
- BBTree<SPACEDIM,int> myTree(bbox2,0,0,m2->getNumberOfCells(),eps);
- int ncell1(m1->getNumberOfCells());
+ BBTree<SPACEDIM,mcIdType> myTree(bbox2,0,0,m2->getNumberOfCells(),eps);
+ mcIdType ncell1=m1->getNumberOfCells();
crI.push_back(0);
- for(int i=0;i<ncell1;i++)
+ for(mcIdType i=0;i<ncell1;i++)
{
- std::vector<int> candidates2;
+ std::vector<mcIdType> candidates2;
myTree.getIntersectingElems(bbox1+i*2*SPACEDIM,candidates2);
- std::map<INTERP_KERNEL::Node *,int> mapp;
- std::map<int,INTERP_KERNEL::Node *> mappRev;
+ std::map<INTERP_KERNEL::Node *,mcIdType> mapp;
+ std::map<mcIdType,INTERP_KERNEL::Node *> mappRev;
INTERP_KERNEL::QuadraticPolygon pol1;
INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)conn1[connI1[i]];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
for(it1.first();!it1.finished();it1.next())
edges1.insert(it1.current()->getPtr());
//
- std::map<int,std::vector<INTERP_KERNEL::ElementaryEdge *> > edgesIn2ForShare; // common edges
+ std::map<mcIdType,std::vector<INTERP_KERNEL::ElementaryEdge *> > edgesIn2ForShare; // common edges
std::vector<INTERP_KERNEL::QuadraticPolygon> pol2s(candidates2.size());
- int ii=0;
+ mcIdType ii=0;
// Build, for each intersecting cell candidate from mesh2, the corresponding QP.
// Again all the additional intersecting nodes are there.
- for(std::vector<int>::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++)
+ for(std::vector<mcIdType>::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++)
{
INTERP_KERNEL::NormalizedCellType typ2=(INTERP_KERNEL::NormalizedCellType)conn2[connI2[*it2]];
const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel(typ2);
///
ii=0;
// Now rebuild intersected cells from all this:
- for(std::vector<int>::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++)
+ for(std::vector<mcIdType>::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++)
{
INTERP_KERNEL::ComposedEdge::InitLocationsWithOther(pol1,pol2s[ii]);
pol2s[ii].updateLocOfEdgeFromCrudeDataArray2(desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,pol1,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,colinear2);
throw INTERP_KERNEL::Exception(oss.str());
}
}
- for(std::map<int,INTERP_KERNEL::Node *>::const_iterator it=mappRev.begin();it!=mappRev.end();it++)
+ for(std::map<mcIdType,INTERP_KERNEL::Node *>::const_iterator it=mappRev.begin();it!=mappRev.end();it++)
(*it).second->decrRef();
}
}
-void InsertNodeInConnIfNecessary(int nodeIdToInsert, std::vector<int>& conn, const double *coords, double eps)
+void InsertNodeInConnIfNecessary(mcIdType nodeIdToInsert, std::vector<mcIdType>& conn, const double *coords, double eps)
{
- std::vector<int>::iterator it(std::find(conn.begin(),conn.end(),nodeIdToInsert));
+ std::vector<mcIdType>::iterator it(std::find(conn.begin(),conn.end(),nodeIdToInsert));
if(it!=conn.end())
return ;
std::size_t sz(conn.size());
std::size_t found(std::numeric_limits<std::size_t>::max());
for(std::size_t i=0;i<sz;i++)
{
- int pt0(conn[i]),pt1(conn[(i+1)%sz]);
+ mcIdType pt0(conn[i]),pt1(conn[(i+1)%sz]);
double v1[3]={coords[3*pt1+0]-coords[3*pt0+0],coords[3*pt1+1]-coords[3*pt0+1],coords[3*pt1+2]-coords[3*pt0+2]},v2[3]={coords[3*nodeIdToInsert+0]-coords[3*pt0+0],coords[3*nodeIdToInsert+1]-coords[3*pt0+1],coords[3*nodeIdToInsert+2]-coords[3*pt0+2]};
double normm(sqrt(v1[0]*v1[0]+v1[1]*v1[1]+v1[2]*v1[2]));
std::transform(v1,v1+3,v1,std::bind2nd(std::multiplies<double>(),1./normm));
conn.insert(conn.begin()+(found+1)%sz,nodeIdToInsert);
}
-void SplitIntoToPart(const std::vector<int>& conn, int pt0, int pt1, std::vector<int>& part0, std::vector<int>& part1)
+void SplitIntoToPart(const std::vector<mcIdType>& conn, mcIdType pt0, mcIdType pt1, std::vector<mcIdType>& part0, std::vector<mcIdType>& part1)
{
std::size_t sz(conn.size());
- std::vector<int> *curPart(&part0);
+ std::vector<mcIdType> *curPart(&part0);
for(std::size_t i=0;i<sz;i++)
{
- int nextt(conn[(i+1)%sz]);
+ mcIdType nextt(conn[(i+1)%sz]);
(*curPart).push_back(nextt);
if(nextt==pt0 || nextt==pt1)
{
/*!
* this method method splits cur cells 3D Surf in sub cells 3DSurf using the previous subsplit. This method is the last one used to clip.
*/
-void MEDCouplingUMesh::buildSubCellsFromCut(const std::vector< std::pair<int,int> >& cut3DSurf,
- const int *desc, const int *descIndx, const double *coords, double eps,
- std::vector<std::vector<int> >& res) const
+void MEDCouplingUMesh::buildSubCellsFromCut(const std::vector< std::pair<mcIdType,mcIdType> >& cut3DSurf,
+ const mcIdType *desc, const mcIdType *descIndx, const double *coords, double eps,
+ std::vector<std::vector<mcIdType> >& res) const
{
checkFullyDefined();
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSubCellsFromCut works on umeshes with meshdim equal to 3 and spaceDim equal to 3 too!");
- const int *nodal3D(_nodal_connec->begin()),*nodalIndx3D(_nodal_connec_index->begin());
- int nbOfCells(getNumberOfCells());
+ const mcIdType *nodal3D(_nodal_connec->begin()),*nodalIndx3D(_nodal_connec_index->begin());
+ mcIdType nbOfCells=getNumberOfCells();
if(nbOfCells!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSubCellsFromCut works only with single cell presently !");
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
- int offset(descIndx[i]),nbOfFaces(descIndx[i+1]-offset);
+ mcIdType offset(descIndx[i]),nbOfFaces(descIndx[i+1]-offset);
for(int j=0;j<nbOfFaces;j++)
{
- const std::pair<int,int>& p=cut3DSurf[desc[offset+j]];
+ const std::pair<mcIdType,mcIdType>& p=cut3DSurf[desc[offset+j]];
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)nodal3D[nodalIndx3D[i]]));
- int sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1;
- INTERP_KERNEL::AutoPtr<int> tmp(new int[sz]);
+ mcIdType sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp(new mcIdType[sz]);
INTERP_KERNEL::NormalizedCellType cmsId;
unsigned nbOfNodesSon(cm.fillSonCellNodalConnectivity2(j,nodal3D+nodalIndx3D[i]+1,sz,tmp,cmsId));
- std::vector<int> elt((int *)tmp,(int *)tmp+nbOfNodesSon);
+ std::vector<mcIdType> elt((mcIdType *)tmp,(mcIdType *)tmp+nbOfNodesSon);
if(p.first!=-1 && p.second!=-1)
{
if(p.first!=-2)
{
InsertNodeInConnIfNecessary(p.first,elt,coords,eps);
InsertNodeInConnIfNecessary(p.second,elt,coords,eps);
- std::vector<int> elt1,elt2;
+ std::vector<mcIdType> elt1,elt2;
SplitIntoToPart(elt,p.first,p.second,elt1,elt2);
res.push_back(elt1);
res.push_back(elt2);
*
* \sa MEDCouplingUMesh::split2DCells
*/
-void MEDCouplingUMesh::split2DCellsLinear(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI)
+void MEDCouplingUMesh::split2DCellsLinear(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI)
{
checkConnectivityFullyDefined();
- int ncells(getNumberOfCells()),lgthToReach(getNodalConnectivityArrayLen()+subNodesInSeg->getNumberOfTuples());
- MCAuto<DataArrayInt> c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach);
- const int *subPtr(subNodesInSeg->begin()),*subIPtr(subNodesInSegI->begin()),*descPtr(desc->begin()),*descIPtr(descI->begin()),*oldConn(getNodalConnectivity()->begin());
- int *cPtr(c->getPointer()),*ciPtr(getNodalConnectivityIndex()->getPointer());
- int prevPosOfCi(ciPtr[0]);
- for(int i=0;i<ncells;i++,ciPtr++,descIPtr++)
+ mcIdType ncells=getNumberOfCells();
+ mcIdType lgthToReach(getNodalConnectivityArrayLen()+subNodesInSeg->getNumberOfTuples());
+ MCAuto<DataArrayIdType> c(DataArrayIdType::New()); c->alloc((std::size_t)lgthToReach);
+ const mcIdType *subPtr(subNodesInSeg->begin()),*subIPtr(subNodesInSegI->begin()),*descPtr(desc->begin()),*descIPtr(descI->begin()),*oldConn(getNodalConnectivity()->begin());
+ mcIdType *cPtr(c->getPointer()),*ciPtr(getNodalConnectivityIndex()->getPointer());
+ mcIdType prevPosOfCi(ciPtr[0]);
+ for(mcIdType i=0;i<ncells;i++,ciPtr++,descIPtr++)
{
- int offset(descIPtr[0]),sz(descIPtr[1]-descIPtr[0]),deltaSz(0);
- *cPtr++=(int)INTERP_KERNEL::NORM_POLYGON; *cPtr++=oldConn[prevPosOfCi+1];
- for(int j=0;j<sz;j++)
+ mcIdType offset(descIPtr[0]),sz(descIPtr[1]-descIPtr[0]),deltaSz(0);
+ *cPtr++=ToIdType(INTERP_KERNEL::NORM_POLYGON); *cPtr++=oldConn[prevPosOfCi+1];
+ for(mcIdType j=0;j<sz;j++)
{
- int offset2(subIPtr[descPtr[offset+j]]),sz2(subIPtr[descPtr[offset+j]+1]-subIPtr[descPtr[offset+j]]);
- for(int k=0;k<sz2;k++)
+ mcIdType offset2(subIPtr[descPtr[offset+j]]),sz2(subIPtr[descPtr[offset+j]+1]-subIPtr[descPtr[offset+j]]);
+ for(mcIdType k=0;k<sz2;k++)
*cPtr++=subPtr[offset2+k];
if(j!=sz-1)
*cPtr++=oldConn[prevPosOfCi+j+2];
/*!
* It is the quadratic part of MEDCouplingUMesh::split2DCells. Here some additional nodes can be added at the end of coordinates array object.
*
- * \return int - the number of new nodes created.
+ * \return mcIdType - the number of new nodes created.
* \sa MEDCouplingUMesh::split2DCells
*/
-int MEDCouplingUMesh::split2DCellsQuadratic(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *mid, const DataArrayInt *midI)
+mcIdType MEDCouplingUMesh::split2DCellsQuadratic(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *mid, const DataArrayIdType *midI)
{
checkConsistencyLight();
- int ncells(getNumberOfCells()),lgthToReach(getNodalConnectivityArrayLen()+2*subNodesInSeg->getNumberOfTuples()),nodesCnt(getNumberOfNodes());
- MCAuto<DataArrayInt> c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach);
+ mcIdType ncells=getNumberOfCells();
+ mcIdType lgthToReach(getNodalConnectivityArrayLen()+2*subNodesInSeg->getNumberOfTuples());
+ mcIdType nodesCnt(getNumberOfNodes());
+ MCAuto<DataArrayIdType> c(DataArrayIdType::New()); c->alloc((std::size_t)lgthToReach);
MCAuto<DataArrayDouble> addCoo(DataArrayDouble::New()); addCoo->alloc(0,1);
- const int *subPtr(subNodesInSeg->begin()),*subIPtr(subNodesInSegI->begin()),*descPtr(desc->begin()),*descIPtr(descI->begin()),*oldConn(getNodalConnectivity()->begin());
- const int *midPtr(mid->begin()),*midIPtr(midI->begin());
+ const mcIdType *subPtr(subNodesInSeg->begin()),*subIPtr(subNodesInSegI->begin()),*descPtr(desc->begin()),*descIPtr(descI->begin()),*oldConn(getNodalConnectivity()->begin());
+ const mcIdType *midPtr(mid->begin()),*midIPtr(midI->begin());
const double *oldCoordsPtr(getCoords()->begin());
- int *cPtr(c->getPointer()),*ciPtr(getNodalConnectivityIndex()->getPointer());
- int prevPosOfCi(ciPtr[0]);
- for(int i=0;i<ncells;i++,ciPtr++,descIPtr++)
+ mcIdType *cPtr(c->getPointer()),*ciPtr(getNodalConnectivityIndex()->getPointer());
+ mcIdType prevPosOfCi(ciPtr[0]);
+ for(mcIdType i=0;i<ncells;i++,ciPtr++,descIPtr++)
{
- int offset(descIPtr[0]),sz(descIPtr[1]-descIPtr[0]),deltaSz(sz);
- for(int j=0;j<sz;j++)
- { int sz2(subIPtr[descPtr[offset+j]+1]-subIPtr[descPtr[offset+j]]); deltaSz+=sz2; }
- *cPtr++=(int)INTERP_KERNEL::NORM_QPOLYG; cPtr[0]=oldConn[prevPosOfCi+1];
- for(int j=0;j<sz;j++)//loop over subedges of oldConn
+ mcIdType offset(descIPtr[0]),sz(descIPtr[1]-descIPtr[0]),deltaSz(sz);
+ for(mcIdType j=0;j<sz;j++)
+ { mcIdType sz2(subIPtr[descPtr[offset+j]+1]-subIPtr[descPtr[offset+j]]); deltaSz+=sz2; }
+ *cPtr++=ToIdType(INTERP_KERNEL::NORM_QPOLYG); cPtr[0]=oldConn[prevPosOfCi+1];
+ for(mcIdType j=0;j<sz;j++)//loop over subedges of oldConn
{
- int offset2(subIPtr[descPtr[offset+j]]),sz2(subIPtr[descPtr[offset+j]+1]-subIPtr[descPtr[offset+j]]),offset3(midIPtr[descPtr[offset+j]]);
+ mcIdType offset2(subIPtr[descPtr[offset+j]]),sz2(subIPtr[descPtr[offset+j]+1]-subIPtr[descPtr[offset+j]]),offset3(midIPtr[descPtr[offset+j]]);
if(sz2==0)
{
if(j<sz-1)
ns[1]=new INTERP_KERNEL::Node(oldCoordsPtr[2*oldConn[prevPosOfCi+1+(1+j)%sz]],oldCoordsPtr[2*oldConn[prevPosOfCi+1+(1+j)%sz]+1]);
ns[2]=new INTERP_KERNEL::Node(oldCoordsPtr[2*oldConn[prevPosOfCi+1+sz+j]],oldCoordsPtr[2*oldConn[prevPosOfCi+1+sz+j]+1]);
MCAuto<INTERP_KERNEL::Edge> e(INTERP_KERNEL::QuadraticPolygon::BuildArcCircleEdge(ns));
- for(int k=0;k<sz2;k++)//loop over subsplit of current subedge
+ for(mcIdType k=0;k<sz2;k++)//loop over subsplit of current subedge
{
cPtr[1]=subPtr[offset2+k];
cPtr[deltaSz]=InternalAddPoint(e,midPtr[offset3+k],oldCoordsPtr,cPtr[0],cPtr[1],*addCoo,nodesCnt); cPtr++;
}
- int tmpEnd(oldConn[prevPosOfCi+1+(j+1)%sz]);
+ mcIdType tmpEnd(oldConn[prevPosOfCi+1+(j+1)%sz]);
if(j!=sz-1)
{ cPtr[1]=tmpEnd; }
cPtr[deltaSz]=InternalAddPoint(e,midPtr[offset3+sz2],oldCoordsPtr,cPtr[0],tmpEnd,*addCoo,nodesCnt); cPtr++;
* \param [in] m2 - the second input mesh which is a partition tool. The mesh must be so that each point in the space covered by \a m2
* must be covered exactly by one entity, \b no \b more. If it is not the case, some tools are available to heal the mesh (conformize2D, mergeNodes)
* \param [in] eps - precision used to detect coincident mesh entities.
- * \param [out] cellNb1 - a new instance of DataArrayInt holding for each result
+ * \param [out] cellNb1 - a new instance of DataArrayIdType holding for each result
* cell an id of the cell of \a m1 it comes from. The caller is to delete
* this array using decrRef() as it is no more needed.
- * \param [out] cellNb2 - a new instance of DataArrayInt holding for each result
+ * \param [out] cellNb2 - a new instance of DataArrayIdType holding for each result
* cell an id of the cell of \a m2 it comes from. -1 value means that a
* result cell comes from a cell (or part of cell) of \a m1 not overlapped by
* any cell of \a m2. The caller is to delete this array using decrRef() as
* \sa conformize2D, mergeNodes
*/
MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2,
- double eps, DataArrayInt *&cellNb1, DataArrayInt *&cellNb2)
+ double eps, DataArrayIdType *&cellNb1, DataArrayIdType *&cellNb2)
{
if(!m1 || !m2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshes : input meshes must be not NULL !");
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshes works on umeshes m1 AND m2 with meshdim equal to 2 and spaceDim equal to 2 too!");
// Step 1: compute all edge intersections (new nodes)
- std::vector< std::vector<int> > intersectEdge1, colinear2, subDiv2;
+ std::vector< std::vector<mcIdType> > intersectEdge1, colinear2, subDiv2;
MEDCouplingUMesh *m1Desc=0,*m2Desc=0; // descending connec. meshes
- DataArrayInt *desc1=0,*descIndx1=0,*revDesc1=0,*revDescIndx1=0,*desc2=0,*descIndx2=0,*revDesc2=0,*revDescIndx2=0;
+ DataArrayIdType *desc1=0,*descIndx1=0,*revDesc1=0,*revDescIndx1=0,*desc2=0,*descIndx2=0,*revDesc2=0,*revDescIndx2=0;
std::vector<double> addCoo,addCoordsQuadratic; // coordinates of newly created nodes
IntersectDescending2DMeshes(m1,m2,eps,intersectEdge1,colinear2, subDiv2,
m1Desc,desc1,descIndx1,revDesc1,revDescIndx1,
addCoo, m2Desc,desc2,descIndx2,revDesc2,revDescIndx2);
revDesc1->decrRef(); revDescIndx1->decrRef(); revDesc2->decrRef(); revDescIndx2->decrRef();
- MCAuto<DataArrayInt> dd1(desc1),dd2(descIndx1),dd3(desc2),dd4(descIndx2);
+ MCAuto<DataArrayIdType> dd1(desc1),dd2(descIndx1),dd3(desc2),dd4(descIndx2);
MCAuto<MEDCouplingUMesh> dd5(m1Desc),dd6(m2Desc);
// Step 2: re-order newly created nodes according to the ordering found in m2
- std::vector< std::vector<int> > intersectEdge2;
+ std::vector< std::vector<mcIdType> > intersectEdge2;
BuildIntersectEdges(m1Desc,m2Desc,addCoo,subDiv2,intersectEdge2);
subDiv2.clear(); dd5=0; dd6=0;
// Step 3:
- std::vector<int> cr,crI; //no DataArrayInt because interface with Geometric2D
- std::vector<int> cNb1,cNb2; //no DataArrayInt because interface with Geometric2D
+ std::vector<mcIdType> cr,crI; //no DataArrayIdType because interface with Geometric2D
+ std::vector<mcIdType> cNb1,cNb2; //no DataArrayIdType because interface with Geometric2D
BuildIntersecting2DCellsFromEdges(eps,m1,desc1->begin(),descIndx1->begin(),intersectEdge1,colinear2,m2,desc2->begin(),descIndx2->begin(),intersectEdge2,addCoo,
/* outputs -> */addCoordsQuadratic,cr,crI,cNb1,cNb2);
// Step 4: Prepare final result:
MCAuto<DataArrayDouble> addCooDa(DataArrayDouble::New());
- addCooDa->alloc((int)(addCoo.size())/2,2);
+ addCooDa->alloc(addCoo.size()/2,2);
std::copy(addCoo.begin(),addCoo.end(),addCooDa->getPointer());
MCAuto<DataArrayDouble> addCoordsQuadraticDa(DataArrayDouble::New());
- addCoordsQuadraticDa->alloc((int)(addCoordsQuadratic.size())/2,2);
+ addCoordsQuadraticDa->alloc(addCoordsQuadratic.size()/2,2);
std::copy(addCoordsQuadratic.begin(),addCoordsQuadratic.end(),addCoordsQuadraticDa->getPointer());
std::vector<const DataArrayDouble *> coordss(4);
coordss[0]=m1->getCoords(); coordss[1]=m2->getCoords(); coordss[2]=addCooDa; coordss[3]=addCoordsQuadraticDa;
MCAuto<DataArrayDouble> coo(DataArrayDouble::Aggregate(coordss));
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("Intersect2D",2));
- MCAuto<DataArrayInt> conn(DataArrayInt::New()); conn->alloc((int)cr.size(),1); std::copy(cr.begin(),cr.end(),conn->getPointer());
- MCAuto<DataArrayInt> connI(DataArrayInt::New()); connI->alloc((int)crI.size(),1); std::copy(crI.begin(),crI.end(),connI->getPointer());
- MCAuto<DataArrayInt> c1(DataArrayInt::New()); c1->alloc((int)cNb1.size(),1); std::copy(cNb1.begin(),cNb1.end(),c1->getPointer());
- MCAuto<DataArrayInt> c2(DataArrayInt::New()); c2->alloc((int)cNb2.size(),1); std::copy(cNb2.begin(),cNb2.end(),c2->getPointer());
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New()); conn->alloc(cr.size(),1); std::copy(cr.begin(),cr.end(),conn->getPointer());
+ MCAuto<DataArrayIdType> connI(DataArrayIdType::New()); connI->alloc(crI.size(),1); std::copy(crI.begin(),crI.end(),connI->getPointer());
+ MCAuto<DataArrayIdType> c1(DataArrayIdType::New()); c1->alloc(cNb1.size(),1); std::copy(cNb1.begin(),cNb1.end(),c1->getPointer());
+ MCAuto<DataArrayIdType> c2(DataArrayIdType::New()); c2->alloc(cNb2.size(),1); std::copy(cNb2.begin(),cNb2.end(),c2->getPointer());
ret->setConnectivity(conn,connI,true);
ret->setCoords(coo);
cellNb1=c1.retn(); cellNb2=c2.retn();
*
* \sa Intersect2DMeshes, orderConsecutiveCells1D, conformize2D, mergeNodes
*/
-void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps, MEDCouplingUMesh *&splitMesh2D, MEDCouplingUMesh *&splitMesh1D, DataArrayInt *&cellIdInMesh2D, DataArrayInt *&cellIdInMesh1D)
+void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps, MEDCouplingUMesh *&splitMesh2D, MEDCouplingUMesh *&splitMesh1D, DataArrayIdType *&cellIdInMesh2D, DataArrayIdType *&cellIdInMesh1D)
{
if(!mesh2D || !mesh1D)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshWith1DLine : input meshes must be not NULL !");
if(mesh2D->getMeshDimension()!=2 || mesh2D->getSpaceDimension()!=2 || mesh1D->getMeshDimension()!=1 || mesh1D->getSpaceDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshWith1DLine works with mesh2D with spacedim=meshdim=2 and mesh1D with meshdim=1 spaceDim=2 !");
// Step 1: compute all edge intersections (new nodes)
- std::vector< std::vector<int> > intersectEdge1, colinear2, subDiv2;
+ std::vector< std::vector<mcIdType> > intersectEdge1, colinear2, subDiv2;
std::vector<double> addCoo,addCoordsQuadratic; // coordinates of newly created nodes
INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
//
// Build desc connectivity
- DataArrayInt *desc1(DataArrayInt::New()),*descIndx1(DataArrayInt::New()),*revDesc1(DataArrayInt::New()),*revDescIndx1(DataArrayInt::New());
- MCAuto<DataArrayInt> dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1);
+ DataArrayIdType *desc1(DataArrayIdType::New()),*descIndx1(DataArrayIdType::New()),*revDesc1(DataArrayIdType::New()),*revDescIndx1(DataArrayIdType::New());
+ MCAuto<DataArrayIdType> dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1);
MCAuto<MEDCouplingUMesh> m1Desc(mesh2D->buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1));
- std::map<int,int> mergedNodes;
+ std::map<mcIdType,mcIdType> mergedNodes;
Intersect1DMeshes(m1Desc,mesh1D,eps,intersectEdge1,colinear2,subDiv2,addCoo,mergedNodes);
// use mergeNodes to fix intersectEdge1
- for(std::vector< std::vector<int> >::iterator it0=intersectEdge1.begin();it0!=intersectEdge1.end();it0++)
+ for(std::vector< std::vector<mcIdType> >::iterator it0=intersectEdge1.begin();it0!=intersectEdge1.end();it0++)
{
std::size_t n((*it0).size()/2);
- int eltStart((*it0)[0]),eltEnd((*it0)[2*n-1]);
- std::map<int,int>::const_iterator it1;
+ mcIdType eltStart((*it0)[0]),eltEnd((*it0)[2*n-1]);
+ std::map<mcIdType,mcIdType>::const_iterator it1;
it1=mergedNodes.find(eltStart);
if(it1!=mergedNodes.end())
(*it0)[0]=(*it1).second;
}
//
MCAuto<DataArrayDouble> addCooDa(DataArrayDouble::New());
- addCooDa->useArray(&addCoo[0],false,DeallocType::C_DEALLOC,(int)addCoo.size()/2,2);
+ addCooDa->useArray(&addCoo[0],false,DeallocType::C_DEALLOC,addCoo.size()/2,2);
// Step 2: re-order newly created nodes according to the ordering found in m2
- std::vector< std::vector<int> > intersectEdge2;
+ std::vector< std::vector<mcIdType> > intersectEdge2;
BuildIntersectEdges(m1Desc,mesh1D,addCoo,subDiv2,intersectEdge2);
subDiv2.clear();
// Step 3: compute splitMesh1D
- MCAuto<DataArrayInt> idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear;
- MCAuto<DataArrayInt> ret2(DataArrayInt::New()); ret2->alloc(0,1);
+ MCAuto<DataArrayIdType> idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear;
+ MCAuto<DataArrayIdType> ret2(DataArrayIdType::New()); ret2->alloc(0,1);
MCAuto<MEDCouplingUMesh> ret1(BuildMesh1DCutFrom(mesh1D,intersectEdge2,mesh2D->getCoords(),addCoo,mergedNodes,colinear2,intersectEdge1,
idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear));
- MCAuto<DataArrayInt> ret3(DataArrayInt::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits<int>::max()); ret3->rearrange(2);
- MCAuto<DataArrayInt> idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ret1->getNumberOfCells()));
+ MCAuto<DataArrayIdType> ret3(DataArrayIdType::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits<mcIdType>::max()); ret3->rearrange(2);
+ MCAuto<DataArrayIdType> idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ret1->getNumberOfCells()));
// deal with cells in mesh2D that are not cut but only some of their edges are
- MCAuto<DataArrayInt> idsInDesc2DToBeRefined(idsInDescMesh2DForIdsInRetColinear->deepCopy());
+ MCAuto<DataArrayIdType> idsInDesc2DToBeRefined(idsInDescMesh2DForIdsInRetColinear->deepCopy());
idsInDesc2DToBeRefined->abs(); idsInDesc2DToBeRefined->applyLin(1,-1);
idsInDesc2DToBeRefined=idsInDesc2DToBeRefined->buildUnique();
- MCAuto<DataArrayInt> out0s;//ids in mesh2D that are impacted by the fact that some edges of \a mesh1D are part of the edges of those cells
+ MCAuto<DataArrayIdType> out0s;//ids in mesh2D that are impacted by the fact that some edges of \a mesh1D are part of the edges of those cells
if(!idsInDesc2DToBeRefined->empty())
{
- DataArrayInt *out0(0),*outi0(0);
- DataArrayInt::ExtractFromIndexedArrays(idsInDesc2DToBeRefined->begin(),idsInDesc2DToBeRefined->end(),dd3,dd4,out0,outi0);
- MCAuto<DataArrayInt> outi0s(outi0);
+ DataArrayIdType *out0(0),*outi0(0);
+ DataArrayIdType::ExtractFromIndexedArrays(idsInDesc2DToBeRefined->begin(),idsInDesc2DToBeRefined->end(),dd3,dd4,out0,outi0);
+ MCAuto<DataArrayIdType> outi0s(outi0);
out0s=out0;
out0s=out0s->buildUnique();
out0s->sort(true);
//
MCAuto<MEDCouplingUMesh> ret1NonCol(static_cast<MEDCouplingUMesh *>(ret1->buildPartOfMySelf(idsInRet1NotColinear->begin(),idsInRet1NotColinear->end())));
MCAuto<DataArrayDouble> baryRet1(ret1NonCol->computeCellCenterOfMass());
- MCAuto<DataArrayInt> elts,eltsIndex;
+ MCAuto<DataArrayIdType> elts,eltsIndex;
mesh2D->getCellsContainingPoints(baryRet1->begin(),baryRet1->getNumberOfTuples(),eps,elts,eltsIndex);
- MCAuto<DataArrayInt> eltsIndex2(DataArrayInt::New()); eltsIndex2->alloc(0,1);
+ MCAuto<DataArrayIdType> eltsIndex2(DataArrayIdType::New()); eltsIndex2->alloc(0,1);
if (eltsIndex->getNumberOfTuples() > 1)
eltsIndex2 = eltsIndex->deltaShiftIndex();
- MCAuto<DataArrayInt> eltsIndex3(eltsIndex2->findIdsEqual(1));
+ MCAuto<DataArrayIdType> eltsIndex3(eltsIndex2->findIdsEqual(1));
if(eltsIndex2->count(0)+eltsIndex3->getNumberOfTuples()!=ret1NonCol->getNumberOfCells())
throw INTERP_KERNEL::Exception("Intersect2DMeshWith1DLine : internal error 1 !");
- MCAuto<DataArrayInt> cellsToBeModified(elts->buildUnique());
- MCAuto<DataArrayInt> untouchedCells(cellsToBeModified->buildComplement(mesh2D->getNumberOfCells()));
- if((DataArrayInt *)out0s)
+ MCAuto<DataArrayIdType> cellsToBeModified(elts->buildUnique());
+ MCAuto<DataArrayIdType> untouchedCells(cellsToBeModified->buildComplement(mesh2D->getNumberOfCells()));
+ if((DataArrayIdType *)out0s)
untouchedCells=untouchedCells->buildSubstraction(out0s);//if some edges in ret1 are colinear to descending mesh of mesh2D remove cells from untouched one
std::vector< MCAuto<MEDCouplingUMesh> > outMesh2DSplit;
// OK all is ready to insert in ret2 mesh
outMesh2DSplit.back()->setCoords(ret1->getCoords());
ret2->pushBackValsSilent(untouchedCells->begin(),untouchedCells->end());
}
- if((DataArrayInt *)out0s)
+ if((DataArrayIdType *)out0s)
{// here dealing with cells in out0s but not in cellsToBeModified
- MCAuto<DataArrayInt> fewModifiedCells(out0s->buildSubstraction(cellsToBeModified));
- const int *rdptr(dd3->begin()),*rdiptr(dd4->begin()),*dptr(dd1->begin()),*diptr(dd2->begin());
- for(const int *it=fewModifiedCells->begin();it!=fewModifiedCells->end();it++)
+ MCAuto<DataArrayIdType> fewModifiedCells(out0s->buildSubstraction(cellsToBeModified));
+ const mcIdType *rdptr(dd3->begin()),*rdiptr(dd4->begin()),*dptr(dd1->begin()),*diptr(dd2->begin());
+ for(const mcIdType *it=fewModifiedCells->begin();it!=fewModifiedCells->end();it++)
{
outMesh2DSplit.push_back(BuildRefined2DCell(ret1->getCoords(),mesh2D,*it,dptr+diptr[*it],dptr+diptr[*it+1],intersectEdge1));
ret1->setCoords(outMesh2DSplit.back()->getCoords());
}
- int offset(ret2->getNumberOfTuples());
+ mcIdType offset(ret2->getNumberOfTuples());
ret2->pushBackValsSilent(fewModifiedCells->begin(),fewModifiedCells->end());
- MCAuto<DataArrayInt> partOfRet3(DataArrayInt::New()); partOfRet3->alloc(2*idsInRet1Colinear->getNumberOfTuples(),1);
- partOfRet3->fillWithValue(std::numeric_limits<int>::max()); partOfRet3->rearrange(2);
- int kk(0),*ret3ptr(partOfRet3->getPointer());
- for(const int *it=idsInDescMesh2DForIdsInRetColinear->begin();it!=idsInDescMesh2DForIdsInRetColinear->end();it++,kk++)
+ MCAuto<DataArrayIdType> partOfRet3(DataArrayIdType::New()); partOfRet3->alloc(2*idsInRet1Colinear->getNumberOfTuples(),1);
+ partOfRet3->fillWithValue(std::numeric_limits<mcIdType>::max()); partOfRet3->rearrange(2);
+ mcIdType kk(0),*ret3ptr(partOfRet3->getPointer());
+ for(const mcIdType *it=idsInDescMesh2DForIdsInRetColinear->begin();it!=idsInDescMesh2DForIdsInRetColinear->end();it++,kk++)
{
- int faceId(std::abs(*it)-1);
- for(const int *it2=rdptr+rdiptr[faceId];it2!=rdptr+rdiptr[faceId+1];it2++)
+ mcIdType faceId(std::abs(*it)-1);
+ for(const mcIdType *it2=rdptr+rdiptr[faceId];it2!=rdptr+rdiptr[faceId+1];it2++)
{
- int tmp(fewModifiedCells->findIdFirstEqual(*it2));
+ mcIdType tmp(fewModifiedCells->findIdFirstEqual(*it2));
if(tmp!=-1)
{
if(std::find(dptr+diptr[*it2],dptr+diptr[*it2+1],-(*it))!=dptr+diptr[*it2+1])
}
}
cellsToBeModified=cellsToBeModified->buildUniqueNotSorted();
- for(const int *it=cellsToBeModified->begin();it!=cellsToBeModified->end();it++)
+ for(const mcIdType *it=cellsToBeModified->begin();it!=cellsToBeModified->end();it++)
{
- MCAuto<DataArrayInt> idsNonColPerCell(elts->findIdsEqual(*it));
+ MCAuto<DataArrayIdType> idsNonColPerCell(elts->findIdsEqual(*it));
idsNonColPerCell->transformWithIndArr(eltsIndex3->begin(),eltsIndex3->end());
- MCAuto<DataArrayInt> idsNonColPerCell2(idsInRet1NotColinear->selectByTupleId(idsNonColPerCell->begin(),idsNonColPerCell->end()));
+ MCAuto<DataArrayIdType> idsNonColPerCell2(idsInRet1NotColinear->selectByTupleId(idsNonColPerCell->begin(),idsNonColPerCell->end()));
MCAuto<MEDCouplingUMesh> partOfMesh1CuttingCur2DCell(static_cast<MEDCouplingUMesh *>(ret1NonCol->buildPartOfMySelf(idsNonColPerCell->begin(),idsNonColPerCell->end())));
- MCAuto<DataArrayInt> partOfRet3;
+ MCAuto<DataArrayIdType> partOfRet3;
MCAuto<MEDCouplingUMesh> splitOfOneCell(BuildMesh2DCutFrom(eps,*it,m1Desc,partOfMesh1CuttingCur2DCell,dd1->begin()+dd2->getIJ(*it,0),dd1->begin()+dd2->getIJ((*it)+1,0),intersectEdge1,ret2->getNumberOfTuples(),partOfRet3));
ret3->setPartOfValues3(partOfRet3,idsNonColPerCell2->begin(),idsNonColPerCell2->end(),0,2,1,true);
outMesh2DSplit.push_back(splitOfOneCell);
- for(std::size_t i=0;i<splitOfOneCell->getNumberOfCells();i++)
+ for(mcIdType i=0;i<splitOfOneCell->getNumberOfCells();i++)
ret2->pushBackSilent(*it);
}
//
//
ret1->getCoords()->setInfoOnComponents(compNames);
MCAuto<MEDCouplingUMesh> ret2D(MEDCouplingUMesh::MergeUMeshesOnSameCoords(tmp));
- // To finish - filter ret3 - std::numeric_limits<int>::max() -> -1 - negate values must be resolved.
+ // To finish - filter ret3 - std::numeric_limits<mcIdType>::max() -> -1 - negate values must be resolved.
ret3->rearrange(1);
- MCAuto<DataArrayInt> edgesToDealWith(ret3->findIdsStrictlyNegative());
- for(const int *it=edgesToDealWith->begin();it!=edgesToDealWith->end();it++)
+ MCAuto<DataArrayIdType> edgesToDealWith(ret3->findIdsStrictlyNegative());
+ for(const mcIdType *it=edgesToDealWith->begin();it!=edgesToDealWith->end();it++)
{
- int old2DCellId(-ret3->getIJ(*it,0)-1);
- MCAuto<DataArrayInt> candidates(ret2->findIdsEqual(old2DCellId));
+ mcIdType old2DCellId(-ret3->getIJ(*it,0)-1);
+ MCAuto<DataArrayIdType> candidates(ret2->findIdsEqual(old2DCellId));
ret3->setIJ(*it,0,FindRightCandidateAmong(ret2D,candidates->begin(),candidates->end(),ret1,*it%2==0?-((*it)/2+1):(*it)/2+1,eps));// div by 2 because 2 components natively in ret3
}
- ret3->changeValue(std::numeric_limits<int>::max(),-1);
+ ret3->changeValue(std::numeric_limits<mcIdType>::max(),-1);
ret3->rearrange(2);
//
splitMesh1D=ret1.retn();
* If it is not the case you can invoke MEDCouplingUMesh::mergeNodes before calling this method.
*
* \param [in] eps the relative error to detect merged edges.
- * \return DataArrayInt * - The list of cellIds in \a this that have been subdivided. If empty, nothing changed in \a this (as if it were a const method). The array is a newly allocated array
+ * \return DataArrayIdType * - The list of cellIds in \a this that have been subdivided. If empty, nothing changed in \a this (as if it were a const method). The array is a newly allocated array
* that the user is expected to deal with.
*
* \throw If \a this is not coherent.
* \throw If \a this has not meshDim equal to 2.
* \sa MEDCouplingUMesh::mergeNodes, MEDCouplingUMesh::split2DCells
*/
-DataArrayInt *MEDCouplingUMesh::conformize2D(double eps)
+DataArrayIdType *MEDCouplingUMesh::conformize2D(double eps)
{
static const int SPACEDIM=2;
checkConsistencyLight();
if(getSpaceDimension()!=2 || getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::conformize2D : This method only works for meshes with spaceDim=2 and meshDim=2 !");
- MCAuto<DataArrayInt> desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New());
+ MCAuto<DataArrayIdType> desc1(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> mDesc(buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1));
- const int *c(mDesc->getNodalConnectivity()->begin()),*ci(mDesc->getNodalConnectivityIndex()->begin()),*rd(revDesc1->begin()),*rdi(revDescIndx1->begin());
+ const mcIdType *c(mDesc->getNodalConnectivity()->begin()),*ci(mDesc->getNodalConnectivityIndex()->begin()),*rd(revDesc1->begin()),*rdi(revDescIndx1->begin());
MCAuto<DataArrayDouble> bboxArr(mDesc->getBoundingBoxForBBTree(eps));
const double *bbox(bboxArr->begin()),*coords(getCoords()->begin());
- int nCell(getNumberOfCells()),nDescCell(mDesc->getNumberOfCells());
- std::vector< std::vector<int> > intersectEdge(nDescCell),overlapEdge(nDescCell);
+ mcIdType nCell=getNumberOfCells(),nDescCell=mDesc->getNumberOfCells();
+ std::vector< std::vector<mcIdType> > intersectEdge(nDescCell),overlapEdge(nDescCell);
std::vector<double> addCoo;
- BBTree<SPACEDIM,int> myTree(bbox,0,0,nDescCell,-eps);
+ BBTree<SPACEDIM,mcIdType> myTree(bbox,0,0,nDescCell,-eps);
INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
- for(int i=0;i<nDescCell;i++)
+ for(mcIdType i=0;i<nDescCell;i++)
{
- std::vector<int> candidates;
+ std::vector<mcIdType> candidates;
myTree.getIntersectingElems(bbox+i*2*SPACEDIM,candidates);
- for(std::vector<int>::const_iterator it=candidates.begin();it!=candidates.end();it++)
+ for(std::vector<mcIdType>::const_iterator it=candidates.begin();it!=candidates.end();it++)
if(*it>i) // we're dealing with pair of edges, no need to treat the same pair twice
{
- std::map<MCAuto<INTERP_KERNEL::Node>,int> m;
+ std::map<MCAuto<INTERP_KERNEL::Node>,mcIdType> m;
INTERP_KERNEL::Edge *e1(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coords,m)),
*e2(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[*it]],c+ci[*it]+1,coords,m));
INTERP_KERNEL::MergePoints merge;
}
}
// splitting done. sort intersect point in intersectEdge.
- std::vector< std::vector<int> > middle(nDescCell);
- int nbOf2DCellsToBeSplit(0);
+ std::vector< std::vector<mcIdType> > middle(nDescCell);
+ mcIdType nbOf2DCellsToBeSplit(0);
bool middleNeedsToBeUsed(false);
std::vector<bool> cells2DToTreat(nDescCell,false);
- for(int i=0;i<nDescCell;i++)
+ for(mcIdType i=0;i<nDescCell;i++)
{
- std::vector<int>& isect(intersectEdge[i]);
- int sz((int)isect.size());
+ std::vector<mcIdType>& isect(intersectEdge[i]);
+ std::size_t sz(isect.size());
if(sz>1)
{
- std::map<MCAuto<INTERP_KERNEL::Node>,int> m;
+ std::map<MCAuto<INTERP_KERNEL::Node>,mcIdType> m;
INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coords,m));
e->sortSubNodesAbs(coords,isect);
e->decrRef();
}
if(sz!=0)
{
- int idx0(rdi[i]),idx1(rdi[i+1]);
+ mcIdType idx0(rdi[i]),idx1(rdi[i+1]);
if(idx1-idx0!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::conformize2D : internal error #0 !");
if(!cells2DToTreat[rd[idx0]])
nbOf2DCellsToBeSplit++;
}
// try to reuse at most eventual 'middle' of SEG3
- std::vector<int>& mid(middle[i]);
+ std::vector<mcIdType>& mid(middle[i]);
mid.resize(sz+1,-1);
if((INTERP_KERNEL::NormalizedCellType)c[ci[i]]==INTERP_KERNEL::NORM_SEG3)
{
middleNeedsToBeUsed=true;
- const std::vector<int>& candidates(overlapEdge[i]);
- std::vector<int> trueCandidates;
- for(std::vector<int>::const_iterator itc=candidates.begin();itc!=candidates.end();itc++)
+ const std::vector<mcIdType>& candidates(overlapEdge[i]);
+ std::vector<mcIdType> trueCandidates;
+ for(std::vector<mcIdType>::const_iterator itc=candidates.begin();itc!=candidates.end();itc++)
if((INTERP_KERNEL::NormalizedCellType)c[ci[*itc]]==INTERP_KERNEL::NORM_SEG3)
trueCandidates.push_back(*itc);
- int stNode(c[ci[i]+1]),endNode(isect[0]);
- for(int j=0;j<sz+1;j++)
+ mcIdType stNode(c[ci[i]+1]),endNode(isect[0]);
+ for(std::size_t j=0;j<sz+1;j++)
{
- for(std::vector<int>::const_iterator itc=trueCandidates.begin();itc!=trueCandidates.end();itc++)
+ for(std::vector<mcIdType>::const_iterator itc=trueCandidates.begin();itc!=trueCandidates.end();itc++)
{
- int tmpSt(c[ci[*itc]+1]),tmpEnd(c[ci[*itc]+2]);
+ mcIdType tmpSt(c[ci[*itc]+1]),tmpEnd(c[ci[*itc]+2]);
if((tmpSt==stNode && tmpEnd==endNode) || (tmpSt==endNode && tmpEnd==stNode))
{ mid[j]=*itc; break; }
}
}
}
}
- MCAuto<DataArrayInt> ret(DataArrayInt::New()),notRet(DataArrayInt::New()); ret->alloc(nbOf2DCellsToBeSplit,1);
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()),notRet(DataArrayIdType::New()); ret->alloc(nbOf2DCellsToBeSplit,1);
if(nbOf2DCellsToBeSplit==0)
return ret.retn();
//
- int *retPtr(ret->getPointer());
- for(int i=0;i<nCell;i++)
+ mcIdType *retPtr(ret->getPointer());
+ for(mcIdType i=0;i<nCell;i++)
if(cells2DToTreat[i])
*retPtr++=i;
//
- MCAuto<DataArrayInt> mSafe,nSafe,oSafe,pSafe,qSafe,rSafe;
- DataArrayInt *m(0),*n(0),*o(0),*p(0),*q(0),*r(0);
- DataArrayInt::ExtractFromIndexedArrays(ret->begin(),ret->end(),desc1,descIndx1,m,n); mSafe=m; nSafe=n;
- DataArrayInt::PutIntoToSkylineFrmt(intersectEdge,o,p); oSafe=o; pSafe=p;
+ MCAuto<DataArrayIdType> mSafe,nSafe,oSafe,pSafe,qSafe,rSafe;
+ DataArrayIdType *m(0),*n(0),*o(0),*p(0),*q(0),*r(0);
+ DataArrayIdType::ExtractFromIndexedArrays(ret->begin(),ret->end(),desc1,descIndx1,m,n); mSafe=m; nSafe=n;
+ DataArrayIdType::PutIntoToSkylineFrmt(intersectEdge,o,p); oSafe=o; pSafe=p;
if(middleNeedsToBeUsed)
- { DataArrayInt::PutIntoToSkylineFrmt(middle,q,r); qSafe=q; rSafe=r; }
+ { DataArrayIdType::PutIntoToSkylineFrmt(middle,q,r); qSafe=q; rSafe=r; }
MCAuto<MEDCouplingUMesh> modif(static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(ret->begin(),ret->end(),true)));
- int nbOfNodesCreated(modif->split2DCells(mSafe,nSafe,oSafe,pSafe,qSafe,rSafe));
+ mcIdType nbOfNodesCreated(modif->split2DCells(mSafe,nSafe,oSafe,pSafe,qSafe,rSafe));
setCoords(modif->getCoords());//if nbOfNodesCreated==0 modif and this have the same coordinates pointer so this line has no effect. But for quadratic cases this line is important.
setPartOfMySelf(ret->begin(),ret->end(),*modif);
{
- bool areNodesMerged; int newNbOfNodes;
+ bool areNodesMerged; mcIdType newNbOfNodes;
if(nbOfNodesCreated!=0)
- MCAuto<DataArrayInt> tmp(mergeNodes(eps,areNodesMerged,newNbOfNodes));
+ MCAuto<DataArrayIdType> tmp(mergeNodes(eps,areNodesMerged,newNbOfNodes));
}
return ret.retn();
}
*
* If \a this is constituted by only linear 2D cells, this method is close to the computation of the convex hull of each cells in \a this.
*
- * \return DataArrayInt * - The list of cellIds in \a this that have at least one edge colinearized.
+ * \return DataArrayIdType * - The list of cellIds in \a this that have at least one edge colinearized.
*
* \throw If \a this is not coherent.
* \throw If \a this has not spaceDim equal to 2.
*
* \sa MEDCouplingUMesh::conformize2D, MEDCouplingUMesh::mergeNodes, MEDCouplingUMesh::convexEnvelop2D.
*/
-DataArrayInt *MEDCouplingUMesh::colinearize2D(double eps)
+DataArrayIdType *MEDCouplingUMesh::colinearize2D(double eps)
{
return internalColinearize2D(eps, false);
}
*
* \sa MEDCouplingUMesh::colinearize2D
*/
-DataArrayInt *MEDCouplingUMesh::colinearizeKeepingConform2D(double eps)
+DataArrayIdType *MEDCouplingUMesh::colinearizeKeepingConform2D(double eps)
{
return internalColinearize2D(eps, true);
}
/*!
* \param stayConform is set to True, will not fuse two edges sharing a node that has (strictly) more than 2 egdes connected to it
*/
-DataArrayInt *MEDCouplingUMesh::internalColinearize2D(double eps, bool stayConform)
+DataArrayIdType *MEDCouplingUMesh::internalColinearize2D(double eps, bool stayConform)
{
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
checkConsistencyLight();
if(getSpaceDimension()!=2 || getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::colinearize2D : This method only works for meshes with spaceDim=2 and meshDim=2 !");
INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
- int nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
- const int *cptr(_nodal_connec->begin()),*ciptr(_nodal_connec_index->begin());
- MCAuto<DataArrayInt> newc(DataArrayInt::New()),newci(DataArrayInt::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0);
- std::map<int, bool> forbiddenPoints; // list of points that can not be removed (or it will break conformity)
+ mcIdType nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
+ const mcIdType *cptr(_nodal_connec->begin()),*ciptr(_nodal_connec_index->begin());
+ MCAuto<DataArrayIdType> newc(DataArrayIdType::New()),newci(DataArrayIdType::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0);
+ std::map<mcIdType, bool> forbiddenPoints; // list of points that can not be removed (or it will break conformity)
if(stayConform) //
{
// A point that is used by more than 2 edges can not be removed without breaking conformity:
- MCAuto<DataArrayInt> desc1(DataArrayInt::New()),descI1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescI1(DataArrayInt::New());
+ MCAuto<DataArrayIdType> desc1(DataArrayIdType::New()),descI1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescI1(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> mDesc1D(buildDescendingConnectivity(desc1,descI1,revDesc1,revDescI1));
- MCAuto<DataArrayInt> desc2(DataArrayInt::New()),descI2(DataArrayInt::New()),revDesc2(DataArrayInt::New()),revDescI2(DataArrayInt::New());
+ MCAuto<DataArrayIdType> desc2(DataArrayIdType::New()),descI2(DataArrayIdType::New()),revDesc2(DataArrayIdType::New()),revDescI2(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> mDesc0D(mDesc1D->buildDescendingConnectivity(desc2,descI2,revDesc2,revDescI2));
- MCAuto<DataArrayInt> dsi(revDescI2->deltaShiftIndex());
- MCAuto<DataArrayInt> ids(dsi->findIdsGreaterThan(2));
- const int * cPtr(mDesc0D->getNodalConnectivity()->begin());
+ MCAuto<DataArrayIdType> dsi(revDescI2->deltaShiftIndex());
+ MCAuto<DataArrayIdType> ids(dsi->findIdsGreaterThan(2));
+ const mcIdType * cPtr(mDesc0D->getNodalConnectivity()->begin());
for(auto it = ids->begin(); it != ids->end(); it++)
forbiddenPoints[cPtr[2*(*it)+1]] = true; // we know that a 0D mesh has a connectivity of the form [NORM_POINT1, i1, NORM_POINT1, i2, ...]
}
MCAuto<DataArrayDouble> appendedCoords(DataArrayDouble::New()); appendedCoords->alloc(0,1);//1 not 2 it is not a bug.
const double *coords(_coords->begin());
- int *newciptr(newci->getPointer());
- for(int i=0;i<nbOfCells;i++,newciptr++,ciptr++)
+ mcIdType *newciptr(newci->getPointer());
+ for(mcIdType i=0;i<nbOfCells;i++,newciptr++,ciptr++)
{
if(Colinearize2DCell(coords,cptr+ciptr[0],cptr+ciptr[1],nbOfNodes,forbiddenPoints, /*out*/ newc,appendedCoords))
ret->pushBackSilent(i);
* startNode, endNode in global numbering
*\return true if the segment is indeed split
*/
-bool MEDCouplingUMesh::OrderPointsAlongLine(const double * coo, int startNode, int endNode,
- const int * c, const int * cI, const int *idsBg, const int *endBg,
- std::vector<int> & pointIds, std::vector<int> & hitSegs)
+bool MEDCouplingUMesh::OrderPointsAlongLine(const double * coo, mcIdType startNode, mcIdType endNode,
+ const mcIdType * c, const mcIdType * cI, const mcIdType *idsBg, const mcIdType *endBg,
+ std::vector<mcIdType> & pointIds, std::vector<mcIdType> & hitSegs)
{
using namespace std;
const int SPACEDIM=3;
- typedef pair<double, int> PairDI;
+ typedef pair<double, mcIdType> PairDI;
set< PairDI > x;
- for (const int * it = idsBg; it != endBg; ++it)
+ for (const mcIdType * it = idsBg; it != endBg; ++it)
{
assert(c[cI[*it]] == INTERP_KERNEL::NORM_SEG2);
- int start = c[cI[*it]+1], end = c[cI[*it]+2];
+ mcIdType start = c[cI[*it]+1], end = c[cI[*it]+2];
x.insert(make_pair(coo[start*SPACEDIM], start)); // take only X coords
x.insert(make_pair(coo[end*SPACEDIM], end));
}
pointIds.reserve(xx.size());
// Keep what is inside [startNode, endNode]:
- int go = 0;
+ mcIdType go = 0;
for (vector<PairDI>::const_iterator it=xx.begin(); it != xx.end(); ++it)
{
- const int idx = (*it).second;
+ const mcIdType idx = (*it).second;
if (!go)
{
if (idx == startNode) go = 1;
break;
}
-// vector<int> pointIds2(pointIds.size()+2);
+// vector<mcIdType> pointIds2(pointIds.size()+2);
// copy(pointIds.begin(), pointIds.end(), pointIds2.data()+1);
// pointIds2[0] = startNode;
// pointIds2[pointIds2.size()-1] = endNode;
reverse(pointIds.begin(), pointIds.end());
// Now identify smaller segments that are not sub-divided - those won't need any further treatment:
- for (const int * it = idsBg; it != endBg; ++it)
+ for (const mcIdType * it = idsBg; it != endBg; ++it)
{
- int start = c[cI[*it]+1], end = c[cI[*it]+2];
- vector<int>::const_iterator itStart = find(pointIds.begin(), pointIds.end(), start);
+ mcIdType start = c[cI[*it]+1], end = c[cI[*it]+2];
+ vector<mcIdType>::const_iterator itStart = find(pointIds.begin(), pointIds.end(), start);
if (itStart == pointIds.end()) continue;
- vector<int>::const_iterator itEnd = find(pointIds.begin(), pointIds.end(), end);
+ vector<mcIdType>::const_iterator itEnd = find(pointIds.begin(), pointIds.end(), end);
if (itEnd == pointIds.end()) continue;
if (abs(distance(itEnd, itStart)) != 1) continue;
hitSegs.push_back(*it); // segment is undivided.
return (pointIds.size() > 2); // something else apart start and end node
}
-void MEDCouplingUMesh::ReplaceEdgeInFace(const int * sIdxConn, const int * sIdxConnE, int startNode, int endNode,
- const std::vector<int>& insidePoints, std::vector<int>& modifiedFace)
+void MEDCouplingUMesh::ReplaceEdgeInFace(const mcIdType * sIdxConn, const mcIdType * sIdxConnE, mcIdType startNode, mcIdType endNode,
+ const std::vector<mcIdType>& insidePoints, std::vector<mcIdType>& modifiedFace)
{
using namespace std;
- int dst = distance(sIdxConn, sIdxConnE);
+ size_t dst = distance(sIdxConn, sIdxConnE);
modifiedFace.reserve(dst + insidePoints.size()-2);
modifiedFace.resize(dst);
copy(sIdxConn, sIdxConnE, modifiedFace.data());
- vector<int>::iterator shortEnd = modifiedFace.begin()+dst;
- vector<int>::iterator startPos = find(modifiedFace.begin(), shortEnd , startNode);
+ vector<mcIdType>::iterator shortEnd = modifiedFace.begin()+dst;
+ vector<mcIdType>::iterator startPos = find(modifiedFace.begin(), shortEnd , startNode);
if (startPos == shortEnd)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ReplaceEdgeInFace: internal error, should never happen!");
- vector<int>::iterator endPos = find(modifiedFace.begin(),shortEnd, endNode);
+ vector<mcIdType>::iterator endPos = find(modifiedFace.begin(),shortEnd, endNode);
if (endPos == shortEnd)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ReplaceEdgeInFace: internal error, should never happen!");
- int d = distance(startPos, endPos);
+ size_t d = distance(startPos, endPos);
if (d == 1 || d == (1-dst)) // don't use modulo, for neg numbers, result is implementation defined ...
modifiedFace.insert(++startPos, ++insidePoints.begin(), --insidePoints.end()); // insidePoints also contains start and end node. Those don't need to be inserted.
else
* If it is not the case you can invoke MEDCouplingUMesh::mergeNodes before calling this method.
*
* \param [in] eps the relative error to detect merged edges.
- * \return DataArrayInt * - The list of cellIds in \a this that have been subdivided. If empty, nothing changed in \a this (as if it were a const method). The array is a newly allocated array
+ * \return DataArrayIdType * - The list of cellIds in \a this that have been subdivided. If empty, nothing changed in \a this (as if it were a const method). The array is a newly allocated array
* that the user is expected to deal with.
*
* \throw If \a this is not coherent.
* \throw If \a this has not meshDim equal to 3.
* \sa MEDCouplingUMesh::mergeNodes, MEDCouplingUMesh::conformize2D, MEDCouplingUMesh::convertAllToPoly()
*/
-DataArrayInt *MEDCouplingUMesh::conformize3D(double eps)
+DataArrayIdType *MEDCouplingUMesh::conformize3D(double eps)
{
using namespace std;
MCAuto<MEDCouplingSkyLineArray> connSla(MEDCouplingSkyLineArray::BuildFromPolyhedronConn(getNodalConnectivity(), getNodalConnectivityIndex()));
const double * coo(_coords->begin());
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
{
/*************************
* STEP 1 -- faces
*************************/
- MCAuto<DataArrayInt> descDNU(DataArrayInt::New()),descIDNU(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescI(DataArrayInt::New());
+ MCAuto<DataArrayIdType> descDNU(DataArrayIdType::New()),descIDNU(DataArrayIdType::New()),revDesc(DataArrayIdType::New()),revDescI(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> mDesc(buildDescendingConnectivity(descDNU,descIDNU,revDesc,revDescI));
- const int *revDescIP(revDescI->getConstPointer()), *revDescP(revDesc->getConstPointer());
- const int *cDesc(mDesc->getNodalConnectivity()->begin()),*cIDesc(mDesc->getNodalConnectivityIndex()->begin());
+ const mcIdType *revDescIP(revDescI->getConstPointer()), *revDescP(revDesc->getConstPointer());
+ const mcIdType *cDesc(mDesc->getNodalConnectivity()->begin()),*cIDesc(mDesc->getNodalConnectivityIndex()->begin());
MCAuto<MEDCouplingSkyLineArray> connSlaDesc(MEDCouplingSkyLineArray::New(mDesc->getNodalConnectivityIndex(), mDesc->getNodalConnectivity()));
// Build BBTree
MCAuto<DataArrayDouble> bboxArr(mDesc->getBoundingBoxForBBTree(eps));
const double *bbox(bboxArr->begin()); getCoords()->begin();
- int nDescCell(mDesc->getNumberOfCells());
- BBTree<SPACEDIM,int> myTree(bbox,0,0,nDescCell,-eps);
+ mcIdType nDescCell=mDesc->getNumberOfCells();
+ BBTree<SPACEDIM,mcIdType> myTree(bbox,0,0,nDescCell,-eps);
// Surfaces - handle biggest first
MCAuto<MEDCouplingFieldDouble> surfF = mDesc->getMeasureField(true);
DataArrayDouble * surfs = surfF->getArray();
const double * normalsP = normals->getConstPointer();
// Sort faces by decreasing surface:
- vector< pair<double,int> > S;
- for(std::size_t i=0;i < surfs->getNumberOfTuples();i++)
+ vector< pair<double,mcIdType> > S;
+ for(mcIdType i=0;i < surfs->getNumberOfTuples();i++)
{
- pair<double,int> p = make_pair(surfs->begin()[i], i);
+ pair<double,mcIdType> p = make_pair(surfs->begin()[i], i);
S.push_back(p);
}
sort(S.rbegin(),S.rend()); // reverse sort
vector<bool> hit(nDescCell);
fill(hit.begin(), hit.end(), false);
- vector<int> hitPoly; // the final result: which 3D cells have been modified.
+ vector<mcIdType> hitPoly; // the final result: which 3D cells have been modified.
- for( vector<pair<double,int> >::const_iterator it = S.begin(); it != S.end(); it++)
+ for( vector<pair<double,mcIdType> >::const_iterator it = S.begin(); it != S.end(); it++)
{
- int faceIdx = (*it).second;
+ mcIdType faceIdx = (*it).second;
if (hit[faceIdx]) continue;
- vector<int> candidates, cands2;
+ vector<mcIdType> candidates, cands2;
myTree.getIntersectingElems(bbox+faceIdx*2*SPACEDIM,candidates);
// Keep only candidates whose normal matches the normal of current face
- for(vector<int>::const_iterator it2=candidates.begin();it2!=candidates.end();it2++)
+ for(vector<mcIdType>::const_iterator it2=candidates.begin();it2!=candidates.end();it2++)
{
bool col = INTERP_KERNEL::isColinear3D(normalsP + faceIdx*SPACEDIM, normalsP + *(it2)*SPACEDIM, eps);
if (*it2 != faceIdx && col)
MCAuto<MEDCouplingUMesh> mPartCand(mDesc->buildPartOfMySelf(&cands2[0], &cands2[0]+cands2.size(), false)); // false=zipCoords is called
double * cooPartRef(mPartRef->_coords->getPointer());
double * cooPartCand(mPartCand->_coords->getPointer());
- for (std::size_t ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++)
+ for (mcIdType ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++)
rotation.transform_vector(cooPartRef+SPACEDIM*ii);
- for (std::size_t ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++)
+ for (mcIdType ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++)
rotation.transform_vector(cooPartCand+SPACEDIM*ii);
// Localize faces in 2D thanks to barycenters
MCAuto<DataArrayDouble> baryPart = mPartCand->computeCellCenterOfMass();
- vector<int> compo; compo.push_back(2);
+ vector<std::size_t> compo; compo.push_back(2);
MCAuto<DataArrayDouble> baryPartZ = baryPart->keepSelectedComponents(compo);
- MCAuto<DataArrayInt> idsGoodPlane = baryPartZ->findIdsInRange(-eps, +eps);
+ MCAuto<DataArrayIdType> idsGoodPlane = baryPartZ->findIdsInRange(-eps, +eps);
if (!idsGoodPlane->getNumberOfTuples())
continue;
compo[0] = 0; compo.push_back(1);
MCAuto<DataArrayDouble> baryPartXY = baryPart->keepSelectedComponents(compo);
mPartRef->changeSpaceDimension(2,0.0);
- MCAuto<DataArrayInt> cc(DataArrayInt::New()), ccI(DataArrayInt::New());
+ MCAuto<DataArrayIdType> cc(DataArrayIdType::New()), ccI(DataArrayIdType::New());
mPartRef->getCellsContainingPoints(baryPartXY->begin(), baryPartXY->getNumberOfTuples(), eps, cc, ccI);
if (!cc->getNumberOfTuples())
continue;
- MCAuto<DataArrayInt> dsi = ccI->deltaShiftIndex();
+ MCAuto<DataArrayIdType> dsi = ccI->deltaShiftIndex();
{
- MCAuto<DataArrayInt> tmp = dsi->findIdsInRange(0, 2);
+ MCAuto<DataArrayIdType> tmp = dsi->findIdsInRange(0, 2);
if (tmp->getNumberOfTuples() != dsi->getNumberOfTuples())
{
ostringstream oss;
}
}
- MCAuto<DataArrayInt> ids = dsi->findIdsEqual(1);
+ MCAuto<DataArrayIdType> ids = dsi->findIdsEqual(1);
// Boundary face:
if (!ids->getNumberOfTuples())
continue;
double checkSurf=0.0;
- const int * idsGoodPlaneP(idsGoodPlane->begin());
- for (const int * ii = ids->begin(); ii != ids->end(); ii++)
+ const mcIdType * idsGoodPlaneP(idsGoodPlane->begin());
+ for (const mcIdType * ii = ids->begin(); ii != ids->end(); ii++)
{
- int faceIdx2 = cands2[idsGoodPlaneP[*ii]];
+ mcIdType faceIdx2 = cands2[idsGoodPlaneP[*ii]];
hit[faceIdx2] = true;
checkSurf += surfs->begin()[faceIdx2];
}
}
// For all polyhedrons using this face, replace connectivity:
- vector<int> polyIndices, packsIds, facePack;
- for (int ii=revDescIP[faceIdx]; ii < revDescIP[faceIdx+1]; ii++)
+ vector<mcIdType> polyIndices, packsIds, facePack;
+ for (mcIdType ii=revDescIP[faceIdx]; ii < revDescIP[faceIdx+1]; ii++)
polyIndices.push_back(revDescP[ii]);
ret->pushBackValsSilent(polyIndices.data(),polyIndices.data()+polyIndices.size());
// Current face connectivity
- const int * sIdxConn = cDesc + cIDesc[faceIdx] + 1;
- const int * sIdxConnE = cDesc + cIDesc[faceIdx+1];
+ const mcIdType * sIdxConn = cDesc + cIDesc[faceIdx] + 1;
+ const mcIdType * sIdxConnE = cDesc + cIDesc[faceIdx+1];
connSla->findPackIds(polyIndices, sIdxConn, sIdxConnE, packsIds);
// Deletion of old faces
- int jj=0;
- for (vector<int>::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2, ++jj)
+ mcIdType jj=0;
+ for (vector<mcIdType>::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2, ++jj)
{
if (packsIds[jj] == -1)
// The below should never happen - if a face is used several times, with a different layout of the nodes
connSla->deletePack(*it2, packsIds[jj]);
}
// Insertion of new faces:
- for (const int * ii = ids->begin(); ii != ids->end(); ii++)
+ for (const mcIdType * ii = ids->begin(); ii != ids->end(); ii++)
{
// Build pack from the face to insert:
- int faceIdx2 = cands2[idsGoodPlane->getIJ(*ii,0)];
- int facePack2Sz;
- const int * facePack2 = connSlaDesc->getSimplePackSafePtr(faceIdx2, facePack2Sz); // contains the type!
+ mcIdType faceIdx2 = cands2[idsGoodPlane->getIJ(*ii,0)];
+ mcIdType facePack2Sz;
+ const mcIdType * facePack2 = connSlaDesc->getSimplePackSafePtr(faceIdx2, facePack2Sz); // contains the type!
// Insert it in all hit polyhedrons:
- for (vector<int>::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2)
+ for (vector<mcIdType>::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2)
connSla->pushBackPack(*it2, facePack2+1, facePack2+facePack2Sz); // without the type
}
}
} // end step1
// Set back modified connectivity
- MCAuto<DataArrayInt> cAuto; cAuto.takeRef(_nodal_connec);
- MCAuto<DataArrayInt> cIAuto; cIAuto.takeRef(_nodal_connec_index);
+ MCAuto<DataArrayIdType> cAuto; cAuto.takeRef(_nodal_connec);
+ MCAuto<DataArrayIdType> cIAuto; cIAuto.takeRef(_nodal_connec_index);
connSla->convertToPolyhedronConn(cAuto, cIAuto);
{
// Now we have a face-conform mesh.
// Recompute descending
- MCAuto<DataArrayInt> desc(DataArrayInt::New()),descI(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescI(DataArrayInt::New());
+ MCAuto<DataArrayIdType> desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),revDesc(DataArrayIdType::New()),revDescI(DataArrayIdType::New());
// Rebuild desc connectivity with orientation this time!!
MCAuto<MEDCouplingUMesh> mDesc(buildDescendingConnectivity2(desc,descI,revDesc,revDescI));
- const int *revDescIP(revDescI->getConstPointer()), *revDescP(revDesc->getConstPointer());
- const int *descIP(descI->getConstPointer()), *descP(desc->getConstPointer());
- const int *cDesc(mDesc->getNodalConnectivity()->begin()),*cIDesc(mDesc->getNodalConnectivityIndex()->begin());
- MCAuto<DataArrayInt> ciDeepC(mDesc->getNodalConnectivityIndex()->deepCopy());
- MCAuto<DataArrayInt> cDeepC(mDesc->getNodalConnectivity()->deepCopy());
+ const mcIdType *revDescIP(revDescI->getConstPointer()), *revDescP(revDesc->getConstPointer());
+ const mcIdType *descIP(descI->getConstPointer()), *descP(desc->getConstPointer());
+ const mcIdType *cDesc(mDesc->getNodalConnectivity()->begin()),*cIDesc(mDesc->getNodalConnectivityIndex()->begin());
+ MCAuto<DataArrayIdType> ciDeepC(mDesc->getNodalConnectivityIndex()->deepCopy());
+ MCAuto<DataArrayIdType> cDeepC(mDesc->getNodalConnectivity()->deepCopy());
MCAuto<MEDCouplingSkyLineArray> connSlaDesc(MEDCouplingSkyLineArray::New(ciDeepC, cDeepC));
- MCAuto<DataArrayInt> desc2(DataArrayInt::New()),descI2(DataArrayInt::New()),revDesc2(DataArrayInt::New()),revDescI2(DataArrayInt::New());
+ MCAuto<DataArrayIdType> desc2(DataArrayIdType::New()),descI2(DataArrayIdType::New()),revDesc2(DataArrayIdType::New()),revDescI2(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> mDesc2 = mDesc->buildDescendingConnectivity(desc2,descI2,revDesc2,revDescI2);
// std::cout << "writing!\n";
// mDesc->writeVTK("/tmp/toto_desc_confInter.vtu");
// mDesc2->writeVTK("/tmp/toto_desc2_confInter.vtu");
- const int *revDescIP2(revDescI2->getConstPointer()), *revDescP2(revDesc2->getConstPointer());
- const int *cDesc2(mDesc2->getNodalConnectivity()->begin()),*cIDesc2(mDesc2->getNodalConnectivityIndex()->begin());
+ const mcIdType *revDescIP2(revDescI2->getConstPointer()), *revDescP2(revDesc2->getConstPointer());
+ const mcIdType *cDesc2(mDesc2->getNodalConnectivity()->begin()),*cIDesc2(mDesc2->getNodalConnectivityIndex()->begin());
MCAuto<DataArrayDouble> bboxArr(mDesc2->getBoundingBoxForBBTree(eps));
const double *bbox2(bboxArr->begin());
- int nDesc2Cell=mDesc2->getNumberOfCells();
- BBTree<SPACEDIM,int> myTree2(bbox2,0,0,nDesc2Cell,-eps);
+ mcIdType nDesc2Cell=mDesc2->getNumberOfCells();
+ BBTree<SPACEDIM,mcIdType> myTree2(bbox2,0,0,nDesc2Cell,-eps);
// Edges - handle longest first
MCAuto<MEDCouplingFieldDouble> lenF = mDesc2->getMeasureField(true);
DataArrayDouble * lens = lenF->getArray();
// Sort edges by decreasing length:
- vector<pair<double,int> > S;
- for(std::size_t i=0;i < lens->getNumberOfTuples();i++)
+ vector<pair<double,mcIdType> > S;
+ for(mcIdType i=0;i < lens->getNumberOfTuples();i++)
{
- pair<double,int> p = make_pair(lens->getIJ(i, 0), i);
+ pair<double,mcIdType> p = make_pair(lens->getIJ(i, 0), i);
S.push_back(p);
}
sort(S.rbegin(),S.rend()); // reverse sort
vector<bool> hit(nDesc2Cell);
fill(hit.begin(), hit.end(), false);
- for( vector<pair<double,int> >::const_iterator it = S.begin(); it != S.end(); it++)
+ for( vector<pair<double,mcIdType> >::const_iterator it = S.begin(); it != S.end(); it++)
{
- int eIdx = (*it).second;
+ mcIdType eIdx = (*it).second;
if (hit[eIdx])
continue;
- vector<int> candidates, cands2;
+ vector<mcIdType> candidates, cands2;
myTree2.getIntersectingElems(bbox2+eIdx*2*SPACEDIM,candidates);
// Keep only candidates colinear with current edge
double vCurr[3];
- unsigned start = cDesc2[cIDesc2[eIdx]+1], end = cDesc2[cIDesc2[eIdx]+2];
- for (int i3=0; i3 < 3; i3++) // TODO: use fillSonCellNodalConnectivity2 or similar?
+ mcIdType start = cDesc2[cIDesc2[eIdx]+1], end = cDesc2[cIDesc2[eIdx]+2];
+ for (mcIdType i3=0; i3 < 3; i3++) // TODO: use fillSonCellNodalConnectivity2 or similar?
vCurr[i3] = coo[start*SPACEDIM+i3] - coo[end*SPACEDIM+i3];
- for(vector<int>::const_iterator it2=candidates.begin();it2!=candidates.end();it2++)
+ for(vector<mcIdType>::const_iterator it2=candidates.begin();it2!=candidates.end();it2++)
{
double vOther[3];
- unsigned start2 = cDesc2[cIDesc2[*it2]+1], end2 = cDesc2[cIDesc2[*it2]+2];
- for (int i3=0; i3 < 3; i3++)
+ mcIdType start2 = cDesc2[cIDesc2[*it2]+1], end2 = cDesc2[cIDesc2[*it2]+2];
+ for (mcIdType i3=0; i3 < 3; i3++)
vOther[i3] = coo[start2*SPACEDIM+i3] - coo[end2*SPACEDIM+i3];
bool col = INTERP_KERNEL::isColinear3D(vCurr, vOther, eps);
// Warning: different from faces: we need to keep eIdx in the final list of candidates because we need
continue;
// Now rotate edges to bring them on Ox
- int startNode = cDesc2[cIDesc2[eIdx]+1];
- int endNode = cDesc2[cIDesc2[eIdx]+2];
+ mcIdType startNode = cDesc2[cIDesc2[eIdx]+1];
+ mcIdType endNode = cDesc2[cIDesc2[eIdx]+2];
INTERP_KERNEL::TranslationRotationMatrix rotation;
INTERP_KERNEL::TranslationRotationMatrix::Rotate3DBipoint(coo+SPACEDIM*startNode, coo+SPACEDIM*endNode, rotation);
MCAuto<MEDCouplingUMesh> mPartRef(mDesc2->buildPartOfMySelfSlice(eIdx, eIdx+1,1,false)); // false=zipCoords is called
MCAuto<MEDCouplingUMesh> mPartCand(mDesc2->buildPartOfMySelf(&cands2[0], &cands2[0]+cands2.size(), true)); // true=zipCoords is called
- MCAuto<DataArrayInt> nodeMap(mPartCand->zipCoordsTraducer());
- int nbElemsNotM1;
+ MCAuto<DataArrayIdType> nodeMap(mPartCand->zipCoordsTraducer());
+ mcIdType nbElemsNotM1;
{
- MCAuto<DataArrayInt> tmp(nodeMap->findIdsNotEqual(-1));
+ MCAuto<DataArrayIdType> tmp(nodeMap->findIdsNotEqual(-1));
nbElemsNotM1 = tmp->getNbOfElems();
}
- MCAuto<DataArrayInt> nodeMapInv = nodeMap->invertArrayO2N2N2O(nbElemsNotM1);
+ MCAuto<DataArrayIdType> nodeMapInv = nodeMap->invertArrayO2N2N2O(nbElemsNotM1);
double * cooPartRef(mPartRef->_coords->getPointer());
double * cooPartCand(mPartCand->_coords->getPointer());
- for (std::size_t ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++)
+ for (mcIdType ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++)
rotation.transform_vector(cooPartRef+SPACEDIM*ii);
- for (std::size_t ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++)
+ for (mcIdType ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++)
rotation.transform_vector(cooPartCand+SPACEDIM*ii);
// Eliminate all edges for which y or z is not null
MCAuto<DataArrayDouble> baryPart = mPartCand->computeCellCenterOfMass();
- vector<int> compo; compo.push_back(1);
+ vector<std::size_t> compo; compo.push_back(1);
MCAuto<DataArrayDouble> baryPartY = baryPart->keepSelectedComponents(compo);
compo[0] = 2;
MCAuto<DataArrayDouble> baryPartZ = baryPart->keepSelectedComponents(compo);
- MCAuto<DataArrayInt> idsGoodLine1 = baryPartY->findIdsInRange(-eps, +eps);
- MCAuto<DataArrayInt> idsGoodLine2 = baryPartZ->findIdsInRange(-eps, +eps);
- MCAuto<DataArrayInt> idsGoodLine = idsGoodLine1->buildIntersection(idsGoodLine2);
+ MCAuto<DataArrayIdType> idsGoodLine1 = baryPartY->findIdsInRange(-eps, +eps);
+ MCAuto<DataArrayIdType> idsGoodLine2 = baryPartZ->findIdsInRange(-eps, +eps);
+ MCAuto<DataArrayIdType> idsGoodLine = idsGoodLine1->buildIntersection(idsGoodLine2);
if (!idsGoodLine->getNumberOfTuples())
continue;
// Now the ordering along the Ox axis:
- std::vector<int> insidePoints, hitSegs;
+ std::vector<mcIdType> insidePoints, hitSegs;
bool isSplit = OrderPointsAlongLine(mPartCand->_coords->getConstPointer(), nodeMap->begin()[startNode], nodeMap->begin()[endNode],
mPartCand->getNodalConnectivity()->begin(), mPartCand->getNodalConnectivityIndex()->begin(),
idsGoodLine->begin(), idsGoodLine->end(),
/*out*/insidePoints, hitSegs);
// Optim: smaller segments completely included in eIdx and not split won't need any further treatment:
- for (vector<int>::const_iterator its=hitSegs.begin(); its != hitSegs.end(); ++its)
+ for (vector<mcIdType>::const_iterator its=hitSegs.begin(); its != hitSegs.end(); ++its)
hit[cands2[*its]] = true;
if (!isSplit) // current segment remains in one piece
continue;
// Get original node IDs in global coords array
- for (std::vector<int>::iterator iit = insidePoints.begin(); iit!=insidePoints.end(); ++iit)
+ for (std::vector<mcIdType>::iterator iit = insidePoints.begin(); iit!=insidePoints.end(); ++iit)
*iit = nodeMapInv->begin()[*iit];
- vector<int> polyIndices, packsIds, facePack;
+ vector<mcIdType> polyIndices, packsIds, facePack;
// For each face implying this edge
- for (int ii=revDescIP2[eIdx]; ii < revDescIP2[eIdx+1]; ii++)
+ for (mcIdType ii=revDescIP2[eIdx]; ii < revDescIP2[eIdx+1]; ii++)
{
- int faceIdx = revDescP2[ii];
+ mcIdType faceIdx = revDescP2[ii];
// each cell where this face is involved connectivity will be modified:
ret->pushBackValsSilent(revDescP + revDescIP[faceIdx], revDescP + revDescIP[faceIdx+1]);
// Current face connectivity
- const int * sIdxConn = cDesc + cIDesc[faceIdx] + 1;
- const int * sIdxConnE = cDesc + cIDesc[faceIdx+1];
+ const mcIdType * sIdxConn = cDesc + cIDesc[faceIdx] + 1;
+ const mcIdType * sIdxConnE = cDesc + cIDesc[faceIdx+1];
- vector<int> modifiedFace;
+ vector<mcIdType> modifiedFace;
ReplaceEdgeInFace(sIdxConn, sIdxConnE, startNode, endNode, insidePoints, /*out*/modifiedFace);
modifiedFace.insert(modifiedFace.begin(), INTERP_KERNEL::NORM_POLYGON);
connSlaDesc->replaceSimplePack(faceIdx, modifiedFace.data(), modifiedFace.data()+modifiedFace.size());
// Rebuild 3D connectivity from descending:
MCAuto<MEDCouplingSkyLineArray> newConn(MEDCouplingSkyLineArray::New());
- MCAuto<DataArrayInt> superIdx(DataArrayInt::New()); superIdx->alloc(getNumberOfCells()+1); superIdx->fillWithValue(0);
- MCAuto<DataArrayInt> idx(DataArrayInt::New()); idx->alloc(1); idx->fillWithValue(0);
- MCAuto<DataArrayInt> vals(DataArrayInt::New()); vals->alloc(0);
+ MCAuto<DataArrayIdType> superIdx(DataArrayIdType::New()); superIdx->alloc(getNumberOfCells()+1); superIdx->fillWithValue(0);
+ MCAuto<DataArrayIdType> idx(DataArrayIdType::New()); idx->alloc(1); idx->fillWithValue(0);
+ MCAuto<DataArrayIdType> vals(DataArrayIdType::New()); vals->alloc(0);
newConn->set3(superIdx, idx, vals);
- for(std::size_t ii = 0; ii < getNumberOfCells(); ii++)
- for (int jj=descIP[ii]; jj < descIP[ii+1]; jj++)
+ mcIdType nbCells=getNumberOfCells();
+ for(mcIdType ii = 0; ii < nbCells; ii++)
+ for (mcIdType jj=descIP[ii]; jj < descIP[ii+1]; jj++)
{
- int sz, faceIdx = abs(descP[jj])-1;
+ mcIdType sz, faceIdx = abs(descP[jj])-1;
bool orient = descP[jj]>0;
- const int * p = connSlaDesc->getSimplePackSafePtr(faceIdx, sz);
+ const mcIdType * p = connSlaDesc->getSimplePackSafePtr(faceIdx, sz);
if (orient)
newConn->pushBackPack(ii, p+1, p+sz); // +1 to skip type
else
{
- vector<int> rev(sz-1);
- for (int kk=0; kk<sz-1; kk++) rev[kk]=*(p+sz-kk-1);
+ vector<mcIdType> rev(sz-1);
+ for (mcIdType kk=0; kk<sz-1; kk++) rev[kk]=*(p+sz-kk-1);
newConn->pushBackPack(ii, rev.data(), rev.data()+sz-1);
}
}
line->setCoords(coo);
}
line->allocateCells();
- static const int CONN[2]={0,1};
+ static const mcIdType CONN[2]={0,1};
line->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,CONN);
MCAuto<MEDCouplingUMesh> sp2,sp1;
{
- DataArrayInt *cellNb1(0),*cellNb2(0);
+ DataArrayIdType *cellNb1(0),*cellNb2(0);
MEDCouplingUMesh *sp2Pt(0),*sp1Pt(0);
MEDCouplingUMesh::Intersect2DMeshWith1DLine(mu,line,eps,sp2Pt,sp1Pt,cellNb1,cellNb2);
sp1=sp1Pt; sp2=sp2Pt;
- MCAuto<DataArrayInt> cellNb10(cellNb1),cellNb20(cellNb2);
+ MCAuto<DataArrayIdType> cellNb10(cellNb1),cellNb20(cellNb2);
}
- std::vector<int> ccp;
+ std::vector<mcIdType> ccp;
sp2->getCellsContainingPoint(pt1,eps,ccp);
if(ccp.size()!=1)
throw INTERP_KERNEL::Exception("ComputeBigCellFrom : expected single element !");
MCAuto<MEDCouplingUMesh> MergeVorCells2D(MEDCouplingUMesh *p, double eps, bool isZip)
{
- MCAuto<DataArrayInt> edgeToKeep;
+ MCAuto<DataArrayIdType> edgeToKeep;
MCAuto<MEDCouplingUMesh> p0;
{
- MCAuto<DataArrayInt> d(DataArrayInt::New()),di(DataArrayInt::New()),rd(DataArrayInt::New()),rdi(DataArrayInt::New());
+ MCAuto<DataArrayIdType> d(DataArrayIdType::New()),di(DataArrayIdType::New()),rd(DataArrayIdType::New()),rdi(DataArrayIdType::New());
p0=p->buildDescendingConnectivity(d,di,rd,rdi);
- MCAuto<DataArrayInt> dsi(rdi->deltaShiftIndex());
+ MCAuto<DataArrayIdType> dsi(rdi->deltaShiftIndex());
edgeToKeep=dsi->findIdsEqual(1);
}
MCAuto<MEDCouplingUMesh> skinOfRes(p0->buildPartOfMySelf(edgeToKeep->begin(),edgeToKeep->end()));
if(isZip)
{
skinOfRes->zipCoords();
- if(skinOfRes->getNumberOfCells()!=skinOfRes->getNumberOfNodes())
+ if(ToIdType(skinOfRes->getNumberOfCells())!=skinOfRes->getNumberOfNodes())
throw INTERP_KERNEL::Exception("MergeVorCells : result of merge looks bad !");
}
- MCAuto<DataArrayInt> d(skinOfRes->orderConsecutiveCells1D());
+ MCAuto<DataArrayIdType> d(skinOfRes->orderConsecutiveCells1D());
MCAuto<MEDCoupling1SGTUMesh> skinOfRes2;
{
MCAuto<MEDCouplingUMesh> part(skinOfRes->buildPartOfMySelf(d->begin(),d->end()));
skinOfRes2=MEDCoupling1SGTUMesh::New(part);
}
- MCAuto<DataArrayInt> c(skinOfRes2->getNodalConnectivity()->deepCopy());
+ MCAuto<DataArrayIdType> c(skinOfRes2->getNodalConnectivity()->deepCopy());
c->circularPermutation(1);
c->rearrange(2);
- std::vector< MCAuto<DataArrayInt> > vdi(c->explodeComponents());
+ std::vector< MCAuto<DataArrayIdType> > vdi(c->explodeComponents());
if(!vdi[0]->isEqual(*vdi[1]))
throw INTERP_KERNEL::Exception("MergeVorCells : internal error !");
MCAuto<MEDCouplingUMesh> m(MEDCouplingUMesh::New("",2));
}
p->zipCoords();
{
- bool dummy; int dummy2;
- MCAuto<DataArrayInt> dummy3(p->mergeNodes(eps,dummy,dummy2));
+ bool dummy; mcIdType dummy2;
+ MCAuto<DataArrayIdType> dummy3(p->mergeNodes(eps,dummy,dummy2));
}
return MergeVorCells2D(p,eps,true);
}
{
if(m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("SimplifyPolygon : internal error !");
- const int *conn(m->getNodalConnectivity()->begin()),*conni(m->getNodalConnectivityIndex()->begin());
- int nbPtsInPolygon(conni[1]-conni[0]-1);
+ const mcIdType *conn(m->getNodalConnectivity()->begin()),*conni(m->getNodalConnectivityIndex()->begin());
+ mcIdType nbPtsInPolygon(conni[1]-conni[0]-1);
const double *coo(m->getCoords()->begin());
- std::vector<int> resConn;
- for(int i=0;i<nbPtsInPolygon;i++)
+ std::vector<mcIdType> resConn;
+ for(mcIdType i=0;i<nbPtsInPolygon;i++)
{
- int prev(conn[(i+nbPtsInPolygon-1)%nbPtsInPolygon+1]),current(conn[i%nbPtsInPolygon+1]),zeNext(conn[(i+1)%nbPtsInPolygon+1]);
+ mcIdType prev(conn[(i+nbPtsInPolygon-1)%nbPtsInPolygon+1]),current(conn[i%nbPtsInPolygon+1]),zeNext(conn[(i+1)%nbPtsInPolygon+1]);
double a[3]={
coo[3*prev+0]-coo[3*current+0],
coo[3*prev+1]-coo[3*current+1],
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("",2));
ret->setCoords(m->getCoords());
ret->allocateCells();
- ret->insertNextCell(INTERP_KERNEL::NORM_POLYGON,resConn.size(),&resConn[0]);
+ ret->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(resConn.size()),&resConn[0]);
return ret;
}
}
p->zipCoords();
{
- bool dummy; int dummy2;
- MCAuto<DataArrayInt> dummy3(p->mergeNodes(eps,dummy,dummy2));
+ bool dummy; mcIdType dummy2;
+ MCAuto<DataArrayIdType> dummy3(p->mergeNodes(eps,dummy,dummy2));
}
- MCAuto<DataArrayInt> edgeToKeep;
+ MCAuto<DataArrayIdType> edgeToKeep;
MCAuto<MEDCouplingUMesh> p0;
{
- MCAuto<DataArrayInt> d(DataArrayInt::New()),di(DataArrayInt::New()),rd(DataArrayInt::New()),rdi(DataArrayInt::New());
+ MCAuto<DataArrayIdType> d(DataArrayIdType::New()),di(DataArrayIdType::New()),rd(DataArrayIdType::New()),rdi(DataArrayIdType::New());
p0=p->buildDescendingConnectivity(d,di,rd,rdi);
- MCAuto<DataArrayInt> dsi(rdi->deltaShiftIndex());
+ MCAuto<DataArrayIdType> dsi(rdi->deltaShiftIndex());
edgeToKeep=dsi->findIdsEqual(1);
}
MCAuto<MEDCouplingUMesh> skinOfRes(p0->buildPartOfMySelf(edgeToKeep->begin(),edgeToKeep->end()));
MCAuto<DataArrayDouble> eqn(skinOfRes->computePlaneEquationOf3DFaces());
- MCAuto<DataArrayInt> comm,commI;
+ MCAuto<DataArrayIdType> comm,commI;
{
- DataArrayInt *a(0),*b(0);
+ DataArrayIdType *a(0),*b(0);
eqn->findCommonTuples(eps,0,a,b);
comm=a; commI=b;
- //comm=DataArrayInt::New(); comm->alloc(0,1); commI=DataArrayInt::New(); commI->alloc(1,1); commI->setIJ(0,0,0);
+ //comm=DataArrayIdType::New(); comm->alloc(0,1); commI=DataArrayIdType::New(); commI->alloc(1,1); commI->setIJ(0,0,0);
}
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("",3));
ret->setCoords(skinOfRes->getCoords());
ret->allocateCells();
- std::vector<int> conn;
+ std::vector<mcIdType> conn;
int jj(0);
- for(int i=0;i<commI->getNumberOfTuples()-1;i++,jj++)
+ for(mcIdType i=0;i<commI->getNumberOfTuples()-1;i++,jj++)
{
if(jj!=0)
conn.push_back(-1);
else
tmp2=MergeVorCells2D(tmp,eps,false);
tmp2=SimplifyPolygon(tmp2,eps);
- const int *cPtr(tmp2->getNodalConnectivity()->begin()),*ciPtr(tmp2->getNodalConnectivityIndex()->begin());
+ const mcIdType *cPtr(tmp2->getNodalConnectivity()->begin()),*ciPtr(tmp2->getNodalConnectivityIndex()->begin());
conn.insert(conn.end(),cPtr+1,cPtr+ciPtr[1]);
}
- MCAuto<DataArrayInt> remain(comm->buildComplement(skinOfRes->getNumberOfCells()));
+ MCAuto<DataArrayIdType> remain(comm->buildComplement(ToIdType(skinOfRes->getNumberOfCells())));
{
MCAuto<MEDCouplingUMesh> tmp(skinOfRes->buildPartOfMySelf(remain->begin(),remain->end(),true));
- const int *cPtr(tmp->getNodalConnectivity()->begin()),*ciPtr(tmp->getNodalConnectivityIndex()->begin());
- for(int i=0;i<remain->getNumberOfTuples();i++,jj++)
+ const mcIdType *cPtr(tmp->getNodalConnectivity()->begin()),*ciPtr(tmp->getNodalConnectivityIndex()->begin());
+ for(mcIdType i=0;i<remain->getNumberOfTuples();i++,jj++)
{
if(jj!=0)
conn.push_back(-1);
conn.insert(conn.end(),cPtr+ciPtr[i]+1,cPtr+ciPtr[i+1]);
}
}
- ret->insertNextCell(INTERP_KERNEL::NORM_POLYHED,conn.size(),&conn[0]);
+ ret->insertNextCell(INTERP_KERNEL::NORM_POLYHED,ToIdType(conn.size()),&conn[0]);
return ret;
}
MCAuto<MEDCouplingUMesh> MergeVorCells1D(const std::vector< MCAuto<MEDCouplingUMesh> >& vcs, double eps)
{
- static const int CONN_SEG2_DFT[2]={0,1};
+ static const mcIdType CONN_SEG2_DFT[2]={0,1};
if(vcs.empty())
throw INTERP_KERNEL::Exception("MergeVorCells1D : internal error 1 !");
if(vcs.size()==1)
throw INTERP_KERNEL::Exception("MergeVorCells1D : internal error 2 !");
double a0,b0,a1,b1;
{
- const int *connPtr(vcs[0]->getNodalConnectivity()->begin());
+ const mcIdType *connPtr(vcs[0]->getNodalConnectivity()->begin());
const double *coordPtr(vcs[0]->getCoords()->begin());
a0=coordPtr[connPtr[1]]; b0=coordPtr[connPtr[2]];
}
{
- const int *connPtr(vcs[1]->getNodalConnectivity()->begin());
+ const mcIdType *connPtr(vcs[1]->getNodalConnectivity()->begin());
const double *coordPtr(vcs[1]->getCoords()->begin());
a1=coordPtr[connPtr[1]]; b1=coordPtr[connPtr[2]];
}
MCAuto<MEDCouplingUMesh> MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const
{
- static const int CONN_SEG2_DFT[2]={0,1};
+ static const mcIdType CONN_SEG2_DFT[2]={0,1};
if(!m || !points)
throw INTERP_KERNEL::Exception("Voronoize1D : null pointer !");
m->checkConsistencyLight();
throw INTERP_KERNEL::Exception("Voronoize1D : spacedim must be equal to 1 and meshdim also equal to 1 !");
if(m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("Voronoize1D : mesh is expected to have only one cell !");
- int nbPts(points->getNumberOfTuples());
+ mcIdType nbPts(points->getNumberOfTuples());
if(nbPts<1)
throw INTERP_KERNEL::Exception("Voronoize1D : at least one point expected !");
std::vector<double> bbox(4);
m->getBoundingBox(&bbox[0]);
std::vector< MCAuto<MEDCouplingUMesh> > l0(1,MCAuto<MEDCouplingUMesh>(m->deepCopy()));
const double *pts(points->begin());
- for(int i=1;i<nbPts;i++)
+ for(mcIdType i=1;i<nbPts;i++)
{
MCAuto<MEDCouplingUMesh> vorTess;
{
}
{
bool dummy;
- int newNbNodes;
- MCAuto<DataArrayInt> dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes));
+ mcIdType newNbNodes;
+ MCAuto<DataArrayIdType> dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes));
}
- std::vector<int> polygsToIterOn;
+ std::vector<mcIdType> polygsToIterOn;
const double *pt(pts+i);
vorTess->getCellsContainingPoint(pt,eps,polygsToIterOn);
if(polygsToIterOn.empty())
if(polygsToIterOn.size()>2)
throw INTERP_KERNEL::Exception("Voronoize1D : overlap of points !");
std::vector< MCAuto<MEDCouplingUMesh> > newVorCells;
- for(std::vector<int>::const_iterator it=polygsToIterOn.begin();it!=polygsToIterOn.end();it++)
+ for(std::vector<mcIdType>::const_iterator it=polygsToIterOn.begin();it!=polygsToIterOn.end();it++)
{
- int poly(*it);
+ mcIdType poly(*it);
//
double seed(pts[poly]),zept(*pt);
double mid((seed+zept)/2.);
tile->zipCoords();
double a,b;
{
- const int *connPtr(tile->getNodalConnectivity()->begin());
+ const mcIdType *connPtr(tile->getNodalConnectivity()->begin());
const double *coordPtr(tile->getCoords()->begin());
a=coordPtr[connPtr[1]]; b=coordPtr[connPtr[2]];
}
std::vector< const MEDCouplingUMesh * > l0Bis(VecAutoToVecOfCstPt(l0));
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::MergeUMeshes(l0Bis));
{
- bool dummy; int dummy2;
- MCAuto<DataArrayInt> dummy3(ret->mergeNodes(eps,dummy,dummy2));
+ bool dummy; mcIdType dummy2;
+ MCAuto<DataArrayIdType> dummy3(ret->mergeNodes(eps,dummy,dummy2));
}
return ret;
}
throw INTERP_KERNEL::Exception("Voronoize2D : spacedim must be equal to 2 and meshdim also equal to 2 !");
if(m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("Voronoize2D : mesh is expected to have only one cell !");
- int nbPts(points->getNumberOfTuples());
+ mcIdType nbPts(points->getNumberOfTuples());
if(nbPts<1)
throw INTERP_KERNEL::Exception("Voronoize2D : at least one point expected !");
std::vector<double> bbox(4);
m->getBoundingBox(&bbox[0]);
std::vector< MCAuto<MEDCouplingUMesh> > l0(1,MCAuto<MEDCouplingUMesh>(m->deepCopy()));
const double *pts(points->begin());
- for(int i=1;i<nbPts;i++)
+ for(mcIdType i=1;i<nbPts;i++)
{
MCAuto<MEDCouplingUMesh> vorTess;
{
}
{
bool dummy;
- int newNbNodes;
- MCAuto<DataArrayInt> dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes));
+ mcIdType newNbNodes;
+ MCAuto<DataArrayIdType> dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes));
}
- std::vector<int> polygsToIterOn;
+ std::vector<mcIdType> polygsToIterOn;
const double *pt(pts+i*2);
vorTess->getCellsContainingPoint(pt,eps,polygsToIterOn);
if(polygsToIterOn.size()<1)
throw INTERP_KERNEL::Exception("Voronoize2D : presence of a point outside the given cell !");
- std::set<int> elemsToDo,elemsDone; elemsToDo.insert(polygsToIterOn[0]);
+ std::set<mcIdType> elemsToDo,elemsDone; elemsToDo.insert(polygsToIterOn[0]);
std::vector< MCAuto<MEDCouplingUMesh> > newVorCells;
while(!elemsToDo.empty())
{
- int poly(*elemsToDo.begin()); elemsToDo.erase(elemsToDo.begin()); elemsDone.insert(poly);
+ mcIdType poly(*elemsToDo.begin()); elemsToDo.erase(elemsToDo.begin()); elemsDone.insert(poly);
const double *seed(pts+2*poly);
MCAuto<MEDCouplingUMesh> cell(ComputeBigCellFrom(pt,seed,bbox,eps));
MCAuto<MEDCouplingUMesh> tile(l0[poly]);
tile->zipCoords();
MCAuto<MEDCouplingUMesh> a;
- MCAuto<DataArrayInt> b,c;
+ MCAuto<DataArrayIdType> b,c;
{
- DataArrayInt *bPtr(0),*cPtr(0);
+ DataArrayIdType *bPtr(0),*cPtr(0);
a=MEDCouplingUMesh::Intersect2DMeshes(tile,cell,eps,bPtr,cPtr);
b=bPtr; c=cPtr;
}
- MCAuto<DataArrayInt> part(c->findIdsEqual(-1));
+ MCAuto<DataArrayIdType> part(c->findIdsEqual(-1));
if(part->getNumberOfTuples()!=1)
throw INTERP_KERNEL::Exception("Voronoize2D : internal error");
MCAuto<MEDCouplingUMesh> newVorCell;
{
- MCAuto<DataArrayInt> tmp(part->buildComplement(a->getNumberOfCells()));
+ MCAuto<DataArrayIdType> tmp(part->buildComplement(ToIdType(a->getNumberOfCells())));
newVorCell=a->buildPartOfMySelf(tmp->begin(),tmp->end());
}
newVorCell->zipCoords();
modifiedCell->zipCoords();
l0[poly]=modifiedCell;
//
- MCAuto<DataArrayInt> ids;
+ MCAuto<DataArrayIdType> ids;
{
- DataArrayInt *tmp(0);
+ DataArrayIdType *tmp(0);
bool sta(a->getCoords()->areIncludedInMe(cell->getCoords(),eps,tmp));
ids=tmp;
if(!sta)
}
MCAuto<DataArrayDouble> newCoords;
{
- MCAuto<DataArrayInt> tmp(ids->buildComplement(a->getNumberOfNodes()));
+ MCAuto<DataArrayIdType> tmp(ids->buildComplement(a->getNumberOfNodes()));
newCoords=a->getCoords()->selectByTupleId(tmp->begin(),tmp->end());
}
const double *cPtr(newCoords->begin());
- for(int j=0;j<newCoords->getNumberOfTuples();j++,cPtr+=2)
+ for(mcIdType j=0;j<newCoords->getNumberOfTuples();j++,cPtr+=2)
{
- std::set<int> zeCandidates;
+ std::set<mcIdType> zeCandidates;
{
- std::vector<int> zeCandidatesTmp;
+ std::vector<mcIdType> zeCandidatesTmp;
vorTess->getCellsContainingPoint(cPtr,eps,zeCandidatesTmp);
zeCandidates.insert(zeCandidatesTmp.begin(),zeCandidatesTmp.end());
}
- std::set<int> tmp2,newElementsToDo;
+ std::set<mcIdType> tmp2,newElementsToDo;
std::set_difference(zeCandidates.begin(),zeCandidates.end(),elemsDone.begin(),elemsDone.end(),std::inserter(tmp2,tmp2.begin()));
std::set_union(elemsToDo.begin(),elemsToDo.end(),tmp2.begin(),tmp2.end(),std::inserter(newElementsToDo,newElementsToDo.begin()));
elemsToDo=newElementsToDo;
std::vector< const MEDCouplingUMesh * > l0Bis(VecAutoToVecOfCstPt(l0));
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::MergeUMeshes(l0Bis));
{
- bool dummy; int dummy2;
- MCAuto<DataArrayInt> dummy3(ret->mergeNodes(eps,dummy,dummy2));
+ bool dummy; mcIdType dummy2;
+ MCAuto<DataArrayIdType> dummy3(ret->mergeNodes(eps,dummy,dummy2));
}
return ret;
}
-MCAuto<MEDCouplingUMesh> Split3DCellInParts(const MEDCouplingUMesh *m, const double pt[3], const double seed[3], double eps, int tmp[2])
+MCAuto<MEDCouplingUMesh> Split3DCellInParts(const MEDCouplingUMesh *m, const double pt[3], const double seed[3], double eps, mcIdType tmp[2])
{
if(m->getMeshDimension()!=3 || m->getSpaceDimension()!=3 || m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("Split3DCellInParts : expecting a 3D with exactly one cell !");
MCAuto<MEDCouplingUMesh> MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const
{
- double eps2(1.-sqrt(eps));// 2nd eps for interpolation. Here the eps is computed to feet cos(eps) ~ 1-eps^2
+ //double eps2(1.-sqrt(eps));// 2nd eps for interpolation. Here the eps is computed to feet cos(eps) ~ 1-eps^2
if(!m || !points)
throw INTERP_KERNEL::Exception("Voronoize3D : null pointer !");
m->checkConsistencyLight();
throw INTERP_KERNEL::Exception("Voronoize3D : spacedim must be equal to 3 and meshdim also equal to 3 !");
if(m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("Voronoize3D : mesh is expected to have only one cell !");
- int nbPts(points->getNumberOfTuples());
+ mcIdType nbPts(points->getNumberOfTuples());
if(nbPts<1)
throw INTERP_KERNEL::Exception("Voronoize3D : at least one point expected !");
std::vector< MCAuto<MEDCouplingUMesh> > l0(1,MCAuto<MEDCouplingUMesh>(m->deepCopy()));
const double *pts(points->begin());
- for(int i=1;i<nbPts;i++)
+ for(mcIdType i=1;i<nbPts;i++)
{
MCAuto<MEDCouplingUMesh> vorTess;
{
}
{
bool dummy;
- int newNbNodes;
- MCAuto<DataArrayInt> dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes));
+ mcIdType newNbNodes;
+ MCAuto<DataArrayIdType> dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes));
}
- std::vector<int> polygsToIterOn;
+ std::vector<mcIdType> polygsToIterOn;
const double *pt(pts+i*3);
vorTess->getCellsContainingPoint(pt,eps,polygsToIterOn);
if(polygsToIterOn.size()<1)
throw INTERP_KERNEL::Exception("Voronoize3D : presence of a point outside the given cell !");
std::vector< MCAuto<MEDCouplingUMesh> > newVorCells;
- for(int poly=0;poly<vorTess->getNumberOfCells();poly++)
+ for(mcIdType poly=0;poly<ToIdType(vorTess->getNumberOfCells());poly++)
{
const double *seed(pts+3*poly);
MCAuto<MEDCouplingUMesh> tile(l0[poly]);
tile->zipCoords();
- int tmp[2];
+ mcIdType tmp[2];
MCAuto<MEDCouplingUMesh> cells;
try
{
cells=Split3DCellInParts(tile,pt,seed,eps,tmp);
}
- catch(INTERP_KERNEL::Exception& e)
+ catch(INTERP_KERNEL::Exception&)
{
continue;
}
std::vector< const MEDCouplingUMesh * > l0Bis(VecAutoToVecOfCstPt(l0));
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::MergeUMeshes(l0Bis));
{
- bool dummy; int dummy2;
- MCAuto<DataArrayInt> dummy3(ret->mergeNodes(eps,dummy,dummy2));
+ bool dummy; mcIdType dummy2;
+ MCAuto<DataArrayIdType> dummy3(ret->mergeNodes(eps,dummy,dummy2));
}
return ret;
}
#define __MEDCOUPLINGBASICSTEST_HXX__
#include <cppunit/extensions/HelperMacros.h>
+#include "MCType.hxx"
#include <map>
#include <vector>
static DataArrayDouble *buildCoordsForMultiTypes_1();
static MEDCouplingMultiFields *buildMultiFields_1();
static std::vector<MEDCouplingFieldDouble *> buildMultiFields_2();
- static double sumAll(const std::vector< std::map<int,double> >& matrix);
+ static double sumAll(const std::vector< std::map<mcIdType,double> >& matrix);
protected:
- static int countNonZero(const std::vector< std::map<int,double> >& matrix);
+ static int countNonZero(const std::vector< std::map<mcIdType,double> >& matrix);
static void test2D1DMeshesIntersection(MEDCouplingUMesh *sourceMesh,
MEDCouplingUMesh *targetMesh,
using namespace MEDCoupling;
-typedef std::vector<std::map<int,double> > IntersectionMatrix;
+typedef std::vector<std::map<mcIdType,double> > IntersectionMatrix;
MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSourceMesh_2()
{
0.0, 200.0, 200.0, 200.0, 0.0, 200.0, 200.0, 100.0, 200.0, 200.0, 200.0, 149.999999970343, 149.9999999874621, 49.999999881628682};
- int sourceConn[212]={25, 27, 13, 19, 18, 3, 20, 21, 5, 10, 17, 1, 1, 3, 0, 7, 18, 1, 0, 27, 12, 27, 13, 24, 25, 19, 16, 26, 1, 2, 6, 8, 15, 13,
+ mcIdType sourceConn[212]={25, 27, 13, 19, 18, 3, 20, 21, 5, 10, 17, 1, 1, 3, 0, 7, 18, 1, 0, 27, 12, 27, 13, 24, 25, 19, 16, 26, 1, 2, 6, 8, 15, 13,
12, 5, 24, 13, 25, 27, 10, 11, 9, 6, 19, 8, 23, 1, 22, 8, 23, 19, 16, 13, 17, 1, 6, 9, 10, 8, 13, 17, 5, 15, 5, 4, 1, 12, 18,
0, 24, 27, 19, 20, 18, 1, 7, 6, 5, 1, 4, 12, 15, 14, 25, 27, 19, 18, 1, 19, 16, 13, 20, 19, 23, 1, 27, 12, 1, 0, 6, 5, 1, 10,
4, 5, 1, 7, 12, 27, 1, 13, 5, 15, 4, 12, 19, 16, 26, 22, 13, 5, 17, 1, 1, 3, 7, 2, 13, 5, 1, 12, 18, 1, 3, 0, 8, 23, 2, 9, 3,
MEDCouplingUMesh *MEDCouplingBasicsTest::build3DTargetMesh_2()
{
double targetCoords[24]={200.0, 200.0, 0.0, 200.0, 200.0, 200.0, 200.0, 0.0, 0.0, 200.0, 0.0, 200.0, 0.0, 200.0, 0.0, 0.0, 200.0, 200.0, 0.0, 0.0, 0.0, 0.0, 0.0, 200.0};
- int targetConn[20]={5, 6, 3, 0, 1, 3, 0, 5, 3, 6, 5, 7, 6, 4, 0, 5, 6, 3, 0, 2};
+ mcIdType targetConn[20]={5, 6, 3, 0, 1, 3, 0, 5, 3, 6, 5, 7, 6, 4, 0, 5, 6, 3, 0, 2};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(3);
targetMesh->allocateCells(5);
25.,25.,0., 25.,25.,50., 25.,25.,200., 75.,25.,0., 75.,25.,50., 75.,25.,200.,
25.,125.,0., 25.,125.,50., 25.,125.,200., 125.,125.,0., 125.,125.,50., 125.,125.,200.
};
- int targetConn[16]={0,1, 1,2, 3,4, 4,5, 6,7, 7,8, 9,10, 10,11};
+ mcIdType targetConn[16]={0,1, 1,2, 3,4, 4,5, 6,7, 7,8, 9,10, 10,11};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New("my name of mesh 1D",1);
targetMesh->allocateCells(8);
MEDCouplingUMesh *MEDCouplingBasicsTest::build2DSourceMesh_1()
{
double sourceCoords[8]={-0.3,-0.3, 0.7,-0.3, -0.3,0.7, 0.7,0.7};
- int sourceConn[6]={0,3,1,0,2,3};
+ mcIdType sourceConn[6]={0,3,1,0,2,3};
MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New("my name of mesh 2D",2);
sourceMesh->allocateCells(2);
sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,sourceConn);
MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMesh_1()
{
double targetCoords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 };
- int targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ mcIdType targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(5);
MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMeshPerm_1()
{
double targetCoords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 };
- int targetConn[18]={0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4};
+ mcIdType targetConn[18]={0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(5);
MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMesh_2()
{
double targetCoords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 };
- int targetConn[24]={0,3,4, 0,4,1, 1,4,2, 4,5,2, 3,6,4, 6,7,4, 4,7,5, 7,8,5 };
+ mcIdType targetConn[24]={0,3,4, 0,4,1, 1,4,2, 4,5,2, 3,6,4, 6,7,4, 4,7,5, 7,8,5 };
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(8);
MEDCouplingUMesh *MEDCouplingBasicsTest::buildCU1DMesh_U()
{
double coords[4]={ 0.0, 0.3, 0.75, 1.0 };
- int conn[2*3]={ 0,1, 1,2, 2,3 };
+ mcIdType conn[2*3]={ 0,1, 1,2, 2,3 };
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(1);
mesh->allocateCells(3);
MEDCouplingUMesh *MEDCouplingBasicsTest::buildCU2DMesh_U()
{
double coords[18]={0.0,0.0, 0.5,0.0, 1.0,0.0, 0.0,0.5, 0.5,0.5, 1.0,0.5, 0.0,1.0, 0.5,1.0, 1.0,1.0 };
- int conn[18]={0,1,4,3, 3,4,7,6, 4,5,8,7, 1,5,4, 1,2,5 };
+ mcIdType conn[18]={0,1,4,3, 3,4,7,6, 4,5,8,7, 1,5,4, 1,2,5 };
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
// 0.0,1.0,0.0 ,0.0,0.3,0.0 ,0.0,0.3,0.3 ,0.3,0.0,0.0 ,0.3,0.3,1.0 ,1.0,0.0,1.0 ,1.0,0.0,0.3 ,0.3,0.0,0.3 ,0.3,1.0,0.3 ,0.0,0.3,1.0 ,0.3,0.0,1.0 ,0.3,0.3,0.3 ,1.0,0.3,1.0 ,1.0,0.0,0.0 ,0.0,0.0,0.0 ,1.0,0.3,0.3 ,0.3,1.0,0.0 ,1.0,1.0,0.3 ,1.0,1.0,1.0 ,0.0,1.0,1.0 ,0.3,0.3,0.0 ,0.0,1.0,0.3 ,0.0,0.0,1.0 ,0.3,1.0,1.0 ,1.0,0.3,0.0 ,0.0,0.0,0.3 ,1.0,1.0,0.0
0.0,0.0,0.0, 0.3,0.0,0.0, 1.0,0.0,0.0, 0.0,0.3,0.0, 0.3,0.3,0.0, 1.0,0.3,0.0, 0.0,1.0,0.0, 0.3,1.0,0.0, 1.0,1.0,0.0, 0.0,0.0,0.3, 0.3,0.0,0.3, 1.0,0.0,0.3, 0.0,0.3,0.3, 0.3,0.3,0.3, 1.0,0.3,0.3, 0.0,1.0,0.3, 0.3,1.0,0.3, 1.0,1.0,0.3, 0.0,0.0,1.0, 0.3,0.0,1.0, 1.0,0.0,1.0, 0.0,0.3,1.0, 0.3,0.3,1.0, 1.0,0.3,1.0, 0.0,1.0,1.0, 0.3,1.0,1.0, 1.0,1.0,1.0,
};
- int conn[8*8]=
+ mcIdType conn[8*8]=
{
// 11,15,12,4,8,17,18,23,3,13,6,7,20,24,15,11,14,3,7,25,1,20,11,2,1,20,11,2,0,16,8,21,20,24,15,11,16,26,17,8,25,7,10,22,2,11,4,9,2,11,4,9,21,8,23,19,7,6,5,10,11,15,12,4
0,3,4,1,9,12,13,10, 1,4,5,2,10,13,14,11, 3,6,7,4,12,15,16,13, 4,7,8,5,13,16,17,14, 9,12,13,10,18,21,22,19, 10,13,14,11,19,22,23,20, 12,15,16,13,21,24,25,22, 13,16,17,14,22,25,26,23
MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSurfSourceMesh_1()
{
double sourceCoords[12]={-0.3,-0.3,0.5, 0.7,-0.3,1.5, -0.3,0.7,0.5, 0.7,0.7,1.5};
- int sourceConn[6]={0,3,1,0,2,3};
+ mcIdType sourceConn[6]={0,3,1,0,2,3};
MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New();
sourceMesh->setMeshDimension(2);
sourceMesh->allocateCells(2);
MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSurfSourceMesh_2()
{
double sourceCoords[12]={-0.3,-0.3,0., 0.7,-0.3,0., -0.3,0.7,0., 0.7,0.7,0.};
- int sourceConn[6]={0,3,1,0,2,3};
+ mcIdType sourceConn[6]={0,3,1,0,2,3};
MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New();
sourceMesh->setMeshDimension(2);
sourceMesh->allocateCells(2);
MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSurfTargetMesh_1()
{
double targetCoords[27]={-0.3,-0.3,0.5, 0.2,-0.3,1., 0.7,-0.3,1.5, -0.3,0.2,0.5, 0.2,0.2,1., 0.7,0.2,1.5, -0.3,0.7,0.5, 0.2,0.7,1., 0.7,0.7,1.5};
- int targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ mcIdType targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(5);
MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSurfTargetMeshPerm_1()
{
double targetCoords[27]={-0.3,-0.3,0.5, 0.2,-0.3,1., 0.7,-0.3,1.5, -0.3,0.2,0.5, 0.2,0.2,1., 0.7,0.2,1.5, -0.3,0.7,0.5, 0.2,0.7,1., 0.7,0.7,1.5};
- int targetConn[18]={0,3,4,1, 1,4,2, 4,2,5, 6,7,4,3, 7,8,5,4};
+ mcIdType targetConn[18]={0,3,4,1, 1,4,2, 4,2,5, 6,7,4,3, 7,8,5,4};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(5);
MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSurfTargetMesh_2()
{
double targetCoords[27]={-0.3,-0.3,0.5, 0.2,-0.3,1., 0.7,-0.3,1.5, -0.3,0.2,0.5, 0.2,0.2,1., 0.7,0.2,1.5, -0.3,0.7,0.5, 0.2,0.7,1., 0.7,0.7,1.5};
- int targetConn[24]={0,3,4, 0,4,1, 1,4,2, 4,5,2, 3,6,4, 6,7,4, 4,7,5, 7,8,5 };
+ mcIdType targetConn[24]={0,3,4, 0,4,1, 1,4,2, 4,5,2, 3,6,4, 6,7,4, 4,7,5, 7,8,5 };
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(8);
{
double sourceCoords[27]={ 0.0, 0.0, 200.0, 0.0, 0.0, 0.0, 0.0, 200.0, 200.0, 0.0, 200.0, 0.0, 200.0, 0.0, 200.0,
200.0, 0.0, 0.0, 200.0, 200.0, 200.0, 200.0, 200.0, 0.0, 100.0, 100.0, 100.0 };
- int sourceConn[48]={8,1,7,3, 6,0,8,2, 7,4,5,8, 6,8,4,7, 6,8,0,4, 6,8,7,3, 8,1,3,0, 4,1,5,8, 1,7,5,8, 0,3,8,2, 8,1,0,4, 3,6,8,2};
+ mcIdType sourceConn[48]={8,1,7,3, 6,0,8,2, 7,4,5,8, 6,8,4,7, 6,8,0,4, 6,8,7,3, 8,1,3,0, 4,1,5,8, 1,7,5,8, 0,3,8,2, 8,1,0,4, 3,6,8,2};
MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New();
sourceMesh->setMeshDimension(3);
sourceMesh->allocateCells(12);
double targetCoords[81]={ 0., 0., 0., 50., 0., 0. , 200., 0., 0. , 0., 50., 0., 50., 50., 0. , 200., 50., 0., 0., 200., 0., 50., 200., 0. , 200., 200., 0. ,
0., 0., 50., 50., 0., 50. , 200., 0., 50. , 0., 50., 50., 50., 50., 50. , 200., 50., 50., 0., 200., 50., 50., 200., 50. , 200., 200., 50. ,
0., 0., 200., 50., 0., 200. , 200., 0., 200. , 0., 50., 200., 50., 50., 200. , 200., 50., 200., 0., 200., 200., 50., 200., 200. , 200., 200., 200. };
- int targetConn[64]={0,1,4,3,9,10,13,12, 1,2,5,4,10,11,14,13, 3,4,7,6,12,13,16,15, 4,5,8,7,13,14,17,16,
+ mcIdType targetConn[64]={0,1,4,3,9,10,13,12, 1,2,5,4,10,11,14,13, 3,4,7,6,12,13,16,15, 4,5,8,7,13,14,17,16,
9,10,13,12,18,19,22,21, 10,11,14,13,19,20,23,22, 12,13,16,15,21,22,25,24, 13,14,17,16,22,23,26,25};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(3);
MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMeshMergeNode_1()
{
double targetCoords[36]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,-0.3, 0.2,-0.3, 0.2,-0.3, 0.2,0.2, 0.2,0.2, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7, 0.2,0.7 };
- int targetConn[18]={0,9,7,5, 4,6,2, 10,11,8, 9,14,15,7, 17,16,13,6};
+ mcIdType targetConn[18]={0,9,7,5, 4,6,2, 10,11,8, 9,14,15,7, 17,16,13,6};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(5);
double targetCoords[93]={ 0., 0., 0., 50., 0., 0. , 200., 0., 0. , 0., 50., 0., 50., 50., 0. , 200., 50., 0., 0., 200., 0., 50., 200., 0. , 200., 200., 0. ,
0., 0., 50., 50., 0., 50. , 200., 0., 50. , 0., 50., 50., 50., 50., 50. , 200., 50., 50., 0., 200., 50., 50., 200., 50. , 200., 200., 50. ,
0., 0., 200., 50., 0., 200. , 200., 0., 200. , 0., 50., 200., 50., 50., 200. , 200., 50., 200., 0., 200., 200., 50., 200., 200. , 200., 200., 200., 50.,0.,0., 50.,0.,0., 50.,0.,0., 200., 50., 200.};
- int targetConn[64]={0,29,4,3,9,10,13,12, 28,2,5,4,10,11,14,13, 3,4,7,6,12,13,16,15, 4,5,8,7,13,14,17,16,
+ mcIdType targetConn[64]={0,29,4,3,9,10,13,12, 28,2,5,4,10,11,14,13, 3,4,7,6,12,13,16,15, 4,5,8,7,13,14,17,16,
9,10,13,12,18,19,22,21, 10,11,14,13,19,20,23,22, 12,13,16,15,21,22,25,24, 13,14,17,16,22,30,26,25};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(3);
0.,0.,3., 1.,1.,3., 1.,1.25,3., 1.,0.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3.,
3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.};
- int conn[354]={
+ mcIdType conn[354]={
// 0
0,11,1,3,15,26,16,18, 1,2,4,7,13,6,-1,1,16,21,6,-1,6,21,28,13,-1,13,7,22,28,-1,7,4,19,22,-1,4,2,17,19,-1,2,1,16,17,-1,16,21,28,22,19,17,
1,6,5,3,16,21,20,18, 13,10,9,6,28,25,24,21,
41,38,37,34,32,31,-1,41,56,46,31,-1,31,46,47,32,-1,32,47,49,34,-1,34,49,52,37,-1,37,38,53,52,-1,38,41,56,53,-1,56,46,47,49,52,53,
37,42,44,43,52,57,59,58
};
- int conn2[28]={7,12,14,13, 11,8,7,4,2,1, 13,10,9,6, 1,6,5,3, 1,2,4,7,13,6, 0,11,1,3};
+ mcIdType conn2[28]={7,12,14,13, 11,8,7,4,2,1, 13,10,9,6, 1,6,5,3, 1,2,4,7,13,6, 0,11,1,3};
//
MEDCouplingUMesh *ret=MEDCouplingUMesh::New();
ret->setMeshDimension(3);
4.2729998779296876, 0.43212001800537109, 0.14404000282287599, 4.2729998779296876, 0, 0.21606000900268554, 4.2729998779296876, 0.10803000450134277,
0.21606000900268554, 4.2729998779296876, 0.21606000900268554, 0.21606000900268554, 4.2729998779296876, 0.28808000564575198, 0.21606000900268554,
4.2729998779296876, 0.36010002136230468, 0.21606000900268554, 4.2729998779296876, 0.43212001800537109, 0.21606000900268554, 4.2729998779296876};
- const int connN[320]={
+ const mcIdType connN[320]={
0, 1, 7, 6, 30, 31, 37, 36, 1, 2, 8, 7, 31, 32, 38, 37, 2, 3, 9, 8, 32, 33, 39, 38, 3, 4, 10, 9, 33, 34, 40, 39, 4, 5, 11, 10, 34, 35, 41, 40, 6,
7, 13, 12, 36, 37, 43, 42, 7, 8, 14, 13, 37, 38, 44, 43, 8, 9, 15, 14, 38, 39, 45, 44, 9, 10, 16, 15, 39, 40, 46, 45, 10, 11, 17, 16, 40, 41, 47,
46, 12, 13, 19, 18, 42, 43, 49, 48, 13, 14, 20, 19, 43, 44, 50, 49, 14, 15, 21, 20, 44, 45, 51, 50, 15, 16, 22, 21, 45, 46, 52, 51, 16, 17, 23,
-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7,
0.7,-0.3, 1.7,-0.3, 0.7,0.7, 1.7,0.7
};
- int targetConn[24]={
+ mcIdType targetConn[24]={
0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4,
9,12,10,9,11,12
};
{
0.+dx,0.+dy, 1.+dx,0.+dy, 2.+dx,1.+dy
};
- int targetConn[2*2]={1,2, 0,1};
+ mcIdType targetConn[2*2]={1,2, 0,1};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New("2Dcurve 1D mesh",1);
targetMesh->allocateCells(2);
{
0.+dx, 1.+dx, 3.+dx, 4.+dx
};
- int targetConn[2*3]={1,2, 0,1, 2,3};
+ mcIdType targetConn[2*3]={1,2, 0,1, 2,3};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New("1D mesh",1);
targetMesh->allocateCells(3);
{
MEDCouplingUMesh *ret=MEDCouplingUMesh::New("1DSourceMesh",1);
ret->allocateCells(4);
- int conn[8]={0,1,2,3,1,2,3,4};
+ mcIdType conn[8]={0,1,2,3,1,2,3,4};
for(int i=0;i<4;i++)
ret->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+2*i);
ret->finishInsertingCells();
{
MEDCouplingUMesh *ret=MEDCouplingUMesh::New("1DTargetMesh",1);
ret->allocateCells(2);
- int conn[4]={1,2,0,1};
+ mcIdType conn[4]={1,2,0,1};
for(int i=0;i<2;i++)
ret->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+2*i);
ret->finishInsertingCells();
{
MEDCouplingUMesh *ret=MEDCouplingUMesh::New("1DSourceMesh",1);
ret->allocateCells(4);
- int conn[8]={0,1,2,3,1,2,3,4};
+ mcIdType conn[8]={0,1,2,3,1,2,3,4};
for(int i=0;i<4;i++)
ret->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+2*i);
ret->finishInsertingCells();
{
MEDCouplingUMesh *ret=MEDCouplingUMesh::New("1DTargetMesh",1);
ret->allocateCells(2);
- int conn[4]={1,2,0,1};
+ mcIdType conn[4]={1,2,0,1};
for(int i=0;i<2;i++)
ret->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+2*i);
ret->finishInsertingCells();
{
MEDCouplingUMesh *ret=MEDCouplingUMesh::New("1DMesh_3",1);
ret->allocateCells(4);
- int conn[10]={0,1,2, 3,4, 6,5,7 ,9,8};
+ mcIdType conn[10]={0,1,2, 3,4, 6,5,7 ,9,8};
ret->insertNextCell(INTERP_KERNEL::NORM_SEG3,3,conn);
ret->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+3);
ret->insertNextCell(INTERP_KERNEL::NORM_SEG3,3,conn+5);
{
MEDCouplingUMesh *ret=MEDCouplingUMesh::New("2DCurveMesh_3",1);
ret->allocateCells(4);
- int conn[10]={0,1,2, 3,4, 6,5,7 ,9,8};
+ mcIdType conn[10]={0,1,2, 3,4, 6,5,7 ,9,8};
ret->insertNextCell(INTERP_KERNEL::NORM_SEG3,3,conn);
ret->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+3);
ret->insertNextCell(INTERP_KERNEL::NORM_SEG3,3,conn+5);
{
MEDCouplingUMesh *ret=MEDCouplingUMesh::New("2DMesh_3",2);
ret->allocateCells(10);
- int conn[52]={
+ mcIdType conn[52]={
0,1,2, 0,1,3,4, 0,1,3,5,4, 0,1,2,6,7,8, 0,1,3,4,6,9,2,10,
0,2,1, 0,4,3,1, 0,4,5,3,1, 0,2,1,8,7,6, 0,4,3,1,10,2,9,6
};
MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMesh_4()
{
double targetCoords[20]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 };
- int targetConn[18]={0,4,5,1, 1,5,3, 5,6,2, 7,8,5,4, 8,9,6,5};
+ mcIdType targetConn[18]={0,4,5,1, 1,5,3, 5,6,2, 7,8,5,4, 8,9,6,5};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(5);
{
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("Multi1DMesh",1);
DataArrayDouble *coo=buildCoordsForMultiTypes_1();
- const int conn[5]={0,2, 0,2,1};
+ const mcIdType conn[5]={0,2, 0,2,1};
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG3,3,conn+2);
{
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("Multi2DMesh",2);
DataArrayDouble *coo=buildCoordsForMultiTypes_1();
- const int conn[21]={3,4,5, 3,4,5,6,7,8, 0,9,10,11, 0,9,10,11,12,13,14,15};
+ const mcIdType conn[21]={3,4,5, 3,4,5,6,7,8, 0,9,10,11, 0,9,10,11,12,13,14,15};
mesh->allocateCells(4);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI6,6,conn+3);
{
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("Multi3DMesh",3);
DataArrayDouble *coo=buildCoordsForMultiTypes_1();
- const int conn[81]={0,16,17,18,
+ const mcIdType conn[81]={0,16,17,18,
0,16,17,18,19,20,21,22,23,24,
0,11,10,9,25,
0,11,10,9,25,15,14,13,12,26,27,28,29,
const double coords[81]={0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.0, 1.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.5, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0, 0.5, 1.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 0.5, 0.5, 1.0, 0.5, 0.5, 0.0, 1.0, 0.5, 0.5, 1.0, 0.5, 1.0, 1.0, 0.5, 0.0, 0.0, 1.0, 0.5, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.5, 1.0, 0.5, 0.5, 1.0, 1.0, 0.5, 1.0, 0.0, 1.0, 1.0, 0.5, 1.0, 1.0, 1.0, 1.0, 1.0};
coo->alloc(27,3);
std::copy(coords,coords+81,coo->getPointer());
- const int conn[64]={3,12,13,4,0,9,10,1,
+ const mcIdType conn[64]={3,12,13,4,0,9,10,1,
4,13,14,5,1,10,11,2,
6,15,16,7,3,12,13,4,
7,16,17,8,4,13,14,5,
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("Pointe.med",3);
MEDCouplingUMesh *mesh2=MEDCouplingUMesh::New("Pointe.med",2);
const double coords[57]={0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 0.0, 1.0, 0.0, 2.0, 1.0, -2.0, 0.0, 1.0, 0.0, -2.0, 1.0, 1.0, 1.0, 2.0, -1.0, 1.0, 2.0, -1.0, -1.0, 2.0, 1.0, -1.0, 2.0, 1.0, 1.0, 3.0, -1.0, 1.0, 3.0, -1.0, -1.0, 3.0, 1.0, -1.0, 3.0, 1.0, 1.0, 4.0, -1.0, 1.0, 4.0, -1.0, -1.0, 4.0, 1.0, -1.0, 4.0, 0.0, 0.0, 5.0};
- const int conn[74]={0,1,2,5,0,1,3,2,0,1,4,3,0,1,5,4,1,6,3,2,1,7,4,3,1,8,5,4,1,9,2,5,1,6,2,9,1,7,3,6,1,8,4,7,1,9,5,8, 6,7,8,9,1,14,17,16,15,18, 10,11,12,13,6,7,8,9,14,15,16,17,10,11,12,13};
+ const mcIdType conn[74]={0,1,2,5,0,1,3,2,0,1,4,3,0,1,5,4,1,6,3,2,1,7,4,3,1,8,5,4,1,9,2,5,1,6,2,9,1,7,3,6,1,8,4,7,1,9,5,8, 6,7,8,9,1,14,17,16,15,18, 10,11,12,13,6,7,8,9,14,15,16,17,10,11,12,13};
DataArrayDouble *coo=DataArrayDouble::New();
coo->alloc(19,3);
std::copy(coords,coords+57,coo->getPointer());
mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+66);
mesh->finishInsertingCells();
//[1,34,29,23,41,32]
- const int conn2[20]={0,5,1,14,18,17,8,7,4,9,5,2, 12,8,9,13,6,7,8,9};
+ const mcIdType conn2[20]={0,5,1,14,18,17,8,7,4,9,5,2, 12,8,9,13,6,7,8,9};
mesh2->allocateCells(6);
for(int i=0;i<4;i++)
mesh2->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn2+3*i);
return mesh;
}
-double MEDCouplingBasicsTest::sumAll(const std::vector< std::map<int,double> >& matrix)
+double MEDCouplingBasicsTest::sumAll(const std::vector< std::map<mcIdType,double> >& matrix)
{
double ret=0.;
- for(std::vector< std::map<int,double> >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++)
- for(std::map<int,double>::const_iterator iter2=(*iter).begin();iter2!=(*iter).end();iter2++)
+ for(std::vector< std::map<mcIdType,double> >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter).begin();iter2!=(*iter).end();iter2++)
ret+=(*iter2).second;
return ret;
}
-5., 3., -9., 0., -13., 3.,
-9., 8., -7., 0., -7., 8.
};
- int sourceConn[16]={0,1, 1,2, 2,3, 3,0, 3,4, 4,5, 4,6, 7,8};
+ mcIdType sourceConn[16]={0,1, 1,2, 2,3, 3,0, 3,4, 4,5, 4,6, 7,8};
MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New();
sourceMesh->setMeshDimension(1);
sourceMesh->allocateCells(8);
MEDCouplingUMesh *MEDCouplingBasicsTest::build2D1DTargetMesh()
{
double targetCoords[10]={-17., 0., -17.,6., -9.,6., -9.,0., -5., 3.};
- int targetConn[7]={0,1,2,3, 2,3,4};
+ mcIdType targetConn[7]={0,1,2,3, 2,3,4};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(2);
const int nbYP1 = nbY + 1;
sourceMesh->allocateCells(nbY);
- int sourceConn[2];
+ mcIdType sourceConn[2];
for (int iY = 0; iY < nbY; ++iY)
{
sourceConn[0] = iY ;
const int nbYP1 = nbY + 1;
targetMesh->allocateCells(nbX * nbY);
- int targetConn[4];
+ mcIdType targetConn[4];
for (int iX = 0; iX < nbX; ++iX)
{
for (int iY = 0; iY < nbY; ++iY)
const int nbYP1 = nbY + 1;
targetMesh->allocateCells(nbX * nbY * 2);
- int targetConn[3];
+ mcIdType targetConn[3];
for (int iX = 0; iX < nbX; ++iX)
{
for (int iY = 0; iY < nbY; ++iY)
-20., 0., 16., -18., 0., 16., -20., 2.5, 16.,
-25., 0., -5., 5., 0., -5., 5., 0. , 25., -25.,0.,25.
};
- int sourceConn[25]={0,1,2, 3,4,5,6, 7,8,9, 10,11,12,13, 14,15,16, 3,4,8,7, 17,18,19,20};
+ mcIdType sourceConn[25]={0,1,2, 3,4,5,6, 7,8,9, 10,11,12,13, 14,15,16, 3,4,8,7, 17,18,19,20};
MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New();
sourceMesh->setMeshDimension(2);
sourceMesh->allocateCells(7);
-20.,-5.,10., -20.,-5.,-4., -12.,-5.,-4.,
-12.,-5.,10., -20., 0.,-4., -12., 0.,-4.
};
- int targetConn[20]={4,5,7,8, 0,3,2,1,4,7,6,5, 4,13,14,7,9,10,11,12};
+ mcIdType targetConn[20]={4,5,7,8, 0,3,2,1,4,7,6,5, 4,13,14,7,9,10,11,12};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(3);
targetMesh->allocateCells(3);
const int nbZP1 = nbZ + 1;
sourceMesh->allocateCells(nbY * nbZ);
- int sourceConn[4];
+ mcIdType sourceConn[4];
for (int iY = 0; iY < nbY; ++iY)
{
for (int iZ = 0; iZ < nbZ; ++iZ)
const int nbZP1 = nbZ + 1;
sourceMesh->allocateCells(nbY * nbZ * 2);
- int sourceConn[3];
+ mcIdType sourceConn[3];
for (int iY = 0; iY < nbY; ++iY)
{
for (int iZ = 0; iZ < nbZ; ++iZ)
const int nbZP1 = nbZ + 1;
targetMesh->allocateCells(nbX * nbY * nbZ);
- int targetConn[8];
+ mcIdType targetConn[8];
for (int iX = 0; iX < nbX; ++iX)
{
for (int iY = 0; iY < nbY; ++iY)
const int nbZP1 = nbZ + 1;
targetMesh->allocateCells(nbX * nbY * nbZ * 5);
- int targetConn[4];
+ mcIdType targetConn[4];
for (int iX = 0; iX < nbX; ++iX)
{
for (int iY = 0; iY < nbY; ++iY)
return targetMesh;
}
-int MEDCouplingBasicsTest::countNonZero(const std::vector< std::map<int,double> >& matrix)
+int MEDCouplingBasicsTest::countNonZero(const std::vector< std::map<mcIdType,double> >& matrix)
{
- int ret=0.;
- for(std::vector< std::map<int,double> >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++)
- for(std::map<int,double>::const_iterator iter2=(*iter).begin();iter2!=(*iter).end();iter2++)
+ int ret=0;
+ for(std::vector< std::map<mcIdType,double> >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter).begin();iter2!=(*iter).end();iter2++)
if (!INTERP_KERNEL::epsilonEqual((*iter2).second, 0.)) ret +=1;
return ret;
}
#include "MEDCouplingCMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingMemArray.txx"
#include <sstream>
#include <cmath>
#include <algorithm>
void MEDCouplingBasicsTest1::testMesh()
{
- const int nbOfCells=6;
- const int nbOfNodes=12;
+ const mcIdType nbOfCells=6;
+ const mcIdType nbOfNodes=12;
double coords[3*nbOfNodes]={
0.024155, 0.04183768725682622, -0.305, 0.04831000000000001, -1.015761910347357e-17, -0.305, 0.09662000000000001, -1.832979297858306e-18,
0.09662000000000001, -1.832979297858306e-18, -0.2863, 0.120775, 0.04183768725682623, -0.2863, 0.09662000000000001, 0.08367537451365245,
-0.2863, 0.04831000000000001, 0.08367537451365246, -0.2863, };
- int tab4[4*nbOfCells]={
+ mcIdType tab4[4*nbOfCells]={
1, 2, 8, 7, 2, 3, 9, 8, 3, 4, 10, 9, 4, 5, 11, 10, 5, 0, 6, 11,
0, 1, 7, 6, };
- CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NORM_TRI3),3);
+ CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NORM_TRI3),ToIdType(3));
CPPUNIT_ASSERT(MEDCouplingMesh::IsStaticGeometricType(INTERP_KERNEL::NORM_TRI3));
CPPUNIT_ASSERT(MEDCouplingMesh::IsLinearGeometricType(INTERP_KERNEL::NORM_TRI3));
CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetDimensionOfGeometricType(INTERP_KERNEL::NORM_TRI3),2);
CPPUNIT_ASSERT(MEDCouplingMesh::IsLinearGeometricType(INTERP_KERNEL::NORM_POLYGON));
CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetDimensionOfGeometricType(INTERP_KERNEL::NORM_POLYGON),2);
CPPUNIT_ASSERT_EQUAL(std::string(MEDCouplingMesh::GetReprOfGeometricType(INTERP_KERNEL::NORM_POLYGON)),std::string("NORM_POLYGON"));
- CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NORM_TRI6),6);
+ CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NORM_TRI6),ToIdType(6));
CPPUNIT_ASSERT(MEDCouplingMesh::IsStaticGeometricType(INTERP_KERNEL::NORM_TRI6));
CPPUNIT_ASSERT(!MEDCouplingMesh::IsLinearGeometricType(INTERP_KERNEL::NORM_TRI6));
CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetDimensionOfGeometricType(INTERP_KERNEL::NORM_TRI6),2);
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(8);
- const int *curConn=tab4;
- for(int i=0;i<nbOfCells;i++,curConn+=4)
+ const mcIdType *curConn=tab4;
+ for(mcIdType i=0;i<nbOfCells;i++,curConn+=4)
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,curConn);
mesh->finishInsertingCells();
- CPPUNIT_ASSERT_EQUAL((std::size_t)30,mesh->getNodalConnectivity()->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(nbOfCells,(int)mesh->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(30),mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh->getNumberOfCells());
//test 0 - no copy no ownership
DataArrayDouble *myCoords=DataArrayDouble::New();
myCoords->useArray(coords,false,DeallocType::CPP_DEALLOC,nbOfNodes,3);
mesh->setCoords(myCoords);
mesh->setCoords(myCoords);
myCoords->decrRef();
- CPPUNIT_ASSERT_EQUAL(nbOfCells,(int)mesh->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh->getNumberOfCells());
mesh->checkConsistencyLight();
//test 1 - no copy ownership C++
myCoords=DataArrayDouble::New();
myCoords->useArray(tmp,true,DeallocType::CPP_DEALLOC,nbOfNodes,3);
mesh->setCoords(myCoords);
myCoords->decrRef();
- CPPUNIT_ASSERT_EQUAL(nbOfCells,(int)mesh->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh->getNumberOfCells());
mesh->checkConsistencyLight();
//test 2 - no copy ownership C
myCoords=DataArrayDouble::New();
MEDCouplingUMesh *mesh2=mesh->clone(false);
CPPUNIT_ASSERT(mesh2!=mesh);
mesh2->checkConsistencyLight();
- CPPUNIT_ASSERT_EQUAL(nbOfCells,(int)mesh2->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh2->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(nbOfNodes,mesh2->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,mesh2->getSpaceDimension());
CPPUNIT_ASSERT(mesh!=mesh2);
CPPUNIT_ASSERT(mesh->getCoords()==mesh2->getCoords());
CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.2863,mesh2->getCoords()->getIJ(11,2),1e-14);
CPPUNIT_ASSERT(mesh->getNodalConnectivity()==mesh2->getNodalConnectivity());
- CPPUNIT_ASSERT_EQUAL(3,mesh2->getNodalConnectivity()->getIJ(7,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),mesh2->getNodalConnectivity()->getIJ(7,0));
CPPUNIT_ASSERT(mesh->getNodalConnectivityIndex()==mesh2->getNodalConnectivityIndex());
- CPPUNIT_ASSERT_EQUAL(15,mesh2->getNodalConnectivityIndex()->getIJ(3,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(15),mesh2->getNodalConnectivityIndex()->getIJ(3,0));
mesh2->decrRef();
// test clone not recursively
MEDCouplingUMesh *mesh3=mesh->clone(true);
CPPUNIT_ASSERT(mesh3!=mesh);
mesh3->checkConsistencyLight();
- CPPUNIT_ASSERT_EQUAL(nbOfCells,(int)mesh3->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh3->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(nbOfNodes,mesh3->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,mesh3->getSpaceDimension());
CPPUNIT_ASSERT(mesh!=mesh3);
CPPUNIT_ASSERT(mesh->getCoords()!=mesh3->getCoords());
CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.2863,mesh3->getCoords()->getIJ(11,2),1e-14);
CPPUNIT_ASSERT(mesh->getNodalConnectivity()!=mesh3->getNodalConnectivity());
- CPPUNIT_ASSERT_EQUAL(3,mesh3->getNodalConnectivity()->getIJ(7,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),mesh3->getNodalConnectivity()->getIJ(7,0));
CPPUNIT_ASSERT(mesh->getNodalConnectivityIndex()!=mesh3->getNodalConnectivityIndex());
- CPPUNIT_ASSERT_EQUAL(15,mesh3->getNodalConnectivityIndex()->getIJ(3,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(15),mesh3->getNodalConnectivityIndex()->getIJ(3,0));
mesh3->decrRef();
//test 4 - Field on cells
MEDCouplingFieldDouble *fieldOnCells=MEDCouplingFieldDouble::New(ON_CELLS);
MEDCouplingFieldDouble *fieldOnCells2=fieldOnCells->clone(false);
CPPUNIT_ASSERT(fieldOnCells2!=fieldOnCells);
fieldOnCells2->checkConsistencyLight();
- CPPUNIT_ASSERT_EQUAL(nbOfCells,(int)fieldOnCells2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(nbOfCells,fieldOnCells2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(9,(int)fieldOnCells2->getNumberOfComponents());
CPPUNIT_ASSERT(fieldOnCells2->getArray()==fieldOnCells->getArray());
CPPUNIT_ASSERT_DOUBLES_EQUAL(7.,fieldOnCells2->getArray()->getIJ(3,7),1e-14);
MEDCouplingFieldDouble *fieldOnCells3=fieldOnCells->clone(true);
CPPUNIT_ASSERT(fieldOnCells3!=fieldOnCells);
fieldOnCells3->checkConsistencyLight();
- CPPUNIT_ASSERT_EQUAL(nbOfCells,(int)fieldOnCells3->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(nbOfCells,fieldOnCells3->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(9,(int)fieldOnCells3->getNumberOfComponents());
CPPUNIT_ASSERT(fieldOnCells3->getArray()!=fieldOnCells->getArray());
CPPUNIT_ASSERT_DOUBLES_EQUAL(7.,fieldOnCells3->getArray()->getIJ(3,7),1e-14);
void MEDCouplingBasicsTest1::testMeshPointsCloud()
{
double targetCoords[27]={-0.3,-0.3,0.5, 0.2,-0.3,1., 0.7,-0.3,1.5, -0.3,0.2,0.5, 0.2,0.2,1., 0.7,0.2,1.5, -0.3,0.7,0.5, 0.2,0.7,1., 0.7,0.7,1.5};
- const int targetConn[]={0,1,2,3,4,5,7,6};
+ const mcIdType targetConn[]={0,1,2,3,4,5,7,6};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(0);
targetMesh->allocateCells(8);
targetMesh->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(3,targetMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(8,(int)targetMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(9,targetMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(9),targetMesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(0,targetMesh->getMeshDimension());
//
targetMesh->decrRef();
void MEDCouplingBasicsTest1::testRevNodal()
{
MEDCouplingUMesh *mesh=build2DTargetMesh_1();
- DataArrayInt *revNodal=DataArrayInt::New();
- DataArrayInt *revNodalIndx=DataArrayInt::New();
+ DataArrayIdType *revNodal=DataArrayIdType::New();
+ DataArrayIdType *revNodalIndx=DataArrayIdType::New();
//
mesh->getReverseNodalConnectivity(revNodal,revNodalIndx);
- const int revNodalExpected[18]={0,0,1,1,2,0,3,0,1,2,3,4,2,4,3,3,4,4};
- const int revNodalIndexExpected[10]={0,1,3,5,7,12,14,15,17,18};
- CPPUNIT_ASSERT_EQUAL((std::size_t)18,revNodal->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)10,revNodalIndx->getNbOfElems());
+ const mcIdType revNodalExpected[18]={0,0,1,1,2,0,3,0,1,2,3,4,2,4,3,3,4,4};
+ const mcIdType revNodalIndexExpected[10]={0,1,3,5,7,12,14,15,17,18};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(18),revNodal->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(10),revNodalIndx->getNbOfElems());
CPPUNIT_ASSERT(std::equal(revNodalExpected,revNodalExpected+18,revNodal->getPointer()));
CPPUNIT_ASSERT(std::equal(revNodalIndexExpected,revNodalIndexExpected+10,revNodalIndx->getPointer()));
//
////// 2D
MEDCouplingUMesh *mesh=build2DTargetMesh_1();
//
- const int elts[2]={1,3};
- std::vector<int> eltsV(elts,elts+2);
+ const mcIdType elts[2]={1,3};
+ std::vector<mcIdType> eltsV(elts,elts+2);
mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size());
mesh->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(5,(int)mesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(23,(int)mesh->getNodalConnectivity()->getNumberOfTuples());
- const int *pt=mesh->getNodalConnectivity()->getConstPointer();
- const int expected1[23]={4, 0, 3, 4, 1, 5, 1, 4, 2, 3, 4, 5, 2, 5, 6, 7, 4, 3, 4, 7, 8, 5, 4};
+ const mcIdType *pt=mesh->getNodalConnectivity()->getConstPointer();
+ const mcIdType expected1[23]={4, 0, 3, 4, 1, 5, 1, 4, 2, 3, 4, 5, 2, 5, 6, 7, 4, 3, 4, 7, 8, 5, 4};
CPPUNIT_ASSERT(std::equal(expected1,expected1+23,pt));
//
mesh->decrRef();
void MEDCouplingBasicsTest1::testDescConn2D()
{
MEDCouplingUMesh *mesh=build2DTargetMesh_1();
- DataArrayInt *desc=DataArrayInt::New();
- DataArrayInt *descIndx=DataArrayInt::New();
- DataArrayInt *revDesc=DataArrayInt::New();
- DataArrayInt *revDescIndx=DataArrayInt::New();
+ DataArrayIdType *desc=DataArrayIdType::New();
+ DataArrayIdType *descIndx=DataArrayIdType::New();
+ DataArrayIdType *revDesc=DataArrayIdType::New();
+ DataArrayIdType *revDescIndx=DataArrayIdType::New();
//
MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
mesh2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(13,(int)mesh2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,(int)revDescIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)descIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)desc->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)revDesc->getNumberOfTuples());
- const int expected1[18]={0,1,2,3, 2,4,5, 6,7,4, 8,9,1,10, 11,12,6,9};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(14),revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,(int)revDescIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(6),descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)descIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(18),desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)desc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(18),revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)revDesc->getNumberOfTuples());
+ const mcIdType expected1[18]={0,1,2,3, 2,4,5, 6,7,4, 8,9,1,10, 11,12,6,9};
CPPUNIT_ASSERT(std::equal(expected1,expected1+18,desc->getConstPointer()));
- const int expected2[6]={0,4,7,10,14,18};
+ const mcIdType expected2[6]={0,4,7,10,14,18};
CPPUNIT_ASSERT(std::equal(expected2,expected2+6,descIndx->getConstPointer()));
- const int expected3[14]={0,1,3,5,6,8,9,11,12,13,15,16,17,18};
+ const mcIdType expected3[14]={0,1,3,5,6,8,9,11,12,13,15,16,17,18};
CPPUNIT_ASSERT(std::equal(expected3,expected3+14,revDescIndx->getConstPointer()));
- const int expected4[18]={0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4};
+ const mcIdType expected4[18]={0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4};
CPPUNIT_ASSERT(std::equal(expected4,expected4+18,revDesc->getConstPointer()));
- DataArrayInt *conn=mesh2->getNodalConnectivity();
- DataArrayInt *connIndex=mesh2->getNodalConnectivityIndex();
- const int expected5[14]={0,3,6,9,12,15,18,21,24,27,30,33,36,39};
+ DataArrayIdType *conn=mesh2->getNodalConnectivity();
+ DataArrayIdType *connIndex=mesh2->getNodalConnectivityIndex();
+ const mcIdType expected5[14]={0,3,6,9,12,15,18,21,24,27,30,33,36,39};
CPPUNIT_ASSERT(std::equal(expected5,expected5+14,connIndex->getConstPointer()));
- const int expected6[39]={1, 0, 3, 1, 3, 4, 1, 4, 1, 1, 1, 0, 1, 4, 2, 1, 2, 1, 1, 4, 5, 1, 5, 2, 1, 6, 7, 1, 7, 4, 1, 3, 6, 1, 7, 8, 1, 8, 5};
+ const mcIdType expected6[39]={1, 0, 3, 1, 3, 4, 1, 4, 1, 1, 1, 0, 1, 4, 2, 1, 2, 1, 1, 4, 5, 1, 5, 2, 1, 6, 7, 1, 7, 4, 1, 3, 6, 1, 7, 8, 1, 8, 5};
CPPUNIT_ASSERT(std::equal(expected6,expected6+39,conn->getConstPointer()));
//
desc->decrRef();
revDescIndx->decrRef();
mesh2->decrRef();
//
- const int elts[2]={1,3};
- std::vector<int> eltsV(elts,elts+2);
+ const mcIdType elts[2]={1,3};
+ std::vector<mcIdType> eltsV(elts,elts+2);
mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size());
mesh->checkConsistencyLight();
//
- desc=DataArrayInt::New();
- descIndx=DataArrayInt::New();
- revDesc=DataArrayInt::New();
- revDescIndx=DataArrayInt::New();
+ desc=DataArrayIdType::New();
+ descIndx=DataArrayIdType::New();
+ revDesc=DataArrayIdType::New();
+ revDescIndx=DataArrayIdType::New();
//
mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
mesh2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(13,(int)mesh2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,(int)revDescIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)descIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)desc->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)revDesc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(14),revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,(int)revDescIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(6),descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)descIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(18),desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)desc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(18),revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)revDesc->getNumberOfTuples());
CPPUNIT_ASSERT(std::equal(expected1,expected1+18,desc->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+6,descIndx->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected3,expected3+14,revDescIndx->getConstPointer()));
void MEDCouplingBasicsTest1::testDescConn3D()
{
MEDCouplingUMesh *mesh=build3DTargetMesh_1();
- DataArrayInt *desc=DataArrayInt::New();
- DataArrayInt *descIndx=DataArrayInt::New();
- DataArrayInt *revDesc=DataArrayInt::New();
- DataArrayInt *revDescIndx=DataArrayInt::New();
+ DataArrayIdType *desc=DataArrayIdType::New();
+ DataArrayIdType *descIndx=DataArrayIdType::New();
+ DataArrayIdType *revDesc=DataArrayIdType::New();
+ DataArrayIdType *revDescIndx=DataArrayIdType::New();
//
MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
mesh2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(2,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(36,(int)mesh2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL((std::size_t)37,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,(int)revDescIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)9,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(9,(int)descIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)48,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)desc->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)48,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)revDesc->getNumberOfTuples());
- const int expected1[9]={0, 6, 12, 18, 24, 30, 36, 42, 48};
- const int expected2[48]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 3, 11, 12, 4, 13, 14, 15, 16, 17, 10, 18, 19, 13, 1, 20, 21, 22, 23, 24, 7, 25, 26, 27, 28, 22, 12, 29, 23, 30, 31, 32, 17, 33, 28, 34, 35, 30};
- const int expected3[37]={0, 1, 3, 4, 6, 8, 9, 10, 12, 13, 14, 16, 17, 19, 21, 22, 23, 24, 26, 27, 28, 29, 30, 32, 34, 35, 36, 37, 38, 40, 41, 43, 44, 45, 46, 47, 48};
- const int expected4[48]={0, 0, 4, 0, 0, 1, 0, 2, 0, 1, 1, 5, 1, 1, 1, 3, 2, 2, 6, 2, 3, 2, 2, 3, 3, 7, 3, 3, 4, 4, 4, 5, 4, 6, 4, 5, 5, 5, 5, 7, 6, 6, 7, 6, 6, 7, 7, 7};
- const int expected5[37]={0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180};
- const int expected6[180]={4, 0, 1, 4, 3, 4, 9, 12, 13, 10, 4, 0, 9, 10, 1, 4, 1, 10, 13, 4, 4, 4, 13, 12, 3, 4, 3, 12, 9, 0, 4, 1, 2, 5, 4, 4, 10, 13, 14, 11, 4, 1, 10, 11, 2, 4, 2, 11, 14,
+ CPPUNIT_ASSERT_EQUAL(ToIdType(37),revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,(int)revDescIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(9),descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(9,(int)descIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(48),desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)desc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(48),revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)revDesc->getNumberOfTuples());
+ const mcIdType expected1[9]={0, 6, 12, 18, 24, 30, 36, 42, 48};
+ const mcIdType expected2[48]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 3, 11, 12, 4, 13, 14, 15, 16, 17, 10, 18, 19, 13, 1, 20, 21, 22, 23, 24, 7, 25, 26, 27, 28, 22, 12, 29, 23, 30, 31, 32, 17, 33, 28, 34, 35, 30};
+ const mcIdType expected3[37]={0, 1, 3, 4, 6, 8, 9, 10, 12, 13, 14, 16, 17, 19, 21, 22, 23, 24, 26, 27, 28, 29, 30, 32, 34, 35, 36, 37, 38, 40, 41, 43, 44, 45, 46, 47, 48};
+ const mcIdType expected4[48]={0, 0, 4, 0, 0, 1, 0, 2, 0, 1, 1, 5, 1, 1, 1, 3, 2, 2, 6, 2, 3, 2, 2, 3, 3, 7, 3, 3, 4, 4, 4, 5, 4, 6, 4, 5, 5, 5, 5, 7, 6, 6, 7, 6, 6, 7, 7, 7};
+ const mcIdType expected5[37]={0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180};
+ const mcIdType expected6[180]={4, 0, 1, 4, 3, 4, 9, 12, 13, 10, 4, 0, 9, 10, 1, 4, 1, 10, 13, 4, 4, 4, 13, 12, 3, 4, 3, 12, 9, 0, 4, 1, 2, 5, 4, 4, 10, 13, 14, 11, 4, 1, 10, 11, 2, 4, 2, 11, 14,
5, 4, 5, 14, 13, 4, 4, 3, 4, 7, 6, 4, 12, 15, 16, 13, 4, 4, 13, 16, 7, 4, 7, 16, 15, 6, 4, 6, 15, 12, 3, 4, 4, 5, 8, 7, 4, 13, 16, 17, 14, 4, 5, 14, 17, 8, 4, 8,
17, 16, 7, 4, 18, 21, 22, 19, 4, 9, 18, 19, 10, 4, 10, 19, 22, 13, 4, 13, 22, 21, 12, 4, 12, 21, 18, 9, 4, 19, 22, 23, 20, 4, 10, 19, 20, 11, 4, 11, 20, 23, 14, 4,
14, 23, 22, 13, 4, 21, 24, 25, 22, 4, 13, 22, 25, 16, 4, 16, 25, 24, 15, 4, 15, 24, 21, 12, 4, 22, 25, 26, 23, 4, 14, 23, 26, 17, 4, 17, 26, 25, 16};
- const int expected7[180]={4, 0, 1, 4, 3, 4, 9, 12, 13, 10, 4, 0, 9, 10, 1, 4, 1, 10, 13, 4, 4, 4, 13, 12, 3, 4, 3, 12, 9, 0, 5, 1, 2, 5, 4, 5, 10, 13, 14, 11, 5, 1, 10, 11, 2, 5, 2, 11, 14,
+ const mcIdType expected7[180]={4, 0, 1, 4, 3, 4, 9, 12, 13, 10, 4, 0, 9, 10, 1, 4, 1, 10, 13, 4, 4, 4, 13, 12, 3, 4, 3, 12, 9, 0, 5, 1, 2, 5, 4, 5, 10, 13, 14, 11, 5, 1, 10, 11, 2, 5, 2, 11, 14,
5, 5, 5, 14, 13, 4, 4, 3, 4, 7, 6, 4, 12, 15, 16, 13, 4, 4, 13, 16, 7, 4, 7, 16, 15, 6, 4, 6, 15, 12, 3, 5, 4, 5, 8, 7, 5, 13, 16, 17, 14, 5, 5, 14, 17, 8, 5, 8,
17, 16, 7, 4, 18, 21, 22, 19, 4, 9, 18, 19, 10, 4, 10, 19, 22, 13, 4, 13, 22, 21, 12, 4, 12, 21, 18, 9, 4, 19, 22, 23, 20, 4, 10, 19, 20, 11, 4, 11, 20, 23, 14, 4,
14, 23, 22, 13, 4, 21, 24, 25, 22, 4, 13, 22, 25, 16, 4, 16, 25, 24, 15, 4, 15, 24, 21, 12, 4, 22, 25, 26, 23, 4, 14, 23, 26, 17, 4, 17, 26, 25, 16};
revDescIndx->decrRef();
mesh2->decrRef();
//
- const int elts[2]={1,3};
- std::vector<int> eltsV(elts,elts+2);
+ const mcIdType elts[2]={1,3};
+ std::vector<mcIdType> eltsV(elts,elts+2);
mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size());
mesh->checkConsistencyLight();
- desc=DataArrayInt::New();
- descIndx=DataArrayInt::New();
- revDesc=DataArrayInt::New();
- revDescIndx=DataArrayInt::New();
+ desc=DataArrayIdType::New();
+ descIndx=DataArrayIdType::New();
+ revDesc=DataArrayIdType::New();
+ revDescIndx=DataArrayIdType::New();
mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
mesh2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(2,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(36,(int)mesh2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL((std::size_t)37,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,(int)revDescIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)9,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(9,(int)descIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)48,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)desc->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)48,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)revDesc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(37),revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,(int)revDescIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(9),descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(9,(int)descIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(48),desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)desc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(48),revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)revDesc->getNumberOfTuples());
CPPUNIT_ASSERT(std::equal(expected1,expected1+9,descIndx->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+48,desc->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected3,expected3+37,revDescIndx->getConstPointer()));
void MEDCouplingBasicsTest1::testFindBoundaryNodes()
{
MEDCouplingUMesh *mesh=build3DTargetMesh_1();
- DataArrayInt *boundaryNodes=mesh->findBoundaryNodes();
+ DataArrayIdType *boundaryNodes=mesh->findBoundaryNodes();
CPPUNIT_ASSERT_EQUAL(26,(int)boundaryNodes->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)boundaryNodes->getNumberOfComponents());
- const int expected1[26]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26};
+ const mcIdType expected1[26]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26};
CPPUNIT_ASSERT(std::equal(expected1,expected1+26,boundaryNodes->begin()));
boundaryNodes->decrRef();
mesh->decrRef();
MEDCouplingUMesh *mesh=build3DTargetMesh_1();
MEDCouplingPointSet *mesh2=mesh->buildBoundaryMesh(false);
CPPUNIT_ASSERT_EQUAL(24,(int)mesh2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(26,mesh2->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(26,(int)mesh2->getNumberOfNodes());
mesh2->decrRef();
mesh->decrRef();
}
{
MEDCouplingUMesh *mesh=build2DTargetMesh_1();
mesh->setName("Toto");
- const int tab1[2]={0,4};
- const int tab2[3]={0,2,3};
+ const mcIdType tab1[2]={0,4};
+ const mcIdType tab2[3]={0,2,3};
//
MEDCouplingPointSet *subMeshSimple=mesh->buildPartOfMySelf(tab1,tab1+2,true);
MEDCouplingUMesh *subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
CPPUNIT_ASSERT(name=="Toto");
CPPUNIT_ASSERT(mesh->getCoords()==subMesh->getCoords());
CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getNumberOfCells());
- const int subConn[10]={4,0,3,4,1,4,7,8,5,4};
- const int subConnIndex[3]={0,5,10};
- CPPUNIT_ASSERT_EQUAL((std::size_t)10,subMesh->getNodalConnectivity()->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)3,subMesh->getNodalConnectivityIndex()->getNbOfElems());
+ const mcIdType subConn[10]={4,0,3,4,1,4,7,8,5,4};
+ const mcIdType subConnIndex[3]={0,5,10};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(10),subMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),subMesh->getNodalConnectivityIndex()->getNbOfElems());
CPPUNIT_ASSERT(std::equal(subConn,subConn+10,subMesh->getNodalConnectivity()->getPointer()));
CPPUNIT_ASSERT(std::equal(subConnIndex,subConnIndex+3,subMesh->getNodalConnectivityIndex()->getPointer()));
subMesh->decrRef();
CPPUNIT_ASSERT(name=="Toto");
CPPUNIT_ASSERT(mesh->getCoords()==subMesh->getCoords());
CPPUNIT_ASSERT_EQUAL(3,(int)subMesh->getNumberOfCells());
- const int subConn2[14]={4,0,3,4,1,3,4,5,2,4,6,7,4,3};
- const int subConnIndex2[4]={0,5,9,14};
- CPPUNIT_ASSERT_EQUAL((std::size_t)14,subMesh->getNodalConnectivity()->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)4,subMesh->getNodalConnectivityIndex()->getNbOfElems());
+ const mcIdType subConn2[14]={4,0,3,4,1,3,4,5,2,4,6,7,4,3};
+ const mcIdType subConnIndex2[4]={0,5,9,14};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(14),subMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(4),subMesh->getNodalConnectivityIndex()->getNbOfElems());
CPPUNIT_ASSERT(std::equal(subConn2,subConn2+14,subMesh->getNodalConnectivity()->getPointer()));
CPPUNIT_ASSERT(std::equal(subConnIndex2,subConnIndex2+4,subMesh->getNodalConnectivityIndex()->getPointer()));
- const int tab3[3]={0,1,2};
+ const mcIdType tab3[3]={0,1,2};
MEDCouplingPointSet *subMeshSimple2=subMeshSimple->buildPartOfMySelf(tab3,tab3+3,true);
subMesh->decrRef();
name=subMeshSimple2->getName();
void MEDCouplingBasicsTest1::testBuildPartOfMySelfNode()
{
MEDCouplingUMesh *mesh=build2DTargetMesh_1();
- const int tab1[4]={5,7,8,4};
+ const mcIdType tab1[4]={5,7,8,4};
MEDCouplingPointSet *subMeshSimple=mesh->buildPartOfMySelfNode(tab1,tab1+4,true);
MEDCouplingUMesh *subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
CPPUNIT_ASSERT(subMesh);
CPPUNIT_ASSERT_EQUAL(1,(int)subMesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin());
CPPUNIT_ASSERT_EQUAL(1,(int)subMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL((std::size_t)5,subMesh->getNodalConnectivity()->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)2,subMesh->getNodalConnectivityIndex()->getNbOfElems());
- const int subConn[5]={4,7,8,5,4};
- const int subConnIndex[3]={0,5};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),subMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),subMesh->getNodalConnectivityIndex()->getNbOfElems());
+ const mcIdType subConn[5]={4,7,8,5,4};
+ const mcIdType subConnIndex[3]={0,5};
CPPUNIT_ASSERT(std::equal(subConn,subConn+5,subMesh->getNodalConnectivity()->getPointer()));
CPPUNIT_ASSERT(std::equal(subConnIndex,subConnIndex+2,subMesh->getNodalConnectivityIndex()->getPointer()));
CPPUNIT_ASSERT(subMesh->getCoords()==mesh->getCoords());
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllGeoTypes().begin());
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++subMesh->getAllGeoTypes().begin()));
CPPUNIT_ASSERT_EQUAL(3,(int)subMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL((std::size_t)14,subMesh->getNodalConnectivity()->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)4,subMesh->getNodalConnectivityIndex()->getNbOfElems());
- const int subConn2[14]={3,4,5,2,4,6,7,4,3,4,7,8,5,4};
- const int subConnIndex2[4]={0,4,9,14};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(14),subMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(4),subMesh->getNodalConnectivityIndex()->getNbOfElems());
+ const mcIdType subConn2[14]={3,4,5,2,4,6,7,4,3,4,7,8,5,4};
+ const mcIdType subConnIndex2[4]={0,4,9,14};
CPPUNIT_ASSERT(std::equal(subConn2,subConn2+14,subMesh->getNodalConnectivity()->getPointer()));
CPPUNIT_ASSERT(std::equal(subConnIndex2,subConnIndex2+4,subMesh->getNodalConnectivityIndex()->getPointer()));
CPPUNIT_ASSERT(subMesh->getCoords()==mesh->getCoords());
subMeshSimple->decrRef();
//testing the case where length of tab2 is greater than max number of node per cell.
- const int tab2[7]={0,3,2,1,4,5,6};
+ const mcIdType tab2[7]={0,3,2,1,4,5,6};
subMeshSimple=mesh->buildPartOfMySelfNode(tab2,tab2+7,true);
subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
CPPUNIT_ASSERT(subMesh);
MEDCouplingUMesh *mesh=build2DTargetMesh_1();
CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(2,mesh->getSpaceDimension());
- CPPUNIT_ASSERT_EQUAL(9,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(9,(int)mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(5,(int)mesh->getNumberOfCells());
- std::vector<int> oldConn(mesh->getNodalConnectivity()->getNbOfElems());
- std::vector<int> oldConnIndex(mesh->getNumberOfCells()+1);
+ std::vector<mcIdType> oldConn(mesh->getNodalConnectivity()->getNbOfElems());
+ std::vector<mcIdType> oldConnIndex(mesh->getNumberOfCells()+1);
std::copy(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+oldConn.size(),oldConn.begin());
std::copy(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+mesh->getNumberOfCells()+1,oldConnIndex.begin());
DataArrayDouble *oldCoords=mesh->getCoords();
mesh->zipCoords();
CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(2,mesh->getSpaceDimension());
- CPPUNIT_ASSERT_EQUAL(9,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(9,(int)mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(5,(int)mesh->getNumberOfCells());
CPPUNIT_ASSERT(mesh->getCoords()!=oldCoords);
CPPUNIT_ASSERT(std::equal(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+2*9,oldCoords->getPointer()));
CPPUNIT_ASSERT(std::equal(oldConnIndex.begin(),oldConnIndex.end(),mesh->getNodalConnectivityIndex()->getPointer()));
oldCoords->decrRef();
//
- const int tab1[2]={0,4};
+ const mcIdType tab1[2]={0,4};
MEDCouplingPointSet *subMeshPtSet=mesh->buildPartOfMySelf(tab1,tab1+2,true);
MEDCouplingUMesh *subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshPtSet);
CPPUNIT_ASSERT(subMesh);
- DataArrayInt *traducer=subMesh->zipCoordsTraducer();
- const int expectedTraducer[9]={0,1,-1,2,3,4,-1,5,6};
+ DataArrayIdType *traducer=subMesh->zipCoordsTraducer();
+ const mcIdType expectedTraducer[9]={0,1,-1,2,3,4,-1,5,6};
CPPUNIT_ASSERT(std::equal(expectedTraducer,expectedTraducer+9,traducer->getPointer()));
traducer->decrRef();
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin());
CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getNumberOfCells());
- const int subConn[10]={4,0,2,3,1,4,5,6,4,3};
- const int subConnIndex[3]={0,5,10};
- CPPUNIT_ASSERT_EQUAL(7,subMesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL((std::size_t)10,subMesh->getNodalConnectivity()->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)3,subMesh->getNodalConnectivityIndex()->getNbOfElems());
+ const mcIdType subConn[10]={4,0,2,3,1,4,5,6,4,3};
+ const mcIdType subConnIndex[3]={0,5,10};
+ CPPUNIT_ASSERT_EQUAL(7,(int)subMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(10),subMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),subMesh->getNodalConnectivityIndex()->getNbOfElems());
CPPUNIT_ASSERT(std::equal(subConn,subConn+10,subMesh->getNodalConnectivity()->getPointer()));
CPPUNIT_ASSERT(std::equal(subConnIndex,subConnIndex+3,subMesh->getNodalConnectivityIndex()->getPointer()));
subMesh->decrRef();
CPPUNIT_ASSERT(subMesh);
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin());
CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(7,subMesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL((std::size_t)10,subMesh->getNodalConnectivity()->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)3,subMesh->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(7,(int)subMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(10),subMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),subMesh->getNodalConnectivityIndex()->getNbOfElems());
CPPUNIT_ASSERT(std::equal(subConn,subConn+10,subMesh->getNodalConnectivity()->getPointer()));
CPPUNIT_ASSERT(std::equal(subConnIndex,subConnIndex+3,subMesh->getNodalConnectivityIndex()->getPointer()));
subMesh->decrRef();
{
MEDCouplingUMesh *m1=build2DTargetMesh_1();
MEDCouplingUMesh *m2=build2DTargetMesh_1();
- int cells1[3]={2,3,4};
+ mcIdType cells1[3]={2,3,4};
MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true);
MEDCouplingUMesh *m3=dynamic_cast<MEDCouplingUMesh *>(m3_1);
CPPUNIT_ASSERT(m3);
m5->decrRef();
//
bool areNodesMerged;
- int newNbOfNodes;
+ mcIdType newNbOfNodes;
CPPUNIT_ASSERT_EQUAL(10,(int)m6->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(22,m6->getNumberOfNodes());
- DataArrayInt *arr=m6->mergeNodes(1e-13,areNodesMerged,newNbOfNodes);
+ CPPUNIT_ASSERT_EQUAL(22,(int)m6->getNumberOfNodes());
+ DataArrayIdType *arr=m6->mergeNodes(1e-13,areNodesMerged,newNbOfNodes);
arr->decrRef();
CPPUNIT_ASSERT(areNodesMerged);
CPPUNIT_ASSERT_EQUAL(10,(int)m6->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(9,m6->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(9,newNbOfNodes);
+ CPPUNIT_ASSERT_EQUAL(9,(int)m6->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(9,(int)newNbOfNodes);
//
arr=m6->zipConnectivityTraducer(0);
CPPUNIT_ASSERT_EQUAL(7,(int)m6->getNumberOfCells());
CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-12));
CPPUNIT_ASSERT(mesh2->isEqual(mesh1,1e-12));
//
- int *pt2=mesh1->getNodalConnectivity()->getPointer();
+ mcIdType *pt2=mesh1->getNodalConnectivity()->getPointer();
pt2[5]++;
CPPUNIT_ASSERT(!mesh1->isEqual(mesh2,1e-12));
CPPUNIT_ASSERT(!mesh2->isEqual(mesh1,1e-12));
//check buildSubMesh on field on cells
MEDCouplingFieldDouble *fieldCells=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
fieldCells->setMesh(targetMesh);
- const int elts[3]={1,2,4};
- DataArrayInt *di;
+ const mcIdType elts[3]={1,2,4};
+ DataArrayIdType *di;
MEDCouplingMesh *ret1=fieldCells->buildSubMeshData(elts,elts+3,di);
CPPUNIT_ASSERT_EQUAL(3,(int)ret1->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(9,ret1->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(9,(int)ret1->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)di->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)di->getNumberOfComponents());
- const int *toCheck=di->getConstPointer();
+ const mcIdType *toCheck=di->getConstPointer();
CPPUNIT_ASSERT(std::equal(elts,elts+3,toCheck));
MEDCouplingUMesh *ret1DC=dynamic_cast<MEDCouplingUMesh *>(ret1);
CPPUNIT_ASSERT(ret1DC);
MEDCouplingUMesh *ret2DC=dynamic_cast<MEDCouplingUMesh *>(ret2);
CPPUNIT_ASSERT(ret2DC);
CPPUNIT_ASSERT_EQUAL(3,(int)ret2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(6,ret2->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(6,(int)ret2->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(6,(int)di->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)di->getNumberOfComponents());
toCheck=di->getConstPointer();
- const int expected[6]={1,2,4,5,7,8};
+ const mcIdType expected[6]={1,2,4,5,7,8};
CPPUNIT_ASSERT(std::equal(expected,expected+6,toCheck));
ret2->decrRef();
di->decrRef();
MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D);
MEDCouplingMappedExtrudedMesh *ext=MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,1);
CPPUNIT_ASSERT_EQUAL(18,(int)ext->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(60,ext->getNumberOfNodes());
- DataArrayInt *ids3D=ext->getMesh3DIds();
- const int ids3DExpected[18]={5,4,3,2,1,0, 11,10,9,8,7,6, 17,16,15,14,13,12};
+ CPPUNIT_ASSERT_EQUAL(60,(int)ext->getNumberOfNodes());
+ DataArrayIdType *ids3D=ext->getMesh3DIds();
+ const mcIdType ids3DExpected[18]={5,4,3,2,1,0, 11,10,9,8,7,6, 17,16,15,14,13,12};
CPPUNIT_ASSERT_EQUAL(18,(int)ids3D->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)ids3D->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(ids3DExpected,ids3DExpected+18,ids3D->getConstPointer()));
MEDCouplingUMesh *mesh1D=ext->getMesh1D();
- CPPUNIT_ASSERT_EQUAL(4,mesh1D->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(4,(int)mesh1D->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)mesh1D->getNumberOfCells());
const double mesh1DExpected[12]={0.66666666666666663, 1.4583333333333333, 0, 0.66666666666666663, 1.4583333333333333, 1, 0.66666666666666663, 1.4583333333333333, 2, 0.66666666666666663, 1.4583333333333333, 3};
DataArrayDouble *mesh1DCoords=mesh1D->getCoords();
CPPUNIT_ASSERT_EQUAL(4,(int)mesh1DCoords->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(3,(int)mesh1DCoords->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(mesh1DExpected,mesh1DExpected+12,mesh1DCoords->getConstPointer()));
- DataArrayInt *conn1D=mesh1D->getNodalConnectivity();
+ DataArrayIdType *conn1D=mesh1D->getNodalConnectivity();
CPPUNIT_ASSERT_EQUAL(9,(int)conn1D->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)conn1D->getNumberOfComponents());
- const int conn1DExpected[9]={1,0,1,1,1,2,1,2,3};
+ const mcIdType conn1DExpected[9]={1,0,1,1,1,2,1,2,3};
CPPUNIT_ASSERT(std::equal(conn1DExpected,conn1DExpected+9,conn1D->getConstPointer()));
ext->decrRef();
mesh3D->decrRef();
build3DExtrudedUMesh_2(mN,mTT,mTF);
//
bool b=false;
- int newNbOfNodes;
- DataArrayInt *da=mTT->mergeNodes(1e-12,b,newNbOfNodes);
+ mcIdType newNbOfNodes;
+ DataArrayIdType *da=mTT->mergeNodes(1e-12,b,newNbOfNodes);
CPPUNIT_ASSERT(b);
da->decrRef();
- std::vector<int> n;
+ std::vector<mcIdType> n;
double pt[3]={300.,300.,0.};
double v[3]={0.,0.,2.};
mTT->findNodesOnPlane(pt,v,1e-12,n);
CPPUNIT_ASSERT_EQUAL(15,(int)m4->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(5,(int)m4->getMesh2D()->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(3,(int)m4->getMesh1D()->getNumberOfCells());
- const int *m3DIds=m4->getMesh3DIds()->getConstPointer();
- for(int i=0;i<15;i++)
+ const mcIdType *m3DIds=m4->getMesh3DIds()->getConstPointer();
+ for(mcIdType i=0;i<15;i++)
CPPUNIT_ASSERT_EQUAL(i,m3DIds[i]);
m4->decrRef();
//some random in cells to check that extrusion alg find it correctly
- const int expected1[15]={1,3,2,0,6,5,7,10,11,8,12,9,14,13,4};
+ const mcIdType expected1[15]={1,3,2,0,6,5,7,10,11,8,12,9,14,13,4};
m3->renumberCells(expected1,false);
m4=MEDCouplingMappedExtrudedMesh::New(m3,m1,0);
CPPUNIT_ASSERT_EQUAL(15,(int)m4->getNumberOfCells());
m4->decrRef();
m3->decrRef();
//play with polygons and polyedrons
- std::vector<int> cells(2); cells[0]=2; cells[1]=3;
+ std::vector<mcIdType> cells(2); cells[0]=2; cells[1]=3;
m1->convertToPolyTypes(&cells[0],&cells[0]+cells.size());
m3=m1->buildExtrudedMesh(m2,0);
CPPUNIT_ASSERT_EQUAL((int)INTERP_KERNEL::NORM_HEXA8,(int)m3->getTypeOfCell(0));
void MEDCouplingBasicsTest1::testExtrudedMesh4()
{
MEDCouplingUMesh *m1=build2DTargetMesh_1();
- std::vector<int> cells(2); cells[0]=2; cells[1]=4;
+ std::vector<mcIdType> cells(2); cells[0]=2; cells[1]=4;
m1->convertToPolyTypes(&cells[0],&cells[0]+cells.size());
m1->changeSpaceDimension(3);
MEDCouplingUMesh *m2=buildCU1DMesh_U();
m2->rotate(center,vector,-M_PI/2.);
m1->zipCoords();
MEDCouplingUMesh *m3=m1->buildExtrudedMesh(m2,0);
- const int expected1[15]= {1,3,2,0,6,5,7,10,11,8,12,9,14,13,4};
- const int rexpected1[15]={3, 0, 2, 1, 14, 5, 4, 6, 9, 11, 7, 8, 10, 13, 12};
+ const mcIdType expected1[15]= {1,3,2,0,6,5,7,10,11,8,12,9,14,13,4};
+ const mcIdType rexpected1[15]={3, 0, 2, 1, 14, 5, 4, 6, 9, 11, 7, 8, 10, 13, 12};
m3->renumberCells(expected1,false);
MEDCouplingMappedExtrudedMesh *m4=MEDCouplingMappedExtrudedMesh::New(m3,m1,0);
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,m4->getTypeOfCell(0));
void MEDCouplingBasicsTest1::testFindCommonNodes()
{
- DataArrayInt *comm,*commI;
+ DataArrayIdType *comm,*commI;
MEDCouplingUMesh *targetMesh=build3DTargetMesh_1();
targetMesh->findCommonNodes(1e-10,-1,comm,commI);
CPPUNIT_ASSERT_EQUAL(1,(int)commI->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(0,(int)comm->getNumberOfTuples());
- int newNbOfNodes;
- DataArrayInt *o2n=targetMesh->buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes);
- CPPUNIT_ASSERT_EQUAL(27,newNbOfNodes);
+ mcIdType newNbOfNodes;
+ DataArrayIdType *o2n=targetMesh->buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes);
+ CPPUNIT_ASSERT_EQUAL(27,(int)newNbOfNodes);
CPPUNIT_ASSERT_EQUAL(27,(int)o2n->getNumberOfTuples());
- const int o2nExp1[27]=
+ const mcIdType o2nExp1[27]=
{
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26
targetMesh->decrRef();
//
targetMesh=build3DTargetMeshMergeNode_1();
- CPPUNIT_ASSERT_EQUAL(31,targetMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(31,(int)targetMesh->getNumberOfNodes());
targetMesh->findCommonNodes(1e-10,-1,comm,commI);
CPPUNIT_ASSERT_EQUAL(3,(int)commI->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(6,(int)comm->getNumberOfTuples());
- const int commExpected[6]={1,27,28,29,23,30};
- const int commIExpected[3]={0,4,6};
+ const mcIdType commExpected[6]={1,27,28,29,23,30};
+ const mcIdType commIExpected[3]={0,4,6};
CPPUNIT_ASSERT(std::equal(commExpected,commExpected+6,comm->getConstPointer()));
CPPUNIT_ASSERT(std::equal(commIExpected,commIExpected+3,commI->getConstPointer()));
o2n=targetMesh->buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes);
CPPUNIT_ASSERT_EQUAL(31,(int)o2n->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(27,newNbOfNodes);
- const int o2nExp2[31]=
+ CPPUNIT_ASSERT_EQUAL(27,(int)newNbOfNodes);
+ const mcIdType o2nExp2[31]=
{
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,1,1,1,23
//
targetMesh=build3DTargetMesh_1();
bool areNodesMerged;
- unsigned int time=targetMesh->getTimeOfThis();
+ std::size_t time=targetMesh->getTimeOfThis();
o2n=targetMesh->mergeNodes(1e-10,areNodesMerged,newNbOfNodes);
targetMesh->updateTime();
CPPUNIT_ASSERT(time==targetMesh->getTimeOfThis());
targetMesh->updateTime();
CPPUNIT_ASSERT(time!=targetMesh->getTimeOfThis());
CPPUNIT_ASSERT(areNodesMerged);
- int connExp[72]={18,0,1,4,3,9,10,13,12, 18,1,2,5,4,10,11,14,13, 18,3,4,7,6,12,13,16,15,
+ mcIdType connExp[72]={18,0,1,4,3,9,10,13,12, 18,1,2,5,4,10,11,14,13, 18,3,4,7,6,12,13,16,15,
18,4,5,8,7,13,14,17,16,
18,9,10,13,12,18,19,22,21, 18,10,11,14,13,19,20,23,22, 18,12,13,16,15,21,22,25,24,
18,13,14,17,16,22,23,26,25};
o2n->decrRef();
//2D
targetMesh=build2DTargetMeshMergeNode_1();
- CPPUNIT_ASSERT_EQUAL(18,targetMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(18,(int)targetMesh->getNumberOfNodes());
time=targetMesh->getTimeOfThis();
o2n=targetMesh->mergeNodes(1e-10,areNodesMerged,newNbOfNodes);
CPPUNIT_ASSERT(time!=targetMesh->getTimeOfThis());
CPPUNIT_ASSERT(areNodesMerged);
- CPPUNIT_ASSERT_EQUAL(9,targetMesh->getNumberOfNodes());
- int connExp2[23]={4,0,4,3,1, 3,1,3,2, 3,3,5,2, 4,4,6,7,3, 4,7,8,5,3};
+ CPPUNIT_ASSERT_EQUAL(9,(int)targetMesh->getNumberOfNodes());
+ mcIdType connExp2[23]={4,0,4,3,1, 3,1,3,2, 3,3,5,2, 4,4,6,7,3, 4,7,8,5,3};
CPPUNIT_ASSERT_EQUAL(23,(int)targetMesh->getNodalConnectivity()->getNumberOfTuples());
CPPUNIT_ASSERT(std::equal(connExp2,connExp2+23,targetMesh->getNodalConnectivity()->getConstPointer()));
double coordsExp2[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, 0.2,0.2, -0.3,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7};
void MEDCouplingBasicsTest1::testCheckButterflyCells()
{
- std::vector<int> cells;
+ std::vector<mcIdType> cells;
MEDCouplingUMesh *sourceMesh=build2DTargetMesh_1();
sourceMesh->checkButterflyCells(cells);
CPPUNIT_ASSERT(cells.empty());
- int *pt=sourceMesh->getNodalConnectivity()->getPointer();
+ mcIdType *pt=sourceMesh->getNodalConnectivity()->getPointer();
std::swap(pt[15],pt[16]);
sourceMesh->checkButterflyCells(cells);
CPPUNIT_ASSERT_EQUAL(1,(int)cells.size());
- CPPUNIT_ASSERT_EQUAL(3,cells[0]);
+ CPPUNIT_ASSERT_EQUAL(3,(int)cells[0]);
cells.clear();
std::swap(pt[15],pt[16]);
sourceMesh->checkButterflyCells(cells);
std::swap(pt[15],pt[16]);
sourceMesh->checkButterflyCells(cells);
CPPUNIT_ASSERT_EQUAL(1,(int)cells.size());
- CPPUNIT_ASSERT_EQUAL(3,cells[0]);
+ CPPUNIT_ASSERT_EQUAL(3,(int)cells[0]);
cells.clear();
std::swap(pt[15],pt[16]);
sourceMesh->checkButterflyCells(cells);
CPPUNIT_ASSERT(m3->isEqual(m4,1.e-12));
m4->decrRef();
bool isMerged;
- int newNbOfNodes;
- DataArrayInt *da=m3C->mergeNodes(1.e-12,isMerged,newNbOfNodes);
- CPPUNIT_ASSERT_EQUAL(11,m3C->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(11,newNbOfNodes);
+ mcIdType newNbOfNodes;
+ DataArrayIdType *da=m3C->mergeNodes(1.e-12,isMerged,newNbOfNodes);
+ CPPUNIT_ASSERT_EQUAL(11,(int)m3C->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(11,(int)newNbOfNodes);
CPPUNIT_ASSERT(isMerged);
da->decrRef();
m3->decrRef();
{
MEDCouplingUMesh *m1=build2DTargetMesh_1();
MEDCouplingUMesh *m2=build2DTargetMesh_1();
- std::vector<int> cells(5);
+ std::vector<mcIdType> cells(5);
for(int i=0;i<5;i++)
cells[i]=i;
m2->convertToPolyTypes(&cells[0],&cells[0]+cells.size());
m4->checkConsistencyLight();
CPPUNIT_ASSERT(m4->getCoords()==m1->getCoords());
CPPUNIT_ASSERT_EQUAL(15,(int)m4->getNumberOfCells());
- const int cells1[5]={0,1,2,3,4};
+ const mcIdType cells1[5]={0,1,2,3,4};
MEDCouplingPointSet *m1_1=m4->buildPartOfMySelf(cells1,cells1+5,true);
m1_1->setName(m1->getName().c_str());
CPPUNIT_ASSERT(m1->isEqual(m1_1,1e-12));
- const int cells2[5]={5,6,7,8,9};
+ const mcIdType cells2[5]={5,6,7,8,9};
MEDCouplingPointSet *m2_1=m4->buildPartOfMySelf(cells2,cells2+5,true);
m2_1->setName(m2->getName().c_str());
CPPUNIT_ASSERT(m2->isEqual(m2_1,1e-12));
- const int cells3[5]={10,11,12,13,14};
+ const mcIdType cells3[5]={10,11,12,13,14};
MEDCouplingPointSet *m3_1=m4->buildPartOfMySelf(cells3,cells3+5,true);
m3_1->setName(m3->getName().c_str());
CPPUNIT_ASSERT(m3->isEqual(m3_1,1e-12));
void MEDCouplingBasicsTest1::testOperationsOnFields4()
{
MEDCouplingUMesh *m=build2DTargetMesh_1();
- int nbOfCells=m->getNumberOfCells();
+ std::size_t nbOfCells=m->getNumberOfCells();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,CONST_ON_TIME_INTERVAL);
f1->setMesh(m);
DataArrayDouble *array=DataArrayDouble::New();
CPPUNIT_ASSERT(!targetMesh->checkConsecutiveCellTypes());
CPPUNIT_ASSERT(!targetMesh->checkConsecutiveCellTypesAndOrder(order1,order1+2));
CPPUNIT_ASSERT(!targetMesh->checkConsecutiveCellTypesAndOrder(order2,order2+2));
- DataArrayInt *da=targetMesh->getRenumArrForConsecutiveCellTypesSpec(order1,order1+2);
+ DataArrayIdType *da=targetMesh->getRenumArrForConsecutiveCellTypesSpec(order1,order1+2);
CPPUNIT_ASSERT_EQUAL(5,(int)da->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents());
- const int expected1[5]={2,0,1,3,4};
+ const mcIdType expected1[5]={2,0,1,3,4};
CPPUNIT_ASSERT(std::equal(expected1,expected1+5,da->getConstPointer()));
da->decrRef();
da=targetMesh->getRenumArrForConsecutiveCellTypesSpec(order2,order2+2);
CPPUNIT_ASSERT_EQUAL(5,(int)da->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents());
- const int expected2[5]={0,3,4,1,2};
+ const mcIdType expected2[5]={0,3,4,1,2};
CPPUNIT_ASSERT(std::equal(expected2,expected2+5,da->getConstPointer()));
da->decrRef();
- const int renumber1[5]={4,0,1,2,3};
+ const mcIdType renumber1[5]={4,0,1,2,3};
targetMesh->renumberCells(renumber1,false);
CPPUNIT_ASSERT(targetMesh->checkConsecutiveCellTypes());
CPPUNIT_ASSERT(targetMesh->checkConsecutiveCellTypesAndOrder(order1,order1+2));
{
MEDCouplingUMesh *m1_1=build2DSourceMesh_1();
MEDCouplingUMesh *m2_1=build2DTargetMesh_1();
- DataArrayInt *arr1=m1_1->rearrange2ConsecutiveCellTypes();
+ DataArrayIdType *arr1=m1_1->rearrange2ConsecutiveCellTypes();
MEDCouplingUMesh *m1_2=build2DSourceMesh_1();
CPPUNIT_ASSERT(m1_2->isEqual(m1_1,1e-12));
- const int expected1[2]={0,1};
+ const mcIdType expected1[2]={0,1};
CPPUNIT_ASSERT_EQUAL(2,(int)arr1->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)arr1->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(expected1,expected1+2,arr1->getConstPointer()));
arr1->decrRef();
- const int expected2[5]={0,3,4,1,2};
+ const mcIdType expected2[5]={0,3,4,1,2};
arr1=m2_1->rearrange2ConsecutiveCellTypes();
CPPUNIT_ASSERT_EQUAL(5,(int)arr1->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)arr1->getNumberOfComponents());
{
std::vector<const MEDCouplingUMesh *> meshes;
MEDCouplingUMesh *m2=build2DTargetMesh_1();
- int cells1[3]={2,3,4};
+ mcIdType cells1[3]={2,3,4};
MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true);
MEDCouplingUMesh *m3=dynamic_cast<MEDCouplingUMesh *>(m3_1);
CPPUNIT_ASSERT(m3);
meshes.push_back(m3);
- int cells2[3]={1,2,4};
+ mcIdType cells2[3]={1,2,4};
MEDCouplingPointSet *m4_1=m2->buildPartOfMySelf(cells2,cells2+3,true);
MEDCouplingUMesh *m4=dynamic_cast<MEDCouplingUMesh *>(m4_1);
CPPUNIT_ASSERT(m4);
meshes.push_back(m4);
- int cells3[2]={1,2};
+ mcIdType cells3[2]={1,2};
MEDCouplingPointSet *m5_1=m2->buildPartOfMySelf(cells3,cells3+2,true);
MEDCouplingUMesh *m5=dynamic_cast<MEDCouplingUMesh *>(m5_1);
CPPUNIT_ASSERT(m5);
meshes.push_back(m5);
m2->decrRef();
//
- std::vector<DataArrayInt *> corr;
+ std::vector<DataArrayIdType *> corr;
MEDCouplingUMesh *m7=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr);
CPPUNIT_ASSERT_EQUAL(4,(int)m7->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(3,(int)corr.size());
- const int expectedVals1[3]={3,3,2};
- const int expectedVals2[3][3]={{0,1,2},{3,0,2},{3,0,111111}};
+ const mcIdType expectedVals1[3]={3,3,2};
+ const mcIdType expectedVals2[3][3]={{0,1,2},{3,0,2},{3,0,111111}};
for(int i=0;i<3;i++)
{
- DataArrayInt *arr=corr[i];
+ DataArrayIdType *arr=corr[i];
CPPUNIT_ASSERT_EQUAL(1,(int)arr->getNumberOfComponents());
- int nbOfVals=expectedVals1[i];
- CPPUNIT_ASSERT_EQUAL(nbOfVals,(int)arr->getNumberOfTuples());
- const int *vals=arr->getConstPointer();
- for(int j=0;j<nbOfVals;j++)
+ mcIdType nbOfVals=expectedVals1[i];
+ CPPUNIT_ASSERT_EQUAL(nbOfVals,arr->getNumberOfTuples());
+ const mcIdType *vals=arr->getConstPointer();
+ for(mcIdType j=0;j<nbOfVals;j++)
CPPUNIT_ASSERT_EQUAL(expectedVals2[i][j],vals[j]);
}
- std::vector< std::vector<int> > fidsOfGroups;
- std::vector<const DataArrayInt *> corr2(corr.begin(),corr.end());
- DataArrayInt *arr2=DataArrayInt::MakePartition(corr2,m7->getNumberOfCells(),fidsOfGroups);
- const int fidExp[4]={5,1,3,4};
- const int fidsGrp[3][3]={{1,3,5},{3,4,5},{4,5,23344}};
+ std::vector< std::vector<mcIdType> > fidsOfGroups;
+ std::vector<const DataArrayIdType *> corr2(corr.begin(),corr.end());
+ DataArrayIdType *arr2=DataArrayIdType::MakePartition(corr2,m7->getNumberOfCells(),fidsOfGroups);
+ const mcIdType fidExp[4]={5,1,3,4};
+ const mcIdType fidsGrp[3][3]={{1,3,5},{3,4,5},{4,5,23344}};
CPPUNIT_ASSERT_EQUAL(3,(int)fidsOfGroups.size());
CPPUNIT_ASSERT_EQUAL(1,(int)arr2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(4,(int)arr2->getNumberOfTuples());
CPPUNIT_ASSERT(std::equal(fidExp,fidExp+4,arr2->getConstPointer()));
for(int i=0;i<3;i++)
{
- int nbOfVals=expectedVals1[i];
- CPPUNIT_ASSERT_EQUAL(nbOfVals,(int)fidsOfGroups[i].size());
+ mcIdType nbOfVals=expectedVals1[i];
+ CPPUNIT_ASSERT_EQUAL(nbOfVals,ToIdType(fidsOfGroups[i].size()));
CPPUNIT_ASSERT(std::equal(fidsOfGroups[i].begin(),fidsOfGroups[i].end(),fidsGrp[i]));
}
- for(std::vector<DataArrayInt *>::iterator iter=corr.begin();iter!=corr.end();iter++)
+ for(std::vector<DataArrayIdType *>::iterator iter=corr.begin();iter!=corr.end();iter++)
(*iter)->decrRef();
arr2->decrRef();
m7->decrRef();
MEDCouplingUMesh *m2;
MEDCouplingUMesh *m1=build3DExtrudedUMesh_1(m2);
m2->decrRef();
- const int part1[5]={2,3,6,4,10};
+ const mcIdType part1[5]={2,3,6,4,10};
MEDCouplingUMesh *m3=(MEDCouplingUMesh *)m1->buildPartOfMySelf(part1,part1+5,true);
- const int part2[4]={5,6,4,7};
+ const mcIdType part2[4]={5,6,4,7};
MEDCouplingUMesh *m4=(MEDCouplingUMesh *)m1->buildPartOfMySelf(part2,part2+4,true);
std::vector<const MEDCouplingUMesh *> meshes;
meshes.push_back(m1);
meshes.push_back(m3);
meshes.push_back(m3);
meshes.push_back(m4);
- std::vector<DataArrayInt *> corr;
+ std::vector<DataArrayIdType *> corr;
MEDCouplingUMesh *m5=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr);
CPPUNIT_ASSERT_EQUAL(18,(int)m5->getNumberOfCells());
- std::vector<DataArrayInt *>::iterator it=corr.begin();
- const int exp1[4]={18,5,5,4};
- const int exp2[4][18]={
+ std::vector<DataArrayIdType *>::iterator it=corr.begin();
+ const mcIdType exp1[4]={18,5,5,4};
+ const mcIdType exp2[4][18]={
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17},
{2,3,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
{2,3,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
int i=0;
for(;it!=corr.end();it++,i++)
{
- int sz=(*it)->getNumberOfTuples();
+ mcIdType sz=(*it)->getNumberOfTuples();
CPPUNIT_ASSERT_EQUAL(exp1[i],sz);
CPPUNIT_ASSERT(std::equal(exp2[i],exp2[i]+sz,(*it)->getConstPointer()));
}
targetMesh->decrRef();
// testing
double targetCoords[12]={0.,0.,0.,0.5,0.,0.5,1.,0.,1.,0.,1.,0.};
- int targetConn[4]={0,1,2,3};
+ mcIdType targetConn[4]={0,1,2,3};
targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(1);
{
MEDCouplingUMesh *targetMesh=build2DTargetMesh_1();
double pos[12]={0.,0.,0.4,0.4,0.,0.4,0.1,0.1,0.25,0.,0.65,0.};
- MCAuto<DataArrayInt> t1,t2;
+ MCAuto<DataArrayIdType> t1,t2;
//2D basic
targetMesh->getCellsContainingPoints(pos,6,1e-12,t1,t2);
CPPUNIT_ASSERT_EQUAL(6,(int)t1->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(7,(int)t2->getNbOfElems());
- const int expectedValues1[6]={0,4,3,0,1,2};
- const int expectedValues2[7]={0,1,2,3,4,5,6};
+ const mcIdType expectedValues1[6]={0,4,3,0,1,2};
+ const mcIdType expectedValues2[7]={0,1,2,3,4,5,6};
CPPUNIT_ASSERT(std::equal(t1->begin(),t1->end(),expectedValues1));
CPPUNIT_ASSERT(std::equal(t2->begin(),t2->end(),expectedValues2));
//2D with no help of bounding box.
CPPUNIT_ASSERT(std::equal(t2->begin(),t2->end(),expectedValues2));
//2D outside
const double pos1bis[2]={-0.3303300858899107,-0.11819805153394641};
- CPPUNIT_ASSERT_EQUAL(-1,targetMesh->getCellContainingPoint(pos1bis,1e-12));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(-1),targetMesh->getCellContainingPoint(pos1bis,1e-12));
targetMesh->decrRef();
//test limits 2D
targetMesh=build2DTargetMesh_1();
const double pos2[2]={0.2,-0.05};
- std::vector<int> t11;
+ std::vector<mcIdType> t11;
t11.clear();
targetMesh->getCellsContainingPoint(pos2,1e-12,t11);
CPPUNIT_ASSERT_EQUAL(2,(int)t11.size());
- const int expectedValues3[2]={0,1};
+ const mcIdType expectedValues3[2]={0,1};
CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues3));
const double pos3[2]={0.2,0.2};
t11.clear();
targetMesh->getCellsContainingPoint(pos3,1e-12,t11);
CPPUNIT_ASSERT_EQUAL(5,(int)t11.size());
- const int expectedValues4[5]={0,1,2,3,4};
+ const mcIdType expectedValues4[5]={0,1,2,3,4};
CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues4));
- CPPUNIT_ASSERT_EQUAL(0,targetMesh->getCellContainingPoint(pos3,1e-12));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),targetMesh->getCellContainingPoint(pos3,1e-12));
targetMesh->decrRef();
//3D
targetMesh=build3DTargetMesh_1();
const double pos4[3]={25.,25.,25.};
- CPPUNIT_ASSERT_EQUAL(0,targetMesh->getCellContainingPoint(pos4,1e-12));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),targetMesh->getCellContainingPoint(pos4,1e-12));
const double pos5[3]={50.,50.,50.};
t11.clear();
targetMesh->getCellsContainingPoint(pos5,1e-12,t11);
CPPUNIT_ASSERT_EQUAL(8,(int)t11.size());
- const int expectedValues5[8]={0,1,2,3,4,5,6,7};
+ const mcIdType expectedValues5[8]={0,1,2,3,4,5,6,7};
CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues5));
const double pos6[3]={0., 50., 0.};
t11.clear();
targetMesh->getCellsContainingPoint(pos6,1e-12,t11);
CPPUNIT_ASSERT_EQUAL(2,(int)t11.size());
- const int expectedValues6[2]={0,2};
+ const mcIdType expectedValues6[2]={0,2};
CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues6));
//3D outside
const double pos7[3]={-1.0,-1.0,0.};
- CPPUNIT_ASSERT_EQUAL(-1,targetMesh->getCellContainingPoint(pos7,1e-12));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(-1),targetMesh->getCellContainingPoint(pos7,1e-12));
//3D outside 2
const double center2[3]={0.,0.,0.};
const double vec2[3]={0.,-1.,0.};
targetMesh->rotate(center2,vec2,0.78539816339744830962);
const double pos8[3]={-25,25.,12.};
- CPPUNIT_ASSERT_EQUAL(-1,targetMesh->getCellContainingPoint(pos8,1e-12));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(-1),targetMesh->getCellContainingPoint(pos8,1e-12));
//
targetMesh->decrRef();
}
{
MEDCouplingUMesh *targetMesh=build2DTargetMesh_1();
MEDCouplingFieldDouble *fieldOnCells=MEDCouplingFieldDouble::New(ON_CELLS);
- int nbOfCells=targetMesh->getNumberOfCells();
+ std::size_t nbOfCells=targetMesh->getNumberOfCells();
fieldOnCells->setMesh(targetMesh);
DataArrayDouble *array=DataArrayDouble::New();
array->alloc(nbOfCells,2);
fieldOnCells->setArray(array);
double *tmp=array->getPointer();
- for(int i=0;i<nbOfCells;i++)
+ for(std::size_t i=0;i<nbOfCells;i++)
{ tmp[2*i]=7.+(double)i; tmp[2*i+1]=17.+(double)i; }
array->decrRef();
//
//
targetMesh=build2DSourceMesh_1();
MEDCouplingFieldDouble *fieldOnNodes=MEDCouplingFieldDouble::New(ON_NODES);
- int nbOfNodes=targetMesh->getNumberOfNodes();
+ mcIdType nbOfNodes=targetMesh->getNumberOfNodes();
fieldOnNodes->setMesh(targetMesh);
array=DataArrayDouble::New();
array->alloc(nbOfNodes,2);
coordsZ1->useArray(arrZ1,false, DeallocType::CPP_DEALLOC,4,1);
mesh1->setCoords(coordsX1,coordsY1,coordsZ1);
- std::vector<int> dis=mesh1->getDistributionOfTypes();
+ std::vector<mcIdType> dis=mesh1->getDistributionOfTypes();
CPPUNIT_ASSERT_EQUAL(3,(int) dis.size());
- CPPUNIT_ASSERT_EQUAL((int) INTERP_KERNEL::NORM_HEXA8,dis[0]);
- CPPUNIT_ASSERT_EQUAL(27,dis[1]);
- CPPUNIT_ASSERT_EQUAL(-1,dis[2]);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(INTERP_KERNEL::NORM_HEXA8),dis[0]);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(27),dis[1]);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(-1),dis[2]);
- std::vector<const DataArrayInt *> idsPerType;
+ std::vector<const DataArrayIdType *> idsPerType;
CPPUNIT_ASSERT(!(mesh1->checkTypeConsistencyAndContig(dis, idsPerType)));
- dis[0]=(int) INTERP_KERNEL::NORM_QUAD4;
+ dis[0]=(mcIdType) INTERP_KERNEL::NORM_QUAD4;
CPPUNIT_ASSERT_THROW(mesh1->checkTypeConsistencyAndContig(dis, idsPerType),INTERP_KERNEL::Exception);
- dis[0]=(int) INTERP_KERNEL::NORM_HEXA8;
+ dis[0]=(mcIdType) INTERP_KERNEL::NORM_HEXA8;
dis[2]=0;
- DataArrayInt *ids=DataArrayInt::New();
+ DataArrayIdType *ids=DataArrayIdType::New();
ids->alloc(10,1);
ids->fillWithValue(23);
idsPerType.push_back(ids);
- DataArrayInt* check=mesh1->checkTypeConsistencyAndContig(dis, idsPerType);
+ DataArrayIdType* check=mesh1->checkTypeConsistencyAndContig(dis, idsPerType);
CPPUNIT_ASSERT(check);
CPPUNIT_ASSERT(check->isEqual(*ids));
- std::vector<int> code;
- std::vector<DataArrayInt *> idsInPflPerType;
- std::vector<DataArrayInt *> pfls;
+ std::vector<mcIdType> code;
+ std::vector<DataArrayIdType *> idsInPflPerType;
+ std::vector<DataArrayIdType *> pfls;
mesh1->splitProfilePerType(ids,code,idsInPflPerType,pfls);
CPPUNIT_ASSERT_EQUAL(3,(int)code.size());
- CPPUNIT_ASSERT_EQUAL((int) INTERP_KERNEL::NORM_HEXA8,code[0]);
- CPPUNIT_ASSERT_EQUAL(10,code[1]);
- CPPUNIT_ASSERT_EQUAL(0,code[2]);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(INTERP_KERNEL::NORM_HEXA8),code[0]);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(10),code[1]);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),code[2]);
CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType.size());
CPPUNIT_ASSERT_EQUAL(1,(int)pfls.size());
- DataArrayInt *exp=DataArrayInt::New(); exp->alloc(10,1); exp->iota(0);
+ DataArrayIdType *exp=DataArrayIdType::New(); exp->alloc(10,1); exp->iota(0);
CPPUNIT_ASSERT(idsInPflPerType[0]->isEqual(*exp));
exp->decrRef();
CPPUNIT_ASSERT(pfls[0]->isEqual(*ids));
ids->decrRef();
check->decrRef();
- int cells1[4]={0,1,25,26};
+ mcIdType cells1[4]={0,1,25,26};
MEDCouplingUMesh *partMesh1=
dynamic_cast<MEDCouplingUMesh *>(mesh1->buildPart(cells1,cells1+4));
CPPUNIT_ASSERT(partMesh1);
CPPUNIT_ASSERT_EQUAL(4,(int)partMesh1->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8));
- CPPUNIT_ASSERT_EQUAL(64,mesh1->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(64,partMesh1->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(64,(int)mesh1->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(64,(int)partMesh1->getNumberOfNodes());
- int cells2[2]={25,26};
- DataArrayInt* arr1;
+ mcIdType cells2[2]={25,26};
+ DataArrayIdType* arr1;
MEDCouplingCMesh *partMesh2=
dynamic_cast<MEDCouplingCMesh *>(mesh1->buildPartAndReduceNodes(cells2,cells2+2,arr1));
CPPUNIT_ASSERT(partMesh2);
CPPUNIT_ASSERT_EQUAL(2,(int)partMesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8));
- CPPUNIT_ASSERT_EQUAL(12,partMesh2->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(12,(int)partMesh2->getNumberOfNodes());
- int cells3[2]={2,3};
- DataArrayInt* arr2;
+ mcIdType cells3[2]={2,3};
+ DataArrayIdType* arr2;
MEDCouplingUMesh *partMesh3=
dynamic_cast<MEDCouplingUMesh *>(partMesh1->buildPartAndReduceNodes(cells3,cells3+2,arr2));
CPPUNIT_ASSERT(partMesh3);
CPPUNIT_ASSERT_EQUAL(2,(int)partMesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8));
- CPPUNIT_ASSERT_EQUAL(12,partMesh3->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(12,(int)partMesh3->getNumberOfNodes());
CPPUNIT_ASSERT_THROW(mesh1->simplexize(0),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(mesh1->getMeasureFieldOnNode(true),INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *f1=mesh2d->buildOrthogonalField();
std::vector<double> tinyInfoD;
- std::vector<int> tinyInfo;
+ std::vector<mcIdType> tinyInfo;
std::vector<std::string> littleStrings;
mesh2d->getTinySerializationInformation(tinyInfoD, tinyInfo, littleStrings);
CPPUNIT_ASSERT_EQUAL(5,(int)tinyInfo.size());
CPPUNIT_ASSERT_EQUAL(-1,(int)tinyInfo[3]); //it
CPPUNIT_ASSERT_EQUAL(-1,(int)tinyInfo[4]); //order
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,tinyInfoD[0],1e-14); //time
- DataArrayInt* d1=DataArrayInt::New();
+ DataArrayIdType* d1=DataArrayIdType::New();
DataArrayDouble* d2=DataArrayDouble::New();
mesh2d->resizeForUnserialization(tinyInfo, d1, d2, littleStrings);
CPPUNIT_ASSERT_EQUAL(0,(int)d1->getNumberOfTuples());
void MEDCouplingBasicsTest1::testFindNodeOnPlane()
{
MEDCouplingUMesh *mesh=build3DTargetMesh_1();
- std::vector<int> n;
+ std::vector<mcIdType> n;
double pt[3]={300.,300.,0.};
double v[3]={0.,0.,2.};
mesh->findNodesOnPlane(pt,v,1e-12,n);
CPPUNIT_ASSERT_EQUAL(9,(int)n.size());
MEDCouplingUMesh *m3dSurf=(MEDCouplingUMesh *)mesh->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
MEDCouplingMappedExtrudedMesh *me=MEDCouplingMappedExtrudedMesh::New(mesh,m3dSurf,0);
- const DataArrayInt *da=me->getMesh3DIds();
+ const DataArrayIdType *da=me->getMesh3DIds();
CPPUNIT_ASSERT_EQUAL(8,(int)me->getNumberOfCells());
- const int expected[8]={0,1,2,3,4,5,6,7};
- const int *val=da->getConstPointer();
+ const mcIdType expected[8]={0,1,2,3,4,5,6,7};
+ const mcIdType *val=da->getConstPointer();
for(int i=0;i<8;i++)
CPPUNIT_ASSERT_EQUAL(expected[i],val[i]);
me->decrRef();
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
MEDCouplingUMesh *m2=build3DSurfTargetMesh_1();
CPPUNIT_ASSERT(m->isEqual(m2,0));
- const int arr[5]={12,3,25,2,26};
+ const mcIdType arr[5]={12,3,25,2,26};
m->renumberCells(arr,true);
CPPUNIT_ASSERT(!m->isEqual(m2,0));
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,m->getTypeOfCell(0));
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,m->getTypeOfCell(2));
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(3));
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,m->getTypeOfCell(4));
- const int arr2[5]={5,-1,-5,4,8};
+ const mcIdType arr2[5]={5,-1,-5,4,8};
m->renumberCells(arr2,true);
CPPUNIT_ASSERT(m->isEqual(m2,0));
m->decrRef();
{
MEDCouplingUMesh *m1 = build1DTargetMesh_1();
- DataArrayInt * conn = DataArrayInt::New();
- DataArrayInt * connI = DataArrayInt::New();
+ DataArrayIdType * conn = DataArrayIdType::New();
+ DataArrayIdType * connI = DataArrayIdType::New();
m1->setConnectivity(conn, connI, true); // was SEG-Faulting with empty arrays
conn->decrRef();
connI->decrRef();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_GAUSS_PT,NO_TIME);
CPPUNIT_ASSERT_THROW(f->getNumberOfTuples(), INTERP_KERNEL::Exception); // Sanity check!
f->setMesh(m);
- CPPUNIT_ASSERT_EQUAL(5,f->getNumberOfMeshPlacesExpected());
- CPPUNIT_ASSERT_EQUAL(0,f->getNbOfGaussLocalization());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),f->getNumberOfMeshPlacesExpected());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getNbOfGaussLocalization());
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,_refCoo1,_gsCoo1,_wg1);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,_refCoo1,_gsCoo1,_wg1); // not a bug only to check that it works well
CPPUNIT_ASSERT_THROW(f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo1,_gsCoo1,_wg1),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_EQUAL(1,f->getNbOfGaussLocalization());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),f->getNbOfGaussLocalization());
const double refCoo2[8]={ 0.,0., 1.,0., 1.,1., 0.,1. };
std::vector<double> _refCoo2(refCoo2,refCoo2+8);
_gsCoo1.resize(4); _wg1.resize(2);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo2,_gsCoo1,_wg1);
- CPPUNIT_ASSERT_EQUAL(2,f->getNbOfGaussLocalization());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),f->getNbOfGaussLocalization());
DataArrayDouble *array=DataArrayDouble::New();
array->alloc(18,2);
double *ptr=array->getPointer();
CPPUNIT_ASSERT_DOUBLES_EQUAL(16.,f->getIJK(1,5,1),1e-14);
//
f->clearGaussLocalizations();
- CPPUNIT_ASSERT_EQUAL(0,f->getNbOfGaussLocalization());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getNbOfGaussLocalization());
CPPUNIT_ASSERT_THROW(f->checkConsistencyLight(),INTERP_KERNEL::Exception);
- int ids1[4]={0,1,3,4};
+ mcIdType ids1[4]={0,1,3,4};
CPPUNIT_ASSERT_THROW(f->setGaussLocalizationOnCells(ids1,ids1+4,_refCoo2,_gsCoo1,_wg1),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_EQUAL(0,f->getNbOfGaussLocalization());
- int ids2[2]={0,4};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getNbOfGaussLocalization());
+ mcIdType ids2[2]={0,4};
f->setGaussLocalizationOnCells(ids2,ids2+2,_refCoo2,_gsCoo1,_wg1);
- CPPUNIT_ASSERT_EQUAL(1,f->getNbOfGaussLocalization());
- CPPUNIT_ASSERT_EQUAL(0,f->getGaussLocalizationIdOfOneCell(0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),f->getNbOfGaussLocalization());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getGaussLocalizationIdOfOneCell(0));
CPPUNIT_ASSERT_THROW(f->getGaussLocalizationIdOfOneCell(1),INTERP_KERNEL::Exception);
- int ids3[2]={1,2};
+ mcIdType ids3[2]={1,2};
f->setGaussLocalizationOnCells(ids3,ids3+2,_refCoo1,_gsCoo1,_wg1);
- CPPUNIT_ASSERT_EQUAL(2,f->getNbOfGaussLocalization());
- CPPUNIT_ASSERT_EQUAL(0,f->getGaussLocalizationIdOfOneCell(0));
- CPPUNIT_ASSERT_EQUAL(1,f->getGaussLocalizationIdOfOneCell(1));
- CPPUNIT_ASSERT_EQUAL(1,f->getGaussLocalizationIdOfOneCell(2));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),f->getNbOfGaussLocalization());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getGaussLocalizationIdOfOneCell(0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),f->getGaussLocalizationIdOfOneCell(1));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),f->getGaussLocalizationIdOfOneCell(2));
CPPUNIT_ASSERT_THROW(f->checkConsistencyLight(),INTERP_KERNEL::Exception);//<- cell 3 has no localization
- int ids4[1]={3};
+ mcIdType ids4[1]={3};
std::vector<double> _gsCoo2(_gsCoo1);
std::vector<double> _wg2(_wg1);
_gsCoo2[0]=0.8888777776666; _wg2[0]=0.1234567892377;
f->setGaussLocalizationOnCells(ids4,ids4+1,_refCoo2,_gsCoo2,_wg2);
- CPPUNIT_ASSERT_EQUAL(3,f->getNbOfGaussLocalization());
- std::vector<int> tmpIds;
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),f->getNbOfGaussLocalization());
+ std::vector<mcIdType> tmpIds;
f->getCellIdsHavingGaussLocalization(0,tmpIds);
CPPUNIT_ASSERT_EQUAL(2,(int)tmpIds.size());
CPPUNIT_ASSERT(std::equal(ids2,ids2+2,tmpIds.begin()));
MEDCouplingUMesh *m=build2DTargetMesh_1();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_GAUSS_NE,NO_TIME);
f->setMesh(m);
- CPPUNIT_ASSERT_EQUAL(5,f->getNumberOfMeshPlacesExpected());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),f->getNumberOfMeshPlacesExpected());
f->setName("MyFirstFieldOnNE");
f->setDescription("MyDescriptionNE");
DataArrayDouble *array=DataArrayDouble::New();
{
MEDCouplingUMesh *m=build2DTargetMesh_1();
double vec[3]={0.,0.,-1.};
- std::vector<int> res1;
+ std::vector<mcIdType> res1;
CPPUNIT_ASSERT_THROW(m->are2DCellsNotCorrectlyOriented(vec,false,res1),INTERP_KERNEL::Exception);
m->changeSpaceDimension(3);
res1.clear();
//
vec[2]=-1.;
// connectivity inversion
- int *conn=m->getNodalConnectivity()->getPointer();
- int tmp=conn[11];
+ mcIdType *conn=m->getNodalConnectivity()->getPointer();
+ mcIdType tmp=conn[11];
conn[11]=conn[12];
conn[12]=tmp;
m->are2DCellsNotCorrectlyOriented(vec,false,res1);
CPPUNIT_ASSERT_EQUAL(1,(int)res1.size());
- CPPUNIT_ASSERT_EQUAL(2,res1[0]);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),res1[0]);
res1.clear();
m->orientCorrectly2DCells(vec,false);
m->are2DCellsNotCorrectlyOriented(vec,false,res1);
MEDCouplingUMesh *m1=0;
MEDCouplingUMesh *m2=build3DExtrudedUMesh_1(m1);
m1->decrRef();
- std::vector<int> res1;
+ std::vector<mcIdType> res1;
m2->arePolyhedronsNotCorrectlyOriented(res1);
CPPUNIT_ASSERT_EQUAL(6,(int)res1.size());
m2->orientCorrectlyPolyhedrons();
CPPUNIT_ASSERT(res1.empty());
m2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(18,(int)m2->getNumberOfCells());
- int cellIds[3]={0,6,12};
- std::vector<int> cellIds2(cellIds,cellIds+3);
+ mcIdType cellIds[3]={0,6,12};
+ std::vector<mcIdType> cellIds2(cellIds,cellIds+3);
m2->convertToPolyTypes(&cellIds2[0],&cellIds2[0]+cellIds2.size());
m2->orientCorrectlyPolyhedrons();
res1.clear();
MEDCouplingUMesh *m3=build2DTargetMesh_1();
double vec[3]={0.,0.,1.};
m3->changeSpaceDimension(3);
- const int ids1[5]={0,1,2,3,4};
- std::vector<int> ids2(ids1,ids1+5);
+ const mcIdType ids1[5]={0,1,2,3,4};
+ std::vector<mcIdType> ids2(ids1,ids1+5);
m3->convertToPolyTypes(&ids2[0],&ids2[0]+ids2.size());
m3->orientCorrectly2DCells(vec,false);
MEDCouplingUMesh *m4=buildCU1DMesh_U();
coords[4] = cos(5*M_PI/4.0); coords[5] = sin(5*M_PI/4.0);
coords[6] = cos(M_PI/4.0); coords[7] = sin(M_PI/4.0);
- int conn[4]= { 0,1,2,3 };
+ mcIdType conn[4]= { 0,1,2,3 };
double vec[3]={0.,0.,-1.};
m->allocateCells(1);
m->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,4,conn);
myCoords->decrRef();
m->changeSpaceDimension(3);
- std::vector<int> res1;
+ std::vector<mcIdType> res1;
m->are2DCellsNotCorrectlyOriented(vec,false,res1);
CPPUNIT_ASSERT(res1.empty());
vec[2] = 1.0;
*/
void MEDCouplingBasicsTest2::testPolyhedronBarycenter()
{
- int connN[]={0,3,2,1, -1, 4,5,6,7, -1, 0,4,7,3, -1, 3,7,6,2, -1, 2,6,5,1, -1, 1,5,4,0};
+ mcIdType connN[]={0,3,2,1, -1, 4,5,6,7, -1, 0,4,7,3, -1, 3,7,6,2, -1, 2,6,5,1, -1, 1,5,4,0};
double coords[]={0.,0.,0., 1.,0.,0., 1.,1.,0., 0.,1.,0., 0.,0.,1., 1.,0.,1., 1.,1.,1., 0.,1.,1., 0.5, 0.5, 0.5};
MEDCouplingUMesh *meshN=MEDCouplingUMesh::New();
meshN->setName("ForBary");
myCoords->decrRef();
meshN->checkConsistencyLight();
//
- std::vector<int> res1;
+ std::vector<mcIdType> res1;
meshN->arePolyhedronsNotCorrectlyOriented(res1);
meshN->orientCorrectlyPolyhedrons();
CPPUNIT_ASSERT(res1.empty());
0.167803379307 , -0.207851396623 , -0.088802726124 , 0.12868717152 , -0.230920439715 , 0.00760508389036 ,
-0.0372812069535 , -0.286740286332 , 0.00963701291166 };
- int connN [] = { /*polyhedron 0*/
+ mcIdType connN [] = { /*polyhedron 0*/
0 , 1 , 3 , 4 , 2 , -1 , 1 , 5 , 6 , 7 , 0 , -1 , 0 , 7 , 8 , 10 , 11 , 9 , 2 , -1 , 1 , 5 , 12 , 14 , 15 , 13 , 3 , -1 , 16 , 9 , 2 , 4 , 17 , -1
, 4 , 3 , 13 , 18 , 17 , -1 , 5 , 6 , 19 , 21 , 20 , 12 , -1 , 6 , 7 , 8 , 23 , 22 , 19 , -1 , 23 , 24 , 10 , 8 , -1 , 25 , 11 , 9 , 16 , -1
, 24 , 26 , 25 , 11 , 10 , -1 , 12 , 14 , 20 , -1 , 27 , 28 , 29 , 15 , 13 , 18 , -1 , 14 , 15 , 29 , 30 , 21 , 20 , -1 , 26 , 27 , 18 , 17 , 16 , 25 , -1
meshN->setCoords(myCoords);
myCoords->decrRef();
meshN->checkConsistencyLight();
- std::vector<int> res1;
+ std::vector<mcIdType> res1;
meshN->arePolyhedronsNotCorrectlyOriented(res1);
meshN->orientCorrectlyPolyhedrons();
res1.clear();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
f->setMesh(m);
DataArrayDouble *arr=DataArrayDouble::New();
- int nbOfCells=m->getNumberOfCells();
- arr->alloc(nbOfCells,3);
+ arr->alloc(m->getNumberOfCells(),3);
f->setArray(arr);
arr->decrRef();
const double values1[15]={7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.};
std::copy(values1,values1+15,arr->getPointer());
- const int renumber1[5]={3,1,0,4,2};
+ const mcIdType renumber1[5]={3,1,0,4,2};
double res[3];
const double loc[]={-0.05,-0.05, 0.55,-0.25, 0.55,0.15, -0.05,0.45, 0.45,0.45};
for(int j=0;j<5;j++)
ptr=f->getArray()->getConstPointer();
for(int i=0;i<36;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],ptr[i],1e-12);
- const int renumber2[5]={2,1,4,0,3};//reverse renumber1
+ const mcIdType renumber2[5]={2,1,4,0,3};//reverse renumber1
f->renumberCells(renumber2,false);
CPPUNIT_ASSERT(f->isEqual(fCpy,1e-12,1e-12));
fCpy->decrRef();
MEDCouplingUMesh *m=build2DTargetMesh_1();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME);
f->setMesh(m);
- CPPUNIT_ASSERT_EQUAL(9,f->getNumberOfMeshPlacesExpected());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(9),f->getNumberOfMeshPlacesExpected());
DataArrayDouble *arr=DataArrayDouble::New();
- int nbOfNodes=m->getNumberOfNodes();
+ mcIdType nbOfNodes=m->getNumberOfNodes();
arr->alloc(nbOfNodes,3);
f->setArray(arr);
arr->decrRef();
const double values1[27]={7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.,12.,112.,10012.,13.,113.,10013.,14.,114.,10014.,15.,115.,10015.};
std::copy(values1,values1+27,arr->getPointer());
f->checkConsistencyLight();
- const int renumber1[9]={0,4,1,3,5,2,6,7,8};
+ const mcIdType renumber1[9]={0,4,1,3,5,2,6,7,8};
double res[3];
const double loc[]={0.5432,-0.2432, 0.5478,0.1528};
const double expected1[6]={9.0272, 109.0272, 10009.0272, 11.4124,111.4124,10011.4124};
const double expected2[27]={7.,107.,10007.,9.,109.,10009.,12.,112.,10012.,10.,110.,10010.,8.,108.,10008.,11.,111.,10011.,13.,113.,10013.,14.,114.,10014.,15.,115.,10015.};
for(int i=0;i<27;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f->getArray()->getConstPointer()[i],1e-12);
- const int renumber2[9]={0,2,5,3,1,4,6,7,8};//reverse of renumber2
+ const mcIdType renumber2[9]={0,2,5,3,1,4,6,7,8};//reverse of renumber2
f->renumberNodes(renumber2);
CPPUNIT_ASSERT(f->isEqual(fCpy,1e-12,1e-12));
fCpy->decrRef();
std::set<INTERP_KERNEL::NormalizedCellType> expected1Bis(expected1,expected1+5);
CPPUNIT_ASSERT(expected1Bis==types);
CPPUNIT_ASSERT(mesh->isPresenceOfQuadratic());
- CPPUNIT_ASSERT_EQUAL(62,mesh->getNodalConnectivityArrayLen());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(62),mesh->getNodalConnectivityArrayLen());
MEDCouplingFieldDouble *f1=mesh->getMeasureField(false);
//
mesh->convertQuadraticCellsToLinear();
mesh->checkConsistencyLight();
MEDCouplingFieldDouble *f2=mesh->getMeasureField(false);
CPPUNIT_ASSERT(f1->getArray()->isEqual(*f2->getArray(),1e-12));
- CPPUNIT_ASSERT_EQUAL(48,mesh->getNodalConnectivityArrayLen());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(48),mesh->getNodalConnectivityArrayLen());
std::set<INTERP_KERNEL::NormalizedCellType> types2=mesh->getAllGeoTypes();
CPPUNIT_ASSERT_EQUAL(3,(int)types2.size());
INTERP_KERNEL::NormalizedCellType expected2[3]={INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_TRI3, INTERP_KERNEL::NORM_QUAD4};
{
MEDCouplingUMesh *mesh1=build2DTargetMesh_3();
MEDCouplingUMesh *mesh2=build2DTargetMesh_3();
- DataArrayInt *cellCor,*nodeCor;
+ DataArrayIdType *cellCor,*nodeCor;
//First test mesh1
mesh1->checkGeoEquivalWith(mesh1,0,1e-12,cellCor,nodeCor);//deepEqual
CPPUNIT_ASSERT(cellCor==0);
CPPUNIT_ASSERT(cellCor==0);
CPPUNIT_ASSERT(nodeCor==0);
//Third test : cell permutation by keeping the first the middle and the last as it is.
- const int renum[]={0,2,1,3,4,5,6,8,7,9};
+ const mcIdType renum[]={0,2,1,3,4,5,6,8,7,9};
mesh2->renumberCells(renum,false);
CPPUNIT_ASSERT_THROW(mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor),INTERP_KERNEL::Exception);//deepEqual fails
CPPUNIT_ASSERT(cellCor==0);
//4th test : cell and node permutation by keeping the first the middle and the last as it is.
mesh2->decrRef();
mesh2=build2DTargetMesh_3();
- const int renum2[]={0,2,1,3,4,5,6,8,7,9,10};
+ const mcIdType renum2[]={0,2,1,3,4,5,6,8,7,9,10};
mesh2->renumberCells(renum,false);
mesh2->renumberNodes(renum2,11);
CPPUNIT_ASSERT_THROW(mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor),INTERP_KERNEL::Exception);//deepEqual fails
//5th test : modification of the last cell to check fastCheck detection.
mesh2->decrRef();
mesh2=build2DTargetMesh_3();
- const int renum3[]={0,2,1,3,4,5,6,8,9,7};
+ const mcIdType renum3[]={0,2,1,3,4,5,6,8,9,7};
mesh2->renumberCells(renum3,false);
mesh2->renumberNodes(renum2,11);
bool isExcep=false;
try { mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor);//deepEqual fails
}
- catch(INTERP_KERNEL::Exception& e) { isExcep=true; }
+ catch(INTERP_KERNEL::Exception&) { isExcep=true; }
CPPUNIT_ASSERT(isExcep); isExcep=false;
CPPUNIT_ASSERT(cellCor==0);
CPPUNIT_ASSERT(nodeCor==0);
try { mesh1->checkGeoEquivalWith(mesh2,1,1e-12,cellCor,nodeCor);//fastEqual has detected something
}
- catch(INTERP_KERNEL::Exception& e) { isExcep=true; }
+ catch(INTERP_KERNEL::Exception&) { isExcep=true; }
CPPUNIT_ASSERT(isExcep); isExcep=false;
CPPUNIT_ASSERT(cellCor==0);
CPPUNIT_ASSERT(nodeCor==0);
{
MEDCouplingUMesh *mesh1=build2DTargetMesh_4();
MEDCouplingUMesh *mesh2=build2DTargetMesh_1();
- DataArrayInt *cellCor,*nodeCor;
+ DataArrayIdType *cellCor,*nodeCor;
mesh1->checkGeoEquivalWith(mesh2,10,1e-12,cellCor,nodeCor);
CPPUNIT_ASSERT(cellCor==0);
CPPUNIT_ASSERT(nodeCor!=0);
- const int expected1[9]={0, 1, 3, 4, 5, 6, 7, 8, 9};
+ const mcIdType expected1[9]={0, 1, 3, 4, 5, 6, 7, 8, 9};
for(int i=0;i<9;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],nodeCor->getIJ(i,0));
nodeCor->decrRef();
void MEDCouplingBasicsTest2::testCopyTinyStringsFromOnFields()
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- int nbOfCells=m->getNumberOfCells();
+ std::size_t nbOfCells=m->getNumberOfCells();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME);
f->setMesh(m);
- CPPUNIT_ASSERT_EQUAL(5,f->getNumberOfMeshPlacesExpected());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),f->getNumberOfMeshPlacesExpected());
f->setName("a");
f->setDescription("b");
DataArrayDouble *a1=DataArrayDouble::New();
m->tryToShareSameCoordsPermute(*m2,1e-12);
CPPUNIT_ASSERT(m->getCoords()==m2->getCoords());
CPPUNIT_ASSERT(m2->isEqual(m,1e-12));
- const int renum1[9]={1,2,0,5,8,7,4,3,6};
+ const mcIdType renum1[9]={1,2,0,5,8,7,4,3,6};
m->renumberNodes(renum1,9);
CPPUNIT_ASSERT(m->getCoords()!=m2->getCoords());
CPPUNIT_ASSERT(!m2->isEqual(m,1e-12));
{
MEDCouplingUMesh *m1=build2DTargetMesh_4();
double targetCoords[8]={-0.3,-0.3, 0.2,-0.3, -0.3,0.2, 0.2,0.2 };
- int targetConn[4]={0,2,3,1};
+ mcIdType targetConn[4]={0,2,3,1};
MEDCouplingUMesh *m2=MEDCouplingUMesh::New();
m2->setMeshDimension(2);
m2->allocateCells(1);
f1->setArray(array);
array->decrRef();
//
- const int renum[]={0,2,1,3,4,5,6,8,7,9};
+ const mcIdType renum[]={0,2,1,3,4,5,6,8,7,9};
mesh2->renumberCells(renum,false);
CPPUNIT_ASSERT(f1->getMesh()==mesh1);
f1->changeUnderlyingMesh(mesh1,10,1e-12);// nothing done only to check that nothing done.
f1->setArray(array);
array->decrRef();
//
- const int renum2[]={0,2,10,3,4,5,6,8,7,9,1};
+ const mcIdType renum2[]={0,2,10,3,4,5,6,8,7,9,1};
mesh2->renumberNodes(renum2,11);
CPPUNIT_ASSERT(f1->getMesh()==mesh1);
f1->changeUnderlyingMesh(mesh2,10,1e-12);
void MEDCouplingBasicsTest2::testGetMaxValue1()
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- int nbOfCells=m->getNumberOfCells();
+ std::size_t nbOfCells=m->getNumberOfCells();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME);
f->setMesh(m);
DataArrayDouble *a1=DataArrayDouble::New();
CPPUNIT_ASSERT_EQUAL(2,(int)f1->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(20,(int)f1->getNumberOfValues());
//
- const int renum[]={0,2,3,1,4,5,6,8,7,9};
+ const mcIdType renum[]={0,2,3,1,4,5,6,8,7,9};
mesh2->renumberCells(renum,false);
//
MEDCouplingFieldDouble *f2=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
array->decrRef();
//
f1->checkConsistencyLight();
- DataArrayInt *da=f1->findIdsInRange(2.9,7.1);
- CPPUNIT_ASSERT_EQUAL((std::size_t)5,da->getNbOfElems());
- const int expected1[5]={2,3,5,7,9};
+ DataArrayIdType *da=f1->findIdsInRange(2.9,7.1);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),da->getNbOfElems());
+ const mcIdType expected1[5]={2,3,5,7,9};
CPPUNIT_ASSERT(std::equal(expected1,expected1+5,da->getConstPointer()));
da->decrRef();
da=f1->findIdsInRange(8.,12.);
- CPPUNIT_ASSERT_EQUAL((std::size_t)4,da->getNbOfElems());
- const int expected2[4]={1,4,6,8};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(4),da->getNbOfElems());
+ const mcIdType expected2[4]={1,4,6,8};
CPPUNIT_ASSERT(std::equal(expected2,expected2+4,da->getConstPointer()));
da->decrRef();
//
f1->setArray(array);
array->decrRef();
//
- const int part1[3]={2,1,4};
+ const mcIdType part1[3]={2,1,4};
MEDCouplingFieldDouble *f2=f1->buildSubPart(part1,part1+3);
f2->zipCoords();
CPPUNIT_ASSERT_EQUAL(3,(int)f2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
MEDCouplingUMesh *m2C=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
- CPPUNIT_ASSERT_EQUAL(13,m2C->getNodalConnectivityArrayLen());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(13),m2C->getNodalConnectivityArrayLen());
const double expected2[12]={0.2, -0.3, 0.7, -0.3, 0.2, 0.2, 0.7, 0.2, 0.2, 0.7, 0.7, 0.7};
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12);
std::copy(arr2,arr2+18,array->getPointer());
f1->setArray(array);
array->decrRef();
- const int part2[2]={1,2};
+ const mcIdType part2[2]={1,2};
f2=f1->buildSubPart(part2,part2+2);
CPPUNIT_ASSERT_EQUAL(4,(int)f2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)f2->getNumberOfComponents());
for(int i=0;i<8;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(f2->getIJ(0,i),expected5[i],1e-12);
CPPUNIT_ASSERT_EQUAL(2,(int)f2->getMesh()->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(4,f2->getMesh()->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(4,(int)f2->getMesh()->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
m2C=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
- CPPUNIT_ASSERT_EQUAL(8,m2C->getNodalConnectivityArrayLen());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(8),m2C->getNodalConnectivityArrayLen());
for(int i=0;i<8;i++)//8 is not an error
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12);
CPPUNIT_ASSERT(std::equal(expected3,expected3+4,m2C->getNodalConnectivity()->getConstPointer()+4));
CPPUNIT_ASSERT(std::equal(expected4,expected4+3,m2C->getNodalConnectivityIndex()->getConstPointer()));
f2->decrRef();
//idem previous because nodes of cell#4 are not fully present in part3
- const int part3[2]={1,2};
- DataArrayInt *arrr=DataArrayInt::New();
+ const mcIdType part3[2]={1,2};
+ DataArrayIdType *arrr=DataArrayIdType::New();
arrr->alloc(2,1);
std::copy(part3,part3+2,arrr->getPointer());
f2=f1->buildSubPart(arrr);
for(int i=0;i<8;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(f2->getIJ(0,i),expected5[i],1e-12);
CPPUNIT_ASSERT_EQUAL(2,(int)f2->getMesh()->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(4,f2->getMesh()->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(4,(int)f2->getMesh()->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
m2C=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
- CPPUNIT_ASSERT_EQUAL(8,m2C->getNodalConnectivityArrayLen());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(8),m2C->getNodalConnectivityArrayLen());
for(int i=0;i<8;i++)//8 is not an error
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12);
CPPUNIT_ASSERT(std::equal(expected3,expected3+4,m2C->getNodalConnectivity()->getConstPointer()+4));
CPPUNIT_ASSERT(std::equal(expected4,expected4+3,m2C->getNodalConnectivityIndex()->getConstPointer()));
f2->decrRef();
//
- const int part4[3]={1,2,4};
+ const mcIdType part4[3]={1,2,4};
f2=f1->buildSubPart(part4,part4+3);
CPPUNIT_ASSERT_EQUAL(6,(int)f2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)f2->getNumberOfComponents());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(f2->getIJ(0,i),expected6[i],1e-12);
CPPUNIT_ASSERT_EQUAL(3,(int)f2->getMesh()->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(6,f2->getMesh()->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(6,(int)f2->getMesh()->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
m2C=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
- CPPUNIT_ASSERT_EQUAL(13,m2C->getNodalConnectivityArrayLen());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(13),m2C->getNodalConnectivityArrayLen());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12);
CPPUNIT_ASSERT(std::equal(expected3,expected3+4,m2C->getNodalConnectivity()->getConstPointer()+4));
CPPUNIT_ASSERT_DOUBLES_EQUAL(5.6,f2->getIJ(i,0),1e-13);
f2->decrRef();
//
- DataArrayInt *d2I=0;
+ DataArrayIdType *d2I=0;
DataArrayDouble *d2=array->maxPerTupleWithCompoId(d2I);
CPPUNIT_ASSERT_EQUAL(1,(int)d2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(5,(int)d2->getNumberOfTuples());
- const int expected2[5]={4,3,2,0,1};
+ const mcIdType expected2[5]={4,3,2,0,1};
for(int i=0;i<5;i++)
{
CPPUNIT_ASSERT_DOUBLES_EQUAL(5.6,d2->getIJ(i,0),1e-13);
{
MEDCouplingUMesh *mesh1=build2DTargetMesh_1();
MEDCouplingUMesh *mesh2=build2DTargetMesh_1();
- DataArrayInt *da1,*da2;
+ DataArrayIdType *da1,*da2;
//
CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-12));
CPPUNIT_ASSERT(mesh1->isEqualWithoutConsideringStr(mesh2,1e-12));
mesh2->getCoords()->setIJ(0,3,tmp);
CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-12));
CPPUNIT_ASSERT(mesh1->isEqualWithoutConsideringStr(mesh2,1e-12));
- int tmp2=mesh2->getNodalConnectivity()->getIJ(0,4);
+ mcIdType tmp2=mesh2->getNodalConnectivity()->getIJ(0,4);
mesh2->getNodalConnectivity()->setIJ(0,4,0);
CPPUNIT_ASSERT(!mesh1->isEqual(mesh2,1e-12));
CPPUNIT_ASSERT(!mesh1->isEqualWithoutConsideringStr(mesh2,1e-12));
void MEDCouplingBasicsTest2::testGetNodeIdsOfCell1()
{
MEDCouplingUMesh *mesh1=build2DTargetMesh_1();
- std::vector<int> nodeIds;
+ std::vector<mcIdType> nodeIds;
mesh1->getNodeIdsOfCell(1,nodeIds);
CPPUNIT_ASSERT_EQUAL(3,(int)nodeIds.size());
- CPPUNIT_ASSERT_EQUAL(1,nodeIds[0]);
- CPPUNIT_ASSERT_EQUAL(4,nodeIds[1]);
- CPPUNIT_ASSERT_EQUAL(2,nodeIds[2]);
+ CPPUNIT_ASSERT_EQUAL(1,(int)nodeIds[0]);
+ CPPUNIT_ASSERT_EQUAL(4,(int)nodeIds[1]);
+ CPPUNIT_ASSERT_EQUAL(2,(int)nodeIds[2]);
std::vector<double> coords;
mesh1->getCoordinatesOfNode(4,coords);
CPPUNIT_ASSERT_EQUAL(2,(int)coords.size());
mesh->setCoords(coo);
coo->decrRef();
//
- int tmpConn[8]={0,1,2,3,4,5,6,7};
+ mcIdType tmpConn[8]={0,1,2,3,4,5,6,7};
mesh->allocateCells(3);
mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,tmpConn);
std::transform(tmpConn,tmpConn+8,tmpConn,std::bind2nd(std::plus<int>(),8));
mesh->finishInsertingCells();
mesh->checkConsistencyLight();
bool isMerged;
- int newNebOfNodes;
- DataArrayInt *da=mesh->mergeNodes(1e-7,isMerged,newNebOfNodes);
+ mcIdType newNebOfNodes;
+ DataArrayIdType *da=mesh->mergeNodes(1e-7,isMerged,newNebOfNodes);
da->decrRef();
- CPPUNIT_ASSERT_EQUAL(12,newNebOfNodes);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(12),newNebOfNodes);
MEDCouplingFieldDouble *vols=mesh->getMeasureField(true);
CPPUNIT_ASSERT_EQUAL(3,(int)vols->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)vols->getNumberOfComponents());
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDCouplingGaussLocalization.hxx"
#include <cmath>
m->setCoordsAt(0,da);
da->decrRef();
m->checkConsistencyLight();
- CPPUNIT_ASSERT_EQUAL(4,m->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(4,(int)m->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)m->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(1,m->getSpaceDimension());
MEDCouplingFieldDouble *f=m->getMeasureField(true);
m->setCoordsAt(1,da);
da->decrRef();
m->checkConsistencyLight();
- CPPUNIT_ASSERT_EQUAL(12,m->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(12,(int)m->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(6,(int)m->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(2,m->getSpaceDimension());
f=m->getMeasureField(true);
m->setCoordsAt(2,da);
da->decrRef();
m->checkConsistencyLight();
- CPPUNIT_ASSERT_EQUAL(60,m->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(60,(int)m->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(24,(int)m->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(3,m->getSpaceDimension());
f=m->getMeasureField(true);
{
MEDCouplingUMesh *m1=build2DTargetMesh_1();
MEDCouplingUMesh *m2=build2DTargetMesh_1();
- const int cells1[3]={2,3,4};
+ const mcIdType cells1[3]={2,3,4};
MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true);
MEDCouplingUMesh *m3=dynamic_cast<MEDCouplingUMesh *>(m3_1);
CPPUNIT_ASSERT(m3);
m5->decrRef();
//
CPPUNIT_ASSERT_EQUAL(10,(int)m6->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(22,m6->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(22,(int)m6->getNumberOfNodes());
bool areNodesMerged;
- int newNbOfNodes;
- DataArrayInt *arr=m6->mergeNodes(1e-13,areNodesMerged,newNbOfNodes);
- CPPUNIT_ASSERT_EQUAL(9,m6->getNumberOfNodes());
+ mcIdType newNbOfNodes;
+ DataArrayIdType *arr=m6->mergeNodes(1e-13,areNodesMerged,newNbOfNodes);
+ CPPUNIT_ASSERT_EQUAL(9,(int)m6->getNumberOfNodes());
arr->decrRef();
MEDCouplingFieldDouble *f=m6->fillFromAnalytic(ON_CELLS,2,"x");
MEDCouplingFieldDouble *f2=m6->fillFromAnalytic(ON_NODES,2,"x");
const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
std::copy(arr1,arr1+14,a->getPointer());
//
- const int arr2[7]={3,1,0,6,5,4,2};
+ const mcIdType arr2[7]={3,1,0,6,5,4,2};
DataArrayDouble *b=a->renumber(arr2);
CPPUNIT_ASSERT_EQUAL(7,(int)b->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)b->getNumberOfComponents());
b->decrRef();
a->decrRef();
//
- DataArrayInt *c=DataArrayInt::New();
+ DataArrayIdType *c=DataArrayIdType::New();
c->alloc(7,2);
c->setInfoOnComponent(0,"toto");
c->setInfoOnComponent(1,"tata");
- const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ const mcIdType arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
std::copy(arr3,arr3+14,c->getPointer());
- DataArrayInt *d=c->renumber(arr2);
+ DataArrayIdType *d=c->renumber(arr2);
CPPUNIT_ASSERT_EQUAL(7,(int)d->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)d->getNumberOfComponents());
CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
- const int expected2[14]={3, 13, 2, 12, 7, 17, 1, 11, 6, 16, 5, 15, 4, 14};
+ const mcIdType expected2[14]={3, 13, 2, 12, 7, 17, 1, 11, 6, 16, 5, 15, 4, 14};
for(int i=0;i<14;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
c->decrRef();
const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
std::copy(arr1,arr1+14,a->getPointer());
//
- const int arr2[7]={2,-1,1,-1,0,4,3};
+ const mcIdType arr2[7]={2,-1,1,-1,0,4,3};
DataArrayDouble *b=a->renumberAndReduce(arr2,5);
CPPUNIT_ASSERT_EQUAL(5,(int)b->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)b->getNumberOfComponents());
b->decrRef();
a->decrRef();
//
- DataArrayInt *c=DataArrayInt::New();
+ DataArrayIdType *c=DataArrayIdType::New();
c->alloc(7,2);
c->setInfoOnComponent(0,"toto");
c->setInfoOnComponent(1,"tata");
- const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ const mcIdType arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
std::copy(arr3,arr3+14,c->getPointer());
- DataArrayInt *d=c->renumberAndReduce(arr2,5);
+ DataArrayIdType *d=c->renumberAndReduce(arr2,5);
CPPUNIT_ASSERT_EQUAL(5,(int)d->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)d->getNumberOfComponents());
CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
- const int expected2[10]={5,15,3,13,1,11,7,17,6,16};
+ const mcIdType expected2[10]={5,15,3,13,1,11,7,17,6,16};
for(int i=0;i<10;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
c->decrRef();
const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
std::copy(arr1,arr1+14,a->getPointer());
//
- const int arr2[7]={3,1,0,6,5,4,2};
+ const mcIdType arr2[7]={3,1,0,6,5,4,2};
a->renumberInPlace(arr2);
CPPUNIT_ASSERT_EQUAL(7,(int)a->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)a->getNumberOfComponents());
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a->getIJ(0,i),1e-14);
a->decrRef();
//
- DataArrayInt *c=DataArrayInt::New();
+ DataArrayIdType *c=DataArrayIdType::New();
c->alloc(7,2);
- const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ const mcIdType arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
std::copy(arr3,arr3+14,c->getPointer());
c->renumberInPlace(arr2);
CPPUNIT_ASSERT_EQUAL(7,(int)c->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)c->getNumberOfComponents());
- const int expected2[14]={3, 13, 2, 12, 7, 17, 1, 11, 6, 16, 5, 15, 4, 14};
+ const mcIdType expected2[14]={3, 13, 2, 12, 7, 17, 1, 11, 6, 16, 5, 15, 4, 14};
for(int i=0;i<14;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],c->getIJ(0,i));
c->decrRef();
const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
std::copy(arr1,arr1+14,a->getPointer());
//
- const int arr2[7]={3,1,0,6,5,4,2};
+ const mcIdType arr2[7]={3,1,0,6,5,4,2};
DataArrayDouble *b=a->renumberR(arr2);
CPPUNIT_ASSERT_EQUAL(7,(int)b->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)b->getNumberOfComponents());
b->decrRef();
a->decrRef();
//
- DataArrayInt *c=DataArrayInt::New();
+ DataArrayIdType *c=DataArrayIdType::New();
c->alloc(7,2);
c->setInfoOnComponent(0,"toto");
c->setInfoOnComponent(1,"tata");
- const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ const mcIdType arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
std::copy(arr3,arr3+14,c->getPointer());
- DataArrayInt *d=c->renumberR(arr2);
+ DataArrayIdType *d=c->renumberR(arr2);
CPPUNIT_ASSERT_EQUAL(7,(int)d->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)d->getNumberOfComponents());
CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
- const int expected2[14]={4, 14, 2, 12, 1, 11, 7, 17, 6, 16, 5, 15, 3, 13};
+ const mcIdType expected2[14]={4, 14, 2, 12, 1, 11, 7, 17, 6, 16, 5, 15, 3, 13};
for(int i=0;i<14;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
c->decrRef();
const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
std::copy(arr1,arr1+14,a->getPointer());
//
- const int arr2[7]={3,1,0,6,5,4,2};
+ const mcIdType arr2[7]={3,1,0,6,5,4,2};
a->renumberInPlaceR(arr2);
CPPUNIT_ASSERT_EQUAL(7,(int)a->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)a->getNumberOfComponents());
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a->getIJ(0,i),1e-14);
a->decrRef();
//
- DataArrayInt *c=DataArrayInt::New();
+ DataArrayIdType *c=DataArrayIdType::New();
c->alloc(7,2);
- const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ const mcIdType arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
std::copy(arr3,arr3+14,c->getPointer());
c->renumberInPlaceR(arr2);
CPPUNIT_ASSERT_EQUAL(7,(int)c->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)c->getNumberOfComponents());
- const int expected2[14]={4, 14, 2, 12, 1, 11, 7, 17, 6, 16, 5, 15, 3, 13};
+ const mcIdType expected2[14]={4, 14, 2, 12, 1, 11, 7, 17, 6, 16, 5, 15, 3, 13};
for(int i=0;i<14;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],c->getIJ(0,i));
c->decrRef();
const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
std::copy(arr1,arr1+14,a->getPointer());
//
- const int arr2[7]={4,2,0,6,5};
+ const mcIdType arr2[7]={4,2,0,6,5};
DataArrayDouble *b=a->selectByTupleId(arr2,arr2+5);
CPPUNIT_ASSERT_EQUAL(5,(int)b->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)b->getNumberOfComponents());
b->decrRef();
a->decrRef();
//
- DataArrayInt *c=DataArrayInt::New();
+ DataArrayIdType *c=DataArrayIdType::New();
c->alloc(7,2);
c->setInfoOnComponent(0,"toto");
c->setInfoOnComponent(1,"tata");
- const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ const mcIdType arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
std::copy(arr3,arr3+14,c->getPointer());
- DataArrayInt *d=c->selectByTupleId(arr2,arr2+5);
+ DataArrayIdType *d=c->selectByTupleId(arr2,arr2+5);
CPPUNIT_ASSERT_EQUAL(5,(int)d->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)d->getNumberOfComponents());
CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
- const int expected2[10]={5,15,3,13,1,11,7,17,6,16};
+ const mcIdType expected2[10]={5,15,3,13,1,11,7,17,6,16};
for(int i=0;i<10;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
c->decrRef();
a->alloc(9,1);
const double arr1[9]={2.34,4.56,-6.77,4.55,4.56,2.24,2.34,1.02,4.56};
std::copy(arr1,arr1+9,a->getPointer());
- int where;
+ mcIdType where;
double m=a->getMaxValue(where);
- CPPUNIT_ASSERT_EQUAL(1,where);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),where);
CPPUNIT_ASSERT_DOUBLES_EQUAL(4.56,m,1e-12);
- DataArrayInt *ws;
+ DataArrayIdType *ws;
m=a->getMaxValue2(ws);
CPPUNIT_ASSERT_DOUBLES_EQUAL(4.56,m,1e-12);
CPPUNIT_ASSERT_EQUAL(3,(int)ws->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)ws->getNumberOfComponents());
- const int expected1[3]={1,4,8};
+ const mcIdType expected1[3]={1,4,8};
for(int i=0;i<3;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],ws->getIJ(i,0));
ws->decrRef();
std::copy(arr2,arr2+9,a->getPointer());
where=-2;
m=a->getMinValue(where);
- CPPUNIT_ASSERT_EQUAL(1,where);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),where);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-4.56,m,1e-12);
m=a->getMinValue2(ws);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-4.56,m,1e-12);
f->checkConsistencyLight();
double m=f->getMaxValue();
CPPUNIT_ASSERT_DOUBLES_EQUAL(8.71,m,1e-12);
- DataArrayInt *ws;
+ DataArrayIdType *ws;
m=f->getMaxValue2(ws);
CPPUNIT_ASSERT_DOUBLES_EQUAL(8.71,m,1e-12);
CPPUNIT_ASSERT_EQUAL(4,(int)ws->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)ws->getNumberOfComponents());
- const int expected1[4]={0,3,7,17};
+ const mcIdType expected1[4]={0,3,7,17};
for(int i=0;i<4;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],ws->getIJ(i,0));
ws->decrRef();
da->decrRef();
m->checkConsistencyLight();
double pos=2.4;
- CPPUNIT_ASSERT_EQUAL(0,m->getCellContainingPoint(&pos,1e-12));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),m->getCellContainingPoint(&pos,1e-12));
pos=3.7;
- CPPUNIT_ASSERT_EQUAL(1,m->getCellContainingPoint(&pos,1e-12));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),m->getCellContainingPoint(&pos,1e-12));
pos=5.9;
- CPPUNIT_ASSERT_EQUAL(2,m->getCellContainingPoint(&pos,1e-12));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),m->getCellContainingPoint(&pos,1e-12));
pos=10.3;
- CPPUNIT_ASSERT_EQUAL(-1,m->getCellContainingPoint(&pos,1e-12));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(-1),m->getCellContainingPoint(&pos,1e-12));
pos=1.3;
- CPPUNIT_ASSERT_EQUAL(-1,m->getCellContainingPoint(&pos,1e-12));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(-1),m->getCellContainingPoint(&pos,1e-12));
//
MEDCouplingUMesh *m2=m->buildUnstructured();
m2->checkConsistencyLight();
f2->decrRef();
//
double pos1[3]={5.,30.,2.};
- CPPUNIT_ASSERT_EQUAL(16,m->getCellContainingPoint(pos1,1e-12));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(16),m->getCellContainingPoint(pos1,1e-12));
//
const double pt[3]={2.4,12.7,-3.4};
m->scale(pt,3.7);
void MEDCouplingBasicsTest3::testDataArrayIntInvertO2NNO21()
{
- const int arr1[6]={2,0,4,1,5,3};
- DataArrayInt *da=DataArrayInt::New();
+ const mcIdType arr1[6]={2,0,4,1,5,3};
+ DataArrayIdType *da=DataArrayIdType::New();
da->alloc(6,1);
std::copy(arr1,arr1+6,da->getPointer());
- DataArrayInt *da2=da->invertArrayO2N2N2O(6);
+ DataArrayIdType *da2=da->invertArrayO2N2N2O(6);
CPPUNIT_ASSERT_EQUAL(6,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
- const int expected1[6]={1,3,0,5,2,4};
+ const mcIdType expected1[6]={1,3,0,5,2,4};
for(int i=0;i<6;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(i,0));
- DataArrayInt *da3=da2->invertArrayN2O2O2N(6);
+ DataArrayIdType *da3=da2->invertArrayN2O2O2N(6);
for(int i=0;i<6;i++)
CPPUNIT_ASSERT_EQUAL(arr1[i],da3->getIJ(i,0));
da3->decrRef();
da2->decrRef();
da->decrRef();
//
- const int arr2[10]={3,-1,5,4,-1,0,-1,1,2,-1};
- da=DataArrayInt::New();
+ const mcIdType arr2[10]={3,-1,5,4,-1,0,-1,1,2,-1};
+ da=DataArrayIdType::New();
da->alloc(10,1);
std::copy(arr2,arr2+10,da->getPointer());
da2=da->invertArrayO2N2N2O(6);
CPPUNIT_ASSERT_EQUAL(6,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
- const int expected2[10]={5,7,8,0,3,2};
+ const mcIdType expected2[10]={5,7,8,0,3,2};
for(int i=0;i<6;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],da2->getIJ(i,0));
da3=da2->invertArrayN2O2O2N(10);
a1->setInfoOnComponent(1,"bbbb");
a1->setInfoOnComponent(2,"cccc");
a1->setInfoOnComponent(3,"dddd");
- const int arr2[6]={1,2,1,2,0,0};
- std::vector<int> arr2V(arr2,arr2+6);
+ const mcIdType arr2[6]={1,2,1,2,0,0};
+ std::vector<std::size_t> arr2V(arr2,arr2+6);
DataArrayDouble *a2=static_cast<DataArrayDouble *>(a1->keepSelectedComponents(arr2V));
CPPUNIT_ASSERT_EQUAL(6,(int)a2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(5,(int)a2->getNumberOfTuples());
CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(4))=="aaaa");
CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(5))=="aaaa");
for(int i=0;i<30;i++)
- CPPUNIT_ASSERT_EQUAL(int(expected1[i]),a4->getIJ(0,i));
+ CPPUNIT_ASSERT_EQUAL((int)expected1[i],a4->getIJ(0,i));
// setSelectedComponents
- const int arr3[2]={3,2};
- std::vector<int> arr3V(arr3,arr3+2);
+ const mcIdType arr3[2]={3,2};
+ std::vector<std::size_t> arr3V(arr3,arr3+2);
DataArrayDouble *a5=static_cast<DataArrayDouble *>(a1->keepSelectedComponents(arr3V));
a5->setInfoOnComponent(0,"eeee");
a5->setInfoOnComponent(1,"ffff");
- const int arr4[2]={1,2};
- std::vector<int> arr4V(arr4,arr4+2);
+ const mcIdType arr4[2]={1,2};
+ std::vector<std::size_t> arr4V(arr4,arr4+2);
a2->setSelectedComponents(a5,arr4V);
CPPUNIT_ASSERT_EQUAL(6,(int)a2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(5,(int)a2->getNumberOfTuples());
CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(4))=="aaaa");
CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(5))=="aaaa");
for(int i=0;i<30;i++)
- CPPUNIT_ASSERT_EQUAL(int(expected2[i]),a4->getIJ(0,i));
+ CPPUNIT_ASSERT_EQUAL(expected2[i],(double)a4->getIJ(0,i));
// test of throw
- const int arr5[3]={2,3,6};
- const int arr6[3]={2,7,5};
- const int arr7[4]={2,1,4,6};
- std::vector<int> arr5V(arr5,arr5+3);
- std::vector<int> arr6V(arr6,arr6+3);
- std::vector<int> arr7V(arr7,arr7+4);
+ const mcIdType arr5[3]={2,3,6};
+ const mcIdType arr6[3]={2,7,5};
+ const mcIdType arr7[4]={2,1,4,6};
+ std::vector<std::size_t> arr5V(arr5,arr5+3);
+ std::vector<std::size_t> arr6V(arr6,arr6+3);
+ std::vector<std::size_t> arr7V(arr7,arr7+4);
CPPUNIT_ASSERT_THROW(a2->keepSelectedComponents(arr5V),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(a2->keepSelectedComponents(arr6V),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(a2->setSelectedComponents(a1,arr7V),INTERP_KERNEL::Exception);
f1->setArray(a1);
f1->checkConsistencyLight();
//
- const int arr2[6]={1,2,1,2,0,0};
- std::vector<int> arr2V(arr2,arr2+6);
+ const mcIdType arr2[6]={1,2,1,2,0,0};
+ std::vector<std::size_t> arr2V(arr2,arr2+6);
MEDCouplingFieldDouble *f2=f1->keepSelectedComponents(arr2V);
CPPUNIT_ASSERT(f2->getMesh()==f1->getMesh());
CPPUNIT_ASSERT(f2->getTimeDiscretization()==ONE_TIME);
for(int i=0;i<30;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f2->getIJ(0,i),1e-14);
//setSelectedComponents
- const int arr3[2]={3,2};
- std::vector<int> arr3V(arr3,arr3+2);
+ const mcIdType arr3[2]={3,2};
+ std::vector<std::size_t> arr3V(arr3,arr3+2);
MEDCouplingFieldDouble *f5=f1->keepSelectedComponents(arr3V);
f5->setTime(6.7,8,9);
f5->getArray()->setInfoOnComponent(0,"eeee");
f5->getArray()->setInfoOnComponent(1,"ffff");
f5->checkConsistencyLight();
- const int arr4[2]={1,2};
- std::vector<int> arr4V(arr4,arr4+2);
+ const mcIdType arr4[2]={1,2};
+ std::vector<std::size_t> arr4V(arr4,arr4+2);
f2->setSelectedComponents(f5,arr4V);
CPPUNIT_ASSERT_EQUAL(6,(int)f2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
void MEDCouplingBasicsTest3::testElementaryDAThrowAndSpecialCases()
{
- DataArrayInt *da=DataArrayInt::New();
+ DataArrayIdType *da=DataArrayIdType::New();
CPPUNIT_ASSERT_THROW(da->checkAllocated(),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(da->fillWithValue(1),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(da->iota(1),INTERP_KERNEL::Exception);
da->fillWithValue(11); //11,11,11,11...
da->iota(10); //10,11,12,13...
- DataArrayInt *db=DataArrayInt::New();
+ DataArrayIdType *db=DataArrayIdType::New();
db->alloc(7,2);
DataArrayDouble *dbl2=DataArrayDouble::New();
CPPUNIT_ASSERT(!dbl->isMonotonic(false, 1.1));
CPPUNIT_ASSERT(!dbl->isMonotonic(false, -1.1));
- DataArrayInt *dc=DataArrayInt::New();
+ DataArrayIdType *dc=DataArrayIdType::New();
dc->alloc(14,1);
DataArrayDouble *dd=DataArrayDouble::New();
CPPUNIT_ASSERT_THROW(db->copyStringInfoFrom(*da),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(db->copyStringInfoFrom(*da),INTERP_KERNEL::Exception);
- std::vector<int> cIds(2,2);
+ std::vector<std::size_t> cIds(2,2);
CPPUNIT_ASSERT_THROW(da->copyPartOfStringInfoFrom(*db,cIds),INTERP_KERNEL::Exception);
cIds[0]=1;
cIds[0]=-1;
CPPUNIT_ASSERT_THROW(db->GetNumberOfItemGivenBES(10,9,1,"theMessageInThrow"),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(db->GetNumberOfItemGivenBES(0,1,-1,"theMessageInThrow"),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_EQUAL(10,db->GetNumberOfItemGivenBES(0,10,1,"theMessageInThrow"));
- CPPUNIT_ASSERT_EQUAL(5,db->GetNumberOfItemGivenBES(0,10,2,"theMessageInThrow"));
- CPPUNIT_ASSERT_EQUAL(6,db->GetNumberOfItemGivenBES(0,11,2,"theMessageInThrow"));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(10),db->GetNumberOfItemGivenBES(0,10,1,"theMessageInThrow"));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),db->GetNumberOfItemGivenBES(0,10,2,"theMessageInThrow"));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(6),db->GetNumberOfItemGivenBES(0,11,2,"theMessageInThrow"));
//std::cout<<"\n!!!!!!!!!\n"<<dd->repr()<<"\n!!!!!!!!!\n";
CPPUNIT_ASSERT(!((da->repr().find("Number of components : 1"))==std::string::npos));
CPPUNIT_ASSERT_THROW(dbl->meldWith(dd),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(dbl->setPartOfValuesAdv(dbl2,da),INTERP_KERNEL::Exception); //dbl dbl2 not have the same number of components
- CPPUNIT_ASSERT_THROW(dbl->setPartOfValuesAdv(dd,da),INTERP_KERNEL::Exception); //da tuple selector DataArrayInt instance not have exactly 2 components
+ CPPUNIT_ASSERT_THROW(dbl->setPartOfValuesAdv(dd,da),INTERP_KERNEL::Exception); //da tuple selector DataArrayIdType instance not have exactly 2 components
DataArrayDouble *dbl3=DataArrayDouble::New();
dbl3->alloc(6,2);
dbl3->fillWithValue(11.);
- int tupleId;
+ mcIdType tupleId;
//bad number of components
CPPUNIT_ASSERT_THROW(dbl3->getMaxValue(tupleId),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(dd->getMaxValue(tupleId),INTERP_KERNEL::Exception);
void MEDCouplingBasicsTest3::testDAIGetIdsEqual1()
{
- const int tab1[7]={5,-2,-4,-2,3,2,-2};
- DataArrayInt *da=DataArrayInt::New();
+ const mcIdType tab1[7]={5,-2,-4,-2,3,2,-2};
+ DataArrayIdType *da=DataArrayIdType::New();
da->alloc(7,1);
std::copy(tab1,tab1+7,da->getPointer());
- DataArrayInt *da2=da->findIdsEqual(-2);
+ DataArrayIdType *da2=da->findIdsEqual(-2);
CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
- const int expected1[3]={1,3,6};
+ const mcIdType expected1[3]={1,3,6};
CPPUNIT_ASSERT(std::equal(expected1,expected1+3,da2->getConstPointer()));
da2->decrRef();
da->decrRef();
void MEDCouplingBasicsTest3::testDAIGetIdsEqualList1()
{
- const int tab1[7]={5,-2,-4,-2,3,2,-2};
- DataArrayInt *da=DataArrayInt::New();
+ const mcIdType tab1[7]={5,-2,-4,-2,3,2,-2};
+ DataArrayIdType *da=DataArrayIdType::New();
da->alloc(7,1);
std::copy(tab1,tab1+7,da->getPointer());
- const int tab2[3]={3,-2,0};
- std::vector<int> tab2V(tab2,tab2+3);
- DataArrayInt *da2=da->findIdsEqualList(&tab2V[0],&tab2V[0]+tab2V.size());
+ const mcIdType tab2[3]={3,-2,0};
+ std::vector<mcIdType> tab2V(tab2,tab2+3);
+ DataArrayIdType *da2=da->findIdsEqualList(&tab2V[0],&tab2V[0]+tab2V.size());
CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
- const int expected1[4]={1,3,4,6};
+ const mcIdType expected1[4]={1,3,4,6};
CPPUNIT_ASSERT(std::equal(expected1,expected1+4,da2->getConstPointer()));
da2->decrRef();
da->decrRef();
void MEDCouplingBasicsTest3::testDAFromNoInterlace1()
{
- const int tab1[15]={1,11,21,31,41,2,12,22,32,42,3,13,23,33,43};
- DataArrayInt *da=DataArrayInt::New();
+ const mcIdType tab1[15]={1,11,21,31,41,2,12,22,32,42,3,13,23,33,43};
+ DataArrayIdType *da=DataArrayIdType::New();
da->alloc(5,3);
std::copy(tab1,tab1+15,da->getPointer());
- DataArrayInt *da2=da->fromNoInterlace();
- const int expected1[15]={1,2,3,11,12,13,21,22,23,31,32,33,41,42,43};
+ DataArrayIdType *da2=da->fromNoInterlace();
+ const mcIdType expected1[15]={1,2,3,11,12,13,21,22,23,31,32,33,41,42,43};
CPPUNIT_ASSERT_EQUAL(5,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components !
CPPUNIT_ASSERT(std::equal(expected1,expected1+15,da2->getConstPointer()));
void MEDCouplingBasicsTest3::testDAToNoInterlace1()
{
- const int tab1[15]={1,2,3,11,12,13,21,22,23,31,32,33,41,42,43};
- DataArrayInt *da=DataArrayInt::New();
+ const mcIdType tab1[15]={1,2,3,11,12,13,21,22,23,31,32,33,41,42,43};
+ DataArrayIdType *da=DataArrayIdType::New();
da->alloc(5,3);
std::copy(tab1,tab1+15,da->getPointer());
- DataArrayInt *da2=da->toNoInterlace();
- const int expected1[15]={1,11,21,31,41,2,12,22,32,42,3,13,23,33,43};
+ DataArrayIdType *da2=da->toNoInterlace();
+ const mcIdType expected1[15]={1,11,21,31,41,2,12,22,32,42,3,13,23,33,43};
CPPUNIT_ASSERT_EQUAL(5,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components !
CPPUNIT_ASSERT(std::equal(expected1,expected1+15,da2->getConstPointer()));
void MEDCouplingBasicsTest3::testDAIsUniform1()
{
- const int tab1[5]={1,1,1,1,1};
- DataArrayInt *da=DataArrayInt::New();
+ const mcIdType tab1[5]={1,1,1,1,1};
+ DataArrayIdType *da=DataArrayIdType::New();
da->alloc(5,1);
std::copy(tab1,tab1+5,da->getPointer());
CPPUNIT_ASSERT(da->isUniform(1));
void MEDCouplingBasicsTest3::testUnPolyze1()
{
- const int elts[8]={0,1,2,3,4,5,6,7};
- std::vector<int> eltsV(elts,elts+8);
+ const mcIdType elts[8]={0,1,2,3,4,5,6,7};
+ std::vector<mcIdType> eltsV(elts,elts+8);
MEDCouplingUMesh *mesh=build3DTargetMesh_1();
mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size());
mesh->unPolyze();
void MEDCouplingBasicsTest3::testConvertDegeneratedCells1()
{
MEDCouplingUMesh *mesh=build3DTargetMesh_1();
- int conn[32]={0,1,3,3,9,10,12,12, 0,1,3,4,9,9,9,9, 1,1,1,1,10,12,9,10, 10,11,12,9,1,1,1,1};
+ mcIdType conn[32]={0,1,3,3,9,10,12,12, 0,1,3,4,9,9,9,9, 1,1,1,1,10,12,9,10, 10,11,12,9,1,1,1,1};
mesh->allocateCells(4);
mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn);
mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+8);
mesh->setCoords(tmp2);
tmp2->decrRef();
const double pts[6]={0.2,0.2,0.1,0.3,-0.3,0.7};
- DataArrayInt *c=mesh->getNodeIdsNearPoint(pts,1e-7);
+ DataArrayIdType *c=mesh->getNodeIdsNearPoint(pts,1e-7);
CPPUNIT_ASSERT_EQUAL(3,(int)c->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(4,c->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(9,c->getIJ(1,0));
- CPPUNIT_ASSERT_EQUAL(11,c->getIJ(2,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(4),c->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(9),c->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(11),c->getIJ(2,0));
c->decrRef();
- DataArrayInt *cI=0;
+ DataArrayIdType *cI=0;
mesh->getNodeIdsNearPoints(pts,3,1e-7,c,cI);
- CPPUNIT_ASSERT_EQUAL(4,(int)cI->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(4,(int)c->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(4,c->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(9,c->getIJ(1,0));
- CPPUNIT_ASSERT_EQUAL(11,c->getIJ(2,0));
- CPPUNIT_ASSERT_EQUAL(6,c->getIJ(3,0));
- CPPUNIT_ASSERT_EQUAL(0,cI->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(3,cI->getIJ(1,0));
- CPPUNIT_ASSERT_EQUAL(3,cI->getIJ(2,0));
- CPPUNIT_ASSERT_EQUAL(4,cI->getIJ(3,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(4),cI->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(4),c->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(4),c->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(9),c->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(11),c->getIJ(2,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(6),c->getIJ(3,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),cI->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),cI->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),cI->getIJ(2,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(4),cI->getIJ(3,0));
c->decrRef();
cI->decrRef();
mesh->decrRef();
DataArrayDouble *h=g->fromPolarToCart();
f->setCoords(h);
MEDCouplingUMesh *i=c->buildExtrudedMesh(f,1);
- CPPUNIT_ASSERT_EQUAL(52,i->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(52,(int)i->getNumberOfNodes());
bool tmp2;
- int tmp3;
- DataArrayInt *tmp=i->mergeNodes(1e-9,tmp2,tmp3);
+ mcIdType tmp3;
+ DataArrayIdType *tmp=i->mergeNodes(1e-9,tmp2,tmp3);
CPPUNIT_ASSERT(tmp2);
- CPPUNIT_ASSERT_EQUAL(37,tmp3);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(37),tmp3);
tmp->decrRef();
i->convertDegeneratedCells();
i->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(36,(int)i->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(37,i->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(37,(int)i->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(12,(int)i->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TRI3));
CPPUNIT_ASSERT_EQUAL(24,(int)i->getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4));
const double expected1[3]={0.25,0.75,2.0625};
DataArrayDouble *h=g->fromPolarToCart();
f->setCoords(h);
MEDCouplingUMesh *i=c->buildExtrudedMesh(f,1);
- CPPUNIT_ASSERT_EQUAL(52,i->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(52,(int)i->getNumberOfNodes());
bool tmp2;
- int tmp3;
- DataArrayInt *tmp=i->mergeNodes(1e-9,tmp2,tmp3);
+ mcIdType tmp3;
+ DataArrayIdType *tmp=i->mergeNodes(1e-9,tmp2,tmp3);
CPPUNIT_ASSERT(tmp2);
- CPPUNIT_ASSERT_EQUAL(37,tmp3);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(37),tmp3);
tmp->decrRef();
i->convertDegeneratedCells();
const double vec1[3]={10.,0.,0.};
MEDCouplingFieldDouble *f2=i3->getMeasureField(true);
tmp=i->mergeNodes(1e-9,tmp2,tmp3);
CPPUNIT_ASSERT(tmp2);
- CPPUNIT_ASSERT_EQUAL(444,tmp3);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(444),tmp3);
tmp->decrRef();
const double expected1[36]={1.327751058489274, 4.2942574094314701, 13.024068164857139, 1.3069177251569044, 4.1484240761012954, 12.297505664866796, 1.270833333332571, 3.8958333333309674, 11.039062499993179, 1.2291666666659207, 3.6041666666644425, 9.585937499993932, 1.1930822748415895, 3.3515759238941376, 8.3274943351204556, 1.1722489415082769, 3.2057425905609289, 7.6009318351210622, 1.1722489415082862, 3.2057425905609884, 7.6009318351213713, 1.1930822748416161, 3.3515759238943001, 8.3274943351212727, 1.2291666666659564, 3.6041666666646734, 9.5859374999950777, 1.2708333333326081, 3.8958333333311868, 11.039062499994293, 1.3069177251569224, 4.1484240761014384, 12.297505664867627, 1.3277510584902354, 4.2942574094346071, 13.024068164866796};
int kk=0;
void MEDCouplingBasicsTest3::testSimplexize1()
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- std::vector<int> v(1);
+ std::vector<mcIdType> v(1);
v[0]=3;
m->convertToPolyTypes(&v[0],&v[0]+v.size());
- DataArrayInt *da=m->simplexize(0);
+ DataArrayIdType *da=m->simplexize(0);
CPPUNIT_ASSERT_EQUAL(7,(int)da->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents());
- const int expected2[7]={0,0,1,2,3,4,4};
+ const mcIdType expected2[7]={0,0,1,2,3,4,4};
for(int i=0;i<7;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],da->getIJ(i,0));
m->checkConsistencyLight();
void MEDCouplingBasicsTest3::testSimplexize2()
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- std::vector<int> v(1);
+ std::vector<mcIdType> v(1);
v[0]=3;
m->convertToPolyTypes(&v[0],&v[0]+v.size());
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
CPPUNIT_ASSERT(da4->getInfoOnComponent(4)=="c2da3");
for(int i=0;i<35;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da4->getIJ(0,i),1e-10);
- // test of static method DataArrayInt::meld
+ // test of static method DataArrayIdType::meld
dai1=da1C->convertToIntArr();
DataArrayInt *dai4=DataArrayInt::Meld(dai1,dai3);
CPPUNIT_ASSERT_EQUAL(5,(int)dai4->getNumberOfComponents());
CPPUNIT_ASSERT(dai4->getInfoOnComponent(3)=="c1da3");
CPPUNIT_ASSERT(dai4->getInfoOnComponent(4)=="c2da3");
for(int i=0;i<35;i++)
- CPPUNIT_ASSERT_EQUAL((int)expected1[i],dai4->getIJ(0,i));
+ CPPUNIT_ASSERT_EQUAL(expected1[i],(double)dai4->getIJ(0,i));
//
dai4->decrRef();
da4->decrRef();
tmp[1]=m2;
MEDCouplingUMesh *m3=MEDCouplingUMesh::MergeUMeshes(tmp);
bool b;
- int newNbOfNodes;
- DataArrayInt *da=m3->mergeNodesCenter(0.01,b,newNbOfNodes);
- CPPUNIT_ASSERT_EQUAL(9,m3->getNumberOfNodes());
+ mcIdType newNbOfNodes;
+ DataArrayIdType *da=m3->mergeNodesCenter(0.01,b,newNbOfNodes);
+ CPPUNIT_ASSERT_EQUAL(9,(int)m3->getNumberOfNodes());
const double expected1[18]={-0.299,-0.3, 0.201,-0.3, 0.701,-0.3, -0.299,0.2, 0.201,0.2, 0.701,0.2, -0.299,0.7, 0.201,0.7, 0.701,0.7};
for(int i=0;i<18;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],m3->getCoords()->getIJ(0,i),1e-13);
void MEDCouplingBasicsTest3::testDAIBuildComplement1()
{
- DataArrayInt *a=DataArrayInt::New();
- const int tab[4]={3,1,7,8};
+ DataArrayIdType *a=DataArrayIdType::New();
+ const mcIdType tab[4]={3,1,7,8};
a->alloc(4,1);
std::copy(tab,tab+4,a->getPointer());
- DataArrayInt *b=a->buildComplement(12);
+ DataArrayIdType *b=a->buildComplement(12);
CPPUNIT_ASSERT_EQUAL(8,(int)b->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)b->getNumberOfComponents());
- const int expected1[8]={0,2,4,5,6,9,10,11};
+ const mcIdType expected1[8]={0,2,4,5,6,9,10,11};
for(int i=0;i<8;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i));
b->decrRef();
void MEDCouplingBasicsTest3::testDAIBuildUnion1()
{
- DataArrayInt *a=DataArrayInt::New();
- const int tab1[4]={3,1,7,8};
+ DataArrayIdType *a=DataArrayIdType::New();
+ const mcIdType tab1[4]={3,1,7,8};
a->alloc(4,1);
std::copy(tab1,tab1+4,a->getPointer());
- DataArrayInt *c=DataArrayInt::New();
- const int tab2[5]={5,3,0,18,8};
+ DataArrayIdType *c=DataArrayIdType::New();
+ const mcIdType tab2[5]={5,3,0,18,8};
c->alloc(5,1);
std::copy(tab2,tab2+5,c->getPointer());
- DataArrayInt *b=a->buildUnion(c);
+ DataArrayIdType *b=a->buildUnion(c);
CPPUNIT_ASSERT_EQUAL(7,(int)b->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)b->getNumberOfComponents());
- const int expected1[7]={0,1,3,5,7,8,18};
+ const mcIdType expected1[7]={0,1,3,5,7,8,18};
for(int i=0;i<7;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i));
c->decrRef();
void MEDCouplingBasicsTest3::testDAIBuildIntersection1()
{
- DataArrayInt *a=DataArrayInt::New();
- const int tab1[4]={3,1,7,8};
+ DataArrayIdType *a=DataArrayIdType::New();
+ const mcIdType tab1[4]={3,1,7,8};
a->alloc(4,1);
std::copy(tab1,tab1+4,a->getPointer());
- DataArrayInt *c=DataArrayInt::New();
- const int tab2[5]={5,3,0,18,8};
+ DataArrayIdType *c=DataArrayIdType::New();
+ const mcIdType tab2[5]={5,3,0,18,8};
c->alloc(5,1);
std::copy(tab2,tab2+5,c->getPointer());
- DataArrayInt *b=a->buildIntersection(c);
+ DataArrayIdType *b=a->buildIntersection(c);
CPPUNIT_ASSERT_EQUAL(2,(int)b->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)b->getNumberOfComponents());
- const int expected1[2]={3,8};
+ const mcIdType expected1[2]={3,8};
for(int i=0;i<2;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i));
c->decrRef();
void MEDCouplingBasicsTest3::testDAIDeltaShiftIndex1()
{
- DataArrayInt *a=DataArrayInt::New();
- const int tab[7]={1,3,6,7,7,9,15};
+ DataArrayIdType *a=DataArrayIdType::New();
+ const mcIdType tab[7]={1,3,6,7,7,9,15};
a->alloc(7,1);
std::copy(tab,tab+7,a->getPointer());
- DataArrayInt *b=a->deltaShiftIndex();
+ DataArrayIdType *b=a->deltaShiftIndex();
CPPUNIT_ASSERT_EQUAL(6,(int)b->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)b->getNumberOfComponents());
- const int expected1[6]={2,3,1,0,2,6};
+ const mcIdType expected1[6]={2,3,1,0,2,6};
for(int i=0;i<6;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i));
b->decrRef();
const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
std::copy(arr1,arr1+14,a->getPointer());
//
- const int arr2[7]={4,2,0,6,5};
+ const mcIdType arr2[7]={4,2,0,6,5};
DataArrayDouble *b=a->selectByTupleIdSafe(arr2,arr2+5);
CPPUNIT_ASSERT_EQUAL(5,(int)b->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)b->getNumberOfComponents());
const double expected1[10]={5.1,15.1,3.1,13.1,1.1,11.1,7.1,17.1,6.1,16.1};
for(int i=0;i<10;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14);
- const int arr4[5]={4,-1,0,6,5};
+ const mcIdType arr4[5]={4,-1,0,6,5};
CPPUNIT_ASSERT_THROW(a->selectByTupleIdSafe(arr4,arr4+5),INTERP_KERNEL::Exception);
- const int arr5[5]={4,2,0,6,7};
+ const mcIdType arr5[5]={4,2,0,6,7};
CPPUNIT_ASSERT_THROW(a->selectByTupleIdSafe(arr5,arr5+5),INTERP_KERNEL::Exception);
b->decrRef();
a->decrRef();
//
- DataArrayInt *c=DataArrayInt::New();
+ DataArrayIdType *c=DataArrayIdType::New();
c->alloc(7,2);
c->setInfoOnComponent(0,"toto");
c->setInfoOnComponent(1,"tata");
- const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ const mcIdType arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
std::copy(arr3,arr3+14,c->getPointer());
- DataArrayInt *d=c->selectByTupleIdSafe(arr2,arr2+5);
+ DataArrayIdType *d=c->selectByTupleIdSafe(arr2,arr2+5);
CPPUNIT_ASSERT_EQUAL(5,(int)d->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)d->getNumberOfComponents());
CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
- const int expected2[10]={5,15,3,13,1,11,7,17,6,16};
+ const mcIdType expected2[10]={5,15,3,13,1,11,7,17,6,16};
for(int i=0;i<10;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
CPPUNIT_ASSERT_THROW(c->selectByTupleIdSafe(arr4,arr4+5),INTERP_KERNEL::Exception);
void MEDCouplingBasicsTest3::testAreCellsIncludedIn1()
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- const int pt[2]={1,3};
+ const mcIdType pt[2]={1,3};
MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->buildPartOfMySelf(pt,pt+2,true);
- DataArrayInt *tmp;
+ DataArrayIdType *tmp;
CPPUNIT_ASSERT(m->areCellsIncludedIn(m2,0,tmp));
CPPUNIT_ASSERT_EQUAL(2,(int)tmp->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)tmp->getNumberOfComponents());
void MEDCouplingBasicsTest3::testDAIBuildSubstraction1()
{
- DataArrayInt *a=DataArrayInt::New();
- const int aa[]={2,3,6,8,9};
+ DataArrayIdType *a=DataArrayIdType::New();
+ const mcIdType aa[]={2,3,6,8,9};
a->alloc(5,1);
std::copy(aa,aa+5,a->getPointer());
- DataArrayInt *b=DataArrayInt::New();
- const int bb[]={1,3,5,9,11};
+ DataArrayIdType *b=DataArrayIdType::New();
+ const mcIdType bb[]={1,3,5,9,11};
b->alloc(5,1);
std::copy(bb,bb+5,b->getPointer());
//
- DataArrayInt *c=a->buildSubstraction(b);
+ DataArrayIdType *c=a->buildSubstraction(b);
CPPUNIT_ASSERT_EQUAL(3,(int)c->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)c->getNumberOfComponents());
- const int expected1[3]={2,6,8};
+ const mcIdType expected1[3]={2,6,8};
CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer()));
//
c->decrRef();
void MEDCouplingBasicsTest3::testBuildOrthogonalField2()
{
MEDCouplingUMesh *m=build2DTargetMesh_1();
- DataArrayInt *d1=DataArrayInt::New();
- DataArrayInt *d2=DataArrayInt::New();
- DataArrayInt *d3=DataArrayInt::New();
- DataArrayInt *d4=DataArrayInt::New();
+ DataArrayIdType *d1=DataArrayIdType::New();
+ DataArrayIdType *d2=DataArrayIdType::New();
+ DataArrayIdType *d3=DataArrayIdType::New();
+ DataArrayIdType *d4=DataArrayIdType::New();
MEDCouplingUMesh *m1=m->buildDescendingConnectivity(d1,d2,d3,d4);
//
MEDCouplingFieldDouble *f1=m1->buildOrthogonalField();
void MEDCouplingBasicsTest3::testUMInsertNextCell1()
{
double targetCoords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 };
- int targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ mcIdType targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->allocateCells(5);
CPPUNIT_ASSERT_THROW(targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn),INTERP_KERNEL::Exception);
void MEDCouplingBasicsTest3::testFieldOperatorDivDiffComp1()
{
MEDCouplingUMesh *m=build2DTargetMesh_1();
- DataArrayInt *d1=DataArrayInt::New();
- DataArrayInt *d2=DataArrayInt::New();
- DataArrayInt *d3=DataArrayInt::New();
- DataArrayInt *d4=DataArrayInt::New();
+ DataArrayIdType *d1=DataArrayIdType::New();
+ DataArrayIdType *d2=DataArrayIdType::New();
+ DataArrayIdType *d3=DataArrayIdType::New();
+ DataArrayIdType *d4=DataArrayIdType::New();
MEDCouplingUMesh *m1=m->buildDescendingConnectivity(d1,d2,d3,d4);
//
MEDCouplingFieldDouble *f1=m1->buildOrthogonalField();
void MEDCouplingBasicsTest3::testDARearrange1()
{
- DataArrayInt *da1=DataArrayInt::New();
+ DataArrayIdType *da1=DataArrayIdType::New();
da1->alloc(12,1);
da1->iota(0);
- const int *ptr=da1->getConstPointer();
+ const mcIdType *ptr=da1->getConstPointer();
//
- CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(12),da1->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(1,(int)da1->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(12,(int)da1->getNumberOfTuples());
da1->rearrange(4);
CPPUNIT_ASSERT(ptr==da1->getConstPointer());
- CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(12),da1->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(4,(int)da1->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(3,(int)da1->getNumberOfTuples());
- for(int i=0;i<12;i++)
+ for(mcIdType i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i));
//
da1->rearrange(6);
CPPUNIT_ASSERT(ptr==da1->getConstPointer());
- CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(12),da1->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(6,(int)da1->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(2,(int)da1->getNumberOfTuples());
- for(int i=0;i<12;i++)
+ for(mcIdType i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i));
//
CPPUNIT_ASSERT_THROW(da1->rearrange(7),INTERP_KERNEL::Exception);
//
da1->rearrange(12);
CPPUNIT_ASSERT(ptr==da1->getConstPointer());
- CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(12),da1->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(12,(int)da1->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(1,(int)da1->getNumberOfTuples());
- for(int i=0;i<12;i++)
+ for(mcIdType i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i));
//
da1->rearrange(3);
CPPUNIT_ASSERT(ptr==da1->getConstPointer());
- CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(12),da1->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(3,(int)da1->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(4,(int)da1->getNumberOfTuples());
- for(int i=0;i<12;i++)
+ for(mcIdType i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i));
//double
MCAuto<DataArrayDouble> da2=da1->convertToDblArr();
da1->decrRef();
const double *ptr2=da2->getConstPointer();
//
- CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(12),da2->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfTuples());
da2->rearrange(4);
CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
- CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(12),da2->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfTuples());
for(int i=0;i<12;i++)
//
da2->rearrange(6);
CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
- CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(12),da2->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(6,(int)da2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(2,(int)da2->getNumberOfTuples());
for(int i=0;i<12;i++)
//
da2->rearrange(1);
CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
- CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(12),da2->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(12,(int)da2->getNumberOfTuples());
for(int i=0;i<12;i++)
//
da2->rearrange(3);
CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
- CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(12),da2->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfTuples());
for(int i=0;i<12;i++)
void MEDCouplingBasicsTest3::testGetDifferentValues1()
{
- DataArrayInt *da1=DataArrayInt::New();
- const int arr[12]={1,2,3,2,2,3,5,1,5,5,2,2};
+ DataArrayIdType *da1=DataArrayIdType::New();
+ const mcIdType arr[12]={1,2,3,2,2,3,5,1,5,5,2,2};
da1->alloc(4,3);
std::copy(arr,arr+12,da1->getPointer());
- DataArrayInt *s=da1->getDifferentValues();
- const int expected1[4]={1,2,3,5};
+ DataArrayIdType *s=da1->getDifferentValues();
+ const mcIdType expected1[4]={1,2,3,5};
CPPUNIT_ASSERT_EQUAL(4,(int)s->getNumberOfTuples());
CPPUNIT_ASSERT(std::equal(expected1,expected1+4,s->begin()));
da1->decrRef();
void MEDCouplingBasicsTest3::testDAIBuildPermutationArr1()
{
- DataArrayInt *a=DataArrayInt::New();
- const int vala[5]={4,5,6,7,8};
+ DataArrayIdType *a=DataArrayIdType::New();
+ const mcIdType vala[5]={4,5,6,7,8};
a->alloc(5,1);
std::copy(vala,vala+5,a->getPointer());
- DataArrayInt *b=DataArrayInt::New();
- const int valb[5]={5,4,8,6,7};
+ DataArrayIdType *b=DataArrayIdType::New();
+ const mcIdType valb[5]={5,4,8,6,7};
b->alloc(5,1);
std::copy(valb,valb+5,b->getPointer());
- DataArrayInt *c=a->buildPermutationArr(*b);
- const int expect1[5]={1,0,4,2,3};
+ DataArrayIdType *c=a->buildPermutationArr(*b);
+ const mcIdType expect1[5]={1,0,4,2,3};
CPPUNIT_ASSERT_EQUAL(5,(int)c->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)c->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(expect1,expect1+5,c->getConstPointer()));
CPPUNIT_ASSERT(a->isEqualWithoutConsideringStrAndOrder(*b));
c->decrRef();
c=a->buildPermutationArr(*b);
- const int expect2[5]={1,3,4,2,3};
+ const mcIdType expect2[5]={1,3,4,2,3};
CPPUNIT_ASSERT(std::equal(expect2,expect2+5,c->getConstPointer()));
MCAuto<DataArrayDouble> d=b->convertToDblArr();
b->sort();
- const int expect3[5]={4,4,5,6,8};
+ const mcIdType expect3[5]={4,4,5,6,8};
CPPUNIT_ASSERT(std::equal(expect3,expect3+5,b->getConstPointer()));
d->sort();
CPPUNIT_ASSERT_EQUAL(5,(int)d->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(3,m2->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,m2->getMeshDimension());
m2->setName(myName);
- DataArrayInt *tmp;
+ DataArrayIdType *tmp;
CPPUNIT_ASSERT(m->areCellsIncludedIn(m2,0,tmp));
CPPUNIT_ASSERT(std::string(myName)==tmp->getName());
CPPUNIT_ASSERT_EQUAL(0,(int)tmp->getNumberOfTuples());
void MEDCouplingBasicsTest3::testUMeshGetPartBarycenterAndOwner1()
{
MEDCouplingUMesh *m1=build2DTargetMesh_1();
- const int part[3]={1,0,4};
+ const mcIdType part[3]={1,0,4};
DataArrayDouble *b=m1->getPartBarycenterAndOwner(part,part+3);
CPPUNIT_ASSERT_EQUAL(2,(int)b->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(3,(int)b->getNumberOfTuples());
void MEDCouplingBasicsTest3::testUMeshGetPartMeasureField1()
{
MEDCouplingUMesh *m1=build2DTargetMesh_1();
- const int part[3]={1,0,4};
+ const mcIdType part[3]={1,0,4};
DataArrayDouble *b=m1->getPartMeasureField(true,part,part+3);
CPPUNIT_ASSERT_EQUAL(1,(int)b->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(3,(int)b->getNumberOfTuples());
{
MEDCouplingUMesh *m1=build2DTargetMesh_1();
m1->changeSpaceDimension(3);
- const int part[3]={1,0,4};
+ const mcIdType part[3]={1,0,4};
MEDCouplingFieldDouble *b=m1->buildPartOrthogonalField(part,part+3);
CPPUNIT_ASSERT_EQUAL(3,(int)b->getArray()->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(3,(int)b->getArray()->getNumberOfTuples());
void MEDCouplingBasicsTest3::testUMeshGetTypesOfPart1()
{
MEDCouplingUMesh *m1=build2DTargetMesh_1();
- const int part1[]={0,3,4};
+ const mcIdType part1[]={0,3,4};
std::set<INTERP_KERNEL::NormalizedCellType> s;
s=m1->getTypesOfPart(part1,part1+3);
CPPUNIT_ASSERT(s.size()==1);
CPPUNIT_ASSERT(*s.begin()==INTERP_KERNEL::NORM_QUAD4);
- const int part2[]={2,2,2,1};
+ const mcIdType part2[]={2,2,2,1};
s=m1->getTypesOfPart(part2,part2+4);
CPPUNIT_ASSERT(s.size()==1);
CPPUNIT_ASSERT(*s.begin()==INTERP_KERNEL::NORM_TRI3);
- const int part3[]={3,2,1};
+ const mcIdType part3[]={3,2,1};
s=m1->getTypesOfPart(part3,part3+3);
CPPUNIT_ASSERT(s.size()==2);
CPPUNIT_ASSERT(*s.begin()==INTERP_KERNEL::NORM_TRI3);
void MEDCouplingBasicsTest3::testUMeshKeepCellIdsByType1()
{
MEDCouplingUMesh *m1=build2DTargetMesh_1();
- const int part1[3]={0,3,4};
- DataArrayInt *a=m1->keepCellIdsByType(INTERP_KERNEL::NORM_TRI3,part1,part1+3);
+ const mcIdType part1[3]={0,3,4};
+ DataArrayIdType *a=m1->keepCellIdsByType(INTERP_KERNEL::NORM_TRI3,part1,part1+3);
CPPUNIT_ASSERT_EQUAL(1,(int)a->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(0,(int)a->getNumberOfTuples());
a->decrRef();
//
- const int part2[5]={3,2,0,2,4};
+ const mcIdType part2[5]={3,2,0,2,4};
a=m1->keepCellIdsByType(INTERP_KERNEL::NORM_TRI3,part2,part2+5);
CPPUNIT_ASSERT_EQUAL(1,(int)a->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(2,(int)a->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,a->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(2,a->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(2,(int)a->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(2,(int)a->getIJ(1,0));
a->decrRef();
//
a=m1->keepCellIdsByType(INTERP_KERNEL::NORM_QUAD4,part2,part2+5);
CPPUNIT_ASSERT_EQUAL(1,(int)a->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(3,(int)a->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,a->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(0,a->getIJ(1,0));
- CPPUNIT_ASSERT_EQUAL(4,a->getIJ(2,0));
+ CPPUNIT_ASSERT_EQUAL(3,(int)a->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(0,(int)a->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(4,(int)a->getIJ(2,0));
//
a->decrRef();
m1->decrRef();
void MEDCouplingBasicsTest3::testDAIAggregateMulti1()
{
- DataArrayInt *a=DataArrayInt::New();
+ DataArrayIdType *a=DataArrayIdType::New();
a->setName("aa");
a->alloc(4,1);
a->iota(0);
a->rearrange(2);
- DataArrayInt *b=DataArrayInt::New();
+ DataArrayIdType *b=DataArrayIdType::New();
b->setName("bb");
b->alloc(6,1);
b->iota(0);
b->rearrange(2);
//
- std::vector<const DataArrayInt *> v(2);
+ std::vector<const DataArrayIdType *> v(2);
v[0]=a; v[1]=b;
- DataArrayInt *c=DataArrayInt::Aggregate(v);
+ DataArrayIdType *c=DataArrayIdType::Aggregate(v);
CPPUNIT_ASSERT_EQUAL(5,(int)c->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)c->getNumberOfComponents());
CPPUNIT_ASSERT(c->getName()=="aa");
- const int expect1[10]={0,1,2,3,0,1,2,3,4,5};
+ const mcIdType expect1[10]={0,1,2,3,0,1,2,3,4,5};
for(int i=0;i<10;i++)
CPPUNIT_ASSERT_EQUAL(expect1[i],c->getIJ(0,i));
//
MEDCouplingUMesh *m2=build3DSurfTargetMesh_1();
MEDCouplingUMesh *m3=build3DSurfTargetMesh_1();
//
- const int vec1[3]={0,2,3};
+ const mcIdType vec1[3]={0,2,3};
MEDCouplingUMesh *m2_2=(MEDCouplingUMesh *)m2->buildPartOfMySelf(vec1,vec1+3,false);
- const int vec2[2]={1,1};
+ const mcIdType vec2[2]={1,1};
MEDCouplingUMesh *m3_2=(MEDCouplingUMesh *)m3->buildPartOfMySelf(vec2,vec2+2,false);
//
std::vector<const MEDCouplingUMesh *> ms(3);
MEDCouplingUMesh *m4=MEDCouplingUMesh::MergeUMeshes(ms);
m4->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(10,(int)m4->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(20,m4->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(45,m4->getNodalConnectivityArrayLen());
+ CPPUNIT_ASSERT_EQUAL(20,(int)m4->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(45,(int)m4->getNodalConnectivityArrayLen());
//
MEDCouplingMesh *m4bis=MEDCouplingMesh::MergeMeshes(ms2);
CPPUNIT_ASSERT(m4->isEqual(m4bis,1e-12));
m4bis->decrRef();
//
- const int vec3[5]={0,1,2,3,4};
+ const mcIdType vec3[5]={0,1,2,3,4};
MEDCouplingUMesh *m4_1=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec3,vec3+5,false);
m4_1->setName(m1->getName().c_str());
CPPUNIT_ASSERT(m4_1->isEqual(m1,1e-12));
m4_1->decrRef();
//
- const int vec4[3]={5,6,7};
+ const mcIdType vec4[3]={5,6,7};
MEDCouplingUMesh *m4_2=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec4,vec4+3,false);
- DataArrayInt *cellCor=0;
- DataArrayInt *nodeCor=0;
+ DataArrayIdType *cellCor=0;
+ DataArrayIdType *nodeCor=0;
m4_2->checkGeoEquivalWith(m2_2,10,1e-12,cellCor,nodeCor);
CPPUNIT_ASSERT(cellCor==0);
CPPUNIT_ASSERT(nodeCor==0);
m4_2->decrRef();
//
- const int vec5[2]={8,9};
+ const mcIdType vec5[2]={8,9};
MEDCouplingUMesh *m4_3=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec5,vec5+2,false);
CPPUNIT_ASSERT_EQUAL(2,(int)m4_3->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(3,m4_3->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(3,(int)m4_3->getNumberOfNodes());
m3_2->zipCoords();
m4_3->setName(m3_2->getName().c_str());
CPPUNIT_ASSERT(m4_3->isEqual(m3_2,1e-12));
std::copy(sourceCoords,sourceCoords+12,coo->getPointer());
MEDCouplingUMesh *m=MEDCouplingUMesh::Build0DMeshFromCoords(coo);
m->checkConsistencyLight();
- CPPUNIT_ASSERT_EQUAL(4,m->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(4,(int)m->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(4,(int)m->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(3,m->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(0,m->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POINT1,*types.begin());
for(int i=0;i<4;i++)
{
- std::vector<int> conn;
+ std::vector<mcIdType> conn;
m->getNodeIdsOfCell(i,conn);
CPPUNIT_ASSERT_EQUAL(1,(int)conn.size());
- CPPUNIT_ASSERT_EQUAL(i,conn[0]);
+ CPPUNIT_ASSERT_EQUAL(i,(int)conn[0]);
CPPUNIT_ASSERT(INTERP_KERNEL::NORM_POINT1==m->getTypeOfCell(i));
}
CPPUNIT_ASSERT(std::string(m->getName())=="My0D");
void MEDCouplingBasicsTest4::testDAICheckAndPreparePermutation1()
{
- const int vals1[]={9,10,0,6,4,11,3,7};
- const int expect1[]={5,6,0,3,2,7,1,4};
- const int vals2[]={9,10,0,6,10,11,3,7};
- DataArrayInt *da=DataArrayInt::New();
+ const mcIdType vals1[]={9,10,0,6,4,11,3,7};
+ const mcIdType expect1[]={5,6,0,3,2,7,1,4};
+ const mcIdType vals2[]={9,10,0,6,10,11,3,7};
+ DataArrayIdType *da=DataArrayIdType::New();
da->alloc(8,1);
std::copy(vals1,vals1+8,da->getPointer());
- DataArrayInt *da2=da->checkAndPreparePermutation();
- CPPUNIT_ASSERT_EQUAL(8,(int)da2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
+ DataArrayIdType *da2=da->checkAndPreparePermutation();
+ CPPUNIT_ASSERT_EQUAL(8,(int)da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
for(int i=0;i<8;i++)
CPPUNIT_ASSERT_EQUAL(expect1[i],da2->getIJ(i,0));
da2->decrRef();
da->decrRef();
//
- da=DataArrayInt::New();
+ da=DataArrayIdType::New();
da->alloc(8,1);
da->iota(0);
da2=da->checkAndPreparePermutation();
- CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
CPPUNIT_ASSERT(da2->isIota(8));
da2->decrRef();
da->decrRef();
//
- da=DataArrayInt::New();
+ da=DataArrayIdType::New();
da->alloc(8,1);
std::copy(vals2,vals2+8,da->getPointer());
CPPUNIT_ASSERT_THROW(da->checkAndPreparePermutation(),INTERP_KERNEL::Exception);
void MEDCouplingBasicsTest4::testDAIChangeSurjectiveFormat1()
{
- const int vals1[8]={0,3,2,3,2,2,1,2};
- const int expected1[5]={0,1,2,6,8};
- const int expected2[8]={0, 6, 2,4,5,7, 1,3};
- DataArrayInt *da=DataArrayInt::New();
+ const mcIdType vals1[8]={0,3,2,3,2,2,1,2};
+ const mcIdType expected1[5]={0,1,2,6,8};
+ const mcIdType expected2[8]={0, 6, 2,4,5,7, 1,3};
+ DataArrayIdType *da=DataArrayIdType::New();
da->alloc(8,1);
std::copy(vals1,vals1+8,da->getPointer());
//
- DataArrayInt *da2,*da2I;
+ DataArrayIdType *da2,*da2I;
da->changeSurjectiveFormat(4,da2,da2I);
CPPUNIT_ASSERT_EQUAL(5,(int)da2I->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(8,(int)da2->getNumberOfTuples());
void MEDCouplingBasicsTest4::testUMeshGetCellIdsLyingOnNodes1()
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- const int nodeIds1[5]={1,2,3,4,6};
- const int nodeIds2[2]={6,7};
- DataArrayInt *da=m->getCellIdsLyingOnNodes(nodeIds1,nodeIds1+5,true);
- CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(1,da->getIJ(0,0));
+ const mcIdType nodeIds1[5]={1,2,3,4,6};
+ const mcIdType nodeIds2[2]={6,7};
+ DataArrayIdType *da=m->getCellIdsLyingOnNodes(nodeIds1,nodeIds1+5,true);
+ CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(1,(int)da->getIJ(0,0));
da->decrRef();
da=m->getCellIdsLyingOnNodes(nodeIds2,nodeIds2+2,false);
- CPPUNIT_ASSERT_EQUAL(2,(int)da->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(3,da->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(4,da->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(2,(int)da->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(3,(int)da->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(4,(int)da->getIJ(1,0));
da->decrRef();
//
m->decrRef();
void MEDCouplingBasicsTest4::testUMeshFindCellIdsOnBoundary1()
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- DataArrayInt *da5=m->findCellIdsOnBoundary();
+ DataArrayIdType *da5=m->findCellIdsOnBoundary();
CPPUNIT_ASSERT(da5->isIota(5));
//
da5->decrRef();
CPPUNIT_ASSERT_DOUBLES_EQUAL(3.4,f1->getTime(a,b),1.e-14);
CPPUNIT_ASSERT_EQUAL(5,a); CPPUNIT_ASSERT_EQUAL(6,b);
CPPUNIT_ASSERT_EQUAL(std::string(f1->getTimeUnit()),std::string("us"));
- CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(9,(int)f1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(9,(int)f1->getNumberOfTuples());
const double expected1[9]={0.2, 0.7, 1.2, 0.7, 1.2, 1.7, 1.2, 1.7, 2.2};
for(int i=0;i<9;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getArray()->getIJ(0,i),1e-12);
{
MEDCouplingUMesh *m=MEDCouplingUMesh::New("testP2",2);
const double coords[12]={0.,2.,3.5,0.,4.5,1.5,1.2,0.32,3.4,1.,2.1,2.4};
- const int conn[6]={0,1,2,3,4,5};
+ const mcIdType conn[6]={0,1,2,3,4,5};
DataArrayDouble *coo=DataArrayDouble::New();
coo->alloc(6,2);
std::copy(coords,coords+12,coo->getPointer());
{
MEDCouplingUMesh *m=MEDCouplingUMesh::New("testP2_2",3);
const double coords[30]={0.33312787792955395, -0.35155740179580952, -0.03567564825034563, 1.307146326477638, -0.57234557776250305, -0.08608044208272235, 0.5551834466499993, 0.62324964668794192, -0.014638951108536295, 0.37761817224442129, -0.38324019806913578, 0.96283164472856886, 0.79494856035658679, -0.40628057809270046, 0.0021004190225864614, 1.023740446371799, 0.07665912970471335, -0.072889657161871096, 0.54564584619517376, 0.11132872093429744, 0.039647326652013051, 0.27164784387819052, -0.42018012100866675, 0.46563376500745146, 0.89501965094896418, -0.56148455362735061, 0.43337469695473035, 0.49118025152924394, 0.093884938060727313, 0.47216346905220891};
- const int conn[10]={0,1,2,3,4,5,6,7,8,9};
+ const mcIdType conn[10]={0,1,2,3,4,5,6,7,8,9};
DataArrayDouble *coo=DataArrayDouble::New();
coo->alloc(10,3);
std::copy(coords,coords+30,coo->getPointer());
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
f->setMesh(m);
DataArrayDouble *arr=DataArrayDouble::New();
- int nbOfCells=m->getNumberOfCells();
+ std::size_t nbOfCells=m->getNumberOfCells();
arr->alloc(nbOfCells,3);
f->setArray(arr);
arr->decrRef();
f=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME);
f->setMesh(m);
arr=DataArrayDouble::New();
- int nbOfNodes=m->getNumberOfNodes();
+ mcIdType nbOfNodes=m->getNumberOfNodes();
arr->alloc(nbOfNodes,3);
f->setArray(arr);
arr->decrRef();
void MEDCouplingBasicsTest4::testDAIGetIdsNotEqual1()
{
- DataArrayInt *d=DataArrayInt::New();
- const int vals1[10]={2,3,5,6,8,5,5,6,1,-5};
+ DataArrayIdType *d=DataArrayIdType::New();
+ const mcIdType vals1[10]={2,3,5,6,8,5,5,6,1,-5};
d->alloc(10,1);
std::copy(vals1,vals1+10,d->getPointer());
- DataArrayInt *d2=d->findIdsNotEqual(5);
+ DataArrayIdType *d2=d->findIdsNotEqual(5);
CPPUNIT_ASSERT_EQUAL(7,(int)d2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)d2->getNumberOfComponents());
- const int expected1[7]={0,1,3,4,7,8,9};
+ const mcIdType expected1[7]={0,1,3,4,7,8,9};
for(int i=0;i<7;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],d2->getIJ(0,i));
d->rearrange(2);
CPPUNIT_ASSERT_THROW(d->findIdsNotEqual(5),INTERP_KERNEL::Exception);
- const int vals2[3]={-4,5,6};
- std::vector<int> vals3(vals2,vals2+3);
+ const mcIdType vals2[3]={-4,5,6};
+ std::vector<mcIdType> vals3(vals2,vals2+3);
d->rearrange(1);
- DataArrayInt *d3=d->findIdsNotEqualList(&vals3[0],&vals3[0]+vals3.size());
+ DataArrayIdType *d3=d->findIdsNotEqualList(&vals3[0],&vals3[0]+vals3.size());
CPPUNIT_ASSERT_EQUAL(5,(int)d3->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)d3->getNumberOfComponents());
- const int expected2[5]={0,1,4,8,9};
+ const mcIdType expected2[5]={0,1,4,8,9};
for(int i=0;i<5;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],d3->getIJ(0,i));
d3->decrRef();
void MEDCouplingBasicsTest4::testDAIComputeOffsets1()
{
- DataArrayInt *d=DataArrayInt::New();
- const int vals1[6]={3,5,1,2,0,8};
- const int expected1[6]={0,3,8,9,11,11};
+ DataArrayIdType *d=DataArrayIdType::New();
+ const mcIdType vals1[6]={3,5,1,2,0,8};
+ const mcIdType expected1[6]={0,3,8,9,11,11};
d->alloc(6,1);
std::copy(vals1,vals1+6,d->getPointer());
d->computeOffsets();
0.8660254037844386, 0.5, 0.0, 0.0, 1.0, 0.0, -0.8660254037844386, 0.5, 0.0, -0.8660254037844386, -0.5, 0.0, 0.0, -1.0, 0.0, 0.8660254037844386, -0.5, 0.0,
0.8660254037844386, 0.5, 2.0, 0.0, 1.0, 2.0, -0.8660254037844386, 0.5, 2.0, -0.8660254037844386, -0.5, 2.0, 0.0, -1.0, 2.0, 0.8660254037844386, -0.5, 2.0
};
- const int conn[12]={1,2,3,4,5,0,7,8,9,10,11,6};
+ const mcIdType conn[12]={1,2,3,4,5,0,7,8,9,10,11,6};
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("MyFirstHexagonalPrism",3);
DataArrayDouble *coo=DataArrayDouble::New();
coo->alloc(12,3);
const double expected1[3]={0.,0.,1.};
for(int i=0;i<3;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],bary->getIJ(0,i),1e-12);
- DataArrayInt *d1=DataArrayInt::New();
- DataArrayInt *d2=DataArrayInt::New();
- DataArrayInt *d3=DataArrayInt::New();
- DataArrayInt *d4=DataArrayInt::New();
+ DataArrayIdType *d1=DataArrayIdType::New();
+ DataArrayIdType *d2=DataArrayIdType::New();
+ DataArrayIdType *d3=DataArrayIdType::New();
+ DataArrayIdType *d4=DataArrayIdType::New();
MEDCouplingUMesh *m2=mesh->buildDescendingConnectivity(d1,d2,d3,d4);
CPPUNIT_ASSERT_EQUAL(8,(int)m2->getNumberOfCells());
- const int expected4[8][6]={{1,2,3,4,5,0},{7,6,11,10,9,8},{1,7,8,2},{2,8,9,3},{3,9,10,4},{4,10,11,5},{5,11,6,0},{0,6,7,1}};
+ const mcIdType expected4[8][6]={{1,2,3,4,5,0},{7,6,11,10,9,8},{1,7,8,2},{2,8,9,3},{3,9,10,4},{4,10,11,5},{5,11,6,0},{0,6,7,1}};
const INTERP_KERNEL::NormalizedCellType expected2[8]={INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4};
- const int expected3[8]={6,6,4,4,4,4,4,4};
+ const mcIdType expected3[8]={6,6,4,4,4,4,4,4};
for(int i=0;i<8;i++)
{
CPPUNIT_ASSERT(m2->getTypeOfCell(i)==expected2[i]);
- std::vector<int> v;
+ std::vector<mcIdType> v;
m2->getNodeIdsOfCell(i,v);
CPPUNIT_ASSERT((int)v.size()==expected3[i]);
CPPUNIT_ASSERT(std::equal(expected4[i],expected4[i]+expected3[i],v.begin()));
CPPUNIT_ASSERT(INTERP_KERNEL::NORM_POLYHED==mesh->getTypeOfCell(0));
mesh->unPolyze();
CPPUNIT_ASSERT(INTERP_KERNEL::NORM_HEXGP12==mesh->getTypeOfCell(0));
- CPPUNIT_ASSERT_EQUAL(13,mesh->getNodalConnectivityArrayLen());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(13),mesh->getNodalConnectivityArrayLen());
//
vols->decrRef();
bary->decrRef();
m->getNodalConnectivity()->setIJ(8,0,8);//OK
m->checkConsistencyLight();
m->checkConsistency();
- const int elts[2]={1,5};
- std::vector<int> eltsV(elts,elts+2);
+ const mcIdType elts[2]={1,5};
+ std::vector<mcIdType> eltsV(elts,elts+2);
m->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size());
m->checkConsistencyLight();
m->checkConsistency();
m->setCoords(coo);
coo->decrRef();
m->allocateCells(2);
- const int conn[4]={0,1,2,3};
+ const mcIdType conn[4]={0,1,2,3};
m->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn);
m->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn);
m->finishInsertingCells();
std::vector<const MEDCouplingUMesh *> ms(4,m);
MEDCouplingUMesh *m2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(ms);
- std::vector<int> temp(1,2);
+ std::vector<mcIdType> temp(1,2);
m2->convertToPolyTypes(&temp[0],&temp[0]+temp.size());
m2->unPolyze();
CPPUNIT_ASSERT(INTERP_KERNEL::NORM_TETRA4==m2->getTypeOfCell(2));
- CPPUNIT_ASSERT_EQUAL(40,m2->getNodalConnectivityArrayLen());
- std::vector<int> temp2;
+ CPPUNIT_ASSERT_EQUAL(ToIdType(40),m2->getNodalConnectivityArrayLen());
+ std::vector<mcIdType> temp2;
m2->getNodeIdsOfCell(2,temp2);
CPPUNIT_ASSERT(4==(int)temp2.size());
CPPUNIT_ASSERT(std::equal(conn,conn+4,temp2.begin()));
void MEDCouplingBasicsTest4::testDAITransformWithIndArr1()
{
- const int tab1[4]={17,18,22,19};
- const int tab2[12]={0,1,1,3,3,0,1,3,2,2,3,0};
- const int expected[12]={17,18,18,19,19,17,18,19,22,22,19,17};
- DataArrayInt *d=DataArrayInt::New();
+ const mcIdType tab1[4]={17,18,22,19};
+ const mcIdType tab2[12]={0,1,1,3,3,0,1,3,2,2,3,0};
+ const mcIdType expected[12]={17,18,18,19,19,17,18,19,22,22,19,17};
+ DataArrayIdType *d=DataArrayIdType::New();
d->alloc(4,1);
std::copy(tab1,tab1+4,d->getPointer());
- DataArrayInt *d1=DataArrayInt::New();
+ DataArrayIdType *d1=DataArrayIdType::New();
d1->alloc(12,1);
std::copy(tab2,tab2+12,d1->getPointer());
//
void MEDCouplingBasicsTest4::testDAIBuildPermArrPerLevel1()
{
- const int arr[12]={2,0,1,1,0,1,2,0,1,1,0,0};
- const int expected1[12]={10,0,5,6,1,7,11,2,8,9,3,4};
- DataArrayInt *da=DataArrayInt::New();
+ const mcIdType arr[12]={2,0,1,1,0,1,2,0,1,1,0,0};
+ const mcIdType expected1[12]={10,0,5,6,1,7,11,2,8,9,3,4};
+ DataArrayIdType *da=DataArrayIdType::New();
da->alloc(12,1);
std::copy(arr,arr+12,da->getPointer());
- DataArrayInt *da2=da->buildPermArrPerLevel();
+ DataArrayIdType *da2=da->buildPermArrPerLevel();
CPPUNIT_ASSERT_EQUAL(12,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
for(int i=0;i<12;i++)
void MEDCouplingBasicsTest4::testDAIOperations1()
{
- const int arr1[12]={-1,-2,4,7,3,2,6,6,4,3,0,1};
- DataArrayInt *da=DataArrayInt::New();
+ const mcIdType arr1[12]={-1,-2,4,7,3,2,6,6,4,3,0,1};
+ DataArrayIdType *da=DataArrayIdType::New();
da->alloc(4,3);
std::copy(arr1,arr1+12,da->getPointer());
- DataArrayInt *da1=DataArrayInt::New();
+ DataArrayIdType *da1=DataArrayIdType::New();
da1->alloc(12,1);
da1->iota(2);
- CPPUNIT_ASSERT_THROW(DataArrayInt::Add(da,da1),INTERP_KERNEL::Exception);//not same number of tuples/Components
+ CPPUNIT_ASSERT_THROW(DataArrayIdType::Add(da,da1),INTERP_KERNEL::Exception);//not same number of tuples/Components
da1->rearrange(3);
- DataArrayInt *da2=DataArrayInt::Add(da,da1);
+ DataArrayIdType *da2=DataArrayIdType::Add(da,da1);
CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents());
- const int expected1[12]={1,1,8,12,9,9,14,15,14,14,12,14};
+ const mcIdType expected1[12]={1,1,8,12,9,9,14,15,14,14,12,14};
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(0,i));
da2->decrRef();
da1->substractEqual(da);
- const int expected2[12]={3,5,0,-2,3,5,2,3,6,8,12,12};
+ const mcIdType expected2[12]={3,5,0,-2,3,5,2,3,6,8,12,12};
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],da1->getIJ(0,i));
da1->rearrange(1); da1->iota(2); da1->rearrange(3);
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],da1->getIJ(0,i));
da1->rearrange(1); da1->iota(2); da1->rearrange(3);
- da2=DataArrayInt::Multiply(da,da1);
+ da2=DataArrayIdType::Multiply(da,da1);
CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents());
- const int expected3[12]={-2,-6,16,35,18,14,48,54,40,33,0,13};
+ const mcIdType expected3[12]={-2,-6,16,35,18,14,48,54,40,33,0,13};
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(expected3[i],da2->getIJ(0,i));
da2->decrRef();
da->divideEqual(da1);
CPPUNIT_ASSERT_EQUAL(4,(int)da->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(3,(int)da->getNumberOfComponents());
- const int expected4[12]={0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0};
+ const mcIdType expected4[12]={0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0};
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(expected4[i],da->getIJ(0,i));
std::copy(arr1,arr1+12,da->getPointer());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(expected3[i],da1->getIJ(0,i));
da1->rearrange(1); da1->iota(2); da1->rearrange(3);
- da2=DataArrayInt::Divide(da,da1);
+ da2=DataArrayIdType::Divide(da,da1);
CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents());
for(int i=0;i<12;i++)
da1->applyInv(321);
CPPUNIT_ASSERT_EQUAL(4,(int)da1->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(3,(int)da1->getNumberOfComponents());
- const int expected5[12]={160,107,80,64,53,45,40,35,32,29,26,24};
+ const mcIdType expected5[12]={160,107,80,64,53,45,40,35,32,29,26,24};
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(expected5[i],da1->getIJ(0,i));
da1->applyDivideBy(2);
CPPUNIT_ASSERT_EQUAL(4,(int)da1->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(3,(int)da1->getNumberOfComponents());
- const int expected6[12]={80,53,40,32,26,22,20,17,16,14,13,12};
+ const mcIdType expected6[12]={80,53,40,32,26,22,20,17,16,14,13,12};
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(expected6[i],da1->getIJ(0,i));
- const int expected7[12]={3,4,5,4,5,1,6,3,2,0,6,5};
+ const mcIdType expected7[12]={3,4,5,4,5,1,6,3,2,0,6,5};
da1->applyModulus(7);
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(expected7[i],da1->getIJ(0,i));
da1->applyLin(1,1);
- const int expected8[12]={3,3,3,3,3,1,3,3,0,0,3,3};
+ const mcIdType expected8[12]={3,3,3,3,3,1,3,3,0,0,3,3};
da1->applyRModulus(3);
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(expected8[i],da1->getIJ(0,i));
{
MEDCouplingUMesh *m1=0;
MEDCouplingUMesh *m=buildPointe_1(m1);
- DataArrayInt *da1=DataArrayInt::New();
- DataArrayInt *da2=DataArrayInt::New();
- DataArrayInt *da3=0;
- DataArrayInt *da4=0;
- DataArrayInt *da5=0;
- DataArrayInt *da0=0;
+ DataArrayIdType *da1=DataArrayIdType::New();
+ DataArrayIdType *da2=DataArrayIdType::New();
+ DataArrayIdType *da3=0;
+ DataArrayIdType *da4=0;
+ DataArrayIdType *da5=0;
+ DataArrayIdType *da0=0;
MEDCouplingUMesh *m2=m->emulateMEDMEMBDC(m1,da1,da2,da3,da4,da5,da0);
- const int expected0[47]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,36,37,32,33,34,35,38,39,40,41,42,43,44,45,46};
- const int expected1[6]={1,32,29,23,41,36};
+ const mcIdType expected0[47]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,36,37,32,33,34,35,38,39,40,41,42,43,44,45,46};
+ const mcIdType expected1[6]={1,32,29,23,41,36};
CPPUNIT_ASSERT_EQUAL(47,(int)da0->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da0->getNumberOfComponents());
for(int i=0;i<47;i++)
CPPUNIT_ASSERT_EQUAL(1,(int)da5->getNumberOfComponents());
for(int i=0;i<6;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],da5->getIJ(0,i));
- const int expected2[70]={0,1,2,3,4,0,5,6,7,4,8,9,1,7,10,11,12,13,14,5,15,16,17,8,18,19,20,10,21,22,23,2,13,24,25,21,16,26,27,12,19,28,29,15,22,30,31,18,36,26,28,30,24,37,32,33,34,35,38,36,39,40,41,42,37,38,43,44,45,46};
+ const mcIdType expected2[70]={0,1,2,3,4,0,5,6,7,4,8,9,1,7,10,11,12,13,14,5,15,16,17,8,18,19,20,10,21,22,23,2,13,24,25,21,16,26,27,12,19,28,29,15,22,30,31,18,36,26,28,30,24,37,32,33,34,35,38,36,39,40,41,42,37,38,43,44,45,46};
CPPUNIT_ASSERT_EQUAL(70,(int)da1->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da1->getNumberOfComponents());
for(int i=0;i<70;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],da1->getIJ(0,i));
- const int expected3[17]={0,4,8,12,16,20,24,28,32,36,40,44,48,53,58,64,70};
+ const mcIdType expected3[17]={0,4,8,12,16,20,24,28,32,36,40,44,48,53,58,64,70};
CPPUNIT_ASSERT_EQUAL(17,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
for(int i=0;i<17;i++)
CPPUNIT_ASSERT_EQUAL(expected3[i],da2->getIJ(0,i));
- const int expected4[48]={0,2,4,6,7,9,11,12,14,16,17,19,20,22,24,25,27,29,30,32,34,35,37,39,40,42,43,45,46,48,49,51,52,53,54,55,56,58,60,62,63,64,65,66,67,68,69,70};
- //const int expected4[48]={0,2,4,6,7,9,11,12,14,16,17,19,20,22,24,25,27,29,30,32,34,35,37,39,40,42,43,45,46,48,49,51,52,54,56,57,58,59,60,62,63,64,65,66,67,68,69,70};
+ const mcIdType expected4[48]={0,2,4,6,7,9,11,12,14,16,17,19,20,22,24,25,27,29,30,32,34,35,37,39,40,42,43,45,46,48,49,51,52,53,54,55,56,58,60,62,63,64,65,66,67,68,69,70};
+ //const mcIdType expected4[48]={0,2,4,6,7,9,11,12,14,16,17,19,20,22,24,25,27,29,30,32,34,35,37,39,40,42,43,45,46,48,49,51,52,54,56,57,58,59,60,62,63,64,65,66,67,68,69,70};
CPPUNIT_ASSERT_EQUAL(48,(int)da4->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da4->getNumberOfComponents());
for(int i=0;i<48;i++)
CPPUNIT_ASSERT_EQUAL(expected4[i],da4->getIJ(0,i));
- const int expected5[70]={0,1,0,3,0,7,0,1,2,1,4,1,2,3,2,5,2,3,6,3,4,9,4,8,4,5,10,5,9,5,6,11,6,10,6,7,8,7,11,7,8,12,8,9,12,9,10,12,10,11,12,11,13,13,13,13,12,14,13,15,14,15,14,14,14,14,15,15,15,15};
+ const mcIdType expected5[70]={0,1,0,3,0,7,0,1,2,1,4,1,2,3,2,5,2,3,6,3,4,9,4,8,4,5,10,5,9,5,6,11,6,10,6,7,8,7,11,7,8,12,8,9,12,9,10,12,10,11,12,11,13,13,13,13,12,14,13,15,14,15,14,14,14,14,15,15,15,15};
CPPUNIT_ASSERT_EQUAL(70,(int)da3->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da3->getNumberOfComponents());
for(int i=0;i<70;i++)
MEDCouplingUMesh *m1=0;
MEDCouplingUMesh *m=buildPointe_1(m1);
m1->decrRef();
- DataArrayInt *d0=DataArrayInt::New();
- DataArrayInt *d1=DataArrayInt::New();
- DataArrayInt *d2=DataArrayInt::New();
- DataArrayInt *d3=DataArrayInt::New();
+ DataArrayIdType *d0=DataArrayIdType::New();
+ DataArrayIdType *d1=DataArrayIdType::New();
+ DataArrayIdType *d2=DataArrayIdType::New();
+ DataArrayIdType *d3=DataArrayIdType::New();
m1=m->buildDescendingConnectivity(d0,d1,d2,d3);
d0->decrRef(); d1->decrRef(); d2->decrRef(); d3->decrRef();
INTERP_KERNEL::NormalizedCellType order[2]={INTERP_KERNEL::NORM_TRI3,INTERP_KERNEL::NORM_QUAD4};
- DataArrayInt *da1=0;
- DataArrayInt *da0=m1->getLevArrPerCellTypes(order,order+2,da1);
- const int expected0[47]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1};
- const int expected1[47]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,36,37,32,33,34,35,38,39,40,41,42,43,44,45,46};
- CPPUNIT_ASSERT_EQUAL(47,(int)da0->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)da0->getNumberOfComponents());
+ DataArrayIdType *da1=0;
+ DataArrayIdType *da0=m1->getLevArrPerCellTypes(order,order+2,da1);
+ const mcIdType expected0[47]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1};
+ const mcIdType expected1[47]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,36,37,32,33,34,35,38,39,40,41,42,43,44,45,46};
+ CPPUNIT_ASSERT_EQUAL(47,(int)da0->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)da0->getNumberOfComponents());
for(int i=0;i<47;i++)
CPPUNIT_ASSERT_EQUAL(expected0[i],da0->getIJ(0,i));
- CPPUNIT_ASSERT_EQUAL(2,(int)da1->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)da1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(36,da1->getIJ(0,0));//36 TRI3
- CPPUNIT_ASSERT_EQUAL(11,da1->getIJ(1,0));//11 QUAD4
+ CPPUNIT_ASSERT_EQUAL(2,(int)da1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)da1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(36,(int)da1->getIJ(0,0));//36 TRI3
+ CPPUNIT_ASSERT_EQUAL(11,(int)da1->getIJ(1,0));//11 QUAD4
//
- DataArrayInt *da2=da0->buildPermArrPerLevel();
+ DataArrayIdType *da2=da0->buildPermArrPerLevel();
//
- CPPUNIT_ASSERT_EQUAL(47,(int)da2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(47,(int)da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
for(int i=0;i<47;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(0,i));
da2->decrRef();
MEDCouplingUMesh *m=buildPointe_1(m1);
MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->deepCopy();
m->setCoords(0);
- const int vals[16]={0,1,2,14,3,12,4,5,15,6,7,8,9,10,11,13};
- DataArrayInt *da=DataArrayInt::New();
+ const mcIdType vals[16]={0,1,2,14,3,12,4,5,15,6,7,8,9,10,11,13};
+ DataArrayIdType *da=DataArrayIdType::New();
da->alloc(16,1);
std::copy(vals,vals+16,da->getPointer());
- DataArrayInt *daa=da->invertArrayN2O2O2N(16);
+ DataArrayIdType *daa=da->invertArrayN2O2O2N(16);
m->renumberCells(daa->getConstPointer(),false);
daa->decrRef();
- DataArrayInt *da2=m->sortCellsInMEDFileFrmt();
+ DataArrayIdType *da2=m->sortCellsInMEDFileFrmt();
CPPUNIT_ASSERT(m2->isEqual(m2,1e-12));
CPPUNIT_ASSERT(da->isEqual(*da2));
m2->decrRef();
void MEDCouplingBasicsTest4::testBuildPartAndReduceNodes1()
{
MEDCouplingMesh *m=build2DTargetMesh_1();
- const int arr[2]={1,0};
- DataArrayInt *da;
+ const mcIdType arr[2]={1,0};
+ DataArrayIdType *da;
MEDCouplingMesh *m2=m->buildPartAndReduceNodes(arr,arr+2,da);
- CPPUNIT_ASSERT_EQUAL(5,m2->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(5,(int)m2->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,(int)m2->getNumberOfCells());
MEDCouplingFieldDouble *f=m2->getMeasureField(true);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125,f->getArray()->getIJ(0,0),1e-12);
void MEDCouplingBasicsTest4::testDAITransformWithIndArrR1()
{
- const int tab1[6]={2,4,5,3,6,7};
- const int tab2[12]={-1,-1,0,1,2,3,4,5,-1,-1,-1,-1};
- const int expected[6]={0,3,1,2,4,5};
- DataArrayInt *d=DataArrayInt::New();
+ const mcIdType tab1[6]={2,4,5,3,6,7};
+ const mcIdType tab2[12]={-1,-1,0,1,2,3,4,5,-1,-1,-1,-1};
+ const mcIdType expected[6]={0,3,1,2,4,5};
+ DataArrayIdType *d=DataArrayIdType::New();
d->alloc(6,1);
std::copy(tab1,tab1+6,d->getPointer());
- DataArrayInt *d1=DataArrayInt::New();
+ DataArrayIdType *d1=DataArrayIdType::New();
d1->alloc(12,1);
std::copy(tab2,tab2+12,d1->getPointer());
//
- DataArrayInt *d3=d->transformWithIndArrR(d1->getConstPointer(),d1->getConstPointer()+d1->getNbOfElems());
+ DataArrayIdType *d3=d->transformWithIndArrR(d1->getConstPointer(),d1->getConstPointer()+d1->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(6,(int)d3->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)d3->getNumberOfComponents());
for(int i=0;i<6;i++)
void MEDCouplingBasicsTest4::testDAISplitByValueRange1()
{
- const int val1[9]={6,5,0,3,2,7,8,1,4};
- const int val2[3]={0,4,9};
- DataArrayInt *d=DataArrayInt::New();
+ const mcIdType val1[9]={6,5,0,3,2,7,8,1,4};
+ const mcIdType val2[3]={0,4,9};
+ DataArrayIdType *d=DataArrayIdType::New();
d->alloc(9,1);
std::copy(val1,val1+9,d->getPointer());
- DataArrayInt *ee=0,*f=0,*g=0;
+ DataArrayIdType *ee=0,*f=0,*g=0;
d->splitByValueRange(val2,val2+3,ee,f,g);
CPPUNIT_ASSERT_EQUAL(9,(int)ee->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)ee->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(2,(int)g->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)g->getNumberOfComponents());
//
- const int expected1[9]={1,1,0,0,0,1,1,0,1};
- const int expected2[9]={2,1,0,3,2,3,4,1,0};
+ const mcIdType expected1[9]={1,1,0,0,0,1,1,0,1};
+ const mcIdType expected2[9]={2,1,0,3,2,3,4,1,0};
for(int i=0;i<9;i++)
{
CPPUNIT_ASSERT_EQUAL(expected1[i],ee->getIJ(i,0));
CPPUNIT_ASSERT_EQUAL(expected2[i],f->getIJ(i,0));
}
- CPPUNIT_ASSERT_EQUAL(0,g->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(1,g->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(0,(int)g->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(1,(int)g->getIJ(1,0));
//
ee->decrRef();
f->decrRef();
void MEDCouplingBasicsTest4::testUMeshSplitProfilePerType1()
{
- const int val0[5]={2,0,1,3,4};
+ const mcIdType val0[5]={2,0,1,3,4};
MEDCouplingUMesh *m=build2DTargetMesh_1();
m->renumberCells(val0,false);
- std::vector<int> code;
- std::vector<DataArrayInt *> idsInPflPerType;
- std::vector<DataArrayInt *> pfls;
+ std::vector<mcIdType> code;
+ std::vector<DataArrayIdType *> idsInPflPerType;
+ std::vector<DataArrayIdType *> pfls;
//
- const int val1[3]={0,2,3};
- DataArrayInt *d=DataArrayInt::New();
+ const mcIdType val1[3]={0,2,3};
+ DataArrayIdType *d=DataArrayIdType::New();
d->alloc(3,1);
d->setName("sup");
std::copy(val1,val1+3,d->getPointer());
m->splitProfilePerType(d,code,idsInPflPerType,pfls);
CPPUNIT_ASSERT_EQUAL(6,(int)code.size());
CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType.size());
- const int expected1[6]={3,1,0, 4,2,1};
+ const mcIdType expected1[6]={3,1,0, 4,2,1};
for(int i=0;i<6;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],code[i]);
- CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[0]->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(0,idsInPflPerType[0]->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[1]->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[1]->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(2,idsInPflPerType[1]->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(0,(int)idsInPflPerType[0]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[1]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[1]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[1]->getIJ(1,0));
idsInPflPerType[0]->decrRef();
idsInPflPerType[1]->decrRef();
CPPUNIT_ASSERT_EQUAL(2,(int)pfls.size());
CPPUNIT_ASSERT(std::string("sup")==pfls[0]->getName());
- CPPUNIT_ASSERT_EQUAL(1,(int)pfls[0]->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(0,pfls[0]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(1,(int)pfls[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(0,(int)pfls[0]->getIJ(0,0));
CPPUNIT_ASSERT(std::string("sup")==pfls[1]->getName());
- CPPUNIT_ASSERT_EQUAL(2,(int)pfls[1]->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(0,pfls[1]->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(1,pfls[1]->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(2,(int)pfls[1]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(0,(int)pfls[1]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(1,(int)pfls[1]->getIJ(1,0));
pfls[0]->decrRef();
pfls[1]->decrRef();
d->decrRef();
pfls.clear();
code.clear();
//
- const int val2[4]={0,2,3,4};// all quad4 are selected here ! So no profile for Quads
- d=DataArrayInt::New();
+ const mcIdType val2[4]={0,2,3,4};// all quad4 are selected here ! So no profile for Quads
+ d=DataArrayIdType::New();
d->alloc(4,1);
std::copy(val2,val2+4,d->getPointer());
m->splitProfilePerType(d,code,idsInPflPerType,pfls);
CPPUNIT_ASSERT_EQUAL(6,(int)code.size());
CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType.size());
- const int expected2[6]={3,1,0, 4,3,-1};
+ const mcIdType expected2[6]={3,1,0, 4,3,-1};
for(int i=0;i<6;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],code[i]);
- CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[0]->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(0,idsInPflPerType[0]->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(3,(int)idsInPflPerType[1]->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[1]->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(2,idsInPflPerType[1]->getIJ(1,0));
- CPPUNIT_ASSERT_EQUAL(3,idsInPflPerType[1]->getIJ(2,0));
+ CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(0,(int)idsInPflPerType[0]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(3,(int)idsInPflPerType[1]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[1]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[1]->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(3,(int)idsInPflPerType[1]->getIJ(2,0));
idsInPflPerType[0]->decrRef();
idsInPflPerType[1]->decrRef();
CPPUNIT_ASSERT_EQUAL(1,(int)pfls.size());
- CPPUNIT_ASSERT_EQUAL(1,(int)pfls[0]->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(0,pfls[0]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(1,(int)pfls[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(0,(int)pfls[0]->getIJ(0,0));
pfls[0]->decrRef();
d->decrRef();
idsInPflPerType.clear();
pfls.clear();
code.clear();
//
- const int val3[3]={1,0,2};// all tri3 are selected here but not in the same order ! Profile requested for Tri3
- d=DataArrayInt::New();
+ const mcIdType val3[3]={1,0,2};// all tri3 are selected here but not in the same order ! Profile requested for Tri3
+ d=DataArrayIdType::New();
d->alloc(3,1);
std::copy(val3,val3+3,d->getPointer());
m->splitProfilePerType(d,code,idsInPflPerType,pfls);
CPPUNIT_ASSERT_EQUAL(6,(int)code.size());
CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType.size());
- const int expected3[6]={3,2,0, 4,1,1};
+ const mcIdType expected3[6]={3,2,0, 4,1,1};
for(int i=0;i<6;i++)
CPPUNIT_ASSERT_EQUAL(expected3[i],code[i]);
- CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[0]->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(0,idsInPflPerType[0]->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[0]->getIJ(1,0));
- CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[1]->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,idsInPflPerType[1]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(0,(int)idsInPflPerType[0]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[0]->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[1]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[1]->getIJ(0,0));
idsInPflPerType[0]->decrRef();
idsInPflPerType[1]->decrRef();
CPPUNIT_ASSERT_EQUAL(2,(int)pfls.size());
- CPPUNIT_ASSERT_EQUAL(2,(int)pfls[0]->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,pfls[0]->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(0,pfls[0]->getIJ(1,0));
- CPPUNIT_ASSERT_EQUAL(0,pfls[1]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(2,(int)pfls[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)pfls[0]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(0,(int)pfls[0]->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(0,(int)pfls[1]->getIJ(0,0));
pfls[0]->decrRef();
pfls[1]->decrRef();
d->decrRef();
pfls.clear();
code.clear();
//
- const int val4[2]={3,4};// all tri3 are selected here but not in the same order ! Profile requested for Tri3
- d=DataArrayInt::New();
+ const mcIdType val4[2]={3,4};// all tri3 are selected here but not in the same order ! Profile requested for Tri3
+ d=DataArrayIdType::New();
d->alloc(2,1);
std::copy(val4,val4+2,d->getPointer());
m->splitProfilePerType(d,code,idsInPflPerType,pfls);
CPPUNIT_ASSERT_EQUAL(3,(int)code.size());
CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType.size());
- const int expected4[3]={4,2,0};
+ const mcIdType expected4[3]={4,2,0};
for(int i=0;i<3;i++)
CPPUNIT_ASSERT_EQUAL(expected4[i],code[i]);
- CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[0]->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(0,idsInPflPerType[0]->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[0]->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(0,(int)idsInPflPerType[0]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[0]->getIJ(1,0));
idsInPflPerType[0]->decrRef();
CPPUNIT_ASSERT_EQUAL(1,(int)pfls.size());
- CPPUNIT_ASSERT_EQUAL(2,(int)pfls[0]->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,pfls[0]->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(2,pfls[0]->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(2,(int)pfls[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)pfls[0]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(2,(int)pfls[0]->getIJ(1,0));
pfls[0]->decrRef();
d->decrRef();
idsInPflPerType.clear();
void MEDCouplingBasicsTest4::testDAIBuildExplicitArrByRanges1()
{
- DataArrayInt *d=DataArrayInt::New();
+ DataArrayIdType *d=DataArrayIdType::New();
d->alloc(3,1);
- const int vals1[3]={0,2,3};
+ const mcIdType vals1[3]={0,2,3};
std::copy(vals1,vals1+3,d->getPointer());
- DataArrayInt *e=DataArrayInt::New();
+ DataArrayIdType *e=DataArrayIdType::New();
e->alloc(6,1);
- const int vals2[6]={0,3,6,10,14,20};
+ const mcIdType vals2[6]={0,3,6,10,14,20};
std::copy(vals2,vals2+6,e->getPointer());
//
- DataArrayInt *f=d->buildExplicitArrByRanges(e);
- CPPUNIT_ASSERT_EQUAL(11,(int)f->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)f->getNumberOfComponents());
- const int expected1[11]={0,1,2,6,7,8,9,10,11,12,13};
+ DataArrayIdType *f=d->buildExplicitArrByRanges(e);
+ CPPUNIT_ASSERT_EQUAL(11,(int)f->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f->getNumberOfComponents());
+ const mcIdType expected1[11]={0,1,2,6,7,8,9,10,11,12,13};
for(int i=0;i<11;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],f->getIJ(i,0));
//
void MEDCouplingBasicsTest4::testDAIComputeOffsets2()
{
- DataArrayInt *d=DataArrayInt::New();
- const int vals1[6]={3,5,1,2,0,8};
- const int expected1[7]={0,3,8,9,11,11,19};
+ DataArrayIdType *d=DataArrayIdType::New();
+ const mcIdType vals1[6]={3,5,1,2,0,8};
+ const mcIdType expected1[7]={0,3,8,9,11,11,19};
d->alloc(6,1);
std::copy(vals1,vals1+6,d->getPointer());
d->computeOffsetsFull();
- CPPUNIT_ASSERT_EQUAL(7,(int)d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(7,(int)d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
for(int i=0;i<7;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],d->getIJ(0,i));
d->decrRef();
void MEDCouplingBasicsTest4::testGetDistributionOfTypes1()
{
MEDCouplingUMesh *m=build2DTargetMesh_1();
- const int tab1[5]={2,0,1,3,4};
+ const mcIdType tab1[5]={2,0,1,3,4};
CPPUNIT_ASSERT_THROW(m->getDistributionOfTypes(),INTERP_KERNEL::Exception);
m->renumberCells(tab1,false);
- std::vector<int> code=m->getDistributionOfTypes();
+ std::vector<mcIdType> code=m->getDistributionOfTypes();
CPPUNIT_ASSERT_EQUAL(6,(int)code.size());
- CPPUNIT_ASSERT_EQUAL(3,code[0]);
- CPPUNIT_ASSERT_EQUAL(2,code[1]);
- CPPUNIT_ASSERT_EQUAL(-1,code[2]);
- CPPUNIT_ASSERT_EQUAL(4,code[3]);
- CPPUNIT_ASSERT_EQUAL(3,code[4]);
- CPPUNIT_ASSERT_EQUAL(-1,code[5]);
+ CPPUNIT_ASSERT_EQUAL(3,(int)code[0]);
+ CPPUNIT_ASSERT_EQUAL(2,(int)code[1]);
+ CPPUNIT_ASSERT_EQUAL(-1,(int)code[2]);
+ CPPUNIT_ASSERT_EQUAL(4,(int)code[3]);
+ CPPUNIT_ASSERT_EQUAL(3,(int)code[4]);
+ CPPUNIT_ASSERT_EQUAL(-1,(int)code[5]);
m->decrRef();
}
void MEDCouplingBasicsTest4::testFindAndCorrectBadOriented3DExtrudedCells1()
{
const double coords[38*3]={0.0011180339887498999, -0.0011755705045849499, 0.0, -0.0012331070204200001, -0.0011755705045849499, 0.0, -0.00067557050458494599, -0.00145964954842536, 0.0, -0.00050000000000000001, -0.00086602540378443902, 0.0, 0.00140211303259031, -0.00061803398874989504, 0.0, 0.00086602540378443902, -0.00050000000000000001, 0.0, 0.001, 0.0, 0.0, 0.00034561537182258202, 0.000269164072574575, 0.0, 0.0, 0.001, 0.0, -0.00050000000000000001, 0.00086602540378443902, 0.0, -0.000269164072574575, 0.00034561537182258202, 0.0, -0.001, 0.0, 0.0, -0.00086602540378443902, -0.00050000000000000001, 0.0, -0.00034561537182258202, -0.000269164072574575, 0.0, 0.0, -0.001, 0.0, 0.00050000000000000001, -0.00086602540378443902, 0.0, 0.000269164072574575, -0.00034561537182258202, 0.0, 0.0015, -6.01853107621011e-36, 0.0, 0.00056049747291484397, -0.00145964954842536, 0.0, 0.0011180339887498999, -0.0011755705045849499, 0.00050000000000000001, -0.0012331070204200001, -0.0011755705045849499, 0.00050000000000000001, -0.00067557050458494599, -0.00145964954842536, 0.00050000000000000001, -0.00050000000000000001, -0.00086602540378443902, 0.00050000000000000001, 0.00140211303259031, -0.00061803398874989504, 0.00050000000000000001, 0.00086602540378443902, -0.00050000000000000001, 0.00050000000000000001, 0.001, 0.0, 0.00050000000000000001, 0.00034561537182258202, 0.000269164072574575, 0.00050000000000000001, 0.0, 0.001, 0.00050000000000000001, -0.00050000000000000001, 0.00086602540378443902, 0.00050000000000000001, -0.000269164072574575, 0.00034561537182258202, 0.00050000000000000001, -0.001, 0.0, 0.00050000000000000001, -0.00086602540378443902, -0.00050000000000000001, 0.00050000000000000001, -0.00034561537182258202, -0.000269164072574575, 0.00050000000000000001, 0.0, -0.001, 0.00050000000000000001, 0.00050000000000000001, -0.00086602540378443902, 0.00050000000000000001, 0.000269164072574575, -0.00034561537182258202, 0.00050000000000000001, 0.0015, -6.01853107621011e-36, 0.00050000000000000001, 0.00056049747291484397, -0.00145964954842536, 0.00050000000000000001};
- const int conn[56]={2, 1, 3, 21, 20, 22, 4, 0, 5, 23, 19, 24, 8, 9, 10, 27, 28, 29, 11, 12, 13, 30, 31, 32, 0, 18, 15, 5, 19, 37, 34, 24, 6, 17, 4, 5, 25, 36, 23, 24, 3, 14, 16, 13, 22, 33, 35, 32, 13, 16, 7, 10, 32, 35, 26, 29};
- const int connExp[64]={16, 2, 1, 3, 21, 20, 22, 16, 4, 0, 5, 23, 19, 24, 16, 8, 10, 9, 27, 29, 28, 16, 11, 13, 12, 30, 32, 31, 18, 0, 18, 15, 5, 19, 37, 34, 24,18, 6, 17, 4, 5, 25, 36, 23, 24, 18, 3, 13, 16, 14, 22, 32, 35, 33, 18, 13, 10, 7, 16, 32, 29, 26, 35};
- const int invalidCells[4]={2,3,6,7};
+ const mcIdType conn[56]={2, 1, 3, 21, 20, 22, 4, 0, 5, 23, 19, 24, 8, 9, 10, 27, 28, 29, 11, 12, 13, 30, 31, 32, 0, 18, 15, 5, 19, 37, 34, 24, 6, 17, 4, 5, 25, 36, 23, 24, 3, 14, 16, 13, 22, 33, 35, 32, 13, 16, 7, 10, 32, 35, 26, 29};
+ const mcIdType connExp[64]={16, 2, 1, 3, 21, 20, 22, 16, 4, 0, 5, 23, 19, 24, 16, 8, 10, 9, 27, 29, 28, 16, 11, 13, 12, 30, 32, 31, 18, 0, 18, 15, 5, 19, 37, 34, 24,18, 6, 17, 4, 5, 25, 36, 23, 24, 18, 3, 13, 16, 14, 22, 32, 35, 33, 18, 13, 10, 7, 16, 32, 29, 26, 35};
+ const mcIdType invalidCells[4]={2,3,6,7};
MEDCouplingUMesh *m=MEDCouplingUMesh::New("Example",3);
DataArrayDouble *coo=DataArrayDouble::New();
coo->alloc(38,3);
m->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+48);
m->finishInsertingCells();
//
- DataArrayInt *v=m->findAndCorrectBadOriented3DExtrudedCells();
+ DataArrayIdType *v=m->findAndCorrectBadOriented3DExtrudedCells();
CPPUNIT_ASSERT_EQUAL(4,(int)v->getNumberOfTuples());
CPPUNIT_ASSERT(std::equal(v->begin(),v->end(),invalidCells));
CPPUNIT_ASSERT(std::equal(connExp,connExp+64,m->getNodalConnectivity()->getConstPointer()));
void MEDCouplingBasicsTest4::testConvertExtrudedPolyhedra1()
{
- const int conn[72]={1,2,3,4, 5,6,7,8,9,10,11,12, 13,14,15,16, 17,18,19,20,21,22, 23,24,25,26,27,28, 29,30,31,32,33,34,35,36,37,38, 39,40,41,42,43,44,45,46, 47,48,49,50,51,52,53,54,55,56,57,58, 59,60,61,62,63,64,65,66,67,68,69,70,71,72};
+ const mcIdType conn[72]={1,2,3,4, 5,6,7,8,9,10,11,12, 13,14,15,16, 17,18,19,20,21,22, 23,24,25,26,27,28, 29,30,31,32,33,34,35,36,37,38, 39,40,41,42,43,44,45,46, 47,48,49,50,51,52,53,54,55,56,57,58, 59,60,61,62,63,64,65,66,67,68,69,70,71,72};
MEDCouplingUMesh *m=MEDCouplingUMesh::New("Example",3);
DataArrayDouble *coo=DataArrayDouble::New();
coo->alloc(73,3);
m->finishInsertingCells();
//
m->convertExtrudedPolyhedra();
- DataArrayInt *da=m->getNodalConnectivity();
- DataArrayInt *dai=m->getNodalConnectivityIndex();
- CPPUNIT_ASSERT_EQUAL((std::size_t)10,dai->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)159,da->getNbOfElems());
+ DataArrayIdType *da=m->getNodalConnectivity();
+ DataArrayIdType *dai=m->getNodalConnectivityIndex();
+ CPPUNIT_ASSERT_EQUAL(ToIdType(10),dai->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(159),da->getNbOfElems());
//
- const int expected1[159]={14,1,2,3,4,
+ const mcIdType expected1[159]={14,1,2,3,4,
18,5,6,7,8,9,10,11,12,
14,13,14,15,16,
31,17,18,19,-1,20,22,21,-1,17,20,21,18,-1,18,21,22,19,-1,19,22,20,17,
18,39,40,41,42,43,44,45,46,
22,47,48,49,50,51,52,53,54,55,56,57,58,
31,59,60,61,62,63,64,65,-1,66,72,71,70,69,68,67,-1,59,66,67,60,-1,60,67,68,61,-1,61,68,69,62,-1,62,69,70,63,-1,63,70,71,64,-1,64,71,72,65,-1,65,72,66,59};
- const int expected2[10]={0,5,14,19,42,49,86,95,108,159};
+ const mcIdType expected2[10]={0,5,14,19,42,49,86,95,108,159};
CPPUNIT_ASSERT(std::equal(expected1,expected1+159,da->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+10,dai->getConstPointer()));
m->checkConsistency();
{
const double tab1[18]={3.,4.,5., 13.,14.,15., 23.,24.,25., 33.,34.,35., 43.,44.,45., 53.,54.,55.};
const double tab2[9]={6.,7.,8., 16.,17.,18., 26.,27.,28.};
- const int tab3[6]={4,1, 2,2, 3,0};
+ const mcIdType tab3[6]={4,1, 2,2, 3,0};
DataArrayDouble *a=DataArrayDouble::New();
a->alloc(6,3);
std::copy(tab1,tab1+18,a->getPointer());
DataArrayDouble *b=DataArrayDouble::New();
b->alloc(3,3);
std::copy(tab2,tab2+9,b->getPointer());
- DataArrayInt *c=DataArrayInt::New();
+ DataArrayIdType *c=DataArrayIdType::New();
c->alloc(3,2);
std::copy(tab3,tab3+6,c->getPointer());
//
//
m=MEDCouplingUMesh::New("toto",2);
m2=m->buildSetInstanceFromThis(3);
- CPPUNIT_ASSERT_EQUAL(0,m2->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(0,(int)m2->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(0,(int)m2->getNumberOfCells());
m->decrRef();
m2->decrRef();
coordsZ->decrRef();
MEDCouplingMesh *mesh2=mesh->deepCopy();
//
- static const int ids1[9]={0,1,2,10,11,12,20,21,22};
- for(const int *myId=ids1;myId!=ids1+9;myId++)
+ static const mcIdType ids1[9]={0,1,2,10,11,12,20,21,22};
+ for(const mcIdType *myId=ids1;myId!=ids1+9;myId++)
{
MEDCouplingFieldDouble *f=mesh->getMeasureField(true);
f->changeUnderlyingMesh(mesh2,*myId,1e-12);
f->decrRef();
}
mesh2->setName("uuuu");
- for(const int *myId=ids1+1;myId!=ids1+9;myId++)
+ for(const mcIdType *myId=ids1+1;myId!=ids1+9;myId++)
{
MEDCouplingFieldDouble *f=mesh->getMeasureField(true);
f->changeUnderlyingMesh(mesh2,*myId,1e-12);
da->alloc(6,1);
const double array1[6]={2.3,1.2,1.3,2.3,2.301,0.8};
std::copy(array1,array1+6,da->getPointer());
- DataArrayInt *c=0,*cI=0;
+ DataArrayIdType *c=0,*cI=0;
// nbOftuples=1
da->findCommonTuples(1e-2,-1,c,cI);
- const int expected1[3]={0,3,4};
- const int expected2[2]={0,3};
- CPPUNIT_ASSERT_EQUAL((std::size_t)3,c->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)2,cI->getNbOfElems());
+ const mcIdType expected1[3]={0,3,4};
+ const mcIdType expected2[2]={0,3};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),c->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),cI->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+2,cI->getConstPointer()));
c->decrRef();
cI->decrRef();
//
da->findCommonTuples(2e-1,-1,c,cI);
- const int expected3[5]={0,3,4,1,2};
- const int expected4[3]={0,3,5};
- CPPUNIT_ASSERT_EQUAL((std::size_t)5,c->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)3,cI->getNbOfElems());
+ const mcIdType expected3[5]={0,3,4,1,2};
+ const mcIdType expected4[3]={0,3,5};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),c->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),cI->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected3,expected3+5,c->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected4,expected4+3,cI->getConstPointer()));
c->decrRef();
const double array2[12]={2.3,2.3,1.2,1.2,1.3,1.3,2.3,2.3,2.301,2.301,0.8,0.8};
std::copy(array2,array2+12,da->getPointer());
da->findCommonTuples(1e-2,-1,c,cI);
- CPPUNIT_ASSERT_EQUAL((std::size_t)3,c->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)2,cI->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),c->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),cI->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+2,cI->getConstPointer()));
c->decrRef();
cI->decrRef();
//
da->findCommonTuples(2e-1,-1,c,cI);
- CPPUNIT_ASSERT_EQUAL((std::size_t)5,c->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)3,cI->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),c->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),cI->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected3,expected3+5,c->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected4,expected4+3,cI->getConstPointer()));
c->decrRef();
const double array3[18]={2.3,2.3,2.3,1.2,1.2,1.2,1.3,1.3,1.3,2.3,2.3,2.3,2.301,2.301,2.301,0.8,0.8,0.8};
std::copy(array3,array3+18,da->getPointer());
da->findCommonTuples(1e-2,-1,c,cI);
- CPPUNIT_ASSERT_EQUAL((std::size_t)3,c->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)2,cI->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),c->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),cI->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+2,cI->getConstPointer()));
c->decrRef();
cI->decrRef();
//
da->findCommonTuples(2e-1,-1,c,cI);
- CPPUNIT_ASSERT_EQUAL((std::size_t)5,c->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)3,cI->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),c->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),cI->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected3,expected3+5,c->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected4,expected4+3,cI->getConstPointer()));
c->decrRef();
std::copy(array11,array11+6,da->getPointer());
// nbOftuples=1, no common groups
da->findCommonTuples(1e-2,-1,c,cI);
- CPPUNIT_ASSERT_EQUAL((std::size_t)0,c->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)1,cI->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(0,cI->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),c->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),cI->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),cI->getIJ(0,0));
da->alloc(6,5); //bad NumberOfComponents
CPPUNIT_ASSERT_THROW(da->findCommonTuples(1e-2,-1,c,cI),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(da->back(),INTERP_KERNEL::Exception);
da->decrRef();
//
- DataArrayInt *da2=DataArrayInt::New();
+ DataArrayIdType *da2=DataArrayIdType::New();
da2->alloc(4,1);
- const int array2[4]={4,7,8,2};
+ const mcIdType array2[4]={4,7,8,2};
std::copy(array2,array2+4,da2->getPointer());
- CPPUNIT_ASSERT_EQUAL(2,da2->back());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),da2->back());
da2->rearrange(2);
CPPUNIT_ASSERT_THROW(da2->back(),INTERP_KERNEL::Exception);
da2->alloc(0,1);
//
const double expected1[4]={2.301,1.2,1.3,0.8};
DataArrayDouble *dv=da->getDifferentValues(1e-2);
- CPPUNIT_ASSERT_EQUAL((std::size_t)4,dv->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(4),dv->getNbOfElems());
for(int i=0;i<4;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],dv->getIJ(i,0),1e-14);
dv->decrRef();
//
dv=da->getDifferentValues(2e-1);
const double expected2[3]={2.301,1.3,0.8};
- CPPUNIT_ASSERT_EQUAL((std::size_t)3,dv->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),dv->getNbOfElems());
for(int i=0;i<3;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],dv->getIJ(i,0),1e-14);
dv->decrRef();
void MEDCouplingBasicsTest4::testDAIBuildOld2NewArrayFromSurjectiveFormat2()
{
- const int arr[5]={0,3, 5,7,9};
- const int arrI[3]={0,2,5};
- DataArrayInt *a=DataArrayInt::New();
+ const mcIdType arr[5]={0,3, 5,7,9};
+ const mcIdType arrI[3]={0,2,5};
+ DataArrayIdType *a=DataArrayIdType::New();
a->alloc(5,1);
std::copy(arr,arr+5,a->getPointer());
- DataArrayInt *b=DataArrayInt::New();
+ DataArrayIdType *b=DataArrayIdType::New();
b->alloc(3,1);
std::copy(arrI,arrI+3,b->getPointer());
- int newNbTuple=-1;
- DataArrayInt *ret=DataArrayInt::ConvertIndexArrayToO2N(10,a->begin(),b->begin(),b->end(),newNbTuple);
- const int expected[10]={0,1,2,0,3,4,5,4,6,4};
- CPPUNIT_ASSERT_EQUAL((std::size_t)10,ret->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(7,newNbTuple);
- CPPUNIT_ASSERT_EQUAL(1,(int)ret->getNumberOfComponents());
+ mcIdType newNbTuple=-1;
+ DataArrayIdType *ret=DataArrayIdType::ConvertIndexArrayToO2N(10,a->begin(),b->begin(),b->end(),newNbTuple);
+ const mcIdType expected[10]={0,1,2,0,3,4,5,4,6,4};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(10),ret->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(7),newNbTuple);
+ CPPUNIT_ASSERT_EQUAL(1,(int)ret->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(expected,expected+10,ret->getConstPointer()));
- CPPUNIT_ASSERT_THROW(DataArrayInt::ConvertIndexArrayToO2N(9,a->begin(),b->begin(),b->end(),newNbTuple),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(DataArrayIdType::ConvertIndexArrayToO2N(9,a->begin(),b->begin(),b->end(),newNbTuple),INTERP_KERNEL::Exception);
ret->decrRef();
b->decrRef();
a->decrRef();
void MEDCouplingBasicsTest4::testDADIReverse1()
{
- const int arr[6]={0,3,5,7,9,2};
- DataArrayInt *a=DataArrayInt::New();
+ const mcIdType arr[6]={0,3,5,7,9,2};
+ DataArrayIdType *a=DataArrayIdType::New();
a->alloc(6,1);
std::copy(arr,arr+6,a->getPointer());
- CPPUNIT_ASSERT_EQUAL(2,a->back());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),a->back());
a->reverse();
for(int i=0;i<6;i++)
CPPUNIT_ASSERT_EQUAL(arr[5-i],a->getIJ(i,0));
void MEDCouplingBasicsTest4::testGetNodeIdsInUse1()
{
MEDCouplingUMesh *m0=build2DTargetMesh_1();
- const int CellIds[2]={1,2};
+ const mcIdType CellIds[2]={1,2};
MEDCouplingUMesh *m1=static_cast<MEDCouplingUMesh *>(m0->buildPartOfMySelf(CellIds,CellIds+2,true));
- int newNbOfNodes=-1;
- DataArrayInt *arr=m1->getNodeIdsInUse(newNbOfNodes);
- const int expected[9]={-1,0,1,-1,2,3,-1,-1,-1};
- CPPUNIT_ASSERT_EQUAL(4,newNbOfNodes);
- CPPUNIT_ASSERT_EQUAL((std::size_t)9,arr->getNbOfElems());
+ mcIdType newNbOfNodes=-1;
+ DataArrayIdType *arr=m1->getNodeIdsInUse(newNbOfNodes);
+ const mcIdType expected[9]={-1,0,1,-1,2,3,-1,-1,-1};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(4),newNbOfNodes);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(9),arr->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected,expected+9,arr->getConstPointer()));
- DataArrayInt *arr2=arr->invertArrayO2N2N2O(newNbOfNodes);
- CPPUNIT_ASSERT_EQUAL((std::size_t)4,arr2->getNbOfElems());
- const int expected2[4]={1,2,4,5};
+ DataArrayIdType *arr2=arr->invertArrayO2N2N2O(newNbOfNodes);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(4),arr2->getNbOfElems());
+ const mcIdType expected2[4]={1,2,4,5};
CPPUNIT_ASSERT(std::equal(expected2,expected2+4,arr2->getConstPointer()));
arr2->decrRef();
arr->decrRef();
void MEDCouplingBasicsTest4::testBuildDescendingConnec2()
{
MEDCouplingUMesh *mesh=build2DTargetMesh_1();
- DataArrayInt *desc=DataArrayInt::New();
- DataArrayInt *descIndx=DataArrayInt::New();
- DataArrayInt *revDesc=DataArrayInt::New();
- DataArrayInt *revDescIndx=DataArrayInt::New();
+ DataArrayIdType *desc=DataArrayIdType::New();
+ DataArrayIdType *descIndx=DataArrayIdType::New();
+ DataArrayIdType *revDesc=DataArrayIdType::New();
+ DataArrayIdType *revDescIndx=DataArrayIdType::New();
//
MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity2(desc,descIndx,revDesc,revDescIndx);
mesh2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(13,(int)mesh2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,(int)revDescIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)descIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)desc->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)revDesc->getNumberOfTuples());
- const int expected1[18]={1,2,3,4,-3,5,6, 7,8,-5,9,10,-2,11, 12,13,-7,-10};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(14),revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,(int)revDescIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(6),descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)descIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(18),desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)desc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(18),revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)revDesc->getNumberOfTuples());
+ const mcIdType expected1[18]={1,2,3,4,-3,5,6, 7,8,-5,9,10,-2,11, 12,13,-7,-10};
CPPUNIT_ASSERT(std::equal(expected1,expected1+18,desc->getConstPointer()));
- const int expected2[6]={0,4,7,10,14,18};
+ const mcIdType expected2[6]={0,4,7,10,14,18};
CPPUNIT_ASSERT(std::equal(expected2,expected2+6,descIndx->getConstPointer()));
- const int expected3[14]={0,1,3,5,6,8,9,11,12,13,15,16,17,18};
+ const mcIdType expected3[14]={0,1,3,5,6,8,9,11,12,13,15,16,17,18};
CPPUNIT_ASSERT(std::equal(expected3,expected3+14,revDescIndx->getConstPointer()));
- const int expected4[18]={0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4};
+ const mcIdType expected4[18]={0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4};
CPPUNIT_ASSERT(std::equal(expected4,expected4+18,revDesc->getConstPointer()));
- DataArrayInt *conn=mesh2->getNodalConnectivity();
- DataArrayInt *connIndex=mesh2->getNodalConnectivityIndex();
- const int expected5[14]={0,3,6,9,12,15,18,21,24,27,30,33,36,39};
+ DataArrayIdType *conn=mesh2->getNodalConnectivity();
+ DataArrayIdType *connIndex=mesh2->getNodalConnectivityIndex();
+ const mcIdType expected5[14]={0,3,6,9,12,15,18,21,24,27,30,33,36,39};
CPPUNIT_ASSERT(std::equal(expected5,expected5+14,connIndex->getConstPointer()));
- const int expected6[39]={1, 0, 3, 1, 3, 4, 1, 4, 1, 1, 1, 0, 1, 4, 2, 1, 2, 1, 1, 4, 5, 1, 5, 2, 1, 6, 7, 1, 7, 4, 1, 3, 6, 1, 7, 8, 1, 8, 5};
+ const mcIdType expected6[39]={1, 0, 3, 1, 3, 4, 1, 4, 1, 1, 1, 0, 1, 4, 2, 1, 2, 1, 1, 4, 5, 1, 5, 2, 1, 6, 7, 1, 7, 4, 1, 3, 6, 1, 7, 8, 1, 8, 5};
CPPUNIT_ASSERT(std::equal(expected6,expected6+39,conn->getConstPointer()));
//
desc->decrRef();
std::copy(arrY,arrY+4,coordY->getPointer());
m1c->setCoordsAt(1,coordY);
MEDCouplingUMesh *m1=m1c->buildUnstructured();
- const int subPart1[3]={3,4,5};
+ const mcIdType subPart1[3]={3,4,5};
MEDCouplingUMesh *m1bis=static_cast<MEDCouplingUMesh *>(m1->buildPartOfMySelf(subPart1,subPart1+3,false));
MEDCouplingUMesh *m2tmp=static_cast<MEDCouplingUMesh *>(m1->deepCopy());
- const int subPart2[3]={0,1,2};
+ const mcIdType subPart2[3]={0,1,2};
MEDCouplingUMesh *m2=static_cast<MEDCouplingUMesh *>(m2tmp->buildPartOfMySelf(subPart2,subPart2+3,false));
const double vec[2]={0.5,0.5};
m2->translate(vec);
// End of construction of input meshes m1bis and m2 -> start of specific part of the test
- DataArrayInt *d1=0,*d2=0;
+ DataArrayIdType *d1=0,*d2=0;
MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1bis,m2,1e-10,d1,d2);
- const int expected1[8]={0,0,1,1,1,2,2,2};
- const int expected2[8]={0,-1,0,1,-1,1,2,-1};
+ const mcIdType expected1[8]={0,0,1,1,1,2,2,2};
+ const mcIdType expected2[8]={0,-1,0,1,-1,1,2,-1};
CPPUNIT_ASSERT_EQUAL(8,(int)d1->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(8,(int)d2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(8,(int)m3->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(22,m3->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(22,(int)m3->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,m3->getSpaceDimension());
CPPUNIT_ASSERT(std::equal(expected1,expected1+8,d1->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+8,d2->getConstPointer()));
- const int expected3[44]={5,17,1,16,12,5,16,0,4,5,17,12,5,18,1,17,13,5,19,2,18,13,5,17,5,6,19,13,5,20,2,19,14,5,21,3,20,14,5,19,6,7,21,14};
- const int expected4[9]={0,5,12,17,22,28,33,38,44};
+ const mcIdType expected3[44]={5,17,1,16,12,5,16,0,4,5,17,12,5,18,1,17,13,5,19,2,18,13,5,17,5,6,19,13,5,20,2,19,14,5,21,3,20,14,5,19,6,7,21,14};
+ const mcIdType expected4[9]={0,5,12,17,22,28,33,38,44};
const double expected5[44]={-1.0,2.0,1.0,2.0,2.0,2.0,4.0,2.0,-1.0,4.0,1.0,4.0,2.0,4.0,4.0,4.0,-0.5,-1.5,1.5,-1.5,2.5,-1.5,4.5,-1.5,-0.5,2.5,1.5,2.5,2.5,2.5,4.5,2.5,-0.5,2.0,1.0,2.5,1.5,2.0,2.0,2.5,2.5,2.0,4.0,2.5};
CPPUNIT_ASSERT_EQUAL(44,(int)m3->getNodalConnectivity()->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(9,(int)m3->getNodalConnectivityIndex()->getNumberOfTuples());
const double vec[2]={0.,1.};
const double vec2[3]={1.,0.,0.};
const double vec3[3]={0.,1.,1.};
- const int expected1[3]={0,3,6};
- std::vector<int> res;
+ const mcIdType expected1[3]={0,3,6};
+ std::vector<mcIdType> res;
mesh->findNodesOnLine(pt,vec,1e-12,res);
CPPUNIT_ASSERT_EQUAL(3,(int)res.size());
CPPUNIT_ASSERT(std::equal(expected1,expected1+3,res.begin()));
m2c->setCoordsAt(1,coordsY2);
MEDCouplingUMesh *m2=m2c->buildUnstructured();
//
- DataArrayInt *d1=0,*d2=0;
+ DataArrayIdType *d1=0,*d2=0;
MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2);
- const int expected1[9]={0,0,1,1,2,2,3,4,5};
- const int expected2[9]={0,2,1,3,1,3,2,3,3};
+ const mcIdType expected1[9]={0,0,1,1,2,2,3,4,5};
+ const mcIdType expected2[9]={0,2,1,3,1,3,2,3,3};
CPPUNIT_ASSERT_EQUAL(9,(int)d1->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(9,(int)d2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(9,(int)m3->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(22,m3->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(22,(int)m3->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,m3->getSpaceDimension());
CPPUNIT_ASSERT(std::equal(expected1,expected1+9,d1->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+9,d2->getConstPointer()));
- const int expected3[45]={5,16,13,12,15,5,15,4,5,16,5,21,2,13,16,5,16,5,6,21,5,17,14,2,21,5,21,6,7,17,5,4,18,19,5,5,5,19,10,6,5,6,10,20,7};
- const int expected4[10]={0,5,10,15,20,25,30,35,40,45};
+ const mcIdType expected3[45]={5,16,13,12,15,5,15,4,5,16,5,21,2,13,16,5,16,5,6,21,5,17,14,2,21,5,21,6,7,17,5,4,18,19,5,5,5,19,10,6,5,6,10,20,7};
+ const mcIdType expected4[10]={0,5,10,15,20,25,30,35,40,45};
const double expected5[44]={0.0,0.0,1.0,0.0,1.5,0.0,2.0,0.0,0.0,1.5,1.0,1.5,1.5,1.5,2.0,1.5,0.0,3.0,1.0,3.0,1.5,3.0,2.0,3.0,0.0,0.0,1.0,0.0,2.0,0.0,0.0,1.0,1.0,1.0,2.0,1.0,0.0,3.0,1.0,3.0,2.0,3.0,1.5,1.0};
CPPUNIT_ASSERT_EQUAL(45,(int)m3->getNodalConnectivity()->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(10,(int)m3->getNodalConnectivityIndex()->getNumberOfTuples());
void MEDCouplingBasicsTest4::testBuildPartOfMySelfSafe1()
{
MEDCouplingUMesh *mesh=build2DTargetMesh_1();
- const int input1[4]={0,-1,4,2};
- const int input2[4]={0,4,5,4};
+ const mcIdType input1[4]={0,-1,4,2};
+ const mcIdType input2[4]={0,4,5,4};
CPPUNIT_ASSERT_THROW(mesh->buildPartOfMySelf(input1,input1+4,true),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(mesh->buildPartOfMySelf(input2,input2+4,true),INTERP_KERNEL::Exception);
mesh->decrRef();
void MEDCouplingBasicsTest4::testIntersect2DMeshesTmp3()
{
double m1Coords[50]={0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1,0.,-1.5,0.5,0.,1.25,0.,0.70710678118654757,0.70710678118654757,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.70710678118654757,0.70710678118654757,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.70710678118654757,-0.70710678118654757,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.70710678118654757,-0.70710678118654757,1.0606601717798214,-1.0606601717798214};
- int m1Conn[56]={0,3,1,13,11,9, 3,4,2,1,14,12,10,11, 5,3,0,15,13,17, 6,4,3,5,16,14,15,18, 5,0,7,17,21,19, 6,5,7,8,18,19,22,20, 0,1,7,9,23,21, 1,2,8,7,10,24,22,23};
+ mcIdType m1Conn[56]={0,3,1,13,11,9, 3,4,2,1,14,12,10,11, 5,3,0,15,13,17, 6,4,3,5,16,14,15,18, 5,0,7,17,21,19, 6,5,7,8,18,19,22,20, 0,1,7,9,23,21, 1,2,8,7,10,24,22,23};
MEDCouplingUMesh *m1=MEDCouplingUMesh::New();
m1->setMeshDimension(2);
m1->allocateCells(8);
myCoords1->decrRef();
//
double m2Coords[30]={0.,0.,1.1,0.,1.1,1.,0.,1.,1.7,0.,1.7,1.,-1.1,1.,-1.1,0.,-1.7,0.,-1.7,1.,-1.7,-1,-1.1,-1.,0.,-1.,1.1,-1,1.7,-1.};
- int m2Conn[32]={0,3,2,1, 1,2,5,4, 7,6,3,0, 8,9,6,7, 7,0,12,11, 8,7,11,10, 0,1,13,12, 1,4,14,13};
+ mcIdType m2Conn[32]={0,3,2,1, 1,2,5,4, 7,6,3,0, 8,9,6,7, 7,0,12,11, 8,7,11,10, 0,1,13,12, 1,4,14,13};
MEDCouplingUMesh *m2=MEDCouplingUMesh::New();
m2->setMeshDimension(2);
m2->allocateCells(8);
m2->setCoords(myCoords2);
myCoords2->decrRef();
//
- DataArrayInt *d1=0,*d2=0;
+ DataArrayIdType *d1=0,*d2=0;
MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2);
m3->unPolyze();
- const int expected1[16]={0,1,1,1,2,3,3,3,4,5,5,5,6,7,7,7};
- const int expected2[16]={0,0,1,-1,2,2,3,-1,4,4,5,-1,6,6,7,-1};
- CPPUNIT_ASSERT_EQUAL(16,(int)d1->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(16,(int)d2->getNumberOfTuples());
+ const mcIdType expected1[16]={0,1,1,1,2,3,3,3,4,5,5,5,6,7,7,7};
+ const mcIdType expected2[16]={0,0,1,-1,2,2,3,-1,4,4,5,-1,6,6,7,-1};
+ CPPUNIT_ASSERT_EQUAL(16,(int)d1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(16,(int)d2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(16,(int)m3->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(104,m3->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(104,(int)m3->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,m3->getSpaceDimension());
CPPUNIT_ASSERT(std::equal(expected1,expected1+16,d1->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+16,d2->getConstPointer()));
- const int expected3[136]={6,28,1,25,44,45,46,8,26,1,28,27,47,48,49,50,8,40,2,26,27,51,52,53,54,8,28,4,40,27,55,56,57,58,6,28,25,5,59,60,61,8,28,5,32,31,62,63,64,65,8,32,6,41,31,66,67,68,69,8,41,4,28,31,70,71,72,73,6,25,37,5,74,75,76,8,32,5,37,36,77,78,79,80,8,42,6,32,36,81,82,83,84,8,37,8,42,36,85,86,87,88,6,1,37,25,89,90,91,8,37,1,26,38,92,93,94,95,8,26,2,43,38,96,97,98,99,8,43,8,37,38,100,101,102,103};
- const int expected4[17]={0,7,16,25,34,41,50,59,68,75,84,93,102,109,118,127,136};
+ const mcIdType expected3[136]={6,28,1,25,44,45,46,8,26,1,28,27,47,48,49,50,8,40,2,26,27,51,52,53,54,8,28,4,40,27,55,56,57,58,6,28,25,5,59,60,61,8,28,5,32,31,62,63,64,65,8,32,6,41,31,66,67,68,69,8,41,4,28,31,70,71,72,73,6,25,37,5,74,75,76,8,32,5,37,36,77,78,79,80,8,42,6,32,36,81,82,83,84,8,37,8,42,36,85,86,87,88,6,1,37,25,89,90,91,8,37,1,26,38,92,93,94,95,8,26,2,43,38,96,97,98,99,8,43,8,37,38,100,101,102,103};
+ const mcIdType expected4[17]={0,7,16,25,34,41,50,59,68,75,84,93,102,109,118,127,136};
const double expected5[208]={0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1.,0.,-1.5,0.5,0.,1.25,0.,0.7071067811865476,0.7071067811865476,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.7071067811865476,0.7071067811865476,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.7071067811865476,-0.7071067811865476,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.7071067811865476,-0.7071067811865476,1.0606601717798214,-1.0606601717798214,0.,0.,1.1,0.,1.1,1.,0.,1.,1.7,0.,1.7,1.,-1.1,1.,-1.1,0.,-1.7,0.,-1.7,1.,-1.7,-1.,-1.1,-1.,0.,-1.,1.1,-1.,1.7,-1.,1.118033988749895,1.,-1.118033988749895,1.,-1.118033988749895,-1.,1.118033988749895,-1.,0.7071067811865477,0.7071067811865476,0.5,0.,0.,0.5,1.05,0.,0.7071067811865475,0.7071067811865477,0.55,1.,1.1,0.5,1.4012585384440737,0.535233134659635,1.3,0.,1.1,0.5,1.1090169943749475,1.,0.,1.25,0.6123724356957946,1.369306393762915,1.1090169943749475,1.,0.55,1.,0.,0.5,-0.5,0.,-0.7071067811865477,0.7071067811865476,-0.7071067811865475,0.7071067811865477,-1.05,0.,-1.1,0.5,-0.55,1.,-1.3,0.,-1.4012585384440737,0.5352331346596344,-1.1090169943749475,1.,-1.1,0.5,-0.6123724356957941,1.3693063937629155,0.,1.25,-0.55,1.,-1.1090169943749475,1.,0.,-0.5,-0.7071067811865475,-0.7071067811865477,-0.5,0.,-1.05,0.,-0.7071067811865478,-0.7071067811865475,-0.55,-1.,-1.1,-0.5,-1.4012585384440734,-0.5352331346596354,-1.3,0.,-1.1,-0.5,-1.1090169943749475,-1.,0.,-1.25,-0.6123724356957945,-1.369306393762915,-1.1090169943749475,-1.,-0.55,-1.,0.7071067811865475,-0.7071067811865477,0.,-0.5,0.5,0.,0.7071067811865477,-0.7071067811865475,1.05,0.,1.1,-0.5,0.55,-1.,1.3,0.,1.4012585384440737,-0.535233134659635,1.1090169943749475,-1.,1.1,-0.5,0.6123724356957946,-1.369306393762915,0.,-1.25,0.55,-1.,1.1090169943749475,-1.0};
CPPUNIT_ASSERT_EQUAL(136,(int)m3->getNodalConnectivity()->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(17,(int)m3->getNodalConnectivityIndex()->getNumberOfTuples());
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDCouplingGaussLocalization.hxx"
#include "MEDCouplingMultiFields.hxx"
#include "MEDCouplingFieldOverTime.hxx"
void MEDCouplingBasicsTest5::testUMeshTessellate2D1()
{
double m1Coords[50]={0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1,0.,-1.5,0.5,0.,1.25,0.,0.70710678118654757,0.70710678118654757,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.70710678118654757,0.70710678118654757,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.70710678118654757,-0.70710678118654757,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.70710678118654757,-0.70710678118654757,1.0606601717798214,-1.0606601717798214};
- int m1Conn[56]={0,3,1,13,11,9, 3,4,2,1,14,12,10,11, 5,3,0,15,13,17, 6,4,3,5,16,14,15,18, 5,0,7,17,21,19, 6,5,7,8,18,19,22,20, 0,1,7,9,23,21, 1,2,8,7,10,24,22,23};
+ mcIdType m1Conn[56]={0,3,1,13,11,9, 3,4,2,1,14,12,10,11, 5,3,0,15,13,17, 6,4,3,5,16,14,15,18, 5,0,7,17,21,19, 6,5,7,8,18,19,22,20, 0,1,7,9,23,21, 1,2,8,7,10,24,22,23};
MEDCouplingUMesh *m1=MEDCouplingUMesh::New();
m1->setMeshDimension(2);
m1->allocateCells(8);
MEDCouplingUMesh *m11=static_cast<MEDCouplingUMesh *>(m1->deepCopy());
m11->tessellate2D(1.);
CPPUNIT_ASSERT(m11->getCoords()->isEqual(*m11->getCoords(),1e-12));
- const int expected1[48]={5,0,3,11,1,5,3,4,12,2,1,11,5,5,15,3,0,5,6,16,4,3,15,5,5,5,0,7,19,5,6,5,19,7,8,20,5,0,1,23,7,5,1,2,24,8,7,23};
- const int expected2[9]={0,5,12,17,24,29,36,41,48};
+ const mcIdType expected1[48]={5,0,3,11,1,5,3,4,12,2,1,11,5,5,15,3,0,5,6,16,4,3,15,5,5,5,0,7,19,5,6,5,19,7,8,20,5,0,1,23,7,5,1,2,24,8,7,23};
+ const mcIdType expected2[9]={0,5,12,17,24,29,36,41,48};
CPPUNIT_ASSERT_EQUAL(48,(int)m11->getNodalConnectivity()->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(9,(int)m11->getNodalConnectivityIndex()->getNumberOfTuples());
CPPUNIT_ASSERT(std::equal(expected1,expected1+48,m11->getNodalConnectivity()->getConstPointer()));
//
MEDCouplingUMesh *m12=static_cast<MEDCouplingUMesh *>(m1->deepCopy());
m12->tessellate2D(0.5);
- CPPUNIT_ASSERT_EQUAL(41,m12->getNumberOfNodes());
- const int expected3[60]={5,0,3,25,26,1,5,3,4,27,28,2,1,26,25,5,5,29,30,3,0,5,6,31,32,4,3,30,29,5,5,5,0,7,33,34,5,6,5,34,33,7,8,35,36,5,0,1,37,38,7,5,1,2,39,40,8,7,38,37};
- const int expected4[9]={0,6,15,21,30,36,45,51,60};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(41),m12->getNumberOfNodes());
+ const mcIdType expected3[60]={5,0,3,25,26,1,5,3,4,27,28,2,1,26,25,5,5,29,30,3,0,5,6,31,32,4,3,30,29,5,5,5,0,7,33,34,5,6,5,34,33,7,8,35,36,5,0,1,37,38,7,5,1,2,39,40,8,7,38,37};
+ const mcIdType expected4[9]={0,6,15,21,30,36,45,51,60};
const double expected5[82]={0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1.,0.,-1.5,0.5,0.,1.25,0.,0.7071067811865476,0.7071067811865476,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.7071067811865476,0.7071067811865476,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.7071067811865476,-0.7071067811865476,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.7071067811865476,-0.7071067811865476,1.0606601717798214,-1.0606601717798214,0.479425538604203,0.8775825618903728,0.8414709848078964,0.54030230586814,0.7191383079063044,1.3163738428355591,1.2622064772118446,0.8104534588022099,-0.877582561890373,0.4794255386042027,-0.5403023058681399,0.8414709848078964,-1.3163738428355596,0.7191383079063038,-0.8104534588022098,1.2622064772118446,-0.4794255386042031,-0.8775825618903728,-0.8414709848078965,-0.5403023058681399,-0.7191383079063045,-1.3163738428355591,-1.2622064772118449,-0.8104534588022098,0.8775825618903729,-0.47942553860420295,0.54030230586814,-0.8414709848078964,1.3163738428355594,-0.7191383079063043,0.8104534588022099,-1.2622064772118446};
for(int i=0;i<82;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected5[i],m12->getCoords()->getIJ(0,i),1e-12);
{
// A quarter of circle:
double mcoords[6] = {0.4,0.0, 0.0,-0.4, 0.283,-0.283};
- int mconnec[3] = {0,1,2};
+ mcIdType mconnec[3] = {0,1,2};
MEDCouplingUMesh *m1 = MEDCouplingUMesh::New();
m1->setMeshDimension(1);
void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp4()
{
double m1Coords[50]={0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1,0.,-1.5,0.5,0.,1.25,0.,0.70710678118654757,0.70710678118654757,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.70710678118654757,0.70710678118654757,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.70710678118654757,-0.70710678118654757,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.70710678118654757,-0.70710678118654757,1.0606601717798214,-1.0606601717798214};
- int m1Conn[56]={0,3,1,13,11,9, 3,4,2,1,14,12,10,11, 5,3,0,15,13,17, 6,4,3,5,16,14,15,18, 5,0,7,17,21,19, 6,5,7,8,18,19,22,20, 0,1,7,9,23,21, 1,2,8,7,10,24,22,23};
+ mcIdType m1Conn[56]={0,3,1,13,11,9, 3,4,2,1,14,12,10,11, 5,3,0,15,13,17, 6,4,3,5,16,14,15,18, 5,0,7,17,21,19, 6,5,7,8,18,19,22,20, 0,1,7,9,23,21, 1,2,8,7,10,24,22,23};
MEDCouplingUMesh *m1=MEDCouplingUMesh::New();
m1->setMeshDimension(2);
m1->allocateCells(8);
myCoords1->decrRef();
//
double m2Coords[30]={0.,0.,1.1,0.,1.1,1.,0.,1.,1.7,0.,1.7,1.,-1.1,1.,-1.1,0.,-1.7,0.,-1.7,1.,-1.7,-1,-1.1,-1.,0.,-1.,1.1,-1,1.7,-1.};
- int m2Conn[32]={0,3,2,1, 1,2,5,4, 7,6,3,0, 8,9,6,7, 7,0,12,11, 8,7,11,10, 0,1,13,12, 1,4,14,13};
+ mcIdType m2Conn[32]={0,3,2,1, 1,2,5,4, 7,6,3,0, 8,9,6,7, 7,0,12,11, 8,7,11,10, 0,1,13,12, 1,4,14,13};
MEDCouplingUMesh *m2=MEDCouplingUMesh::New();
m2->setMeshDimension(2);
m2->allocateCells(8);
m2->setCoords(myCoords2);
myCoords2->decrRef();
//
- DataArrayInt *d1=0,*d2=0;
+ DataArrayIdType *d1=0,*d2=0;
MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m2,m1,1e-10,d1,d2);
m3->unPolyze();
- const int expected1[16]={0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7};
- const int expected2[16]={0,1,1,-1,2,3,3,-1,4,5,5,-1,6,7,7,-1};
+ const mcIdType expected1[16]={0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7};
+ const mcIdType expected2[16]={0,1,1,-1,2,3,3,-1,4,5,5,-1,6,7,7,-1};
CPPUNIT_ASSERT_EQUAL(16,(int)d1->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(16,(int)d2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(16,(int)m3->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(104,m3->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(104,(int)m3->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,m3->getSpaceDimension());
CPPUNIT_ASSERT(std::equal(expected1,expected1+16,d1->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+16,d2->getConstPointer()));
- const int expected3[136]={6,16,15,18,44,45,46,8,18,2,1,16,47,48,49,50,8,17,1,2,40,51,52,53,54,8,40,5,4,17,55,56,57,58,6,18,15,20,59,60,61,8,20,7,6,18,62,63,64,65,8,41,6,7,21,66,67,68,69,8,21,8,9,41,70,71,72,73,6,20,15,22,74,75,76,8,22,11,7,20,77,78,79,80,8,21,7,11,42,81,82,83,84,8,42,10,8,21,85,86,87,88,6,22,15,16,89,90,91,8,16,1,13,22,92,93,94,95,8,43,13,1,17,96,97,98,99,8,17,4,14,43,100,101,102,103};
- const int expected4[17]={0,7,16,25,34,41,50,59,68,75,84,93,102,109,118,127,136};
+ const mcIdType expected3[136]={6,16,15,18,44,45,46,8,18,2,1,16,47,48,49,50,8,17,1,2,40,51,52,53,54,8,40,5,4,17,55,56,57,58,6,18,15,20,59,60,61,8,20,7,6,18,62,63,64,65,8,41,6,7,21,66,67,68,69,8,21,8,9,41,70,71,72,73,6,20,15,22,74,75,76,8,22,11,7,20,77,78,79,80,8,21,7,11,42,81,82,83,84,8,42,10,8,21,85,86,87,88,6,22,15,16,89,90,91,8,16,1,13,22,92,93,94,95,8,43,13,1,17,96,97,98,99,8,17,4,14,43,100,101,102,103};
+ const mcIdType expected4[17]={0,7,16,25,34,41,50,59,68,75,84,93,102,109,118,127,136};
const double expected5[208]={0.,0.,1.1, 0.,1.1,1.,0.,1.,1.7,0.,1.7,1.,-1.1,1.,-1.1,0.,-1.7,0.,-1.7,1.,-1.7,-1.,-1.1,-1.,0.,-1.,1.1,-1.,1.7,-1.,0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1.,0.,-1.5,0.5,0.,1.25,0.,0.7071067811865476,0.7071067811865476,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.7071067811865476,0.7071067811865476,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.7071067811865476,-0.7071067811865476,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.7071067811865476,-0.7071067811865476,1.0606601717798214,-1.0606601717798214,1.1180339887498951,1.,-1.1180339887498951,1.,-1.1180339887498951,-1.,1.1180339887498951,-1.,0.5,0.,0.,0.5,0.7071067811865477,0.7071067811865476,0.55,1.,1.1,0.5,1.05,0.,0.7071067811865477,0.7071067811865475,1.3,0.,1.1,0.5,1.1090169943749475,1.,1.4012585384440737,0.535233134659635,1.4090169943749475,1.,1.7,0.5,1.6,0.,1.4012585384440737,0.535233134659635,0.,0.5,-0.5,0.,-0.7071067811865477,0.7071067811865476,-1.05,0.,-1.1,0.5,-0.55,1.,-0.7071067811865478,0.7071067811865475,-1.1090169943749475,1.,-1.1,0.5,-1.3,0.,-1.4012585384440737,0.5352331346596344,-1.6,0.,-1.7,0.5,-1.4090169943749475,1.,-1.4012585384440737,0.5352331346596344,-0.5,0.,0.,-0.5,-0.7071067811865475,-0.7071067811865477,-0.55,-1.,-1.1,-0.5,-1.05,0.,-0.7071067811865475,-0.7071067811865477,-1.3,0.,-1.1,-0.5,-1.1090169943749475,-1.,-1.4012585384440734,-0.5352331346596354,-1.4090169943749475,-1.,-1.7,-0.5,-1.6,0.,-1.4012585384440732,-0.5352331346596354,0.,-0.5,0.5,0.,0.7071067811865475,-0.7071067811865477,1.05,0.,1.1,-0.5,0.55,-1.,0.7071067811865475,-0.7071067811865477,1.1090169943749475,-1.,1.1,-0.5,1.3,0.,1.4012585384440737,-0.535233134659635,1.6,0.,1.7,-0.5,1.4090169943749475,-1.,1.4012585384440737,-0.535233134659635};
CPPUNIT_ASSERT_EQUAL(136,(int)m3->getNodalConnectivity()->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(17,(int)m3->getNodalConnectivityIndex()->getNumberOfTuples());
MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D);
const double vec[3]={-0.07,1.,0.07};
const double origin[3]={1.524,1.4552,1.74768};
- DataArrayInt *ids1=mesh3D->getCellIdsCrossingPlane(origin,vec,1e-10);
+ DataArrayIdType *ids1=mesh3D->getCellIdsCrossingPlane(origin,vec,1e-10);
CPPUNIT_ASSERT_EQUAL(9,(int)ids1->getNumberOfTuples());
- const int expected1[9]={1,3,4,7,9,10,13,15,16};
+ const mcIdType expected1[9]={1,3,4,7,9,10,13,15,16};
CPPUNIT_ASSERT(std::equal(expected1,expected1+9,ids1->getConstPointer()));
const double vec2[3]={0.,0.,1.};
- DataArrayInt *ids2=mesh3D->getCellIdsCrossingPlane(origin,vec2,1e-10);
- const int expected2[6]={6,7,8,9,10,11};
+ DataArrayIdType *ids2=mesh3D->getCellIdsCrossingPlane(origin,vec2,1e-10);
+ const mcIdType expected2[6]={6,7,8,9,10,11};
CPPUNIT_ASSERT_EQUAL(6,(int)ids2->getNumberOfTuples());
CPPUNIT_ASSERT(std::equal(expected2,expected2+6,ids2->getConstPointer()));
ids1->decrRef();
// First slice in the middle of 3D cells
const double vec1[3]={-0.07,1.,0.07};
const double origin1[3]={1.524,1.4552,1.74768};
- DataArrayInt *ids=0;
+ DataArrayIdType *ids=0;
MEDCouplingUMesh *slice1=mesh3D->buildSlice3D(origin1,vec1,1e-10,ids);
- const int expected1[9]={1,3,4,7,9,10,13,15,16};
- const int expected2[47]={5,42,41,40,43,44,5,42,46,45,41,5,44,43,40,47,48,5,49,42,44,50,5,49,51,46,42,5,50,44,48,52,5,53,49,50,54,5,53,55,51,49,5,54,50,52,56};
- const int expected3[10]={0,6,11,17,22,27,32,37,42,47};
+ const mcIdType expected1[9]={1,3,4,7,9,10,13,15,16};
+ const mcIdType expected2[47]={5,42,41,40,43,44,5,42,46,45,41,5,44,43,40,47,48,5,49,42,44,50,5,49,51,46,42,5,50,44,48,52,5,53,49,50,54,5,53,55,51,49,5,54,50,52,56};
+ const mcIdType expected3[10]={0,6,11,17,22,27,32,37,42,47};
const double expected4[171]={1.,1.,0.,1.,1.25,0.,1.,1.5,0.,2.,1.,0.,1.,2.,0.,0.,2.,0.,3.,1.,0.,3.,2.,0.,0.,1.,0.,2.,2.,0.,1.,1.,1.,1.,1.25,1.,1.,1.5,1.,2.,1.,1.,1.,2.,1.,0.,2.,1.,3.,1.,1.,3.,2.,1.,0.,1.,1.,2.,2.,1.,1.,1.,2.,1.,1.25,2.,1.,1.5,2.,2.,1.,2.,1.,2.,2.,0.,2.,2.,3.,1.,2.,3.,2.,2.,0.,1.,2.,2.,2.,2.,1.,1.,3.,1.,1.25,3.,1.,1.5,3.,2.,1.,3.,1.,2.,3.,0.,2.,3.,3.,1.,3.,3.,2.,3.,0.,1.,3.,2.,2.,3.,1.,1.5408576,0.,2.,1.6108576000000001,0.,2.,1.5408576,1.,1.,1.5,0.5836800000000008,1.,1.4708576,1.,3.,1.6808576,0.,3.,1.6108576000000001,1.,0.,1.4708576,0.,0.,1.4008576,1.,2.,1.4708576,2.,1.,1.4008576000000001,2.,3.,1.5408575999999998,2.,0.,1.3308575999999999,2.,2.,1.4008576,3.,1.,1.3308576,3.,3.,1.4708576,3.,0.,1.2608576,3.};
CPPUNIT_ASSERT_EQUAL(2,slice1->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(3,slice1->getSpaceDimension());
- CPPUNIT_ASSERT_EQUAL(57,slice1->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(57,(int)slice1->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(9,(int)slice1->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(9,(int)ids->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(47,(int)slice1->getNodalConnectivity()->getNumberOfTuples());
const double vec2[3]={0.,3.,1.};
const double origin2[3]={2.5,1.,3.};
slice1=mesh3D->buildSlice3D(origin2,vec2,1e-10,ids);
- const int expected5[49]={5,50,10,4,51,5,50,52,7,10,5,51,4,5,53,5,54,50,51,55,56,5,54,57,52,50,5,56,55,51,53,58,5,38,59,56,54,43,5,54,57,46,43,5,38,59,56,58,48};
- const int expected6[10]={0,5,10,15,21,26,32,38,43,49};
+ const mcIdType expected5[49]={5,50,10,4,51,5,50,52,7,10,5,51,4,5,53,5,54,50,51,55,56,5,54,57,52,50,5,56,55,51,53,58,5,38,59,56,54,43,5,54,57,46,43,5,38,59,56,58,48};
+ const mcIdType expected6[10]={0,5,10,15,21,26,32,38,43,49};
const double expected7[180]={1.,1.,0.,1.,1.25,0.,1.,1.5,0.,2.,1.,0.,1.,2.,0.,0.,2.,0.,3.,1.,0.,3.,2.,0.,0.,1.,0.,1.,3.,0.,2.,2.,0.,2.,3.,0.,1.,1.,1.,1.,1.25,1.,1.,1.5,1.,2.,1.,1.,1.,2.,1.,0.,2.,1.,3.,1.,1.,3.,2.,1.,0.,1.,1.,1.,3.,1.,2.,2.,1.,2.,3.,1.,0.,0.,2.,1.,1.,2.,1.,1.25,2.,1.,0.,2.,1.,1.5,2.,2.,0.,2.,2.,1.,2.,1.,2.,2.,0.,2.,2.,3.,1.,2.,3.,2.,2.,0.,1.,2.,2.,2.,2.,0.,0.,3.,1.,1.,3.,1.,1.25,3.,1.,0.,3.,1.,1.5,3.,2.,0.,3.,2.,1.,3.,1.,2.,3.,0.,2.,3.,3.,1.,3.,3.,2.,3.,0.,1.,3.,2.,2.,3.,2.,1.6666666666666667,1.,1.,1.6666666666666667,1.,3.,1.6666666666666667,1.,0.,1.6666666666666667,1.,2.,1.3333333333333335,2.,1.,1.5,1.5,1.,1.3333333333333333,2.,3.,1.3333333333333335,2.,0.,1.3333333333333335,2.,1.,1.25,2.25};
CPPUNIT_ASSERT_EQUAL(2,slice1->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(3,slice1->getSpaceDimension());
- CPPUNIT_ASSERT_EQUAL(60,slice1->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(60,(int)slice1->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(9,(int)slice1->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(9,(int)ids->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(49,(int)slice1->getNodalConnectivity()->getNumberOfTuples());
const double vec3[3]={0.,0.,1.};
const double origin3[3]={2.5,1.,2.};
slice1=mesh3D->buildSlice3D(origin3,vec3,1e-10,ids);
- const int expected8[12]={6,7,8,9,10,11,12,13,14,15,16,17};
- const int expected9[68]={5,15,26,16,18,5,16,21,28,22,19,17,5,18,20,21,16,5,21,24,25,28,5,26,16,17,19,22,23,5,22,27,29,28,5,15,26,16,18,5,16,21,28,22,19,17,5,18,20,21,16,5,21,24,25,28,5,26,16,17,19,22,23,5,22,27,29,28};
- const int expected10[13]={0,5,12,17,22,29,34,39,46,51,56,63,68};
+ const mcIdType expected8[12]={6,7,8,9,10,11,12,13,14,15,16,17};
+ const mcIdType expected9[68]={5,15,26,16,18,5,16,21,28,22,19,17,5,18,20,21,16,5,21,24,25,28,5,26,16,17,19,22,23,5,22,27,29,28,5,15,26,16,18,5,16,21,28,22,19,17,5,18,20,21,16,5,21,24,25,28,5,26,16,17,19,22,23,5,22,27,29,28};
+ const mcIdType expected10[13]={0,5,12,17,22,29,34,39,46,51,56,63,68};
const double expected11[135]={0.,0.,1.,1.,1.,1.,1.,1.25, 1.,1.,0.,1.,1.,1.5, 1.,2.,0.,1.,2.,1.,1.,1.,2.,1.,0.,2.,1.,3.,1.,1.,3.,2.,1.,0.,1.,1.,1.,3.,1.,2.,2.,1.,2.,3.,1.,0.,0.,2.,1.,1.,2.,1.,1.25, 2.,1.,0.,2.,1.,1.5, 2.,2.,0.,2.,2.,1.,2.,1.,2.,2.,0.,2.,2.,3.,1.,2.,3.,2.,2.,0.,1.,2.,1.,3.,2.,2.,2.,2.,2.,3.,2.,0.,0.,3.,1.,1.,3.,1.,1.25, 3.,1.,0.,3.,1.,1.5, 3.,2.,0.,3.,2.,1.,3.,1.,2.,3.,0.,2.,3.,3.,1.,3.,3.,2.,3.,0.,1.,3.,1.,3.,3.,2.,2.,3.,2.,3.,3.};
CPPUNIT_ASSERT_EQUAL(2,slice1->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(3,slice1->getSpaceDimension());
- CPPUNIT_ASSERT_EQUAL(45,slice1->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(45,(int)slice1->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(12,(int)slice1->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(12,(int)ids->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(68,(int)slice1->getNodalConnectivity()->getNumberOfTuples());
MEDCouplingUMesh *mesh2D=0;
MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D);
mesh2D->decrRef();
- DataArrayInt *a=DataArrayInt::New(),*b=DataArrayInt::New(),*c=DataArrayInt::New(),*d=DataArrayInt::New();
+ DataArrayIdType *a=DataArrayIdType::New(),*b=DataArrayIdType::New(),*c=DataArrayIdType::New(),*d=DataArrayIdType::New();
mesh2D=mesh3D->buildDescendingConnectivity(a,b,c,d);
a->decrRef(); b->decrRef(); c->decrRef(); d->decrRef();
mesh3D->decrRef();
//
const double vec1[3]={-0.07,1.,0.07};
const double origin1[3]={1.524,1.4552,1.74768};
- DataArrayInt *ids=0;
+ DataArrayIdType *ids=0;
MEDCouplingUMesh *slice1=mesh2D->buildSlice3DSurf(origin1,vec1,1e-10,ids);
- const int expected1[25]={6,8,10,11,13,18,19,21,23,25,26,38,41,43,47,49,52,53,64,67,69,73,75,78,79};
- const int expected2[75]={1,40,41,1,42,41,1,40,43,1,44,43,1,42,44,1,45,41,1,42,46,1,46,45,1,47,40,1,47,48,1,44,48,1,49,42,1,44,50,1,49,50,1,49,51,1,51,46,1,48,52,1,50,52,1,53,49,1,50,54,1,53,54,1,53,55,1,55,51,1,52,56,1,54,56};
- const int expected3[26]={0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75};
+ const mcIdType expected1[25]={6,8,10,11,13,18,19,21,23,25,26,38,41,43,47,49,52,53,64,67,69,73,75,78,79};
+ const mcIdType expected2[75]={1,40,41,1,42,41,1,40,43,1,44,43,1,42,44,1,45,41,1,42,46,1,46,45,1,47,40,1,47,48,1,44,48,1,49,42,1,44,50,1,49,50,1,49,51,1,51,46,1,48,52,1,50,52,1,53,49,1,50,54,1,53,54,1,53,55,1,55,51,1,52,56,1,54,56};
+ const mcIdType expected3[26]={0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75};
const double expected4[171]={1.,1.,0.,1.,1.25,0.,1.,1.5,0.,2.,1.,0.,1.,2.,0.,0.,2.,0.,3.,1.,0.,3.,2.,0.,0.,1.,0.,2.,2.,0.,1.,1.,1.,1.,1.25,1.,1.,1.5,1.,2.,1.,1.,1.,2.,1.,0.,2.,1.,3.,1.,1.,3.,2.,1.,0.,1.,1.,2.,2.,1.,1.,1.,2.,1.,1.25,2.,1.,1.5,2.,2.,1.,2.,1.,2.,2.,0.,2.,2.,3.,1.,2.,3.,2.,2.,0.,1.,2.,2.,2.,2.,1.,1.,3.,1.,1.25,3.,1.,1.5,3.,2.,1.,3.,1.,2.,3.,0.,2.,3.,3.,1.,3.,3.,2.,3.,0.,1.,3.,2.,2.,3.,1.,1.5408576,0.,2.,1.6108576000000001,0.,2.,1.5408576,1.,1.,1.5,0.5836800000000008,1.,1.4708576,1.,3.,1.6808576,0.,3.,1.6108576000000001,1.,0.,1.4708576,0.,0.,1.4008576,1.,2.,1.4708576,2.,1.,1.4008576000000001,2.,3.,1.5408575999999998,2.,0.,1.3308575999999999,2.,2.,1.4008576,3.,1.,1.3308576,3.,3.,1.4708576,3.,0.,1.2608576,3.};
CPPUNIT_ASSERT_EQUAL(1,slice1->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(3,slice1->getSpaceDimension());
- CPPUNIT_ASSERT_EQUAL(57,slice1->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(57,(int)slice1->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(25,(int)slice1->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(25,(int)ids->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(75,(int)slice1->getNodalConnectivity()->getNumberOfTuples());
const double vec2[3]={0.,0.,1.};
const double origin2[3]={2.5,1.,2.};
slice1=mesh2D->buildSlice3DSurf(origin2,vec2,1e-10,ids);
- const int expected5[68]={32,32,32,32,33,34,35,36,37,38,39,40,41,42,43,43,43,43,43,43,44,44,44,44,45,46,47,47,47,47,48,49,50,51,52,53,53,53,53,53,53,54,54,54,54,55,56,57,59,60,61,62,63,64,65,66,67,68,71,72,74,75,76,77,78,81,82,83};
- const int expected6[204]={1,15,18,1,18,16,1,16,26,1,26,15,1,26,15,1,16,26,1,18,16,1,15,18,1,16,21,1,21,28,1,22,28,1,19,22,1,17,19,1,16,17,1,16,21,1,21,28,1,28,22,1,22,19,1,19,17,1,17,16,1,16,18,1,18,20,1,20,21,1,21,16,1,20,21,1,18,20,1,28,21,1,21,24,1,24,25,1,25,28,1,25,28,1,24,25,1,21,24,1,23,22,1,26,23,1,26,16,1,16,17,1,17,19,1,19,22,1,22,23,1,23,26,1,22,28,1,28,29,1,29,27,1,27,22,1,27,22,1,29,27,1,28,29,1,26,15,1,16,26,1,18,16,1,15,18,1,16,21,1,21,28,1,22,28,1,19,22,1,17,19,1,16,17,1,20,21,1,18,20,1,25,28,1,24,25,1,21,24,1,23,22,1,26,23,1,27,22,1,29,27,1,28,29};
- const int expected7[69]={0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204};
+ const mcIdType expected5[68]={32,32,32,32,33,34,35,36,37,38,39,40,41,42,43,43,43,43,43,43,44,44,44,44,45,46,47,47,47,47,48,49,50,51,52,53,53,53,53,53,53,54,54,54,54,55,56,57,59,60,61,62,63,64,65,66,67,68,71,72,74,75,76,77,78,81,82,83};
+ const mcIdType expected6[204]={1,15,18,1,18,16,1,16,26,1,26,15,1,26,15,1,16,26,1,18,16,1,15,18,1,16,21,1,21,28,1,22,28,1,19,22,1,17,19,1,16,17,1,16,21,1,21,28,1,28,22,1,22,19,1,19,17,1,17,16,1,16,18,1,18,20,1,20,21,1,21,16,1,20,21,1,18,20,1,28,21,1,21,24,1,24,25,1,25,28,1,25,28,1,24,25,1,21,24,1,23,22,1,26,23,1,26,16,1,16,17,1,17,19,1,19,22,1,22,23,1,23,26,1,22,28,1,28,29,1,29,27,1,27,22,1,27,22,1,29,27,1,28,29,1,26,15,1,16,26,1,18,16,1,15,18,1,16,21,1,21,28,1,22,28,1,19,22,1,17,19,1,16,17,1,20,21,1,18,20,1,25,28,1,24,25,1,21,24,1,23,22,1,26,23,1,27,22,1,29,27,1,28,29};
+ const mcIdType expected7[69]={0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204};
const double expected8[135]={0.,0.,1.,1.,1.,1.,1.,1.25, 1.,1.,0.,1.,1.,1.5, 1.,2.,0.,1.,2.,1.,1.,1.,2.,1.,0.,2.,1.,3.,1.,1.,3.,2.,1.,0.,1.,1.,1.,3.,1.,2.,2.,1.,2.,3.,1.,0.,0.,2.,1.,1.,2.,1.,1.25, 2.,1.,0.,2.,1.,1.5, 2.,2.,0.,2.,2.,1.,2.,1.,2.,2.,0.,2.,2.,3.,1.,2.,3.,2.,2.,0.,1.,2.,1.,3.,2.,2.,2.,2.,2.,3.,2.,0.,0.,3.,1.,1.,3.,1.,1.25, 3.,1.,0.,3.,1.,1.5, 3.,2.,0.,3.,2.,1.,3.,1.,2.,3.,0.,2.,3.,3.,1.,3.,3.,2.,3.,0.,1.,3.,1.,3.,3.,2.,2.,3.,2.,3.,3.};
CPPUNIT_ASSERT_EQUAL(1,slice1->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(3,slice1->getSpaceDimension());
- CPPUNIT_ASSERT_EQUAL(45,slice1->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(45,(int)slice1->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(68,(int)slice1->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(68,(int)ids->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(204,(int)slice1->getNodalConnectivity()->getNumberOfTuples());
CPPUNIT_ASSERT_THROW(da->setInfoAndChangeNbOfCompo(compsCpp),INTERP_KERNEL::Exception);
std::copy(data1,data1+14,da->getPointer());
//
- std::vector<std::pair<int,int> > p(3);
+ std::vector<std::pair<mcIdType,mcIdType> > p(3);
p[0].first=0; p[0].second=3; p[1].first=3; p[1].second=5; p[2].first=5; p[2].second=7;
tmp=dynamic_cast<DataArrayDouble *>(da->selectByTupleRanges(p));
CPPUNIT_ASSERT(tmp->isEqual(*da,1e-14));
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected4[i],dac->getIJ(0,i),1e-14);
dac->decrRef();
//
- DataArrayInt *ids=DataArrayInt::New();
+ DataArrayIdType *ids=DataArrayIdType::New();
ids->alloc(3,1);
dac=da->deepCopy();
ids->setIJ(0,0,2); ids->setIJ(1,0,0); ids->setIJ(2,0,4);
void MEDCouplingBasicsTest5::testDataArrayIntAdvSetting1()
{
- const int data1[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
- const int data2[10]={8,38,9,39,0,30,11,41,12,42};
+ const mcIdType data1[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ const mcIdType data2[10]={8,38,9,39,0,30,11,41,12,42};
const char *comps[2]={"comp1","comp2"};
std::vector<std::string> compsCpp(comps,comps+2);
- DataArrayInt *da=DataArrayInt::New();
- DataArrayInt *tmp=0;
+ DataArrayIdType *da=DataArrayIdType::New();
+ DataArrayIdType *tmp=0;
da->setInfoAndChangeNbOfCompo(compsCpp);
da->setName("da");
da->alloc(7,2);
CPPUNIT_ASSERT_THROW(da->setInfoAndChangeNbOfCompo(compsCpp),INTERP_KERNEL::Exception);
std::copy(data1,data1+14,da->getPointer());
//
- std::vector<std::pair<int,int> > p(3);
+ std::vector<std::pair<mcIdType,mcIdType> > p(3);
p[0].first=0; p[0].second=3; p[1].first=3; p[1].second=5; p[2].first=5; p[2].second=7;
- tmp=dynamic_cast<DataArrayInt *>(da->selectByTupleRanges(p));
+ tmp=dynamic_cast<DataArrayIdType *>(da->selectByTupleRanges(p));
CPPUNIT_ASSERT(tmp->isEqual(*da));
tmp->decrRef();
p[0].first=0; p[0].second=2; p[1].first=3; p[1].second=4; p[2].first=5; p[2].second=7;
- tmp=dynamic_cast<DataArrayInt *>(da->selectByTupleRanges(p));
- const int expected1[10]={1,11,2,12,4,14,6,16,7,17};
+ tmp=dynamic_cast<DataArrayIdType *>(da->selectByTupleRanges(p));
+ const mcIdType expected1[10]={1,11,2,12,4,14,6,16,7,17};
CPPUNIT_ASSERT_EQUAL(5,(int)tmp->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)tmp->getNumberOfComponents());
for(int i=0;i<10;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],tmp->getIJ(0,i));
tmp->decrRef();
p[0].first=0; p[0].second=2; p[1].first=0; p[1].second=2; p[2].first=5; p[2].second=6;
- tmp=dynamic_cast<DataArrayInt *>(da->selectByTupleRanges(p));
- const int expected2[10]={1,11,2,12,1,11,2,12,6,16};
+ tmp=dynamic_cast<DataArrayIdType *>(da->selectByTupleRanges(p));
+ const mcIdType expected2[10]={1,11,2,12,1,11,2,12,6,16};
CPPUNIT_ASSERT_EQUAL(5,(int)tmp->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)tmp->getNumberOfComponents());
for(int i=0;i<10;i++)
p[0].first=0; p[0].second=2; p[1].first=0; p[1].second=2; p[2].first=5; p[2].second=8;
CPPUNIT_ASSERT_THROW(da->selectByTupleRanges(p),INTERP_KERNEL::Exception);
//
- DataArrayInt *da2=DataArrayInt::New();
+ DataArrayIdType *da2=DataArrayIdType::New();
da2->alloc(5,2);
std::copy(data2,data2+10,da2->getPointer());
//
- DataArrayInt *dac=da->deepCopy();
+ DataArrayIdType *dac=da->deepCopy();
dac->setContigPartOfSelectedValuesSlice(1,da2,2,4,1);
- const int expected3[14]={1,11,0,30,11,41,4,14,5,15,6,16,7,17};
+ const mcIdType expected3[14]={1,11,0,30,11,41,4,14,5,15,6,16,7,17};
for(int i=0;i<14;i++)
CPPUNIT_ASSERT_EQUAL(expected3[i],dac->getIJ(0,i));
dac->decrRef();
CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValuesSlice(0,da2,4,6,1),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValuesSlice(3,da2,5,0,1),INTERP_KERNEL::Exception);
dac->setContigPartOfSelectedValuesSlice(3,da2,1,5,1);
- const int expected4[14]={1,11,2,12,3,13,9,39,0,30,11,41,12,42};
+ const mcIdType expected4[14]={1,11,2,12,3,13,9,39,0,30,11,41,12,42};
for(int i=0;i<14;i++)
CPPUNIT_ASSERT_EQUAL(expected4[i],dac->getIJ(0,i));
dac->decrRef();
//
- DataArrayInt *ids=DataArrayInt::New();
+ DataArrayIdType *ids=DataArrayIdType::New();
ids->alloc(3,1);
dac=da->deepCopy();
ids->setIJ(0,0,2); ids->setIJ(1,0,0); ids->setIJ(2,0,4);
dac->setContigPartOfSelectedValues(2,da2,ids);
- const int expected5[14]={1,11,2,12,0,30,8,38,12,42,6,16,7,17};
+ const mcIdType expected5[14]={1,11,2,12,0,30,8,38,12,42,6,16,7,17};
for(int i=0;i<14;i++)
CPPUNIT_ASSERT_EQUAL(expected5[i],dac->getIJ(0,i));
dac->decrRef();
ids->setIJ(0,0,2); ids->setIJ(1,0,2); ids->setIJ(2,0,1);
dac=da->deepCopy();
dac->setContigPartOfSelectedValues(4,da2,ids);
- const int expected6[14]={1,11,2,12,3,13,4,14,0,30,0,30,9,39};
+ const mcIdType expected6[14]={1,11,2,12,3,13,4,14,0,30,0,30,9,39};
for(int i=0;i<14;i++)
CPPUNIT_ASSERT_EQUAL(expected6[i],dac->getIJ(0,i));
dac->decrRef();
void MEDCouplingBasicsTest5::testBuildDescendingConnec2Of3DMesh1()
{
MEDCouplingUMesh *mesh=build3DSourceMesh_1();
- DataArrayInt *desc=DataArrayInt::New();
- DataArrayInt *descIndx=DataArrayInt::New();
- DataArrayInt *revDesc=DataArrayInt::New();
- DataArrayInt *revDescIndx=DataArrayInt::New();
+ DataArrayIdType *desc=DataArrayIdType::New();
+ DataArrayIdType *descIndx=DataArrayIdType::New();
+ DataArrayIdType *revDesc=DataArrayIdType::New();
+ DataArrayIdType *revDescIndx=DataArrayIdType::New();
//
MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity2(desc,descIndx,revDesc,revDescIndx);
mesh2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(2,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(30,(int)mesh2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL((std::size_t)31,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(31,(int)revDescIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)13,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(13,(int)descIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)48,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)desc->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL((std::size_t)48,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)revDesc->getNumberOfTuples());
- const int expected1[48]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,-10,15,-5,-13,16,17,-14,18,-4,19,-2,20,21,22,23,24,25,-11,26,-1,-12,-25,-22,27,28,-7,-20,-24,29,-16,-18,30,-8,-28};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(31),revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(31,(int)revDescIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(13),descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(13,(int)descIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(48),desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)desc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(48),revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)revDesc->getNumberOfTuples());
+ const mcIdType expected1[48]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,-10,15,-5,-13,16,17,-14,18,-4,19,-2,20,21,22,23,24,25,-11,26,-1,-12,-25,-22,27,28,-7,-20,-24,29,-16,-18,30,-8,-28};
CPPUNIT_ASSERT(std::equal(expected1,expected1+48,desc->getConstPointer()));
- const int expected2[13]={0,4,8,12,16,20,24,28,32,36,40,44,48};
+ const mcIdType expected2[13]={0,4,8,12,16,20,24,28,32,36,40,44,48};
CPPUNIT_ASSERT(std::equal(expected2,expected2+13,descIndx->getConstPointer()));
- const int expected3[31]={0,2,4,5,7,9,10,12,14,15,17,19,21,23,25,26,28,29,31,32,34,35,37,38,40,42,43,44,46,47,48};
+ const mcIdType expected3[31]={0,2,4,5,7,9,10,12,14,15,17,19,21,23,25,26,28,29,31,32,34,35,37,38,40,42,43,44,46,47,48};
CPPUNIT_ASSERT(std::equal(expected3,expected3+31,revDescIndx->getConstPointer()));
- const int expected4[48]={0,8,0,6,0,0,5,1,4,1,1,9,1,11,2,2,3,2,7,2,8,3,4,3,5,3,4,10,4,5,11,5,6,10,6,6,9,7,7,10,7,8,8,9,9,11,10,11};
+ const mcIdType expected4[48]={0,8,0,6,0,0,5,1,4,1,1,9,1,11,2,2,3,2,7,2,8,3,4,3,5,3,4,10,4,5,11,5,6,10,6,6,9,7,7,10,7,8,8,9,9,11,10,11};
CPPUNIT_ASSERT(std::equal(expected4,expected4+48,revDesc->getConstPointer()));
- DataArrayInt *conn=mesh2->getNodalConnectivity();
- DataArrayInt *connIndex=mesh2->getNodalConnectivityIndex();
- const int expected5[31]={0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120};
+ DataArrayIdType *conn=mesh2->getNodalConnectivity();
+ DataArrayIdType *connIndex=mesh2->getNodalConnectivityIndex();
+ const mcIdType expected5[31]={0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120};
CPPUNIT_ASSERT(std::equal(expected5,expected5+31,connIndex->getConstPointer()));
- const int expected6[120]={3,8,1,7,3,8,3,1,3,1,3,7,3,7,3,8,3,6,0,8,3,6,2,0,3,0,2,8,3,8,2,6,3,7,4,5,3,7,8,4,3,4,8,5,3,5,8,7,3,6,8,4,3,6,7,8,3,4,7,6,3,8,4,0,3,0,4,6,3,6,3,8,3,7,3,6,3,8,0,1,3,1,0,3,3,3,0,8,3,4,1,5,3,4,8,1,3,1,8,5,3,1,7,5,3,0,2,3,3,3,2,8,3,1,4,0,3,3,2,6};
+ const mcIdType expected6[120]={3,8,1,7,3,8,3,1,3,1,3,7,3,7,3,8,3,6,0,8,3,6,2,0,3,0,2,8,3,8,2,6,3,7,4,5,3,7,8,4,3,4,8,5,3,5,8,7,3,6,8,4,3,6,7,8,3,4,7,6,3,8,4,0,3,0,4,6,3,6,3,8,3,7,3,6,3,8,0,1,3,1,0,3,3,3,0,8,3,4,1,5,3,4,8,1,3,1,8,5,3,1,7,5,3,0,2,3,3,3,2,8,3,1,4,0,3,3,2,6};
CPPUNIT_ASSERT(std::equal(expected6,expected6+120,conn->getConstPointer()));
//
desc->decrRef();
void MEDCouplingBasicsTest5::testAre2DCellsNotCorrectlyOriented1()
{
double m1Coords[8]={1.,1.,-1.,-1.,-1.,-1.,1.,-1.};
- int m1Conn[4]={0,3,1,2};
+ mcIdType m1Conn[4]={0,3,1,2};
MEDCouplingUMesh *m1=MEDCouplingUMesh::New();
m1->setMeshDimension(2);
m1->allocateCells(1);
vec2[1]=3.*sin(M_PI/9.*i);
MEDCouplingUMesh *m1Cpy=static_cast<MEDCouplingUMesh *>(m1->deepCopy());
m1Cpy->translate(vec2);
- std::vector<int> res;
+ std::vector<mcIdType> res;
CPPUNIT_ASSERT_THROW(m1Cpy->are2DCellsNotCorrectlyOriented(vec1,false,res),INTERP_KERNEL::Exception);
res.clear();
m1Cpy->changeSpaceDimension(3);
m1Cpy->are2DCellsNotCorrectlyOriented(vec1,false,res);
CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
- CPPUNIT_ASSERT_EQUAL(0,res[0]);
+ CPPUNIT_ASSERT_EQUAL(0,(int)res[0]);
m1Cpy->decrRef();
}
delete [] vec2;
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],d1->getIJ(0,i),1e-14);
//
- const int expected2[12]={2,3,5,6,7,8,9,10,11,12,13,15};
+ const mcIdType expected2[12]={2,3,5,6,7,8,9,10,11,12,13,15};
d2->abs();
for(int i=0;i<12;i++)
- CPPUNIT_ASSERT_EQUAL(expected2[i],d2->getIJ(0,i));
+ CPPUNIT_ASSERT_EQUAL((int)expected2[i],d2->getIJ(0,i));
//
d1->decrRef();
}
const double v2[5]={0.7,1.25,0.,2.,1.5};
const double disp[12]={5.,50.,500.,6.,60.,600.,7.,70.,700.,8.,80.,800.};
MEDCouplingUMesh *m=MEDCouplingUMesh::New("myMesh",1);
- const int nbNodes=4;
- const int nbCells=nbNodes-1;
+ const mcIdType nbNodes=4;
+ const mcIdType nbCells=nbNodes-1;
m->allocateCells(nbCells);
DataArrayDouble *coords=DataArrayDouble::New();
coords->alloc(nbNodes,1);
std::copy(v,v+nbNodes,coords->getPointer());
m->setCoords(coords);
coords->decrRef();
- const int conn[6]={0,1,2,1,2,3};
+ const mcIdType conn[6]={0,1,2,1,2,3};
m->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
m->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+2);
m->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+4);
// test in 1D
m1c->setCoordsAt(0,coordsX);
CPPUNIT_ASSERT_EQUAL(4,(int)m1c->getNumberOfCells());
- const int expected1[4][2]={{0,1},{1,2},{2,3},{3,4}};
+ const mcIdType expected1[4][2]={{0,1},{1,2},{2,3},{3,4}};
for(int i=0;i<4;i++)
{
- std::vector<int> v;
+ std::vector<mcIdType> v;
m1c->getNodeIdsOfCell(i,v);
CPPUNIT_ASSERT((int)v.size()==2);
std::equal(v.begin(),v.end(),expected1[i]);
// test in 2D
m1c->setCoordsAt(1,coordsY);
CPPUNIT_ASSERT_EQUAL(12,(int)m1c->getNumberOfCells());
- const int expected2[12][4]={{0,1,6,5},{1,2,7,6},{2,3,8,7},{3,4,9,8},{4,5,11,10},{5,6,12,11},{6,7,13,12},{7,8,14,13},{8,9,16,15},{9,10,17,16},{10,11,18,17},{11,12,19,18}};
+ const mcIdType expected2[12][4]={{0,1,6,5},{1,2,7,6},{2,3,8,7},{3,4,9,8},{4,5,11,10},{5,6,12,11},{6,7,13,12},{7,8,14,13},{8,9,16,15},{9,10,17,16},{10,11,18,17},{11,12,19,18}};
for(int i=0;i<12;i++)
{
- std::vector<int> v;
+ std::vector<mcIdType> v;
m1c->getNodeIdsOfCell(i,v);
CPPUNIT_ASSERT((int)v.size()==4);
std::equal(v.begin(),v.end(),expected2[i]);
// test in 3D
m1c->setCoordsAt(2,coordsZ);
CPPUNIT_ASSERT_EQUAL(24,(int)m1c->getNumberOfCells());
- const int expected3[24][8]={{0,1,6,5,20,21,26,25},{1,2,7,6,21,22,27,26},{2,3,8,7,22,23,28,27},{3,4,9,8,23,24,29,28},{4,5,11,10,24,25,31,30},{5,6,12,11,25,26,32,31},{6,7,13,12,26,27,33,32},{7,8,14,13,27,28,34,33},{8,9,16,15,28,29,36,35},{9,10,17,16,29,30,37,36},{10,11,18,17,30,31,38,37},{11,12,19,18,31,32,39,38},{20,21,26,25,40,41,46,45},{21,22,27,26,41,42,47,46},{22,23,28,27,42,43,48,47},{23,24,29,28,43,44,49,48},{24,25,31,30,44,45,51,50},{25,26,32,31,45,46,52,51},{26,27,33,32,46,47,53,52},{27,28,34,33,47,48,54,53},{28,29,36,35,48,49,56,55},{29,30,37,36,49,50,57,56},{30,31,38,37,50,51,58,57},{31,32,39,38,51,52,59,58}};
+ const mcIdType expected3[24][8]={{0,1,6,5,20,21,26,25},{1,2,7,6,21,22,27,26},{2,3,8,7,22,23,28,27},{3,4,9,8,23,24,29,28},{4,5,11,10,24,25,31,30},{5,6,12,11,25,26,32,31},{6,7,13,12,26,27,33,32},{7,8,14,13,27,28,34,33},{8,9,16,15,28,29,36,35},{9,10,17,16,29,30,37,36},{10,11,18,17,30,31,38,37},{11,12,19,18,31,32,39,38},{20,21,26,25,40,41,46,45},{21,22,27,26,41,42,47,46},{22,23,28,27,42,43,48,47},{23,24,29,28,43,44,49,48},{24,25,31,30,44,45,51,50},{25,26,32,31,45,46,52,51},{26,27,33,32,46,47,53,52},{27,28,34,33,47,48,54,53},{28,29,36,35,48,49,56,55},{29,30,37,36,49,50,57,56},{30,31,38,37,50,51,58,57},{31,32,39,38,51,52,59,58}};
for(int i=0;i<12;i++)
{
- std::vector<int> v;
+ std::vector<mcIdType> v;
m1c->getNodeIdsOfCell(i,v);
CPPUNIT_ASSERT((int)v.size()==8);
std::equal(v.begin(),v.end(),expected3[i]);
void MEDCouplingBasicsTest5::testRenumberNodesInConn1()
{
double mesh2DCoords[27]={-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0. };
- int mesh2DConn[18]={1,4,2, 4,5,2, 0,3,4,1, 6,7,4,3, 7,8,5,4};
+ mcIdType mesh2DConn[18]={1,4,2, 4,5,2, 0,3,4,1, 6,7,4,3, 7,8,5,4};
MEDCouplingUMesh *mesh2D=MEDCouplingUMesh::New("mesh",2);
mesh2D->allocateCells(5);
mesh2D->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,mesh2DConn);
mesh2D->checkConsistencyLight();
//
double mesh3DCoords[24]={-0.3,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.2,-0.3,0., -0.3,-0.3,1., -0.3,0.2,1., 0.2,0.2,1., 0.2,-0.3,1. };
- int mesh3DConn[8]={0,1,2,3,4,5,6,7};
+ mcIdType mesh3DConn[8]={0,1,2,3,4,5,6,7};
MEDCouplingUMesh *mesh3D=MEDCouplingUMesh::New("mesh",3);
mesh3D->allocateCells(1);
mesh3D->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,mesh3DConn);
MEDCouplingUMesh *mesh2D_2=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCopy());
MEDCouplingUMesh *mesh3D_4=dynamic_cast<MEDCouplingUMesh *>(mesh3D->deepCopy());
MEDCouplingUMesh *mesh2D_4=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCopy());
- DataArrayInt *renumNodes=DataArrayInt::New();
- int oldNbOf3DNodes=mesh3D->getNumberOfNodes();
+ DataArrayIdType *renumNodes=DataArrayIdType::New();
+ mcIdType oldNbOf3DNodes=mesh3D->getNumberOfNodes();
renumNodes->alloc(mesh2D->getNumberOfNodes(),1);
renumNodes->iota(oldNbOf3DNodes);
DataArrayDouble *coo=DataArrayDouble::Aggregate(mesh3D->getCoords(),mesh2D->getCoords());
CPPUNIT_ASSERT(mesh2D_3->isEqual(mesh2D,1e-12));
mesh2D_3->decrRef();
//
- DataArrayInt *da1,*da2;
+ DataArrayIdType *da1,*da2;
mesh3D->checkGeoEquivalWith(mesh3D_2,10,1e-12,da1,da2);
CPPUNIT_ASSERT(da1==0);
CPPUNIT_ASSERT_EQUAL(8,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
- const int expected1[8]={8,11,12,9,4,5,6,7};
+ const mcIdType expected1[8]={8,11,12,9,4,5,6,7};
for(int i=0;i<8;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(i,0));
da2->decrRef();
CPPUNIT_ASSERT(da1==0);
CPPUNIT_ASSERT_EQUAL(9,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
- for(int i=0;i<9;i++)
+ for(mcIdType i=0;i<9;i++)
CPPUNIT_ASSERT_EQUAL(8+i,da2->getIJ(i,0));
da2->decrRef();
//
CPPUNIT_ASSERT(mesh3D_4->getCoords()==mesh2D_4->getCoords());
CPPUNIT_ASSERT(mesh2D_4->getCoords()==mesh2D_5->getCoords());
mesh3D_4->checkConsistencyLight(); mesh2D_4->checkConsistencyLight(); mesh2D_5->checkConsistencyLight();
- CPPUNIT_ASSERT_EQUAL(26,mesh3D_4->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(26,(int)mesh3D_4->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,mesh3D_4->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(9,(int)mesh3D_4->getNodalConnectivity()->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(23,(int)mesh2D_4->getNodalConnectivity()->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(23,(int)mesh2D_5->getNodalConnectivity()->getNumberOfTuples());
- const int expected2[9]={18,0,1,2,3,4,5,6,7};
- const int expected3[23]={3,9,12,10, 3,12,13,10, 4,8,11,12,9, 4,14,15,12,11, 4,15,16,13,12};
- const int expected4[23]={3,18,21,19, 3,21,22,19, 4,17,20,21,18, 4,23,24,21,20, 4,24,25,22,21};
+ const mcIdType expected2[9]={18,0,1,2,3,4,5,6,7};
+ const mcIdType expected3[23]={3,9,12,10, 3,12,13,10, 4,8,11,12,9, 4,14,15,12,11, 4,15,16,13,12};
+ const mcIdType expected4[23]={3,18,21,19, 3,21,22,19, 4,17,20,21,18, 4,23,24,21,20, 4,24,25,22,21};
const double expected5[78]={-0.3,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.2,-0.3,0., -0.3,-0.3,1., -0.3,0.2,1., 0.2,0.2,1., 0.2,-0.3,1., -0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0., 0.7, -0.3, 0.0, 1.2, -0.3, 0.0, 1.7, -0.3, 0.0, 0.7, 0.2, 0.0, 1.2, 0.2, 0.0, 1.7, 0.2, 0.0, 0.7, 0.7, 0.0, 1.2, 0.7, 0.0, 1.7, 0.7, 0.0};
CPPUNIT_ASSERT(std::equal(expected2,expected2+9,mesh3D_4->getNodalConnectivity()->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected3,expected3+23,mesh2D_4->getNodalConnectivity()->getConstPointer()));
mesh3D_4->checkConsistencyLight(); mesh2D_4->checkConsistencyLight(); mesh2D_5->checkConsistencyLight();
CPPUNIT_ASSERT(mesh3D_4->getCoords()==mesh2D_4->getCoords());
CPPUNIT_ASSERT(mesh2D_4->getCoords()==mesh2D_5->getCoords());
- CPPUNIT_ASSERT_EQUAL(19,mesh3D_4->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(19,(int)mesh3D_4->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,mesh3D_4->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(9,(int)mesh3D_4->getNodalConnectivity()->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(23,(int)mesh2D_4->getNodalConnectivity()->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(23,(int)mesh2D_5->getNodalConnectivity()->getNumberOfTuples());
- const int expected6[9]={18,0,1,2,3,4,5,6,7};
- const int expected7[23]={3,3,2,8, 3,2,9,8, 4,0,1,2,3, 4,10,11,2,1, 4,11,12,9,2};
- const int expected8[23]={3,13,15,14, 3,15,16,14, 4,8,9,15,13, 4,12,17,15,9, 4,17,18,16,15};
+ const mcIdType expected6[9]={18,0,1,2,3,4,5,6,7};
+ const mcIdType expected7[23]={3,3,2,8, 3,2,9,8, 4,0,1,2,3, 4,10,11,2,1, 4,11,12,9,2};
+ const mcIdType expected8[23]={3,13,15,14, 3,15,16,14, 4,8,9,15,13, 4,12,17,15,9, 4,17,18,16,15};
const double expected9[57]={-0.3, -0.3, 0., -0.3, 0.2, 0., 0.2, 0.2, 0., 0.2, -0.3, 0., -0.3, -0.3, 1., -0.3, 0.2, 1.,
0.2, 0.2, 1., 0.2, -0.3, 1., 0.7, -0.3, 0., 0.7, 0.2, 0., -0.3, 0.7, 0., 0.2, 0.7, 0.,
0.7, 0.7, 0., 1.2, -0.3, 0., 1.7, -0.3, 0., 1.2, 0.2, 0., 1.7, 0.2, 0., 1.2, 0.7, 0., 1.7, 0.7, 0.};
void MEDCouplingBasicsTest5::testComputeNeighborsOfCells1()
{
MEDCouplingUMesh *m=build2DTargetMesh_1();
- DataArrayInt *d1=0,*d2=0;
+ DataArrayIdType *d1=0,*d2=0;
m->computeNeighborsOfCells(d1,d2);
CPPUNIT_ASSERT_EQUAL(6,(int)d2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(10,(int)d1->getNumberOfTuples());
- const int expected1[6]={0,2,4,6,8,10};
- const int expected2[10]={3,1,0,2,4,1,4,0,2,3};
+ const mcIdType expected1[6]={0,2,4,6,8,10};
+ const mcIdType expected2[10]={3,1,0,2,4,1,4,0,2,3};
CPPUNIT_ASSERT(std::equal(expected1,expected1+6,d2->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+10,d1->getConstPointer()));
d1->decrRef();
void MEDCouplingBasicsTest5::testCheckButterflyCellsBug1()
{
double mesh2DCoords[10]={323.85,120.983748908684,317.5,131.982271536747,336.55,120.983748908686,330.2,131.982271536751,323.85,142.98079416481};
- int mesh2DConn[5]={4,1,0,2,3};
+ mcIdType mesh2DConn[5]={4,1,0,2,3};
MEDCouplingUMesh *mesh2D=MEDCouplingUMesh::New("mesh",2);
mesh2D->allocateCells(1);
mesh2D->insertNextCell(INTERP_KERNEL::NORM_POLYGON,5,mesh2DConn);
myCoords->decrRef();
mesh2D->checkConsistencyLight();
//
- std::vector<int> v;
+ std::vector<mcIdType> v;
mesh2D->checkButterflyCells(v);
CPPUNIT_ASSERT_EQUAL(0,(int)v.size());
//
void MEDCouplingBasicsTest5::testDataArrayIntRange1()
{
- DataArrayInt *d=DataArrayInt::Range(2,17,7);
- const int expected1[3]={2,9,16};
- CPPUNIT_ASSERT_EQUAL(3,(int)d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
+ DataArrayIdType *d=DataArrayIdType::Range(2,17,7);
+ const mcIdType expected1[3]={2,9,16};
+ CPPUNIT_ASSERT_EQUAL(3,(int)d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(expected1,expected1+3,d->getConstPointer()));
d->decrRef();
//
- d=DataArrayInt::Range(2,23,7);
- CPPUNIT_ASSERT_EQUAL(3,(int)d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
+ d=DataArrayIdType::Range(2,23,7);
+ CPPUNIT_ASSERT_EQUAL(3,(int)d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(expected1,expected1+3,d->getConstPointer()));
d->decrRef();
//
- d=DataArrayInt::Range(2,24,7);
- const int expected2[4]={2,9,16,23};
- CPPUNIT_ASSERT_EQUAL(4,(int)d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
+ d=DataArrayIdType::Range(2,24,7);
+ const mcIdType expected2[4]={2,9,16,23};
+ CPPUNIT_ASSERT_EQUAL(4,(int)d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(expected2,expected2+4,d->getConstPointer()));
d->decrRef();
//
- d=DataArrayInt::Range(24,2,-7);
- const int expected3[4]={24,17,10,3};
- CPPUNIT_ASSERT_EQUAL(4,(int)d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
+ d=DataArrayIdType::Range(24,2,-7);
+ const mcIdType expected3[4]={24,17,10,3};
+ CPPUNIT_ASSERT_EQUAL(4,(int)d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(expected3,expected3+4,d->getConstPointer()));
d->decrRef();
//
- d=DataArrayInt::Range(23,2,-7);
- const int expected4[3]={23,16,9};
- CPPUNIT_ASSERT_EQUAL(3,(int)d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
+ d=DataArrayIdType::Range(23,2,-7);
+ const mcIdType expected4[3]={23,16,9};
+ CPPUNIT_ASSERT_EQUAL(3,(int)d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(expected4,expected4+3,d->getConstPointer()));
d->decrRef();
//
- d=DataArrayInt::Range(23,22,-7);
- CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(23,d->getIJ(0,0));
+ d=DataArrayIdType::Range(23,22,-7);
+ CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(23,(int)d->getIJ(0,0));
d->decrRef();
//
- d=DataArrayInt::Range(22,23,7);
- CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(22,d->getIJ(0,0));
+ d=DataArrayIdType::Range(22,23,7);
+ CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(22,(int)d->getIJ(0,0));
d->decrRef();
//
- d=DataArrayInt::Range(22,22,7);
- CPPUNIT_ASSERT_EQUAL(0,(int)d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
+ d=DataArrayIdType::Range(22,22,7);
+ CPPUNIT_ASSERT_EQUAL(0,(int)d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
d->decrRef();
//
- d=DataArrayInt::Range(22,22,-7);
- CPPUNIT_ASSERT_EQUAL(0,(int)d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
+ d=DataArrayIdType::Range(22,22,-7);
+ CPPUNIT_ASSERT_EQUAL(0,(int)d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents());
d->decrRef();
//
- CPPUNIT_ASSERT_THROW(DataArrayInt::Range(22,23,-7),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_THROW(DataArrayInt::Range(23,22,7),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_THROW(DataArrayInt::Range(23,22,0),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_THROW(DataArrayInt::Range(22,23,0),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(DataArrayIdType::Range(22,23,-7),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(DataArrayIdType::Range(23,22,7),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(DataArrayIdType::Range(23,22,0),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(DataArrayIdType::Range(22,23,0),INTERP_KERNEL::Exception);
}
void MEDCouplingBasicsTest5::testDataArrayDoubleGetMinMaxPerComponent1()
void MEDCouplingBasicsTest5::testDataArrayIntGetHashCode1()
{
- DataArrayInt *d1=DataArrayInt::New(); d1->alloc(3545,1); d1->iota(0);
- DataArrayInt *d2=DataArrayInt::New(); d2->alloc(3545,1); d2->iota(0);
+ DataArrayIdType *d1=DataArrayIdType::New(); d1->alloc(3545,1); d1->iota(0);
+ DataArrayIdType *d2=DataArrayIdType::New(); d2->alloc(3545,1); d2->iota(0);
//
CPPUNIT_ASSERT_EQUAL(d1->getHashCode(),d2->getHashCode());
- CPPUNIT_ASSERT_EQUAL(232341068,d1->getHashCode());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(232341068),d1->getHashCode());
d1->setIJ(886,0,6);
- CPPUNIT_ASSERT_EQUAL(232340188,d1->getHashCode());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(232340188),d1->getHashCode());
//
d1->decrRef();
d2->decrRef();
void MEDCouplingBasicsTest5::testZipConnectivityPol1()
{
MEDCouplingUMesh *m1=build2DTargetMesh_1();
- const int cells1[3]={2,3,4};
+ const mcIdType cells1[3]={2,3,4};
MEDCouplingPointSet *m2_1=m1->buildPartOfMySelf(cells1,cells1+3,true);
MEDCouplingUMesh *m2=dynamic_cast<MEDCouplingUMesh *>(m2_1);
- DataArrayInt *arr=0;
+ DataArrayIdType *arr=0;
CPPUNIT_ASSERT(m2);
// no permutation policy 0
CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,0,arr));
CPPUNIT_ASSERT(std::equal(cells1,cells1+3,arr->getConstPointer()));
arr->decrRef();
// some modification into m2
- const int modif1[3]={2,4,5};
+ const mcIdType modif1[3]={2,4,5};
std::copy(modif1,modif1+3,m2->getNodalConnectivity()->getPointer()+1);
//policy 0 fails because cell0 in m2 has same orientation be not same connectivity
- const int expected1[3]={5,3,4};
+ const mcIdType expected1[3]={5,3,4};
CPPUNIT_ASSERT(!m1->areCellsIncludedIn(m2,0,arr));
CPPUNIT_ASSERT_EQUAL(3,(int)arr->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)arr->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(cells1,cells1+3,arr->getConstPointer()));
arr->decrRef();
//some new modification into m2
- const int modif2[3]={2,5,4};
+ const mcIdType modif2[3]={2,5,4};
std::copy(modif2,modif2+3,m2->getNodalConnectivity()->getPointer()+1);
//policy 0 fails because cell0 in m2 has not exactly the same conn
CPPUNIT_ASSERT(!m1->areCellsIncludedIn(m2,0,arr));
m1->decrRef();
m2->decrRef();
// Now 1D
- const int cells2[2]={3,2};
+ const mcIdType cells2[2]={3,2};
m1=build1DSourceMesh_2();
m2_1=m1->buildPartOfMySelf(cells2,cells2+2,true);
m2=dynamic_cast<MEDCouplingUMesh *>(m2_1);
CPPUNIT_ASSERT(std::equal(cells2,cells2+2,arr->getConstPointer()));
arr->decrRef();
// some modification into m2
- const int modif3[2]={4,3};
+ const mcIdType modif3[2]={4,3};
std::copy(modif3,modif3+2,m2->getNodalConnectivity()->getPointer()+1);
//policy 0 fails because cell0 in m2 has not exactly the same conn
- const int expected2[2]={4,2};
+ const mcIdType expected2[2]={4,2};
CPPUNIT_ASSERT(!m1->areCellsIncludedIn(m2,0,arr));
CPPUNIT_ASSERT_EQUAL(2,(int)arr->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)arr->getNumberOfComponents());
void MEDCouplingBasicsTest5::testConvexEnvelop2D1()
{
const double coords[662]={7.54758495819e-14,-1.12270326253e-12,8.43143594193,-1.02835845055e-12,4.21571797096,7.30183771609,-4.21571797097,7.30183771609,-8.43143594193,-1.09439981894e-12,-4.21571797097,-7.30183771609,4.21571797097,-7.30183771609,16.8628718839,-1.02835845055e-12,12.6471539129,7.30183771609,8.43143594193,14.6036754322,2.26427548746e-13,14.6036754322,-8.43143594193,14.6036754322,-12.6471539129,7.30183771609,-16.8628718839,-1.39630321727e-12,-12.6471539129,-7.30183771609,-8.43143594193,-14.6036754322,3.7737924791e-14,-14.6036754322,8.43143594193,-14.6036754322,12.6471539129,-7.30183771609,25.2943078258,-1.07553085654e-12,21.0785898548,7.30183771609,16.8628718839,14.6036754322,12.6471539129,21.9055131483,4.21571797096,21.9055131483,-4.21571797097,21.9055131483,-12.6471539129,21.9055131483,-16.8628718839,14.6036754322,-21.0785898548,7.30183771609,-25.2943078258,-1.02835845055e-12,-21.0785898548,-7.30183771609,-16.8628718839,-14.6036754322,-12.6471539129,-21.9055131483,-4.21571797097,-21.9055131483,4.21571797097,-21.9055131483,12.6471539129,-21.9055131483,16.8628718839,-14.6036754322,21.0785898548,-7.30183771609,33.7257437677,-7.45324014622e-13,29.5100257968,7.30183771609,25.2943078258,14.6036754322,21.0785898548,21.9055131483,16.8628718839,29.2073508644,8.43143594193,29.2073508644,-1.20761359331e-12,29.2073508644,-8.43143594193,29.2073508644,-16.8628718839,29.2073508644,-21.0785898548,21.9055131483,-25.2943078258,14.6036754322,-29.5100257968,7.30183771609,-33.7257437677,-7.26455052226e-13,-29.5100257968,-7.30183771609,-25.2943078258,-14.6036754322,-21.0785898548,-21.9055131483,-16.8628718839,-29.2073508644,-8.43143594193,-29.2073508644,4.15117172701e-13,-29.2073508644,8.43143594193,-29.2073508644,16.8628718839,-29.2073508644,21.0785898548,-21.9055131483,25.2943078258,-14.6036754322,29.5100257968,-7.30183771609,42.1571797097,-1.86802727715e-12,37.9414617387,7.30183771609,33.7257437677,14.6036754322,29.5100257968,21.9055131483,25.2943078258,29.2073508644,21.0785898548,36.5091885805,12.6471539129,36.5091885805,4.21571797096,36.5091885805,-4.21571797096,36.5091885805,-12.6471539129,36.5091885805,-21.0785898548,36.5091885805,-25.2943078258,29.2073508644,-29.5100257968,21.9055131483,-33.7257437677,14.6036754322,-37.9414617387,7.30183771609,-42.1571797097,-9.81186044565e-13,-37.9414617387,-7.30183771609,-33.7257437677,-14.6036754322,-29.5100257968,-21.9055131483,-25.2943078258,-29.2073508644,-21.0785898548,-36.5091885805,-12.6471539129,-36.5091885805,-4.21571797097,-36.5091885805,4.21571797097,-36.5091885805,12.6471539129,-36.5091885805,21.0785898548,-36.5091885805,25.2943078258,-29.2073508644,29.5100257968,-21.9055131483,33.7257437677,-14.6036754322,37.9414617387,-7.30183771609,50.5886156516,-6.98151608633e-13,46.3728976806,7.30183771609,42.1571797097,14.6036754322,37.9414617387,21.9055131483,33.7257437677,29.2073508644,29.5100257968,36.5091885805,25.2943078258,43.8110262966,16.8628718839,43.8110262966,8.43143594193,43.8110262966,-1.84915831476e-12,43.8110262966,-8.43143594193,43.8110262966,-16.8628718839,43.8110262966,-25.2943078258,43.8110262966,-29.5100257968,36.5091885805,-33.7257437677,29.2073508644,-37.9414617387,21.9055131483,-42.1571797097,14.6036754322,-46.3728976806,7.30183771609,-50.5886156516,-1.47177906685e-12,-46.3728976806,-7.30183771609,-42.1571797097,-14.6036754322,-37.9414617387,-21.9055131483,-33.7257437677,-29.2073508644,-29.5100257968,-36.5091885805,-25.2943078258,-43.8110262966,-16.8628718839,-43.8110262966,-8.43143594193,-43.8110262966,7.54758495819e-14,-43.8110262966,8.43143594193,-43.8110262966,16.8628718839,-43.8110262966,25.2943078258,-43.8110262966,29.5100257968,-36.5091885805,33.7257437677,-29.2073508644,37.9414617387,-21.9055131483,42.1571797097,-14.6036754322,46.3728976806,-7.30183771609,59.0200515935,-7.9249642061e-13,54.8043336225,7.30183771609,50.5886156516,14.6036754322,46.3728976806,21.9055131483,42.1571797097,29.2073508644,37.9414617387,36.5091885805,33.7257437677,43.8110262966,29.5100257968,51.1128640127,21.0785898548,51.1128640127,12.6471539129,51.1128640127,4.21571797096,51.1128640127,-4.21571797096,51.1128640127,-12.6471539129,51.1128640127,-21.0785898548,51.1128640127,-29.5100257968,51.1128640127,-33.7257437677,43.8110262966,-37.9414617387,36.5091885805,-42.1571797097,29.2073508644,-46.3728976806,21.9055131483,-50.5886156516,14.6036754322,-54.8043336226,7.30183771609,-59.0200515935,-1.31139288649e-12,-54.8043336226,-7.30183771609,-50.5886156516,-14.6036754322,-46.3728976806,-21.9055131483,-42.1571797097,-29.2073508644,-37.9414617387,-36.5091885805,-33.7257437677,-43.8110262966,-29.5100257968,-51.1128640127,-21.0785898548,-51.1128640127,-12.6471539129,-51.1128640127,-4.21571797097,-51.1128640127,4.21571797097,-51.1128640127,12.6471539129,-51.1128640127,21.0785898548,-51.1128640127,29.5100257968,-51.1128640127,33.7257437677,-43.8110262966,37.9414617387,-36.5091885805,42.1571797097,-29.2073508644,46.3728976806,-21.9055131483,50.5886156516,-14.6036754322,54.8043336225,-7.30183771609,67.4514875354,-2.14162723189e-12,63.2357695645,7.30183771609,59.0200515935,14.6036754322,54.8043336226,21.9055131483,50.5886156516,29.2073508644,46.3728976806,36.5091885805,42.1571797097,43.8110262966,37.9414617387,51.1128640127,33.7257437677,58.4147017287,25.2943078258,58.4147017287,16.8628718839,58.4147017287,8.43143594193,58.4147017287,6.79282646237e-13,58.4147017287,-8.43143594193,58.4147017287,-16.8628718839,58.4147017287,-25.2943078258,58.4147017287,-33.7257437677,58.4147017287,-37.9414617387,51.1128640127,-42.1571797097,43.8110262966,-46.3728976806,36.5091885805,-50.5886156516,29.2073508644,-54.8043336226,21.9055131483,-59.0200515935,14.6036754322,-63.2357695645,7.30183771609,-67.4514875354,-1.16044118732e-12,-63.2357695645,-7.30183771609,-59.0200515935,-14.6036754322,-54.8043336226,-21.9055131483,-50.5886156516,-29.2073508644,-46.3728976806,-36.5091885805,-42.1571797097,-43.8110262966,-37.9414617387,-51.1128640127,-33.7257437677,-58.4147017287,-25.2943078258,-58.4147017287,-16.8628718839,-58.4147017287,-8.43143594193,-58.4147017287,-5.66068871864e-14,-58.4147017287,8.43143594193,-58.4147017287,16.8628718839,-58.4147017287,25.2943078258,-58.4147017287,33.7257437677,-58.4147017287,37.9414617387,-51.1128640127,42.1571797097,-43.8110262966,46.3728976806,-36.5091885805,50.5886156516,-29.2073508644,54.8043336226,-21.9055131483,59.0200515935,-14.6036754322,63.2357695645,-7.30183771609,75.8829234774,-2.29257893105e-12,71.6672055064,7.30183771609,67.4514875354,14.6036754322,63.2357695645,21.9055131483,59.0200515935,29.2073508644,54.8043336226,36.5091885805,50.5886156516,43.8110262966,46.3728976806,51.1128640127,42.1571797097,58.4147017287,37.9414617387,65.7165394448,29.5100257968,65.7165394448,21.0785898548,65.7165394448,12.6471539129,65.7165394448,4.21571797097,65.7165394448,-4.21571797096,65.7165394448,-12.6471539129,65.7165394448,-21.0785898548,65.7165394448,-29.5100257968,65.7165394448,-37.9414617387,65.7165394448,-42.1571797097,58.4147017287,-46.3728976806,51.1128640127,-50.5886156516,43.8110262966,-54.8043336226,36.5091885805,-59.0200515935,29.2073508644,-63.2357695645,21.9055131483,-67.4514875354,14.6036754322,-71.6672055064,7.30183771609,-75.8829234774,-1.31139288649e-12,-71.6672055064,-7.30183771609,-67.4514875354,-14.6036754322,-63.2357695645,-21.9055131483,-59.0200515935,-29.2073508644,-54.8043336226,-36.5091885805,-50.5886156516,-43.8110262966,-46.3728976806,-51.1128640127,-42.1571797097,-58.4147017287,-37.9414617387,-65.7165394448,-29.5100257968,-65.7165394448,-21.0785898548,-65.7165394448,-12.6471539129,-65.7165394448,-4.21571797097,-65.7165394448,4.21571797097,-65.7165394448,12.6471539129,-65.7165394448,21.0785898548,-65.7165394448,29.5100257968,-65.7165394448,37.9414617387,-65.7165394448,42.1571797097,-58.4147017287,46.3728976806,-51.1128640127,50.5886156516,-43.8110262966,54.8043336226,-36.5091885805,59.0200515935,-29.2073508644,63.2357695645,-21.9055131483,67.4514875354,-14.6036754322,71.6672055064,-7.30183771609,84.3143594193,-1.49064802924e-12,80.0986414483,7.30183771609,75.8829234774,14.6036754322,71.6672055064,21.9055131483,67.4514875354,29.2073508644,63.2357695645,36.5091885805,59.0200515935,43.8110262966,54.8043336226,51.1128640127,50.5886156516,58.4147017287,46.3728976806,65.7165394448,42.1571797097,73.0183771609,33.7257437677,73.0183771609,25.2943078258,73.0183771609,16.8628718839,73.0183771609,8.43143594193,73.0183771609,2.0755858635e-12,73.0183771609,-8.43143594193,73.0183771609,-16.8628718839,73.0183771609,-25.2943078258,73.0183771609,-33.7257437677,73.0183771609,-42.1571797097,73.0183771609,-46.3728976806,65.7165394448,-50.5886156516,58.4147017287,-54.8043336226,51.1128640127,-59.0200515935,43.8110262966,-63.2357695645,36.5091885805,-67.4514875354,29.2073508644,-71.6672055064,21.9055131483,-75.8829234774,14.6036754322,-80.0986414483,7.30183771609,-84.3143594193,-1.11326878133e-12,-80.0986414483,-7.30183771609,-75.8829234774,-14.6036754322,-71.6672055064,-21.9055131483,-67.4514875354,-29.2073508644,-63.2357695645,-36.5091885805,-59.0200515935,-43.8110262966,-54.8043336226,-51.1128640127,-50.5886156516,-58.4147017287,-46.3728976806,-65.7165394448,-42.1571797097,-73.0183771609,-33.7257437677,-73.0183771609,-25.2943078258,-73.0183771609,-16.8628718839,-73.0183771609,-8.43143594193,-73.0183771609,-5.66068871864e-14,-73.0183771609,8.43143594193,-73.0183771609,16.8628718839,-73.0183771609,25.2943078258,-73.0183771609,33.7257437677,-73.0183771609,42.1571797097,-73.0183771609,46.3728976806,-65.7165394448,50.5886156516,-58.4147017287,54.8043336226,-51.1128640127,59.0200515935,-43.8110262966,63.2357695645,-36.5091885805,67.4514875354,-29.2073508644,71.6672055064,-21.9055131483,75.8829234774,-14.6036754322,80.0986414483,-7.3018377161};
- const int conn[2137]={0,2,3,4,5,6,1,1,8,2,0,6,18,7,2,9,10,3,0,1,8,3,10,11,12,4,0,2,4,3,12,13,14,5,0,5,0,4,14,15,16,6,6,1,0,5,16,17,18,7,20,8,1,18,36,19,8,21,9,2,1,7,20,9,22,23,10,2,8,21,10,23,24,11,3,2,9,11,24,25,26,12,3,10,12,11,26,27,13,4,3,13,12,27,28,29,14,4,14,4,13,29,30,15,5,15,5,14,30,31,32,16,16,6,5,15,32,33,17,17,18,6,16,33,34,35,18,7,1,6,17,35,36,19,38,20,7,36,60,37,20,39,21,8,7,19,38,21,40,22,9,8,20,39,22,41,42,23,9,21,40,23,42,43,24,10,9,22,24,43,44,25,11,10,23,25,44,45,46,26,11,24,26,25,46,47,27,12,11,27,26,47,48,28,13,12,28,27,48,49,50,29,13,29,13,28,50,51,30,14,30,14,29,51,52,31,15,31,15,30,52,53,54,32,32,16,15,31,54,55,33,33,17,16,32,55,56,34,34,35,17,33,56,57,58,35,36,18,17,34,58,59,36,19,7,18,35,59,60,37,62,38,19,60,90,61,38,63,39,20,19,37,62,39,64,40,21,20,38,63,40,65,41,22,21,39,64,41,66,67,42,22,40,65,42,67,68,43,23,22,41,43,68,69,44,24,23,42,44,69,70,45,25,24,43,45,70,71,72,46,25,44,46,45,72,73,47,26,25,47,46,73,74,48,27,26,48,47,74,75,49,28,27,49,48,75,76,77,50,28,50,28,49,77,78,51,29,51,29,50,78,79,52,30,52,30,51,79,80,53,31,53,31,52,80,81,82,54,54,32,31,53,82,83,55,55,33,32,54,83,84,56,56,34,33,55,84,85,57,57,58,34,56,85,86,87,58,59,35,34,57,87,88,59,60,36,35,58,88,89,60,37,19,36,59,89,90,61,92,62,37,90,126,91,62,93,63,38,37,61,92,63,94,64,39,38,62,93,64,95,65,40,39,63,94,65,96,66,41,40,64,95,66,97,98,67,41,65,96,67,98,99,68,42,41,66,68,99,100,69,43,42,67,69,100,101,70,44,43,68,70,101,102,71,45,44,69,71,102,103,104,72,45,70,72,71,104,105,73,46,45,73,72,105,106,74,47,46,74,73,106,107,75,48,47,75,74,107,108,76,49,48,76,75,108,109,110,77,49,77,49,76,110,111,78,50,78,50,77,111,112,79,51,79,51,78,112,113,80,52,80,52,79,113,114,81,53,81,53,80,114,115,116,82,82,54,53,81,116,117,83,83,55,54,82,117,118,84,84,56,55,83,118,119,85,85,57,56,84,119,120,86,86,87,57,85,120,121,122,87,88,58,57,86,122,123,88,89,59,58,87,123,124,89,90,60,59,88,124,125,90,61,37,60,89,125,126,91,128,92,61,126,168,127,92,129,93,62,61,91,128,93,130,94,63,62,92,129,94,131,95,64,63,93,130,95,132,96,65,64,94,131,96,133,97,66,65,95,132,97,134,135,98,66,96,133,98,135,136,99,67,66,97,99,136,137,100,68,67,98,100,137,138,101,69,68,99,101,138,139,102,70,69,100,102,139,140,103,71,70,101,103,140,141,142,104,71,102,104,103,142,143,105,72,71,105,104,143,144,106,73,72,106,105,144,145,107,74,73,107,106,145,146,108,75,74,108,107,146,147,109,76,75,109,108,147,148,149,110,76,110,76,109,149,150,111,77,111,77,110,150,151,112,78,112,78,111,151,152,113,79,113,79,112,152,153,114,80,114,80,113,153,154,115,81,115,81,114,154,155,156,116,116,82,81,115,156,157,117,117,83,82,116,157,158,118,118,84,83,117,158,159,119,119,85,84,118,159,160,120,120,86,85,119,160,161,121,121,122,86,120,161,162,163,122,123,87,86,121,163,164,123,124,88,87,122,164,165,124,125,89,88,123,165,166,125,126,90,89,124,166,167,126,91,61,90,125,167,168,127,170,128,91,168,216,169,128,171,129,92,91,127,170,129,172,130,93,92,128,171,130,173,131,94,93,129,172,131,174,132,95,94,130,173,132,175,133,96,95,131,174,133,176,134,97,96,132,175,134,177,178,135,97,133,176,135,178,179,136,98,97,134,136,179,180,137,99,98,135,137,180,181,138,100,99,136,138,181,182,139,101,100,137,139,182,183,140,102,101,138,140,183,184,141,103,102,139,141,184,185,186,142,103,140,142,141,186,187,143,104,103,143,142,187,188,144,105,104,144,143,188,189,145,106,105,145,144,189,190,146,107,106,146,145,190,191,147,108,107,147,146,191,192,148,109,108,148,147,192,193,194,149,109,149,109,148,194,195,150,110,150,110,149,195,196,151,111,151,111,150,196,197,152,112,152,112,151,197,198,153,113,153,113,152,198,199,154,114,154,114,153,199,200,155,115,155,115,154,200,201,202,156,156,116,115,155,202,203,157,157,117,116,156,203,204,158,158,118,117,157,204,205,159,159,119,118,158,205,206,160,160,120,119,159,206,207,161,161,121,120,160,207,208,162,162,163,121,161,208,209,210,163,164,122,121,162,210,211,164,165,123,122,163,211,212,165,166,124,123,164,212,213,166,167,125,124,165,213,214,167,168,126,125,166,214,215,168,127,91,126,167,215,216,169,218,170,127,216,270,217,170,219,171,128,127,169,218,171,220,172,129,128,170,219,172,221,173,130,129,171,220,173,222,174,131,130,172,221,174,223,175,132,131,173,222,175,224,176,133,132,174,223,176,225,177,134,133,175,224,177,226,227,178,134,176,225,178,227,228,179,135,134,177,179,228,229,180,136,135,178,180,229,230,181,137,136,179,181,230,231,182,138,137,180,182,231,232,183,139,138,181,183,232,233,184,140,139,182,184,233,234,185,141,140,183,185,234,235,236,186,141,184,186,185,236,237,187,142,141,187,186,237,238,188,143,142,188,187,238,239,189,144,143,189,188,239,240,190,145,144,190,189,240,241,191,146,145,191,190,241,242,192,147,146,192,191,242,243,193,148,147,193,192,243,244,245,194,148,194,148,193,245,246,195,149,195,149,194,246,247,196,150,196,150,195,247,248,197,151,197,151,196,248,249,198,152,198,152,197,249,250,199,153,199,153,198,250,251,200,154,200,154,199,251,252,201,155,201,155,200,252,253,254,202,202,156,155,201,254,255,203,203,157,156,202,255,256,204,204,158,157,203,256,257,205,205,159,158,204,257,258,206,206,160,159,205,258,259,207,207,161,160,206,259,260,208,208,162,161,207,260,261,209,209,210,162,208,261,262,263,210,211,163,162,209,263,264,211,212,164,163,210,264,265,212,213,165,164,211,265,266,213,214,166,165,212,266,267,214,215,167,166,213,267,268,215,216,168,167,214,268,269,216,169,127,168,215,269,270,217,272,218,169,270,330,271,218,273,219,170,169,217,272,219,274,220,171,170,218,273,220,275,221,172,171,219,274,221,276,222,173,172,220,275,222,277,223,174,173,221,276,223,278,224,175,174,222,277,224,279,225,176,175,223,278,225,280,226,177,176,224,279,226,281,282,227,177,225,280,227,282,283,228,178,177,226,228,283,284,229,179,178,227,229,284,285,230,180,179,228,230,285,286,231,181,180,229,231,286,287,232,182,181,230,232,287,288,233,183,182,231,233,288,289,234,184,183,232,234,289,290,235,185,184,233,235,290,291,292,236,185,234,236,235,292,293,237,186,185,237,236,293,294,238,187,186,238,237,294,295,239,188,187,239,238,295,296,240,189,188,240,239,296,297,241,190,189,241,240,297,298,242,191,190,242,241,298,299,243,192,191,243,242,299,300,244,193,192,244,243,300,301,302,245,193,245,193,244,302,303,246,194,246,194,245,303,304,247,195,247,195,246,304,305,248,196,248,196,247,305,306,249,197,249,197,248,306,307,250,198,250,198,249,307,308,251,199,251,199,250,308,309,252,200,252,200,251,309,310,253,201,253,201,252,310,311,312,254,254,202,201,253,312,313,255,255,203,202,254,313,314,256,256,204,203,255,314,315,257,257,205,204,256,315,316,258,258,206,205,257,316,317,259,259,207,206,258,317,318,260,260,208,207,259,318,319,261,261,209,208,260,319,320,262,262,263,209,261,320,321,322,263,264,210,209,262,322,323,264,265,211,210,263,323,324,265,266,212,211,264,324,325,266,267,213,212,265,325,326,267,268,214,213,266,326,327,268,269,215,214,267,327,328,269,270,216,215,268,328,329,270,217,169,216,269,329,330,271,272,217,330,273,218,217,271,274,219,218,272,275,220,219,273,276,221,220,274,277,222,221,275,278,223,222,276,279,224,223,277,280,225,224,278,281,226,225,279,281,282,226,280,283,227,226,281,284,228,227,282,285,229,228,283,286,230,229,284,287,231,230,285,288,232,231,286,289,233,232,287,290,234,233,288,291,235,234,289,291,292,235,290,291,293,236,235,292,294,237,236,293,295,238,237,294,296,239,238,295,297,240,239,296,298,241,240,297,299,242,241,298,300,243,242,299,301,244,243,301,300,302,244,244,301,303,245,245,302,304,246,246,303,305,247,247,304,306,248,248,305,307,249,249,306,308,250,250,307,309,251,251,308,310,252,252,309,311,253,311,253,310,312,254,253,311,313,255,254,312,314,256,255,313,315,257,256,314,316,258,257,315,317,259,258,316,318,260,259,317,319,261,260,318,320,262,261,319,321,321,322,262,320,323,263,262,321,324,264,263,322,325,265,264,323,326,266,265,324,327,267,266,325,328,268,267,326,329,269,268,327,330,270,269,328,271,217,270,329};
- const int connI[332]={0,7,14,21,28,35,42,49,56,63,70,77,84,91,98,105,112,119,126,133,140,147,154,161,168,175,182,189,196,203,210,217,224,231,238,245,252,259,266,273,280,287,294,301,308,315,322,329,336,343,350,357,364,371,378,385,392,399,406,413,420,427,434,441,448,455,462,469,476,483,490,497,504,511,518,525,532,539,546,553,560,567,574,581,588,595,602,609,616,623,630,637,644,651,658,665,672,679,686,693,700,707,714,721,728,735,742,749,756,763,770,777,784,791,798,805,812,819,826,833,840,847,854,861,868,875,882,889,896,903,910,917,924,931,938,945,952,959,966,973,980,987,994,1001,1008,1015,1022,1029,1036,1043,1050,1057,1064,1071,1078,1085,1092,1099,1106,1113,1120,1127,1134,1141,1148,1155,1162,1169,1176,1183,1190,1197,1204,1211,1218,1225,1232,1239,1246,1253,1260,1267,1274,1281,1288,1295,1302,1309,1316,1323,1330,1337,1344,1351,1358,1365,1372,1379,1386,1393,1400,1407,1414,1421,1428,1435,1442,1449,1456,1463,1470,1477,1484,1491,1498,1505,1512,1519,1526,1533,1540,1547,1554,1561,1568,1575,1582,1589,1596,1603,1610,1617,1624,1631,1638,1645,1652,1659,1666,1673,1680,1687,1694,1701,1708,1715,1722,1729,1736,1743,1750,1757,1764,1771,1778,1785,1792,1799,1806,1813,1820,1827,1834,1841,1848,1855,1862,1869,1876,1883,1890,1897,1901,1905,1909,1913,1917,1921,1925,1929,1933,1937,1941,1945,1949,1953,1957,1961,1965,1969,1973,1977,1981,1985,1989,1993,1997,2001,2005,2009,2013,2017,2021,2025,2029,2033,2037,2041,2045,2049,2053,2057,2061,2065,2069,2073,2077,2081,2085,2089,2093,2097,2101,2105,2109,2113,2117,2121,2125,2129,2133,2137};
+ const mcIdType conn[2137]={0,2,3,4,5,6,1,1,8,2,0,6,18,7,2,9,10,3,0,1,8,3,10,11,12,4,0,2,4,3,12,13,14,5,0,5,0,4,14,15,16,6,6,1,0,5,16,17,18,7,20,8,1,18,36,19,8,21,9,2,1,7,20,9,22,23,10,2,8,21,10,23,24,11,3,2,9,11,24,25,26,12,3,10,12,11,26,27,13,4,3,13,12,27,28,29,14,4,14,4,13,29,30,15,5,15,5,14,30,31,32,16,16,6,5,15,32,33,17,17,18,6,16,33,34,35,18,7,1,6,17,35,36,19,38,20,7,36,60,37,20,39,21,8,7,19,38,21,40,22,9,8,20,39,22,41,42,23,9,21,40,23,42,43,24,10,9,22,24,43,44,25,11,10,23,25,44,45,46,26,11,24,26,25,46,47,27,12,11,27,26,47,48,28,13,12,28,27,48,49,50,29,13,29,13,28,50,51,30,14,30,14,29,51,52,31,15,31,15,30,52,53,54,32,32,16,15,31,54,55,33,33,17,16,32,55,56,34,34,35,17,33,56,57,58,35,36,18,17,34,58,59,36,19,7,18,35,59,60,37,62,38,19,60,90,61,38,63,39,20,19,37,62,39,64,40,21,20,38,63,40,65,41,22,21,39,64,41,66,67,42,22,40,65,42,67,68,43,23,22,41,43,68,69,44,24,23,42,44,69,70,45,25,24,43,45,70,71,72,46,25,44,46,45,72,73,47,26,25,47,46,73,74,48,27,26,48,47,74,75,49,28,27,49,48,75,76,77,50,28,50,28,49,77,78,51,29,51,29,50,78,79,52,30,52,30,51,79,80,53,31,53,31,52,80,81,82,54,54,32,31,53,82,83,55,55,33,32,54,83,84,56,56,34,33,55,84,85,57,57,58,34,56,85,86,87,58,59,35,34,57,87,88,59,60,36,35,58,88,89,60,37,19,36,59,89,90,61,92,62,37,90,126,91,62,93,63,38,37,61,92,63,94,64,39,38,62,93,64,95,65,40,39,63,94,65,96,66,41,40,64,95,66,97,98,67,41,65,96,67,98,99,68,42,41,66,68,99,100,69,43,42,67,69,100,101,70,44,43,68,70,101,102,71,45,44,69,71,102,103,104,72,45,70,72,71,104,105,73,46,45,73,72,105,106,74,47,46,74,73,106,107,75,48,47,75,74,107,108,76,49,48,76,75,108,109,110,77,49,77,49,76,110,111,78,50,78,50,77,111,112,79,51,79,51,78,112,113,80,52,80,52,79,113,114,81,53,81,53,80,114,115,116,82,82,54,53,81,116,117,83,83,55,54,82,117,118,84,84,56,55,83,118,119,85,85,57,56,84,119,120,86,86,87,57,85,120,121,122,87,88,58,57,86,122,123,88,89,59,58,87,123,124,89,90,60,59,88,124,125,90,61,37,60,89,125,126,91,128,92,61,126,168,127,92,129,93,62,61,91,128,93,130,94,63,62,92,129,94,131,95,64,63,93,130,95,132,96,65,64,94,131,96,133,97,66,65,95,132,97,134,135,98,66,96,133,98,135,136,99,67,66,97,99,136,137,100,68,67,98,100,137,138,101,69,68,99,101,138,139,102,70,69,100,102,139,140,103,71,70,101,103,140,141,142,104,71,102,104,103,142,143,105,72,71,105,104,143,144,106,73,72,106,105,144,145,107,74,73,107,106,145,146,108,75,74,108,107,146,147,109,76,75,109,108,147,148,149,110,76,110,76,109,149,150,111,77,111,77,110,150,151,112,78,112,78,111,151,152,113,79,113,79,112,152,153,114,80,114,80,113,153,154,115,81,115,81,114,154,155,156,116,116,82,81,115,156,157,117,117,83,82,116,157,158,118,118,84,83,117,158,159,119,119,85,84,118,159,160,120,120,86,85,119,160,161,121,121,122,86,120,161,162,163,122,123,87,86,121,163,164,123,124,88,87,122,164,165,124,125,89,88,123,165,166,125,126,90,89,124,166,167,126,91,61,90,125,167,168,127,170,128,91,168,216,169,128,171,129,92,91,127,170,129,172,130,93,92,128,171,130,173,131,94,93,129,172,131,174,132,95,94,130,173,132,175,133,96,95,131,174,133,176,134,97,96,132,175,134,177,178,135,97,133,176,135,178,179,136,98,97,134,136,179,180,137,99,98,135,137,180,181,138,100,99,136,138,181,182,139,101,100,137,139,182,183,140,102,101,138,140,183,184,141,103,102,139,141,184,185,186,142,103,140,142,141,186,187,143,104,103,143,142,187,188,144,105,104,144,143,188,189,145,106,105,145,144,189,190,146,107,106,146,145,190,191,147,108,107,147,146,191,192,148,109,108,148,147,192,193,194,149,109,149,109,148,194,195,150,110,150,110,149,195,196,151,111,151,111,150,196,197,152,112,152,112,151,197,198,153,113,153,113,152,198,199,154,114,154,114,153,199,200,155,115,155,115,154,200,201,202,156,156,116,115,155,202,203,157,157,117,116,156,203,204,158,158,118,117,157,204,205,159,159,119,118,158,205,206,160,160,120,119,159,206,207,161,161,121,120,160,207,208,162,162,163,121,161,208,209,210,163,164,122,121,162,210,211,164,165,123,122,163,211,212,165,166,124,123,164,212,213,166,167,125,124,165,213,214,167,168,126,125,166,214,215,168,127,91,126,167,215,216,169,218,170,127,216,270,217,170,219,171,128,127,169,218,171,220,172,129,128,170,219,172,221,173,130,129,171,220,173,222,174,131,130,172,221,174,223,175,132,131,173,222,175,224,176,133,132,174,223,176,225,177,134,133,175,224,177,226,227,178,134,176,225,178,227,228,179,135,134,177,179,228,229,180,136,135,178,180,229,230,181,137,136,179,181,230,231,182,138,137,180,182,231,232,183,139,138,181,183,232,233,184,140,139,182,184,233,234,185,141,140,183,185,234,235,236,186,141,184,186,185,236,237,187,142,141,187,186,237,238,188,143,142,188,187,238,239,189,144,143,189,188,239,240,190,145,144,190,189,240,241,191,146,145,191,190,241,242,192,147,146,192,191,242,243,193,148,147,193,192,243,244,245,194,148,194,148,193,245,246,195,149,195,149,194,246,247,196,150,196,150,195,247,248,197,151,197,151,196,248,249,198,152,198,152,197,249,250,199,153,199,153,198,250,251,200,154,200,154,199,251,252,201,155,201,155,200,252,253,254,202,202,156,155,201,254,255,203,203,157,156,202,255,256,204,204,158,157,203,256,257,205,205,159,158,204,257,258,206,206,160,159,205,258,259,207,207,161,160,206,259,260,208,208,162,161,207,260,261,209,209,210,162,208,261,262,263,210,211,163,162,209,263,264,211,212,164,163,210,264,265,212,213,165,164,211,265,266,213,214,166,165,212,266,267,214,215,167,166,213,267,268,215,216,168,167,214,268,269,216,169,127,168,215,269,270,217,272,218,169,270,330,271,218,273,219,170,169,217,272,219,274,220,171,170,218,273,220,275,221,172,171,219,274,221,276,222,173,172,220,275,222,277,223,174,173,221,276,223,278,224,175,174,222,277,224,279,225,176,175,223,278,225,280,226,177,176,224,279,226,281,282,227,177,225,280,227,282,283,228,178,177,226,228,283,284,229,179,178,227,229,284,285,230,180,179,228,230,285,286,231,181,180,229,231,286,287,232,182,181,230,232,287,288,233,183,182,231,233,288,289,234,184,183,232,234,289,290,235,185,184,233,235,290,291,292,236,185,234,236,235,292,293,237,186,185,237,236,293,294,238,187,186,238,237,294,295,239,188,187,239,238,295,296,240,189,188,240,239,296,297,241,190,189,241,240,297,298,242,191,190,242,241,298,299,243,192,191,243,242,299,300,244,193,192,244,243,300,301,302,245,193,245,193,244,302,303,246,194,246,194,245,303,304,247,195,247,195,246,304,305,248,196,248,196,247,305,306,249,197,249,197,248,306,307,250,198,250,198,249,307,308,251,199,251,199,250,308,309,252,200,252,200,251,309,310,253,201,253,201,252,310,311,312,254,254,202,201,253,312,313,255,255,203,202,254,313,314,256,256,204,203,255,314,315,257,257,205,204,256,315,316,258,258,206,205,257,316,317,259,259,207,206,258,317,318,260,260,208,207,259,318,319,261,261,209,208,260,319,320,262,262,263,209,261,320,321,322,263,264,210,209,262,322,323,264,265,211,210,263,323,324,265,266,212,211,264,324,325,266,267,213,212,265,325,326,267,268,214,213,266,326,327,268,269,215,214,267,327,328,269,270,216,215,268,328,329,270,217,169,216,269,329,330,271,272,217,330,273,218,217,271,274,219,218,272,275,220,219,273,276,221,220,274,277,222,221,275,278,223,222,276,279,224,223,277,280,225,224,278,281,226,225,279,281,282,226,280,283,227,226,281,284,228,227,282,285,229,228,283,286,230,229,284,287,231,230,285,288,232,231,286,289,233,232,287,290,234,233,288,291,235,234,289,291,292,235,290,291,293,236,235,292,294,237,236,293,295,238,237,294,296,239,238,295,297,240,239,296,298,241,240,297,299,242,241,298,300,243,242,299,301,244,243,301,300,302,244,244,301,303,245,245,302,304,246,246,303,305,247,247,304,306,248,248,305,307,249,249,306,308,250,250,307,309,251,251,308,310,252,252,309,311,253,311,253,310,312,254,253,311,313,255,254,312,314,256,255,313,315,257,256,314,316,258,257,315,317,259,258,316,318,260,259,317,319,261,260,318,320,262,261,319,321,321,322,262,320,323,263,262,321,324,264,263,322,325,265,264,323,326,266,265,324,327,267,266,325,328,268,267,326,329,269,268,327,330,270,269,328,271,217,270,329};
+ const mcIdType connI[332]={0,7,14,21,28,35,42,49,56,63,70,77,84,91,98,105,112,119,126,133,140,147,154,161,168,175,182,189,196,203,210,217,224,231,238,245,252,259,266,273,280,287,294,301,308,315,322,329,336,343,350,357,364,371,378,385,392,399,406,413,420,427,434,441,448,455,462,469,476,483,490,497,504,511,518,525,532,539,546,553,560,567,574,581,588,595,602,609,616,623,630,637,644,651,658,665,672,679,686,693,700,707,714,721,728,735,742,749,756,763,770,777,784,791,798,805,812,819,826,833,840,847,854,861,868,875,882,889,896,903,910,917,924,931,938,945,952,959,966,973,980,987,994,1001,1008,1015,1022,1029,1036,1043,1050,1057,1064,1071,1078,1085,1092,1099,1106,1113,1120,1127,1134,1141,1148,1155,1162,1169,1176,1183,1190,1197,1204,1211,1218,1225,1232,1239,1246,1253,1260,1267,1274,1281,1288,1295,1302,1309,1316,1323,1330,1337,1344,1351,1358,1365,1372,1379,1386,1393,1400,1407,1414,1421,1428,1435,1442,1449,1456,1463,1470,1477,1484,1491,1498,1505,1512,1519,1526,1533,1540,1547,1554,1561,1568,1575,1582,1589,1596,1603,1610,1617,1624,1631,1638,1645,1652,1659,1666,1673,1680,1687,1694,1701,1708,1715,1722,1729,1736,1743,1750,1757,1764,1771,1778,1785,1792,1799,1806,1813,1820,1827,1834,1841,1848,1855,1862,1869,1876,1883,1890,1897,1901,1905,1909,1913,1917,1921,1925,1929,1933,1937,1941,1945,1949,1953,1957,1961,1965,1969,1973,1977,1981,1985,1989,1993,1997,2001,2005,2009,2013,2017,2021,2025,2029,2033,2037,2041,2045,2049,2053,2057,2061,2065,2069,2073,2077,2081,2085,2089,2093,2097,2101,2105,2109,2113,2117,2121,2125,2129,2133,2137};
//
MEDCouplingUMesh *m=MEDCouplingUMesh::New("convexhull",2);
m->allocateCells(331);
coordsDa->decrRef();
m->checkConsistencyLight();
//
- DataArrayInt *da=m->convexEnvelop2D();
+ DataArrayIdType *da=m->convexEnvelop2D();
m->checkConsistencyLight();
CPPUNIT_ASSERT(coordsDa==m->getCoords());
- DataArrayInt *daC=da->buildComplement(331);
+ DataArrayIdType *daC=da->buildComplement(331);
da->decrRef();
- const int expected[58]={271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,302,303,304,305,306,307,308,309,310,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330};
- DataArrayInt *expected2=DataArrayInt::New();
+ const mcIdType expected[58]={271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,302,303,304,305,306,307,308,309,310,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330};
+ DataArrayIdType *expected2=DataArrayIdType::New();
expected2->alloc(58,1);
std::copy(expected,expected+58,expected2->getPointer());
CPPUNIT_ASSERT(expected2->isEqual(*daC));
vals->substractEqual(ref2);
ref2->decrRef();
vals->abs();
- DataArrayInt *theTest=vals->findIdsInRange(-1.,1e-7);
+ DataArrayIdType *theTest=vals->findIdsInRange(-1.,1e-7);
CPPUNIT_ASSERT(theTest->isIota(331));
theTest->decrRef();
valsF->decrRef();
void MEDCouplingBasicsTest5::testDataArraySort1()
{
- DataArrayInt *arr=DataArrayInt::New();
+ DataArrayIdType *arr=DataArrayIdType::New();
CPPUNIT_ASSERT_THROW(arr->sort(true),INTERP_KERNEL::Exception);//no allocation
CPPUNIT_ASSERT_THROW(arr->sort(false),INTERP_KERNEL::Exception);//no allocation
- const int values[6]={2,1,6,5,4,7};
+ const mcIdType values[6]={2,1,6,5,4,7};
arr->alloc(3,2);
CPPUNIT_ASSERT_THROW(arr->sort(true),INTERP_KERNEL::Exception);//no one component
CPPUNIT_ASSERT_THROW(arr->sort(false),INTERP_KERNEL::Exception);//no one component
arr->rearrange(1);
std::copy(values,values+6,arr->getPointer());
- DataArrayInt *arr1=arr->deepCopy();
- DataArrayInt *arr2=arr->deepCopy();
+ DataArrayIdType *arr1=arr->deepCopy();
+ DataArrayIdType *arr2=arr->deepCopy();
arr1->sort(true);
- const int expected1[6]={1,2,4,5,6,7};
+ const mcIdType expected1[6]={1,2,4,5,6,7};
CPPUNIT_ASSERT_EQUAL(6,(int)arr1->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)arr1->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(expected1,expected1+6,arr1->begin()));
arr2->sort(false);
- const int expected2[6]={7,6,5,4,2,1};
+ const mcIdType expected2[6]={7,6,5,4,2,1};
CPPUNIT_ASSERT_EQUAL(6,(int)arr2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)arr2->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(expected2,expected2+6,arr2->begin()));
void MEDCouplingBasicsTest5::testPartitionBySpreadZone1()
{
MEDCouplingUMesh *m=build2DTargetMesh_1();
- const int part0[3]={2,3,4};
- const int part1[2]={0,1};
+ const mcIdType part0[3]={2,3,4};
+ const mcIdType part1[2]={0,1};
MEDCouplingUMesh *m1=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelf(part0,part0+3));
MEDCouplingUMesh *m2=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelf(part1,part1+2));
std::vector<const MEDCouplingUMesh *> v(3); v[0]=m; v[1]=m1; v[2]=m2;
MEDCouplingUMesh *m4=MEDCouplingUMesh::MergeUMeshes(v);
- const int renum[10]={5,2,9,6,4,7,0,1,3,8};
+ const mcIdType renum[10]={5,2,9,6,4,7,0,1,3,8};
m4->renumberCells(renum);
//
- std::vector<DataArrayInt *> v2=m4->partitionBySpreadZone();
+ std::vector<DataArrayIdType *> v2=m4->partitionBySpreadZone();
CPPUNIT_ASSERT_EQUAL(3,(int)v2.size());
- const int expected0[3]={0,1,7};
- const int expected1[5]={2,4,5,6,9};
- const int expected2[2]={3,8};
+ const mcIdType expected0[3]={0,1,7};
+ const mcIdType expected1[5]={2,4,5,6,9};
+ const mcIdType expected2[2]={3,8};
CPPUNIT_ASSERT_EQUAL(3,(int)v2[0]->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)v2[0]->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(5,(int)v2[1]->getNumberOfTuples());
MEDCouplingUMesh *m5=m4->buildSpreadZonesWithPoly();
CPPUNIT_ASSERT_EQUAL(3,(int)m5->getNumberOfCells());
CPPUNIT_ASSERT(m5->getCoords()==m4->getCoords());
- const int expected3[23]={5,15,16,17,14,11,13,12,5,2,1,0,3,6,7,8,5,5,18,21,22,20,19};
- const int expected4[4]={0,8,17,23};
+ const mcIdType expected3[23]={5,15,16,17,14,11,13,12,5,2,1,0,3,6,7,8,5,5,18,21,22,20,19};
+ const mcIdType expected4[4]={0,8,17,23};
CPPUNIT_ASSERT_EQUAL(23,(int)m5->getNodalConnectivity()->getNumberOfTuples());
CPPUNIT_ASSERT(std::equal(expected3,expected3+23,m5->getNodalConnectivity()->getConstPointer()));
CPPUNIT_ASSERT_EQUAL(4,(int)m5->getNodalConnectivityIndex()->getNumberOfTuples());
void MEDCouplingBasicsTest5::testGiveCellsWithType1()
{
- const int expected0[2]={1,2};
- const int expected1[3]={0,3,4};
+ const mcIdType expected0[2]={1,2};
+ const mcIdType expected1[3]={0,3,4};
MEDCouplingUMesh *m=build2DTargetMesh_1();
- DataArrayInt *da=m->giveCellsWithType(INTERP_KERNEL::NORM_TRI3);
+ DataArrayIdType *da=m->giveCellsWithType(INTERP_KERNEL::NORM_TRI3);
CPPUNIT_ASSERT_EQUAL(2,(int)da->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(expected0,expected0+2,da->getConstPointer()));
// First slice in the middle of 3D cells
const double vec1[3]={-0.07,1.,0.07};
const double origin1[3]={1.524,1.4552,1.74768};
- DataArrayInt *ids=0;
+ DataArrayIdType *ids=0;
MEDCouplingUMesh *slice1=mesh3D->buildSlice3D(origin1,vec1,1e-10,ids);
//
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
arr->rearrange(1); arr->iota(2.); arr->rearrange(2);
f->setArray(arr);
f->checkConsistencyLight();
- const int exp1[9]={1,3,4,7,9,10,13,15,16};
- DataArrayInt *expected1=DataArrayInt::New(); expected1->alloc(9,1); std::copy(exp1,exp1+9,expected1->getPointer());
+ const mcIdType exp1[9]={1,3,4,7,9,10,13,15,16};
+ DataArrayIdType *expected1=DataArrayIdType::New(); expected1->alloc(9,1); std::copy(exp1,exp1+9,expected1->getPointer());
CPPUNIT_ASSERT(expected1->isEqual(*ids));
DataArrayDouble *arr2=arr->selectByTupleIdSafe(expected1->begin(),expected1->end());
//
DataArrayDouble *arr=DataArrayDouble::New(); arr->alloc(52,2) ; arr->rearrange(1) ; arr->iota(7.); arr->rearrange(2);
f->setArray(arr);
//
- const int subPart1[3]={1,5,9};
+ const mcIdType subPart1[3]={1,5,9};
MEDCouplingFieldDouble *f2=f->buildSubPart(subPart1,subPart1+3);
f2->checkConsistencyLight();
- DataArrayInt *cI=m->computeNbOfNodesPerCell();
+ DataArrayIdType *cI=m->computeNbOfNodesPerCell();
cI->computeOffsetsFull();
- const int sel1[3]={1,5,9};
- DataArrayInt *sel=DataArrayInt::New(); sel->useArray(sel1,false,DeallocType::CPP_DEALLOC,3,1);
- DataArrayInt *res=sel->buildExplicitArrByRanges(cI);
+ const mcIdType sel1[3]={1,5,9};
+ DataArrayIdType *sel=DataArrayIdType::New(); sel->useArray(sel1,false,DeallocType::CPP_DEALLOC,3,1);
+ DataArrayIdType *res=sel->buildExplicitArrByRanges(cI);
DataArrayDouble *arr2=arr->selectByTupleIdSafe(res->begin(),res->end());
const double expected1[30]={13.,14.,15.,16.,17.,18.,19.,20.,59.,60.,61.,62.,63.,64.,95.,96.,97.,98.,99.,100.,101.,102.,103.,104.,105.,106.,107.,108.,109.,110.};
DataArrayDouble *arr3=DataArrayDouble::New(); arr3->useArray(expected1,false,DeallocType::CPP_DEALLOC,15,2);
CPPUNIT_ASSERT_EQUAL(18,(int)skin->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(1,skin->getMeshDimension());
CPPUNIT_ASSERT(skin->getCoords()==umesh->getCoords());
- const int expected1[19]={0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54};
- const int expected2[54]={1,1,0,1,0,5,1,2,1,1,3,2,1,4,3,1,9,4,1,5,10,1,14,9,1,10,15,1,19,14,1,15,20,1,24,19,1,20,25,1,25,26,1,26,27,1,27,28,1,28,29,1,29,24};
- CPPUNIT_ASSERT_EQUAL((std::size_t)19,skin->getNodalConnectivityIndex()->getNbOfElems());
+ const mcIdType expected1[19]={0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54};
+ const mcIdType expected2[54]={1,1,0,1,0,5,1,2,1,1,3,2,1,4,3,1,9,4,1,5,10,1,14,9,1,10,15,1,19,14,1,15,20,1,24,19,1,20,25,1,25,26,1,26,27,1,27,28,1,28,29,1,29,24};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),skin->getNodalConnectivityIndex()->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected1,expected1+19,skin->getNodalConnectivityIndex()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL((std::size_t)54,skin->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(54),skin->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected2,expected2+54,skin->getNodalConnectivity()->getConstPointer()));
- DataArrayInt *ids=skin->computeFetchedNodeIds();
- const int expected3[18]={0,1,2,3,4,5,9,10,14,15,19,20,24,25,26,27,28,29};
- CPPUNIT_ASSERT_EQUAL((std::size_t)18,ids->getNbOfElems());
+ DataArrayIdType *ids=skin->computeFetchedNodeIds();
+ const mcIdType expected3[18]={0,1,2,3,4,5,9,10,14,15,19,20,24,25,26,27,28,29};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(18),ids->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected3,expected3+18,ids->getConstPointer()));
MEDCouplingUMesh *part=dynamic_cast<MEDCouplingUMesh *>(umesh->buildFacePartOfMySelfNode(ids->begin(),ids->end(),true));
part->setName(skin->getName().c_str());
CPPUNIT_ASSERT(part->isEqual(skin,1e-12));
MEDCouplingUMesh *part2=dynamic_cast<MEDCouplingUMesh *>(part->buildPartOfMySelfSlice(1,18,2,true));
- DataArrayInt *ids2=DataArrayInt::Range(0,18,2);
+ DataArrayIdType *ids2=DataArrayIdType::Range(0,18,2);
part->setPartOfMySelf(ids2->begin(),ids2->end(),*part2);
ids2->decrRef();
CPPUNIT_ASSERT(!part->isEqual(skin,1e-12));
- DataArrayInt *trad=part->zipConnectivityTraducer(0);
+ DataArrayIdType *trad=part->zipConnectivityTraducer(0);
CPPUNIT_ASSERT_EQUAL(9,(int)part->getNumberOfCells());
- const int expected4[18]={0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8};
+ const mcIdType expected4[18]={0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8};
CPPUNIT_ASSERT(std::equal(expected4,expected4+18,trad->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL((std::size_t)18,trad->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(18),trad->getNbOfElems());
trad->decrRef();
part->decrRef();
part2->decrRef();
MEDCouplingUMesh *m=build2DTargetMesh_1();
std::set<INTERP_KERNEL::NormalizedCellType> s; s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4);
CPPUNIT_ASSERT(s==m->getAllGeoTypes());
- const int ids1[3]={0,3,4};
+ const mcIdType ids1[3]={0,3,4};
MEDCouplingUMesh *part=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelf(ids1,ids1+3,true));
part->simplexize(0)->decrRef();
- const int ids2[3]={1,2,5};
+ const mcIdType ids2[3]={1,2,5};
MEDCouplingUMesh *part2=static_cast<MEDCouplingUMesh *>(part->buildPartOfMySelf(ids2,ids2+3,true));
m->setPartOfMySelf(ids1,ids1+3,*part2);
- const int expected1[20]={3,0,4,1,3,1,4,2,3,4,5,2,3,6,7,4,3,7,5,4};
+ const mcIdType expected1[20]={3,0,4,1,3,1,4,2,3,4,5,2,3,6,7,4,3,7,5,4};
CPPUNIT_ASSERT(std::equal(expected1,expected1+20,m->getNodalConnectivity()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL((std::size_t)20,m->getNodalConnectivity()->getNbOfElems());
- const int expected2[6]={0,4,8,12,16,20};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(20),m->getNodalConnectivity()->getNbOfElems());
+ const mcIdType expected2[6]={0,4,8,12,16,20};
CPPUNIT_ASSERT(std::equal(expected2,expected2+6,m->getNodalConnectivityIndex()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(6),m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3);
CPPUNIT_ASSERT(s==m->getAllGeoTypes());
m->decrRef(); part->decrRef(); part2->decrRef();
part=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelf(ids1,ids1+2,true));
part->convertAllToPoly();
m->setPartOfMySelf(ids1+1,ids1+3,*part);
- const int expected3[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3};
+ const mcIdType expected3[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3};
CPPUNIT_ASSERT(std::equal(expected3,expected3+23,m->getNodalConnectivity()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL((std::size_t)23,m->getNodalConnectivity()->getNbOfElems());
- const int expected4[6]={0,5,9,13,18,23};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(23),m->getNodalConnectivity()->getNbOfElems());
+ const mcIdType expected4[6]={0,5,9,13,18,23};
CPPUNIT_ASSERT(std::equal(expected4,expected4+6,m->getNodalConnectivityIndex()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(6),m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4); s.insert(INTERP_KERNEL::NORM_POLYGON);
CPPUNIT_ASSERT(s==m->getAllGeoTypes());
m->decrRef(); part->decrRef();
m=build2DTargetMesh_1();
part=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelfSlice(3,5,1,true));
m->setPartOfMySelfSlice(1,3,1,*part);
- const int expected5[25]={4,0,3,4,1,4,6,7,4,3,4,7,8,5,4,4,6,7,4,3,4,7,8,5,4};
+ const mcIdType expected5[25]={4,0,3,4,1,4,6,7,4,3,4,7,8,5,4,4,6,7,4,3,4,7,8,5,4};
CPPUNIT_ASSERT(std::equal(expected5,expected5+25,m->getNodalConnectivity()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL((std::size_t)25,m->getNodalConnectivity()->getNbOfElems());
- const int expected6[6]={0,5,10,15,20,25};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(25),m->getNodalConnectivity()->getNbOfElems());
+ const mcIdType expected6[6]={0,5,10,15,20,25};
CPPUNIT_ASSERT(std::equal(expected6,expected6+6,m->getNodalConnectivityIndex()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(6),m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_QUAD4);
CPPUNIT_ASSERT(s==m->getAllGeoTypes());
m->decrRef(); part->decrRef();
part=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelfSlice(0,5,3,true));
part->convertAllToPoly();
m->setPartOfMySelfSlice(3,5,1,*part);
- const int expected7[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3};
+ const mcIdType expected7[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3};
CPPUNIT_ASSERT(std::equal(expected7,expected7+23,m->getNodalConnectivity()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL((std::size_t)23,m->getNodalConnectivity()->getNbOfElems());
- const int expected8[6]={0,5,9,13,18,23};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(23),m->getNodalConnectivity()->getNbOfElems());
+ const mcIdType expected8[6]={0,5,9,13,18,23};
CPPUNIT_ASSERT(std::equal(expected8,expected8+6,m->getNodalConnectivityIndex()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(6),m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4); s.insert(INTERP_KERNEL::NORM_POLYGON);
CPPUNIT_ASSERT(s==m->getAllGeoTypes());
m->decrRef(); part->decrRef();
part=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelfSlice(3,-1,-3,true));
part->convertAllToPoly();
m->setPartOfMySelfSlice(4,2,-1,*part);
- const int expected9[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3};
+ const mcIdType expected9[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3};
CPPUNIT_ASSERT(std::equal(expected9,expected9+23,m->getNodalConnectivity()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL((std::size_t)23,m->getNodalConnectivity()->getNbOfElems());
- const int expected10[6]={0,5,9,13,18,23};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(23),m->getNodalConnectivity()->getNbOfElems());
+ const mcIdType expected10[6]={0,5,9,13,18,23};
CPPUNIT_ASSERT(std::equal(expected10,expected10+6,m->getNodalConnectivityIndex()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(6),m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4); s.insert(INTERP_KERNEL::NORM_POLYGON);
CPPUNIT_ASSERT(s==m->getAllGeoTypes());
part->decrRef();
void MEDCouplingBasicsTest5::testUnPolyze3()
{
const double coord[18]={0.0,0.5,-0.5,-0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.0,0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,0.5};
- const int conn[22]={1,2,5,4,-1,4,3,0,1,-1,2,0,3,5,-1,0,2,1,-1,4,5,3};
+ const mcIdType conn[22]={1,2,5,4,-1,4,3,0,1,-1,2,0,3,5,-1,0,2,1,-1,4,5,3};
MEDCouplingUMesh *m=MEDCouplingUMesh::New("a mesh",3);
m->allocateCells(1);
m->insertNextCell(INTERP_KERNEL::NORM_POLYHED,22,conn);
std::set<INTERP_KERNEL::NormalizedCellType> s; s.insert(INTERP_KERNEL::NORM_PENTA6);
CPPUNIT_ASSERT(s==m->getAllGeoTypes());
//
- const int expected1[2]={0,7};
- const int expected2[7]={16,0,2,1,3,5,4};
+ const mcIdType expected1[2]={0,7};
+ const mcIdType expected2[7]={16,0,2,1,3,5,4};
CPPUNIT_ASSERT_EQUAL(2,(int)m->getNodalConnectivityIndex()->getNumberOfTuples());
CPPUNIT_ASSERT(std::equal(expected1,expected1+2,m->getNodalConnectivityIndex()->getConstPointer()));
CPPUNIT_ASSERT_EQUAL(7,(int)m->getNodalConnectivity()->getNumberOfTuples());
d->decrRef();
d2->decrRef();
//
- const int vals2[4]={9,8,7,6};
- DataArrayInt *d4=DataArrayInt::New(); d4->useArray(vals2,false,DeallocType::CPP_DEALLOC,4,1); d4->setInfoOnComponent(0,"mass [kg]") ; d4->setName("aname");
- DataArrayInt *d5=d4->duplicateEachTupleNTimes(3);
- const int vals3[12]={9,9,9,8,8,8,7,7,7,6,6,6};
- DataArrayInt *d6=DataArrayInt::New(); d6->useArray(vals3,false,DeallocType::CPP_DEALLOC,4*3,1); d6->setName("aname"); d6->setInfoOnComponent(0,"mass [kg]");
+ const mcIdType vals2[4]={9,8,7,6};
+ DataArrayIdType *d4=DataArrayIdType::New(); d4->useArray(vals2,false,DeallocType::CPP_DEALLOC,4,1); d4->setInfoOnComponent(0,"mass [kg]") ; d4->setName("aname");
+ DataArrayIdType *d5=d4->duplicateEachTupleNTimes(3);
+ const mcIdType vals3[12]={9,9,9,8,8,8,7,7,7,6,6,6};
+ DataArrayIdType *d6=DataArrayIdType::New(); d6->useArray(vals3,false,DeallocType::CPP_DEALLOC,4*3,1); d6->setName("aname"); d6->setInfoOnComponent(0,"mass [kg]");
CPPUNIT_ASSERT(d5->isEqual(*d6)); d6->decrRef();
d4->decrRef();
d5->decrRef();
const double coordsData[376]={41,0,42,0,0,42,0,41,41.5,0,29.698484809834998,29.698484809834994,0,41.5,28.991378028648452,28.991378028648445,-42,0,-41,0,-29.698484809834994,29.698484809834998,-41.5,0,-28.991378028648445,28.991378028648452,0,-42,0,-41,-29.698484809835001,-29.698484809834994,0,-41.5,-28.991378028648455,-28.991378028648445,29.698484809834987,-29.698484809835001,28.991378028648441,-28.991378028648455,43,0,0,43,42.5,0,30.405591591021544,30.40559159102154,0,42.5,-43,0,-30.40559159102154,30.405591591021544,-42.5,0,0,-43,-30.405591591021551,-30.40559159102154,0,-42.5,30.405591591021537,-30.405591591021551,44,0,0,44,43.5,0,31.112698372208094,31.112698372208087,0,43.5,-44,0,-31.112698372208087,31.112698372208094,-43.5,0,0,-44,-31.112698372208097,-31.112698372208087,0,-43.5,31.112698372208083,-31.112698372208097,45,0,0,45,44.5,0,31.81980515339464,31.819805153394636,0,44.5,-45,0,-31.819805153394636,31.81980515339464,-44.5,0,0,-45,-31.819805153394647,-31.819805153394636,0,-44.5,31.819805153394629,-31.819805153394647,47,0,0,47,46,0,33.234018715767739,33.234018715767732,0,46,-47,0,-33.234018715767732,33.234018715767739,-46,0,0,-47,-33.234018715767739,-33.234018715767732,0,-46,33.234018715767725,-33.234018715767739,49,0,0,49,48,0,34.648232278140831,34.648232278140824,0,48,-49,0,-34.648232278140824,34.648232278140831,-48,0,0,-49,-34.648232278140839,-34.648232278140824,0,-48,34.648232278140817,-34.648232278140839,51,0,0,51,50,0,36.062445840513924,36.062445840513924,0,50,-51,0,-36.062445840513924,36.062445840513924,-50,0,0,-51,-36.062445840513931,-36.062445840513924,0,-50,36.062445840513917,-36.062445840513931,53,0,0,53,52,0,37.476659402887023,37.476659402887016,0,52,-53,0,-37.476659402887016,37.476659402887023,-52,0,0,-53,-37.47665940288703,-37.476659402887016,0,-52,37.476659402887009,-37.47665940288703,55,0,0,55,54,0,38.890872965260115,38.890872965260108,0,54,-55,0,-38.890872965260108,38.890872965260115,-54,0,0,-55,-38.890872965260122,-38.890872965260108,0,-54,38.890872965260101,-38.890872965260122,59,0,0,59,57,0,41.719300090006307,41.7193000900063,0,57,-59,0,-41.7193000900063,41.719300090006307,-57,0,0,-59,-41.719300090006314,-41.7193000900063,0,-57,41.719300090006293,-41.719300090006314,63,0,0,63,61,0,44.547727214752499,44.547727214752491,0,61,-63,0,-44.547727214752491,44.547727214752499,-61,0,0,-63,-44.547727214752506,-44.547727214752491,0,-61,44.547727214752484,-44.547727214752506,67,0,0,67,65,0,47.37615433949869,47.376154339498683,0,65,-67,0,-47.376154339498683,47.37615433949869,-65,0,0,-67,-47.376154339498697,-47.376154339498683,0,-65,47.376154339498676,-47.376154339498697,71,0,0,71,69,0,50.204581464244875,50.204581464244868,0,69,-71,0,-50.204581464244868,50.204581464244875,-69,0,0,-71,-50.204581464244889,-50.204581464244868,0,-69,50.20458146424486,-50.204581464244889,75,0,0,75,73,0,53.033008588991066,53.033008588991059,0,73,-75,0,-53.033008588991059,53.033008588991066,-73,0,0,-75,-53.033008588991073,-53.033008588991059,0,-73,53.033008588991052,-53.033008588991073,80,0,0,80,77.5,0,56.568542494923804,56.568542494923797,0,77.5,-80,0,-56.568542494923797,56.568542494923804,-77.5,0,0,-80,-56.568542494923818,-56.568542494923797,0,-77.5,56.56854249492379,-56.568542494923818};
coords->useArray(coordsData,false,DeallocType::CPP_DEALLOC,188,2);
coords->setName("");
- DataArrayInt *conn=DataArrayInt::New();
- const int connData[540]={8,0,1,2,3,4,5,6,7,8,3,2,8,9,6,10,11,12,8,9,8,13,14,11,15,16,17,8,14,13,1,0,16,18,4,19,8,1,20,21,2,22,23,24,5,8,2,21,25,8,24,26,27,10,8,8,25,28,13,27,29,30,15,8,13,28,20,1,30,31,22,18,8,20,32,33,21,34,35,36,23,8,21,33,37,25,36,38,39,26,8,25,37,40,28,39,41,42,29,8,28,40,32,20,42,43,34,31,8,32,44,45,33,46,47,48,35,8,33,45,49,37,48,50,51,38,8,37,49,52,40,51,53,54,41,8,40,52,44,32,54,55,46,43,8,44,56,57,45,58,59,60,47,8,45,57,61,49,60,62,63,50,8,49,61,64,52,63,65,66,53,8,52,64,56,44,66,67,58,55,8,56,68,69,57,70,71,72,59,8,57,69,73,61,72,74,75,62,8,61,73,76,64,75,77,78,65,8,64,76,68,56,78,79,70,67,8,68,80,81,69,82,83,84,71,8,69,81,85,73,84,86,87,74,8,73,85,88,76,87,89,90,77,8,76,88,80,68,90,91,82,79,8,80,92,93,81,94,95,96,83,8,81,93,97,85,96,98,99,86,8,85,97,100,88,99,101,102,89,8,88,100,92,80,102,103,94,91,8,92,104,105,93,106,107,108,95,8,93,105,109,97,108,110,111,98,8,97,109,112,100,111,113,114,101,8,100,112,104,92,114,115,106,103,8,104,116,117,105,118,119,120,107,8,105,117,121,109,120,122,123,110,8,109,121,124,112,123,125,126,113,8,112,124,116,104,126,127,118,115,8,116,128,129,117,130,131,132,119,8,117,129,133,121,132,134,135,122,8,121,133,136,124,135,137,138,125,8,124,136,128,116,138,139,130,127,8,128,140,141,129,142,143,144,131,8,129,141,145,133,144,146,147,134,8,133,145,148,136,147,149,150,137,8,136,148,140,128,150,151,142,139,8,140,152,153,141,154,155,156,143,8,141,153,157,145,156,158,159,146,8,145,157,160,148,159,161,162,149,8,148,160,152,140,162,163,154,151,8,152,164,165,153,166,167,168,155,8,153,165,169,157,168,170,171,158,8,157,169,172,160,171,173,174,161,8,160,172,164,152,174,175,166,163,8,164,176,177,165,178,179,180,167,8,165,177,181,169,180,182,183,170,8,169,181,184,172,183,185,186,173,8,172,184,176,164,186,187,178,175};
+ DataArrayIdType *conn=DataArrayIdType::New();
+ const mcIdType connData[540]={8,0,1,2,3,4,5,6,7,8,3,2,8,9,6,10,11,12,8,9,8,13,14,11,15,16,17,8,14,13,1,0,16,18,4,19,8,1,20,21,2,22,23,24,5,8,2,21,25,8,24,26,27,10,8,8,25,28,13,27,29,30,15,8,13,28,20,1,30,31,22,18,8,20,32,33,21,34,35,36,23,8,21,33,37,25,36,38,39,26,8,25,37,40,28,39,41,42,29,8,28,40,32,20,42,43,34,31,8,32,44,45,33,46,47,48,35,8,33,45,49,37,48,50,51,38,8,37,49,52,40,51,53,54,41,8,40,52,44,32,54,55,46,43,8,44,56,57,45,58,59,60,47,8,45,57,61,49,60,62,63,50,8,49,61,64,52,63,65,66,53,8,52,64,56,44,66,67,58,55,8,56,68,69,57,70,71,72,59,8,57,69,73,61,72,74,75,62,8,61,73,76,64,75,77,78,65,8,64,76,68,56,78,79,70,67,8,68,80,81,69,82,83,84,71,8,69,81,85,73,84,86,87,74,8,73,85,88,76,87,89,90,77,8,76,88,80,68,90,91,82,79,8,80,92,93,81,94,95,96,83,8,81,93,97,85,96,98,99,86,8,85,97,100,88,99,101,102,89,8,88,100,92,80,102,103,94,91,8,92,104,105,93,106,107,108,95,8,93,105,109,97,108,110,111,98,8,97,109,112,100,111,113,114,101,8,100,112,104,92,114,115,106,103,8,104,116,117,105,118,119,120,107,8,105,117,121,109,120,122,123,110,8,109,121,124,112,123,125,126,113,8,112,124,116,104,126,127,118,115,8,116,128,129,117,130,131,132,119,8,117,129,133,121,132,134,135,122,8,121,133,136,124,135,137,138,125,8,124,136,128,116,138,139,130,127,8,128,140,141,129,142,143,144,131,8,129,141,145,133,144,146,147,134,8,133,145,148,136,147,149,150,137,8,136,148,140,128,150,151,142,139,8,140,152,153,141,154,155,156,143,8,141,153,157,145,156,158,159,146,8,145,157,160,148,159,161,162,149,8,148,160,152,140,162,163,154,151,8,152,164,165,153,166,167,168,155,8,153,165,169,157,168,170,171,158,8,157,169,172,160,171,173,174,161,8,160,172,164,152,174,175,166,163,8,164,176,177,165,178,179,180,167,8,165,177,181,169,180,182,183,170,8,169,181,184,172,183,185,186,173,8,172,184,176,164,186,187,178,175};
conn->useArray(connData,false,DeallocType::CPP_DEALLOC,540,1);
conn->setName("");
- DataArrayInt *connI=DataArrayInt::New();
- const int connIData[61]={0,9,18,27,36,45,54,63,72,81,90,99,108,117,126,135,144,153,162,171,180,189,198,207,216,225,234,243,252,261,270,279,288,297,306,315,324,333,342,351,360,369,378,387,396,405,414,423,432,441,450,459,468,477,486,495,504,513,522,531,540};
+ DataArrayIdType *connI=DataArrayIdType::New();
+ const mcIdType connIData[61]={0,9,18,27,36,45,54,63,72,81,90,99,108,117,126,135,144,153,162,171,180,189,198,207,216,225,234,243,252,261,270,279,288,297,306,315,324,333,342,351,360,369,378,387,396,405,414,423,432,441,450,459,468,477,486,495,504,513,522,531,540};
connI->useArray(connIData,false,DeallocType::CPP_DEALLOC,61,1);
connI->setName("");
//
//
coords=DataArrayDouble::New();
const double coordsData2[84]={46.5,-2.5,53.5,-2.5,53.5,2.5,46.5,2.5,50,-2.5,53.5,0,50,2.5,46.5,0,60.5,-2.5,60.5,2.5,57,-2.5,60.5,0,57,2.5,53.5,7.5,46.5,7.5,53.5,5,50,7.5,46.5,5,60.5,7.5,60.5,5,57,7.5,-2,47,2,47,2,53,-2,53,0,47,2,50,0,53,-2,50,6,47,6,53,4,47,6,50,4,53,2,59,-2,59,2,56,0,59,-2,56,6,59,6,56,4,59};
- coords->useArray(coordsData2,false,DeallocType::CPP_DEALLOC,42,2);
+ coords->useArray(coordsData2,false,DeallocType::CPP_DEALLOC,42,2);
coords->setName("");
// connectivity
- conn=DataArrayInt::New();
- const int connData2[72]={8,0,1,2,3,4,5,6,7,8,1,8,9,2,10,11,12,5,8,3,2,13,14,6,15,16,17,8,2,9,18,13,12,19,20,15,8,21,22,23,24,25,26,27,28,8,22,29,30,23,31,32,33,26,8,24,23,34,35,27,36,37,38,8,23,30,39,34,33,40,41,36};
+ conn=DataArrayIdType::New();
+ const mcIdType connData2[72]={8,0,1,2,3,4,5,6,7,8,1,8,9,2,10,11,12,5,8,3,2,13,14,6,15,16,17,8,2,9,18,13,12,19,20,15,8,21,22,23,24,25,26,27,28,8,22,29,30,23,31,32,33,26,8,24,23,34,35,27,36,37,38,8,23,30,39,34,33,40,41,36};
conn->useArray(connData2,false,DeallocType::CPP_DEALLOC,72,1);
conn->setName("");
- connI=DataArrayInt::New();
- const int connIData2[9]={0,9,18,27,36,45,54,63,72};
+ connI=DataArrayIdType::New();
+ const mcIdType connIData2[9]={0,9,18,27,36,45,54,63,72};
connI->useArray(connIData2,false,DeallocType::CPP_DEALLOC,9,1);
connI->setName("");
MEDCouplingUMesh *m2=MEDCouplingUMesh::New("Mobile",2);
m2->setConnectivity(conn,connI,true);
coords->decrRef(); conn->decrRef(); connI->decrRef();
//
- DataArrayInt *d1=0,*d2=0;
+ DataArrayIdType *d1=0,*d2=0;
MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2);
CPPUNIT_ASSERT_EQUAL(105,(int)m3->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(105,(int)d1->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(105,(int)d2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(704,m3->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(105,(int)d1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(105,(int)d2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(704,(int)m3->getNumberOfNodes());
//
const double areaExpected[105]={-65.18804756198824,-65.18804756198824,-65.18804756198824,-65.18804756198824,-66.75884388878285,-66.75884388878285,-66.7588438887833,-66.75884388878308,-68.32964021557768,-68.32964021557768,-68.32964021557814,-68.32964021557791,-69.9004365423732,-69.9004365423732,-69.90043654237297,-69.90043654237297,-1.194568659706448,-1.0869994447159463,-142.2316939607081,-144.51326206513068,-144.5132620651309,-1.1945686597064424,-143.3186934054243,-5.002264310862817,-10.0261332846393,-3.9727823117092953,-7.290862524642649,-124.504404940456,-3.9727823117093237,-146.82366506060032,-150.79644737231024,-5.002264310862776,-145.79418306144626,-5.00208651738126,-10.054764051268958,-4.001067863263231,-8.027932154428669,-129.99378209314813,-4.001067863263216,-153.07856481622616,-157.0796326794898,-5.0020865173811915,-152.07754616210832,-5.001928880064381,-10.050590216368969,-4.00098721602491,-8.025810856794209,-136.28350081741684,-4.000987216024939,-159.36183077064402,-163.36281798667005,-5.0019288800643285,-158.36088910660442,-1.2991516319851801,-3.702636830195414,-3.7815130030068254,-6.265364371195623,-0.02516260900254963,-0.6553944641345026,-3.975752765070567,-7.368528340442765,-142.57249927881398,-0.02516260900254963,-3.9757527650706095,-165.64508791977525,-169.64600329384803,-1.299151631985167,-3.7026368301953885,-164.6442148316677,-10.00321285677458,-20.08414323176165,-8.001644468035863,-16.042954878437143,-304.0096070742277,-8.00164446803587,-350.1399180412005,-358.1415625092368,-10.003212856774468,-348.13834965246224,-3.794150313030109,-8.65049239704272,-0.02260276689354157,-0.5885167811200915,-370.2185414798688,-0.022602766893559393,-383.2517009710623,-383.2743037379555,-3.7941503130300576,-379.48015342492505,-408.40704496667513,-408.4070449666742,-408.4070449666742,-408.4070449666742,-433.53978619538975,-433.5397861953902,-433.5397861953911,-433.53978619539066,-458.67252742410983,-458.6725274241094,-458.67252742410983,-458.6725274241089,-608.6835766330232,-608.6835766330232,-608.6835766330232,-608.6835766330241};
- const int expected1[105]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,16,16,17,18,19,19,20,20,20,20,20,21,21,22,23,23,24,24,24,24,24,25,25,26,27,27,28,28,28,28,28,29,29,30,31,31,32,32,32,32,32,32,32,32,32,33,33,33,34,35,35,35,36,36,36,36,36,37,37,38,39,39,40,40,40,40,40,41,41,42,43,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59};
- const int expected2[105]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,2,-1,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,1,2,3,4,5,6,7,-1,4,6,-1,-1,0,1,-1,1,3,6,7,-1,6,-1,-1,1,-1,1,3,6,7,-1,6,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
+ const mcIdType expected1[105]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,16,16,17,18,19,19,20,20,20,20,20,21,21,22,23,23,24,24,24,24,24,25,25,26,27,27,28,28,28,28,28,29,29,30,31,31,32,32,32,32,32,32,32,32,32,33,33,33,34,35,35,35,36,36,36,36,36,37,37,38,39,39,40,40,40,40,40,41,41,42,43,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59};
+ const mcIdType expected2[105]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,2,-1,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,1,2,3,4,5,6,7,-1,4,6,-1,-1,0,1,-1,1,3,6,7,-1,6,-1,-1,1,-1,1,3,6,7,-1,6,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
MEDCouplingFieldDouble *f3f=m3->getMeasureField(ON_CELLS);
const double *f3=f3f->getArray()->getConstPointer();
for(int i=0;i<105;i++)
void MEDCouplingBasicsTest5::testDAIBuildUnique1()
{
- DataArrayInt *d=DataArrayInt::New();
- const int dData[14]={1,2,2,3,3,3,3,4,5,5,7,7,7,19};
+ DataArrayIdType *d=DataArrayIdType::New();
+ const mcIdType dData[14]={1,2,2,3,3,3,3,4,5,5,7,7,7,19};
d->useArray(dData,false,DeallocType::CPP_DEALLOC,14,1);
- const int expectedData[7]={1,2,3,4,5,7,19};
+ const mcIdType expectedData[7]={1,2,3,4,5,7,19};
//
- DataArrayInt *e=d->buildUnique();
+ DataArrayIdType *e=d->buildUnique();
CPPUNIT_ASSERT_EQUAL(7,(int)e->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)e->getNumberOfComponents());
for(int i=0;i<7;i++)
void MEDCouplingBasicsTest5::testDAIPartitionByDifferentValues1()
{
- const int data[9]={1,0,1,2,0,2,2,-3,2};
- const int expected1[4]={-3,0,1,2};
- const int expected2_0[1]={7};
- const int expected2_1[2]={1,4};
- const int expected2_2[2]={0,2};
- const int expected2_3[4]={3,5,6,8};
- DataArrayInt *d=DataArrayInt::New();
+ const mcIdType data[9]={1,0,1,2,0,2,2,-3,2};
+ const mcIdType expected1[4]={-3,0,1,2};
+ const mcIdType expected2_0[1]={7};
+ const mcIdType expected2_1[2]={1,4};
+ const mcIdType expected2_2[2]={0,2};
+ const mcIdType expected2_3[4]={3,5,6,8};
+ DataArrayIdType *d=DataArrayIdType::New();
d->useArray(data,false,DeallocType::CPP_DEALLOC,9,1);
- std::vector<int> f;
+ std::vector<mcIdType> f;
static const int nbOfOutputsExpected=4;
- std::vector<DataArrayInt *> e=d->partitionByDifferentValues(f);
+ std::vector<DataArrayIdType *> e=d->partitionByDifferentValues(f);
d->decrRef();
CPPUNIT_ASSERT_EQUAL(nbOfOutputsExpected,(int)e.size());
CPPUNIT_ASSERT_EQUAL(nbOfOutputsExpected,(int)f.size());
for(int i=0;i<nbOfOutputsExpected;i++)
- {
- CPPUNIT_ASSERT_EQUAL(expected1[i],f[i]);
- }
- CPPUNIT_ASSERT_EQUAL((std::size_t)1,e[0]->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)2,e[1]->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)2,e[2]->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL((std::size_t)4,e[3]->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(1,(int)e[0]->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(1,(int)e[1]->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(1,(int)e[2]->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(1,(int)e[3]->getNumberOfComponents());
+ {
+ CPPUNIT_ASSERT_EQUAL(expected1[i],f[i]);
+ }
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),e[0]->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),e[1]->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),e[2]->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(4),e[3]->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(1,(int)e[0]->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(1,(int)e[1]->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(1,(int)e[2]->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(1,(int)e[3]->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(expected2_0,expected2_0+1,e[0]->begin()));
CPPUNIT_ASSERT(std::equal(expected2_1,expected2_1+2,e[1]->begin()));
CPPUNIT_ASSERT(std::equal(expected2_2,expected2_2+2,e[2]->begin()));
void MEDCouplingBasicsTest5::testDAICheckMonotonic1()
{
- const int data1[6]={-1,0,2,2,4,5};
- const int data2[6]={6,2,0,-8,-9,-56};
- const int data3[6]={-1,0,3,2,4,6};
- const int data4[6]={7,5,2,3,0,-6};
- DataArrayInt *d=DataArrayInt::New();
+ const mcIdType data1[6]={-1,0,2,2,4,5};
+ const mcIdType data2[6]={6,2,0,-8,-9,-56};
+ const mcIdType data3[6]={-1,0,3,2,4,6};
+ const mcIdType data4[6]={7,5,2,3,0,-6};
+ DataArrayIdType *d=DataArrayIdType::New();
d->useArray(data1,false,DeallocType::CPP_DEALLOC,6,1);
CPPUNIT_ASSERT(d->isMonotonic(true));
CPPUNIT_ASSERT(!d->isMonotonic(false));
const double coordsData[16]={2.7554552980815448e-15,45,-45,5.5109105961630896e-15,-31.819805153394636,31.81980515339464,2.8779199779962799e-15,47,2.8166876380389124e-15,46,-47,5.7558399559925599e-15,-33.234018715767732,33.234018715767739,-46,5.6333752760778247e-15};
coords->useArray(coordsData,false,DeallocType::CPP_DEALLOC,8,2);
// connectivity
- DataArrayInt *conn=DataArrayInt::New();
- const int connData[9]={8,0,3,5,1,4,6,7,2};
+ DataArrayIdType *conn=DataArrayIdType::New();
+ const mcIdType connData[9]={8,0,3,5,1,4,6,7,2};
conn->useArray(connData,false,DeallocType::CPP_DEALLOC,9,1);
- DataArrayInt *connI=DataArrayInt::New();
- const int connIData[2]={0,9};
+ DataArrayIdType *connI=DataArrayIdType::New();
+ const mcIdType connIData[2]={0,9};
connI->useArray(connIData,false,DeallocType::CPP_DEALLOC,2,1);
MEDCouplingUMesh *m1=MEDCouplingUMesh::New("Fixe",2);
m1->setCoords(coords);
const double coordsData2[26]={-7.3800475508445391,41.854329503018846,-3.7041190667754655,42.338274668899189,-3.7041190667754655,45.338274668899189,-7.3800475508445382,44.854329503018839,-5.5473631693521845,42.136406608386956,-3.7041190667754655,43.838274668899189,-5.5420833088100014,45.09630208595901,-7.3800475508445382,43.354329503018839,-3.7041190667754651,52.338274668899189,-7.3800475508445382,51.854329503018839,-3.7041190667754655,48.838274668899189,-5.5420833088100014,52.09630208595901,-7.3800475508445382,48.354329503018839};
coords->useArray(coordsData2,false,DeallocType::CPP_DEALLOC,13,2);
// connectivity
- conn=DataArrayInt::New();
- const int connData2[18]={8,0,1,2,3,4,5,6,7,8,3,2,8,9,6,10,11,12};
+ conn=DataArrayIdType::New();
+ const mcIdType connData2[18]={8,0,1,2,3,4,5,6,7,8,3,2,8,9,6,10,11,12};
conn->useArray(connData2,false,DeallocType::CPP_DEALLOC,18,1);
- connI=DataArrayInt::New();
- const int connIData2[3]={0,9,18};
+ connI=DataArrayIdType::New();
+ const mcIdType connIData2[3]={0,9,18};
connI->useArray(connIData2,false,DeallocType::CPP_DEALLOC,3,1);
//
MEDCouplingUMesh *m2=MEDCouplingUMesh::New("Mobile",2);
m2->setConnectivity(conn,connI,true);
coords->decrRef(); conn->decrRef(); connI->decrRef();
//
- DataArrayInt *d1=0,*d2=0;
+ DataArrayIdType *d1=0,*d2=0;
MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2);
CPPUNIT_ASSERT_EQUAL(4,(int)m3->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(4,(int)d1->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(4,(int)d2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(43,m3->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(4,(int)d1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(4,(int)d2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(43,(int)m3->getNumberOfNodes());
bool areMerged=false;
- int newNbOfNodes=-1;
+ mcIdType newNbOfNodes=-1;
m3->mergeNodes(1e-12,areMerged,newNbOfNodes)->decrRef();
- CPPUNIT_ASSERT_EQUAL(35,m3->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(35,(int)m3->getNumberOfNodes());
m3->zipCoords();
- CPPUNIT_ASSERT_EQUAL(23,m3->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(23,(int)m3->getNumberOfNodes());
//
MEDCouplingFieldDouble *f=m3->getMeasureField(true);
const double *vals=f->getArray()->getConstPointer();
const double coordsData1[16]={0.5328427124746189, -0.08284271247461905, -0.03284271247461901, 0.4828427124746191, -0.03284271247461906, -0.082842712474619, 0.5328427124746191, 0.482842712474619};
coords1->useArray(coordsData1,false,DeallocType::CPP_DEALLOC,8,2);
// connectivity
- DataArrayInt *conn1=DataArrayInt::New();
- const int connData1[5]={INTERP_KERNEL::NORM_QPOLYG,0,1,2,3};
+ DataArrayIdType *conn1=DataArrayIdType::New();
+ const mcIdType connData1[5]={INTERP_KERNEL::NORM_QPOLYG,0,1,2,3};
conn1->useArray(connData1,false,DeallocType::CPP_DEALLOC,5,1);
- DataArrayInt *connI1=DataArrayInt::New();
- const int connIData1[2]={0,5};
+ DataArrayIdType *connI1=DataArrayIdType::New();
+ const mcIdType connIData1[2]={0,5};
connI1->useArray(connIData1,false,DeallocType::CPP_DEALLOC,2,1);
MEDCouplingUMesh *m1=MEDCouplingUMesh::New("circle",2);
m1->setCoords(coords1);
const double coordsData2[8]={-0.5,-0.5, -0.5, 0.5, 0.5, 0.5, 0.5,-0.5};
coords2->useArray(coordsData2,false,DeallocType::CPP_DEALLOC,4,2);
// connectivity
- DataArrayInt *conn2=DataArrayInt::New();
- const int connData2[5]={INTERP_KERNEL::NORM_POLYGON, 0,1,2,3};
+ DataArrayIdType *conn2=DataArrayIdType::New();
+ const mcIdType connData2[5]={INTERP_KERNEL::NORM_POLYGON, 0,1,2,3};
conn2->useArray(connData2,false,DeallocType::CPP_DEALLOC,5,1);
- DataArrayInt *connI2=DataArrayInt::New();
- const int connIData2[2]={0,5};
+ DataArrayIdType *connI2=DataArrayIdType::New();
+ const mcIdType connIData2[2]={0,5};
connI2->useArray(connIData2,false,DeallocType::CPP_DEALLOC,2,1);
MEDCouplingUMesh *m2=MEDCouplingUMesh::New("square",2);
m2->setCoords(coords2);
m2->setConnectivity(conn2,connI2,true);
coords2->decrRef(); conn2->decrRef(); connI2->decrRef();
- DataArrayInt * resToM1 = 0, * resToM2 = 0;
+ DataArrayIdType * resToM1 = 0, * resToM2 = 0;
MEDCouplingUMesh *m_intersec=MEDCouplingUMesh::Intersect2DMeshes(m2, m1, eps, resToM1, resToM2);
m_intersec->zipCoords();
-0.014575131106459124, 0.5000000000000001, 0.5, -0.11224989991991996, 0.24271243444677046, 0.5, 0.5, 0.19387505004004, \
-0.04799910280454185, -0.06682678787499614, -0.023843325638122054, 0.4915644577163915, 0.5, -0.30612494995996, 0.0, -0.5,\
-0.5, 0.0, -0.25728756555322957, 0.5, -0.023843325638122026, 0.49156445771639157, -0.04799910280454181, -0.06682678787499613};
- const int conn_tgt[22]={32, 5, 2, 6, 4, 7, 8, 9, 10, 32, 6, 3, 0, 1, 5, 4, 11, 12, 13, 14, 15, 16};
- const int connI_tgt[3]={0, 9, 22};
- const int res1_tgt[2] = {0, 0};
- const int res2_tgt[2] = {0, -1};
+ const mcIdType conn_tgt[22]={32, 5, 2, 6, 4, 7, 8, 9, 10, 32, 6, 3, 0, 1, 5, 4, 11, 12, 13, 14, 15, 16};
+ const mcIdType connI_tgt[3]={0, 9, 22};
+ const mcIdType res1_tgt[2] = {0, 0};
+ const mcIdType res2_tgt[2] = {0, -1};
CPPUNIT_ASSERT(std::equal(conn_tgt,conn_tgt+22,m_intersec->getNodalConnectivity()->getConstPointer()));
CPPUNIT_ASSERT(std::equal(connI_tgt,connI_tgt+3,m_intersec->getNodalConnectivityIndex()->getConstPointer()));
void MEDCouplingBasicsTest5::testDAIBuildSubstractionOptimized1()
{
- const int tab1[7]={1,3,5,6,7,9,13};
- const int tab2[3]={3,5,9};
- const int tab3[3]={1,3,5};
- DataArrayInt *da1=DataArrayInt::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,7,1);
- DataArrayInt *da2=DataArrayInt::New(); da2->useArray(tab2,false,DeallocType::CPP_DEALLOC,3,1);
- DataArrayInt *da3=DataArrayInt::New(); da3->useArray(tab3,false,DeallocType::CPP_DEALLOC,3,1);
- DataArrayInt *da4=DataArrayInt::New(); da4->useArray(tab1,false,DeallocType::CPP_DEALLOC,7,1);
- //
- DataArrayInt *a=0;
+ const mcIdType tab1[7]={1,3,5,6,7,9,13};
+ const mcIdType tab2[3]={3,5,9};
+ const mcIdType tab3[3]={1,3,5};
+ DataArrayIdType *da1=DataArrayIdType::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,7,1);
+ DataArrayIdType *da2=DataArrayIdType::New(); da2->useArray(tab2,false,DeallocType::CPP_DEALLOC,3,1);
+ DataArrayIdType *da3=DataArrayIdType::New(); da3->useArray(tab3,false,DeallocType::CPP_DEALLOC,3,1);
+ DataArrayIdType *da4=DataArrayIdType::New(); da4->useArray(tab1,false,DeallocType::CPP_DEALLOC,7,1);
+ //
+ DataArrayIdType *a=0;
a=da1->buildSubstractionOptimized(da2);
CPPUNIT_ASSERT_EQUAL(4,(int)a->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)a->getNumberOfComponents());
- const int expected1_0[4]={1,6,7,13};
+ const mcIdType expected1_0[4]={1,6,7,13};
CPPUNIT_ASSERT(std::equal(expected1_0,expected1_0+4,a->begin()));
a->decrRef();
//
a=da1->buildSubstractionOptimized(da3);
CPPUNIT_ASSERT_EQUAL(4,(int)a->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)a->getNumberOfComponents());
- const int expected2_0[4]={6,7,9,13};
+ const mcIdType expected2_0[4]={6,7,9,13};
CPPUNIT_ASSERT(std::equal(expected2_0,expected2_0+4,a->begin()));
a->decrRef();
//
void MEDCouplingBasicsTest5::testDAIIsStrictlyMonotonic1()
{
- const int tab1[7]={1,3,5,6,7,9,13};
- DataArrayInt *da1=DataArrayInt::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,7,1);
+ const mcIdType tab1[7]={1,3,5,6,7,9,13};
+ DataArrayIdType *da1=DataArrayIdType::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,7,1);
CPPUNIT_ASSERT(da1->isStrictlyMonotonic(true));
da1->checkStrictlyMonotonic(true);
CPPUNIT_ASSERT(da1->isMonotonic(true));
CPPUNIT_ASSERT_THROW(da1->checkMonotonic(false),INTERP_KERNEL::Exception);
da1->decrRef();
//
- int tab2[7]={1,3,5,6,6,9,13};
- da1=DataArrayInt::New(); da1->useArray(tab2,false,DeallocType::CPP_DEALLOC,7,1);
+ mcIdType tab2[7]={1,3,5,6,6,9,13};
+ da1=DataArrayIdType::New(); da1->useArray(tab2,false,DeallocType::CPP_DEALLOC,7,1);
CPPUNIT_ASSERT(!da1->isStrictlyMonotonic(true));
CPPUNIT_ASSERT_THROW(da1->checkStrictlyMonotonic(true),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT(da1->isMonotonic(true));
CPPUNIT_ASSERT_THROW(da1->checkMonotonic(false),INTERP_KERNEL::Exception);
da1->decrRef();
//
- const int tab3[7]={1,3,5,6,5,9,13};
- da1=DataArrayInt::New(); da1->useArray(tab3,false,DeallocType::CPP_DEALLOC,7,1);
+ const mcIdType tab3[7]={1,3,5,6,5,9,13};
+ da1=DataArrayIdType::New(); da1->useArray(tab3,false,DeallocType::CPP_DEALLOC,7,1);
CPPUNIT_ASSERT(!da1->isStrictlyMonotonic(true));
CPPUNIT_ASSERT_THROW(da1->checkStrictlyMonotonic(true),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT(!da1->isMonotonic(true));
CPPUNIT_ASSERT_THROW(da1->checkMonotonic(false),INTERP_KERNEL::Exception);
da1->decrRef();
//
- const int tab4[7]={13,9,7,6,5,3,1};
- da1=DataArrayInt::New(); da1->useArray(tab4,false,DeallocType::CPP_DEALLOC,7,1);
+ const mcIdType tab4[7]={13,9,7,6,5,3,1};
+ da1=DataArrayIdType::New(); da1->useArray(tab4,false,DeallocType::CPP_DEALLOC,7,1);
CPPUNIT_ASSERT(!da1->isStrictlyMonotonic(true));
CPPUNIT_ASSERT_THROW(da1->checkStrictlyMonotonic(true),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT(!da1->isMonotonic(true));
da1->checkMonotonic(false);
da1->decrRef();
//
- const int tab5[7]={13,9,6,6,5,3,1};
- da1=DataArrayInt::New(); da1->useArray(tab5,false,DeallocType::CPP_DEALLOC,7,1);
+ const mcIdType tab5[7]={13,9,6,6,5,3,1};
+ da1=DataArrayIdType::New(); da1->useArray(tab5,false,DeallocType::CPP_DEALLOC,7,1);
CPPUNIT_ASSERT(!da1->isStrictlyMonotonic(true));
CPPUNIT_ASSERT_THROW(da1->checkStrictlyMonotonic(true),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT(!da1->isMonotonic(true));
da1->checkMonotonic(false);
da1->decrRef();
//
- const int tab6[7]={13,9,5,6,5,3,1};
- da1=DataArrayInt::New(); da1->useArray(tab6,false,DeallocType::CPP_DEALLOC,7,1);
+ const mcIdType tab6[7]={13,9,5,6,5,3,1};
+ da1=DataArrayIdType::New(); da1->useArray(tab6,false,DeallocType::CPP_DEALLOC,7,1);
CPPUNIT_ASSERT(!da1->isStrictlyMonotonic(true));
CPPUNIT_ASSERT_THROW(da1->checkStrictlyMonotonic(true),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT(!da1->isMonotonic(true));
CPPUNIT_ASSERT_THROW(da1->checkMonotonic(false),INTERP_KERNEL::Exception);
da1->decrRef();
//
- da1=DataArrayInt::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,0,1);
+ da1=DataArrayIdType::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,0,1);
CPPUNIT_ASSERT(da1->isStrictlyMonotonic(true));
da1->checkStrictlyMonotonic(true);
CPPUNIT_ASSERT(da1->isMonotonic(true));
da1->checkMonotonic(false);
da1->decrRef();
//
- da1=DataArrayInt::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,1,1);
+ da1=DataArrayIdType::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,1,1);
CPPUNIT_ASSERT(da1->isStrictlyMonotonic(true));
da1->checkStrictlyMonotonic(true);
CPPUNIT_ASSERT(da1->isMonotonic(true));
void MEDCouplingBasicsTest5::testSimplexize3()
{
- const int conn[24]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};
+ const mcIdType conn[24]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};
MEDCouplingUMesh *m=MEDCouplingUMesh::New("toto",3);
m->allocateCells(0);
m->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn+0);
m->checkConsistency();
//
MEDCouplingUMesh *m1=static_cast<MEDCouplingUMesh *>(m->deepCopy());
- DataArrayInt *d1=m1->simplexize(INTERP_KERNEL::PLANAR_FACE_5);
+ DataArrayIdType *d1=m1->simplexize(INTERP_KERNEL::PLANAR_FACE_5);
m1->checkConsistency();
MEDCouplingFieldDouble *f1=m1->getMeasureField(ON_CELLS);
const double vol1Expected[12]={1./6, 1./6, 1./6,1./6, 1./6, 1./3,1./6, 1./6, 1./6, 1./6, 1./3, 1./6};
CPPUNIT_ASSERT_EQUAL(12,(int)f1->getArray()->getNumberOfTuples());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(vol1Expected[i],f1->getIJ(i,0),1e-12);
- const int connExpected1[60]={14,0,1,2,3,14,4,9,5,6,14,4,8,9,11,14,4,7,11,6,14,9,11,10,6,14,4,9,6,11,14,12,17,13,14,14,12,16,17,19,14,12,15,19,14,14,17,19,18,14,14,12,17,14,19,14,20,21,22,23};
- const int connIExpected1[13]={0,5,10,15,20,25,30,35,40,45,50,55,60};
- const int n2o1[12]={0,1,1,1,1,1,2,2,2,2,2,3};
+ const mcIdType connExpected1[60]={14,0,1,2,3,14,4,9,5,6,14,4,8,9,11,14,4,7,11,6,14,9,11,10,6,14,4,9,6,11,14,12,17,13,14,14,12,16,17,19,14,12,15,19,14,14,17,19,18,14,14,12,17,14,19,14,20,21,22,23};
+ const mcIdType connIExpected1[13]={0,5,10,15,20,25,30,35,40,45,50,55,60};
+ const mcIdType n2o1[12]={0,1,1,1,1,1,2,2,2,2,2,3};
CPPUNIT_ASSERT_EQUAL(1,(int)m1->getNodalConnectivity()->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(60,(int)m1->getNodalConnectivity()->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)m1->getNodalConnectivityIndex()->getNumberOfComponents());
d1->decrRef();
//
MEDCouplingUMesh *m2=static_cast<MEDCouplingUMesh *>(m->deepCopy());
- DataArrayInt *d2=m2->simplexize(INTERP_KERNEL::PLANAR_FACE_6);
+ DataArrayIdType *d2=m2->simplexize(INTERP_KERNEL::PLANAR_FACE_6);
m2->checkConsistency();
MEDCouplingFieldDouble *f2=m2->getMeasureField(ON_CELLS);
const double vol2Expected[14]={1./6, 1./6, 1./6,1./6, 1./6, 1./6,1./6,1./6, 1./6, 1./6, 1./6, 1./6,1./6,1./6};
CPPUNIT_ASSERT_EQUAL(14,(int)f2->getArray()->getNumberOfTuples());
for(int i=0;i<14;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(vol2Expected[i],f2->getIJ(i,0),1e-12);
- const int connExpected2[70]={14,0,1,2,3,14,4,9,5,10,14,4,5,6,10,14,4,8,9,10,14,4,11,8,10,14,4,6,7,10,14,4,7,11,10,14,12,17,13,18,14,12,13,14,18,14,12,16,17,18,14,12,19,16,18,14,12,14,15,18,14,12,15,19,18,14,20,21,22,23};
- const int connIExpected2[15]={0,5,10,15,20,25,30,35,40,45,50,55,60,65,70};
- const int n2o2[14]={0,1,1,1,1,1,1,2,2,2,2,2,2,3};
+ const mcIdType connExpected2[70]={14,0,1,2,3,14,4,9,5,10,14,4,5,6,10,14,4,8,9,10,14,4,11,8,10,14,4,6,7,10,14,4,7,11,10,14,12,17,13,18,14,12,13,14,18,14,12,16,17,18,14,12,19,16,18,14,12,14,15,18,14,12,15,19,18,14,20,21,22,23};
+ const mcIdType connIExpected2[15]={0,5,10,15,20,25,30,35,40,45,50,55,60,65,70};
+ const mcIdType n2o2[14]={0,1,1,1,1,1,1,2,2,2,2,2,2,3};
CPPUNIT_ASSERT_EQUAL(1,(int)m2->getNodalConnectivity()->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(70,(int)m2->getNodalConnectivity()->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)m2->getNodalConnectivityIndex()->getNumberOfComponents());
//
// Author : Anthony Geay (CEA/DEN)
-int connITT[201]={0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1029, 1058, 1087, 1116, 1145, 1174, 1203,
+mcIdType connITT[201]={0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1029, 1058, 1087, 1116, 1145, 1174, 1203,
1232, 1261, 1290, 1319, 1348, 1377, 1406, 1435, 1464, 1493, 1522, 1551, 1580, 1609, 1638, 1667, 1696, 1725, 1754, 1783, 1812, 1841, 1870, 1899,
1928, 1957, 1986, 2015, 2044, 2073, 2102, 2131, 2160, 2189, 2218, 2247, 2276, 2305, 2334, 2363, 2392, 2421, 2450, 2479, 2508, 2537, 2566, 2595,
2624, 2653, 2682, 2711, 2740, 2769, 2798, 2827, 2856, 2885, 2914, 2943, 2972, 3001, 3030, 3059, 3088, 3117, 3146, 3175, 3204, 3233, 3262, 3291,
4712, 4741, 4770, 4799, 4828, 4857, 4886, 4915, 4944, 4973, 5002, 5031, 5060, 5089, 5118, 5147, 5176, 5205, 5234, 5263, 5292, 5321, 5350, 5379,
5408, 5437, 5466, 5495, 5524, 5553, 5582, 5611, 5640, 5669, 5698, 5727, 5756, 5785, 5814, 5843, 5872, 5901, 5930, 5959, 5988, 6017, 6046, 6075,
6104, 6133, 6162, 6191, 6220};
- int connTT[6220]={0, 1, 2, 3, 4, 5, 6, -1, 0, 7, 8, 1, -1, 1, 8, 9, 2, -1, 2, 9, 10, 3, -1, 3, 10, 11, 4, -1, 4, 11, 12, 5, -1, 5, 12, 13, 6, -1, 6, 13, 7, 0, -1, 7, 13, 12, 11, 10, 9, 8, 14, 15, 16, 17, 18, 19,
+ mcIdType connTT[6220]={0, 1, 2, 3, 4, 5, 6, -1, 0, 7, 8, 1, -1, 1, 8, 9, 2, -1, 2, 9, 10, 3, -1, 3, 10, 11, 4, -1, 4, 11, 12, 5, -1, 5, 12, 13, 6, -1, 6, 13, 7, 0, -1, 7, 13, 12, 11, 10, 9, 8, 14, 15, 16, 17, 18, 19,
20, -1, 14, 21, 22, 15, -1, 15, 22, 23, 16, -1, 16, 23, 24, 17, -1, 17, 24, 25, 18, -1, 18, 25, 26, 19, -1, 19, 26, 27, 20, -1, 20, 27, 21, 14, -1, 21, 27, 26, 25, 24, 23, 22, 28, 29, 30, 31, 32,
33, 34, -1, 28, 35, 36, 29, -1, 29, 36, 37, 30, -1, 30, 37, 38, 31, -1, 31, 38, 39, 32, -1, 32, 39, 40, 33, -1, 33, 40, 41, 34, -1, 34, 41, 35, 28, -1, 35, 41, 40, 39, 38, 37, 36, 42, 43, 44, 45,
46, 47, 48, -1, 42, 49, 50, 43, -1, 43, 50, 51, 44, -1, 44, 51, 52, 45, -1, 45, 52, 53, 46, -1, 46, 53, 54, 47, -1, 47, 54, 55, 48, -1, 48, 55, 49, 42, -1, 49, 55, 54, 53, 52, 51, 50, 56, 57, 58,
};
-const int connTFH8[2560]={
+const mcIdType connTFH8[2560]={
1, 2, 7, 6, 28, 29, 34, 33, 2, 3, 8, 7, 29, 30, 35, 34, 3, 4, 9, 8, 30, 31, 36, 35, 4, 5, 10, 9, 31, 32, 37, 36, 6, 7, 12, 11, 33, 34, 39, 38, 7, 8, 13, 12, 34, 35, 40, 39,
8, 9, 14, 13, 35, 36, 41, 40, 9, 10, 15, 14, 36, 37, 42, 41, 11, 12, 17, 16, 38, 39, 44, 43, 12, 13, 18, 17, 39, 40, 45, 44, 13, 14, 19, 18, 40, 41, 46, 45, 14, 15, 20, 19,
41, 42, 47, 46, 16, 17, 21, 26, 43, 44, 48, 53, 17, 18, 22, 21, 44, 45, 49, 48, 18, 19, 23, 22, 45, 46, 50, 49, 19, 20, 24, 23, 46, 47, 51, 50, 28, 29, 34, 33, 55, 56, 61, 60,
526, 531, 530, 552, 553, 558, 557, 526, 527, 532, 531, 553, 554, 559, 558, 527, 528, 533, 532, 554, 555, 560, 559, 529, 530, 534, 539, 556, 557, 561, 566, 530, 531, 535, 534, 557, 558, 562, 561, 531, 532, 536, 535, 558, 559, 563,
562, 532, 533, 537, 536, 559, 560, 564, 563};
-const int connTFPOLH[1000]={
+const mcIdType connTFPOLH[1000]={
0, 25, 26, 16, 11, 6, 1, -1, 27, 28, 33, 38, 43, 53, 52, -1, 0, 1, 28, 27, -1, 1, 6, 33, 28, -1, 6, 11, 38, 33, -1, 11, 16, 43, 38, -1, 16, 26, 53, 43, -1, 26, 25, 52, 53, -1, 25, 0, 27, 52, 27, 52, 53, 43, 38, 33, 28, -1, 54, 55,
60, 65, 70, 80, 79, -1, 27, 28, 55, 54, -1, 28, 33, 60, 55, -1, 33, 38, 65, 60, -1, 38, 43, 70, 65, -1, 43, 53, 80, 70, -1, 53, 52, 79, 80, -1, 52, 27, 54, 79, 54, 79, 80, 70, 65, 60, 55, -1, 81, 82, 87, 92, 97, 107, 106, -1, 54,
55, 82, 81, -1, 55, 60, 87, 82, -1, 60, 65, 92, 87, -1, 65, 70, 97, 92, -1, 70, 80, 107, 97, -1, 80, 79, 106, 107, -1, 79, 54, 81, 106, 81, 106, 107, 97, 92, 87, 82, -1, 108, 109, 114, 119, 124, 134, 133, -1, 81, 82, 109, 108, -1,
4.2729999999999997, 0, 0.21606, 4.2729999999999997, 0.21606, 0.21606, 4.2729999999999997
};
-const int connTFPOLH_I[21]={0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000};
+const mcIdType connTFPOLH_I[21]={0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000};
using namespace MEDCoupling;
-typedef std::vector<std::map<int,double> > IntersectionMatrix;
+typedef std::vector<std::map<mcIdType,double> > IntersectionMatrix;
void MEDCouplingBasicsTestInterp::test2DInterpP0P0_1()
{
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
INTERP_KERNEL::IntersectionType types[3]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Convex, INTERP_KERNEL::Geometric2D};
for(int i=0;i<3;i++)
{
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
//
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
MEDCouplingUMesh *sourceMesh=build2DSourceMesh_1();
MEDCouplingUMesh *targetMesh=build2DTargetMesh_1();
//
- std::vector<int> cellsIds(targetMesh->getNumberOfCells());
- for(int i=0;i<targetMesh->getNumberOfCells();i++)
+ std::vector<mcIdType> cellsIds(targetMesh->getNumberOfCells());
+ for(mcIdType i=0;i<targetMesh->getNumberOfCells();i++)
cellsIds[i]=i;
targetMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size());
//
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
//
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
MEDCouplingUMesh *sourceMesh=build2DSourceMesh_1();
MEDCouplingUMesh *targetMesh=build2DTargetMesh_1();
//
- std::vector<int> cellsIds(sourceMesh->getNumberOfCells());
- for(int i=0;i<sourceMesh->getNumberOfCells();i++)
+ std::vector<mcIdType> cellsIds(sourceMesh->getNumberOfCells());
+ for(mcIdType i=0;i<sourceMesh->getNumberOfCells();i++)
cellsIds[i]=i;
sourceMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size());
//
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
//
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
MEDCouplingUMesh *sourceMesh=build2DSourceMesh_1();
MEDCouplingUMesh *targetMesh=build2DTargetMesh_1();
//
- std::vector<int> cellsIds(sourceMesh->getNumberOfCells());
- for(int i=0;i<sourceMesh->getNumberOfCells();i++)
+ std::vector<mcIdType> cellsIds(sourceMesh->getNumberOfCells());
+ for(mcIdType i=0;i<sourceMesh->getNumberOfCells();i++)
cellsIds[i]=i;
sourceMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size());
cellsIds.resize(targetMesh->getNumberOfCells());
- for(int i=0;i<targetMesh->getNumberOfCells();i++)
+ for(mcIdType i=0;i<targetMesh->getNumberOfCells();i++)
cellsIds[i]=i;
targetMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size());
//
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
//
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
for(int i=0;i<2;i++)
{
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1");
MEDCouplingUMesh *sourceMesh=build2DSourceMesh_1();
MEDCouplingUMesh *targetMesh=build2DTargetMesh_1();
//
- std::vector<int> cellsIds(sourceMesh->getNumberOfCells());
- for(int i=0;i<sourceMesh->getNumberOfCells();i++)
+ std::vector<mcIdType> cellsIds(sourceMesh->getNumberOfCells());
+ for(mcIdType i=0;i<sourceMesh->getNumberOfCells();i++)
cellsIds[i]=i;
sourceMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size());
//
cellsIds.resize(targetMesh->getNumberOfCells());
- for(int i=0;i<targetMesh->getNumberOfCells();i++)
+ for(mcIdType i=0;i<targetMesh->getNumberOfCells();i++)
cellsIds[i]=i;
targetMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size());
//
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1");
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
- for(int i=0;i<2;i++)
+ for(mcIdType i=0;i<2;i++)
{
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(types[i]);
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
MEDCouplingUMesh *sourceMesh=build2DSourceMesh_1();
MEDCouplingUMesh *targetMesh=build2DTargetMesh_1();
//
- std::vector<int >cellsIds(targetMesh->getNumberOfCells());
- for(int i=0;i<targetMesh->getNumberOfCells();i++)
+ std::vector<mcIdType >cellsIds(targetMesh->getNumberOfCells());
+ for(mcIdType i=0;i<targetMesh->getNumberOfCells();i++)
cellsIds[i]=i;
targetMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size());
//
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
for(int i=0;i<2;i++)
{
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1");
MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
INTERP_KERNEL::IntersectionType types[3]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
for(int i=0;i<2;i++)
{
MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
for(int i=0;i<2;i++)
{
MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1");
MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
for(int i=0;i<2;i++)
{
MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
for(int i=0;i<2;i++)
{
MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1");
MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::Triangulation);
{
void MEDCouplingBasicsTestInterp::test3DSurfInterpP0P0_3()
{
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
double vecTrans[3]={0.,0.,1.e-10};
double vec[3]={0.,-1.,0.};
double pt[3]={-0.3,-0.3,5.e-11};
MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
for ( int i = 0; i < 4; ++i )
MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
{
MEDCouplingUMesh *sourceMesh=build3DSourceMesh_1();
MEDCouplingUMesh *targetMesh=build3DTargetMesh_1();
- std::vector<int> cellsIds(targetMesh->getNumberOfCells());
+ std::vector<mcIdType> cellsIds(targetMesh->getNumberOfCells());
for(int i=0;i<targetMesh->getNumberOfCells();i++)
cellsIds[i]=i;
targetMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size());
MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
{
MEDCouplingUMesh *sourceMesh=build3DSourceMesh_1();
MEDCouplingUMesh *targetMesh=build3DTargetMesh_1();
- std::vector<int> cellsIds(sourceMesh->getNumberOfCells());
+ std::vector<mcIdType> cellsIds(sourceMesh->getNumberOfCells());
for(int i=0;i<sourceMesh->getNumberOfCells();i++)
cellsIds[i]=i;
sourceMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size());
MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
{
MEDCouplingUMesh *sourceMesh=build3DSourceMesh_1();
MEDCouplingUMesh *targetMesh=build3DTargetMesh_1();
- std::vector<int> cellsIds(sourceMesh->getNumberOfCells());
+ std::vector<mcIdType> cellsIds(sourceMesh->getNumberOfCells());
for(int i=0;i<sourceMesh->getNumberOfCells();i++)
cellsIds[i]=i;
sourceMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size());
MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
for ( int i = 0; i < 4; ++i )
MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
for ( int i = 0; i < 4; ++i )
MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1");
CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
int i=0;
double sum = 0;
//cout.precision(18);
- for(std::vector<std::map<int,double> >::const_iterator iter1=res.begin();iter1!=res.end();iter1++,i++)
+ for(std::vector<std::map<mcIdType,double> >::const_iterator iter1=res.begin();iter1!=res.end();iter1++,i++)
{
//cout<< "res3D[" <<i<< "][]={";
for(int j=0;j<28;j++)
{
- std::map<int,double>::const_iterator iter2=(*iter1).find(j);
+ std::map<mcIdType,double>::const_iterator iter2=(*iter1).find(j);
if(iter2!=(*iter1).end())
{
//cout<< iter2->second<< ", ";
MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1");
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
//clean up
CPPUNIT_ASSERT_THROW( sourceWrapper.nbCellsAlongAxis(3), INTERP_KERNEL::Exception);
INTERP_KERNEL::InterpolationCC myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
CPPUNIT_ASSERT_EQUAL(8,int( res.size()));
std::set<double> vals;
double sum = 0;
for ( int i = 0; i < (int)res.size(); ++i )
- for ( std::map<int,double>::iterator s_v = res[i].begin(); s_v != res[i].end(); ++s_v)
+ for ( std::map<mcIdType,double>::iterator s_v = res[i].begin(); s_v != res[i].end(); ++s_v)
{
sum += s_v->second;
double vvv;
MEDCouplingNormalizedCartesianMesh<1> sourceWrapper(meshC);
MEDCouplingNormalizedUnstructuredMesh<1,1> targetWrapper(meshU);
INTERP_KERNEL::InterpolationCU myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
const double precis = 1e-13;
myInterpolator.setPrecision(precis);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
MEDCouplingNormalizedCartesianMesh<2> sourceWrapper(meshC);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(meshU);
INTERP_KERNEL::InterpolationCU myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
MEDCouplingNormalizedCartesianMesh<3> sourceWrapper(meshC);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(meshU);
INTERP_KERNEL::InterpolationCU myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
const double precis = 1e-13;
myInterpolator.setPrecision(precis);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
//
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
- CPPUNIT_ASSERT_EQUAL(5,myInterpolator.toIntegralUniform(targetWrapper,res,"P0"));
+ std::vector<std::map<mcIdType,double> > res;
+ CPPUNIT_ASSERT_EQUAL(5,(int)myInterpolator.toIntegralUniform(targetWrapper,res,"P0"));
CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[0][0],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125,res[0][1],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[0][4],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,sumAll(res),1e-12);
res.clear();
- CPPUNIT_ASSERT_EQUAL(1,myInterpolator.fromIntegralUniform(targetWrapper,res,"P0"));
+ CPPUNIT_ASSERT_EQUAL(1,(int)myInterpolator.fromIntegralUniform(targetWrapper,res,"P0"));
CPPUNIT_ASSERT_EQUAL(5,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[0][0],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125,res[1][0],1e-12);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper2(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator2;
CPPUNIT_ASSERT(myInterpolator2.getMeasureAbsStatus());
- CPPUNIT_ASSERT_EQUAL(5,myInterpolator2.toIntegralUniform(targetWrapper2,res,"P0"));
+ CPPUNIT_ASSERT_EQUAL(5,(int)myInterpolator2.toIntegralUniform(targetWrapper2,res,"P0"));
CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[0][0],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125,res[0][1],1e-12);
res.clear();
myInterpolator2.setMeasureAbsStatus(false);
CPPUNIT_ASSERT(!myInterpolator2.getMeasureAbsStatus());
- CPPUNIT_ASSERT_EQUAL(5,myInterpolator2.toIntegralUniform(targetWrapper2,res,"P0"));
+ CPPUNIT_ASSERT_EQUAL(5,(int)myInterpolator2.toIntegralUniform(targetWrapper2,res,"P0"));
CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[0][0],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.125,res[0][1],1e-12);
MEDCouplingUMesh *targetMesh=build3DSurfTargetMesh_1();
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh);
- std::vector<std::map<int,double> > res;
- CPPUNIT_ASSERT_EQUAL(5,myInterpolator.toIntegralUniform(targetWrapper,res,"P0"));
+ std::vector<std::map<mcIdType,double> > res;
+ CPPUNIT_ASSERT_EQUAL(5,(int)myInterpolator.toIntegralUniform(targetWrapper,res,"P0"));
CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25*sqrt(2.),res[0][0],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125*sqrt(2.),res[0][1],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25*sqrt(2.),res[0][4],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.*sqrt(2.),sumAll(res),1e-12);
res.clear();
- CPPUNIT_ASSERT_EQUAL(1,myInterpolator.fromIntegralUniform(targetWrapper,res,"P0"));
+ CPPUNIT_ASSERT_EQUAL(1,(int)myInterpolator.fromIntegralUniform(targetWrapper,res,"P0"));
CPPUNIT_ASSERT_EQUAL(5,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25*sqrt(2.),res[0][0],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125*sqrt(2.),res[1][0],1e-12);
MEDCouplingUMesh *targetMesh=build3DTargetMesh_1();
INTERP_KERNEL::Interpolation3D myInterpolator;
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
- std::vector<std::map<int,double> > res;
- CPPUNIT_ASSERT_EQUAL(8,myInterpolator.toIntegralUniform(targetWrapper,res,"P0"));
+ std::vector<std::map<mcIdType,double> > res;
+ CPPUNIT_ASSERT_EQUAL(8,(int)myInterpolator.toIntegralUniform(targetWrapper,res,"P0"));
CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(125000.,res[0][0],1e-6);
CPPUNIT_ASSERT_DOUBLES_EQUAL(375000.,res[0][1],1e-6);
CPPUNIT_ASSERT_DOUBLES_EQUAL(3375000.,res[0][7],1e-6);
CPPUNIT_ASSERT_DOUBLES_EQUAL(8000000.,sumAll(res),1e-6);
res.clear();
- CPPUNIT_ASSERT_EQUAL(1,myInterpolator.fromIntegralUniform(targetWrapper,res,"P0"));
+ CPPUNIT_ASSERT_EQUAL(1,(int)myInterpolator.fromIntegralUniform(targetWrapper,res,"P0"));
CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(125000.,res[0][0],1e-6);
CPPUNIT_ASSERT_DOUBLES_EQUAL(375000.,res[1][0],1e-6);
//
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
- CPPUNIT_ASSERT_EQUAL(4,myInterpolator.toIntegralUniform(targetWrapper,res,"P1"));
+ std::vector<std::map<mcIdType,double> > res;
+ CPPUNIT_ASSERT_EQUAL(4,(int)myInterpolator.toIntegralUniform(targetWrapper,res,"P1"));
CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.33333333333333331,res[0][0],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666666,res[0][1],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666666,res[0][2],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.33333333333333331,res[0][3],1e-12);
res.clear();
- CPPUNIT_ASSERT_EQUAL(1,myInterpolator.fromIntegralUniform(targetWrapper,res,"P1"));
+ CPPUNIT_ASSERT_EQUAL(1,(int)myInterpolator.fromIntegralUniform(targetWrapper,res,"P1"));
CPPUNIT_ASSERT_EQUAL(4,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.33333333333333331,res[0][0],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666666,res[1][0],1e-12);
//
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(sourceMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- std::vector<std::map<int,double> > res;
- CPPUNIT_ASSERT_EQUAL(9,myInterpolator.toIntegralUniform(targetWrapper,res,"P1"));
+ std::vector<std::map<mcIdType,double> > res;
+ CPPUNIT_ASSERT_EQUAL(9,(int)myInterpolator.toIntegralUniform(targetWrapper,res,"P1"));
CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(833333.333333333,res[0][0],1e-6);
CPPUNIT_ASSERT_DOUBLES_EQUAL(833333.333333333,res[0][1],1e-6);
CPPUNIT_ASSERT_DOUBLES_EQUAL(2000000.,res[0][8],1e-6);
CPPUNIT_ASSERT_DOUBLES_EQUAL(8000000.,sumAll(res),1e-6);
res.clear();
- CPPUNIT_ASSERT_EQUAL(1,myInterpolator.fromIntegralUniform(targetWrapper,res,"P1"));
+ CPPUNIT_ASSERT_EQUAL(1,(int)myInterpolator.fromIntegralUniform(targetWrapper,res,"P1"));
CPPUNIT_ASSERT_EQUAL(9,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(833333.333333333,res[0][0],1e-6);
CPPUNIT_ASSERT_DOUBLES_EQUAL(833333.333333333,res[1][0],1e-6);
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Barycentric,INTERP_KERNEL::BarycentricGeo2D};
for(int i=0;i<2;i++)
{
MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Barycentric,INTERP_KERNEL::BarycentricGeo2D};
for(int i=0;i<2;i++)
{
MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::Barycentric);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
double sum = 0;
int i=0;
- for(std::vector<std::map<int,double> >::const_iterator iter1=res.begin();iter1!=res.end();iter1++,i++)
+ for(std::vector<std::map<mcIdType,double> >::const_iterator iter1=res.begin();iter1!=res.end();iter1++,i++)
{
for(int j=0;j<28;j++)
{
- std::map<int,double>::const_iterator iter2=(*iter1).find(j);
+ std::map<mcIdType,double>::const_iterator iter2=(*iter1).find(j);
if(iter2!=(*iter1).end())
{
sum += iter2->second;
MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
myInterpolator.setPrecision(precis);
// P0P0
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
CPPUNIT_ASSERT_EQUAL( 3, int( res.size()) );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.5, res[0][0], precis);
INTERP_KERNEL::Interpolation2DCurve myInterpolator;
const double precis = 1e-13;
myInterpolator.setPrecision(precis);
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
CPPUNIT_ASSERT_EQUAL( 2, int( res.size()) );
const double precis = 1e-13;
myInterpolator.setPrecision(precis);
myInterpolator.setMedianPlane(1.);// median line on target
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
double tolInters = myInterpolator.getBoundingBoxAdjustmentAbs() * sqrt(2.);
INTERP_KERNEL::Interpolation2DCurve myInterpolator;
const double precis = 1e-13;
myInterpolator.setPrecision(precis);
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1");
const double len1 = 1., len0 = sqrt(2.);
INTERP_KERNEL::Interpolation2DCurve myInterpolator;
const double precis = 1e-13;
myInterpolator.setPrecision(precis);
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
const double len1 = 1., len0 = sqrt(2.);
INTERP_KERNEL::Interpolation2DCurve myInterpolator;
const double precis = 1e-13;
myInterpolator.setPrecision(precis);
- std::vector<std::map<int,double> > res;
+ std::vector<std::map<mcIdType,double> > res;
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1");
const double len1 = 1., len0 = sqrt(2.);
CPPUNIT_ASSERT_EQUAL(1,(int)duplicateFaces.size());
INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType correctDuplicateFaces;
- std::set<int> face6;
+ std::set<mcIdType> face6;
face6.insert(0);
face6.insert(1);
correctDuplicateFaces[6] = face6;
CPPUNIT_ASSERT_EQUAL(3,(int)duplicateFaces.size());
INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType correctDuplicateFaces;
- std::set<int> face2;
+ std::set<mcIdType> face2;
face2.insert(0);
face2.insert(1);
correctDuplicateFaces[2] = face2;
- std::set<int> face5;
+ std::set<mcIdType> face5;
face5.insert(1);
face5.insert(2);
correctDuplicateFaces[5] = face5;
- std::set<int> face6;
+ std::set<mcIdType> face6;
face6.insert(0);
face6.insert(1);
face6.insert(2);
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDCouplingMultiFields.hxx"
CPPUNIT_ASSERT( values->isEqualWithoutConsideringStr( *nodeCoords, 1e-13 ));
//! [CppSnippet_MEDCouplingFieldDouble_renumberNodes_2]
//! [CppSnippet_MEDCouplingFieldDouble_renumberNodes_3]
- const int renumber[9] = { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
+ const mcIdType renumber[9] = { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
field->renumberNodes(renumber,false);
const MEDCouplingMesh* mesh2 = field->getMesh(); // field now refers to another mesh
values = field->getArray();
CPPUNIT_ASSERT( values->isEqualWithoutConsideringStr( *bc, 1e-13 ));
//! [CppSnippet_MEDCouplingFieldDouble_renumberCells_2]
//! [CppSnippet_MEDCouplingFieldDouble_renumberCells_3]
- const int renumber[4] = { 3, 2, 1, 0 };
+ const mcIdType renumber[4] = { 3, 2, 1, 0 };
field->renumberCells(renumber,false);
const MEDCouplingMesh* mesh2 = field->getMesh(); // field now refers to another mesh
values = field->getArray();
MCAuto<MEDCouplingUMesh> mesh1=MEDCouplingUMesh::New();
mesh1->setMeshDimension(2);
mesh1->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh1->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // #0
mesh1->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // #1
mesh1->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // #2
mesh1->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_1]
//! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_2]
- const int cells2[3] = { 4,2,0 }; // even cells selected
+ const mcIdType cells2[3] = { 4,2,0 }; // even cells selected
MCAuto<MEDCouplingUMesh> mesh2 =
(MEDCouplingUMesh*) mesh1->buildPartOfMySelf( cells2, cells2+3, true );
//! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_2]
//! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_3]
int compType = 0; // the strongest policy
- DataArrayInt *corr2to1, *corr1to2;
+ DataArrayIdType *corr2to1, *corr1to2;
// a larger mesh1 includes a smaller mesh2
CPPUNIT_ASSERT( mesh1->areCellsIncludedIn( mesh2, compType, corr2to1 ));
CPPUNIT_ASSERT( std::equal( cells2, cells2+3, corr2to1->getConstPointer() ));
//! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_4]
// the smaller mesh2 does NOT include the larger mesh1
CPPUNIT_ASSERT( ! mesh2->areCellsIncludedIn( mesh1, compType, corr1to2 ));
- const int corr1to2Expected[5] = {2, 3, 1, 4, 0};
+ const mcIdType corr1to2Expected[5] = {2, 3, 1, 4, 0};
CPPUNIT_ASSERT(std::equal( corr1to2Expected, corr1to2Expected+5, corr1to2->getConstPointer() ));
//! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_4]
corr2to1->decrRef();
mesh->setMeshDimension(3);
mesh->allocateCells(2);
// connectivity of reversed HEXA8 and PENTA6
- const int conn[8+6]={0,1,4,3, 5,6,9,8, 1,2,4, 6,7,9};
+ const mcIdType conn[8+6]={0,1,4,3, 5,6,9,8, 1,2,4, 6,7,9};
mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8, 8,conn+0);
mesh->insertNextCell(INTERP_KERNEL::NORM_PENTA6,6,conn+8);
mesh->finishInsertingCells();
//! [CppSnippet_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells_1]
//! [CppSnippet_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells_2]
- MCAuto<DataArrayInt> fixedCells =
+ MCAuto<DataArrayIdType> fixedCells =
mesh->findAndCorrectBadOriented3DExtrudedCells();
CPPUNIT_ASSERT( fixedCells->getNumberOfTuples() == 2 ); // 2 cells fixed
fixedCells = mesh->findAndCorrectBadOriented3DExtrudedCells();
mesh->setMeshDimension(3);
mesh->allocateCells(2);
// connectivity of a HEXA8 + a reversed PENTA6
- const int conn[8+6]={0,3,4,1, 5,8,9,6, 1,2,4, 6,7,9};
+ const mcIdType conn[8+6]={0,3,4,1, 5,8,9,6, 1,2,4, 6,7,9};
mesh->insertNextCell(INTERP_KERNEL::NORM_POLYHED,8,conn); // "extruded" polyhedron
mesh->insertNextCell(INTERP_KERNEL::NORM_POLYHED,6,conn+8);
mesh->finishInsertingCells();
mesh->convertExtrudedPolyhedra();
//! [CppSnippet_MEDCouplingUMesh_arePolyhedronsNotCorrectlyOriented_1]
//! [CppSnippet_MEDCouplingUMesh_arePolyhedronsNotCorrectlyOriented_2]
- std::vector<int> badCellIds;
+ std::vector<mcIdType> badCellIds;
mesh->arePolyhedronsNotCorrectlyOriented( badCellIds );
CPPUNIT_ASSERT( badCellIds.size() == 1 ); // one polyhedron is KO
// fix invalid rolyherdons
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2
//! [CppSnippet_MEDCouplingUMesh_are2DCellsNotCorrectlyOriented_1]
//! [CppSnippet_MEDCouplingUMesh_are2DCellsNotCorrectlyOriented_2]
const double vec[3] = {0.,0.,-1.};
- std::vector<int> badCellIds;
+ std::vector<mcIdType> badCellIds;
mesh->are2DCellsNotCorrectlyOriented( vec, false, badCellIds );
CPPUNIT_ASSERT( badCellIds.size() == 1 ); // one cell is reversed
// fix orientation
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7);
0.3, 0.3, // point located somewhere inside the mesh
coords[2], coords[3]}; // point at the node #1
const double eps = 1e-4; // ball radius
- MCAuto<DataArrayInt> cells, cellsIndex;
+ MCAuto<DataArrayIdType> cells, cellsIndex;
mesh->getCellsContainingPoints( pos, 3, eps, cells, cellsIndex );
- const int cellsExpected[3]={4, 0, 1};
- const int cellsIndexExpected[4]={0, 0, 1, 3};
+ const mcIdType cellsExpected[3]={4, 0, 1};
+ const mcIdType cellsIndexExpected[4]={0, 0, 1, 3};
CPPUNIT_ASSERT(std::equal( cellsExpected, cellsExpected+3, cells->begin()));
CPPUNIT_ASSERT(std::equal( cellsIndexExpected, cellsIndexExpected+4, cellsIndex->begin()));
//! [CppSnippet_MEDCouplingUMesh_getCellsContainingPoints_2]
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2
const double* coords4 = coords + 4*2; // coordinates of the node #4
const double eps = 1e-4; // ball radius
const double pos[2] = { coords4[0] + eps, coords4[1] - eps }; // ball center
- std::vector<int> cellIds;
+ std::vector<mcIdType> cellIds;
mesh->getCellsContainingPoint( pos, eps, cellIds );
- CPPUNIT_ASSERT ( (int)cellIds.size() == mesh->getNumberOfCells() );
+ CPPUNIT_ASSERT ( ToIdType(cellIds.size()) == mesh->getNumberOfCells() );
//! [CppSnippet_MEDCouplingUMesh_getCellsContainingPoint_2]
}
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_buildPartOrthogonalField_1]
//! [CppSnippet_MEDCouplingUMesh_buildPartOrthogonalField_2]
- const int part[4] = {1,2,3,4}; // cell #0 is omitted
+ const mcIdType part[4] = {1,2,3,4}; // cell #0 is omitted
MCAuto<MEDCouplingFieldDouble> vecField=
mesh->buildPartOrthogonalField( part, part+4 );
CPPUNIT_ASSERT ( vecField->getArray()->getNumberOfTuples() == 4 );
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2
//! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_1]
//! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_2]
const bool isAbs = true;
- const int part[4] = {1,2,3,4}; // cell #0 is omitted
+ const mcIdType part[4] = {1,2,3,4}; // cell #0 is omitted
MCAuto<DataArrayDouble> areaArr=
mesh->getPartMeasureField( isAbs, part, part+4 );
CPPUNIT_ASSERT( areaArr->getIJ(0,0) > 0 ); // orientation ignored
CPPUNIT_ASSERT ( areaArr->getNumberOfTuples() == 4 );
//! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_2]
//! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_3]
- const int cellIds[4] = {1,2,3,4}; // cell #0 is omitted
+ const mcIdType cellIds[4] = {1,2,3,4}; // cell #0 is omitted
MCAuto<DataArrayDouble> baryCenters=
mesh->getPartBarycenterAndOwner( cellIds, cellIds+4 );
CPPUNIT_ASSERT( baryCenters->getNumberOfTuples() == 4 );
- CPPUNIT_ASSERT( baryCenters->getNumberOfComponents() == mesh->getSpaceDimension() );
+ CPPUNIT_ASSERT( (int)baryCenters->getNumberOfComponents() == mesh->getSpaceDimension() );
//! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_3]
}
coordsArr->useExternalArrayWithRWAccess(coords, 3,2);
mesh->setCoords(coordsArr);
mesh->allocateCells(1);
- const int conn[3]={0,1,2};
+ const mcIdType conn[3]={0,1,2};
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn);
mesh->finishInsertingCells();
//! [CppSnippet_MEDCouplingUMesh_getCellsInBoundingBox_1]
//! [CppSnippet_MEDCouplingUMesh_getCellsInBoundingBox_2]
const double bbox[] = {1., 1., 1.001,1.001}; // xMin, xMax, yMin, yMax
- MCAuto<DataArrayInt> cellIdsArr =
+ MCAuto<DataArrayIdType> cellIdsArr =
mesh->getCellsInBoundingBox( bbox, 0.0 );
CPPUNIT_ASSERT( cellIdsArr->getNumberOfTuples() == 0 );
cellIdsArr = mesh->getCellsInBoundingBox( bbox, 0.1 );
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(1);
- const int conn[4]={4,3,2,1};
+ const mcIdType conn[4]={4,3,2,1};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
mesh->finishInsertingCells();
//! [CppSnippet_MEDCouplingUMesh_renumberNodesInConn_1]
//! [CppSnippet_MEDCouplingUMesh_renumberNodesInConn_2]
- const int old2newIds[] = {-1,3,2,1,0};
+ const mcIdType old2newIds[] = {-1,3,2,1,0};
mesh->renumberNodesInConn( old2newIds );
- const int nodes0Expected[] = {0,1,2,3};
- std::vector<int> nodes0;
+ const mcIdType nodes0Expected[] = {0,1,2,3};
+ std::vector<mcIdType> nodes0;
mesh->getNodeIdsOfCell( 0, nodes0 );
CPPUNIT_ASSERT(std::equal( nodes0Expected, nodes0Expected+4, &nodes0[0] ));
//! [CppSnippet_MEDCouplingUMesh_renumberNodesInConn_2]
mesh->finishInsertingCells();
//! [CppSnippet_MEDCouplingUMesh_renumberNodes_1]
//! [CppSnippet_MEDCouplingUMesh_renumberNodes_2]
- const int newIds[] = { 2,1,0,-1 };
+ const mcIdType newIds[] = { 2,1,0,-1 };
mesh->renumberNodes(newIds, 3);
coordsArr = mesh->getCoordinatesAndOwner(); // get a shorten array
const double coordsExpected[3*2]={0.7,-0.3, 0.2,-0.3, -0.3,-0.3};
//! [CppSnippet_MEDCouplingUMesh_renumberNodes_2]
//! [CppSnippet_MEDCouplingUMesh_renumberNodes_3]
coordsArr->useExternalArrayWithRWAccess(coords, 4,2); // restore old nodes
- const int newIds2[] = { 2,1,0,2 };
+ const mcIdType newIds2[] = { 2,1,0,2 };
mesh->renumberNodesCenter(newIds2, 3);
coordsArr = mesh->getCoordinatesAndOwner(); // get a shorten array
const double coordsExpected2[3*2]={0.7,-0.3, 0.2,-0.3, -0.3, 0.0};
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7);
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_findBoundaryNodes_1]
//! [CppSnippet_MEDCouplingUMesh_findBoundaryNodes_2]
- MCAuto<DataArrayInt> nodeIdsArr=mesh->findBoundaryNodes();
+ MCAuto<DataArrayIdType> nodeIdsArr=mesh->findBoundaryNodes();
CPPUNIT_ASSERT( nodeIdsArr->getNumberOfTuples() == mesh->getNumberOfNodes() - 1 );
//! [CppSnippet_MEDCouplingUMesh_findBoundaryNodes_2]
}
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7);
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_buildFacePartOfMySelfNode_1]
//! [CppSnippet_MEDCouplingUMesh_buildFacePartOfMySelfNode_2]
- std::vector<int> nodes;
+ std::vector<mcIdType> nodes;
mesh->getNodeIdsOfCell( 0, nodes );
const bool allNodes = true;
MCAuto<MEDCouplingUMesh> mesh1 =
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelfNode_1]
//! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelfNode_2]
- std::vector<int> nodes;
+ std::vector<mcIdType> nodes;
mesh->getNodeIdsOfCell( 0, nodes );
const bool allNodes = true;
MCAuto<MEDCouplingUMesh> mesh1 =
(MEDCouplingUMesh*)mesh->buildPartOfMySelfNode( &nodes[0], &nodes[0]+nodes.size(), allNodes);
MCAuto<MEDCouplingUMesh> mesh2 =
(MEDCouplingUMesh*)mesh->buildPartOfMySelfNode( &nodes[0], &nodes[0]+nodes.size(),!allNodes);
- CPPUNIT_ASSERT_EQUAL( (int)mesh1->getNumberOfCells(), 1 );
+ CPPUNIT_ASSERT_EQUAL( mesh1->getNumberOfCells(), ToIdType( 1 ));
CPPUNIT_ASSERT_EQUAL( mesh2->getNumberOfCells(), mesh->getNumberOfCells() );
//! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelfNode_2]
}
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_getCellIdsLyingOnNodes_1]
//! [CppSnippet_MEDCouplingUMesh_getCellIdsLyingOnNodes_2]
- std::vector<int> nodes;
+ std::vector<mcIdType> nodes;
mesh->getNodeIdsOfCell( 0, nodes );
const bool allNodes = true;
- DataArrayInt* cellIdsArr1 = mesh->getCellIdsLyingOnNodes( &nodes[0], &nodes[0]+nodes.size(), allNodes);
- DataArrayInt* cellIdsArr2 = mesh->getCellIdsLyingOnNodes( &nodes[0], &nodes[0]+nodes.size(),!allNodes);
- CPPUNIT_ASSERT_EQUAL( (int)cellIdsArr1->getNumberOfTuples(), 1 );
- CPPUNIT_ASSERT_EQUAL( (int)cellIdsArr2->getNumberOfTuples(), (int)mesh->getNumberOfCells() );
+ DataArrayIdType* cellIdsArr1 = mesh->getCellIdsLyingOnNodes( &nodes[0], &nodes[0]+nodes.size(), allNodes);
+ DataArrayIdType* cellIdsArr2 = mesh->getCellIdsLyingOnNodes( &nodes[0], &nodes[0]+nodes.size(),!allNodes);
+ CPPUNIT_ASSERT_EQUAL( cellIdsArr1->getNumberOfTuples(), ToIdType( 1 ));
+ CPPUNIT_ASSERT_EQUAL( cellIdsArr2->getNumberOfTuples(), mesh->getNumberOfCells() );
//! [CppSnippet_MEDCouplingUMesh_getCellIdsLyingOnNodes_2]
cellIdsArr1->decrRef();
cellIdsArr2->decrRef();
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7);
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds_1]
//! [CppSnippet_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds_2]
- const int cellIds[2]={1,2};
- std::vector<int> nodes;
+ const mcIdType cellIds[2]={1,2};
+ std::vector<mcIdType> nodes;
mesh->getNodeIdsOfCell( cellIds[0], nodes );
mesh->getNodeIdsOfCell( cellIds[1], nodes );
- DataArrayInt* cellIdsArr = mesh->getCellIdsFullyIncludedInNodeIds( &nodes[0], &nodes[0]+nodes.size());
+ DataArrayIdType* cellIdsArr = mesh->getCellIdsFullyIncludedInNodeIds( &nodes[0], &nodes[0]+nodes.size());
CPPUNIT_ASSERT(std::equal( cellIds, cellIds+2, cellIdsArr->getPointer() ));
//! [CppSnippet_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds_2]
cellIdsArr->decrRef();
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelf_1]
//! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelf_2]
- const int cellIds[2]={1,2};
+ const mcIdType cellIds[2]={1,2};
MEDCouplingUMesh* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true);
MEDCouplingUMesh* mesh3=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,false);
CPPUNIT_ASSERT( coordsArr->isEqual( *mesh2->getCoords(), 1e-13 )); // same nodes
CPPUNIT_ASSERT( !coordsArr->isEqual( *mesh3->getCoords(), 1e-13 )); // different nodes
- for ( int i = 0; i < 2; ++i )
+ for ( mcIdType i = 0; i < 2; ++i )
{
- std::vector<int> nodes1, nodes2;
+ std::vector<mcIdType> nodes1, nodes2;
mesh ->getNodeIdsOfCell(cellIds[i], nodes1);
mesh2->getNodeIdsOfCell(i, nodes2);
CPPUNIT_ASSERT( nodes1 == nodes2 ); // cell #cellIds[i] was copied
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7);
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_mergeNodes_1]
//! [CppSnippet_MEDCouplingUMesh_mergeNodes_2]
- bool areNodesMerged; int newNbOfNodes;
- MCAuto<DataArrayInt> arr=
+ bool areNodesMerged; mcIdType newNbOfNodes;
+ MCAuto<DataArrayIdType> arr=
mesh->mergeNodes(0.004,areNodesMerged,newNbOfNodes);
- const int idsExpected[6] = {0, 1, 0, 2, 2, 0};
+ const mcIdType idsExpected[6] = {0, 1, 0, 2, 2, 0};
CPPUNIT_ASSERT(std::equal(idsExpected,idsExpected+6,arr->getPointer()));
CPPUNIT_ASSERT( areNodesMerged );
- CPPUNIT_ASSERT_EQUAL( 3, newNbOfNodes );
+ CPPUNIT_ASSERT_EQUAL( ToIdType( 3 ), newNbOfNodes );
//! [CppSnippet_MEDCouplingUMesh_mergeNodes_2]
//! [CppSnippet_MEDCouplingUMesh_mergeNodes_3]
const double* baryCoords2 = coords + 2*2; // initial coordinates of node #2
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[11]={0,3,4,1, 1,4,2, 4,1,0,3};
+ const mcIdType conn[11]={0,3,4,1, 1,4,2, 4,1,0,3};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+0); // 0
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 2 == 1
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_zipConnectivityTraducer_1]
//! [CppSnippet_MEDCouplingUMesh_zipConnectivityTraducer_2]
- const int oldNbCells = mesh->getNumberOfCells();
- DataArrayInt *arr = mesh->zipConnectivityTraducer(0);
- CPPUNIT_ASSERT_EQUAL( oldNbCells-2, (int)mesh->getNumberOfCells() );
- const int idsExpected[5] = {0, 1, 1, 0, 2};
+ const mcIdType oldNbCells = mesh->getNumberOfCells();
+ DataArrayIdType *arr = mesh->zipConnectivityTraducer(0);
+ CPPUNIT_ASSERT_EQUAL( oldNbCells-2, mesh->getNumberOfCells() );
+ const mcIdType idsExpected[5] = {0, 1, 1, 0, 2};
CPPUNIT_ASSERT(std::equal(idsExpected,idsExpected+5,arr->getPointer()));
//! [CppSnippet_MEDCouplingUMesh_zipConnectivityTraducer_2]
arr->decrRef();
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7);
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_zipCoordsTraducer_1]
//! [CppSnippet_MEDCouplingUMesh_zipCoordsTraducer_2]
- const int cellIds[2]={1,2};
+ const mcIdType cellIds[2]={1,2};
MEDCouplingUMesh* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true);
- DataArrayInt *arr=mesh2->zipCoordsTraducer();
- CPPUNIT_ASSERT_EQUAL( 4, mesh2->getNumberOfNodes() ); // nb of nodes decreased
- CPPUNIT_ASSERT_EQUAL( (int)mesh->getNumberOfNodes(), (int)arr->getNumberOfTuples() );
- const int idsExpected[9] = {-1,0,1,-1,2,3,-1,-1,-1}; // -1 for unused nodes
+ DataArrayIdType *arr=mesh2->zipCoordsTraducer();
+ CPPUNIT_ASSERT_EQUAL( ToIdType(4), mesh2->getNumberOfNodes() ); // nb of nodes decreased
+ CPPUNIT_ASSERT_EQUAL( mesh->getNumberOfNodes(), arr->getNumberOfTuples() );
+ const mcIdType idsExpected[9] = {-1,0,1,-1,2,3,-1,-1,-1}; // -1 for unused nodes
CPPUNIT_ASSERT(std::equal(idsExpected,idsExpected+9,arr->getPointer()));
//! [CppSnippet_MEDCouplingUMesh_zipCoordsTraducer_2]
mesh2->decrRef();
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7);
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_1]
//! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_2]
- const int cellIds[2]={1,2};
+ const mcIdType cellIds[2]={1,2};
MEDCouplingUMesh* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true);
- int newNbOfNodes = 0;
- DataArrayInt *arr=mesh2->getNodeIdsInUse( newNbOfNodes );
- const int idsExpected[9] = {-1,0,1,-1,2,3,-1,-1,-1};
+ mcIdType newNbOfNodes = 0;
+ DataArrayIdType *arr=mesh2->getNodeIdsInUse( newNbOfNodes );
+ const mcIdType idsExpected[9] = {-1,0,1,-1,2,3,-1,-1,-1};
CPPUNIT_ASSERT(std::equal(idsExpected,idsExpected+9,arr->getPointer()));
//! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_2]
//! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_3]
- DataArrayInt *arr2=arr->invertArrayO2N2N2O(newNbOfNodes);
- const int idsExpected2[4] = {1,2,4,5};
+ DataArrayIdType *arr2=arr->invertArrayO2N2N2O(newNbOfNodes);
+ const mcIdType idsExpected2[4] = {1,2,4,5};
CPPUNIT_ASSERT(std::equal(idsExpected2,idsExpected2+4,arr2->getPointer()));
//! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_3]
mesh2->decrRef();
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_convertToPolyTypes_1]
//! [CppSnippet_MEDCouplingUMesh_convertToPolyTypes_2]
- const int cells[2]={1,3};
+ const mcIdType cells[2]={1,3};
mesh->convertToPolyTypes(cells, cells+2);
CPPUNIT_ASSERT( mesh->getTypeOfCell(0) == INTERP_KERNEL::NORM_QUAD4 );
CPPUNIT_ASSERT( mesh->getTypeOfCell(1) == INTERP_KERNEL::NORM_POLYGON );
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_1]
//! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_2]
- DataArrayInt *desc =DataArrayInt::New();
- DataArrayInt *descIndx =DataArrayInt::New();
- DataArrayInt *revDesc =DataArrayInt::New();
- DataArrayInt *revDescIndx=DataArrayInt::New();
+ DataArrayIdType *desc =DataArrayIdType::New();
+ DataArrayIdType *descIndx =DataArrayIdType::New();
+ DataArrayIdType *revDesc =DataArrayIdType::New();
+ DataArrayIdType *revDescIndx=DataArrayIdType::New();
MEDCouplingUMesh * mesh2 = mesh->buildDescendingConnectivity2(desc,descIndx,revDesc,revDescIndx);
- const int descExpected[] = {1,2,3,4,-3,5,6,7,8,-5,9,10,-2,11,12,13,-7,-10};
- const int descIndxExpected[] = {0,4,7,10,14,18};
- const int revDescExpected[] = {0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4};
- const int revDescIndxExpected[] = {0,1,3,5,6,8,9,11,12,13,15,16,17,18};
+ const mcIdType descExpected[] = {1,2,3,4,-3,5,6,7,8,-5,9,10,-2,11,12,13,-7,-10};
+ const mcIdType descIndxExpected[] = {0,4,7,10,14,18};
+ const mcIdType revDescExpected[] = {0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4};
+ const mcIdType revDescIndxExpected[] = {0,1,3,5,6,8,9,11,12,13,15,16,17,18};
CPPUNIT_ASSERT(std::equal(descExpected,descExpected+18,desc->getPointer()));
CPPUNIT_ASSERT(std::equal(descIndxExpected,descIndxExpected+6,descIndx->getPointer()));
CPPUNIT_ASSERT(std::equal(revDescExpected,revDescExpected+18,revDesc->getPointer()));
CPPUNIT_ASSERT(std::equal(revDescIndxExpected,revDescIndxExpected+14,revDescIndx->getPointer()));
//! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_2]
//! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_3]
- const int cell2ConnExpect[] = {4,1};
- std::vector<int> cell2Conn;
+ const mcIdType cell2ConnExpect[] = {4,1};
+ std::vector<mcIdType> cell2Conn;
mesh2->getNodeIdsOfCell( 3-1, cell2Conn ); // cell #3 in FORTRAN mode
CPPUNIT_ASSERT(std::equal(cell2ConnExpect,cell2ConnExpect+2,&cell2Conn[0]));
//! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_3]
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity_1]
//! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity_2]
- DataArrayInt *desc =DataArrayInt::New();
- DataArrayInt *descIndx =DataArrayInt::New();
- DataArrayInt *revDesc =DataArrayInt::New();
- DataArrayInt *revDescIndx=DataArrayInt::New();
+ DataArrayIdType *desc =DataArrayIdType::New();
+ DataArrayIdType *descIndx =DataArrayIdType::New();
+ DataArrayIdType *revDesc =DataArrayIdType::New();
+ DataArrayIdType *revDescIndx=DataArrayIdType::New();
MEDCouplingUMesh * mesh2 = mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
- const int descExpected[] = {0,1,2,3, 2,4,5, 6,7,4, 8,9,1,10, 11,12,6,9};
- const int descIndxExpected[] = {0,4,7,10,14,18};
- const int revDescExpected[] = {0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4};
- const int revDescIndxExpected[] = {0,1,3,5,6,8,9,11,12,13,15,16,17,18};
+ const mcIdType descExpected[] = {0,1,2,3, 2,4,5, 6,7,4, 8,9,1,10, 11,12,6,9};
+ const mcIdType descIndxExpected[] = {0,4,7,10,14,18};
+ const mcIdType revDescExpected[] = {0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4};
+ const mcIdType revDescIndxExpected[] = {0,1,3,5,6,8,9,11,12,13,15,16,17,18};
CPPUNIT_ASSERT(std::equal(descExpected,descExpected+18,desc->getPointer()));
CPPUNIT_ASSERT(std::equal(descIndxExpected,descIndxExpected+6,descIndx->getPointer()));
CPPUNIT_ASSERT(std::equal(revDescExpected,revDescExpected+18,revDesc->getPointer()));
MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
- const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingUMesh_getReverseNodalConnectivity_1]
//! [CppSnippet_MEDCouplingUMesh_getReverseNodalConnectivity_2]
- DataArrayInt *revNodal=DataArrayInt::New();
- DataArrayInt *revNodalIndx=DataArrayInt::New();
+ DataArrayIdType *revNodal=DataArrayIdType::New();
+ DataArrayIdType *revNodalIndx=DataArrayIdType::New();
mesh->getReverseNodalConnectivity(revNodal,revNodalIndx);
- const int revNodalExpected[18]={0,0,1,1,2,0,3,0,1,2,3,4,2,4,3,3,4,4};
- const int revNodalIndexExpected[10]={0,1,3,5,7,12,14,15,17,18};
+ const mcIdType revNodalExpected[18]={0,0,1,1,2,0,3,0,1,2,3,4,2,4,3,3,4,4};
+ const mcIdType revNodalIndexExpected[10]={0,1,3,5,7,12,14,15,17,18};
CPPUNIT_ASSERT(std::equal(revNodalExpected,revNodalExpected+18,revNodal->getPointer()));
CPPUNIT_ASSERT(std::equal(revNodalIndexExpected,revNodalIndexExpected+10,revNodalIndx->getPointer()));
//! [CppSnippet_MEDCouplingUMesh_getReverseNodalConnectivity_2]
coordsArr->useExternalArrayWithRWAccess( coords, 4, 2 );
mesh1->setCoords(coordsArr);
mesh1->allocateCells(2);
- const int conn[6]={0,1,2, 1,2,3};
+ const mcIdType conn[6]={0,1,2, 1,2,3};
mesh1->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+0); // #0
mesh1->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+3); // #1
mesh1->finishInsertingCells();
coordsArr->useExternalArrayWithRWAccess( coords2, 4, 2 );
mesh2->setCoords(coordsArr);
mesh2->allocateCells(2);
- const int conn[6]={2,3,0, 3,1,2};
+ const mcIdType conn[6]={2,3,0, 3,1,2};
mesh2->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+0); // #0 = #1
mesh2->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+3); // #1 ~ #0
mesh2->finishInsertingCells();
//! [CppSnippet_MEDCouplingUMesh_checkDeepEquivalWith_1]
//! [CppSnippet_MEDCouplingUMesh_checkDeepEquivalWith_2]
int cellCompPol = 1; // "permuted same orientation" - policy of medium severity
- DataArrayInt *nOld2New, *cOld2New;
+ DataArrayIdType *nOld2New, *cOld2New;
mesh1->checkDeepEquivalWith( mesh2, cellCompPol, 0.002, cOld2New, nOld2New );
- const int nOld2NewExpected[4] = { 3, 0, 1, 2 };
- const int cOld2NewExpected[2] = { 1, 0 };
+ const mcIdType nOld2NewExpected[4] = { 3, 0, 1, 2 };
+ const mcIdType cOld2NewExpected[2] = { 1, 0 };
CPPUNIT_ASSERT(std::equal(nOld2NewExpected,nOld2NewExpected+4,nOld2New->getConstPointer()));
CPPUNIT_ASSERT(std::equal(cOld2NewExpected,cOld2NewExpected+2,cOld2New->getConstPointer()));
//! [CppSnippet_MEDCouplingUMesh_checkDeepEquivalWith_2]
CPPUNIT_ASSERT_THROW ( mesh1->checkDeepEquivalOnSameNodesWith( mesh2, cellCompPol, 0.002, cOld2New ), INTERP_KERNEL::Exception );
mesh2->setCoords( mesh1->getCoords() ); // make meshes share the same coordinates array
mesh2->allocateCells(2);
- const int conn[6]={1,2,3, 1,0,2};
+ const mcIdType conn[6]={1,2,3, 1,0,2};
mesh2->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+0); // #0 = #1
mesh2->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3); // #1 ~ #0
mesh2->finishInsertingCells();
mesh->getBoundingBox( (double*) bbox );
// check the returned coordinates of extremum points of the bounding box
- for ( int i = 0; i < 2; ++i ) // point id
- for ( int j = 0; j < 3; ++j ) // component
+ for ( mcIdType i = 0; i < 2; ++i ) // point id
+ for ( mcIdType j = 0; j < 3; ++j ) // component
CPPUNIT_ASSERT_DOUBLES_EQUAL( cc[ i*3 + j ], bbox[j][i], 1e-13);
//! [CppSnippet_MEDCouplingPointSet_getBoundingBox_2]
}
//! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoint_1]
//! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoint_2]
double point [2]={0.3, -0.3}; // point close to nodes #0, #2 and #4
- DataArrayInt *ids = mesh->getNodeIdsNearPoint(point, 1e-2);
+ DataArrayIdType *ids = mesh->getNodeIdsNearPoint(point, 1e-2);
// check found ids
- const int expectedIDs[3] = {0,2,4};
- DataArrayInt * okIDs = ids->findIdsEqualList ( expectedIDs, expectedIDs+3 );
- CPPUNIT_ASSERT_EQUAL(3, (int)okIDs->getNumberOfTuples());
+ const mcIdType expectedIDs[3] = {0,2,4};
+ DataArrayIdType * okIDs = ids->findIdsEqualList ( expectedIDs, expectedIDs+3 );
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3), okIDs->getNumberOfTuples());
// release data
ids->decrRef();
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoints_1]
//! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoints_2]
- const int nbOfPoints = 3;
+ const mcIdType nbOfPoints = 3;
double points [nbOfPoints*2]={0.2,-0.30001, // ~ node #1
0.0, 0.0,
1.1, 0.002}; // ~ nodes #3, #4 and #5
- DataArrayInt *ids, *idsIndex;
+ DataArrayIdType *ids, *idsIndex;
mesh->getNodeIdsNearPoints(points, nbOfPoints, 1e-1,ids,idsIndex);
// check found ids (i.e. contents of 'ids' array)
- const int expectedIDs[4] = {1, 3, 4, 5};
- DataArrayInt * okIDs = ids->findIdsEqualList ( expectedIDs, expectedIDs+4 );
- CPPUNIT_ASSERT_EQUAL(4, (int)okIDs->getNumberOfTuples());
+ const mcIdType expectedIDs[4] = {1, 3, 4, 5};
+ DataArrayIdType * okIDs = ids->findIdsEqualList ( expectedIDs, expectedIDs+4 );
+ CPPUNIT_ASSERT_EQUAL(ToIdType(4), okIDs->getNumberOfTuples());
// release data
ids->decrRef();
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingPointSet_findCommonNodes_1]
//! [CppSnippet_MEDCouplingPointSet_findCommonNodes_2]
- DataArrayInt *com, *comI;
+ DataArrayIdType *com, *comI;
mesh->findCommonNodes(1e-13,-1,com,comI);
- CPPUNIT_ASSERT_EQUAL(2, (int)com->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),com->getNumberOfTuples());
com->decrRef(); comI->decrRef();
mesh->findCommonNodes(0.004,-1,com,comI);
- CPPUNIT_ASSERT_EQUAL(5, (int)com->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5), com->getNumberOfTuples());
//! [CppSnippet_MEDCouplingPointSet_findCommonNodes_2]
com->decrRef(); comI->decrRef();
}
using namespace MEDCoupling;
//! [CppSnippet_DataArrayInt_buildPermutationArr_1]
DataArrayInt *a=DataArrayInt::New();
- const int vala[5]={4,5,6,7,8};
+ const mcIdType vala[5]={4,5,6,7,8};
a->alloc(5,1);
std::copy(vala,vala+5,a->getPointer());
DataArrayInt *b=DataArrayInt::New();
- const int valb[5]={5,4,8,6,7};
+ const mcIdType valb[5]={5,4,8,6,7};
b->alloc(5,1);
std::copy(valb,valb+5,b->getPointer());
- DataArrayInt *c=a->buildPermutationArr(*b);
+ DataArrayIdType *c=a->buildPermutationArr(*b);
//! [CppSnippet_DataArrayInt_buildPermutationArr_1]
- const int expect1[5]={1,0,4,2,3};
- CPPUNIT_ASSERT_EQUAL(5,(int)c->getNumberOfTuples());
+ const mcIdType expect1[5]={1,0,4,2,3};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),c->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)c->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(expect1,expect1+5,c->getConstPointer()));
CPPUNIT_ASSERT(a->isEqualWithoutConsideringStrAndOrder(*b));
{
using namespace MEDCoupling;
//! [CppSnippet_DataArrayInt_invertArrayO2N2N2O_1]
- const int arr1[6]={2,0,4,1,5,3};
+ const mcIdType arr1[6]={2,0,4,1,5,3};
DataArrayInt *da=DataArrayInt::New();
da->alloc(6,1);
std::copy(arr1,arr1+6,da->getPointer());
- DataArrayInt *da2=da->invertArrayO2N2N2O(6);
- const int expected1[6]={1,3,0,5,2,4};
- for(int i=0;i<6;i++)
+ DataArrayIdType *da2=da->invertArrayO2N2N2O(6);
+ const mcIdType expected1[6]={1,3,0,5,2,4};
+ for(mcIdType i=0;i<6;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(i,0));
//! [CppSnippet_DataArrayInt_invertArrayO2N2N2O_1]
da->decrRef();
{
using namespace MEDCoupling;
//! [CppSnippet_DataArrayInt_invertArrayN2O2O2N_1]
- const int arr1[6]={2,0,4,1,5,3};
+ const mcIdType arr1[6]={2,0,4,1,5,3};
DataArrayInt *da=DataArrayInt::New();
da->alloc(6,1);
std::copy(arr1,arr1+6,da->getPointer());
- DataArrayInt *da2=da->invertArrayN2O2O2N(6);
- const int expected1[6]={1,3,0,5,2,4};
- for(int i=0;i<6;i++)
+ DataArrayIdType *da2=da->invertArrayN2O2O2N(6);
+ const mcIdType expected1[6]={1,3,0,5,2,4};
+ for(mcIdType i=0;i<6;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(i,0));
//! [CppSnippet_DataArrayInt_invertArrayN2O2O2N_1]
da->decrRef();
da->alloc(10,1);
da->iota();
- DataArrayInt* da2 = da->findIdsInRange( 2.5, 6 );
+ DataArrayIdType* da2 = da->findIdsInRange( 2.5, 6 );
//! [CppSnippet_DataArrayDouble_getIdsInRange_1]
da->decrRef();
da2->decrRef();
std::copy(array2,array2+12,da->getPointer());
//! [CppSnippet_DataArrayDouble_findCommonTuples1]
//! [CppSnippet_DataArrayDouble_findCommonTuples2]
- DataArrayInt *c=0,*cI=0;
+ DataArrayIdType *c=0,*cI=0;
da->findCommonTuples(1.01e-1,-1,c,cI);
- const int expected3[5]={0,3,4,1,2};
- const int expected4[3]={0,3,5};
+ const mcIdType expected3[5]={0,3,4,1,2};
+ const mcIdType expected4[3]={0,3,5};
CPPUNIT_ASSERT(std::equal(expected3,expected3+5,c->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected4,expected4+3,cI->getConstPointer()));
c->decrRef();
{
using namespace MEDCoupling;
//! [CppSnippet_DataArrayDouble_Meld1_1]
- const int sameNbTuples = 7;
+ const mcIdType sameNbTuples = 7;
DataArrayDouble *da1=DataArrayDouble::New();
da1->alloc(sameNbTuples,2);
{
using namespace MEDCoupling;
//! [CppSnippet_DataArrayInt_Meld1_1]
- const int sameNbTuples = 7;
+ const mcIdType sameNbTuples = 7;
DataArrayInt *da1=DataArrayInt::New();
da1->alloc(sameNbTuples,2);
array->decrRef();
//! [CppSnippetFieldDoubleBuildSubPart1_1]
//! [CppSnippetFieldDoubleBuildSubPart1_2]
- const int part1[3]={2,1,4};
+ const mcIdType part1[3]={2,1,4};
MEDCoupling::MEDCouplingFieldDouble *f2=f1->buildSubPart(part1,part1+3);
//! [CppSnippetFieldDoubleBuildSubPart1_2]
f2->zipCoords();
- CPPUNIT_ASSERT_EQUAL(3,(int)f2->getMesh()->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(6,f2->getMesh()->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),f2->getMesh()->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(6),f2->getMesh()->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
MEDCoupling::MEDCouplingUMesh *m2C=dynamic_cast<MEDCoupling::MEDCouplingUMesh *>(const_cast<MEDCoupling::MEDCouplingMesh *>(f2->getMesh()));
- CPPUNIT_ASSERT_EQUAL(13,m2C->getNodalConnectivityArrayLen());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(13),m2C->getNodalConnectivityArrayLen());
const double expected2[12]={0.2, -0.3, 0.7, -0.3, 0.2, 0.2, 0.7, 0.2, 0.2, 0.7, 0.7, 0.7};
- for(int i=0;i<12;i++)
+ for(mcIdType i=0;i<12;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12);
const double expected3[13]={3,2,3,1,3,0,2,1,4,4,5,3,2};
CPPUNIT_ASSERT(std::equal(expected3,expected3+13,m2C->getNodalConnectivity()->getConstPointer()));
array->decrRef();
//! [CppSnippetFieldDoubleBuildSubPart1_3]
//! [CppSnippetFieldDoubleBuildSubPart1_4]
- const int part2[2]={1,2};
+ const mcIdType part2[2]={1,2};
f2=f1->buildSubPart(part2,part2+2);
//! [CppSnippetFieldDoubleBuildSubPart1_4]
f2->decrRef();
//idem previous because nodes of cell#4 are not fully present in part3
- const int part3[2]={1,2};
- MEDCoupling::DataArrayInt *arrr=MEDCoupling::DataArrayInt::New();
+ const mcIdType part3[2]={1,2};
+ MEDCoupling::DataArrayIdType *arrr=MEDCoupling::DataArrayIdType::New();
arrr->alloc(2,1);
std::copy(part3,part3+2,arrr->getPointer());
f2=f1->buildSubPart(arrr);
arrr->decrRef();
f2->decrRef();
//
- const int part4[3]={1,2,4};
+ const mcIdType part4[3]={1,2,4};
f2=f1->buildSubPart(part4,part4+3);
f2->decrRef();
//
//! [CppSnippetUMeshStdBuild1_1]
double coords[27]={-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0.,
0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0. };
- int nodalConnPerCell[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ mcIdType nodalConnPerCell[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
//! [CppSnippetUMeshStdBuild1_1]
//! [CppSnippetUMeshStdBuild1_2]
MEDCoupling::MEDCouplingUMesh *mesh=MEDCoupling::MEDCouplingUMesh::New("My2DMesh",2);
arrY->decrRef();
//! [CppSnippetCMeshStdBuild1_2]
//! [CppSnippetCMeshStdBuild1_3]
- CPPUNIT_ASSERT_EQUAL(8*6,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(9*7,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(8*6),mesh->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(9*7),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
//! [CppSnippetCMeshStdBuild1_3]
mesh->setCoordsAt(1,arrY);
arrY->decrRef();
//! [CppSnippetCMeshStdBuild1_2bis]
- CPPUNIT_ASSERT_EQUAL(8*6,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(9*7,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(8*6),mesh->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(9*7),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
//! [CppSnippetCMeshStdBuild1_4]
//! [CppSnippetUMeshAdvBuild1_1]
double coords[27]={-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0.,
0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0. };
- int nodalConnPerCell[23]={4,0,3,4,1, 3,1,4,2, 3,4,5,2, 4,6,7,4,3, 4,7,8,5,4};
- int nodalConnPerCellIndex[6]={0,5,9,13,18,23};
+ mcIdType nodalConnPerCell[23]={4,0,3,4,1, 3,1,4,2, 3,4,5,2, 4,6,7,4,3, 4,7,8,5,4};
+ mcIdType nodalConnPerCellIndex[6]={0,5,9,13,18,23};
//! [CppSnippetUMeshAdvBuild1_1]
//! [CppSnippetUMeshAdvBuild1_2]
MEDCoupling::MEDCouplingUMesh *mesh=MEDCoupling::MEDCouplingUMesh::New("My2DMesh",2);
//! [CppSnippetUMeshAdvBuild1_2]
//! [CppSnippetUMeshAdvBuild1_3]
- MEDCoupling::DataArrayInt *nodalConn=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType *nodalConn=MEDCoupling::DataArrayIdType::New();
nodalConn->alloc(23,1);
std::copy(nodalConnPerCell,nodalConnPerCell+23,nodalConn->getPointer());
- MEDCoupling::DataArrayInt *nodalConnI=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType *nodalConnI=MEDCoupling::DataArrayIdType::New();
nodalConnI->alloc(6,1);
std::copy(nodalConnPerCellIndex,nodalConnPerCellIndex+6,nodalConnI->getPointer());
mesh->setConnectivity(nodalConn,nodalConnI,true);
- nodalConn->decrRef();// nodalConn DataArrayInt instance is owned by mesh after call to setConnectivity method. No more need here -> decrRef()
- nodalConnI->decrRef();// nodalConnI DataArrayInt instance is owned by mesh after call to setConnectivity method. No more need here -> decrRef()
+ nodalConn->decrRef();// nodalConn DataArrayIdType instance is owned by mesh after call to setConnectivity method. No more need here -> decrRef()
+ nodalConnI->decrRef();// nodalConnI DataArrayIdType instance is owned by mesh after call to setConnectivity method. No more need here -> decrRef()
//! [CppSnippetUMeshAdvBuild1_3]
//! [CppSnippetUMeshAdvBuild1_4]
MEDCoupling::DataArrayDouble *coordsArr=MEDCoupling::DataArrayDouble::New();
void CppSnippetDataArrayBuild1()
{
//! [CppSnippetDataArrayBuild1_0]
- const int nbOfNodes=12;
+ const mcIdType nbOfNodes=12;
double coords[3*nbOfNodes]={2.,3.,4.,3.,4.,5.,4.,5.,6.,5.,6.,7.,6.,7.,8.,7.,8.,9.,8.,9.,10.,9.,10.,11.,10.,11.,12.,11.,12.,13.,12.,13.,14.,13.,14.,15.};
//
MEDCoupling::DataArrayDouble *coordsArr=0;
sourceMesh->decrRef();
targetMesh->decrRef();
//------------- 1D -> 2D
- const int conn[8]={0,1,1,2,2,3,3,0};
- const int conn2[12]={6,7,5,4,2,7,6,3,0,4,5,1};
+ const mcIdType conn[8]={0,1,1,2,2,3,3,0};
+ const mcIdType conn2[12]={6,7,5,4,2,7,6,3,0,4,5,1};
const double coords1[]={0.17,0.93,0.56,0.93,0.56,0.25,0.17,0.52};
const double coords2[]={0.,0.,1.,0.,1.,1.,0.,1.,0.,0.5,1.,0.5,0.,0.8,1.,0.8};
sourceMesh=MEDCouplingUMesh::New("src1D",1);
{
MEDCouplingUMesh *meshN,*meshTT,*meshTF;
MEDCouplingBasicsTest::build3DExtrudedUMesh_2(meshN,meshTT,meshTF);
- std::vector<int> n;
+ std::vector<mcIdType> n;
double pt[3]={300.,300.,0.};
double v[3]={0.,0.,2.};
meshN->findNodesOnPlane(pt,v,1e-12,n);
MEDCouplingUMesh *meshN2D=(MEDCouplingUMesh *)meshN->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
n.clear();
bool b=false;
- int newNbOfNodes;
- DataArrayInt *da=meshTT->mergeNodes(1e-12,b,newNbOfNodes);
+ mcIdType newNbOfNodes;
+ DataArrayIdType *da=meshTT->mergeNodes(1e-12,b,newNbOfNodes);
CPPUNIT_ASSERT(b);
da->decrRef();
meshTT->findNodesOnPlane(pt,v,1e-12,n);
0.59,0.09, 0.69,0.19, 0.21,-0.29,0.31,-0.19, 0.45,0.25,0.65,0.45,
-0.2,-0.2,0.11,0.11, 0.25,0.25, 0.45,0.45
};
- int targetConn[10]={0,1, 2,3, 4,5, 6,7, 8,9};
+ mcIdType targetConn[10]={0,1, 2,3, 4,5, 6,7, 8,9};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New("my name of mesh 1D 2",1);
targetMesh->allocateCells(5);
double targetCoords[20]={-0.6,-0.4, -0.1,-0.4, 1.1,-0.4, 2.1,-0.4,
-0.6,0.1, -0.1,0.1, 1.1,0.1, 2.1,0.1,
-0.6,1.1, -0.1,1.1};
- int targetConn[16]={0,4,5,1, 1,5,6,2, 2,6,7,3, 4,8,9,5};
+ mcIdType targetConn[16]={0,4,5,1, 1,5,6,2, 2,6,7,3, 4,8,9,5};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(4);
0.,0.,3., 1.,1.,3., 1.,1.25,3., 0.,1.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3.,
3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.};
- int conn[354]={
+ mcIdType conn[354]={
// 0
0,11,1,3,15,26,16,18, 1,2,4,7,13,6,-1,1,16,21,6,-1,6,21,28,13,-1,13,7,22,28,-1,7,4,19,22,-1,4,2,17,19,-1,2,1,16,17,-1,16,21,28,22,19,17,
1,6,5,3,16,21,20,18, 13,10,9,6,28,25,24,21,
41,38,37,34,32,31,-1,41,56,46,31,-1,31,46,47,32,-1,32,47,49,34,-1,34,49,52,37,-1,37,38,53,52,-1,38,41,56,53,-1,56,46,47,49,52,53,
37,42,44,43,52,57,59,58
};
- int conn2[28]={7,12,14,13, 11,8,7,4,2,1, 13,10,9,6, 1,6,5,3, 1,2,4,7,13,6, 0,11,1,3};
+ mcIdType conn2[28]={7,12,14,13, 11,8,7,4,2,1, 13,10,9,6, 1,6,5,3, 1,2,4,7,13,6, 0,11,1,3};
//
MEDCouplingUMesh *ret=MEDCouplingUMesh::New();
ret->setMeshDimension(3);
array->alloc(sourceMesh->getNumberOfCells(),1);
srcField->setArray(array);
double *ptr=array->getPointer();
- for(int i=0;i<sourceMesh->getNumberOfCells();i++)
+ for(mcIdType i=0;i<sourceMesh->getNumberOfCells();i++)
ptr[i]=(double)(i+7);
array->decrRef();
MEDCouplingFieldDouble *trgField=MEDCouplingFieldDouble::New(ON_CELLS);
DataArrayDouble *coordsSrc(DataArrayDouble::New());
const double coordsSrcData[18]={-6.25,3.6084391824351605,264.85199999999998,-6.25,3.6084391824351605,289.05200000000002,-6.2499999999999991,-3.6084391824351618,264.85199999999998,-6.2499999999999991,-3.6084391824351618,289.05200000000002,-1.7763568394002505e-15,4.4408920985006262e-15,264.85199999999998,-1.7763568394002505e-15,4.4408920985006262e-15,289.05200000000002};
coordsSrc->useArray(coordsSrcData,false,DeallocType::CPP_DEALLOC,6,3);
- DataArrayInt *connSrc(DataArrayInt::New()),*connISrc(DataArrayInt::New());
- const int connSrcData[7]={16,2,0,4,3,1,5};
+ DataArrayIdType *connSrc(DataArrayIdType::New()),*connISrc(DataArrayIdType::New());
+ const mcIdType connSrcData[7]={16,2,0,4,3,1,5};
connSrc->useArray(connSrcData,false,DeallocType::CPP_DEALLOC,7,1);
- const int connISrcData[2]={0,7};
+ const mcIdType connISrcData[2]={0,7};
connISrc->useArray(connISrcData,false,DeallocType::CPP_DEALLOC,2,1);
MEDCouplingUMesh *srcMesh(MEDCouplingUMesh::New("source",3));
srcMesh->setCoords(coordsSrc);
DataArrayDouble *coordsTrg(DataArrayDouble::New());
const double coordsTrgData[36]={-2,1.1547005383792521,264.85199999999998,-2,0.57735026918962618,264.85199999999998,-2.5,0.2886751345948132,264.85199999999998,-2.5,1.443375672974065,264.85199999999998,-3.0000000000000004,1.1547005383792526,264.85199999999998,-3.0000000000000004,0.57735026918962662,264.85199999999998,-2,1.1547005383792521,289.05200000000002,-2,0.57735026918962618,289.05200000000002,-2.5,0.2886751345948132,289.05200000000002,-2.5,1.443375672974065,289.05200000000002,-3.0000000000000004,1.1547005383792526,289.05200000000002,-3.0000000000000004,0.57735026918962662,289.05200000000002};
coordsTrg->useArray(coordsTrgData,false,DeallocType::CPP_DEALLOC,12,3);
- DataArrayInt *connTrg=DataArrayInt::New();
- const int connTrgData[44]={31,0,1,2,5,4,3,-1,7,6,9,10,11,8,-1,3,9,6,0,-1,4,10,9,3,-1,5,11,10,4,-1,2,8,11,5,-1,1,7,8,2,-1,0,6,7,1};
+ DataArrayIdType *connTrg=DataArrayIdType::New();
+ const mcIdType connTrgData[44]={31,0,1,2,5,4,3,-1,7,6,9,10,11,8,-1,3,9,6,0,-1,4,10,9,3,-1,5,11,10,4,-1,2,8,11,5,-1,1,7,8,2,-1,0,6,7,1};
connTrg->useArray(connTrgData,false,DeallocType::CPP_DEALLOC,44,1);
- DataArrayInt *connITrg=DataArrayInt::New();
- const int connITrgData[2]={0,44};
+ DataArrayIdType *connITrg=DataArrayIdType::New();
+ const mcIdType connITrgData[2]={0,44};
connITrg->useArray(connITrgData,false,DeallocType::CPP_DEALLOC,2,1);
MEDCouplingUMesh *trgMesh=MEDCouplingUMesh::New("target",3);
trgMesh->setCoords(coordsTrg);
remapper.setPrecision(1e-12);
remapper.setIntersectionType(INTERP_KERNEL::Triangulation);
CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(srcMesh,trgMesh,"P0P0"));
- std::vector<std::map<int,double> > matrx(remapper.getCrudeMatrix());
+ std::vector<std::map<mcIdType,double> > matrx(remapper.getCrudeMatrix());
CPPUNIT_ASSERT_EQUAL(1,(int)matrx.size());
CPPUNIT_ASSERT_EQUAL(1,(int)matrx[0].size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(valExpected,matrx[0][0],1e-13);
ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES CPLUSPLUS ON)
IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES SWIG_FLAGS "-py3")
SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES SWIG_DEFINITIONS "-shadow")
ENDIF()
SET(SWIG_MODULE_MEDCoupling_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
+IF(MEDCOUPLING_USE_64BIT_IDS)
+ STRING(APPEND SWIG_MODULE_MEDCoupling_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
+ENDIF(MEDCOUPLING_USE_64BIT_IDS)
SET (MEDCoupling_SWIG_DPYS_FILES
MEDCouplingCommon.i
MEDCouplingMemArray.i
+ DataArrayInt.i
MEDCouplingFieldDiscretization.i
MEDCouplingFinalize.i
MEDCouplingTypemaps.i)
MEDCouplingRemapperCommon.i
MEDCouplingRefCountObject.i
MEDCouplingMemArray.i
+ DataArrayInt.i
MEDCouplingFieldDiscretization.i
MEDCouplingTimeDiscretization.i
MEDCouplingFinalize.i
SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_DEFINITIONS "-shadow")
ENDIF()
SET(SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
+IF(MEDCOUPLING_USE_64BIT_IDS)
+ STRING(APPEND SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
+ENDIF(MEDCOUPLING_USE_64BIT_IDS)
# _ABR_ Ensure dependency mechanism on all SWIG files and headers
SET (SWIG_MODULE_MEDCouplingRemapper_EXTRA_DEPS ${MEDCoupling_SWIG_DPYS_FILES}
--- /dev/null
+// Copyright (C) 2007-2019 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, or (at your option) any later version.
+//
+// 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
+//
+// Author : Anthony Geay (EDF R&D)
+
+%include "MEDCouplingMemArray.i"
+
+%define ARRAYDEF( ARRAY, INT )
+
+// namespace MEDCoupling
+// {
+// class ARRAY ## Iterator;
+
+// class ARRAY : public DataArray -- #ifdef doesn't work inside
+// {
+ public:
+ static ARRAY *New();
+ INT intValue() const;
+ INT getHashCode() const;
+ bool empty() const;
+ void aggregate(const ARRAY *other);
+ ARRAY *performCopyOrIncrRef(bool deepCopy) const;
+ void deepCopyFrom(const ARRAY& other);
+ void reserve(std::size_t nbOfElems);
+ void pushBackSilent(INT val);
+ INT popBackSilent();
+ void pack() const;
+ void allocIfNecessary(INT nbOfTuple, INT nbOfCompo);
+ bool isEqual(const ARRAY& other) const;
+ bool isEqualWithoutConsideringStr(const ARRAY& other) const;
+ bool isEqualWithoutConsideringStrAndOrder(const ARRAY& other) const;
+ DataArrayIdType *buildPermutationArr(const ARRAY& other) const;
+ ARRAY *sumPerTuple() const;
+ void sort(bool asc=true);
+ void reverse();
+ void checkMonotonic(bool increasing) const;
+ bool isMonotonic(bool increasing) const;
+ void checkStrictlyMonotonic(bool increasing) const;
+ bool isStrictlyMonotonic(bool increasing) const;
+ void fillWithZero();
+ void fillWithValue(INT val);
+ void iota(INT init=0);
+ std::string repr() const;
+ std::string reprZip() const;
+ std::string reprNotTooLong() const;
+ ARRAY *invertArrayO2N2N2O(mcIdType newNbOfElem) const;
+ ARRAY *invertArrayN2O2O2N(mcIdType oldNbOfElem) const;
+ ARRAY *invertArrayO2N2N2OBis(mcIdType newNbOfElem) const;
+ DataArrayIdType *indicesOfSubPart(const ARRAY& partOfThis) const;
+ ARRAY *fromNoInterlace() const;
+ ARRAY *toNoInterlace() const;
+ ARRAY *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end, mcIdType step) const;
+ DataArrayIdType *checkAndPreparePermutation() const;
+ DataArrayIdType *buildPermArrPerLevel() const;
+ bool isIota(mcIdType sizeExpected) const;
+ bool isUniform(INT val) const;
+ INT checkUniformAndGuess() const;
+ bool hasUniqueValues() const;
+ ARRAY *subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd=-1) const;
+ void transpose();
+ ARRAY *changeNbOfComponents(std::size_t newNbOfComp, INT dftValue) const;
+ void meldWith(const ARRAY *other);
+ void setPartOfValues1(const ARRAY *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true);
+ void setPartOfValuesSimple1(INT a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp);
+ void setPartOfValuesAdv(const ARRAY *a, const DataArrayIdType *tuplesSelec);
+ void getTuple(mcIdType tupleId, INT *res) const;
+ INT getIJ(std::size_t tupleId, std::size_t compoId) const;
+ INT getIJSafe(std::size_t tupleId, std::size_t compoId) const;
+ INT front() const;
+ INT back() const;
+ void setIJ(mcIdType tupleId, mcIdType compoId, INT newVal);
+ void setIJSilent(mcIdType tupleId, mcIdType compoId, INT newVal);
+ INT *getPointer();
+ const INT *getConstPointer() const;
+ ARRAY ## Iterator *iterator();
+ const INT *begin() const;
+ const INT *end() const;
+ DataArrayIdType *findIdsEqual(INT val) const;
+ DataArrayIdType *findIdsNotEqual(INT val) const;
+ mcIdType changeValue(INT oldValue, INT newValue);
+ mcIdType findIdFirstEqualTuple(const std::vector<INT>& tupl) const;
+ mcIdType findIdFirstEqual(INT value) const;
+ mcIdType findIdFirstEqual(const std::vector<INT>& vals) const;
+ mcIdType findIdSequence(const std::vector<INT>& vals) const;
+ bool presenceOfTuple(const std::vector<INT>& tupl) const;
+ bool presenceOfValue(INT value) const;
+ bool presenceOfValue(const std::vector<INT>& vals) const;
+ INT count(INT value) const;
+ INT accumulate(INT compId) const;
+ INT getMaxValueInArray() const;
+ INT getMaxAbsValueInArray() const;
+ INT getMinValueInArray() const;
+ void abs();
+ ARRAY *computeAbs() const;
+ void applyLin(INT a, INT b, INT compoId);
+ void applyLin(INT a, INT b);
+ void applyInv(INT numerator);
+ ARRAY *negate() const;
+ void applyDivideBy(INT val);
+ void applyModulus(INT val);
+ void applyRModulus(INT val);
+ void applyPow(INT val);
+ void applyRPow(INT val);
+ ARRAY *findIdsInRange(INT vmin, INT vmax) const;
+ ARRAY *findIdsNotInRange(INT vmin, INT vmax) const;
+ ARRAY *findIdsStrictlyNegative() const;
+ bool checkAllIdsInRange(INT vmin, INT vmax) const;
+ static ARRAY *Aggregate(const ARRAY *a1, const ARRAY *a2, INT offsetA2);
+ static ARRAY *Meld(const ARRAY *a1, const ARRAY *a2);
+ static DataArrayIdType *MakePartition(const std::vector<const ARRAY *>& groups, mcIdType newNb, std::vector< std::vector<mcIdType> >& fidsOfGroups);
+ static ARRAY *BuildUnion(const std::vector<const ARRAY *>& arr);
+ static ARRAY *BuildIntersection(const std::vector<const ARRAY *>& arr);
+ static DataArrayIdType *FindPermutationFromFirstToSecond(const ARRAY *ids1, const ARRAY *ids2);
+ DataArrayIdType *buildComplement(mcIdType nbOfElement) const;
+ ARRAY *buildSubstraction(const ARRAY *other) const;
+ ARRAY *buildSubstractionOptimized(const ARRAY *other) const;
+ ARRAY *buildUnion(const ARRAY *other) const;
+ ARRAY *buildIntersection(const ARRAY *other) const;
+ ARRAY *buildUnique() const;
+ ARRAY *buildUniqueNotSorted() const;
+ ARRAY *deltaShiftIndex() const;
+ void computeOffsets();
+ void computeOffsetsFull();
+ ARRAY *buildExplicitArrByRanges(const ARRAY *offsets) const;
+ DataArrayIdType *findRangeIdForEachTuple(const ARRAY *ranges) const;
+ ARRAY *findIdInRangeForEachTuple(const ARRAY *ranges) const;
+ void sortEachPairToMakeALinkedList();
+ ARRAY *duplicateEachTupleNTimes(mcIdType nbTimes) const;
+ ARRAY *getDifferentValues() const;
+ static ARRAY *Add(const ARRAY *a1, const ARRAY *a2);
+ void addEqual(const ARRAY *other);
+ static ARRAY *Substract(const ARRAY *a1, const ARRAY *a2);
+ void substractEqual(const ARRAY *other);
+ static ARRAY *Multiply(const ARRAY *a1, const ARRAY *a2);
+ void multiplyEqual(const ARRAY *other);
+ static ARRAY *Divide(const ARRAY *a1, const ARRAY *a2);
+ void divideEqual(const ARRAY *other);
+ static ARRAY *Modulus(const ARRAY *a1, const ARRAY *a2);
+ void modulusEqual(const ARRAY *other);
+ static ARRAY *Pow(const ARRAY *a1, const ARRAY *a2);
+ void powEqual(const ARRAY *other);
+ MCAuto<ARRAY> fromLinkedListOfPairToList() const;
+ MCAuto<DataArrayIdType> findIdsGreaterOrEqualTo(INT val) const;
+ MCAuto<DataArrayIdType> findIdsGreaterThan(INT val) const;
+ MCAuto<DataArrayIdType> findIdsLowerOrEqualTo(INT val) const;
+ MCAuto<DataArrayIdType> findIdsLowerThan(INT val) const;
+ MCAuto<ARRAY> selectPartDef(const PartDefinition* pd) const;
+ MCAuto<DataArrayDouble> convertToDblArr() const;
+ MCAuto<DataArrayFloat> convertToFloatArr() const;
+ public:
+ static ARRAY *Range(INT begin, INT end, INT step);
+ %extend
+ {
+ ARRAY()
+ {
+ return ARRAY::New();
+ }
+
+ static ARRAY *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
+ {
+ const char *msgBase="MEDCoupling::ARRAY::New : Available API are : \n-ARRAY.New()\n-ARRAY.New([1,3,4])\n-ARRAY.New([1,3,4],3)\n-ARRAY.New([1,3,4,5],2,2)\n-ARRAY.New([1,3,4,5,7,8],3,2)\n-ARRAY.New([(1,3),(4,5),(7,8)])\n-ARRAY.New(5)\n-ARRAY.New(5,2)";
+ std::string msg(msgBase);
+ if ( MEDCouplingHasNumPyBindings() )
+ msg+="\n-ARRAY.New(numpy array with dtype=int32)";
+
+ msg+=" !";
+ if(PyList_Check(elt0) || PyTuple_Check(elt0))
+ {
+ if(nbOfTuples)
+ {
+ if(PyInt_Check(nbOfTuples))
+ {
+ mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples));
+ if(nbOfTuples1<0)
+ throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive set of allocated memory !");
+ if(nbOfComp)
+ {
+ if(PyInt_Check(nbOfComp))
+ {//ARRAY.New([1,3,4,5],2,2)
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp));
+ if(nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive number of components !");
+ MCAuto<ARRAY> ret=ARRAY::New();
+ std::vector<INT> tmp=fillArrayWithPyListInt2<INT>(elt0,nbOfTuples1,nbOfCompo);
+ ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+ return ret.retn();
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg.c_str());
+ }
+ else
+ {//ARRAY.New([1,3,4],3)
+ MCAuto<ARRAY> ret=ARRAY::New();
+ mcIdType tmpp1=-1;
+ std::vector<INT> tmp=fillArrayWithPyListInt2<INT>(elt0,nbOfTuples1,tmpp1);
+ ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+ return ret.retn();
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg.c_str());
+ }
+ else
+ {// ARRAY.New([1,3,4])
+ MCAuto<ARRAY> ret=ARRAY::New();
+ mcIdType tmpp1=-1,tmpp2=-1;
+ std::vector<INT> tmp=fillArrayWithPyListInt2<INT>(elt0,tmpp1,tmpp2);
+ ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+ return ret.retn();
+ }
+ }
+ else if(PyInt_Check(elt0))
+ {
+ INT nbOfTuples1=(INT)PyInt_AS_LONG(elt0);
+ if(nbOfTuples1<0)
+ throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive set of allocated memory !");
+ if(nbOfTuples)
+ {
+ if(!nbOfComp)
+ {
+ if(PyInt_Check(nbOfTuples))
+ {//ARRAY.New(5,2)
+ INT nbOfCompo=(INT)PyInt_AS_LONG(nbOfTuples);
+ if(nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive number of components !");
+ MCAuto<ARRAY> ret=ARRAY::New();
+ ret->alloc(nbOfTuples1,nbOfCompo);
+ return ret.retn();
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg.c_str());
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg.c_str());
+ }
+ else
+ {//ARRAY.New(5)
+ MCAuto<ARRAY> ret=ARRAY::New();
+ ret->alloc(nbOfTuples1,1);
+ return ret.retn();
+ }
+ }
+ else if(MEDCouplingHasNumPyBindings() && PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
+ {//ARRAY.New(numpyArray)
+ return BuildNewInstance<ARRAY,INT>(elt0,NPYTraits<INT>::NPYObjectType,NPYTraits<INT>::NPYFunc,MEDCoupling::Traits<INT>::NPYStr);
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg.c_str());
+ throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
+ }
+
+ ARRAY(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
+ {
+ return MEDCoupling_ ## ARRAY ## _New__SWIG_1(elt0,nbOfTuples,nbOfComp);
+ }
+
+ std::string __str__() const
+ {
+ return self->reprNotTooLong();
+ }
+
+ mcIdType __len__() const
+ {
+ if(self->isAllocated())
+ {
+ return self->getNumberOfTuples();
+ }
+ else
+ {
+ throw INTERP_KERNEL::Exception("ARRAY::__len__ : Instance is NOT allocated !");
+ }
+ }
+
+ INT __int__() const
+ {
+ return self->intValue();
+ }
+
+ ARRAY ## Iterator *__iter__()
+ {
+ return self->iterator();
+ }
+
+ PyObject *accumulate() const
+ {
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
+ INTERP_KERNEL::AutoPtr<INT> tmp=new INT[sz];
+ self->accumulate((INT *)tmp);
+ return convertIntArrToPyList((const INT *)tmp,sz);
+ }
+
+ ARRAY *accumulatePerChunck(PyObject *indexArr) const
+ {
+ mcIdType sw,sz,val;
+ std::vector<mcIdType> val2;
+ const mcIdType *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
+ return self->accumulatePerChunck(bg,bg+sz);
+ }
+
+ DataArrayIdType *findIdsEqualTuple(PyObject *inputTuple) const
+ {
+ mcIdType sw,sz;
+ INT val;
+ std::vector<INT> val2;
+ const INT *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
+ return self->findIdsEqualTuple(bg,bg+sz);
+ }
+
+ DataArrayIdType *findIdForEach(PyObject *vals) const
+ {
+ mcIdType sw,sz;
+ INT val;
+ std::vector<INT> val2;
+ const INT *bg(convertIntStarLikePyObjToCppIntStar(vals,sw,sz,val,val2));
+ MCAuto<DataArrayIdType> ret(self->findIdForEach(bg,bg+sz));
+ return ret.retn();
+ }
+
+ PyObject *splitInBalancedSlices(mcIdType nbOfSlices) const
+ {
+ std::vector< std::pair<mcIdType,mcIdType> > slcs(self->splitInBalancedSlices(nbOfSlices));
+ PyObject *ret=PyList_New(slcs.size());
+ for(std::size_t i=0;i<slcs.size();i++)
+ PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
+ return ret;
+ }
+
+ ARRAY *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const
+ {
+ if(!PySlice_Check(slic))
+ throw INTERP_KERNEL::Exception("ARRAY::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
+ Py_ssize_t strt=2,stp=2,step=2;
+ GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"ARRAY::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
+ if(strt==std::numeric_limits<INT>::max() || stp==std::numeric_limits<INT>::max())
+ throw INTERP_KERNEL::Exception("ARRAY::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
+ return self->buildExplicitArrOfSliceOnScaledArr((INT)strt,(INT)stp,(INT)step);
+ }
+
+ PyObject *getMinMaxValues() const
+ {
+ INT a,b;
+ self->getMinMaxValues(a,b);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyInt_FromLong(a));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(b));
+ return ret;
+ }
+
+ static PyObject *ConvertIndexArrayToO2N(mcIdType nbOfOldTuples, PyObject *arr, PyObject *arrI)
+ {
+ mcIdType newNbOfTuples=-1;
+ mcIdType szArr,szArrI,sw,iTypppArr,iTypppArrI;
+ std::vector<mcIdType> stdvecTyyppArr;
+ std::vector<mcIdType> stdvecTyyppArrI;
+ const mcIdType *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const mcIdType *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
+ DataArrayIdType *ret0=MEDCoupling::ARRAY::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
+ return ret;
+ }
+
+ static DataArrayIdType *CheckAndPreparePermutation(PyObject *arr)
+ {
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
+ mcIdType szArr,sw;
+ INT iTypppArr;
+ std::vector<INT> stdvecTyyppArr;
+ const INT *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
+ mcIdType *pt(MEDCoupling::ARRAY::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
+ ret->useArray(pt,true,MEDCoupling::DeallocType::C_DEALLOC,szArr,1);
+ return ret.retn();
+ }
+
+ void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
+ {
+ const char *msg="MEDCoupling::ARRAY::setValues : Available API are : \n-ARRAY.setValues([1,3,4])\n-ARRAY.setValues([1,3,4],3)\n-ARRAY.setValues([1,3,4,5],2,2)\n-ARRAY.New(5)\n !";
+ if(PyList_Check(li) || PyTuple_Check(li))
+ {
+ if(nbOfTuples && nbOfTuples != Py_None)
+ {
+ if(PyInt_Check(nbOfTuples))
+ {
+ mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples));
+ if(nbOfTuples1<0)
+ throw INTERP_KERNEL::Exception("ARRAY::setValue : should be a positive set of allocated memory !");
+ if(nbOfComp && nbOfComp != Py_None)
+ {
+ if(PyInt_Check(nbOfComp))
+ {//ARRAY.setValues([1,3,4,5],2,2)
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp));
+ if(nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("ARRAY::setValue : should be a positive number of components !");
+ std::vector<INT> tmp=fillArrayWithPyListInt2<INT>(li,nbOfTuples1,nbOfCompo);
+ self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {//ARRAY.setValues([1,3,4],3)
+ mcIdType tmpp1=-1;
+ std::vector<INT> tmp=fillArrayWithPyListInt2<INT>(li,nbOfTuples1,tmpp1);
+ self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {// ARRAY.setValues([1,3,4])
+ mcIdType tmpp1=-1,tmpp2=-1;
+ std::vector<INT> tmp=fillArrayWithPyListInt2<INT>(li,tmpp1,tmpp2);
+ self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+
+ PyObject *getValues() const
+ {
+ const INT *vals=self->getConstPointer();
+ return convertIntArrToPyList(vals,self->getNbOfElems());
+ }
+
+ PyObject *isEqualIfNotWhy(const ARRAY& other) const
+ {
+ std::string ret1;
+ bool ret0=self->isEqualIfNotWhy(other,ret1);
+ PyObject *ret=PyTuple_New(2);
+ PyObject *ret0Py=ret0?Py_True:Py_False;
+ Py_XINCREF(ret0Py);
+ PyTuple_SetItem(ret,0,ret0Py);
+ PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
+ return ret;
+ }
+
+ PyObject *getValuesAsTuple() const
+ {
+ const INT *vals=self->getConstPointer();
+ mcIdType nbOfComp=ToIdType(self->getNumberOfComponents());
+ mcIdType nbOfTuples=self->getNumberOfTuples();
+ return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
+ }
+
+ static PyObject *MakePartition(PyObject *gps, mcIdType newNb)
+ {
+ std::vector<const ARRAY *> groups;
+ std::vector< std::vector<mcIdType> > fidsOfGroups;
+ convertFromPyObjVectorOfObj(gps,SWIGTITraits<INT>::TI,"ARRAY",groups);
+ DataArrayIdType *ret0=MEDCoupling::ARRAY::MakePartition(groups,newNb,fidsOfGroups);
+ PyObject *ret = PyList_New(2);
+ PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ std::size_t sz=fidsOfGroups.size();
+ PyObject *ret1 = PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
+ PyList_SetItem(ret,1,ret1);
+ return ret;
+ }
+
+ DataArrayIdType *findIdsEqualList(PyObject *obj)
+ {
+ mcIdType sw;
+ INT singleVal;
+ std::vector<INT> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ ARRAY *daIntTyypp=0;
+ convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
+ switch(sw)
+ {
+ case 1:
+ return self->findIdsEqualList(&singleVal,&singleVal+1);
+ case 2:
+ return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
+ case 4:
+ return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
+ default:
+ throw INTERP_KERNEL::Exception("ARRAY::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or ARRAY !");
+ }
+ }
+
+ DataArrayIdType *findIdsNotEqualList(PyObject *obj)
+ {
+ mcIdType sw;
+ INT singleVal;
+ std::vector<INT> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ ARRAY *daIntTyypp=0;
+ convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
+ switch(sw)
+ {
+ case 1:
+ return self->findIdsNotEqualList(&singleVal,&singleVal+1);
+ case 2:
+ return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
+ case 4:
+ return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
+ default:
+ throw INTERP_KERNEL::Exception("ARRAY::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or ARRAY !");
+ }
+ }
+
+ PyObject *splitByValueRange(PyObject *li) const
+ {
+ ARRAY *ret0=0,*ret1=0,*ret2=0;
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<INT>::TI, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<INT> tmp=convertPyToNewIntArr2<INT>(li,&size);
+ self->splitByValueRange(tmp,(INT *)tmp+size,ret0,ret1,ret2);
+ }
+ else
+ {
+ ARRAY *da2=reinterpret_cast< ARRAY * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null ARRAY instance expected !");
+ da2->checkAllocated();
+ self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
+ }
+ PyObject *ret = PyList_New(3);
+ PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ DataArrayIdType *transformWithIndArrR(PyObject *li) const
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<INT>::TI, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<INT> tmp=convertPyToNewIntArr2<INT>(li,&size);
+ return self->transformWithIndArrR(tmp,tmp+size);
+ }
+ else
+ {
+ ARRAY *da2=reinterpret_cast< ARRAY * >(da);
+ return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
+ }
+ }
+
+ ARRAY *renumberAndReduce(PyObject *li, mcIdType newNbOfTuple)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberAndReduce(tmp,newNbOfTuple);
+ }
+ else
+ {
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ mcIdType size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
+ }
+ }
+
+ ARRAY *renumber(PyObject *li)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumber(tmp);
+ }
+ else
+ {
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ mcIdType size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumber(da2->getConstPointer());
+ }
+ }
+
+ ARRAY *renumberR(PyObject *li)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberR(tmp);
+ }
+ else
+ {
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ mcIdType size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberR(da2->getConstPointer());
+ }
+ }
+
+ void setSelectedComponents(const ARRAY *a, PyObject *li)
+ {
+ std::vector<std::size_t> tmp;
+ convertPyToNewIntArr3(li,tmp);
+ self->setSelectedComponents(a,tmp);
+ }
+
+ PyObject *explodeComponents() const
+ {
+ std::vector< MCAuto<ARRAY> > retCpp(self->explodeComponents());
+ std::size_t sz(retCpp.size());
+ PyObject *res(PyList_New(sz));
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ return res;
+ }
+
+ PyObject *getTuple(mcIdType tupleId)
+ {
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
+ INTERP_KERNEL::AutoPtr<INT> tmp=new INT[sz];
+ self->getTuple(tupleId,tmp);
+ return convertIntArrToPyList((const INT*)tmp,sz);
+ }
+
+ PyObject *changeSurjectiveFormat(INT targetNb) const
+ {
+ DataArrayIdType *arr=0;
+ DataArrayIdType *arrI=0;
+ self->changeSurjectiveFormat(targetNb,arr,arrI);
+ PyObject *res = PyList_New(2);
+ PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
+ PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
+ return res;
+ }
+
+ static ARRAY *Meld(PyObject *li)
+ {
+ std::vector<const ARRAY *> tmp;
+ convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
+ return ARRAY::Meld(tmp);
+ }
+
+ static ARRAY *Aggregate(PyObject *li)
+ {
+ std::vector<const ARRAY *> tmp;
+ convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
+ return ARRAY::Aggregate(tmp);
+ }
+
+ static ARRAY *AggregateIndexes(PyObject *li)
+ {
+ std::vector<const ARRAY *> tmp;
+ convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
+ return ARRAY::AggregateIndexes(tmp);
+ }
+
+ static ARRAY *BuildUnion(PyObject *li)
+ {
+ std::vector<const ARRAY *> tmp;
+ convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
+ return ARRAY::BuildUnion(tmp);
+ }
+
+ static ARRAY *BuildIntersection(PyObject *li)
+ {
+ std::vector<const ARRAY *> tmp;
+ convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
+ return ARRAY::BuildIntersection(tmp);
+ }
+
+ PyObject *getMaxValue() const
+ {
+ mcIdType tmp;
+ INT r1=self->getMaxValue(tmp);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
+ return ret;
+ }
+
+ PyObject *getMaxAbsValue(std::size_t& tupleId) const
+ {
+ std::size_t tmp;
+ INT r1=self->getMaxAbsValue(tmp);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
+ return ret;
+ }
+
+ PyObject *getMinValue() const
+ {
+ mcIdType tmp;
+ INT r1=self->getMinValue(tmp);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
+ return ret;
+ }
+
+ mcIdType index(PyObject *obj) const
+ {
+ std::size_t nbOfCompo=self->getNumberOfComponents();
+ switch(nbOfCompo)
+ {
+ case 1:
+ {
+ if(PyInt_Check(obj))
+ {
+ INT val=(INT)PyInt_AS_LONG(obj);
+ return self->findIdFirstEqual(val);
+ }
+ else
+ throw INTERP_KERNEL::Exception("ARRAY::index : 'this' contains one component and trying to find an element which is not an integer !");
+ }
+ default:
+ {
+ std::vector<INT> arr;
+ convertPyToNewIntArr3(obj,arr);
+ return self->findIdFirstEqualTuple(arr);
+ }
+ }
+ }
+
+ bool __contains__(PyObject *obj) const
+ {
+ std::size_t nbOfCompo=self->getNumberOfComponents();
+ switch(nbOfCompo)
+ {
+ case 0:
+ return false;
+ case 1:
+ {
+ if(PyInt_Check(obj))
+ {
+ INT val=(INT)PyInt_AS_LONG(obj);
+ return self->presenceOfValue(val);
+ }
+ else
+ throw INTERP_KERNEL::Exception("ARRAY::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
+ }
+ default:
+ {
+ std::vector<INT> arr;
+ convertPyToNewIntArr3(obj,arr);
+ return self->presenceOfTuple(arr);
+ }
+ }
+ }
+
+ PyObject *__getitem__(PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in ARRAY::__getitem__ !";
+ const char msg2[]="ARRAY::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
+ self->checkAllocated();
+ mcIdType nbOfTuples=self->getNumberOfTuples();
+ std::size_t nbOfComponents=self->getNumberOfComponents();
+ mcIdType it1;
+ std::size_t ic1;
+ std::vector<mcIdType> vt1;
+ std::vector<std::size_t> vc1;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > pt1,pc1;
+ DataArrayIdType *dt1=0,*dc1=0;
+ mcIdType sw;
+ convertObjToPossibleCpp3(obj,nbOfTuples,(int)nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
+ MCAuto<ARRAY> ret;
+ switch(sw)
+ {
+ case 1:
+ {
+ if(nbOfComponents==1)
+ return PyInt_FromLong(self->getIJSafe(it1,0));
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ }
+ case 2:
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ case 3:
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ case 4:
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ case 5:
+ return PyInt_FromLong(self->getIJSafe(it1,ic1));
+ case 6:
+ {
+ ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
+ std::vector<std::size_t> v2(1,ic1);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ }
+ case 7:
+ {
+ ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
+ std::vector<std::size_t> v2(1,ic1);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ }
+ case 8:
+ {
+ ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
+ std::vector<std::size_t> v2(1,ic1);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ }
+ case 9:
+ {
+ ret=self->selectByTupleIdSafe(&it1,&it1+1);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ }
+ case 10:
+ {
+ ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ }
+ case 11:
+ {
+ ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ }
+ case 12:
+ {
+ ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ }
+ case 13:
+ {
+ ret=self->selectByTupleIdSafe(&it1,&it1+1);
+ mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
+ std::vector<std::size_t> v2(nbOfComp);
+ for(INT i=0;i<nbOfComp;i++)
+ v2[i]=pc1.first+i*pc1.second.second;
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ }
+ case 14:
+ {
+ ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
+ mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
+ std::vector<std::size_t> v2(nbOfComp);
+ for(INT i=0;i<nbOfComp;i++)
+ v2[i]=pc1.first+i*pc1.second.second;
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ }
+ case 15:
+ {
+ ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
+ mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
+ std::vector<std::size_t> v2(nbOfComp);
+ for(mcIdType i=0;i<nbOfComp;i++)
+ v2[i]=pc1.first+i*pc1.second.second;
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ }
+ case 16:
+ {
+ ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
+ mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
+ std::vector<std::size_t> v2(nbOfComp);
+ for(INT i=0;i<nbOfComp;i++)
+ v2[i]=pc1.first+i*pc1.second.second;
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ ARRAY *__setitem__(PyObject *obj, PyObject *value)
+ {
+ self->checkAllocated();
+ const char msg[]="Unexpected situation in __setitem__ !";
+ mcIdType nbOfTuples=self->getNumberOfTuples();
+ int nbOfComponents=(int)self->getNumberOfComponents();
+ mcIdType sw1,sw2;
+ INT i1;
+ std::vector<INT> v1;
+ ARRAY *d1=0;
+ ARRAY ## Tuple *dd1=0;
+ convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
+ mcIdType it1,ic1;
+ std::vector<mcIdType> vt1,vc1;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > pt1,pc1;
+ DataArrayIdType *dt1=0,*dc1=0;
+ convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
+ MCAuto<ARRAY> tmp;
+ switch(sw2)
+ {
+ case 1:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
+ return self;
+ case 3:
+ self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 2:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
+ return self;
+ case 3:
+ self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 3:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
+ return self;
+ case 3:
+ self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 4:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
+ return self;
+ case 3:
+ self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 5:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
+ return self;
+ case 3:
+ self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 6:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
+ return self;
+ case 3:
+ self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 7:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
+ return self;
+ case 3:
+ self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 8:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
+ return self;
+ case 3:
+ self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 9:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
+ return self;
+ case 3:
+ self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 10:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
+ return self;
+ case 3:
+ self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 11:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
+ return self;
+ case 3:
+ self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 12:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
+ return self;
+ case 3:
+ self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 13:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
+ return self;
+ case 3:
+ self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 14:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
+ return self;
+ case 3:
+ self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 15:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
+ return self;
+ case 3:
+ self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ case 16:
+ {
+ switch(sw1)
+ {
+ case 1:
+ self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
+ return self;
+ case 2:
+ tmp=ARRAY::New();
+ tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
+ self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
+ return self;
+ case 3:
+ self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
+ return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
+ return self;
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ break;
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ return self;
+ }
+
+ ARRAY *__neg__() const
+ {
+ return self->negate();
+ }
+
+ ARRAY *__add__(PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __add__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ MCAuto<ARRAY> ret=self->deepCopy();
+ ret->applyLin(1,val);
+ return ret.retn();
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ return ARRAY::Add(self,aaaa);
+ }
+ case 3:
+ {
+ return ARRAY::Add(self,a);
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return ARRAY::Add(self,aaaa);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ ARRAY *__radd__(PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __radd__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ MCAuto<ARRAY> ret=self->deepCopy();
+ ret->applyLin(1,val);
+ return ret.retn();
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ return ARRAY::Add(self,aaaa);
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return ARRAY::Add(self,aaaa);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __iadd__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ self->applyLin(1,val);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> bb=ARRAY::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ self->addEqual(bb);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 3:
+ {
+ self->addEqual(a);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ self->addEqual(aaaa);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ ARRAY *__sub__(PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __sub__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ MCAuto<ARRAY> ret=self->deepCopy();
+ ret->applyLin(1,-val);
+ return ret.retn();
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ return ARRAY::Substract(self,aaaa);
+ }
+ case 3:
+ {
+ return ARRAY::Substract(self,a);
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return ARRAY::Substract(self,aaaa);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ ARRAY *__rsub__(PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __rsub__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ MCAuto<ARRAY> ret=self->deepCopy();
+ ret->applyLin(-1,val);
+ return ret.retn();
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ return ARRAY::Substract(aaaa,self);
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return ARRAY::Substract(aaaa,self);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __isub__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ self->applyLin(1,-val);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> bb=ARRAY::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ self->substractEqual(bb);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 3:
+ {
+ self->substractEqual(a);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ self->substractEqual(aaaa);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ ARRAY *__mul__(PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __mul__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ MCAuto<ARRAY> ret=self->deepCopy();
+ ret->applyLin(val,0);
+ return ret.retn();
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ return ARRAY::Multiply(self,aaaa);
+ }
+ case 3:
+ {
+ return ARRAY::Multiply(self,a);
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return ARRAY::Multiply(self,aaaa);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ ARRAY *__rmul__(PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __rmul__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ MCAuto<ARRAY> ret=self->deepCopy();
+ ret->applyLin(val,0);
+ return ret.retn();
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ return ARRAY::Multiply(self,aaaa);
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return ARRAY::Multiply(self,aaaa);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __imul__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ self->applyLin(val,0);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> bb=ARRAY::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ self->multiplyEqual(bb);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 3:
+ {
+ self->multiplyEqual(a);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ self->multiplyEqual(aaaa);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ ARRAY *__div__(PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __div__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ MCAuto<ARRAY> ret=self->deepCopy();
+ ret->applyDivideBy(val);
+ return ret.retn();
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ return ARRAY::Divide(self,aaaa);
+ }
+ case 3:
+ {
+ return ARRAY::Divide(self,a);
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return ARRAY::Divide(self,aaaa);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ ARRAY *__rdiv__(PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __rdiv__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ MCAuto<ARRAY> ret=self->deepCopy();
+ ret->applyInv(val);
+ return ret.retn();
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ return ARRAY::Divide(aaaa,self);
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return ARRAY::Divide(aaaa,self);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __idiv__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ self->applyDivideBy(val);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> bb=ARRAY::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ self->divideEqual(bb);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 3:
+ {
+ self->divideEqual(a);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ self->divideEqual(aaaa);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ ARRAY *__mod__(PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __mod__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ MCAuto<ARRAY> ret=self->deepCopy();
+ ret->applyModulus(val);
+ return ret.retn();
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ return ARRAY::Modulus(self,aaaa);
+ }
+ case 3:
+ {
+ return ARRAY::Modulus(self,a);
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return ARRAY::Modulus(self,aaaa);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ ARRAY *__rmod__(PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __rmod__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ MCAuto<ARRAY> ret=self->deepCopy();
+ ret->applyRModulus(val);
+ return ret.retn();
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ return ARRAY::Modulus(aaaa,self);
+ }
+ case 3:
+ {
+ return ARRAY::Modulus(a,self);
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return ARRAY::Modulus(aaaa,self);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ PyObject *___imod___(PyObject *trueSelf, PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __imod__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ self->applyModulus(val);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 3:
+ {
+ self->modulusEqual(a);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ self->modulusEqual(aaaa);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ ARRAY *__pow__(PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __pow__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ MCAuto<ARRAY> ret=self->deepCopy();
+ ret->applyPow(val);
+ return ret.retn();
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ return ARRAY::Pow(self,aaaa);
+ }
+ case 3:
+ {
+ return ARRAY::Pow(self,a);
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return ARRAY::Pow(self,aaaa);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ ARRAY *__rpow__(PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __rpow__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ MCAuto<ARRAY> ret=self->deepCopy();
+ ret->applyRPow(val);
+ return ret.retn();
+ }
+ case 2:
+ {
+ MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
+ return ARRAY::Pow(aaaa,self);
+ }
+ case 3:
+ {
+ return ARRAY::Pow(a,self);
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return ARRAY::Pow(aaaa,self);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
+ {
+ const char msg[]="Unexpected situation in __ipow__ !";
+ INT val;
+ ARRAY *a;
+ std::vector<INT> aa;
+ ARRAY ## Tuple *aaa;
+ mcIdType sw;
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ self->applyPow(val);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 3:
+ {
+ self->powEqual(a);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 4:
+ {
+ MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ self->powEqual(aaaa);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ std::string __repr__() const
+ {
+ std::ostringstream oss;
+ self->reprQuickOverview(oss);
+ return oss.str();
+ }
+
+ void pushBackValsSilent(PyObject *li)
+ {
+ mcIdType szArr,sw;
+ INT iTypppArr;
+ std::vector<INT> stdvecTyyppArr;
+ const INT *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ self->pushBackValsSilent(tmp,tmp+szArr);
+ }
+
+ PyObject *partitionByDifferentValues() const
+ {
+ std::vector<INT> ret1;
+ std::vector<DataArrayIdType *> ret0=self->partitionByDifferentValues(ret1);
+ std::size_t sz=ret0.size();
+ PyObject *pyRet=PyTuple_New(2);
+ PyObject *pyRet0=PyList_New((INT)sz);
+ PyObject *pyRet1=PyList_New((INT)sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
+ }
+ PyTuple_SetItem(pyRet,0,pyRet0);
+ PyTuple_SetItem(pyRet,1,pyRet1);
+ return pyRet;
+ }
+
+ PyObject *findIdsRangesInListOfIds(const ARRAY *listOfIds) const
+ {
+ DataArrayIdType *ret0=0;
+ ARRAY *ret1=0;
+ self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
+ PyObject *pyRet=PyTuple_New(2);
+ PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 ));
+ return pyRet;
+ }
+
+ PyObject *isRange() const
+ {
+ INT a(0),b(0),c(0);
+ bool ret(self->isRange(a,b,c));
+ PyObject *pyRet=PyTuple_New(2);
+ PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
+ Py_XINCREF(ret0Py);
+ PyTuple_SetItem(pyRet,0,ret0Py);
+ if(ret)
+ ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
+ else
+ {
+ ret1Py=Py_None;
+ Py_XINCREF(ret1Py);
+ }
+ PyTuple_SetItem(pyRet,1,ret1Py);
+ return pyRet;
+ }
+
+ static bool RemoveIdsFromIndexedArrays(PyObject *li, ARRAY *arr, DataArrayIdType *arrIndx, mcIdType offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
+ {
+ mcIdType sw;
+ INT singleVal;
+ std::vector<INT> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::ARRAY *daIntTyypp=0;
+ if(!arrIndx)
+ throw INTERP_KERNEL::Exception("ARRAY::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
+ convertIntStarOrSliceLikePyObjToCpp(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
+ switch(sw)
+ {
+ case 1:
+ return ARRAY::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
+ case 2:
+ return ARRAY::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
+ case 4:
+ return ARRAY::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
+ default:
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or ARRAY !");
+ }
+ }
+
+ static PyObject *ExtractFromIndexedArrays(PyObject *li, const ARRAY *arrIn, const DataArrayIdType *arrIndxIn) throw(INTERP_KERNEL::Exception)
+ {
+ ARRAY *arrOut=0;
+ DataArrayIdType *arrIndexOut=0;
+ mcIdType sw;
+ mcIdType singleVal;
+ std::vector<mcIdType> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
+ if(!arrIndxIn)
+ throw INTERP_KERNEL::Exception("ARRAY::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
+ convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
+ switch(sw)
+ {
+ case 1:
+ {
+ ARRAY::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
+ break;
+ }
+ case 2:
+ {
+ ARRAY::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
+ break;
+ }
+ case 4:
+ {
+ ARRAY::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
+ break;
+ }
+ default:
+ throw INTERP_KERNEL::Exception("ARRAY::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or ARRAY !");
+ }
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ static PyObject *ExtractFromIndexedArraysSlice(mcIdType strt, mcIdType stp, mcIdType step, const ARRAY *arrIn, const DataArrayIdType *arrIndxIn) throw(INTERP_KERNEL::Exception)
+ {
+ ARRAY *arrOut=0;
+ DataArrayIdType *arrIndexOut=0;
+ ARRAY::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ static PyObject *ExtractFromIndexedArraysSlice(PyObject *slic, const ARRAY *arrIn, const DataArrayIdType *arrIndxIn) throw(INTERP_KERNEL::Exception)
+ {
+ if(!PySlice_Check(slic))
+ throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : the first param is not a pyslice !");
+ Py_ssize_t strt=2,stp=2,step=2;
+ if(!arrIndxIn)
+ throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : last array is null !");
+ arrIndxIn->checkAllocated();
+ if(arrIndxIn->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : number of components of last argument must be equal to one !");
+ GetIndicesOfSlice(slic,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArraysSlice (wrap) : Invalid slice regarding nb of elements !");
+ ARRAY *arrOut=0;
+ DataArrayIdType *arrIndexOut=0;
+ ARRAY::ExtractFromIndexedArraysSlice(ToIdType(strt),ToIdType(stp),ToIdType(step),arrIn,arrIndxIn,arrOut,arrIndexOut);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ static PyObject *SetPartOfIndexedArrays(PyObject *li,
+ const ARRAY *arrIn, const DataArrayIdType *arrIndxIn,
+ const ARRAY *srcArr, const DataArrayIdType *srcArrIndex) throw(INTERP_KERNEL::Exception)
+ {
+ ARRAY *arrOut=0;
+ DataArrayIdType *arrIndexOut=0;
+ mcIdType sw;
+ mcIdType singleVal;
+ std::vector<mcIdType> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
+ if(!arrIndxIn)
+ throw INTERP_KERNEL::Exception("ARRAY::SetPartOfIndexedArrays : null pointer as arrIndex !");
+ convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
+ switch(sw)
+ {
+ case 1:
+ {
+ ARRAY::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
+ break;
+ }
+ case 2:
+ {
+ ARRAY::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
+ break;
+ }
+ case 4:
+ {
+ ARRAY::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
+ break;
+ }
+ default:
+ throw INTERP_KERNEL::Exception("ARRAY::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or ARRAY !");
+ }
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ static void SetPartOfIndexedArraysSameIdx(PyObject *li, ARRAY *arrIn, const DataArrayIdType *arrIndxIn,
+ const ARRAY *srcArr, const DataArrayIdType *srcArrIndex) throw(INTERP_KERNEL::Exception)
+ {
+ mcIdType sw;
+ mcIdType singleVal;
+ std::vector<mcIdType> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
+ if(!arrIndxIn)
+ throw INTERP_KERNEL::Exception("ARRAY::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
+ convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
+ switch(sw)
+ {
+ case 1:
+ {
+ ARRAY::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
+ break;
+ }
+ case 2:
+ {
+ ARRAY::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
+ break;
+ }
+ case 4:
+ {
+ ARRAY::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
+ break;
+ }
+ default:
+ throw INTERP_KERNEL::Exception("ARRAY::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or ARRAY !");
+ }
+ }
+
+ } // end extent
+ };
+
+ class ARRAY ## Tuple;
+
+ class ARRAY ## Iterator
+ {
+ public:
+ ARRAY ## Iterator(ARRAY *da);
+ ~ARRAY ## Iterator();
+ %extend
+ {
+ PyObject *next()
+ {
+ ARRAY ## Tuple *ret=self->nextt();
+ if(ret)
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__ ## ARRAY ## Tuple,SWIG_POINTER_OWN | 0);
+ else
+ {
+ PyErr_SetString(PyExc_StopIteration,"No more data.");
+ return 0;
+ }
+ }
+ }
+ };
+
+ class ARRAY ## Tuple
+ {
+ public:
+ std::size_t getNumberOfCompo() const;
+ ARRAY *buildDAInt(INT nbOfTuples, INT nbOfCompo) const;
+ %extend
+ {
+ std::string __str__() const
+ {
+ return self->repr();
+ }
+
+ INT __int__() const
+ {
+ return self->intValue();
+ }
+
+ ARRAY *buildDAInt()
+ {
+ return self->buildDAInt(1,self->getNumberOfCompo());
+ }
+
+ PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
+ {
+ MCAuto<ARRAY> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ MEDCoupling_ ## ARRAY ## ____iadd___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+
+ PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
+ {
+ MCAuto<ARRAY> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ MEDCoupling_ ## ARRAY ## ____isub___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+
+ PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
+ {
+ MCAuto<ARRAY> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ MEDCoupling_ ## ARRAY ## ____imul___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
+ {
+ MCAuto<ARRAY> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ MEDCoupling_ ## ARRAY ## ____idiv___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+
+ PyObject *___imod___(PyObject *trueSelf, PyObject *obj)
+ {
+ MCAuto<ARRAY> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ MEDCoupling_ ## ARRAY ## ____imod___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+
+ PyObject *__len__()
+ {
+ return PyInt_FromLong(self->getNumberOfCompo());
+ }
+
+ PyObject *__getitem__(PyObject *obj)
+ {
+ const char msg2[]="ARRAY ## Tuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
+ mcIdType sw;
+ INT singleVal;
+ std::vector<INT> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
+ const INT *pt=self->getConstPointer();
+ INT nbc=(INT)self->getNumberOfCompo();
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,ToIdType(nbc),sw,singleVal,multiVal,slic,daIntTyypp);
+ switch(sw)
+ {
+ case 1:
+ {
+ if(singleVal>=(INT)nbc)
+ {
+ std::ostringstream oss;
+ oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
+ PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
+ return 0;
+ }
+ if(singleVal>=0)
+ return PyInt_FromLong(pt[singleVal]);
+ else
+ {
+ if(nbc+singleVal>0)
+ return PyInt_FromLong(pt[nbc+singleVal]);
+ else
+ {
+ std::ostringstream oss;
+ oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ }
+ case 2:
+ {
+ PyObject *t=PyTuple_New(multiVal.size());
+ for(std::size_t j=0;j<multiVal.size();j++)
+ {
+ INT cid=multiVal[j];
+ if(cid>=(INT)nbc)
+ {
+ std::ostringstream oss;
+ oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
+ }
+ return t;
+ }
+ case 3:
+ {
+ mcIdType sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
+ PyObject *t=PyTuple_New(sz);
+ for(INT j=0;j<sz;j++)
+ PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
+ return t;
+ }
+ default:
+ throw INTERP_KERNEL::Exception("ARRAY ## Tuple::__getitem__ : unrecognized type entered !");
+ }
+ }
+
+ ARRAY ## Tuple *__setitem__(PyObject *obj, PyObject *value)
+ {
+ const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
+ const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
+ mcIdType sw1,sw2;
+ mcIdType singleValV;
+ std::vector<mcIdType> multiValV;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slicV;
+ MEDCoupling::ARRAY ## Tuple *daIntTyyppV=0;
+ mcIdType nbc=ToIdType(self->getNumberOfCompo());
+ convertObjToPossibleCpp22<INT>(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
+ INT singleVal;
+ std::vector<INT> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::ARRAY *daIntTyypp=0;
+ INT *pt=self->getPointer();
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
+ switch(sw2)
+ {
+ case 1:
+ {
+ if(singleVal>=nbc)
+ {
+ std::ostringstream oss;
+ oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ switch(sw1)
+ {
+ case 1:
+ {
+ pt[singleVal]=(INT)singleValV;
+ return self;
+ }
+ case 2:
+ {
+ if(multiValV.size()!=1)
+ {
+ std::ostringstream oss;
+ oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ pt[singleVal]=(INT)multiValV[0];
+ return self;
+ }
+ case 4:
+ {
+ pt[singleVal]=daIntTyyppV->getConstPointer()[0];
+ return self;
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+ case 2:
+ {
+ switch(sw1)
+ {
+ case 1:
+ {
+ for(std::vector<INT>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
+ {
+ if(*it>=nbc)
+ {
+ std::ostringstream oss;
+ oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ pt[*it]=(INT)singleValV;
+ }
+ return self;
+ }
+ case 2:
+ {
+ if(multiVal.size()!=multiValV.size())
+ {
+ std::ostringstream oss;
+ oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ for(INT i=0;i<(INT)multiVal.size();i++)
+ {
+ INT pos=multiVal[i];
+ if(pos>=nbc)
+ {
+ std::ostringstream oss;
+ oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ pt[multiVal[i]]=(INT)multiValV[i];
+ }
+ return self;
+ }
+ case 4:
+ {
+ const INT *ptV=daIntTyyppV->getConstPointer();
+ if(nbc>(INT)daIntTyyppV->getNumberOfCompo())
+ {
+ std::ostringstream oss;
+ oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ std::copy(ptV,ptV+nbc,pt);
+ return self;
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+ case 3:
+ {
+ std::size_t sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
+ switch(sw1)
+ {
+ case 1:
+ {
+ for(std::size_t j=0;j<sz;j++)
+ pt[slic.first+j*slic.second.second]=(INT)singleValV;
+ return self;
+ }
+ case 2:
+ {
+ if(sz!=multiValV.size())
+ {
+ std::ostringstream oss;
+ oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ for(std::size_t j=0;j<sz;j++)
+ pt[slic.first+j*slic.second.second]=(INT)multiValV[j];
+ return self;
+ }
+ case 4:
+ {
+ const INT *ptV=daIntTyyppV->getConstPointer();
+ if(sz>daIntTyyppV->getNumberOfCompo())
+ {
+ std::ostringstream oss;
+ oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ for(std::size_t j=0;j<sz;j++)
+ pt[slic.first+j*slic.second.second]=ptV[j];
+ return self;
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+ }
+// };
+// }
+%enddef
+
+
+%define TRANSFORMWITHINDARR( ARRAY, INT )
+void transformWithIndArr(PyObject *li)
+{
+ void *da=0;
+ int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<INT>::TI, 0 | 0 ));
+ if (!SWIG_IsOK(res1))
+ {
+ int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
+ if(SWIG_IsOK(res2))
+ {
+ MapII *m=reinterpret_cast<MapII *>(da);
+ self->transformWithIndArr(*m);
+ }
+ else
+ {
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<INT> tmp=convertPyToNewIntArr2<INT>(li,&size);
+ self->transformWithIndArr(tmp,tmp+size);
+ }
+ }
+ else
+ {
+ ARRAY *da2=reinterpret_cast< ARRAY * >(da);
+ self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
+ }
+}
+%enddef
+
+namespace MEDCoupling
+{
+ typedef int Int32;
+ typedef long int Int64;
+
+
+ class DataArrayInt32Iterator;
+
+ class DataArrayInt32 : public DataArray
+ {
+ ARRAYDEF( DataArrayInt32, Int32 )
+ };
+ %extend DataArrayInt32 {
+#ifdef WITH_NUMPY
+ PyObject *toNumPyArray() // not const. It is not a bug !
+ {
+ return ToNumPyArray<DataArrayInt32,MEDCoupling::Int32>(self,NPY_INT32,"DataArrayInt32");
+ }
+#endif
+#ifndef MEDCOUPLING_USE_64BIT_IDS
+ MCAuto< MapII > invertArrayN2O2O2NOptimized()
+ {
+ return self->invertArrayN2O2O2NOptimized();
+ }
+ MCAuto< MapII > giveN2OOptimized()
+ {
+ return self->giveN2OOptimized();
+ }
+ TRANSFORMWITHINDARR( DataArrayInt32, Int32 )
+#endif
+ };
+
+ class DataArrayInt64Iterator;
+
+ class DataArrayInt64 : public DataArray
+ {
+ ARRAYDEF( DataArrayInt64, Int64 )
+ };
+ %extend DataArrayInt64 {
+#ifdef WITH_NUMPY
+ PyObject *toNumPyArray() // not const. It is not a bug !
+ {
+ return ToNumPyArray<DataArrayInt64,MEDCoupling::Int64>(self,NPY_INT64,"DataArrayInt64");
+ }
+#endif
+#ifdef MEDCOUPLING_USE_64BIT_IDS
+ MCAuto< MapII > invertArrayN2O2O2NOptimized()
+ {
+ return self->invertArrayN2O2O2NOptimized();
+ }
+ MCAuto< MapII > giveN2OOptimized()
+ {
+ return self->giveN2OOptimized();
+ }
+ TRANSFORMWITHINDARR( DataArrayInt64, Int64 )
+#endif
+ };
+
+}
def MEDCouplingFieldDoubleIpow(self,*args):
import _MEDCoupling
return _MEDCoupling.MEDCouplingFieldDouble____ipow___(self, self, *args)
-def MEDCouplingDataArrayIntIadd(self,*args):
+def MEDCouplingDataArrayInt32Iadd(self,*args):
import _MEDCoupling
- return _MEDCoupling.DataArrayInt____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntIsub(self,*args):
+ return _MEDCoupling.DataArrayInt32____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32Isub(self,*args):
import _MEDCoupling
- return _MEDCoupling.DataArrayInt____isub___(self, self, *args)
-def MEDCouplingDataArrayIntImul(self,*args):
+ return _MEDCoupling.DataArrayInt32____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32Imul(self,*args):
import _MEDCoupling
- return _MEDCoupling.DataArrayInt____imul___(self, self, *args)
-def MEDCouplingDataArrayIntIdiv(self,*args):
+ return _MEDCoupling.DataArrayInt32____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32Idiv(self,*args):
import _MEDCoupling
- return _MEDCoupling.DataArrayInt____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntImod(self,*args):
+ return _MEDCoupling.DataArrayInt32____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32Imod(self,*args):
import _MEDCoupling
- return _MEDCoupling.DataArrayInt____imod___(self, self, *args)
-def MEDCouplingDataArrayIntIpow(self,*args):
+ return _MEDCoupling.DataArrayInt32____imod___(self, self, *args)
+def MEDCouplingDataArrayInt32Ipow(self,*args):
import _MEDCoupling
- return _MEDCoupling.DataArrayInt____ipow___(self, self, *args)
+ return _MEDCoupling.DataArrayInt32____ipow___(self, self, *args)
+def MEDCouplingDataArrayInt64Iadd(self,*args):
+ import _MEDCoupling
+ return _MEDCoupling.DataArrayInt64____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64Isub(self,*args):
+ import _MEDCoupling
+ return _MEDCoupling.DataArrayInt64____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64Imul(self,*args):
+ import _MEDCoupling
+ return _MEDCoupling.DataArrayInt64____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64Idiv(self,*args):
+ import _MEDCoupling
+ return _MEDCoupling.DataArrayInt64____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64Imod(self,*args):
+ import _MEDCoupling
+ return _MEDCoupling.DataArrayInt64____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64Ipow(self,*args):
+ import _MEDCoupling
+ return _MEDCoupling.DataArrayInt64____ipow___(self, self, *args)
def MEDCouplingDataArrayFloatIadd(self,*args):
import _MEDCoupling
return _MEDCoupling.DataArrayFloat____iadd___(self, self, *args)
def MEDCouplingDataArrayDoubleTupleIdiv(self,*args):
import _MEDCoupling
return _MEDCoupling.DataArrayDoubleTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIadd(self,*args):
+def MEDCouplingDataArrayInt32TupleIadd(self,*args):
+ import _MEDCoupling
+ return _MEDCoupling.DataArrayInt32Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIsub(self,*args):
+ import _MEDCoupling
+ return _MEDCoupling.DataArrayInt32Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImul(self,*args):
+ import _MEDCoupling
+ return _MEDCoupling.DataArrayInt32Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIdiv(self,*args):
+ import _MEDCoupling
+ return _MEDCoupling.DataArrayInt32Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImod(self,*args):
+ import _MEDCoupling
+ return _MEDCoupling.DataArrayInt32Tuple____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIadd(self,*args):
import _MEDCoupling
- return _MEDCoupling.DataArrayIntTuple____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIsub(self,*args):
+ return _MEDCoupling.DataArrayInt64Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIsub(self,*args):
import _MEDCoupling
- return _MEDCoupling.DataArrayIntTuple____isub___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImul(self,*args):
+ return _MEDCoupling.DataArrayInt64Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImul(self,*args):
import _MEDCoupling
- return _MEDCoupling.DataArrayIntTuple____imul___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIdiv(self,*args):
+ return _MEDCoupling.DataArrayInt64Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIdiv(self,*args):
import _MEDCoupling
- return _MEDCoupling.DataArrayIntTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImod(self,*args):
+ return _MEDCoupling.DataArrayInt64Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImod(self,*args):
import _MEDCoupling
- return _MEDCoupling.DataArrayIntTuple____imod___(self, self, *args)
+ return _MEDCoupling.DataArrayInt64Tuple____imod___(self, self, *args)
def MEDCouplingDenseMatrixIadd(self,*args):
import _MEDCoupling
return _MEDCoupling.DenseMatrix____iadd___(self, self, *args)
pass
# test of static method DataArrayInt::meld
dai1=da1C.convertToIntArr();
- dai4=DataArrayInt.Meld(dai1,dai3);
- tmp=DataArrayInt.Meld([dai1,dai3]);
+ dai4=DataArrayInt32.Meld(dai1,dai3);
+ tmp=DataArrayInt32.Meld([dai1,dai3]);
self.assertTrue(dai4.isEqual(tmp))
self.assertEqual(5,dai4.getNumberOfComponents());
self.assertEqual(7,dai4.getNumberOfTuples());
self.assertTrue(d.isEqual(d1,1e-12));
#
d2=d.convertToIntArr();
- d4=DataArrayInt.New();
+ d4=DataArrayInt32.New();
self.assertTrue(not d2.isEqual(d4));
d4.deepCopyFrom(d2);
self.assertTrue(d2.isEqual(d4));
@unittest.skipUnless(checkFreeMemory((223456789*16)/(1024)), "Not enough memory")
def testSwig2BigMem(self):
- if MEDCouplingSizeOfVoidStar()==64:
+ if MEDCouplingSizeOfVoidStar()==64 and MEDCouplingSizeOfIDs()==32:
d=DataArrayAsciiChar(223456789,16)
self.assertTrue(d.getNumberOfTuples(),223456789)
self.assertTrue(d.getNumberOfComponents(),16)
m=MEDCoupling1SGTUMesh("m",NORM_QUAD4)
mem_m=m.getHeapMemorySize()
m.allocateCells(5)
- self.assertIn(m.getHeapMemorySize() - mem_m, list(range(5 * 4 * 4, 5 * 4 * 4 + 32)))
+ self.assertIn(m.getHeapMemorySize() - mem_m, list(range(5 * 4 * MEDCouplingSizeOfIDs()//8, 5 * 4 * MEDCouplingSizeOfIDs()//8 + 32)))
self.assertEqual(m.getNodalConnectivity().getNbOfElemAllocated(),20)
m.setCoords(um.getCoords())
m.insertNextCell([1,0,6,7])
self.assertEqual(d.getInfoOnComponents(),["aa","bbb"])
ref=d.getHeapMemorySize()
d.desallocate()
- self.assertEqual(ref-d.getHeapMemorySize(),6*4)
+ self.assertEqual(ref-d.getHeapMemorySize(),6*MEDCouplingSizeOfIDs()//8)
self.assertTrue(not d.isAllocated())
self.assertEqual(d.getInfoOnComponents(),["aa","bbb"])
self.assertRaises(InterpKernelException,d.checkAllocated)
m.setCoords(arrX,arrX)
f=MEDCouplingFieldInt(ON_CELLS)
f.setMesh(m)
- arr=DataArrayInt(8) ; arr.iota() ;f.setArray(arr)
+ arr=DataArrayInt32(8) ; arr.iota() ;f.setArray(arr)
self.assertRaises(InterpKernelException,f.checkConsistencyLight)
- arr=DataArrayInt(9) ; arr.iota() ;f.setArray(arr)
+ arr=DataArrayInt32(9) ; arr.iota() ;f.setArray(arr)
f.checkConsistencyLight()
f.setTimeUnit("ms")
self.assertEqual(f.getTimeUnit(),"ms")
m1=MEDCouplingCMesh() ; m1.setCoords(DataArrayDouble([0,1,2,3]),DataArrayDouble([0,1,2,3,4]))
m1=m1.buildUnstructured() ; m1.setName("mesh")
f1=MEDCouplingFieldInt(ON_CELLS) ; f1.setMesh(m1)
- arr1=DataArrayInt([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr1.setInfoOnComponents(["aa","bbb"])
+ arr1=DataArrayInt32([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr1.setInfoOnComponents(["aa","bbb"])
f1.setArray(arr1) ; f1.setName("f1") ; f1.setTime(2.,3,4)
#
m2=MEDCouplingCMesh() ; m2.setCoords(DataArrayDouble([0,1,2,3]),DataArrayDouble([0,1,2,3,4]))
m2=m2.buildUnstructured() ; m2.setName("mesh")
f2=MEDCouplingFieldInt(ON_CELLS) ; f2.setMesh(m2)
- arr2=DataArrayInt([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr2.setInfoOnComponents(["aa","bbb"])
+ arr2=DataArrayInt32([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr2.setInfoOnComponents(["aa","bbb"])
f2.setArray(arr2) ; f2.setName("f1") ; f2.setTime(2.,3,4)
#
self.assertTrue(f1.isEqual(f2,1e-12,0))
#
for fd,expected in ((ON_NODES,False),(ON_CELLS,True)):
f4=MEDCouplingFieldInt(fd) ; f4.setMesh(m2) ; f4.setTime(2.,3,4)
- arr4=DataArrayInt([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr4.setInfoOnComponents(["aa","bbb"])
+ arr4=DataArrayInt32([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr4.setInfoOnComponents(["aa","bbb"])
f4.setArray(arr4) ; f4.setName("f1")
self.assertEqual(f1.isEqual(f4,1e-12,0),expected)
pass
"""Test focused of new wrapped methods for MEDCouplingFieldInt thanks to code factorization."""
d=DataArrayDouble(7) ; d.iota()
m=MEDCouplingUMesh.Build1DMeshFromCoords(d)
- f=MEDCouplingFieldInt(ON_CELLS) ; f.setMesh(m) ; arr=DataArrayInt(6) ; arr.iota() ; f.setArray(arr) ; f.checkConsistencyLight()
+ f=MEDCouplingFieldInt(ON_CELLS) ; f.setMesh(m) ; arr=DataArrayInt32(6) ; arr.iota() ; f.setArray(arr) ; f.checkConsistencyLight()
f_0=f[::2] # test is here
- self.assertTrue(f_0.getArray().isEqual(DataArrayInt([0,2,4])))
+ self.assertTrue(f_0.getArray().isEqual(DataArrayInt32([0,2,4])))
self.assertTrue(f_0.getMesh().isEqual(m[[0,2,4]],1e-12))
#
- f2=MEDCouplingFieldInt(ON_NODES) ; f2.setMesh(m) ; arr=DataArrayInt(7) ; arr.iota() ; f2.setArray(arr) ; f2.checkConsistencyLight()
+ f2=MEDCouplingFieldInt(ON_NODES) ; f2.setMesh(m) ; arr=DataArrayInt32(7) ; arr.iota() ; f2.setArray(arr) ; f2.checkConsistencyLight()
f_1=f2[::2] # test is here
- self.assertTrue(f_1.getArray().isEqual(DataArrayInt([0,1,2,3,4,5])))
+ self.assertTrue(f_1.getArray().isEqual(DataArrayInt32([0,1,2,3,4,5])))
m_1=m[[0,2,4]] ; m_1.zipCoords()
self.assertTrue(f_1.getMesh().isEqual(m_1,1e-12))
pass
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2019 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, or (at your option) any later version.
+#
+# 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
+#
+
+
+import sys
+if sys.platform == "win32":
+ from MEDCouplingCompat import *
+else:
+ from medcoupling import *
+import unittest
+from math import pi,e,sqrt,cos,sin
+from datetime import datetime
+from MEDCouplingDataForTest import MEDCouplingDataForTest
+import rlcompleter,readline # this line has to be here, to ensure a usability of MEDCoupling/MEDLoader. B4 removing it please notify to anthony.geay@cea.fr
+
+class MEDCouplingBasicsTest7(unittest.TestCase):
+
+ def testDAIGetIdsEqual1(self):
+ tab1=[5,-2,-4,-2,3,2,-2];
+ da=DataArrayInt64.New();
+ da.setValues(tab1,7,1);
+ da2=da.findIdsEqual(-2);
+ self.assertEqual(3,da2.getNumberOfTuples());
+ self.assertEqual(1,da2.getNumberOfComponents());
+ expected1=[1,3,6];
+ self.assertEqual(expected1,da2.getValues());
+ pass
+
+ def testDAIGetIdsEqualList1(self):
+ tab1=[5,-2,-4,-2,3,2,-2];
+ da=DataArrayInt64.New();
+ da.setValues(tab1,7,1);
+ da2=da.findIdsEqualList([3,-2,0]);
+ self.assertEqual(4,da2.getNumberOfTuples());
+ self.assertEqual(1,da2.getNumberOfComponents());
+ expected1=[1,3,4,6];
+ self.assertEqual(expected1,da2.getValues());
+ pass
+
+ def testDAIsUniform1(self):
+ tab1=[1,1,1,1,1]
+ da=DataArrayInt64.New();
+ da.setValues(tab1,5,1);
+ self.assertTrue(da.isUniform(1));
+ da.setIJ(2,0,2);
+ self.assertTrue(not da.isUniform(1));
+ da.setIJ(2,0,1);
+ self.assertTrue(da.isUniform(1));
+ da2=da.convertToDblArr();
+ self.assertTrue(da2.isUniform(1.,1.e-12));
+ da2.setIJ(1,0,1.+1.e-13);
+ self.assertTrue(da2.isUniform(1.,1.e-12));
+ da2.setIJ(1,0,1.+1.e-11);
+ self.assertTrue(not da2.isUniform(1.,1.e-12));
+ pass
+
+ def testDAIBuildComplement1(self):
+ a=DataArrayInt64.New();
+ tab=[3,1,7,8]
+ a.setValues(tab,4,1);
+ b=a.buildComplement(12);
+ self.assertEqual(8,b.getNumberOfTuples());
+ self.assertEqual(1,b.getNumberOfComponents());
+ expected1=[0,2,4,5,6,9,10,11]
+ for i in range(8):
+ self.assertEqual(expected1[i],b.getIJ(0,i));
+ pass
+ pass
+
+ def testDAIBuildUnion1(self):
+ a=DataArrayInt64.New();
+ tab1=[3,1,7,8]
+ a.setValues(tab1,4,1);
+ c=DataArrayInt64.New();
+ tab2=[5,3,0,18,8]
+ c.setValues(tab2,5,1);
+ b=a.buildUnion(c);
+ self.assertEqual(7,b.getNumberOfTuples());
+ self.assertEqual(1,b.getNumberOfComponents());
+ expected1=[0,1,3,5,7,8,18]
+ for i in range(7):
+ self.assertEqual(expected1[i],b.getIJ(0,i));
+ pass
+ b=DataArrayInt64.BuildUnion([a,c]);
+ self.assertEqual(7,b.getNumberOfTuples());
+ self.assertEqual(1,b.getNumberOfComponents());
+ expected1=[0,1,3,5,7,8,18]
+ for i in range(7):
+ self.assertEqual(expected1[i],b.getIJ(0,i));
+ pass
+ pass
+
+ def testDAIBuildIntersection1(self):
+ a=DataArrayInt64.New();
+ tab1=[3,1,7,8]
+ a.setValues(tab1,4,1);
+ c=DataArrayInt64.New();
+ tab2=[5,3,0,18,8]
+ c.setValues(tab2,5,1);
+ b=a.buildIntersection(c);
+ self.assertEqual(2,b.getNumberOfTuples());
+ self.assertEqual(1,b.getNumberOfComponents());
+ expected1=[3,8]
+ for i in range(2):
+ self.assertEqual(expected1[i],b.getIJ(0,i));
+ pass
+ b=DataArrayInt64.BuildIntersection([a,c]);
+ self.assertEqual(2,b.getNumberOfTuples());
+ self.assertEqual(1,b.getNumberOfComponents());
+ expected1=[3,8]
+ for i in range(2):
+ self.assertEqual(expected1[i],b.getIJ(0,i));
+ pass
+ pass
+
+ def testDAIDeltaShiftIndex1(self):
+ a=DataArrayInt64.New();
+ tab=[1,3,6,7,7,9,15]
+ a.setValues(tab,7,1);
+ b=a.deltaShiftIndex();
+ self.assertEqual(6,b.getNumberOfTuples());
+ self.assertEqual(1,b.getNumberOfComponents());
+ expected1=[2,3,1,0,2,6]
+ for i in range(6):
+ self.assertEqual(expected1[i],b.getIJ(0,i));
+ pass
+ pass
+
+ def testDAIBuildSubstraction1(self):
+ a=DataArrayInt64.New()
+ aa=[2,3,6,8,9]
+ a.setValues(aa,5,1)
+ b=DataArrayInt64.New()
+ bb=[1,3,5,9,11]
+ b.setValues(bb,5,1)
+ self.assertEqual([2,6,8],a.buildSubstraction(b).getValues())
+ pass
+
+ def testDAIBuildPermutationArr1(self):
+ a=DataArrayInt64.New()
+ a.setValues([4,5,6,7,8],5,1)
+ b=DataArrayInt64.New()
+ b.setValues([5,4,8,6,7],5,1)
+ c=a.buildPermutationArr(b)
+ self.assertEqual([1,0,4,2,3],c.getValues())
+ self.assertTrue(a.isEqualWithoutConsideringStrAndOrder(b))
+ b.setIJ(0,0,9)
+ self.assertTrue(not a.isEqualWithoutConsideringStrAndOrder(b))
+ self.assertRaises(InterpKernelException,a.buildPermutationArr,b)
+ a.setIJ(3,0,4)
+ b.setIJ(0,0,5)
+ b.setIJ(4,0,4)#a==[4,5,6,4,8] and b==[5,4,8,6,4]
+ self.assertTrue(a.isEqualWithoutConsideringStrAndOrder(b))
+ c=a.buildPermutationArr(b)
+ self.assertEqual([1,3,4,2,3],c.getValues())
+ d=b.convertToDblArr()
+ expect3=[4,4,5,6,8]
+ b.sort()
+ self.assertEqual(expect3,b.getValues())
+ d.sort()
+ self.assertEqual(5,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ for i in range(5):
+ self.assertAlmostEqual(float(expect3[i]),d.getIJ(i,0),14);
+ pass
+ pass
+
+ def testDAIAggregateMulti1(self):
+ a=DataArrayInt64.New()
+ a.setValues(list(range(4)), 2, 2)
+ a.setName("aa")
+ b=DataArrayInt64.New()
+ b.setValues(list(range(6)), 3, 2)
+ c=DataArrayInt64.Aggregate([a,b])
+ self.assertEqual(list(range(4)) + list(range(6)), c.getValues())
+ self.assertEqual("aa",c.getName())
+ self.assertEqual(5,c.getNumberOfTuples())
+ self.assertEqual(2,c.getNumberOfComponents())
+ pass
+
+ def testDAICheckAndPreparePermutation1(self):
+ vals1=[9,10,0,6,4,11,3,7];
+ expect1=[5,6,0,3,2,7,1,4];
+ vals2=[9,10,0,6,10,11,3,7];
+ da=DataArrayInt64.New();
+ da.setValues(vals1,8,1);
+ da2=da.checkAndPreparePermutation();
+ self.assertEqual(8,da2.getNumberOfTuples());
+ self.assertEqual(1,da2.getNumberOfComponents());
+ for i in range(8):
+ self.assertEqual(expect1[i],da2.getIJ(i,0));
+ pass
+ #
+ da=DataArrayInt64.New();
+ da.alloc(8,1);
+ da.iota(0);
+ da2=da.checkAndPreparePermutation();
+ self.assertEqual(1,da2.getNumberOfComponents());
+ self.assertTrue(da2.isIota(8));
+ #
+ da=DataArrayInt64.New();
+ da.alloc(8,1);
+ da.setValues(vals2,8,1);
+ self.assertRaises(InterpKernelException,da.checkAndPreparePermutation);
+ pass
+
+ def testDAIChangeSurjectiveFormat1(self):
+ vals1=[0,3,2,3,2,2,1,2]
+ expected1=[0,1,2,6,8]
+ expected2=[0, 6, 2,4,5,7, 1,3]
+ da=DataArrayInt64.New();
+ da.setValues(vals1,8,1);
+ #
+ da2,da2I=da.changeSurjectiveFormat(4);
+ self.assertEqual(5,da2I.getNumberOfTuples());
+ self.assertEqual(8,da2.getNumberOfTuples());
+ self.assertEqual(expected1,da2I.getValues());
+ self.assertEqual(expected2,da2.getValues());
+ #
+ self.assertRaises(InterpKernelException,da.changeSurjectiveFormat,3);
+ #
+ pass
+
+ def testDAIGetIdsNotEqual1(self):
+ d=DataArrayInt64.New();
+ vals1=[2,3,5,6,8,5,5,6,1,-5]
+ d.setValues(vals1,10,1);
+ d2=d.findIdsNotEqual(5);
+ self.assertEqual(7,d2.getNumberOfTuples());
+ self.assertEqual(1,d2.getNumberOfComponents());
+ expected1=[0,1,3,4,7,8,9]
+ for i in range(7):
+ self.assertEqual(expected1[i],d2.getIJ(0,i));
+ pass
+ d.rearrange(2);
+ self.assertRaises(InterpKernelException,d.findIdsNotEqual,5);
+ vals2=[-4,5,6]
+ vals3=vals2;
+ d.rearrange(1);
+ d3=d.findIdsNotEqualList(vals3);
+ self.assertEqual(5,d3.getNumberOfTuples());
+ self.assertEqual(1,d3.getNumberOfComponents());
+ expected2=[0,1,4,8,9]
+ for i in range(5):
+ self.assertEqual(expected2[i],d3.getIJ(0,i));
+ pass
+ pass
+
+ def testDAIComputeOffsets1(self):
+ d=DataArrayInt64.New();
+ vals1=[3,5,1,2,0,8]
+ expected1=[0,3,8,9,11,11]
+ d.setValues(vals1,6,1);
+ d.computeOffsets();
+ self.assertEqual(6,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ for i in range(6):
+ self.assertEqual(expected1[i],d.getIJ(0,i));
+ pass
+ pass
+
+ def testDAITransformWithIndArr1(self):
+ if not MEDCouplingUse64BitIDs():
+ return
+ tab1=[17,18,22,19]
+ tab2=[0,1,1,3,3,0,1,3,2,2,3,0]
+ expected=[17,18,18,19,19,17,18,19,22,22,19,17]
+ d=DataArrayInt64.New();
+ d.setValues(tab1,4,1);
+ d1=DataArrayInt64.New();
+ d1.setValues(tab2,12,1);
+ d2=d1[:]
+ #
+ d1.transformWithIndArr(d);
+ self.assertEqual(12,d1.getNumberOfTuples());
+ self.assertEqual(1,d1.getNumberOfComponents());
+ for i in range(12):
+ self.assertEqual(expected[i],d1.getIJ(i,0));
+ pass
+ #
+ d1=d2
+ d1.transformWithIndArr(tab1)
+ self.assertEqual(12,d1.getNumberOfTuples());
+ self.assertEqual(1,d1.getNumberOfComponents());
+ for i in range(12):
+ self.assertEqual(expected[i],d1.getIJ(i,0));
+ pass
+ pass
+
+ def testDAIBuildPermArrPerLevel1(self):
+ arr=[2,0,1,1,0,1,2,0,1,1,0,0]
+ expected1=[10,0,5,6,1,7,11,2,8,9,3,4]
+ da=DataArrayInt64.New();
+ da.setValues(arr,12,1);
+ da2=da.buildPermArrPerLevel();
+ self.assertEqual(12,da2.getNumberOfTuples());
+ self.assertEqual(1,da2.getNumberOfComponents());
+ for i in range(12):
+ self.assertEqual(expected1[i],da2.getIJ(i,0));
+ pass
+ pass
+
+ def testDAIOperations1(self):
+ arr1=[-1,-2,4,7,3,2,6,6,4,3,0,1]
+ da=DataArrayInt64.New();
+ da.setValues(arr1,4,3);
+ da1=DataArrayInt64.New();
+ da1.alloc(12,1);
+ da1.iota(2);
+ self.assertRaises(InterpKernelException,DataArrayInt64.Add,da,da1);#not same number of tuples/Components
+ da1.rearrange(3);
+ da2=DataArrayInt64.Add(da,da1);
+ self.assertEqual(4,da2.getNumberOfTuples());
+ self.assertEqual(3,da2.getNumberOfComponents());
+ expected1=[1,1,8,12,9,9,14,15,14,14,12,14]
+ for i in range(12):
+ self.assertEqual(expected1[i],da2.getIJ(0,i));
+ pass
+ da1.substractEqual(da);
+ expected2=[3,5,0,-2,3,5,2,3,6,8,12,12]
+ for i in range(12):
+ self.assertEqual(expected2[i],da1.getIJ(0,i));
+ pass
+ da1.rearrange(1); da1.iota(2); da1.rearrange(3);
+ da1.addEqual(da);
+ for i in range(12):
+ self.assertEqual(expected1[i],da1.getIJ(0,i));
+ pass
+ da1.rearrange(1); da1.iota(2); da1.rearrange(3);
+ da2=DataArrayInt64.Multiply(da,da1);
+ self.assertEqual(4,da2.getNumberOfTuples());
+ self.assertEqual(3,da2.getNumberOfComponents());
+ expected3=[-2,-6,16,35,18,14,48,54,40,33,0,13]
+ for i in range(12):
+ self.assertEqual(expected3[i],da2.getIJ(0,i));
+ pass
+ da.divideEqual(da1);
+ self.assertEqual(4,da.getNumberOfTuples());
+ self.assertEqual(3,da.getNumberOfComponents());
+ expected4=[0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]
+ for i in range(12):
+ self.assertEqual(expected4[i],da.getIJ(0,i));
+ pass
+ da.setValues(arr1,4,3);
+ da1.multiplyEqual(da);
+ self.assertEqual(4,da1.getNumberOfTuples());
+ self.assertEqual(3,da1.getNumberOfComponents());
+ for i in range(12):
+ self.assertEqual(expected3[i],da1.getIJ(0,i));
+ pass
+ da1.rearrange(1); da1.iota(2); da1.rearrange(3);
+ da2=DataArrayInt64.Divide(da,da1);
+ self.assertEqual(4,da2.getNumberOfTuples());
+ self.assertEqual(3,da2.getNumberOfComponents());
+ for i in range(12):
+ self.assertEqual(expected4[i],da2.getIJ(0,i));
+ pass
+ da1.applyInv(321);
+ self.assertEqual(4,da1.getNumberOfTuples());
+ self.assertEqual(3,da1.getNumberOfComponents());
+ expected5=[160,107,80,64,53,45,40,35,32,29,26,24]
+ for i in range(12):
+ self.assertEqual(expected5[i],da1.getIJ(0,i));
+ pass
+ da1.applyDivideBy(2);
+ self.assertEqual(4,da1.getNumberOfTuples());
+ self.assertEqual(3,da1.getNumberOfComponents());
+ expected6=[80,53,40,32,26,22,20,17,16,14,13,12]
+ for i in range(12):
+ self.assertEqual(expected6[i],da1.getIJ(0,i));
+ pass
+ expected7=[3,4,5,4,5,1,6,3,2,0,6,5]
+ da1.applyModulus(7);
+ for i in range(12):
+ self.assertEqual(expected7[i],da1.getIJ(0,i));
+ pass
+ da1.applyLin(1,1);
+ expected8=[3,3,3,3,3,1,3,3,0,0,3,3]
+ da1.applyRModulus(3);
+ for i in range(12):
+ self.assertEqual(expected8[i],da1.getIJ(0,i));
+ pass
+ pass
+
+ def testDAITransformWithIndArrR1(self):
+ tab1=[2,4,5,3,6,7]
+ tab2=[-1,-1,0,1,2,3,4,5,-1,-1,-1,-1]
+ expected=[0,3,1,2,4,5]
+ d=DataArrayInt64.New();
+ d.setValues(tab1,6,1);
+ d1=DataArrayInt64.New();
+ d1.setValues(tab2,12,1);
+ d2=d1[:]
+ #
+ d3=d.transformWithIndArrR(d1);
+ self.assertEqual(6,d3.getNumberOfTuples());
+ self.assertEqual(1,d3.getNumberOfComponents());
+ for i in range(6):
+ self.assertEqual(expected[i],d3.getIJ(i,0));
+ pass
+ #
+ d1=d2
+ d3=d.transformWithIndArrR(tab2)
+ self.assertEqual(6,d3.getNumberOfTuples());
+ self.assertEqual(1,d3.getNumberOfComponents());
+ for i in range(6):
+ self.assertEqual(expected[i],d3.getIJ(i,0));
+ pass
+ pass
+
+ def testDAISplitByValueRange1(self):
+ val1=[6,5,0,3,2,7,8,1,4]
+ val2=[0,4,9]
+ d=DataArrayInt64.New();
+ d.setValues(val1,9,1);
+ e,f,g=d.splitByValueRange(val2);
+ self.assertEqual(9,e.getNumberOfTuples());
+ self.assertEqual(1,e.getNumberOfComponents());
+ self.assertEqual(9,f.getNumberOfTuples());
+ self.assertEqual(1,f.getNumberOfComponents());
+ self.assertEqual(2,g.getNumberOfTuples());
+ self.assertEqual(1,g.getNumberOfComponents());
+ #
+ expected1=[1,1,0,0,0,1,1,0,1]
+ expected2=[2,1,0,3,2,3,4,1,0]
+ for i in range(9):
+ self.assertEqual(expected1[i],e.getIJ(i,0));
+ self.assertEqual(expected2[i],f.getIJ(i,0));
+ pass
+ self.assertEqual(0,g.getIJ(0,0));
+ self.assertEqual(1,g.getIJ(1,0));
+ #
+ d.setIJ(6,0,9);
+ self.assertRaises(InterpKernelException,d.splitByValueRange,val2);
+ # non regression test in python wrapping
+ rg=DataArrayInt64([0,10,29,56,75,102,121,148,167,194,213,240,259,286,305,332,351,378,397,424,443,470,489,516])
+ a,b,c=DataArrayInt64([75]).splitByValueRange(rg)
+ assert(a.isEqual(DataArrayInt64([4])))
+ assert(b.isEqual(DataArrayInt64([0])))
+ assert(c.isEqual(DataArrayInt64([4])))
+ pass
+
+ def testDAIBuildExplicitArrByRanges1(self):
+ d=DataArrayInt64.New();
+ vals1=[0,2,3]
+ d.setValues(vals1,3,1);
+ e=DataArrayInt64.New();
+ vals2=[0,3,6,10,14,20]
+ e.setValues(vals2,6,1);
+ #
+ f=d.buildExplicitArrByRanges(e);
+ self.assertEqual(11,f.getNumberOfTuples());
+ self.assertEqual(1,f.getNumberOfComponents());
+ expected1=[0,1,2,6,7,8,9,10,11,12,13]
+ for i in range(11):
+ self.assertEqual(expected1[i],f.getIJ(i,0));
+ pass
+ pass
+
+ def testDAIComputeOffsets2(self):
+ d=DataArrayInt64.New();
+ vals1=[3,5,1,2,0,8]
+ expected1=[0,3,8,9,11,11,19]
+ d.setValues(vals1,6,1);
+ d.computeOffsetsFull();
+ self.assertEqual(7,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ for i in range(7):
+ self.assertEqual(expected1[i],d.getIJ(0,i));
+ pass
+ pass
+
+ def testDAIBuildOld2NewArrayFromSurjectiveFormat2(self):
+ arr=[0,3, 5,7,9]
+ arrI=[0,2,5]
+ a=DataArrayInt.New();
+ a.setValues(arr,5,1);
+ b=DataArrayInt.New();
+ b.setValues(arrI,3,1);
+ ret,newNbTuple=DataArrayInt64.ConvertIndexArrayToO2N(10,a,b);
+ expected=[0,1,2,0,3,4,5,4,6,4]
+ self.assertEqual(10,ret.getNbOfElems());
+ self.assertEqual(7,newNbTuple);
+ self.assertEqual(1,ret.getNumberOfComponents());
+ self.assertEqual(expected,ret.getValues());
+ self.assertRaises(InterpKernelException,DataArrayInt64.ConvertIndexArrayToO2N,9,a,b);
+ pass
+
+ def testDAIBuildUnique1(self):
+ d=DataArrayInt64([1,2,2,3,3,3,3,4,5,5,7,7,7,19])
+ e=d.buildUnique()
+ self.assertTrue(e.isEqual(DataArrayInt64([1,2,3,4,5,7,19])))
+ pass
+
+ def testDAIPartitionByDifferentValues1(self):
+ d=DataArrayInt64([1,0,1,2,0,2,2,-3,2])
+ expected=[[-3,[7]],[0,[1,4]],[1,[0,2]],[2,[3,5,6,8]]]
+ for i,elt in enumerate(zip(*d.partitionByDifferentValues())):
+ self.assertEqual(expected[i][0],elt[1])
+ self.assertEqual(expected[i][1],elt[0].getValues())
+ pass
+ pass
+
+ def testDAICheckMonotonic1(self):
+ data1=[-1,0,2,2,4,5]
+ data2=[6,2,0,-8,-9,-56]
+ data3=[-1,0,3,2,4,6]
+ data4=[7,5,2,3,0,-6]
+ d=DataArrayInt64.New(data1);
+ self.assertTrue(d.isMonotonic(True));
+ self.assertTrue(not d.isMonotonic(False));
+ d.checkMonotonic(True);
+ self.assertRaises(InterpKernelException,d.checkMonotonic,False)
+ d=DataArrayInt64.New(data2);
+ self.assertTrue(d.isMonotonic(False));
+ self.assertTrue(not d.isMonotonic(True));
+ d.checkMonotonic(False);
+ self.assertRaises(InterpKernelException,d.checkMonotonic,True)
+ d=DataArrayInt64.New(data3);
+ self.assertTrue(not d.isMonotonic(False));
+ self.assertTrue(not d.isMonotonic(True));
+ self.assertRaises(InterpKernelException,d.checkMonotonic,True)
+ self.assertRaises(InterpKernelException,d.checkMonotonic,False)
+ d=DataArrayInt64.New(data4);
+ self.assertTrue(not d.isMonotonic(False));
+ self.assertTrue(not d.isMonotonic(True));
+ self.assertRaises(InterpKernelException,d.checkMonotonic,True)
+ self.assertRaises(InterpKernelException,d.checkMonotonic,False)
+ d=DataArrayInt64.New(0,1)
+ self.assertTrue(d.isMonotonic(True));
+ self.assertTrue(d.isMonotonic(False));
+ d.checkMonotonic(True);
+ d.checkMonotonic(False);
+ d=DataArrayInt64.New(data4,3,2);#throw because nbComp!=1
+ self.assertRaises(InterpKernelException,d.isMonotonic,True)
+ self.assertRaises(InterpKernelException,d.isMonotonic,False)
+ self.assertRaises(InterpKernelException,d.checkMonotonic,True)
+ self.assertRaises(InterpKernelException,d.checkMonotonic,False)
+ pass
+
+ def testDAIBuildSubstractionOptimized1(self):
+ da1=DataArrayInt64.New([1,3,5,6,7,9,13])
+ da2=DataArrayInt64.New([3,5,9])
+ da3=DataArrayInt64.New([1,3,5])
+ da4=DataArrayInt64.New([1,3,5,6,7,9,13])
+ #
+ a=da1.buildSubstractionOptimized(da2);
+ self.assertTrue(a.isEqual(DataArrayInt64([1,6,7,13])));
+ #
+ a=da1.buildSubstractionOptimized(da3);
+ self.assertTrue(a.isEqual(DataArrayInt64([6,7,9,13])));
+ #
+ a=da1.buildSubstractionOptimized(da4);
+ self.assertTrue(a.isEqual(DataArrayInt64([])));
+ pass
+
+ def testDAIIsStrictlyMonotonic1(self):
+ da1=DataArrayInt64.New([1,3,5,6,7,9,13])
+ self.assertTrue(da1.isStrictlyMonotonic(True));
+ da1.checkStrictlyMonotonic(True);
+ self.assertTrue(da1.isMonotonic(True));
+ da1.checkMonotonic(True);
+ self.assertTrue(not da1.isStrictlyMonotonic(False));
+ self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,False)
+ self.assertTrue(not da1.isMonotonic(False));
+ self.assertRaises(InterpKernelException,da1.checkMonotonic,False)
+ #
+ da1=DataArrayInt64.New([1,3,5,6,6,9,13])
+ self.assertTrue(not da1.isStrictlyMonotonic(True));
+ self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,True)
+ self.assertTrue(da1.isMonotonic(True));
+ da1.checkMonotonic(True);
+ self.assertTrue(not da1.isStrictlyMonotonic(False));
+ self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,False)
+ self.assertTrue(not da1.isMonotonic(False));
+ self.assertRaises(InterpKernelException,da1.checkMonotonic,False)
+ #
+ da1=DataArrayInt64.New([1,3,5,6,5,9,13])
+ self.assertTrue(not da1.isStrictlyMonotonic(True));
+ self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,True)
+ self.assertTrue(not da1.isMonotonic(True));
+ self.assertRaises(InterpKernelException,da1.checkMonotonic,True)
+ self.assertTrue(not da1.isStrictlyMonotonic(False));
+ self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,False)
+ self.assertTrue(not da1.isMonotonic(False));
+ self.assertRaises(InterpKernelException,da1.checkMonotonic,False)
+ #
+ da1=DataArrayInt64.New([13,9,7,6,5,3,1])
+ self.assertTrue(not da1.isStrictlyMonotonic(True));
+ self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,True)
+ self.assertTrue(not da1.isMonotonic(True));
+ self.assertRaises(InterpKernelException,da1.checkMonotonic,True)
+ self.assertTrue(da1.isStrictlyMonotonic(False));
+ da1.checkStrictlyMonotonic(False);
+ self.assertTrue(da1.isMonotonic(False));
+ da1.checkMonotonic(False);
+ #
+ da1=DataArrayInt64.New([13,9,6,6,5,3,1])
+ self.assertTrue(not da1.isStrictlyMonotonic(True));
+ self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,True)
+ self.assertTrue(not da1.isMonotonic(True));
+ self.assertRaises(InterpKernelException,da1.checkMonotonic,True)
+ self.assertTrue(not da1.isStrictlyMonotonic(False));
+ self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,False)
+ self.assertTrue(da1.isMonotonic(False));
+ da1.checkMonotonic(False);
+ #
+ da1=DataArrayInt64.New([13,9,5,6,5,3,1])
+ self.assertTrue(not da1.isStrictlyMonotonic(True));
+ self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,True)
+ self.assertTrue(not da1.isMonotonic(True));
+ self.assertRaises(InterpKernelException,da1.checkMonotonic,True)
+ self.assertTrue(not da1.isStrictlyMonotonic(False));
+ self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,False)
+ self.assertTrue(not da1.isMonotonic(False));
+ self.assertRaises(InterpKernelException,da1.checkMonotonic,False)
+ #
+ da1=DataArrayInt64.New([])
+ self.assertTrue(da1.isStrictlyMonotonic(True));
+ da1.checkStrictlyMonotonic(True);
+ self.assertTrue(da1.isMonotonic(True));
+ da1.checkMonotonic(True);
+ self.assertTrue(da1.isStrictlyMonotonic(False));
+ da1.checkStrictlyMonotonic(False);
+ self.assertTrue(da1.isMonotonic(False));
+ da1.checkMonotonic(False);
+ #
+ da1=DataArrayInt64.New([13])
+ self.assertTrue(da1.isStrictlyMonotonic(True));
+ da1.checkStrictlyMonotonic(True);
+ self.assertTrue(da1.isMonotonic(True));
+ da1.checkMonotonic(True);
+ self.assertTrue(da1.isStrictlyMonotonic(False));
+ da1.checkStrictlyMonotonic(False);
+ self.assertTrue(da1.isMonotonic(False));
+ da1.checkMonotonic(False);
+ pass
+
+ def testDAIIndicesOfSubPart(self):
+ a=DataArrayInt64([9,10,0,6,4,11,3,8])
+ b=DataArrayInt64([6,0,11,8])
+ c=a.indicesOfSubPart(b)
+ self.assertTrue(c.isEqual(DataArrayInt([3,2,5,7])))
+ #
+ d=DataArrayInt64([9,10,0,6,4,11,0,8])
+ self.assertRaises(InterpKernelException,d.indicesOfSubPart,b) # 0 appears twice in the d array
+ f=DataArrayInt64([6,0,11,8,12])
+ self.assertRaises(InterpKernelException,a.indicesOfSubPart,f) # 12 in f does not exist in a
+ pass
+
+ def testDAIFromLinkedListOfPairToList1(self):
+ d=DataArrayInt64([(5,7),(7,3),(3,12),(12,17)])
+ zeRes=DataArrayInt64([5,7,3,12,17])
+ self.assertTrue(d.fromLinkedListOfPairToList().isEqual(zeRes))
+ d.rearrange(1)
+ self.assertRaises(InterpKernelException,d.fromLinkedListOfPairToList)
+ d.rearrange(2)
+ self.assertTrue(d.fromLinkedListOfPairToList().isEqual(zeRes))
+ d2=DataArrayInt64([(5,7)])
+ self.assertTrue(d2.fromLinkedListOfPairToList().isEqual(DataArrayInt64([5,7])))
+ d3=DataArrayInt64([(5,7),(7,3),(4,12),(12,17)])
+ self.assertRaises(InterpKernelException,d3.fromLinkedListOfPairToList) # not a linked list of pair
+ d4=DataArrayInt64([(5,7),(7,3),(12,3),(12,17)])
+ self.assertRaises(InterpKernelException,d4.fromLinkedListOfPairToList) # not a linked list of pair, but can be repaired !
+ d4.sortEachPairToMakeALinkedList()
+ self.assertTrue(d4.fromLinkedListOfPairToList().isEqual(zeRes))
+ pass
+
+ def testDAIfindIdsExt1(self):
+ d=DataArrayInt64([4,6,-2,3,7,0,10])
+ self.assertTrue(d.findIdsGreaterOrEqualTo(3).isEqual(DataArrayInt([0,1,3,4,6])))
+ self.assertTrue(d.findIdsGreaterThan(3).isEqual(DataArrayInt([0,1,4,6])))
+ self.assertTrue(d.findIdsLowerThan(3).isEqual(DataArrayInt([2,5])))
+ self.assertTrue(d.findIdsLowerOrEqualTo(3).isEqual(DataArrayInt([2,3,5])))
+ pass
+
+ def testDAICheckUniformAndGuess1(self):
+ d=DataArrayInt64([3,3],1,2)
+ self.assertRaises(InterpKernelException,d.checkUniformAndGuess)# non single compo
+ d=DataArrayInt64([])
+ self.assertRaises(InterpKernelException,d.checkUniformAndGuess)# empty
+ d=DataArrayInt64()
+ self.assertRaises(InterpKernelException,d.checkUniformAndGuess)# non allocated
+ d=DataArrayInt64([3,3,3])
+ self.assertEqual(3,d.checkUniformAndGuess())
+ d=DataArrayInt64([7])
+ self.assertEqual(7,d.checkUniformAndGuess())
+ d=DataArrayInt64([3,4,3])
+ self.assertRaises(InterpKernelException,d.checkUniformAndGuess)# non uniform
+ pass
+
+ def testDAIFindIdForEach1(self):
+ a1=DataArrayInt64([17,27,2,10,-4,3,12,27,16])
+ b1=DataArrayInt64([3,16,-4,27,17])
+ ret=a1.findIdForEach(b1)
+ self.assertTrue(ret.isEqual(DataArrayInt([5,8,4,7,0])))
+ self.assertTrue(a1[ret].isEqual(b1))
+ b2=DataArrayInt64([3,16,22,27,17])
+ self.assertRaises(InterpKernelException,a1.findIdForEach,b2) # 22 not in a1 !
+ a1.rearrange(3)
+ self.assertRaises(InterpKernelException,a1.findIdForEach,b1) # a1 is not single component
+ pass
+
+ pass
+
+if __name__ == '__main__':
+ unittest.main()
%{
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingCMesh.hxx"
%}
-%template(ivec) std::vector<int>;
%template(dvec) std::vector<double>;
%template(svec) std::vector<std::string>;
+//%include stdint.i
+
+#ifndef MEDCOUPLING_USE_64BIT_IDS
+//typedef std::int32_t mcIdType;
+typedef int mcIdType;
+typedef DataArrayInt32 DataArrayIdType;
+%template(ivec) std::vector<int>;
+%template(i64vec) std::vector<long>;
+#else
+//typedef std::int64_t mcIdType;
+typedef long int mcIdType;
+typedef DataArrayInt64 DataArrayIdType;
+%template(ivec) std::vector<long>;
+%template(i32vec) std::vector<int>;
+#endif
+
+
////////////////////
%typemap(out) MEDCoupling::MEDCouplingMesh*
{
{// AGY : here initialization of C++ traits in MEDCouplingDataArrayTypemaps.i for code factorization. Awful, I know, but no other solutions.
SWIGTITraits<double>::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble;
SWIGTITraits<float>::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat;
- SWIGTITraits<int>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt;
+ SWIGTITraits<Int32>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt32;
+ SWIGTITraits<Int64>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt64;
SWIGTITraits<double>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple;
SWIGTITraits<float>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple;
- SWIGTITraits<int>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayIntTuple;
+ SWIGTITraits<Int32>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt32Tuple;
+ SWIGTITraits<Int64>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt64Tuple;
}
%}
Py_ssize_t sz(sizeof(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER[0])));
auto maxElt(*std::max_element(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER,MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER+sz));
auto szOut(maxElt+1);
- std::vector< int > retCpp(szOut,-1);
+ std::vector< mcIdType > retCpp(szOut,-1);
mcIdType id(0);
- for(const int *it=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++)
+ for(const mcIdType *it=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++)
{
if(*it!=-1)
retCpp[*it]=id;
IMAGE_GRID = 12
} MEDCouplingMeshType;
- class DataArrayInt;
+ class DataArrayInt32;
+ class DataArrayInt64;
class DataArrayDouble;
class MEDCouplingUMesh;
class MEDCouplingCMesh;
virtual DataArrayDouble *getCoordinatesAndOwner() const;
virtual DataArrayDouble *computeCellCenterOfMass() const;
virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
- virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
- virtual DataArrayInt *computeNbOfNodesPerCell() const;
- virtual DataArrayInt *computeNbOfFacesPerCell() const;
- virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const;
+ virtual DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ virtual DataArrayIdType *computeNbOfNodesPerCell() const;
+ virtual DataArrayIdType *computeNbOfFacesPerCell() const;
+ virtual DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
virtual MEDCouplingUMesh *buildUnstructured() const;
virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
- virtual DataArrayInt *simplexize(int policy);
- virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
+ virtual DataArrayIdType *simplexize(int policy);
+ virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type);
static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type);
return ret2;
}
- int getCellContainingPoint(PyObject *p, double eps) const
+ mcIdType getCellContainingPoint(PyObject *p, double eps) const
{
double val;
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
int spaceDim=self->getSpaceDimension();
const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
int spaceDim=self->getSpaceDimension();
const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
- MCAuto<DataArrayInt> elts,eltsIndex;
+ MCAuto<DataArrayIdType> elts,eltsIndex;
self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
int spaceDim=self->getSpaceDimension();
const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : ";
const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
- MCAuto<DataArrayInt> elts,eltsIndex;
+ MCAuto<DataArrayIdType> elts,eltsIndex;
self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *getCellsContainingPoints(PyObject *p, double eps) const
{
- auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayInt>& d, MCAuto<DataArrayInt>& e) { self->getCellsContainingPoints(a,b,c,d,e); };
+ auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPoints(a,b,c,d,e); };
return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
}
PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const
{
- auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayInt>& d, MCAuto<DataArrayInt>& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); };
+ auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); };
return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
}
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
int spaceDim=self->getSpaceDimension();
const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
- std::vector<int> elts;
+ std::vector<mcIdType> elts;
self->getCellsContainingPoint(pos,eps,elts);
- DataArrayInt *ret=DataArrayInt::New();
+ DataArrayIdType *ret=DataArrayIdType::New();
ret->alloc((int)elts.size(),1);
std::copy(elts.begin(),elts.end(),ret->getPointer());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
virtual PyObject *getReverseNodalConnectivity() const
{
- MCAuto<DataArrayInt> d0=DataArrayInt::New();
- MCAuto<DataArrayInt> d1=DataArrayInt::New();
+ MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
self->getReverseNodalConnectivity(d0,d1);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
void renumberCells(PyObject *li, bool check=true)
{
- int sw,sz(-1);
- int v0; std::vector<int> v1;
- const int *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
+ mcIdType sw,sz(-1);
+ mcIdType v0; std::vector<mcIdType> v1;
+ const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
self->renumberCells(ids,check);
}
PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const
{
- DataArrayInt *cellCor, *nodeCor;
+ DataArrayIdType *cellCor, *nodeCor;
self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
PyObject *res = PyList_New(2);
- PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
- PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
+ PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
+ PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
return res;
}
PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
{
- DataArrayInt *cellCor=0,*nodeCor=0;
+ DataArrayIdType *cellCor=0,*nodeCor=0;
self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
PyObject *res = PyList_New(2);
- PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
- PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
+ PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
+ PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
return res;
}
- DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
+ DataArrayIdType *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
{
- DataArrayInt *cellCor=0;
+ DataArrayIdType *cellCor=0;
self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
return cellCor;
}
- DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const
+ DataArrayIdType *getCellIdsFullyIncludedInNodeIds(PyObject *li) const
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
if (!SWIG_IsOK(res1))
{
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
+ return self->getCellIdsFullyIncludedInNodeIds(tmp,((const mcIdType *)tmp)+size);
}
else
{
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
da2->checkAllocated();
return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
}
}
PyObject *getNodeIdsOfCell(int cellId) const
{
- std::vector<int> conn;
+ std::vector<mcIdType> conn;
self->getNodeIdsOfCell(cellId,conn);
return convertIntArrToPyList2(conn);
}
- PyObject *getCoordinatesOfNode(int nodeId) const
+ PyObject *getCoordinatesOfNode(mcIdType nodeId) const
{
std::vector<double> coo;
self->getCoordinatesOfNode(nodeId,coo);
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
int spaceDim=self->getSpaceDimension();
const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
PyObject *buildPart(PyObject *li) const
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
- if(sw==3)//DataArrayInt
+ if(sw==3)//DataArrayIdType
{
- void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
- DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
+ void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
+ DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
std::string name=argpt->getName();
if(!name.empty())
ret->setName(name.c_str());
PyObject *buildPartAndReduceNodes(PyObject *li) const
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- DataArrayInt *arr=0;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ DataArrayIdType *arr=0;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
- if(sw==3)//DataArrayInt
+ if(sw==3)//DataArrayIdType
{
- void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
- DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
+ void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
+ DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
std::string name=argpt->getName();
if(!name.empty())
ret->setName(name.c_str());
//
PyObject *res = PyList_New(2);
PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
- PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
PyList_SetItem(res,0,obj0);
PyList_SetItem(res,1,obj1);
return res;
}
- PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const
+ PyObject *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
{
- int a,b,c;
- DataArrayInt *arr=0;
+ mcIdType a,b,c;
+ DataArrayIdType *arr=0;
MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
PyObject *res = PyTuple_New(2);
PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
PyObject *obj1=0;
if(arr)
- obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
else
obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
PyTuple_SetItem(res,0,obj0);
PyObject *getDistributionOfTypes() const
{
- std::vector<int> vals=self->getDistributionOfTypes();
+ std::vector<mcIdType> vals=self->getDistributionOfTypes();
if(vals.size()%3!=0)
throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
- PyObject *ret=PyList_New((int)vals.size()/3);
- for(int j=0;j<(int)vals.size()/3;j++)
+ PyObject *ret=PyList_New((mcIdType)vals.size()/3);
+ for(std::size_t j=0;j<vals.size()/3;j++)
{
PyObject *ret1=PyList_New(3);
- PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
- PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
- PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
+ PyList_SetItem(ret1,0,PyInt_FromLong(vals[3*j]));
+ PyList_SetItem(ret1,1,PyInt_FromLong(vals[3*j+1]));
+ PyList_SetItem(ret1,2,PyInt_FromLong(vals[3*j+2]));
PyList_SetItem(ret,j,ret1);
}
return ret;
}
- DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const
+ DataArrayIdType *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const
{
- std::vector<int> code;
- std::vector<const DataArrayInt *> idsPerType;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li2,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",idsPerType);
+ std::vector<mcIdType> code;
+ std::vector<const DataArrayIdType *> idsPerType;
+ convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li2,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",idsPerType);
convertPyToNewIntArr4(li,1,3,code);
return self->checkTypeConsistencyAndContig(code,idsPerType);
}
- PyObject *splitProfilePerType(const DataArrayInt *profile, bool smartPflKiller=true) const
+ PyObject *splitProfilePerType(const DataArrayIdType *profile, bool smartPflKiller=true) const
{
- std::vector<int> code;
- std::vector<DataArrayInt *> idsInPflPerType;
- std::vector<DataArrayInt *> idsPerType;
+ std::vector<mcIdType> code;
+ std::vector<DataArrayIdType *> idsInPflPerType;
+ std::vector<DataArrayIdType *> idsPerType;
self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
PyObject *ret=PyTuple_New(3);
//
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
- PyObject *ret0=PyList_New((int)code.size()/3);
- for(int j=0;j<(int)code.size()/3;j++)
+ PyObject *ret0=PyList_New((mcIdType)code.size()/3);
+ for(std::size_t j=0;j<code.size()/3;j++)
{
PyObject *ret00=PyList_New(3);
- PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
- PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
- PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
+ PyList_SetItem(ret00,0,PyInt_FromLong(code[3*j]));
+ PyList_SetItem(ret00,1,PyInt_FromLong(code[3*j+1]));
+ PyList_SetItem(ret00,2,PyInt_FromLong(code[3*j+2]));
PyList_SetItem(ret0,j,ret00);
}
PyTuple_SetItem(ret,0,ret0);
//
PyObject *ret1=PyList_New(idsInPflPerType.size());
for(std::size_t j=0;j<idsInPflPerType.size();j++)
- PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,1,ret1);
- int n=idsPerType.size();
+ std::size_t n=idsPerType.size();
PyObject *ret2=PyList_New(n);
- for(int i=0;i<n;i++)
- PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ for(std::size_t i=0;i<n;i++)
+ PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,2,ret2);
return ret;
}
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
int spaceDim=self->getSpaceDimension();
const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
int spaceDim=self->getSpaceDimension();
const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
self->rotate(centerPtr,0,alpha);
DataArrayDouble *a,*a2;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
int spaceDim=self->getSpaceDimension();
const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,spaceDim,false);//vectorPtr can be null in case of space dim 2
virtual PyObject *getTinySerializationInformation() const
{
std::vector<double> a0;
- std::vector<int> a1;
+ std::vector<mcIdType> a1;
std::vector<std::string> a2;
self->getTinySerializationInformation(a0,a1,a2);
PyObject *ret(PyTuple_New(3));
PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
- int sz(a2.size());
+ std::size_t sz(a2.size());
PyObject *ret2(PyList_New(sz));
{
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
}
PyTuple_SetItem(ret,2,ret2);
virtual PyObject *serialize() const
{
- DataArrayInt *a0Tmp(0);
+ DataArrayIdType *a0Tmp(0);
DataArrayDouble *a1Tmp(0);
self->serialize(a0Tmp,a1Tmp);
PyObject *ret(PyTuple_New(2));
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(a1Tmp),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
return ret;
}
- void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2) const
+ void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2) const
{
std::vector<std::string> littleStrings;
self->resizeForUnserialization(tinyInfo,a1,a2,littleStrings);
static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !";
if(!PyTuple_Check(inp))
throw INTERP_KERNEL::Exception(MSG);
- int sz(PyTuple_Size(inp));
+ std::size_t sz(PyTuple_Size(inp));
if(sz!=2)
throw INTERP_KERNEL::Exception(MSG);
PyObject *elt0(PyTuple_GetItem(inp,0));
PyObject *elt1(PyTuple_GetItem(inp,1));
std::vector<double> a0;
- std::vector<int> a1;
+ std::vector<mcIdType> a1;
std::vector<std::string> a2;
- DataArrayInt *b0(0);
+ DataArrayIdType *b0(0);
DataArrayDouble *b1(0);
{
if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
throw INTERP_KERNEL::Exception(MSG);
PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
- int tmp(-1);
+ mcIdType tmp(-1);
fillArrayWithPyListDbl3(a0py,tmp,a0);
convertPyToNewIntArr3(a1py,a1);
fillStringVector(a2py,a2);
throw INTERP_KERNEL::Exception(MSG);
PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
void *argp(0);
- int status(SWIG_ConvertPtr(b0py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0));
+ int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits<mcIdType>::TI,0|0));
if(!SWIG_IsOK(status))
throw INTERP_KERNEL::Exception(MSG);
- b0=reinterpret_cast<DataArrayInt *>(argp);
+ b0=reinterpret_cast<DataArrayIdType *>(argp);
status=SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
if(!SWIG_IsOK(status))
throw INTERP_KERNEL::Exception(MSG);
class MEDCouplingSkyLineArray
{
public:
- static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayInt* c, const DataArrayInt* cI );
+ static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI );
- void set( DataArrayInt* index, DataArrayInt* value );
- void set3( DataArrayInt* superIndex, DataArrayInt* index, DataArrayInt* value );
+ void set( DataArrayIdType* index, DataArrayIdType* value );
+ void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value );
int getSuperNumberOf() const;
int getNumberOf() const;
void deletePack(const int i, const int j);
void deleteSimplePack(const int i);
- void deleteSimplePacks(const DataArrayInt* idx);
+ void deleteSimplePacks(const DataArrayIdType* idx);
%extend
{
return MEDCouplingSkyLineArray::New();
}
- MEDCouplingSkyLineArray( const std::vector<int>& index, const std::vector<int>& value)
+ MEDCouplingSkyLineArray( const std::vector<mcIdType>& index, const std::vector<mcIdType>& value)
{
return MEDCouplingSkyLineArray::New(index, value);
}
- MEDCouplingSkyLineArray( DataArrayInt* index, DataArrayInt* value )
+ MEDCouplingSkyLineArray( DataArrayIdType* index, DataArrayIdType* value )
{
return MEDCouplingSkyLineArray::New(index, value);
}
return self->simpleRepr();
}
- DataArrayInt *getSuperIndexArray() const
+ DataArrayIdType *getSuperIndexArray() const
{
- DataArrayInt *ret(self->getSuperIndexArray());
+ DataArrayIdType *ret(self->getSuperIndexArray());
if(ret)
ret->incrRef();
return ret;
}
- DataArrayInt *getIndexArray() const
+ DataArrayIdType *getIndexArray() const
{
- DataArrayInt *ret(self->getIndexArray());
+ DataArrayIdType *ret(self->getIndexArray());
if(ret)
ret->incrRef();
return ret;
}
- DataArrayInt *getValuesArray() const
+ DataArrayIdType *getValuesArray() const
{
- DataArrayInt *ret(self->getValuesArray());
+ DataArrayIdType *ret(self->getValuesArray());
if(ret)
ret->incrRef();
return ret;
}
- PyObject *getSimplePackSafe(int absolutePackId) const
+ PyObject *getSimplePackSafe(mcIdType absolutePackId) const
{
- std::vector<int> ret;
+ std::vector<mcIdType> ret;
self->getSimplePackSafe(absolutePackId,ret);
return convertIntArrToPyList2(ret);
}
PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const
{
- std::vector<int> vpack, vspIdx, out;
+ std::vector<mcIdType> vpack, vspIdx, out;
convertPyToNewIntArr3(superPackIndices,vspIdx);
convertPyToNewIntArr3(pack,vpack);
return convertIntArrToPyList2(out);
}
- void pushBackPack(const int i, PyObject *pack)
+ void pushBackPack(const mcIdType i, PyObject *pack)
{
- std::vector<int> vpack;
+ std::vector<mcIdType> vpack;
convertPyToNewIntArr3(pack,vpack);
self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size());
}
- void replaceSimplePack(const int idx, PyObject *pack)
+ void replaceSimplePack(const mcIdType idx, PyObject *pack)
{
- std::vector<int> vpack;
+ std::vector<mcIdType> vpack;
convertPyToNewIntArr3(pack,vpack);
self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size());
}
- void replaceSimplePacks(const DataArrayInt* idx, PyObject *listePacks)
+ void replaceSimplePacks(const DataArrayIdType* idx, PyObject *listePacks)
{
- std::vector<const DataArrayInt*> packs;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt*>(listePacks,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",packs);
+ std::vector<const DataArrayIdType*> packs;
+ convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType*>(listePacks,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",packs);
self->replaceSimplePacks(idx, packs);
}
- void replacePack(const int superIdx, const int idx, PyObject *pack)
+ void replacePack(const mcIdType superIdx, const mcIdType idx, PyObject *pack)
{
- std::vector<int> vpack;
+ std::vector<mcIdType> vpack;
convertPyToNewIntArr3(pack,vpack);
self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size());
}
PyObject *convertToPolyhedronConn() const
{
- MCAuto<DataArrayInt> d0=DataArrayInt::New();
- MCAuto<DataArrayInt> d1=DataArrayInt::New();
+ MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
self->convertToPolyhedronConn(d0,d1);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
}
virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon);
static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
- static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
- virtual DataArrayInt *computeFetchedNodeIds() const;
+ static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
+ virtual DataArrayIdType *computeFetchedNodeIds() const;
virtual int getNumberOfNodesInCell(int cellId) const;
virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
- virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
- virtual DataArrayInt *zipCoordsTraducer();
- virtual DataArrayInt *findBoundaryNodes() const;
- virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0);
+ virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
+ virtual DataArrayIdType *zipCoordsTraducer();
+ virtual DataArrayIdType *findBoundaryNodes() const;
+ virtual DataArrayIdType *zipConnectivityTraducer(int compType, int startCellId=0);
virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
virtual void checkFullyDefined() const;
- virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const;
+ virtual bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const;
virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
virtual void renumberNodesWithOffsetInConn(int offset);
return self->simpleRepr();
}
- PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const
+ PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex) const
{
- int newNbOfNodes;
- DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
+ mcIdType newNbOfNodes;
+ DataArrayIdType *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
PyObject *res = PyList_New(2);
- PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
+ PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,1,PyInt_FromLong(newNbOfNodes));
return res;
}
- PyObject *findCommonNodes(double prec, int limitTupleId=-1) const
+ PyObject *findCommonNodes(double prec, mcIdType limitTupleId=-1) const
{
- DataArrayInt *comm, *commIndex;
+ DataArrayIdType *comm, *commIndex;
self->findCommonNodes(prec,limitTupleId,comm,commIndex);
PyObject *res = PyList_New(2);
- PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return res;
}
PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
- if(sw==3)//DataArrayInt
+ if(sw==3)//DataArrayIdType
{
- void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
- DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
+ void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
+ DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
std::string name=argpt->getName();
if(!name.empty())
ret->setName(name.c_str());
PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
- if(sw==3)//DataArrayInt
+ if(sw==3)//DataArrayIdType
{
- void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
- DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
+ void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
+ DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
std::string name=argpt->getName();
if(!name.empty())
ret->setName(name.c_str());
virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
- if(sw==3)//DataArrayInt
+ if(sw==3)//DataArrayIdType
{
- void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
- DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
+ void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
+ DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
std::string name=argpt->getName();
if(!name.empty())
ret->setName(name.c_str());
return convertMesh(ret, SWIG_POINTER_OWN | 0 );
}
- virtual PyObject *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const
+ virtual PyObject *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
{
MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step);
return convertMesh(ret, SWIG_POINTER_OWN | 0 );
PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
- if(sw==3)//DataArrayInt
+ if(sw==3)//DataArrayIdType
{
- void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
- DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
+ void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
+ DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
std::string name=argpt->getName();
if(!name.empty())
ret->setName(name.c_str());
return convertMesh(ret, SWIG_POINTER_OWN | 0 );
}
- void renumberNodes(PyObject *li, int newNbOfNodes)
+ void renumberNodes(PyObject *li, mcIdType newNbOfNodes)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->renumberNodes(tmp,newNbOfNodes);
}
- void renumberNodesCenter(PyObject *li, int newNbOfNodes)
+ void renumberNodesCenter(PyObject *li, mcIdType newNbOfNodes)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->renumberNodesCenter(tmp,newNbOfNodes);
}
DataArrayDouble *a,*a2;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point.";
const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector.";
const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
- std::vector<int> nodes;
+ std::vector<mcIdType> nodes;
self->findNodesOnLine(p,v,eps,nodes);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)nodes.size(),1);
+ DataArrayIdType *ret=DataArrayIdType::New();
+ ret->alloc(nodes.size(),1);
std::copy(nodes.begin(),nodes.end(),ret->getPointer());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const
{
DataArrayDouble *a,*a2;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point.";
const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector.";
const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
- std::vector<int> nodes;
+ std::vector<mcIdType> nodes;
self->findNodesOnPlane(p,v,eps,nodes);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)nodes.size(),1);
+ DataArrayIdType *ret=DataArrayIdType::New();
+ ret->alloc(nodes.size(),1);
std::copy(nodes.begin(),nodes.end(),ret->getPointer());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
int spaceDim=self->getSpaceDimension();
const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
- DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ DataArrayIdType *ret=self->getNodeIdsNearPoint(pos,eps);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
- PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const
+ PyObject *getNodeIdsNearPoints(PyObject *pt, mcIdType nbOfPoints, double eps) const
{
- DataArrayInt *c=0,*cI=0;
+ DataArrayIdType *c=0,*cI=0;
//
double val;
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
int spaceDim=self->getSpaceDimension();
const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const
{
- DataArrayInt *c=0,*cI=0;
+ DataArrayIdType *c=0,*cI=0;
int spaceDim=self->getSpaceDimension();
double val;
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
- int nbOfTuples=-1;
+ mcIdType sw;
+ mcIdType nbOfTuples=-1;
const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
//
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
int spaceDim=self->getSpaceDimension();
const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
//
- DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
- return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ DataArrayIdType *elems=self->getCellsInBoundingBox(tmp,eps);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
void duplicateNodesInCoords(PyObject *li)
{
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
+ mcIdType sw;
+ mcIdType singleVal;
+ std::vector<mcIdType> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 4:
return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
default:
- throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
+ throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
}
}
- virtual PyObject *findCommonCells(int compType, int startCellId=0) const
+ virtual PyObject *findCommonCells(int compType, mcIdType startCellId=0) const
{
- DataArrayInt *v0(nullptr),*v1(nullptr);
+ DataArrayIdType *v0(nullptr),*v1(nullptr);
self->findCommonCells(compType,startCellId,v0,v1);
PyObject *res = PyList_New(2);
- PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return res;
}
return ;
}
}
- int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ));
+ int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 ));
if (!SWIG_IsOK(res1))
{
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
self->renumberNodesInConn(tmp);
}
else
{
- DataArrayInt *da2(reinterpret_cast< DataArrayInt * >(da));
+ DataArrayIdType *da2(reinterpret_cast< DataArrayIdType * >(da));
if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
da2->checkAllocated();
self->renumberNodesInConn(da2->getConstPointer());
}
virtual PyObject *getNodeIdsInUse() const
{
- int ret1=-1;
- DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
+ mcIdType ret1=-1;
+ DataArrayIdType *ret0=self->getNodeIdsInUse(ret1);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
return ret;
}
- virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
+ virtual DataArrayIdType *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
{
- DataArrayInt *ret(nullptr);
+ DataArrayIdType *ret(nullptr);
//
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
return ret;
}
virtual PyObject *mergeNodes(double precision)
{
bool ret1;
- int ret2;
- DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
+ mcIdType ret2;
+ DataArrayIdType *ret0=self->mergeNodes(precision,ret1,ret2);
PyObject *res = PyList_New(3);
- PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyList_SetItem(res,1,SWIG_From_bool(ret1));
- PyList_SetItem(res,2,SWIG_From_int(ret2));
+ PyList_SetItem(res,2,PyInt_FromLong(ret2));
return res;
}
virtual PyObject *mergeNodesCenter(double precision)
{
bool ret1;
- int ret2;
- DataArrayInt *ret0=self->mergeNodesCenter(precision,ret1,ret2);
+ mcIdType ret2;
+ DataArrayIdType *ret0=self->mergeNodesCenter(precision,ret1,ret2);
PyObject *res = PyList_New(3);
- PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyList_SetItem(res,1,SWIG_From_bool(ret1));
- PyList_SetItem(res,2,SWIG_From_int(ret2));
+ PyList_SetItem(res,2,PyInt_FromLong(ret2));
return res;
}
- DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const
+ DataArrayIdType *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
if (!SWIG_IsOK(res1))
{
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
+ return self->getCellIdsLyingOnNodes(tmp,((const mcIdType *)tmp)+size,fullyIn);
}
else
{
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
da2->checkAllocated();
return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
}
MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI)
{
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- int nbc=self->getNumberOfCells();
+ mcIdType sw;
+ mcIdType singleVal;
+ std::vector<mcIdType> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
+ mcIdType nbc=self->getNumberOfCells();
convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
{
if(nbc+singleVal>0)
{
- int tmp=nbc+singleVal;
+ mcIdType tmp=nbc+singleVal;
return self->buildPartOfMySelf(&tmp,&tmp+1,true);
}
else
return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
}
default:
- throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
}
}
- static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords)
+ static void Rotate2DAlg(PyObject *center, double angle, mcIdType nbNodes, PyObject *coords)
{
- int sz;
+ mcIdType sz;
INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo);
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
}
static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords)
{
- int sz;
+ mcIdType sz;
INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
- int sw,nbNodes=0;
+ mcIdType sw,nbNodes=0;
double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
std::vector<double> val3;
const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast<double *>(coo));
}
- static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords)
+ static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, mcIdType nbNodes, PyObject *coords)
{
- int sz,sz2;
+ mcIdType sz,sz2;
INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo);
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
}
static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords)
{
- int sz,sz2;
+ mcIdType sz,sz2;
INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
- int sw,nbNodes=0;
+ mcIdType sw,nbNodes=0;
double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
std::vector<double> val3;
const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
PyObject *getAllConn() const
{
- int ret2;
- const int *r=self->getAllConn(ret2);
+ mcIdType ret2;
+ const mcIdType *r=self->getAllConn(ret2);
PyObject *ret=PyTuple_New(ret2);
- for(int i=0;i<ret2;i++)
+ for(mcIdType i=0;i<ret2;i++)
PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
return ret;
}
void allocateCells(int nbOfCells=0);
void finishInsertingCells();
MEDCouplingUMeshCellByTypeEntry *cellsByType();
- void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true);
+ void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true);
INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
int getNodalConnectivityArrayLen() const;
std::string reprConnectivityOfThis() const;
MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const;
//tools
- DataArrayInt *conformize2D(double eps);
- DataArrayInt *conformize3D(double eps);
- DataArrayInt *colinearize2D(double eps);
- DataArrayInt *colinearizeKeepingConform2D(double eps);
+ DataArrayIdType *conformize2D(double eps);
+ DataArrayIdType *conformize3D(double eps);
+ DataArrayIdType *colinearize2D(double eps);
+ DataArrayIdType *colinearizeKeepingConform2D(double eps);
void shiftNodeNumbersInConn(int delta);
std::vector<bool> getQuadraticStatus() const;
- DataArrayInt *findCellIdsOnBoundary() const;
+ DataArrayIdType *findCellIdsOnBoundary() const;
MEDCouplingUMesh *computeSkin() const;
bool checkConsecutiveCellTypes() const;
bool checkConsecutiveCellTypesForMEDFileFrmt() const;
- DataArrayInt *rearrange2ConsecutiveCellTypes();
- DataArrayInt *sortCellsInMEDFileFrmt();
- DataArrayInt *getRenumArrForMEDFileFrmt() const;
- DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const;
- MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
- MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
- MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
- MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
+ DataArrayIdType *rearrange2ConsecutiveCellTypes();
+ DataArrayIdType *sortCellsInMEDFileFrmt();
+ DataArrayIdType *getRenumArrForMEDFileFrmt() const;
+ DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const;
+ MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
+ MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
+ MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
+ MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
void orientCorrectlyPolyhedrons();
bool isPresenceOfQuadratic() const;
bool isFullyQuadratic() const;
bool isContiguous1D() const;
void tessellate2D(double eps);
void convertQuadraticCellsToLinear();
- DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0);
+ DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0);
void convertDegeneratedCells();
- DataArrayInt *convertDegeneratedCellsAndRemoveFlatOnes();
+ DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes();
bool removeDegenerated1DCells();
bool areOnlySimplexCells() const;
MEDCouplingFieldDouble *getEdgeRatioField() const;
MEDCouplingFieldDouble *getWarpField() const;
MEDCouplingFieldDouble *getSkewField() const;
DataArrayDouble *computePlaneEquationOf3DFaces() const;
- DataArrayInt *convexEnvelop2D();
+ DataArrayIdType *convexEnvelop2D();
std::string cppRepr() const;
- DataArrayInt *findAndCorrectBadOriented3DExtrudedCells();
- DataArrayInt *findAndCorrectBadOriented3DCells();
+ DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells();
+ DataArrayIdType *findAndCorrectBadOriented3DCells();
MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
MEDCouplingSkyLineArray *generateGraph() const;
- DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const;
- DataArrayInt *buildUnionOf2DMesh() const;
- DataArrayInt *buildUnionOf3DMesh() const;
- DataArrayInt *orderConsecutiveCells1D() const;
+ DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const;
+ DataArrayIdType *buildUnionOf2DMesh() const;
+ DataArrayIdType *buildUnionOf3DMesh() const;
+ DataArrayIdType *orderConsecutiveCells1D() const;
DataArrayDouble *getBoundingBoxForBBTreeFast() const;
DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
void changeOrientationOfCells();
DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps);
- int split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt=0, const DataArrayInt *midOptI=0);
+ int split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0);
static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
- static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn);
- static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code);
+ static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
+ static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code);
%extend {
MEDCouplingUMesh()
{
void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
{
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- int nbc=self->getNumberOfCells();
+ mcIdType sw;
+ mcIdType singleVal;
+ std::vector<mcIdType> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
+ mcIdType nbc=self->getNumberOfCells();
convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
{
if(nbc+singleVal>0)
{
- int tmp=nbc+singleVal;
+ mcIdType tmp=nbc+singleVal;
self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
break;
}
break;
}
default:
- throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
}
}
void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
{
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- int nbc=self->getNumberOfCells();
+ mcIdType sw;
+ mcIdType singleVal;
+ std::vector<mcIdType> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
+ mcIdType nbc=self->getNumberOfCells();
convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
{
if(nbc+singleVal>0)
{
- int tmp=nbc+singleVal;
+ mcIdType tmp=nbc+singleVal;
self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
break;
}
break;
}
default:
- throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayIdType instance !");
}
}
- void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li)
+ void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, PyObject *li)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
if(size>szArr)
{
std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->insertNextCell(type,szArr,tmp);
}
- DataArrayInt *getNodalConnectivity()
+ DataArrayIdType *getNodalConnectivity()
{
- DataArrayInt *ret=self->getNodalConnectivity();
+ DataArrayIdType *ret=self->getNodalConnectivity();
if(ret)
ret->incrRef();
return ret;
}
- DataArrayInt *getNodalConnectivityIndex()
+ DataArrayIdType *getNodalConnectivityIndex()
{
- DataArrayInt *ret=self->getNodalConnectivityIndex();
+ DataArrayIdType *ret=self->getNodalConnectivityIndex();
if(ret)
ret->incrRef();
return ret;
}
- static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1)
+ static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling=-1)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
- int nbOfDepthPeelingPerformed=0;
- DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType nbOfDepthPeelingPerformed=0;
+ DataArrayIdType *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
PyObject *res=PyTuple_New(2);
- PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
return res;
}
- static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI)
+ static PyObject *FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI)
{
- DataArrayInt *v0=0,*v1=0;
+ DataArrayIdType *v0=0,*v1=0;
MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
PyObject *res = PyList_New(2);
- PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return res;
}
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
int nbOfCompo=self->getSpaceDimension();
const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
//
- int cellId=-1;
+ mcIdType cellId=-1;
double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
PyObject *distanceToPoints(const DataArrayDouble *pts) const
{
- DataArrayInt *ret1=0;
+ DataArrayIdType *ret1=0;
DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *tetrahedrize(int policy)
{
- int ret2(-1);
- DataArrayInt *ret1(0);
+ mcIdType ret2(-1);
+ DataArrayIdType *ret1(0);
MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
PyObject *ret=PyTuple_New(3);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
return ret;
}
PyObject *checkButterflyCells(double eps=1e-12)
{
- std::vector<int> cells;
+ std::vector<mcIdType> cells;
self->checkButterflyCells(cells,eps);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)cells.size(),1);
+ DataArrayIdType *ret=DataArrayIdType::New();
+ ret->alloc(cells.size(),1);
std::copy(cells.begin(),cells.end(),ret->getPointer());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *splitByType() const
{
std::vector<MEDCouplingUMesh *> ms=self->splitByType();
- int sz=ms.size();
+ std::size_t sz=ms.size();
PyObject *ret = PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *partitionBySpreadZone() const
{
- std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
- int sz=retCpp.size();
+ std::vector<DataArrayIdType *> retCpp=self->partitionBySpreadZone();
+ std::size_t sz=retCpp.size();
PyObject *ret=PyList_New(sz);
- for(int i=0;i<sz;i++)
- PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
- static PyObject *PartitionBySpreadZone(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn)
+ static PyObject *PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn)
{
- std::vector<DataArrayInt *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
- int sz=retCpp.size();
+ std::vector<DataArrayIdType *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
+ std::size_t sz=retCpp.size();
PyObject *ret=PyList_New(sz);
- for(int i=0;i<sz;i++)
- PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const
{
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(ids,&size);
MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
}
bool checkConsecutiveCellTypesAndOrder(PyObject *li) const
{
- int sz;
- INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
+ mcIdType sz;
+ INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
return ret;
}
- DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
+ DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
{
- int sz;
- INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
- DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
+ mcIdType sz;
+ INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
+ DataArrayIdType *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
return ret;
}
PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
{
- DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
+ DataArrayIdType *tmp0=0,*tmp1=0,*tmp2=0;
self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
PyObject *ret=PyTuple_New(3);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
{
- DataArrayInt *tmp0=0,*tmp1=0;
+ DataArrayIdType *tmp0=0,*tmp1=0;
self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
void duplicateNodes(PyObject *li)
{
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
+ mcIdType sw;
+ mcIdType singleVal;
+ std::vector<mcIdType> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 4:
return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
default:
- throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
}
}
- void duplicateNodesInConn(PyObject *li, int offset)
+ void duplicateNodesInConn(PyObject *li, mcIdType offset)
{
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
+ mcIdType sw;
+ mcIdType singleVal;
+ std::vector<mcIdType> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 4:
return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
default:
- throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
}
}
void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr);
}
PyObject *getLevArrPerCellTypes(PyObject *li) const
{
- int sz;
- INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
- DataArrayInt *tmp0,*tmp1=0;
+ mcIdType sz;
+ INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
+ DataArrayIdType *tmp0,*tmp1=0;
tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const
{
- DataArrayInt *ret0=0,*ret1=0;
+ DataArrayIdType *ret0=0,*ret1=0;
self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
{
std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
- DataArrayInt *ret1=0,*ret2=0;
+ DataArrayIdType *ret1=0,*ret2=0;
MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
PyObject *ret=PyTuple_New(3);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType)
{
- int sz;
+ std::size_t sz;
std::vector<const MEDCouplingUMesh *> meshes;
convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
- std::vector<DataArrayInt *> corr;
+ std::vector<DataArrayIdType *> corr;
MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
sz=corr.size();
PyObject *ret1=PyList_New(sz);
- for(int i=0;i<sz;i++)
- PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyObject *ret=PyList_New(2);
PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
PyList_SetItem(ret,1,ret1);
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
int spaceDim=self->getSpaceDimension();
const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
//
- std::vector<int> cells;
+ std::vector<mcIdType> cells;
self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)cells.size(),1);
+ DataArrayIdType *ret=DataArrayIdType::New();
+ ret->alloc(cells.size(),1);
std::copy(cells.begin(),cells.end(),ret->getPointer());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
void orientCorrectly2DCells(PyObject *vec, bool polyOnly)
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
int spaceDim=self->getSpaceDimension();
const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
PyObject *arePolyhedronsNotCorrectlyOriented() const
{
- std::vector<int> cells;
+ std::vector<mcIdType> cells;
self->arePolyhedronsNotCorrectlyOriented(cells);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)cells.size(),1);
+ DataArrayIdType *ret=DataArrayIdType::New();
+ ret->alloc(cells.size(),1);
std::copy(cells.begin(),cells.end(),ret->getPointer());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *getFastAveragePlaneOfThis() const
PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const
{
- DataArrayInt *ret1;
+ DataArrayIdType *ret1;
bool ret0=self->areCellsIncludedIn(other,compType,ret1);
PyObject *ret=PyTuple_New(2);
PyObject *ret0Py=ret0?Py_True:Py_False;
Py_XINCREF(ret0Py);
PyTuple_SetItem(ret,0,ret0Py);
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const
{
- DataArrayInt *ret1;
+ DataArrayIdType *ret1;
bool ret0=self->areCellsIncludedInPolicy7(other,ret1);
PyObject *ret=PyTuple_New(2);
PyObject *ret0Py=ret0?Py_True:Py_False;
Py_XINCREF(ret0Py);
PyTuple_SetItem(ret,0,ret0Py);
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *explode3DMeshTo1D() const
{
- MCAuto<DataArrayInt> d0=DataArrayInt::New();
- MCAuto<DataArrayInt> d1=DataArrayInt::New();
- MCAuto<DataArrayInt> d2=DataArrayInt::New();
- MCAuto<DataArrayInt> d3=DataArrayInt::New();
+ MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
PyObject *ret=PyTuple_New(5);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *explodeIntoEdges() const
{
- MCAuto<DataArrayInt> desc,descIndex,revDesc,revDescIndx;
+ MCAuto<DataArrayIdType> desc,descIndex,revDesc,revDescIndx;
MCAuto<MEDCouplingUMesh> m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx));
PyObject *ret=PyTuple_New(5);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *explodeMeshIntoMicroEdges() const
{
- MCAuto<DataArrayInt> d0=DataArrayInt::New();
- MCAuto<DataArrayInt> d1=DataArrayInt::New();
- MCAuto<DataArrayInt> d2=DataArrayInt::New();
- MCAuto<DataArrayInt> d3=DataArrayInt::New();
+ MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3);
PyObject *ret=PyTuple_New(5);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *buildDescendingConnectivity() const
{
- MCAuto<DataArrayInt> d0=DataArrayInt::New();
- MCAuto<DataArrayInt> d1=DataArrayInt::New();
- MCAuto<DataArrayInt> d2=DataArrayInt::New();
- MCAuto<DataArrayInt> d3=DataArrayInt::New();
+ MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
PyObject *ret=PyTuple_New(5);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *buildDescendingConnectivity2() const
{
- MCAuto<DataArrayInt> d0=DataArrayInt::New();
- MCAuto<DataArrayInt> d1=DataArrayInt::New();
- MCAuto<DataArrayInt> d2=DataArrayInt::New();
- MCAuto<DataArrayInt> d3=DataArrayInt::New();
+ MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
PyObject *ret=PyTuple_New(5);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *computeNeighborsOfCells() const
{
- DataArrayInt *neighbors=0,*neighborsIdx=0;
+ DataArrayIdType *neighbors=0,*neighborsIdx=0;
self->computeNeighborsOfCells(neighbors,neighborsIdx);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *computeNeighborsOfNodes() const
{
- DataArrayInt *neighbors=0,*neighborsIdx=0;
+ DataArrayIdType *neighbors=0,*neighborsIdx=0;
self->computeNeighborsOfNodes(neighbors,neighborsIdx);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *computeEnlargedNeighborsOfNodes() const
{
- MCAuto<DataArrayInt> neighbors,neighborsIdx;
+ MCAuto<DataArrayIdType> neighbors,neighborsIdx;
self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
- PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayInt *nodeNeigh, const DataArrayInt *nodeNeighI) const
+ PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI) const
{
- MCAuto<DataArrayInt> cellNeigh,cellNeighIndex;
+ MCAuto<DataArrayIdType> cellNeigh,cellNeighIndex;
self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
- static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI)
+ static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI)
{
- DataArrayInt *neighbors=0,*neighborsIdx=0;
+ DataArrayIdType *neighbors=0,*neighborsIdx=0;
MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
{
- MCAuto<DataArrayInt> d0=DataArrayInt::New();
- MCAuto<DataArrayInt> d1=DataArrayInt::New();
- DataArrayInt *d2,*d3,*d4,*dd5;
+ MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
+ MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
+ DataArrayIdType *d2,*d3,*d4,*dd5;
MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
PyObject *ret=PyTuple_New(7);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
- DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const
+ DataArrayDouble *getPartBarycenterAndOwner(DataArrayIdType *da) const
{
if(!da)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
da->checkAllocated();
return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
}
- DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const
+ DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayIdType *da) const
{
if(!da)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
da->checkAllocated();
return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
}
- MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const
+ MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayIdType *da) const
{
if(!da)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
da->checkAllocated();
return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
}
- PyObject *getTypesOfPart(DataArrayInt *da) const
+ PyObject *getTypesOfPart(DataArrayIdType *da) const
{
if(!da)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
da->checkAllocated();
std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
return res;
}
- DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const
+ DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayIdType *da) const
{
if(!da)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
da->checkAllocated();
- DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
+ DataArrayIdType *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
ret->setName(da->getName().c_str());
return ret;
}
static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps)
{
- DataArrayInt *cellNb1=0,*cellNb2=0;
+ DataArrayIdType *cellNb1=0,*cellNb2=0;
MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
PyObject *ret=PyTuple_New(3);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps)
{
MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0);
- DataArrayInt *cellIdInMesh2D(0),*cellIdInMesh1D(0);
+ DataArrayIdType *cellIdInMesh2D(0),*cellIdInMesh1D(0);
MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D);
PyObject *ret(PyTuple_New(4));
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
DataArrayDouble *a,*a2;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin.";
const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector.";
const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
//
- DataArrayInt *cellIds=0;
+ DataArrayIdType *cellIds=0;
MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
DataArrayDouble *a,*a2;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin.";
const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector.";
const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
//
- DataArrayInt *cellIds=0;
+ DataArrayIdType *cellIds=0;
MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
DataArrayDouble *a,*a2;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin.";
const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector.";
const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
return ret.retn();
}
- DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const
+ DataArrayIdType *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const
{
int spaceDim=self->getSpaceDimension();
if(spaceDim!=3)
DataArrayDouble *a,*a2;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin.";
const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector.";
const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
void convertToPolyTypes(PyObject *li)
{
- int sw;
- int pos1;
- std::vector<int> pos2;
- DataArrayInt *pos3=0;
- DataArrayIntTuple *pos4=0;
+ mcIdType sw;
+ mcIdType pos1;
+ std::vector<mcIdType> pos2;
+ DataArrayIdType *pos3=0;
+ DataArrayIdTypeTuple *pos4=0;
convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
switch(sw)
{
MEDCouplingUMesh *build3DUnstructuredMesh() const;
int get2DCellIdForExtrusion() const;
%extend {
- MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId)
+ MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId)
{
return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
}
}
PyObject *getMesh3DIds() const
{
- DataArrayInt *ret=self->getMesh3DIds();
+ DataArrayIdType *ret=self->getMesh3DIds();
if(ret)
ret->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
}
};
{
virtual void insertNextCell(PyObject *li)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->insertNextCell(tmp,tmp+szArr);
}
- virtual DataArrayInt *getNodalConnectivity() const
+ virtual DataArrayIdType *getNodalConnectivity() const
{
- DataArrayInt *ret=self->getNodalConnectivity();
+ DataArrayIdType *ret=self->getNodalConnectivity();
if(ret) ret->incrRef();
return ret;
}
public:
static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m);
- void setNodalConnectivity(DataArrayInt *nodalConn);
+ void setNodalConnectivity(DataArrayIdType *nodalConn);
int getNumberOfNodesPerCell() const;
static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
MEDCoupling1GTUMesh *computeDualMesh() const;
MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const;
- DataArrayInt *sortHexa8EachOther();
+ DataArrayIdType *sortHexa8EachOther();
%extend
{
MEDCoupling1SGTUMesh()
PyObject *structurizeMe(double eps=1e-12) const
{
- DataArrayInt *cellPerm(0),*nodePerm(0);
+ DataArrayIdType *cellPerm(0),*nodePerm(0);
MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
PyObject *ret(PyTuple_New(3));
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
public:
static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m);
- void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex);
+ void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex);
MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
bool isPacked() const;
%extend
return oss.str();
}
- DataArrayInt *getNodalConnectivityIndex() const
+ DataArrayIdType *getNodalConnectivityIndex() const
{
- DataArrayInt *ret=self->getNodalConnectivityIndex();
+ DataArrayIdType *ret=self->getNodalConnectivityIndex();
if(ret) ret->incrRef();
return ret;
}
PyObject *retrievePackedNodalConnectivity() const
{
- DataArrayInt *ret1=0,*ret2=0;
+ DataArrayIdType *ret1=0,*ret2=0;
bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
PyObject *ret0Py=ret0?Py_True:Py_False;
Py_XINCREF(ret0Py);
PyObject *ret=PyTuple_New(3);
PyTuple_SetItem(ret,0,ret0Py);
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
}
- static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt)
+ static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<mcIdType>& offsetInNodeIdsPerElt)
{
- std::vector<const MEDCoupling::DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
+ std::vector<const MEDCoupling::DataArrayIdType *> tmp;
+ convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",tmp);
return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
}
}
class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh
{
public:
- int getCellIdFromPos(int i, int j, int k) const;
- int getNodeIdFromPos(int i, int j, int k) const;
- int getNumberOfCellsOfSubLevelMesh() const;
+ mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
+ mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
+ mcIdType getNumberOfCellsOfSubLevelMesh() const;
int getSpaceDimensionOnNodeStruct() const;
double computeSquareness() const;
- virtual std::vector<int> getNodeGridStructure() const;
- std::vector<int> getCellGridStructure() const;
+ virtual std::vector<mcIdType> getNodeGridStructure() const;
+ std::vector<mcIdType> getCellGridStructure() const;
MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
- std::vector<int> getLocationFromCellId(int cellId) const;
- std::vector<int> getLocationFromNodeId(int cellId) const;
+ std::vector<mcIdType> getLocationFromCellId(mcIdType cellId) const;
+ std::vector<mcIdType> getLocationFromNodeId(mcIdType cellId) const;
static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
- static int DeduceNumberOfGivenStructure(const std::vector<int>& st);
- static DataArrayInt *ComputeCornersGhost(const std::vector<int>& st, int ghostLev);
- static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct);
+ static mcIdType DeduceNumberOfGivenStructure(const std::vector<mcIdType>& st);
+ static DataArrayIdType *ComputeCornersGhost(const std::vector<mcIdType>& st, mcIdType ghostLev);
+ static std::vector<mcIdType> GetSplitVectFromStruct(const std::vector<mcIdType>& strct);
%extend
{
virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const
{
- int tmpp1=-1,tmpp2=-1;
- std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
- std::vector< std::pair<int,int> > inp;
+ mcIdType tmpp1=-1,tmpp2=-1;
+ std::vector<mcIdType> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
if(tmpp2==2)
{
inp.resize(tmpp1);
- for(int i=0;i<tmpp1;i++)
+ for(mcIdType i=0;i<tmpp1;i++)
{ inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
}
else if(tmpp2==1)
if(tmpp1%2!=0)
throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
inp.resize(tmpp1/2);
- for(int i=0;i<tmpp1/2;i++)
+ for(mcIdType i=0;i<tmpp1/2;i++)
{ inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
}
else
return self->buildStructuredSubPart(inp);
}
- static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part)
+ static DataArrayIdType *BuildExplicitIdsFrom(PyObject *st, PyObject *part)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(part,inp);
//
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
- std::vector<int> tmp5(tmp4,tmp4+szArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
+ std::vector<mcIdType> tmp5(tmp4,tmp4+szArr);
//
return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
}
- static void MultiplyPartOf(const std::vector<int>& st, PyObject *part, double factor, DataArrayDouble *da)
+ static void MultiplyPartOf(const std::vector<mcIdType>& st, PyObject *part, double factor, DataArrayDouble *da)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(part,inp);
MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
}
- static void MultiplyPartOfByGhost(const std::vector<int>& st, PyObject *part, int ghostSize, double factor, DataArrayDouble *da)
+ static void MultiplyPartOfByGhost(const std::vector<mcIdType>& st, PyObject *part, mcIdType ghostSize, double factor, DataArrayDouble *da)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(part,inp);
MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
}
- static PyObject *PutInGhostFormat(int ghostSize, const std::vector<int>& st, PyObject *part)
+ static PyObject *PutInGhostFormat(mcIdType ghostSize, const std::vector<mcIdType>& st, PyObject *part)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(part,inp);
- std::vector<int> stWithGhost;
- std::vector< std::pair<int,int> > partWithGhost;
+ std::vector<mcIdType> stWithGhost;
+ std::vector< std::pair<mcIdType,mcIdType> > partWithGhost;
MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
PyObject *ret(PyTuple_New(2));
PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
return ret;
}
- static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<int>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat)
+ static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<mcIdType>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(partCompactFormat,inp);
return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
}
- static void AssignPartOfFieldOfDoubleUsing(const std::vector<int>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other)
+ static void AssignPartOfFieldOfDoubleUsing(const std::vector<mcIdType>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(partCompactFormat,inp);
MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other);
}
- static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part)
+ static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(part,inp);
return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
}
- static DataArrayInt *Build1GTNodalConnectivity(PyObject *li)
+ static DataArrayIdType *Build1GTNodalConnectivity(PyObject *li)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
}
- static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li)
+ static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
}
- static std::vector<int> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat)
+ static std::vector<mcIdType> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(partCompactFormat,inp);
return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
}
- static PyObject *GetCompactFrmtFromDimensions(const std::vector<int>& dims)
+ static PyObject *GetCompactFrmtFromDimensions(const std::vector<mcIdType>& dims)
{
- std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
+ std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
PyObject *retPy=PyList_New(ret.size());
for(std::size_t i=0;i<ret.size();i++)
{
static PyObject *IntersectRanges(PyObject *r1, PyObject *r2)
{
- std::vector< std::pair<int,int> > r1Cpp,r2Cpp;
+ std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
convertPyToVectorPairInt(r1,r1Cpp);
convertPyToVectorPairInt(r2,r2Cpp);
- std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
+ std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
PyObject *retPy=PyList_New(ret.size());
for(std::size_t i=0;i<ret.size();i++)
{
static bool AreRangesIntersect(PyObject *r1, PyObject *r2)
{
- std::vector< std::pair<int,int> > r1Cpp,r2Cpp;
+ std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
convertPyToVectorPairInt(r1,r1Cpp);
convertPyToVectorPairInt(r2,r2Cpp);
return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp);
static PyObject *IsPartStructured(PyObject *li, PyObject *st)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
- int szArr2,sw2,iTypppArr2;
- std::vector<int> stdvecTyyppArr2;
- const int *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
- std::vector<int> tmp3(tmp2,tmp2+szArr2);
- std::vector< std::pair<int,int> > partCompactFormat;
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr2,sw2,iTypppArr2;
+ std::vector<mcIdType> stdvecTyyppArr2;
+ const mcIdType *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
+ std::vector<mcIdType> tmp3(tmp2,tmp2+szArr2);
+ std::vector< std::pair<mcIdType,mcIdType> > partCompactFormat;
bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
PyObject *ret=PyTuple_New(2);
PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true)
{
- std::vector< std::pair<int,int> > param0,param1,ret;
+ std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
convertPyToVectorPairInt(bigInAbs,param0);
convertPyToVectorPairInt(partOfBigInAbs,param1);
MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
return retPy;
}
- static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<int>& translation)
+ static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<mcIdType>& translation)
{
- std::vector< std::pair<int,int> > param0;
+ std::vector< std::pair<mcIdType,mcIdType> > param0;
convertPyToVectorPairInt(part,param0);
- std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
+ std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
PyObject *retPy(PyList_New(ret.size()));
for(std::size_t i=0;i<ret.size();i++)
{
return retPy;
}
- static std::vector<int> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo)
+ static std::vector<mcIdType> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo)
{
- std::vector< std::pair<int,int> > param0,param1;
+ std::vector< std::pair<mcIdType,mcIdType> > param0,param1;
convertPyToVectorPairInt(startingFrom,param0);
convertPyToVectorPairInt(goingTo,param1);
return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true)
{
- std::vector< std::pair<int,int> > param0,param1,ret;
+ std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
convertPyToVectorPairInt(bigInAbs,param0);
convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
}
void setNodeGridStructure(PyObject *gridStruct)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
self->setNodeGridStructure(tmp,tmp+szArr);
}
}
static MEDCouplingIMesh *New();
//
void setSpaceDimension(int spaceDim);
- std::vector<int> getNodeStruct() const;
+ std::vector<mcIdType> getNodeStruct() const;
std::vector<double> getOrigin() const;
std::vector<double> getDXYZ() const;
void setAxisUnit(const std::string& unitName);
std::string getAxisUnit() const;
double getMeasureOfAnyCell() const;
MEDCouplingCMesh *convertToCartesian() const;
- void refineWithFactor(const std::vector<int>& factors);
+ void refineWithFactor(const std::vector<mcIdType>& factors);
MEDCouplingIMesh *asSingleCell() const;
- MEDCouplingIMesh *buildWithGhost(int ghostLev) const;
+ MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const;
%extend
{
MEDCouplingIMesh()
{
static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
- const int *nodeStrctPtr(0);
+ const mcIdType *nodeStrctPtr(0);
const double *originPtr(0),*dxyzPtr(0);
- int sw,sz,val0;
- std::vector<int> bb0;
+ mcIdType sw,sz,val0;
+ std::vector<mcIdType> bb0;
nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
//
double val,val2;
std::vector<double> bb,bb2;
- int sz1,sz2;
+ mcIdType sz1,sz2;
originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
//
void setNodeStruct(PyObject *nodeStrct)
{
- int sw,sz,val0;
- std::vector<int> bb0;
- const int *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
+ mcIdType sw,sz,val0;
+ std::vector<mcIdType> bb0;
+ const mcIdType *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
}
{
static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw,nbTuples;
+ mcIdType sw,nbTuples;
const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
self->setOrigin(originPtr,originPtr+nbTuples);
}
{
static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw,nbTuples;
+ mcIdType sw,nbTuples;
const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
self->setDXYZ(originPtr,originPtr+nbTuples);
}
- static void CondenseFineToCoarse(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA)
+ static void CondenseFineToCoarse(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(fineLocInCoarse,inp);
MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
}
- static void CondenseFineToCoarseGhost(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA, int ghostSize)
+ static void CondenseFineToCoarseGhost(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA, mcIdType ghostSize)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(fineLocInCoarse,inp);
MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
}
- static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts)
+ static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(fineLocInCoarse,inp);
MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
}
- static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, int ghostSize)
+ static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(fineLocInCoarse,inp);
MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
}
- static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, int ghostSize)
+ static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(fineLocInCoarse,inp);
MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
}
virtual void setNature(NatureOfField nat);
DataArrayDouble *getLocalizationOfDiscr() const;
MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
- int getNumberOfTuplesExpected() const;
- int getNumberOfMeshPlacesExpected() const;
+ mcIdType getNumberOfTuplesExpected() const;
+ mcIdType getNumberOfMeshPlacesExpected() const;
void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg);
void clearGaussLocalizations();
MEDCouplingGaussLocalization& getGaussLocalization(int locId);
- int getNbOfGaussLocalization() const;
- int getGaussLocalizationIdOfOneCell(int cellId) const;
+ mcIdType getNbOfGaussLocalization() const;
+ mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
- int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
+ mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
%extend {
PyObject *getMesh() const
PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
{
- std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
+ std::set<mcIdType> ret=self->getGaussLocalizationIdsOfOneType(type);
return convertIntArrToPyList3(ret);
}
PyObject *buildSubMeshData(PyObject *li) const
{
- DataArrayInt *ret1=0;
+ DataArrayIdType *ret1=0;
MEDCouplingMesh *ret0=0;
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
if (!SWIG_IsOK(res1))
{
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
}
else
{
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
da2->checkAllocated();
ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
}
PyObject *res = PyList_New(2);
PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
+ PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
return res;
}
- PyObject *buildSubMeshDataRange(int begin, int end, int step) const
+ PyObject *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step) const
{
- DataArrayInt *ret1=0;
- int bb,ee,ss;
+ DataArrayIdType *ret1=0;
+ mcIdType bb,ee,ss;
MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
PyObject *res=PyTuple_New(2);
PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
if(ret1)
- PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
+ PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
else
{
PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
return res;
}
- DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
+ DataArrayIdType *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
{
- int sw,sz(-1);
- int v0; std::vector<int> v1;
- const int *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
+ mcIdType sw,sz(-1);
+ mcIdType v0; std::vector<mcIdType> v1;
+ const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
}
const std::vector<double>& gsCoo, const std::vector<double>& wg)
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
if (!SWIG_IsOK(res1))
{
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
+ self->setGaussLocalizationOnCells(tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg);
}
else
{
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
da2->checkAllocated();
self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
}
PyObject *getCellIdsHavingGaussLocalization(int locId) const
{
- std::vector<int> tmp;
+ std::vector<mcIdType> tmp;
self->getCellIdsHavingGaussLocalization(locId,tmp);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)tmp.size(),1);
+ DataArrayIdType *ret=DataArrayIdType::New();
+ ret->alloc((mcIdType)tmp.size(),1);
std::copy(tmp.begin(),tmp.end(),ret->getPointer());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
- int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
+ mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
{
- std::vector<int> inp0;
+ std::vector<mcIdType> inp0;
convertPyToNewIntArr4(code,1,3,inp0);
- std::vector<const DataArrayInt *> inp1;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(idsPerType,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",inp1);
+ std::vector<const DataArrayIdType *> inp1;
+ convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(idsPerType,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",inp1);
return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
}
}
MEDCouplingFieldDouble *deviator() const;
MEDCouplingFieldDouble *magnitude() const;
MEDCouplingFieldDouble *maxPerTuple() const;
- void changeNbOfComponents(int newNbOfComp, double dftValue=0.);
+ void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.);
void sortPerTuple(bool asc);
MEDCouplingFieldDouble &operator=(double value);
void fillFromAnalytic(int nbOfComp, const std::string& func);
double normL1(int compId) const;
double normL2(int compId) const;
double normMax(int compId) const;
- DataArrayInt *findIdsInRange(double vmin, double vmax) const;
+ DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const;
static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
DataArrayDouble *a,*a2;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
return self->computeVectorFieldCyl(centerPtr,vectorPtr);
for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
if(*it)
(*it)->incrRef();
- int sz=arrs.size();
+ std::size_t sz=arrs.size();
PyObject *ret=PyTuple_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
if(arrs[i])
PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
{
std::vector<const DataArrayDouble *> tmp;
convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
- int sz=tmp.size();
+ std::size_t sz=tmp.size();
std::vector<DataArrayDouble *> arrs(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
self->setArrays(arrs);
}
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
const MEDCouplingMesh *mesh=self->getMesh();
if(!mesh)
throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
//
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> res=new double[sz];
self->getValueOn(spaceLoc,res);
return convertDblArrToPyList<double>(res,sz);
}
- PyObject *getValueOnPos(int i, int j, int k) const
+ PyObject *getValueOnPos(mcIdType i, mcIdType j, mcIdType k) const
{
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> res=new double[sz];
self->getValueOnPos(i,j,k,res);
return convertDblArrToPyList<double>(res,sz);
if(!mesh)
throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
//
- int sw,nbPts;
+ mcIdType sw,nbPts;
double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
mesh->getSpaceDimension(),true,nbPts);
- return self->getValueOnMulti(inp,nbPts);
+ return self->getValueOnMulti(inp,(int)nbPts);
}
PyObject *getValueOn(PyObject *sl, double time) const
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
const MEDCouplingMesh *mesh=self->getMesh();
if(!mesh)
throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
//
//
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> res=new double[sz];
self->getValueOn(spaceLoc,time,res);
return convertDblArrToPyList<double>(res,sz);
}
PyObject *accumulate() const
{
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->accumulate(tmp);
return convertDblArrToPyList<double>(tmp,sz);
}
PyObject *integral(bool isWAbs) const
{
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->integral(isWAbs,tmp);
return convertDblArrToPyList<double>(tmp,sz);
}
PyObject *getWeightedAverageValue(bool isWAbs=true) const
{
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->getWeightedAverageValue(tmp,isWAbs);
return convertDblArrToPyList<double>(tmp,sz);
}
PyObject *normL1() const
{
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->normL1(tmp);
return convertDblArrToPyList<double>(tmp,sz);
}
PyObject *normL2() const
{
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->normL2(tmp);
return convertDblArrToPyList<double>(tmp,sz);
}
PyObject *normMax() const
{
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->normMax(tmp);
return convertDblArrToPyList<double>(tmp,sz);
}
void renumberCells(PyObject *li, bool check=true)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->renumberCells(tmp,check);
}
void renumberCellsWithoutMesh(PyObject *li, bool check=true)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->renumberCellsWithoutMesh(tmp,check);
}
void renumberNodes(PyObject *li, double eps=1e-15)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->renumberNodes(tmp,eps);
}
- void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15)
+ void renumberNodesWithoutMesh(PyObject *li, mcIdType newNbOfNodes, double eps=1e-15)
{
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ mcIdType szArr,sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
}
PyObject *getMaxValue2() const
{
- DataArrayInt *tmp;
+ DataArrayIdType *tmp;
double r1=self->getMaxValue2(tmp);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *getMinValue2() const
{
- DataArrayInt *tmp;
+ DataArrayIdType *tmp;
double r1=self->getMinValue2(tmp);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const
{
- std::vector<int> tmp;
+ std::vector<std::size_t> tmp;
convertPyToNewIntArr3(li,tmp);
return self->keepSelectedComponents(tmp);
}
void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li)
{
- std::vector<int> tmp;
+ std::vector<std::size_t> tmp;
convertPyToNewIntArr3(li,tmp);
self->setSelectedComponents(f,tmp);
}
DataArrayDouble *a,*a2;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
int spaceDim=3;
const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin.";
const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector.";
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
self->getArray()->addEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
self->getArray()->substractEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
self->getArray()->divideEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
self->getArray()->powEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
{
std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
- int sz=tmp.size();
+ std::size_t sz=tmp.size();
std::vector<MEDCouplingFieldDouble *> fs(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
return MEDCouplingMultiFields::New(fs);
}
{
std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
- int sz=tmp.size();
+ std::size_t sz=tmp.size();
std::vector<MEDCouplingFieldDouble *> fs(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
return MEDCouplingMultiFields::New(fs);
}
PyObject *getFields() const
{
std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
- int sz=fields.size();
+ std::size_t sz=fields.size();
PyObject *res = PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
if(fields[i])
{
PyObject *getMeshes() const
{
std::vector<MEDCouplingMesh *> ms=self->getMeshes();
- int sz=ms.size();
+ std::size_t sz=ms.size();
PyObject *res = PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
if(ms[i])
{
{
std::vector<int> refs;
std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
- int sz=ms.size();
+ std::size_t sz=ms.size();
PyObject *res = PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
if(ms[i])
{
PyObject *getArrays() const
{
std::vector<DataArrayDouble *> ms=self->getArrays();
- int sz=ms.size();
+ std::size_t sz=ms.size();
PyObject *res = PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
if(ms[i])
{
{
std::vector< std::vector<int> > refs;
std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
- int sz=ms.size();
+ std::size_t sz=ms.size();
PyObject *res = PyList_New(sz);
PyObject *res2 = PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
if(ms[i])
{
void setTimeUnit(const std::string& unit);
std::string getTimeUnit() const;
void setTime(double val, int iteration, int order);
- void setArray(DataArrayInt *array);
+ void setArray(DataArrayInt32 *array);
MEDCouplingFieldInt *deepCopy() const;
MEDCouplingFieldInt *clone(bool recDeepCpy) const;
MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const;
return fieldT__getitem__(self,li);
}
- DataArrayInt *getArray()
+ DataArrayInt32 *getArray()
{
- DataArrayInt *ret=self->getArray();
+ DataArrayInt32 *ret=self->getArray();
if(ret)
ret->incrRef();
return ret;
{
std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
- int sz=tmp.size();
+ std::size_t sz=tmp.size();
std::vector<MEDCouplingFieldDouble *> fs(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
return MEDCouplingFieldOverTime::New(fs);
}
return self->simpleRepr();
}
static MEDCouplingFieldOverTime *New(PyObject *li)
- {
- std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
- int sz=tmp.size();
- std::vector<MEDCouplingFieldDouble *> fs(sz);
- for(int i=0;i<sz;i++)
- fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
- return MEDCouplingFieldOverTime::New(fs);
- }
+ {
+ std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
+ convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
+ std::size_t sz=tmp.size();
+ std::vector<MEDCouplingFieldDouble *> fs(sz);
+ for(std::size_t i=0;i<sz;i++)
+ fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
+ return MEDCouplingFieldOverTime::New(fs);
+ }
}
};
public:
int getNumberOfOverlapedCellsForFather() const;
bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
- std::vector<int> computeCellGridSt() const;
+ std::vector<mcIdType> computeCellGridSt() const;
%extend
{
PyObject *getBLTRRange() const
{
- const std::vector< std::pair<int,int> >& ret(self->getBLTRRange());
+ const std::vector< std::pair<mcIdType,mcIdType> >& ret(self->getBLTRRange());
return convertFromVectorPairInt(ret);
}
PyObject *getBLTRRangeRelativeToGF() const
{
- std::vector< std::pair<int,int> > ret(self->getBLTRRangeRelativeToGF());
+ std::vector< std::pair<mcIdType,mcIdType> > ret(self->getBLTRRangeRelativeToGF());
return convertFromVectorPairInt(ret);
}
- void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors)
+ void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(bottomLeftTopRight,inp);
self->addPatch(inp,factors);
}
- MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const
+ MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
{
const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
if(!mesh)
return ret;
}
- void __delitem__(int patchId)
+ void __delitem__(mcIdType patchId)
{
MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
if(!mesh)
mesh->removePatch(patchId);
}
- int __len__() const
+ mcIdType __len__() const
{
const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
if(!mesh)
class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
{
public:
- int getAbsoluteLevel() const;
- int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
- std::vector<int> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
+ mcIdType getAbsoluteLevel() const;
+ mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
+ std::vector<mcIdType> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
int getSpaceDimension() const;
- const std::vector<int>& getFactors() const;
- void setFactors(const std::vector<int>& newFactors);
- int getMaxNumberOfLevelsRelativeToThis() const;
- int getNumberOfCellsAtCurrentLevel() const;
- int getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const;
- int getNumberOfCellsRecursiveWithOverlap() const;
- int getNumberOfCellsRecursiveWithoutOverlap() const;
- bool isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const;
+ const std::vector<mcIdType>& getFactors() const;
+ void setFactors(const std::vector<mcIdType>& newFactors);
+ mcIdType getMaxNumberOfLevelsRelativeToThis() const;
+ mcIdType getNumberOfCellsAtCurrentLevel() const;
+ mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const;
+ mcIdType getNumberOfCellsRecursiveWithOverlap() const;
+ mcIdType getNumberOfCellsRecursiveWithoutOverlap() const;
+ bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const;
virtual void detachFromFather();
//
- int getNumberOfPatches() const;
- int getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
+ mcIdType getNumberOfPatches() const;
+ mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
MEDCouplingUMesh *buildUnstructured() const;
- DataArrayDouble *extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const;
- std::vector<int> getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const;
+ DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const;
+ std::vector<mcIdType> getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const;
MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const;
void removeAllPatches();
- void removePatch(int patchId);
- void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<int>& factors);
- void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<int>& factors, double eps);
- DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const;
- void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
- void fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev, bool isConservative=true) const;
- void fillCellFieldOnPatchOnlyOnGhostZone(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const;
- void fillCellFieldOnPatchOnlyOnGhostZoneWith(int ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
- void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
- void fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev, bool isConservative=true) const;
- DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const;
+ void removePatch(mcIdType patchId);
+ void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<mcIdType>& factors);
+ void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<mcIdType>& factors, double eps);
+ DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const;
+ void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
+ void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const;
+ void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const;
+ void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
+ void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
+ void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const;
+ DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
std::string buildPythonDumpOfThis() const;
%extend
{
- void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors)
+ void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
{
- std::vector< std::pair<int,int> > inp;
+ std::vector< std::pair<mcIdType,mcIdType> > inp;
convertPyToVectorPairInt(bottomLeftTopRight,inp);
self->addPatch(inp,factors);
}
PyObject *getPatches() const
{
std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
- int sz(ps.size());
+ std::size_t sz(ps.size());
PyObject *ret = PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
if(elt)
return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 );
}
- MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<int>& pos) const
+ MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<mcIdType>& pos) const
{
const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
return ret2;
}
- MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<int>& pos) const
+ MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<mcIdType>& pos) const
{
const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
virtual PyObject *positionRelativeToGodFather() const
{
- std::vector<int> out1;
- std::vector< std::pair<int,int> > out0(self->positionRelativeToGodFather(out1));
+ std::vector<mcIdType> out1;
+ std::vector< std::pair<mcIdType,mcIdType> > out0(self->positionRelativeToGodFather(out1));
PyObject *ret(PyTuple_New(2));
PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0));
PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1));
return ret;
}
- virtual PyObject *retrieveGridsAt(int absoluteLev) const
+ virtual PyObject *retrieveGridsAt(mcIdType absoluteLev) const
{
std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
- int sz(ps.size());
+ std::size_t sz(ps.size());
PyObject *ret = PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
return ret;
}
- MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostSz, PyObject *recurseArrs) const
+ MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, PyObject *recurseArrs) const
{
std::vector<const DataArrayDouble *> inp;
convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp);
return ret;
}
- MEDCouplingCartesianAMRPatch *getPatch(int patchId) const
+ MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const
{
MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
if(ret)
return const_cast<MEDCouplingIMesh *>(ret);
}
- MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const
+ MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
{
if(patchId==self->getNumberOfPatches())
{
return ret;
}
- void fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const
+ void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const
{
std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
}
- void fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, PyObject *arrsOnPatches) const
+ void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, PyObject *arrsOnPatches) const
{
std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
}
- void __delitem__(int patchId)
+ void __delitem__(mcIdType patchId)
{
self->removePatch(patchId);
}
- int __len__() const
+ mcIdType __len__() const
{
return self->getNumberOfPatches();
}
{
static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
- const int *nodeStrctPtr(0);
+ const mcIdType *nodeStrctPtr(0);
const double *originPtr(0),*dxyzPtr(0);
- int sw,sz,val0;
- std::vector<int> bb0;
+ mcIdType sw,sz,val0;
+ std::vector<mcIdType> bb0;
nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
//
double val,val2;
std::vector<double> bb,bb2;
- int sz1,sz2;
+ mcIdType sz1,sz2;
originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
//
{
std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
- std::vector< std::vector<int> > inp2;
+ std::vector< std::vector<mcIdType> > inp2;
convertPyToVectorOfVectorOfInt(factors,inp2);
self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
}
{
public:
virtual void synchronizeFineToCoarse();
- virtual void synchronizeFineToCoarseBetween(int fromLev, int toLev);
+ virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev);
virtual void synchronizeCoarseToFine();
- virtual void synchronizeCoarseToFineBetween(int fromLev, int toLev);
+ virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev);
virtual void synchronizeAllGhostZones();
virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
- virtual void synchronizeAllGhostZonesAtASpecifiedLevel(int level);
- virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(int level);
+ virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level);
+ virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level);
virtual void alloc();
virtual void dealloc();
%extend
class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
{
public:
- int getNumberOfLevels() const;
+ mcIdType getNumberOfLevels() const;
MEDCouplingAMRAttribute *deepCopy() const;
MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
std::string writeVTHB(const std::string& fileName) const;
%extend
{
- static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev)
+ static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
{
std::vector< std::pair<std::string,int> > fieldNamesCpp0;
std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
return ret;
}
- MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev)
+ MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
{
return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
}
void spillNatures(PyObject *nfs)
{
- std::vector<int> inp0;
+ std::vector<mcIdType> inp0;
if(!fillIntVector(nfs,inp0))
throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
std::size_t sz(inp0.size());
PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
{
std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
- int sz((int)ret.size());
+ std::size_t sz(ret.size());
PyObject *retPy(PyList_New(sz));
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
return retPy;
}
class DenseMatrix : public RefCountObject, public TimeLabel
{
public:
- static DenseMatrix *New(int nbRows, int nbCols);
- static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols);
+ static DenseMatrix *New(mcIdType nbRows, mcIdType nbCols);
+ static DenseMatrix *New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
DenseMatrix *deepCopy() const;
DenseMatrix *shallowCpy() const;
//
- int getNumberOfRows() const;
- int getNumberOfCols() const;
- int getNbOfElems() const;
- void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1);
- void reShape(int nbRows, int nbCols);
+ mcIdType getNumberOfRows() const;
+ mcIdType getNumberOfCols() const;
+ mcIdType getNbOfElems() const;
+ void reBuild(DataArrayDouble *array, mcIdType nbRows=-1, mcIdType nbCols=-1);
+ void reShape(mcIdType nbRows, mcIdType nbCols);
void transpose();
//
bool isEqual(const DenseMatrix& other, double eps) const;
static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec);
%extend
{
- DenseMatrix(int nbRows, int nbCols)
+ DenseMatrix(mcIdType nbRows, mcIdType nbCols)
{
return DenseMatrix::New(nbRows,nbCols);
}
- DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols)
+ DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols)
{
return DenseMatrix::New(array,nbRows,nbCols);
}
};
typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayByte> PyCallBackDataArrayChar;
-typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayInt> PyCallBackDataArrayInt;
+typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayInt32> PyCallBackDataArrayInt32;
+typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayInt64> PyCallBackDataArrayInt64;
typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayFloat> PyCallBackDataArrayFloat;
typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayDouble> PyCallBackDataArrayDouble;
return (PyObject *)self;
}
- static PyObject *callbackmcdataarrayint___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+ static PyObject *callbackmcdataarrayint32___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
- PyCallBackDataArrayInt *self = (PyCallBackDataArrayInt *) ( type->tp_alloc(type, 0) );
+ PyCallBackDataArrayInt32 *self = (PyCallBackDataArrayInt32 *) ( type->tp_alloc(type, 0) );
+ return (PyObject *)self;
+ }
+
+ static PyObject *callbackmcdataarrayint64___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+ {
+ PyCallBackDataArrayInt64 *self = (PyCallBackDataArrayInt64 *) ( type->tp_alloc(type, 0) );
return (PyObject *)self;
}
// real callback called when a numpy arr having more than one DataArray instance client on it is destroyed.
// In this case, all the "weak" clients, except the first one, invoke this call back that desable the content of these "weak" clients.
- static PyObject *callbackmcdataarrayint_call(PyCallBackDataArrayInt *self, PyObject *args, PyObject *kw)
+ static PyObject *callbackmcdataarrayint32_call(PyCallBackDataArrayInt32 *self, PyObject *args, PyObject *kw)
{
if(self->_pt_mc)
{
return Py_None;
}
+ // real callback called when a numpy arr having more than one DataArray instance client on it is destroyed.
+ // In this case, all the "weak" clients, except the first one, invoke this call back that desable the content of these "weak" clients.
+ static PyObject *callbackmcdataarrayint64_call(PyCallBackDataArrayInt64 *self, PyObject *args, PyObject *kw)
+ {
+ if(self->_pt_mc)
+ {
+ MEDCoupling::MemArray<long>& mma=self->_pt_mc->accessToMemArray();
+ mma.destroy();
+ }
+ Py_XINCREF(Py_None);
+ return Py_None;
+ }
+
// real callback called when a numpy arr having more than one DataArray instance client on it is destroyed.
// In this case, all the "weak" clients, except the first one, invoke this call back that desable the content of these "weak" clients.
static PyObject *callbackmcdataarrayfloat_call(PyCallBackDataArrayFloat *self, PyObject *args, PyObject *kw)
};
-PyTypeObject PyCallBackDataArrayInt_RefType = {
+PyTypeObject PyCallBackDataArrayInt32_RefType = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "callbackmcdataarrayint",
- sizeof(PyCallBackDataArrayInt),
+ "callbackmcdataarrayint32",
+ sizeof(PyCallBackDataArrayInt32),
0,
callbackmcdataarray_dealloc, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
- (ternaryfunc)callbackmcdataarrayint_call, /*tp_call*/
+ (ternaryfunc)callbackmcdataarrayint32_call, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_dictoffset*/
callbackmcdataarray___init__, /*tp_init*/
PyType_GenericAlloc, /*tp_alloc*/
- callbackmcdataarrayint___new__, /*tp_new*/
+ callbackmcdataarrayint32___new__, /*tp_new*/
+ PyObject_GC_Del, /*tp_free*/
+};
+
+
+PyTypeObject PyCallBackDataArrayInt64_RefType = {
+ PyVarObject_HEAD_INIT(&PyType_Type, 0)
+ "callbackmcdataarrayint64",
+ sizeof(PyCallBackDataArrayInt64),
+ 0,
+ callbackmcdataarray_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ (ternaryfunc)callbackmcdataarrayint64_call, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ 0, /*tp_methods*/
+ 0, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ callbackmcdataarray___init__, /*tp_init*/
+ PyType_GenericAlloc, /*tp_alloc*/
+ callbackmcdataarrayint64___new__, /*tp_new*/
PyObject_GC_Del, /*tp_free*/
};
static PyTypeObject *NPYFunc;
static PyObject *Array_SWIGTYPE;
};
+
+template<>
+struct NPYTraits<int>
+{
+ static const int NPYObjectType=NPY_INT32;
+ static PyTypeObject *NPYFunc;
+ static PyObject *Array_SWIGTYPE;
+};
+
+template<>
+struct NPYTraits<long>
+{
+ static const int NPYObjectType=NPY_INT64;
+ static PyTypeObject *NPYFunc;
+ static PyObject *Array_SWIGTYPE;
+};
#endif
#endif
#include "InterpKernelAutoPtr.hxx"
#include "MEDCouplingDataArrayTraits.hxx"
+#include "MCType.hxx"
#include <sstream>
+using namespace MEDCoupling;
+
+template<class T>
+struct SWIGTITraits
+{ };
+
+template<>
+struct SWIGTITraits<double>
+{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
+
+template<>
+struct SWIGTITraits<float>
+{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
+
+template<>
+struct SWIGTITraits<Int32>
+{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
+
+template<>
+struct SWIGTITraits<Int64>
+{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
+
+swig_type_info *SWIGTITraits<double>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<float>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<Int32>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayInt32 is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<Int64>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayInt64 is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<double>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<float>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<Int32>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayInt32 is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<Int64>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayInt64 is null when called here ! Postpone initialization at inlined initializeMe()
+
static PyObject *convertArray(MEDCoupling::DataArray *array, int owner)
{
PyObject *ret(NULL);
}
if(dynamic_cast<MEDCoupling::DataArrayDouble *>(array))
ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayDouble,owner);
- if(dynamic_cast<MEDCoupling::DataArrayInt *>(array))
- ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayInt,owner);
+ if(dynamic_cast<MEDCoupling::DataArrayInt32 *>(array))
+ ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayInt32,owner);
+ if(dynamic_cast<MEDCoupling::DataArrayInt64 *>(array))
+ ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayInt64,owner);
if(dynamic_cast<MEDCoupling::DataArrayFloat *>(array))
ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayFloat,owner);
if(!ret)
throw INTERP_KERNEL::Exception(msgInCaseOfFailure);
}
-int InterpreteNegativeInt(int val, int nbelem)
+int InterpreteNegativeInt(long val, mcIdType nbelem)
{
if(val<0)
{
- int newVal(nbelem+val);
+ int newVal((int)(nbelem+val));
if(newVal<0)
{
std::ostringstream oss; oss << "interpreteNegativeInt : request for negative int=" << val << " but number of elems is equal to " << nbelem << " !";
return newVal;
}
else
- return val;
+ return (int)val;
}
#ifdef WITH_NUMPY
if(PyArray_DESCR(elt0)->type_num != npyObjectType)
{
std::ostringstream oss; oss << "Input numpy array has not the type " << msg << "!";
+#ifdef _DEBUG_
+ oss << " type_num == " << PyArray_DESCR(elt0)->type_num;
+#endif
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
npy_intp sz0=PyArray_DIM(elt0,0);
void **objs=new void *[2]; objs[0]=cb; objs[1]=ref;
mma.setParameterForDeallocator(objs);
mma.setSpecificDeallocator(numarrdeal2<MCData>);
- //"Impossible to share this numpy array chunk of data, because already shared by an another non numpy array object (maybe an another DataArrayInt instance) ! Release it, or perform a copy on the input array !");
+ //"Impossible to share this numpy array chunk of data, because already shared by an another non numpy array object (maybe an another DataArrayIdType instance) ! Release it, or perform a copy on the input array !");
}
else
{
}
template<class MCData, class T>
-PyObject *ToNumPyArrayUnderground(MCData *self, int npyObjectType, const char *MCDataStr, int nbTuples, int nbComp)
+PyObject *ToNumPyArrayUnderground(MCData *self, int npyObjectType, const char *MCDataStr, mcIdType nbTuples, std::size_t nbComp)
{
if(!self->isAllocated())
{
}
int nbDims=nbComp==1?1:2;
npy_intp dim[2];
- dim[0]=(npy_intp)nbTuples; dim[1]=nbComp;
+ dim[0]=(npy_intp)nbTuples; dim[1]=(npy_intp)nbComp;
const T *bg=self->getConstPointer();
PyObject *ret(PyArray_SimpleNewFromData(nbDims,dim,npyObjectType,const_cast<T *>(bg)));
if(mem.isDeallocatorCalled())
return ToNumPyArrayUnderground<MCData,T>(self,npyObjectType,MCDataStr,self->getNumberOfTuples(),self->getNumberOfComponents());
}
-SWIGINTERN PyObject *MEDCoupling_DataArrayInt_toNumPyArray(MEDCoupling::DataArrayInt *self);
+SWIGINTERN PyObject *MEDCoupling_DataArrayInt32_toNumPyArray(MEDCoupling::DataArrayInt32 *self);
+SWIGINTERN PyObject *MEDCoupling_DataArrayInt64_toNumPyArray(MEDCoupling::DataArrayInt64 *self);
SWIGINTERN PyObject *MEDCoupling_DataArrayDouble_toNumPyArray(MEDCoupling::DataArrayDouble *self);
#endif
#ifdef WITH_SCIPY
-PyObject *ToCSRMatrix(const std::vector<std::map<int,double> >& m, int nbCols)
+PyObject *ToCSRMatrix(const std::vector<std::map<mcIdType,double> >& m, mcIdType nbCols)
{
- int nbRows((int)m.size());
- MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> indPtr(MEDCoupling::DataArrayInt::New()),indices(MEDCoupling::DataArrayInt::New());
+ mcIdType nbRows((mcIdType)m.size());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> indPtr(MEDCoupling::DataArrayIdType::New()),indices(MEDCoupling::DataArrayIdType::New());
MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> data(MEDCoupling::DataArrayDouble::New());
indPtr->alloc(nbRows+1,1);
- int *intPtr_ptr(indPtr->getPointer()); intPtr_ptr[0]=0; intPtr_ptr++;
- int sz2(0);
- for(std::vector<std::map<int,double> >::const_iterator it0=m.begin();it0!=m.end();it0++,intPtr_ptr++)
+ mcIdType *intPtr_ptr(indPtr->getPointer()); intPtr_ptr[0]=0; intPtr_ptr++;
+ mcIdType sz2(0);
+ for(std::vector<std::map<mcIdType,double> >::const_iterator it0=m.begin();it0!=m.end();it0++,intPtr_ptr++)
{
- sz2+=(int)(*it0).size();
+ sz2+=(mcIdType)(*it0).size();
*intPtr_ptr=sz2;
}
indices->alloc(sz2,1); data->alloc(sz2,1);
- int *indices_ptr(indices->getPointer());
+ mcIdType *indices_ptr(indices->getPointer());
double *data_ptr(data->getPointer());
- for(std::vector<std::map<int,double> >::const_iterator it0=m.begin();it0!=m.end();it0++)
- for(std::map<int,double>::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++,indices_ptr++,data_ptr++)
+ for(std::vector<std::map<mcIdType,double> >::const_iterator it0=m.begin();it0!=m.end();it0++)
+ for(std::map<mcIdType,double>::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++,indices_ptr++,data_ptr++)
{
*indices_ptr=(*it1).first;
*data_ptr=(*it1).second;
}
- PyObject *a(MEDCoupling_DataArrayDouble_toNumPyArray(data)),*b(MEDCoupling_DataArrayInt_toNumPyArray(indices)),*c(MEDCoupling_DataArrayInt_toNumPyArray(indPtr));
+#ifndef MEDCOUPLING_USE_64BIT_IDS
+ PyObject *a(MEDCoupling_DataArrayDouble_toNumPyArray(data)),*b(MEDCoupling_DataArrayInt32_toNumPyArray(indices)),*c(MEDCoupling_DataArrayInt32_toNumPyArray(indPtr));
+#else
+ PyObject *a(MEDCoupling_DataArrayDouble_toNumPyArray(data)),*b(MEDCoupling_DataArrayInt64_toNumPyArray(indices)),*c(MEDCoupling_DataArrayInt64_toNumPyArray(indPtr));
+#endif
//
PyObject *args(PyTuple_New(1)),*args0(PyTuple_New(3)),*kw(PyDict_New()),*kw1(PyTuple_New(2));
PyTuple_SetItem(args0,0,a); PyTuple_SetItem(args0,1,b); PyTuple_SetItem(args0,2,c); PyTuple_SetItem(args,0,args0);
}
if(dynamic_cast<MEDCoupling::DataArrayDouble *>(dac))
ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayDouble,owner);
- if(dynamic_cast<MEDCoupling::DataArrayInt *>(dac))
- ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayInt,owner);
+ if(dynamic_cast<MEDCoupling::DataArrayInt32 *>(dac))
+ ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayInt32,owner);
+ if(dynamic_cast<MEDCoupling::DataArrayInt64 *>(dac))
+ ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayInt64,owner);
if(dynamic_cast<MEDCoupling::DataArrayFloat *>(dac))
ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayFloat,owner);
if(dynamic_cast<MEDCoupling::DataArrayByte *>(dac))
return ret;
}
-static PyObject *convertIntArrToPyList(const int *ptr, int size)
+template<class T>
+static PyObject *convertIntArrToPyList(const T *ptr, mcIdType size)
{
PyObject *ret=PyList_New(size);
- for(int i=0;i<size;i++)
+ for(T i=0;i<size;i++)
PyList_SetItem(ret,i,PyInt_FromLong(ptr[i]));
return ret;
}
-static PyObject *convertIntArrToPyList2(const std::vector<int>& v)
+template<class T>
+static PyObject *convertIntArrToPyList2(const std::vector<T>& v)
{
- int size=v.size();
+ std::size_t size=v.size();
PyObject *ret=PyList_New(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
PyList_SetItem(ret,i,PyInt_FromLong(v[i]));
return ret;
}
-static PyObject *convertIntArrToPyList3(const std::set<int>& v)
+template<class T>
+static PyObject *convertIntArrToPyList3(const std::set<T>& v)
{
- int size=v.size();
+ std::size_t size=v.size();
PyObject *ret=PyList_New(size);
- std::set<int>::const_iterator it=v.begin();
- for(int i=0;i<size;i++,it++)
+ typename std::set<T>::const_iterator it=v.begin();
+ for(std::size_t i=0;i<size;i++,it++)
PyList_SetItem(ret,i,PyInt_FromLong(*it));
return ret;
}
return ret;
}
-static PyObject *convertIntArrToPyListOfTuple(const int *vals, int nbOfComp, int nbOfTuples)
+template<class T>
+static PyObject *convertIntArrToPyListOfTuple(const T *vals, mcIdType nbOfComp, mcIdType nbOfTuples)
{
PyObject *ret=PyList_New(nbOfTuples);
- for(int i=0;i<nbOfTuples;i++)
+ for(T i=0;i<nbOfTuples;i++)
{
PyObject *t=PyTuple_New(nbOfComp);
- for(int j=0;j<nbOfComp;j++)
+ for(T j=0;j<nbOfComp;j++)
PyTuple_SetItem(t,j,PyInt_FromLong(vals[i*nbOfComp+j]));
PyList_SetItem(ret,i,t);
}
return ret;
}
-static int *convertPyToNewIntArr2(PyObject *pyLi, int *size)
+template< class T = mcIdType >
+static T *convertPyToNewIntArr2(PyObject *pyLi, mcIdType *size)
{
if(PyList_Check(pyLi))
{
- *size=PyList_Size(pyLi);
- int *tmp=new int[*size];
- for(int i=0;i<*size;i++)
+ *size=ToIdType(PyList_Size(pyLi));
+ T *tmp=new T[*size];
+ for(mcIdType i=0;i<*size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyInt_Check(o))
{
- int val=(int)PyInt_AS_LONG(o);
+ T val=(T)PyInt_AS_LONG(o);
tmp[i]=val;
}
else
}
else if(PyTuple_Check(pyLi))
{
- *size=PyTuple_Size(pyLi);
- int *tmp=new int[*size];
- for(int i=0;i<*size;i++)
+ *size=ToIdType(PyTuple_Size(pyLi));
+ T *tmp=new T[*size];
+ for(mcIdType i=0;i<*size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(PyInt_Check(o))
{
- int val=(int)PyInt_AS_LONG(o);
+ T val=(T)PyInt_AS_LONG(o);
tmp[i]=val;
}
else
}
}
-static PyObject *convertFromVectorPairInt(const std::vector< std::pair<int,int> >& arr)
+static PyObject *convertFromVectorPairInt(const std::vector< std::pair<mcIdType,mcIdType> >& arr)
{
PyObject *ret=PyList_New(arr.size());
for(std::size_t i=0;i<arr.size();i++)
return ret;
}
-static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair<int,int> >& arr)
+static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair<mcIdType,mcIdType> >& arr)
{
const char msg[]="list must contain tuples of 2 integers only or tuple must contain tuples of 2 integers only !";
if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
arr.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
- int sz2=PyTuple_Size(o);
+ std::size_t sz2=PyTuple_Size(o);
if(sz2!=2)
throw INTERP_KERNEL::Exception(msg);
PyObject *o_0=PyTuple_GetItem(o,0);
PyObject *o_1=PyTuple_GetItem(o,1);
if(!PyInt_Check(o_1))
throw INTERP_KERNEL::Exception(msg);
- arr[i].first=(int)PyInt_AS_LONG(o_0);
- arr[i].second=(int)PyInt_AS_LONG(o_1);
+ arr[i].first=(mcIdType)PyInt_AS_LONG(o_0);
+ arr[i].second=(mcIdType)PyInt_AS_LONG(o_1);
}
else
throw INTERP_KERNEL::Exception(msg);
}
else if(PyTuple_Check(pyLi))
{
- int size=PyTuple_Size(pyLi);
+ std::size_t size=PyTuple_Size(pyLi);
arr.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
- int sz2=PyTuple_Size(o);
+ std::size_t sz2=PyTuple_Size(o);
if(sz2!=2)
throw INTERP_KERNEL::Exception(msg);
PyObject *o_0=PyTuple_GetItem(o,0);
PyObject *o_1=PyTuple_GetItem(o,1);
if(!PyInt_Check(o_1))
throw INTERP_KERNEL::Exception(msg);
- arr[i].first=(int)PyInt_AS_LONG(o_0);
- arr[i].second=(int)PyInt_AS_LONG(o_1);
+ arr[i].first=(mcIdType)PyInt_AS_LONG(o_0);
+ arr[i].second=(mcIdType)PyInt_AS_LONG(o_1);
}
else
throw INTERP_KERNEL::Exception(msg);
const char msg[]="convertPyToVectorPairStringInt : list must contain tuples of 2 integers only or tuple must contain tuples of 1 string and 1 integer only !";
if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
arr.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
- int sz2=PyTuple_Size(o);
+ std::size_t sz2=PyTuple_Size(o);
if(sz2!=2)
throw INTERP_KERNEL::Exception(msg);
PyObject *o_0=PyTuple_GetItem(o,0);
}
else if(PyTuple_Check(pyLi))
{
- int size=PyTuple_Size(pyLi);
+ std::size_t size=PyTuple_Size(pyLi);
arr.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
- int sz2=PyTuple_Size(o);
+ std::size_t sz2=PyTuple_Size(o);
if(sz2!=2)
throw INTERP_KERNEL::Exception(msg);
PyObject *o_0=PyTuple_GetItem(o,0);
throw INTERP_KERNEL::Exception(msg);
}
-static void convertPyToNewIntArr3(PyObject *pyLi, std::vector<int>& arr)
+template<class T>
+static void convertPyToNewIntArr3(PyObject *pyLi, std::vector<T>& arr)
{
if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
arr.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyInt_Check(o))
{
- int val=(int)PyInt_AS_LONG(o);
+ T val=(T)PyInt_AS_LONG(o);
arr[i]=val;
}
else
}
else if(PyTuple_Check(pyLi))
{
- int size=PyTuple_Size(pyLi);
+ std::size_t size=PyTuple_Size(pyLi);
arr.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(PyInt_Check(o))
{
- int val=(int)PyInt_AS_LONG(o);
+ T val=(T)PyInt_AS_LONG(o);
arr[i]=val;
}
else
}
}
-static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPart, std::vector<int>& arr)
+static void convertPyToNewIntArr4(PyObject *pyLi, mcIdType recurseLev, mcIdType nbOfSubPart, std::vector<mcIdType>& arr)
{
if(recurseLev<0)
throw INTERP_KERNEL::Exception("convertPyToNewIntArr4 : invalid list of integers level of recursion !");
arr.clear();
if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
- for(int i=0;i<size;i++)
+ std::size_t size=PyList_Size(pyLi);
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyInt_Check(o))
{
- int val=(int)PyInt_AS_LONG(o);
+ mcIdType val=(mcIdType)PyInt_AS_LONG(o);
arr.push_back(val);
}
else
{
- std::vector<int> arr2;
+ std::vector<mcIdType> arr2;
convertPyToNewIntArr4(o,recurseLev-1,nbOfSubPart,arr2);
- if(nbOfSubPart>=1 && nbOfSubPart!=(int)arr2.size())
+ if(nbOfSubPart>=1 && nbOfSubPart!=(mcIdType)arr2.size())
{
std::ostringstream oss; oss << "convertPyToNewIntArr4 : input list at lev " << recurseLev << " invalid nb of subpart elts expected " << nbOfSubPart << " having " << arr2.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
else if(PyTuple_Check(pyLi))
{
- int size=PyTuple_Size(pyLi);
- for(int i=0;i<size;i++)
+ std::size_t size=PyTuple_Size(pyLi);
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(PyInt_Check(o))
{
- int val=(int)PyInt_AS_LONG(o);
+ mcIdType val=ToIdType(PyInt_AS_LONG(o));
arr.push_back(val);
}
else
{
- std::vector<int> arr2;
+ std::vector<mcIdType> arr2;
convertPyToNewIntArr4(o,recurseLev-1,nbOfSubPart,arr2);
- if(nbOfSubPart>=1 && nbOfSubPart!=(int)arr2.size())
+ if(nbOfSubPart>=1 && nbOfSubPart!=(mcIdType)arr2.size())
{
std::ostringstream oss; oss << "convertPyToNewIntArr4 : input list at lev " << recurseLev << " invalid nb of subpart elts expected " << nbOfSubPart << " having " << arr2.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
throw INTERP_KERNEL::Exception("convertPyToNewIntArr4 : not a list nor a tuple recursively !");
}
-static void checkFillArrayWithPyList(int size1, int size2, int& nbOfTuples, int& nbOfComp)
+static void checkFillArrayWithPyList(mcIdType size1, mcIdType size2, mcIdType& nbOfTuples, mcIdType& nbOfComp)
{
if(nbOfTuples==-1)
{
}
}
-static void fillArrayWithPyListInt3(PyObject *pyLi, int& nbOfElt, std::vector<int>& ret)
+template< class T >
+static void fillArrayWithPyListInt3(PyObject *pyLi, mcIdType& nbOfElt, std::vector<T>& ret)
{
static const char MSG[]="fillArrayWithPyListInt3 : It appears that the input list or tuple is composed by elts having different sizes !";
if(PyInt_Check(pyLi))
{
- long val=PyInt_AS_LONG(pyLi);
+ T val=(T)PyInt_AS_LONG(pyLi);
if(nbOfElt==-1)
nbOfElt=1;
else
}
else if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
- int tmp=0;
- for(int i=0;i<size;i++)
+ std::size_t size=PyList_Size(pyLi);
+ mcIdType tmp=0;
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
- int tmp1=-1;
+ mcIdType tmp1=-1;
fillArrayWithPyListInt3(o,tmp1,ret);
tmp+=tmp1;
}
}
else if(PyTuple_Check(pyLi))
{
- int size=PyTuple_Size(pyLi);
- int tmp=0;
- for(int i=0;i<size;i++)
+ std::size_t size=PyTuple_Size(pyLi);
+ mcIdType tmp=0;
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
- int tmp1=-1;
+ mcIdType tmp1=-1;
fillArrayWithPyListInt3(o,tmp1,ret);
tmp+=tmp1;
}
throw INTERP_KERNEL::Exception("fillArrayWithPyListInt3 : Unrecognized type ! Should be a composition of tuple,list,int !");
}
-static std::vector<int> fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp)
+template< class T = mcIdType >
+static std::vector<T> fillArrayWithPyListInt2(PyObject *pyLi, mcIdType& nbOfTuples, mcIdType& nbOfComp)
{
- std::vector<int> ret;
- int size1=-1,size2=-1;
+ std::vector<T> ret;
+ mcIdType size1=-1,size2=-1;
if(PyList_Check(pyLi))
{
- size1=PyList_Size(pyLi);
- for(int i=0;i<size1;i++)
+ size1=ToIdType(PyList_Size(pyLi));
+ for(mcIdType i=0;i<size1;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
fillArrayWithPyListInt3(o,size2,ret);
}
else if(PyTuple_Check(pyLi))
{
- size1=PyTuple_Size(pyLi);
- for(int i=0;i<size1;i++)
+ size1=ToIdType(PyTuple_Size(pyLi));
+ for(mcIdType i=0;i<size1;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
fillArrayWithPyListInt3(o,size2,ret);
{
Py_ssize_t sz=PyList_Size(pyLi);
vec.resize(sz);
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(!convertPyObjectToStrNT(o,vec[i]))
{
Py_ssize_t sz=PyTuple_Size(pyLi);
vec.resize(sz);
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(!convertPyObjectToStrNT(o,vec[i]))
{
Py_ssize_t sz=PyList_Size(pyLi);
arr.resize(sz);
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(!fillStringVector(o,arr[i]))
{
Py_ssize_t sz=PyTuple_Size(pyLi);
arr.resize(sz);
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(!fillStringVector(o,arr[i]))
throw INTERP_KERNEL::Exception(msg);
}
-static bool fillIntVector(PyObject *pyLi, std::vector<int>& vec)
+static bool fillIntVector(PyObject *pyLi, std::vector<mcIdType>& vec)
{
if(PyList_Check(pyLi))
{
Py_ssize_t sz=PyList_Size(pyLi);
vec.resize(sz);
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyInt_Check(o))
- vec[i]=PyInt_AS_LONG(o);
+ vec[i]=ToIdType(PyInt_AS_LONG(o));
else
return false;
}
{
Py_ssize_t sz=PyTuple_Size(pyLi);
vec.resize(sz);
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(PyInt_Check(o))
- vec[i]=PyInt_AS_LONG(o);
+ vec[i]=ToIdType(PyInt_AS_LONG(o));
else
return false;
}
return false;
}
-static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vector<int> >& arr)
+static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vector<mcIdType> >& arr)
{
const char msg[]="convertPyToVectorOfVectorOfInt : expecting list of list of strings !";
if(PyList_Check(pyLi))
{
Py_ssize_t sz=PyList_Size(pyLi);
arr.resize(sz);
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(!fillIntVector(o,arr[i]))
{
Py_ssize_t sz=PyTuple_Size(pyLi);
arr.resize(sz);
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(!fillIntVector(o,arr[i]))
{
Py_ssize_t sz=PyList_Size(pyLi);
arr.resize(sz);
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
- int sz2=PyTuple_Size(o);
+ std::size_t sz2=PyTuple_Size(o);
if(sz2!=2)
throw INTERP_KERNEL::Exception(msg);
std::pair<std::string, std::vector<std::string> > item;
{
Py_ssize_t sz=PyTuple_Size(pyLi);
arr.resize(sz);
- for(int i=0;i<sz;i++)
+ for(Py_ssize_t i=0;i<sz;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
- int sz2=PyTuple_Size(o);
+ std::size_t sz2=PyTuple_Size(o);
if(sz2!=2)
throw INTERP_KERNEL::Exception(msg);
std::pair<std::string, std::vector<std::string> > item;
}
template<class T>
-PyObject *convertDblArrToPyList(const T *ptr, int size)
+PyObject *convertDblArrToPyList(const T *ptr, std::size_t size)
{
PyObject *ret(PyList_New(size));
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
PyList_SetItem(ret,i,PyFloat_FromDouble(ptr[i]));
return ret;
}
static PyObject *convertDblArrToPyList2(const std::vector<double>& v)
{
- int size(v.size());
+ std::size_t size(v.size());
PyObject *ret(PyList_New(size));
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
PyList_SetItem(ret,i,PyFloat_FromDouble(v[i]));
return ret;
}
template<class T>
-PyObject *convertDblArrToPyListOfTuple(const T *vals, int nbOfComp, int nbOfTuples)
+PyObject *convertDblArrToPyListOfTuple(const T *vals, std::size_t nbOfComp, mcIdType nbOfTuples)
{
PyObject *ret(PyList_New(nbOfTuples));
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
PyObject *t=PyTuple_New(nbOfComp);
- for(int j=0;j<nbOfComp;j++)
+ for(std::size_t j=0;j<nbOfComp;j++)
PyTuple_SetItem(t,j,PyFloat_FromDouble(vals[i*nbOfComp+j]));
PyList_SetItem(ret,i,t);
}
return ret;
}
-static PyObject *convertCharArrToPyListOfTuple(const char *vals, int nbOfComp, int nbOfTuples)
+static PyObject *convertCharArrToPyListOfTuple(const char *vals, int nbOfComp, mcIdType nbOfTuples)
{
PyObject *ret=PyList_New(nbOfTuples);
INTERP_KERNEL::AutoPtr<char> tmp=new char[nbOfComp+1]; tmp[nbOfComp]='\0';
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
std::copy(vals+i*nbOfComp,vals+(i+1)*nbOfComp,(char *)tmp);
PyList_SetItem(ret,i,PyString_FromString(tmp));
return ret;
}
-static double *convertPyToNewDblArr2(PyObject *pyLi, int *size)
+static double *convertPyToNewDblArr2(PyObject *pyLi, mcIdType *size)
{
if(PyList_Check(pyLi))
{
- *size=PyList_Size(pyLi);
+ *size=ToIdType(PyList_Size(pyLi));
double *tmp=(double *)malloc((*size)*sizeof(double));
- for(int i=0;i<*size;i++)
+ for(mcIdType i=0;i<*size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyFloat_Check(o))
else if(PyInt_Check(o))
{
long val0=PyInt_AS_LONG(o);
- double val=val0;
+ double val=(double)val0;
tmp[i]=val;
}
else
}
else if(PyTuple_Check(pyLi))
{
- *size=PyTuple_Size(pyLi);
+ *size=ToIdType(PyTuple_Size(pyLi));
double *tmp=(double *)malloc((*size)*sizeof(double));
- for(int i=0;i<*size;i++)
+ for(mcIdType i=0;i<*size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(PyFloat_Check(o))
else if(PyInt_Check(o))
{
long val0=PyInt_AS_LONG(o);
- double val=val0;
+ double val=(double)val0;
tmp[i]=val;
}
else
throw INTERP_KERNEL::Exception("convertPyToNewDblArr2 : not a list");
}
-static void fillArrayWithPyListDbl3(PyObject *pyLi, int& nbOfElt, std::vector<double>& ret)
+static void fillArrayWithPyListDbl3(PyObject *pyLi, mcIdType& nbOfElt, std::vector<double>& ret)
{
static const char MSG[]="fillArrayWithPyListDbl3 : It appears that the input list or tuple is composed by elts having different sizes !";
if(PyFloat_Check(pyLi))
}
else if(PyInt_Check(pyLi))
{
- long val0=PyInt_AS_LONG(pyLi);
- double val=val0;
+ mcIdType val0=ToIdType(PyInt_AS_LONG(pyLi));
+ double val=(double)val0;
if(nbOfElt==-1)
nbOfElt=1;
else
}
else if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
- int tmp=0;
- for(int i=0;i<size;i++)
+ std::size_t size=PyList_Size(pyLi);
+ mcIdType tmp=0;
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
- int tmp1=-1;
+ mcIdType tmp1=-1;
fillArrayWithPyListDbl3(o,tmp1,ret);
tmp+=tmp1;
}
}
else if(PyTuple_Check(pyLi))
{
- int size=PyTuple_Size(pyLi);
- int tmp=0;
- for(int i=0;i<size;i++)
+ std::size_t size=PyTuple_Size(pyLi);
+ mcIdType tmp=0;
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
- int tmp1=-1;
+ mcIdType tmp1=-1;
fillArrayWithPyListDbl3(o,tmp1,ret);
tmp+=tmp1;
}
throw INTERP_KERNEL::Exception("fillArrayWithPyListDbl3 : Unrecognized type ! Should be a composition of tuple,list,int and float !");
}
-static std::vector<double> fillArrayWithPyListDbl2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp)
+static std::vector<double> fillArrayWithPyListDbl2(PyObject *pyLi, mcIdType& nbOfTuples, mcIdType& nbOfComp)
{
std::vector<double> ret;
- int size1=-1,size2=-1;
+ std::size_t size1=-1;
+ mcIdType size2=-1;
if(PyList_Check(pyLi))
{
size1=PyList_Size(pyLi);
- for(int i=0;i<size1;i++)
+ for(std::size_t i=0;i<size1;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
fillArrayWithPyListDbl3(o,size2,ret);
else if(PyTuple_Check(pyLi))
{
size1=PyTuple_Size(pyLi);
- for(int i=0;i<size1;i++)
+ for(std::size_t i=0;i<size1;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
fillArrayWithPyListDbl3(o,size2,ret);
else
throw INTERP_KERNEL::Exception("fillArrayWithPyListDbl2 : Unrecognized type ! Should be a tuple or a list !");
//
- checkFillArrayWithPyList(size1,size2,nbOfTuples,nbOfComp);
+ checkFillArrayWithPyList(ToIdType(size1),ToIdType(size2),nbOfTuples,nbOfComp);
return ret;
}
void *argp=0;
if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
ret.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *obj=PyList_GetItem(pyLi,i);
int status=SWIG_ConvertPtr(obj,&argp,ty,0|0);
}
else if(PyTuple_Check(pyLi))
{
- int size=PyTuple_Size(pyLi);
+ std::size_t size=PyTuple_Size(pyLi);
ret.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *obj=PyTuple_GetItem(pyLi,i);
int status=SWIG_ConvertPtr(obj,&argp,ty,0|0);
* if python int -> cpp int sw=1
* if python list[int] -> cpp vector<int> sw=2
* if python tuple[int] -> cpp vector<int> sw=2
- * if python DataArrayInt -> cpp DataArrayInt sw=3
- * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4
+ * if python DataArrayIdType -> cpp DataArrayIdType sw=3
+ * if python DataArrayIntTuple -> cpp DataArrayIdTypeTuple sw=4
*
- * switch between (int,vector<int>,DataArrayInt)
+ * switch between (int,vector<int>,DataArrayIdType)
*/
-static void convertIntStarLikePyObjToCpp(PyObject *value, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, MEDCoupling::DataArrayInt *& daIntTyypp, MEDCoupling::DataArrayIntTuple *&daIntTuple)
+template< class T, class ARRAY >
+static void convertIntStarLikePyObjToCpp(PyObject *value, mcIdType& sw, T& iTyypp, std::vector<T>& stdvecTyypp, ARRAY *& daIntTyypp, typename MEDCoupling::Traits< T >::ArrayTuple *&daIntTuple)
{
sw=-1;
if(PyInt_Check(value))
{
- iTyypp=(int)PyInt_AS_LONG(value);
+ iTyypp=(T)PyInt_AS_LONG(value);
sw=1;
return;
}
if(PyTuple_Check(value))
{
- int size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
stdvecTyypp.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyInt_Check(o))
- stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+ stdvecTyypp[i]=(T)PyInt_AS_LONG(o);
else
{
std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
}
if(PyList_Check(value))
{
- int size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
stdvecTyypp.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyInt_Check(o))
- stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+ stdvecTyypp[i]=(T)PyInt_AS_LONG(o);
else
{
std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
return;
}
void *argp;
- int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
+ int status=SWIG_ConvertPtr(value,&argp,SWIGTITraits< typename ARRAY::Type >::TI,0|0);
if(SWIG_IsOK(status))
{
- daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
+ daIntTyypp=reinterpret_cast< ARRAY * >(argp);
sw=3;
return;
}
- status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
+ status=SWIG_ConvertPtr(value,&argp,SWIGTITraits<T>::TI_TUPLE,0|0);
if(SWIG_IsOK(status))
{
- daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
+ daIntTuple=reinterpret_cast< typename MEDCoupling::Traits< T >::ArrayTuple * >(argp);
sw=4;
return ;
}
- throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple");
+ throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayIdType, DataArrayIdTypeTuple");
}
/*!
* if python int -> cpp int sw=1
* if python list[int] -> cpp vector<int> sw=2
* if python tuple[int] -> cpp vector<int> sw=2
- * if python DataArrayInt -> cpp DataArrayInt sw=3
- * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4
+ * if python DataArrayIdType -> cpp DataArrayIdType sw=3
+ * if python DataArrayIdTypeTuple -> cpp DataArrayIdTypeTuple sw=4
*
- * switch between (int,vector<int>,DataArrayInt)
+ * switch between (int,vector<int>,DataArrayIdType)
*/
-static const int *convertIntStarLikePyObjToCppIntStar(PyObject *value, int& sw, int& sz, int& iTyypp, std::vector<int>& stdvecTyypp)
+template< class T >
+static const T *convertIntStarLikePyObjToCppIntStar(PyObject *value, mcIdType& sw, mcIdType& sz, T& iTyypp, std::vector<T>& stdvecTyypp)
{
sw=-1;
if(PyInt_Check(value))
{
- iTyypp=(int)PyInt_AS_LONG(value);
+ iTyypp=(T)PyInt_AS_LONG(value);
sw=1; sz=1;
return &iTyypp;
}
if(PyTuple_Check(value))
{
- int size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
stdvecTyypp.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyInt_Check(o))
- stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+ stdvecTyypp[i]=(T)PyInt_AS_LONG(o);
else
{
std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- sw=2; sz=size;
+ sw=2; sz=ToIdType(size);
return &stdvecTyypp[0];
}
if(PyList_Check(value))
{
- int size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
stdvecTyypp.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyInt_Check(o))
- stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+ stdvecTyypp[i]=(T)PyInt_AS_LONG(o);
else
{
std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- sw=2; sz=size;
+ sw=2; sz=ToIdType(size);
return &stdvecTyypp[0];
}
void *argp;
- int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
+ int status=SWIG_ConvertPtr(value,&argp,SWIGTITraits<T>::TI,0|0);
if(SWIG_IsOK(status))
{
- MEDCoupling::DataArrayInt *daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
+ typedef typename MEDCoupling::Traits< T >::ArrayType ARRAY;
+ ARRAY *daIntTyypp=reinterpret_cast< ARRAY * >(argp);
if(daIntTyypp)
{
sw=3; sz=daIntTyypp->getNbOfElems();
return 0;
}
}
- status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
+ status=SWIG_ConvertPtr(value,&argp,SWIGTITraits<T>::TI_TUPLE,0|0);
if(SWIG_IsOK(status))
{
- MEDCoupling::DataArrayIntTuple *daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
- sw=4; sz=daIntTuple->getNumberOfCompo();
+ typedef typename MEDCoupling::Traits< T >::ArrayTuple ARRAYTUPLE;
+ ARRAYTUPLE *daIntTuple=reinterpret_cast< ARRAYTUPLE * >(argp);
+ sw=4; sz=ToIdType(daIntTuple->getNumberOfCompo());
return daIntTuple->getConstPointer();
}
- throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple");
+ throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayIdType, DataArrayIdTypeTuple");
}
/*!
* if python tuple[int] -> cpp vector<double> sw=2
* if python DataArrayDouble -> cpp DataArrayDouble sw=3
*
- * switch between (int,vector<int>,DataArrayInt)
+ * switch between (int,vector<int>,DataArrayIdType)
*/
template<class T>
-void considerPyObjAsATStarLikeObject(PyObject *value, int& sw, T& iTyypp, std::vector<T>& stdvecTyypp, typename MEDCoupling::Traits<T>::ArrayType *& daIntTyypp, swig_type_info *ti)
+void considerPyObjAsATStarLikeObject(PyObject *value, mcIdType& sw, T& iTyypp, std::vector<T>& stdvecTyypp, typename MEDCoupling::Traits<T>::ArrayType *& daIntTyypp, swig_type_info *ti)
{
sw=-1;
if(PyFloat_Check(value))
}
if(PyTuple_Check(value))
{
- int size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
stdvecTyypp.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyFloat_Check(o))
}
if(PyList_Check(value))
{
- int size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
stdvecTyypp.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyFloat_Check(o))
* if python tuple[int] -> cpp vector<double> sw=2
* if python DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3
*
- * switch between (int,vector<int>,DataArrayInt)
+ * switch between (int,vector<int>,DataArrayIdType)
*/
-static void convertDoubleStarLikePyObjToCpp(PyObject *value, int& sw, double& iTyypp, std::vector<double>& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp)
+static void convertDoubleStarLikePyObjToCpp(PyObject *value, mcIdType& sw, double& iTyypp, std::vector<double>& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp)
{
sw=-1;
if(PyFloat_Check(value))
}
if(PyTuple_Check(value))
{
- int size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
stdvecTyypp.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyFloat_Check(o))
}
if(PyList_Check(value))
{
- int size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
stdvecTyypp.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyFloat_Check(o))
}
template<class T>
-void convertFPStarLikePyObjToCpp_2(PyObject *value, int& sw, T& val, typename MEDCoupling::Traits<T>::ArrayType *&d, typename MEDCoupling::Traits<T>::ArrayTuple *&e, std::vector<T>& f, swig_type_info *ti_da, swig_type_info *ti_tuple)
+void convertFPStarLikePyObjToCpp_2(PyObject *value, mcIdType& sw, T& val, typename MEDCoupling::Traits<T>::ArrayType *&d, typename MEDCoupling::Traits<T>::ArrayTuple *&e, std::vector<T>& f, swig_type_info *ti_da, swig_type_info *ti_tuple)
{
sw=-1;
if(PyFloat_Check(value))
{
- val=PyFloat_AS_DOUBLE(value);
+ val=(T)PyFloat_AS_DOUBLE(value);
sw=1;
return;
}
}
if(PyTuple_Check(value))
{
- int size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
f.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyFloat_Check(o))
- f[i]=PyFloat_AS_DOUBLE(o);
+ f[i]=(T)PyFloat_AS_DOUBLE(o);
else if(PyInt_Check(o))
f[i]=(T)PyInt_AS_LONG(o);
else
}
if(PyList_Check(value))
{
- int size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
f.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyFloat_Check(o))
- f[i]=PyFloat_AS_DOUBLE(o);
+ f[i]=(T)PyFloat_AS_DOUBLE(o);
else if(PyInt_Check(o))
f[i]=(T)PyInt_AS_LONG(o);
else
* if value list[int,double] -> cpp std::vector<double> sw=4
* if value tuple[int,double] -> cpp std::vector<double> sw=4
*/
-static void convertDoubleStarLikePyObjToCpp_2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f)
+static void convertDoubleStarLikePyObjToCpp_2(PyObject *value, mcIdType& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f)
{
convertFPStarLikePyObjToCpp_2<double>(value,sw,val,d,e,f,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple);
}
* if value list[int,double] -> cpp std::vector<double> sw=4
* if value tuple[int,double] -> cpp std::vector<double> sw=4
*/
-static void convertFloatStarLikePyObjToCpp_2(PyObject *value, int& sw, float& val, MEDCoupling::DataArrayFloat *&d, MEDCoupling::DataArrayFloatTuple *&e, std::vector<float>& f)
+static void convertFloatStarLikePyObjToCpp_2(PyObject *value, mcIdType& sw, float& val, MEDCoupling::DataArrayFloat *&d, MEDCoupling::DataArrayFloatTuple *&e, std::vector<float>& f)
{
convertFPStarLikePyObjToCpp_2<float>(value,sw,val,d,e,f,SWIGTYPE_p_MEDCoupling__DataArrayFloat,SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple);
}
* if python list[int] -> cpp vector<int> sw=2
* if python tuple[int] -> cpp vector<int> sw=2
* if python slicp -> cpp pair sw=3 (begin,end,step)
- * if python DataArrayInt -> cpp DataArrayInt sw=4 . The returned pointer cannot be the null pointer ! If null an exception is thrown.
+ * if python DataArrayIdType -> cpp DataArrayIdType sw=4 . The returned pointer cannot be the null pointer ! If null an exception is thrown.
*
- * switch between (int,vector<int>,DataArrayInt)
+ * switch between (int,vector<int>,DataArrayIdType)
*/
-static void convertIntStarOrSliceLikePyObjToCpp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayInt *& daIntTyypp)
+template<class T, class ARRAY>
+static void convertIntStarOrSliceLikePyObjToCpp(PyObject *value, mcIdType nbelem, mcIdType& sw, T& iTyypp, std::vector<T>& stdvecTyypp, std::pair<mcIdType, std::pair<mcIdType,mcIdType> >& p, ARRAY *& daIntTyypp)
{
- const char *msg="5 types accepted : integer, tuple of integer, list of integer, slice, DataArrayInt, DataArrayIntTuple";
+ const char *msg="5 types accepted : integer, tuple of integer, list of integer, slice, DataArrayIdType, DataArrayIdTypeTuple";
sw=-1;
if(PyInt_Check(value))
{
- iTyypp=(int)PyInt_AS_LONG(value);
+ iTyypp=(T)PyInt_AS_LONG(value);
sw=1;
return;
}
if(PyTuple_Check(value))
{
- int size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
stdvecTyypp.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyInt_Check(o))
- stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+ stdvecTyypp[i]=(T)PyInt_AS_LONG(o);
else
{
std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
}
if(PyList_Check(value))
{
- int size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
stdvecTyypp.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyInt_Check(o))
- stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+ stdvecTyypp[i]=(T)PyInt_AS_LONG(o);
else
{
std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
{
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSlice(value,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !");
- p.first=strt;
- p.second.first=stp;
- p.second.second=step;
+ p.first=ToIdType(strt);
+ p.second.first=ToIdType(stp);
+ p.second.second=ToIdType(step);
sw=3;
return ;
}
void *argp;
- int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
+ int status=SWIG_ConvertPtr(value,&argp,SWIGTITraits< typename ARRAY::Type >::TI,0|0);
if(SWIG_IsOK(status))
{
- daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
+ daIntTyypp=reinterpret_cast< ARRAY * >(argp);
if(!daIntTyypp)
{
std::ostringstream oss; oss << msg << " Instance in null !";
sw=4;
return ;
}
- status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
+ status=SWIG_ConvertPtr(value,&argp,SWIGTITraits< typename ARRAY::Type >::TI_TUPLE,0|0);
if(SWIG_IsOK(status))
{
- MEDCoupling::DataArrayIntTuple *tmp=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
+ typedef typename MEDCoupling::Traits< typename ARRAY::Type >::ArrayTuple ARRAYTUPLE;
+ ARRAYTUPLE *tmp=reinterpret_cast< ARRAYTUPLE * >(argp);
if(!tmp)
{
std::ostringstream oss; oss << msg << " Instance in null !";
/*!
* Idem than convertIntStarOrSliceLikePyObjToCpp
*/
-static void convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayInt *& daIntTyypp)
+template<class T, class ARRAY>
+static void convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(PyObject *value, mcIdType nbelem, mcIdType& sw, T& iTyypp, std::vector<T>& stdvecTyypp, std::pair<mcIdType, std::pair<mcIdType,mcIdType> >& p, ARRAY *& daIntTyypp)
{
convertIntStarOrSliceLikePyObjToCpp(value,nbelem,sw,iTyypp,stdvecTyypp,p,daIntTyypp);
if(sw==1)
{
- iTyypp=InterpreteNegativeInt(iTyypp,nbelem);
+ iTyypp=(T)InterpreteNegativeInt(iTyypp,nbelem);
}
}
* if python tuple[int] -> cpp vector<int> sw=2
* if python list[int] -> cpp vector<int> sw=2
* if python slice -> cpp pair sw=3
- * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4 . WARNING The returned pointer can be the null pointer !
+ * if python DataArrayIdTypeTuple -> cpp DataArrayIdTypeTuple sw=4 . WARNING The returned pointer can be the null pointer !
*/
-static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayIntTuple *& daIntTyypp)
+template< class TUPLE_T >
+static void convertObjToPossibleCpp22(PyObject *value, mcIdType nbelem, mcIdType& sw, mcIdType& iTyypp, std::vector<mcIdType>& stdvecTyypp, std::pair<mcIdType, std::pair<mcIdType,mcIdType> >& p, typename MEDCoupling::Traits< TUPLE_T >::ArrayTuple *& daIntTyypp)
{
sw=-1;
if(PyInt_Check(value))
{
- iTyypp=(int)PyInt_AS_LONG(value);
+ iTyypp=ToIdType(PyInt_AS_LONG(value));
sw=1;
return;
}
if(PyTuple_Check(value))
{
- int size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
stdvecTyypp.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyInt_Check(o))
- stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+ stdvecTyypp[i]=(mcIdType)PyInt_AS_LONG(o);
else
{
std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
}
if(PyList_Check(value))
{
- int size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
stdvecTyypp.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyInt_Check(o))
- stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+ stdvecTyypp[i]=(mcIdType)PyInt_AS_LONG(o);
else
{
std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
{
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSlice(value,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !");
- p.first=strt;
- p.second.first=stp;
- p.second.second=step;
+ p.first=ToIdType(strt);
+ p.second.first=ToIdType(stp);
+ p.second.second=ToIdType(step);
sw=3;
return ;
}
void *argp;
- int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
+ int status=SWIG_ConvertPtr(value,&argp,SWIGTITraits<TUPLE_T>::TI_TUPLE,0|0);
if(!SWIG_IsOK(status))
- throw INTERP_KERNEL::Exception("4 types accepted : integer, tuple of integer, list of integer, slice, DataArrayIntTuple");
- daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
+ throw INTERP_KERNEL::Exception("4 types accepted : integer, tuple of integer, list of integer, slice, DataArrayIdTypeTuple");
+ daIntTyypp=reinterpret_cast< typename MEDCoupling::Traits< TUPLE_T >::ArrayTuple * >(argp);
sw=4;
}
* if python not null pointer of DataArrayChar -> cpp DataArrayChar sw=4
* switch between (int,string,vector<string>,DataArrayChar)
*/
-static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::string& sType, std::vector<std::string>& vsType, MEDCoupling::DataArrayChar *& dacType)
+static void convertObjToPossibleCpp6(PyObject *value, mcIdType& sw, char& cTyp, std::string& sType, std::vector<std::string>& vsType, MEDCoupling::DataArrayChar *& dacType)
{
const char *msg="4 types accepted : string, list or tuple of strings having same size, not null DataArrayChar instance.";
sw=-1;
#endif
if(PyTuple_Check(value))
{
- int size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
vsType.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
try
}
if(PyList_Check(value))
{
- int size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
vsType.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
try
* if value list[int] -> vt sw=2
* if value tuple[int] -> vt sw=2
* if value slice -> pt sw=3
- * if value DataArrayInt -> dt sw=4
+ * if value DataArrayIdType -> dt sw=4
* if value tuple [int,int] -> cpp it,ip sw=5
* if value tuple [list[int],int] -> cpp vt,ip sw=6
* if value tuple [tuple[int],int] -> cpp vt,ip sw=6
* if value tuple [slice,slice] -> cpp pt,pc sw=15
* if value tuple [DaI,slice] -> cpp dt,pc sw=16
*
- * switch between (int,vector<int>,DataArrayInt)
+ * switch between (int,vector<int>,DataArrayIdType)
*/
-static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, int& sw, int& it, int& ic, std::vector<int>& vt, std::vector<int>& vc,
- std::pair<int, std::pair<int,int> >& pt, std::pair<int, std::pair<int,int> >& pc,
- MEDCoupling::DataArrayInt *&dt, MEDCoupling::DataArrayInt *&dc)
+template<class TC>
+static void convertObjToPossibleCpp3(PyObject *value, mcIdType nbTuple, int nbCompo, mcIdType& sw, mcIdType& it, TC& ic, std::vector<mcIdType>& vt, std::vector<TC>& vc,
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> >& pt, std::pair<mcIdType, std::pair<mcIdType,mcIdType> >& pc,
+ MEDCoupling::DataArrayIdType *&dt, MEDCoupling::DataArrayIdType *&dc)
{
if(!PyTuple_Check(value))
{
}
else
{
- int sz=PyTuple_Size(value);
+ std::size_t sz=PyTuple_Size(value);
if(sz!=2)
throw INTERP_KERNEL::Exception("Unexpected nb of slice element : 1 or 2 expected !\n1st is for tuple selection, 2nd for component selection !");
PyObject *ob0=PyTuple_GetItem(value,0);
- int sw1,sw2;
+ mcIdType sw1,sw2;
convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(ob0,nbTuple,sw1,it,vt,pt,dt);
PyObject *ob1=PyTuple_GetItem(value,1);
convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(ob1,nbCompo,sw2,ic,vc,pc,dc);
* if value list[int,double] -> cpp std::vector<double> sw=4
* if value tuple[int,double] -> cpp std::vector<double> sw=4
*/
-static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f,
- const char *msg, int nbTuplesExpected, int nbCompExpected, bool throwIfNullPt)
+static const double *convertObjToPossibleCpp5_Safe(PyObject *value, mcIdType& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f,
+ const char *msg, mcIdType nbTuplesExpected, int nbCompExpected, bool throwIfNullPt)
{
sw=-1;
if(PyFloat_Check(value))
{
try
{
- int tmp1=nbTuplesExpected,tmp2=nbCompExpected;
+ mcIdType tmp1=nbTuplesExpected,tmp2=nbCompExpected;
std::vector<double> ret=fillArrayWithPyListDbl2(value,tmp1,tmp2);
sw=4;
f=ret;
{
if(d->getNumberOfTuples()==nbTuplesExpected)
{
- if(d->getNumberOfComponents()==nbCompExpected)
+ if(ToIdType(d->getNumberOfComponents())==nbCompExpected)
{
return d->getConstPointer();
}
{
e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp);
sw=3;
- if(e->getNumberOfCompo()==nbCompExpected)
+ if(ToIdType(e->getNumberOfCompo())==nbCompExpected)
{
if(nbTuplesExpected==1)
return e->getConstPointer();
* if value list[int,double] -> cpp std::vector<double> sw=4
* if value tuple[int,double] -> cpp std::vector<double> sw=4
*/
-static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f,
- const char *msg, int nbCompExpected, bool throwIfNullPt, int& nbTuples)
+static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, mcIdType& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f,
+ const char *msg, int nbCompExpected, bool throwIfNullPt, mcIdType& nbTuples)
{
sw=-1;
if(PyFloat_Check(value))
}
if(PyTuple_Check(value))
{
- int size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
f.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyFloat_Check(o))
std::ostringstream oss; oss << msg << "dimension expected to be a multiple of " << nbCompExpected << " , and your data in input has dimension " << f.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- nbTuples=size/nbCompExpected;
+ nbTuples=ToIdType(size/nbCompExpected);
return &f[0];
}
if(PyList_Check(value))
{
- int size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
f.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyFloat_Check(o))
std::ostringstream oss; oss << msg << "dimension expected to be a multiple of " << nbCompExpected << " , and your data in input has dimension " << f.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- nbTuples=size/nbCompExpected;
+ nbTuples=ToIdType(size/nbCompExpected);
return &f[0];
}
void *argp;
sw=2;
if(d)
{
- if(d->getNumberOfComponents()==nbCompExpected)
+ if(ToIdType(d->getNumberOfComponents())==nbCompExpected)
{
nbTuples=d->getNumberOfTuples();
return d->getConstPointer();
sw=3;
if(e)
{
- if(e->getNumberOfCompo()==nbCompExpected)
+ if(ToIdType(e->getNumberOfCompo())==nbCompExpected)
{
nbTuples=1;
return e->getConstPointer();
* if value list[int,double] -> cpp std::vector<double> sw=4
* if value tuple[int,double] -> cpp std::vector<double> sw=4
*/
-static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int& sw, double& val, std::vector<double>& f,
- const char *msg, bool throwIfNullPt, int& nbTuples)
+static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, mcIdType& sw, double& val, std::vector<double>& f,
+ const char *msg, bool throwIfNullPt, mcIdType& nbTuples)
{
MEDCoupling::DataArrayDouble *d=0;
MEDCoupling::DataArrayDoubleTuple *e=0;
}
if(PyTuple_Check(value))
{
- int size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
f.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyFloat_Check(o))
}
}
sw=4;
- nbTuples=size;
+ nbTuples=ToIdType(size);
return &f[0];
}
if(PyList_Check(value))
{
- int size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
f.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyFloat_Check(o))
}
}
sw=4;
- nbTuples=size;
+ nbTuples=ToIdType(size);
return &f[0];
}
void *argp;
sw=3;
if(e)
{
- nbTuples=e->getNumberOfCompo();
+ nbTuples=ToIdType(e->getNumberOfCompo());
return e->getConstPointer();
}
else
status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
if(!SWIG_IsOK(status))
{
- status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
+ status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayInt32,0|0);
if(!SWIG_IsOK(status))
{
- status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar,0|0);
+ status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayInt64,0|0);
if(!SWIG_IsOK(status))
{
- status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayByte,0|0);
- std::ostringstream oss; oss << msg << " ! Accepted instances are DataArrayDouble, DataArrayInt, DataArrayAsciiChar, DataArrayByte !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
+ status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar,0|0);
+ if(!SWIG_IsOK(status))
+ {
+ status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayByte,0|0);
+ std::ostringstream oss; oss << msg << " ! Accepted instances are DataArrayDouble, DataArrayIdType, DataArrayAsciiChar, DataArrayByte !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
}
}
}
{
if(PyInt_Check(nbOfTuples))
{
- int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples));
if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
if(elt2)
{
if(PyInt_Check(elt2))
{//DataArrayDouble.New([1.,3.,4.,5.],2,2)
- int nbOfCompo=PyInt_AS_LONG(elt2);
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(elt2));
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
else
{//DataArrayDouble.New([1.,3.,4.],3)
MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
- int tmpp1(-1);
+ mcIdType tmpp1(-1);
std::vector<double> tmp(fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1));
ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
return ret.retn();
else
{// DataArrayDouble.New([1.,3.,4.])
MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
- int tmpp1(-1),tmpp2(-1);
+ mcIdType tmpp1(-1),tmpp2(-1);
std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
return ret.retn();
}
else if(PyInt_Check(elt0))
{
- int nbOfTuples1(PyInt_AS_LONG(elt0));
+ mcIdType nbOfTuples1(ToIdType(PyInt_AS_LONG(elt0)));
if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
if(nbOfTuples)
{
if(PyInt_Check(nbOfTuples))
{//DataArrayDouble.New(5,2)
- int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfTuples));
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
{
self->checkAllocated();
const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
- int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
- int sw1,sw2;
+ mcIdType nbOfTuples(self->getNumberOfTuples());
+ int nbOfComponents((int)(self->getNumberOfComponents()));
+ mcIdType sw1,sw2;
T i1;
std::vector<T> v1;
typename MEDCoupling::Traits<T>::ArrayType *d1=0;
considerPyObjAsATStarLikeObject<T>(value,sw1,i1,v1,d1,ti);
- int it1,ic1;
- std::vector<int> vt1,vc1;
- std::pair<int, std::pair<int,int> > pt1,pc1;
- MEDCoupling::DataArrayInt *dt1=0,*dc1=0;
+ mcIdType it1,ic1;
+ std::vector<mcIdType> vt1;
+ std::vector<mcIdType> vc1;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > pt1,pc1;
+ MEDCoupling::DataArrayIdType *dt1=0,*dc1=0;
convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > tmp;
switch(sw2)
const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
self->checkAllocated();
- int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
- int it1,ic1;
- std::vector<int> vt1,vc1;
- std::pair<int, std::pair<int,int> > pt1,pc1;
- MEDCoupling::DataArrayInt *dt1=0,*dc1=0;
- int sw;
+ mcIdType nbOfTuples(self->getNumberOfTuples());
+ int nbOfComponents((int)(self->getNumberOfComponents()));
+ mcIdType it1;
+ std::size_t ic1;
+ std::vector<mcIdType> vt1;
+ std::vector<std::size_t> vc1;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > pt1,pc1;
+ MEDCoupling::DataArrayIdType *dt1=0,*dc1=0;
+ mcIdType sw;
convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
MEDCoupling::MCAuto<typename MEDCoupling::Traits<T>::ArrayType > ret;
switch(sw)
case 6:
{
ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- std::vector<int> v2(1,ic1);
+ std::vector<std::size_t> v2(1,ic1);
return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
}
case 7:
{
ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
- std::vector<int> v2(1,ic1);
+ std::vector<std::size_t> v2(1,ic1);
return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
}
case 8:
{
ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- std::vector<int> v2(1,ic1);
+ std::vector<std::size_t> v2(1,ic1);
return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
}
case 9:
case 13:
{
ret=self->selectByTupleIdSafe(&it1,&it1+1);
- int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
- std::vector<int> v2(nbOfComp);
- for(int i=0;i<nbOfComp;i++)
+ mcIdType nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
+ std::vector<std::size_t> v2(nbOfComp);
+ for(mcIdType i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
}
case 14:
{
ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
- std::vector<int> v2(nbOfComp);
+ mcIdType nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
+ std::vector<std::size_t> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
case 15:
{
ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
- int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
- std::vector<int> v2(nbOfComp);
+ mcIdType nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
+ std::vector<std::size_t> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
case 16:
{
ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
- std::vector<int> v2(nbOfComp);
+ mcIdType nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
+ std::vector<std::size_t> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
#endif
}
-void convertCSR_MCDataToVectMapIntDouble(const MEDCoupling::DataArrayInt *indptrPtr, const MEDCoupling::DataArrayInt *indicesPtr, const MEDCoupling::DataArrayDouble *dataPtr, std::vector<std::map<int,double> >& mCpp)
+void convertCSR_MCDataToVectMapIntDouble(const MEDCoupling::DataArrayInt32 *indptrPtr, const MEDCoupling::DataArrayInt32 *indicesPtr, const MEDCoupling::DataArrayDouble *dataPtr, std::vector<std::map<mcIdType,double> >& mCpp)
{
auto nbOfRows(indptrPtr->getNumberOfTuples()-1);
if(nbOfRows<0)
}
}
-void convertToVectMapIntDouble(PyObject *pyobj, std::vector<std::map<int,double> >& mCpp)
+void convertToVectMapIntDouble(PyObject *pyobj, std::vector<std::map<mcIdType,double> >& mCpp)
{
if(!PyList_Check(pyobj))
throw INTERP_KERNEL::Exception("convertToVectMapIntDouble : input is not a python list !");
}
PyObject *key, *value;
Py_ssize_t pos(0);
- std::map<int,double>& mapCpp(mCpp[i]);
+ std::map<mcIdType,double>& mapCpp(mCpp[i]);
while(PyDict_Next(elt,&pos,&key,&value))
{
if(!PyInt_Check(key))
std::ostringstream oss; oss << "convertToVectMapIntDouble : at pos # " << i << " of pylist the dict contains at pos " << pos << " the value not mappable to pyfloat !";
throw INTERP_KERNEL::Exception(oss.str());
}
- mapCpp[(int)PyInt_AS_LONG(key)]=PyFloat_AS_DOUBLE(value);
+ mapCpp[ToIdType(PyInt_AS_LONG(key))]=PyFloat_AS_DOUBLE(value);
}
}
}
typename MEDCoupling::Traits<T>::ArrayType *a;
typename MEDCoupling::Traits<T>::ArrayTuple *aa;
std::vector<T> bb;
- int sw;
+ mcIdType sw;
convertFPStarLikePyObjToCpp_2<T>(obj,sw,val,a,aa,bb,ti_da,ti_tuple);
switch(sw)
{
}
case 4:
{
- MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size());
self->multiplyEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
typename MEDCoupling::Traits<T>::ArrayType *a;
typename MEDCoupling::Traits<T>::ArrayTuple *aa;
std::vector<T> bb;
- int sw;
+ mcIdType sw;
convertFPStarLikePyObjToCpp_2<T>(obj,sw,val,a,aa,bb,ti_da,ti_tuple);
switch(sw)
{
{
if(val==0.)
throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
- self->applyLin(1./val,0.);
+ self->applyLin((T)(1./val),(T)0.);
Py_XINCREF(trueSelf);
return trueSelf;
}
}
case 4:
{
- MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size());
self->divideEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
typename MEDCoupling::Traits<T>::ArrayType *a;
typename MEDCoupling::Traits<T>::ArrayTuple *aa;
std::vector<T> bb;
- int sw;
+ mcIdType sw;
convertFPStarLikePyObjToCpp_2<T>(obj,sw,val,a,aa,bb,ti_da,ti_tuple);
switch(sw)
{
}
case 4:
{
- MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size());
self->addEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
typename MEDCoupling::Traits<T>::ArrayType *a;
typename MEDCoupling::Traits<T>::ArrayTuple *aa;
std::vector<T> bb;
- int sw;
+ mcIdType sw;
convertFPStarLikePyObjToCpp_2<T>(obj,sw,val,a,aa,bb,ti_da,ti_tuple);
switch(sw)
{
}
case 4:
{
- MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size());
self->substractEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
}
}
-template<class T>
-struct SWIGTITraits
-{ };
-
-template<>
-struct SWIGTITraits<double>
-{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
-
-template<>
-struct SWIGTITraits<float>
-{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
-
-template<>
-struct SWIGTITraits<int>
-{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
-
-swig_type_info *SWIGTITraits<double>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe()
-swig_type_info *SWIGTITraits<float>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
-swig_type_info *SWIGTITraits<int>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
-swig_type_info *SWIGTITraits<double>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe()
-swig_type_info *SWIGTITraits<float>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
-swig_type_info *SWIGTITraits<int>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
-
#ifdef WITH_NUMPY
PyTypeObject *NPYTraits<double>::NPYFunc=&PyCallBackDataArrayDouble_RefType;
PyTypeObject *NPYTraits<float>::NPYFunc=&PyCallBackDataArrayFloat_RefType;
+
+PyTypeObject *NPYTraits<int>::NPYFunc=&PyCallBackDataArrayInt32_RefType;
+
+PyTypeObject *NPYTraits<long>::NPYFunc=&PyCallBackDataArrayInt64_RefType;
#endif
template<class T>
typename MEDCoupling::Traits<T>::ArrayType *a;
typename MEDCoupling::Traits<T>::ArrayTuple *aa;
std::vector<T> bb;
- int sw;
+ mcIdType sw;
convertFPStarLikePyObjToCpp_2<T>(obj,sw,val,a,aa,bb,SWIGTITraits<T>::TI,SWIGTITraits<T>::TI_TUPLE);
switch(sw)
{
}
case 4:
{
- typename MEDCoupling::MCAuto<typename MEDCoupling::Traits<T>::ArrayType> aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ typename MEDCoupling::MCAuto<typename MEDCoupling::Traits<T>::ArrayType> aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size());
return MEDCoupling::Traits<T>::ArrayType::Multiply(self,aaa);
}
default:
virtual const char *getRepr() const;
virtual int getNumberOfTuples(const MEDCouplingMesh *mesh) const;
virtual int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
- virtual DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
+ virtual DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const;
virtual DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
virtual void checkCompatibilityWithNature(NatureOfField nat) const;
virtual double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const;
{
virtual MEDCouplingFieldDiscretization *clonePart(PyObject *li)
{
- int sz=0,sw=-1,val1=-1;
- std::vector<int> val2;
- const int *inp=convertIntStarLikePyObjToCppIntStar(li,sw,sz,val1,val2);
+ mcIdType sz=0,sw=-1,val1=-1;
+ std::vector<mcIdType> val2;
+ const mcIdType *inp=convertIntStarLikePyObjToCppIntStar(li,sw,sz,val1,val2);
return self->clonePart(inp,inp+sz);
}
- virtual PyObject *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const
+ virtual PyObject *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const
{
- DataArrayInt *ret1=0;
- int bb,ee,ss;
+ DataArrayIdType *ret1=0;
+ mcIdType bb,ee,ss;
MEDCouplingMesh *ret0=self->buildSubMeshDataRange(mesh,beginCellIds,endCellIds,stepCellIds,bb,ee,ss,ret1);
PyObject *res=PyTuple_New(2);
PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
if(ret1)
- PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
+ PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
else
{
PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
return res;
}
- virtual int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
+ virtual mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
{
- std::vector<int> inp0;
+ std::vector<mcIdType> inp0;
convertPyToNewIntArr4(code,1,3,inp0);
- std::vector<const DataArrayInt *> inp1;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(idsPerType,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",inp1);
+ std::vector<const DataArrayIdType *> inp1;
+ convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(idsPerType,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",inp1);
return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
}
virtual PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const
{
- std::vector<int> vVal; int iVal=-1;
- int sz=-1,sw=0;
- const int *tupleIdsBg=convertIntStarLikePyObjToCppIntStar(tupleIds,sw,sz,iVal,vVal);
+ std::vector<mcIdType> vVal; mcIdType iVal=-1;
+ mcIdType sz=-1,sw=0;
+ const mcIdType *tupleIdsBg=convertIntStarLikePyObjToCppIntStar(tupleIds,sw,sz,iVal,vVal);
if(sw==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::computeMeshRestrictionFromTupleIds : none parameter in input !");
- DataArrayInt *ret0=0,*ret1=0;
+ DataArrayIdType *ret0=0,*ret1=0;
self->computeMeshRestrictionFromTupleIds(mesh,tupleIdsBg,tupleIdsBg+sz,ret0,ret1);
PyObject *pyRet=PyTuple_New(2);
- PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return pyRet;
}
{
if(!arr)
throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretization::normL1 : input array is null !");
- int sz(arr->getNumberOfComponents());
+ std::size_t sz(arr->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->normL1(mesh,arr,tmp);
return convertDblArrToPyList<double>(tmp,sz);
{
if(!arr)
throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretization::normL2 : input array is null !");
- int sz(arr->getNumberOfComponents());
+ std::size_t sz(arr->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->normL2(mesh,arr,tmp);
return convertDblArrToPyList<double>(tmp,sz);
{
if(!arr)
throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretization::integral : input array is null !");
- int sz(arr->getNumberOfComponents());
+ std::size_t sz(arr->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->integral(mesh,arr,isWAbs,tmp);
return convertDblArrToPyList<double>(tmp,sz);
}
- virtual PyObject *getCellIdsHavingGaussLocalization(int locId) const
+ virtual PyObject *getCellIdsHavingGaussLocalization(mcIdType locId) const
{
- std::vector<int> tmp;
+ std::vector<mcIdType> tmp;
self->getCellIdsHavingGaussLocalization(locId,tmp);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)tmp.size(),1);
+ DataArrayIdType *ret=DataArrayIdType::New();
+ ret->alloc(tmp.size(),1);
std::copy(tmp.begin(),tmp.end(),ret->getPointer());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
virtual void setGaussLocalizationOnCells(const MEDCouplingMesh *m, PyObject *li, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg)
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
if (!SWIG_IsOK(res1))
{
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- self->setGaussLocalizationOnCells(m,tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
+ self->setGaussLocalizationOnCells(m,tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg);
}
else
{
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
da2->checkAllocated();
self->setGaussLocalizationOnCells(m,da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
}
virtual PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
{
- std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
+ std::set<mcIdType> ret=self->getGaussLocalizationIdsOfOneType(type);
return convertIntArrToPyList3(ret);
}
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
if(!mesh)
throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDiscretization::getValueOn : no underlying mesh !");
int spaceDim=mesh->getSpaceDimension();
return convertDblArrToPyList<double>(res,spaceDim);
}
- virtual PyObject *getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k) const
+ virtual PyObject *getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k) const
{
if(!arr)
throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretization::getValueOnPos : input array is null !");
- int sz(arr->getNumberOfComponents());
- INTERP_KERNEL::AutoPtr<double> res=new double[sz];
- self->getValueOnPos(arr,mesh,i,j,k,res);
- return convertDblArrToPyList<double>(res,sz);
- }
+ std::size_t sz(arr->getNumberOfComponents());
+ INTERP_KERNEL::AutoPtr<double> res=new double[sz];
+ self->getValueOnPos(arr,mesh,i,j,k,res);
+ return convertDblArrToPyList<double>(res,sz);
+ }
virtual DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, PyObject *loc) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDiscretization::getValueOnMulti : null input mesh !");
//
- int sw,nbPts;
+ mcIdType sw,nbPts;
double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
const double *inp=convertObjToPossibleCpp5_Safe2(loc,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
mesh->getSpaceDimension(),true,nbPts);
virtual void renumberCells(PyObject *li, bool check=true)
{
- int sw,sz(-1);
- int v0; std::vector<int> v1;
- const int *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
+ mcIdType sw,sz(-1);
+ mcIdType v0; std::vector<mcIdType> v1;
+ const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
self->renumberCells(ids,check);
}
std::vector<DataArray *> input1;
convertFromPyObjVectorOfObj<MEDCoupling::DataArray *>(arrays,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",input1);
//
- int sw,sz(-1);
- int v0; std::vector<int> v1;
- const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1));
+ mcIdType sw,sz(-1);
+ mcIdType v0; std::vector<mcIdType> v1;
+ const mcIdType *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1));
//
self->renumberArraysForCell(mesh,input1,old2NewBg,check);
}
- virtual DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, PyObject *cellIds) const
+ virtual DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, PyObject *cellIds) const
{
- int sw,sz(-1);
- int v0; std::vector<int> v1;
- const int *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
+ mcIdType sw,sz(-1);
+ mcIdType v0; std::vector<mcIdType> v1;
+ const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
return self->computeTupleIdsToSelectFromCellIds(mesh,cellIdsBg,cellIdsBg+sz);
}
virtual PyObject *buildSubMeshData(const MEDCouplingMesh *mesh, PyObject *ids)
{
- int sw,sz(-1);
- int v0; std::vector<int> v1;
- const int *idsBg(convertIntStarLikePyObjToCppIntStar(ids,sw,sz,v0,v1));
- DataArrayInt *di(0);
+ mcIdType sw,sz(-1);
+ mcIdType v0; std::vector<mcIdType> v1;
+ const mcIdType *idsBg(convertIntStarLikePyObjToCppIntStar(ids,sw,sz,v0,v1));
+ DataArrayIdType *di(0);
MEDCouplingMesh *ret0=self->buildSubMeshData(mesh,idsBg,idsBg+sz,di);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(di),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(di),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
- virtual void renumberValuesOnNodes(double epsOnVals, PyObject *old2New, int newNbOfNodes, DataArrayDouble *arr) const
+ virtual void renumberValuesOnNodes(double epsOnVals, PyObject *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const
{
- int sw,sz(-1);
- int v0; std::vector<int> v1;
- const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1));
+ mcIdType sw,sz(-1);
+ mcIdType v0; std::vector<mcIdType> v1;
+ const mcIdType *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1));
self->renumberValuesOnNodes(epsOnVals,old2NewBg,newNbOfNodes,arr);
}
- virtual void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, PyObject *old2New, int newSz, DataArrayDouble *arr) const
+ virtual void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, PyObject *old2New, mcIdType newSz, DataArrayDouble *arr) const
{
- int sw,sz(-1);
- int v0; std::vector<int> v1;
- const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1));
+ mcIdType sw,sz(-1);
+ mcIdType v0; std::vector<mcIdType> v1;
+ const mcIdType *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1));
self->renumberValuesOnCells(epsOnVals,mesh,old2NewBg,newSz,arr);
}
- virtual void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, PyObject *new2old, int newSz, DataArrayDouble *arr) const
+ virtual void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, PyObject *new2old, mcIdType newSz, DataArrayDouble *arr) const
{
- int sw,sz(-1);
- int v0; std::vector<int> v1;
- const int *new2oldBg(convertIntStarLikePyObjToCppIntStar(new2old,sw,sz,v0,v1));
+ mcIdType sw,sz(-1);
+ mcIdType v0; std::vector<mcIdType> v1;
+ const mcIdType *new2oldBg(convertIntStarLikePyObjToCppIntStar(new2old,sw,sz,v0,v1));
self->renumberValuesOnCellsR(mesh,new2oldBg,newSz,arr);
}
}
class MEDCouplingFieldDiscretizationPerCell : public MEDCouplingFieldDiscretization
{
public:
- void setArrayOfDiscIds(const DataArrayInt *adids);
+ void setArrayOfDiscIds(const DataArrayIdType *adids);
void checkNoOrphanCells() const;
%extend
{
PyObject *getArrayOfDiscIds() const
{
- DataArrayInt *ret=const_cast<DataArrayInt *>(self->getArrayOfDiscIds());
+ DataArrayIdType *ret=const_cast<DataArrayIdType *>(self->getArrayOfDiscIds());
if(ret)
ret->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *splitIntoSingleGaussDicrPerCellType() const
{
- std::vector<int> ret1;
- std::vector<DataArrayInt *> ret0=self->splitIntoSingleGaussDicrPerCellType(ret1);
+ std::vector<mcIdType> ret1;
+ std::vector<DataArrayIdType *> ret0=self->splitIntoSingleGaussDicrPerCellType(ret1);
std::size_t sz=ret0.size();
PyObject *pyRet=PyTuple_New(2);
- PyObject *pyRet0=PyList_New((int)sz);
- PyObject *pyRet1=PyList_New((int)sz);
+ PyObject *pyRet0=PyList_New((mcIdType)sz);
+ PyObject *pyRet1=PyList_New((mcIdType)sz);
for(std::size_t i=0;i<sz;i++)
{
- PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
}
PyTuple_SetItem(pyRet,0,pyRet0);
{
std::size_t sz(0);
const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetWeightArrayFromGeometricType(geoType,sz));
- return convertDblArrToPyList<double>(ret,sz);
+ return convertDblArrToPyList<double>(ret,ToIdType(sz));
}
static PyObject *GetRefCoordsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType)
{
std::size_t sz(0);
const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetRefCoordsFromGeometricType(geoType,sz));
- return convertDblArrToPyList<double>(ret,sz);
+ return convertDblArrToPyList<double>(ret,ToIdType(sz));
}
static PyObject *GetLocsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType)
{
std::size_t sz(0);
const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetLocsFromGeometricType(geoType,sz));
- return convertDblArrToPyList<double>(ret,sz);
+ return convertDblArrToPyList<double>(ret,ToIdType(sz));
}
}
};
class MEDCouplingFieldDiscretizationKriging : public MEDCouplingFieldDiscretizationOnNodes
{
public:
- static DataArrayDouble *PerformDriftOfVec(const DataArrayDouble *arr, int isDrift);
+ static DataArrayDouble *PerformDriftOfVec(const DataArrayDouble *arr, mcIdType isDrift);
%extend
{
PyObject *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr) const
{
- int ret1;
+ mcIdType ret1;
DataArrayDouble *ret0=self->computeVectorOfCoefficients(mesh,arr,ret1);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
PyObject *computeInverseMatrix(const MEDCouplingMesh *mesh) const
{
- int ret1(-1),ret2(-1);
+ mcIdType ret1(-1),ret2(-1);
DataArrayDouble *ret0=self->computeInverseMatrix(mesh,ret1,ret2);
PyObject *ret=PyTuple_New(3);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
PyObject *computeMatrix(const MEDCouplingMesh *mesh) const
{
- int ret1(-1),ret2(-1);
+ mcIdType ret1(-1),ret2(-1);
DataArrayDouble *ret0=self->computeMatrix(mesh,ret1,ret2);
PyObject *ret=PyTuple_New(3);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
{
if(!mesh)
throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixOnGivenPts : input mesh is empty !");
- int sw,nbPts;
+ mcIdType sw,nbPts;
double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixOnGivenPts",
mesh->getSpaceDimension(),true,nbPts);
//
- int ret1(-1);
+ mcIdType ret1(-1);
DataArrayDouble *ret0=self->computeEvaluationMatrixOnGivenPts(mesh,inp,nbPts,ret1);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
PyObject *performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr) const
{
- int ret1(-1);
+ mcIdType ret1(-1);
DataArrayDouble *ret0(self->performDrift(matr,arr,ret1));
PyObject *res(PyTuple_New(2));
PyTuple_SetItem(res,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0));
static PyObject *PerformDriftRect(const DataArrayDouble *matr, const DataArrayDouble *arr)
{
- int ret1(-1);
+ mcIdType ret1(-1);
DataArrayDouble *ret0(MEDCouplingFieldDiscretizationKriging::PerformDriftRect(matr,arr,ret1));
PyObject *res(PyTuple_New(2));
PyTuple_SetItem(res,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0));
DataArrayDouble.__ifloordiv__=MEDCouplingDataArrayDoubleIdiv
DataArrayDouble.__rfloordiv__=DataArrayDouble.__rdiv__
-DataArrayInt.__reduce__=MEDCouplingDataArrayIntReduce
-DataArrayInt.__iadd__=MEDCouplingDataArrayIntIadd
-DataArrayInt.__isub__=MEDCouplingDataArrayIntIsub
-DataArrayInt.__imul__=MEDCouplingDataArrayIntImul
-DataArrayInt.__idiv__=MEDCouplingDataArrayIntIdiv
-DataArrayInt.__imod__=MEDCouplingDataArrayIntImod
-DataArrayInt.__ipow__=MEDCouplingDataArrayIntIpow
-DataArrayInt.__truediv__=DataArrayInt.__div__
-DataArrayInt.__itruediv__=MEDCouplingDataArrayIntIdiv
-DataArrayInt.__rtruediv__=DataArrayInt.__rdiv__
-DataArrayInt.__floordiv__=DataArrayInt.__div__
-DataArrayInt.__ifloordiv__=MEDCouplingDataArrayIntIdiv
-DataArrayInt.__rfloordiv__=DataArrayInt.__rdiv__
+DataArrayInt32.__reduce__=MEDCouplingDataArrayInt32Reduce
+DataArrayInt32.__iadd__=MEDCouplingDataArrayInt32Iadd
+DataArrayInt32.__isub__=MEDCouplingDataArrayInt32Isub
+DataArrayInt32.__imul__=MEDCouplingDataArrayInt32Imul
+DataArrayInt32.__idiv__=MEDCouplingDataArrayInt32Idiv
+DataArrayInt32.__imod__=MEDCouplingDataArrayInt32Imod
+DataArrayInt32.__ipow__=MEDCouplingDataArrayInt32Ipow
+DataArrayInt32.__truediv__=DataArrayInt32.__div__
+DataArrayInt32.__itruediv__=MEDCouplingDataArrayInt32Idiv
+DataArrayInt32.__rtruediv__=DataArrayInt32.__rdiv__
+DataArrayInt32.__floordiv__=DataArrayInt32.__div__
+DataArrayInt32.__ifloordiv__=MEDCouplingDataArrayInt32Idiv
+DataArrayInt32.__rfloordiv__=DataArrayInt32.__rdiv__
+
+DataArrayInt64.__reduce__=MEDCouplingDataArrayInt64Reduce
+DataArrayInt64.__iadd__=MEDCouplingDataArrayInt64Iadd
+DataArrayInt64.__isub__=MEDCouplingDataArrayInt64Isub
+DataArrayInt64.__imul__=MEDCouplingDataArrayInt64Imul
+DataArrayInt64.__idiv__=MEDCouplingDataArrayInt64Idiv
+DataArrayInt64.__imod__=MEDCouplingDataArrayInt64Imod
+DataArrayInt64.__ipow__=MEDCouplingDataArrayInt64Ipow
+DataArrayInt64.__truediv__=DataArrayInt64.__div__
+DataArrayInt64.__itruediv__=MEDCouplingDataArrayInt64Idiv
+DataArrayInt64.__rtruediv__=DataArrayInt64.__rdiv__
+DataArrayInt64.__floordiv__=DataArrayInt64.__div__
+DataArrayInt64.__ifloordiv__=MEDCouplingDataArrayInt64Idiv
+DataArrayInt64.__rfloordiv__=DataArrayInt64.__rdiv__
DataArrayByte.__reduce__=MEDCouplingDataArrayByteReduce
DataArrayDoubleTuple.__itruediv__=MEDCouplingDataArrayDoubleTupleIdiv
DataArrayDoubleTuple.__ifloordiv__=MEDCouplingDataArrayDoubleTupleIdiv
-DataArrayIntTuple.__iadd__=MEDCouplingDataArrayIntTupleIadd
-DataArrayIntTuple.__isub__=MEDCouplingDataArrayIntTupleIsub
-DataArrayIntTuple.__imul__=MEDCouplingDataArrayIntTupleImul
-DataArrayIntTuple.__idiv__=MEDCouplingDataArrayIntTupleIdiv
-DataArrayIntTuple.__itruediv__=MEDCouplingDataArrayIntTupleIdiv
-DataArrayIntTuple.__ifloordiv__=MEDCouplingDataArrayIntTupleIdiv
-DataArrayIntTuple.__imod__=MEDCouplingDataArrayIntTupleImod
+DataArrayInt32Tuple.__iadd__=MEDCouplingDataArrayInt32TupleIadd
+DataArrayInt32Tuple.__isub__=MEDCouplingDataArrayInt32TupleIsub
+DataArrayInt32Tuple.__imul__=MEDCouplingDataArrayInt32TupleImul
+DataArrayInt32Tuple.__idiv__=MEDCouplingDataArrayInt32TupleIdiv
+DataArrayInt32Tuple.__itruediv__=MEDCouplingDataArrayInt32TupleIdiv
+DataArrayInt32Tuple.__ifloordiv__=MEDCouplingDataArrayInt32TupleIdiv
+DataArrayInt32Tuple.__imod__=MEDCouplingDataArrayInt32TupleImod
+
+DataArrayInt64Tuple.__iadd__=MEDCouplingDataArrayInt64TupleIadd
+DataArrayInt64Tuple.__isub__=MEDCouplingDataArrayInt64TupleIsub
+DataArrayInt64Tuple.__imul__=MEDCouplingDataArrayInt64TupleImul
+DataArrayInt64Tuple.__idiv__=MEDCouplingDataArrayInt64TupleIdiv
+DataArrayInt64Tuple.__itruediv__=MEDCouplingDataArrayInt64TupleIdiv
+DataArrayInt64Tuple.__ifloordiv__=MEDCouplingDataArrayInt64TupleIdiv
+DataArrayInt64Tuple.__imod__=MEDCouplingDataArrayInt64TupleImod
DenseMatrix.__iadd__=MEDCouplingDenseMatrixIadd
DenseMatrix.__isub__=MEDCouplingDenseMatrixIsub
MEDCouplingMappedExtrudedMesh.__reduce__=MEDCouplingMappedExtrudedMeshReduce
DataArrayAsciiCharIterator.__next__ = DataArrayAsciiCharIterator.next
-DataArrayIntIterator.__next__ = DataArrayIntIterator.next
+DataArrayInt32Iterator.__next__ = DataArrayInt32Iterator.next
+DataArrayInt64Iterator.__next__ = DataArrayInt64Iterator.next
DataArrayDoubleIterator.__next__ = DataArrayDoubleIterator.next
MEDCouplingUMeshCellIterator.__next__ = MEDCouplingUMeshCellIterator.next
MEDCouplingUMeshCellByTypeIterator.__next__ = MEDCouplingUMeshCellByTypeIterator.next
+
del INTERPKERNELExceptionReduce
-del MEDCouplingDataArrayDoubleReduce
-del MEDCouplingDataArrayFloatReduce
-del MEDCouplingDataArrayIntReduce
-del MEDCouplingDataArrayByteReduce
-del MEDCouplingUMeshReduce
+del MEDCoupling1SGTUMeshReduce
del MEDCouplingCMeshReduce
-del MEDCouplingIMeshReduce
-del MEDCouplingMappedExtrudedMeshReduce
del MEDCouplingCurveLinearMeshReduce
-del MEDCoupling1SGTUMeshReduce
-del MEDCoupling1DGTUMeshReduce
-del MEDCouplingFieldDoubleReduce
-del MEDCouplingFieldFloatReduce
-del MEDCouplingFieldIntReduce
-del MEDCouplingFieldTemplateReduce
+del MEDCouplingDataArrayByteReduce
del MEDCouplingDataArrayDoubleIadd
-del MEDCouplingDataArrayDoubleIsub
-del MEDCouplingDataArrayDoubleImul
del MEDCouplingDataArrayDoubleIdiv
-del MEDCouplingFieldDoubleIadd
-del MEDCouplingFieldDoubleIsub
-del MEDCouplingFieldDoubleImul
-del MEDCouplingFieldDoubleIdiv
-del MEDCouplingFieldDoubleIpow
-del MEDCouplingDataArrayIntIadd
-del MEDCouplingDataArrayIntIsub
-del MEDCouplingDataArrayIntImul
-del MEDCouplingDataArrayIntIdiv
-del MEDCouplingDataArrayIntImod
-del MEDCouplingDataArrayFloatIadd
-del MEDCouplingDataArrayFloatIsub
-del MEDCouplingDataArrayFloatImul
-del MEDCouplingDataArrayFloatIdiv
+del MEDCouplingDataArrayDoubleImul
+del MEDCouplingDataArrayDoubleIpow
+del MEDCouplingDataArrayDoubleIsub
+del MEDCouplingDataArrayDoubleReduce
del MEDCouplingDataArrayDoubleTupleIadd
-del MEDCouplingDataArrayDoubleTupleIsub
-del MEDCouplingDataArrayDoubleTupleImul
del MEDCouplingDataArrayDoubleTupleIdiv
-del MEDCouplingDataArrayIntTupleIadd
-del MEDCouplingDataArrayIntTupleIsub
-del MEDCouplingDataArrayIntTupleImul
-del MEDCouplingDataArrayIntTupleIdiv
-del MEDCouplingDataArrayIntTupleImod
+del MEDCouplingDataArrayDoubleTupleImul
+del MEDCouplingDataArrayDoubleTupleIsub
+del MEDCouplingDataArrayFloatIadd
+del MEDCouplingDataArrayFloatIdiv
+del MEDCouplingDataArrayFloatImul
+del MEDCouplingDataArrayFloatIsub
+del MEDCouplingDataArrayFloatReduce
+del MEDCouplingDataArrayInt32Iadd
+del MEDCouplingDataArrayInt32Idiv
+del MEDCouplingDataArrayInt32Imod
+del MEDCouplingDataArrayInt32Imul
+del MEDCouplingDataArrayInt32Ipow
+del MEDCouplingDataArrayInt32Isub
+del MEDCouplingDataArrayInt32Reduce
+del MEDCouplingDataArrayInt32TupleIadd
+del MEDCouplingDataArrayInt32TupleIdiv
+del MEDCouplingDataArrayInt32TupleImod
+del MEDCouplingDataArrayInt32TupleImul
+del MEDCouplingDataArrayInt32TupleIsub
+del MEDCouplingDataArrayInt64Iadd
+del MEDCouplingDataArrayInt64Idiv
+del MEDCouplingDataArrayInt64Imod
+del MEDCouplingDataArrayInt64Imul
+del MEDCouplingDataArrayInt64Ipow
+del MEDCouplingDataArrayInt64Isub
+del MEDCouplingDataArrayInt64Reduce
+del MEDCouplingDataArrayInt64TupleIadd
+del MEDCouplingDataArrayInt64TupleIdiv
+del MEDCouplingDataArrayInt64TupleImod
+del MEDCouplingDataArrayInt64TupleImul
+del MEDCouplingDataArrayInt64TupleIsub
del MEDCouplingDenseMatrixIadd
del MEDCouplingDenseMatrixIsub
+del MEDCouplingFieldDoubleIadd
+del MEDCouplingFieldDoubleIdiv
+del MEDCouplingFieldDoubleImul
+del MEDCouplingFieldDoubleIpow
+del MEDCouplingFieldDoubleIsub
+del MEDCouplingFieldDoubleReduce
+del MEDCouplingFieldFloatReduce
+del MEDCouplingFieldIntReduce
+del MEDCouplingFieldTemplateReduce
+del MEDCouplingIMeshReduce
+del MEDCouplingMappedExtrudedMeshReduce
+del MEDCouplingUMeshReduce
%}
$result=convertDataArrayChar($1,$owner);
}
-%typemap(out) MCAuto<MEDCoupling::DataArrayInt>
+%typemap(out) MCAuto<MEDCoupling::DataArrayInt32>
{
- $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN|0);
+ $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt32,SWIG_POINTER_OWN|0);
+}
+
+%typemap(out) MCAuto<MEDCoupling::DataArrayInt64>
+{
+ $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt64,SWIG_POINTER_OWN|0);
+}
+
+%typemap(out) MCAuto<MEDCoupling::DataArrayIdType>
+{
+ $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN|0);
}
%typemap(out) MCAuto<MEDCoupling::DataArrayDouble>
%newobject MEDCoupling::DataArrayFloat::__iter__;
%newobject MEDCoupling::DataArrayFloat::Meld;
%newobject MEDCoupling::DataArrayFloat::__rmul__;
-%newobject MEDCoupling::DataArrayInt::New;
-%newobject MEDCoupling::DataArrayInt::__iter__;
-%newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
-%newobject MEDCoupling::DataArrayInt::subArray;
-%newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
-%newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
-%newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
-%newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
-%newobject MEDCoupling::DataArrayInt::renumber;
-%newobject MEDCoupling::DataArrayInt::renumberR;
-%newobject MEDCoupling::DataArrayInt::renumberAndReduce;
-%newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
-%newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
-%newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
-%newobject MEDCoupling::DataArrayInt::findIdsEqual;
-%newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
-%newobject MEDCoupling::DataArrayInt::findIdsEqualList;
-%newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
-%newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
-%newobject MEDCoupling::DataArrayInt::findIdForEach;
-%newobject MEDCoupling::DataArrayInt::sumPerTuple;
-%newobject MEDCoupling::DataArrayInt::negate;
-%newobject MEDCoupling::DataArrayInt::computeAbs;
-%newobject MEDCoupling::DataArrayInt::findIdsInRange;
-%newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
-%newobject MEDCoupling::DataArrayInt::findIdsStrictlyNegative;
-%newobject MEDCoupling::DataArrayInt::Aggregate;
-%newobject MEDCoupling::DataArrayInt::AggregateIndexes;
-%newobject MEDCoupling::DataArrayInt::Meld;
-%newobject MEDCoupling::DataArrayInt::Add;
-%newobject MEDCoupling::DataArrayInt::Substract;
-%newobject MEDCoupling::DataArrayInt::Multiply;
-%newobject MEDCoupling::DataArrayInt::Divide;
-%newobject MEDCoupling::DataArrayInt::Pow;
-%newobject MEDCoupling::DataArrayInt::BuildUnion;
-%newobject MEDCoupling::DataArrayInt::BuildIntersection;
-%newobject MEDCoupling::DataArrayInt::Range;
-%newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
-%newobject MEDCoupling::DataArrayInt::fromNoInterlace;
-%newobject MEDCoupling::DataArrayInt::toNoInterlace;
-%newobject MEDCoupling::DataArrayInt::buildComplement;
-%newobject MEDCoupling::DataArrayInt::buildUnion;
-%newobject MEDCoupling::DataArrayInt::buildSubstraction;
-%newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
-%newobject MEDCoupling::DataArrayInt::buildIntersection;
-%newobject MEDCoupling::DataArrayInt::buildUnique;
-%newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
-%newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
-%newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
-%newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
-%newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
-%newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
-%newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
-%newobject MEDCoupling::DataArrayInt::buildPermutationArr;
-%newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
-%newobject MEDCoupling::DataArrayInt::getDifferentValues;
-%newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
-%newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
-%newobject MEDCoupling::DataArrayInt::__neg__;
-%newobject MEDCoupling::DataArrayInt::__add__;
-%newobject MEDCoupling::DataArrayInt::__radd__;
-%newobject MEDCoupling::DataArrayInt::__sub__;
-%newobject MEDCoupling::DataArrayInt::__rsub__;
-%newobject MEDCoupling::DataArrayInt::__mul__;
-%newobject MEDCoupling::DataArrayInt::__rmul__;
-%newobject MEDCoupling::DataArrayInt::__div__;
-%newobject MEDCoupling::DataArrayInt::__rdiv__;
-%newobject MEDCoupling::DataArrayInt::__mod__;
-%newobject MEDCoupling::DataArrayInt::__rmod__;
-%newobject MEDCoupling::DataArrayInt::__pow__;
-%newobject MEDCoupling::DataArrayInt::__rpow__;
-%newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
+%newobject MEDCoupling::DataArrayInt32::New;
+%newobject MEDCoupling::DataArrayInt32::__iter__;
+%newobject MEDCoupling::DataArrayInt32::performCopyOrIncrRef;
+%newobject MEDCoupling::DataArrayInt32::subArray;
+%newobject MEDCoupling::DataArrayInt32::changeNbOfComponents;
+%newobject MEDCoupling::DataArrayInt32::accumulatePerChunck;
+%newobject MEDCoupling::DataArrayInt32::checkAndPreparePermutation;
+%newobject MEDCoupling::DataArrayInt32::transformWithIndArrR;
+%newobject MEDCoupling::DataArrayInt32::renumber;
+%newobject MEDCoupling::DataArrayInt32::renumberR;
+%newobject MEDCoupling::DataArrayInt32::renumberAndReduce;
+%newobject MEDCoupling::DataArrayInt32::invertArrayO2N2N2O;
+%newobject MEDCoupling::DataArrayInt32::invertArrayN2O2O2N;
+%newobject MEDCoupling::DataArrayInt32::invertArrayO2N2N2OBis;
+%newobject MEDCoupling::DataArrayInt32::findIdsEqual;
+%newobject MEDCoupling::DataArrayInt32::findIdsNotEqual;
+%newobject MEDCoupling::DataArrayInt32::findIdsEqualList;
+%newobject MEDCoupling::DataArrayInt32::findIdsNotEqualList;
+%newobject MEDCoupling::DataArrayInt32::findIdsEqualTuple;
+%newobject MEDCoupling::DataArrayInt32::findIdForEach;
+%newobject MEDCoupling::DataArrayInt32::sumPerTuple;
+%newobject MEDCoupling::DataArrayInt32::negate;
+%newobject MEDCoupling::DataArrayInt32::computeAbs;
+%newobject MEDCoupling::DataArrayInt32::findIdsInRange;
+%newobject MEDCoupling::DataArrayInt32::findIdsNotInRange;
+%newobject MEDCoupling::DataArrayInt32::findIdsStrictlyNegative;
+%newobject MEDCoupling::DataArrayInt32::Aggregate;
+%newobject MEDCoupling::DataArrayInt32::AggregateIndexes;
+%newobject MEDCoupling::DataArrayInt32::Meld;
+%newobject MEDCoupling::DataArrayInt32::Add;
+%newobject MEDCoupling::DataArrayInt32::Substract;
+%newobject MEDCoupling::DataArrayInt32::Multiply;
+%newobject MEDCoupling::DataArrayInt32::Divide;
+%newobject MEDCoupling::DataArrayInt32::Pow;
+%newobject MEDCoupling::DataArrayInt32::BuildUnion;
+%newobject MEDCoupling::DataArrayInt32::BuildIntersection;
+%newobject MEDCoupling::DataArrayInt32::Range;
+%newobject MEDCoupling::DataArrayInt32::indicesOfSubPart;
+%newobject MEDCoupling::DataArrayInt32::fromNoInterlace;
+%newobject MEDCoupling::DataArrayInt32::toNoInterlace;
+%newobject MEDCoupling::DataArrayInt32::buildComplement;
+%newobject MEDCoupling::DataArrayInt32::buildUnion;
+%newobject MEDCoupling::DataArrayInt32::buildSubstraction;
+%newobject MEDCoupling::DataArrayInt32::buildSubstractionOptimized;
+%newobject MEDCoupling::DataArrayInt32::buildIntersection;
+%newobject MEDCoupling::DataArrayInt32::buildUnique;
+%newobject MEDCoupling::DataArrayInt32::buildUniqueNotSorted;
+%newobject MEDCoupling::DataArrayInt32::deltaShiftIndex;
+%newobject MEDCoupling::DataArrayInt32::buildExplicitArrByRanges;
+%newobject MEDCoupling::DataArrayInt32::buildExplicitArrOfSliceOnScaledArr;
+%newobject MEDCoupling::DataArrayInt32::findRangeIdForEachTuple;
+%newobject MEDCoupling::DataArrayInt32::findIdInRangeForEachTuple;
+%newobject MEDCoupling::DataArrayInt32::duplicateEachTupleNTimes;
+%newobject MEDCoupling::DataArrayInt32::buildPermutationArr;
+%newobject MEDCoupling::DataArrayInt32::buildPermArrPerLevel;
+%newobject MEDCoupling::DataArrayInt32::getDifferentValues;
+%newobject MEDCoupling::DataArrayInt32::FindPermutationFromFirstToSecond;
+%newobject MEDCoupling::DataArrayInt32::CheckAndPreparePermutation;
+%newobject MEDCoupling::DataArrayInt32::__neg__;
+%newobject MEDCoupling::DataArrayInt32::__add__;
+%newobject MEDCoupling::DataArrayInt32::__radd__;
+%newobject MEDCoupling::DataArrayInt32::__sub__;
+%newobject MEDCoupling::DataArrayInt32::__rsub__;
+%newobject MEDCoupling::DataArrayInt32::__mul__;
+%newobject MEDCoupling::DataArrayInt32::__rmul__;
+%newobject MEDCoupling::DataArrayInt32::__div__;
+%newobject MEDCoupling::DataArrayInt32::__rdiv__;
+%newobject MEDCoupling::DataArrayInt32::__mod__;
+%newobject MEDCoupling::DataArrayInt32::__rmod__;
+%newobject MEDCoupling::DataArrayInt32::__pow__;
+%newobject MEDCoupling::DataArrayInt32::__rpow__;
+%newobject MEDCoupling::DataArrayInt32Tuple::buildDAInt;
+%newobject MEDCoupling::DataArrayInt64::New;
+%newobject MEDCoupling::DataArrayInt64::__iter__;
+%newobject MEDCoupling::DataArrayInt64::performCopyOrIncrRef;
+%newobject MEDCoupling::DataArrayInt64::subArray;
+%newobject MEDCoupling::DataArrayInt64::changeNbOfComponents;
+%newobject MEDCoupling::DataArrayInt64::accumulatePerChunck;
+%newobject MEDCoupling::DataArrayInt64::checkAndPreparePermutation;
+%newobject MEDCoupling::DataArrayInt64::transformWithIndArrR;
+%newobject MEDCoupling::DataArrayInt64::renumber;
+%newobject MEDCoupling::DataArrayInt64::renumberR;
+%newobject MEDCoupling::DataArrayInt64::renumberAndReduce;
+%newobject MEDCoupling::DataArrayInt64::invertArrayO2N2N2O;
+%newobject MEDCoupling::DataArrayInt64::invertArrayN2O2O2N;
+%newobject MEDCoupling::DataArrayInt64::invertArrayO2N2N2OBis;
+%newobject MEDCoupling::DataArrayInt64::findIdsEqual;
+%newobject MEDCoupling::DataArrayInt64::findIdsNotEqual;
+%newobject MEDCoupling::DataArrayInt64::findIdsEqualList;
+%newobject MEDCoupling::DataArrayInt64::findIdsNotEqualList;
+%newobject MEDCoupling::DataArrayInt64::findIdsEqualTuple;
+%newobject MEDCoupling::DataArrayInt64::findIdForEach;
+%newobject MEDCoupling::DataArrayInt64::sumPerTuple;
+%newobject MEDCoupling::DataArrayInt64::negate;
+%newobject MEDCoupling::DataArrayInt64::computeAbs;
+%newobject MEDCoupling::DataArrayInt64::findIdsInRange;
+%newobject MEDCoupling::DataArrayInt64::findIdsNotInRange;
+%newobject MEDCoupling::DataArrayInt64::findIdsStrictlyNegative;
+%newobject MEDCoupling::DataArrayInt64::Aggregate;
+%newobject MEDCoupling::DataArrayInt64::AggregateIndexes;
+%newobject MEDCoupling::DataArrayInt64::Meld;
+%newobject MEDCoupling::DataArrayInt64::Add;
+%newobject MEDCoupling::DataArrayInt64::Substract;
+%newobject MEDCoupling::DataArrayInt64::Multiply;
+%newobject MEDCoupling::DataArrayInt64::Divide;
+%newobject MEDCoupling::DataArrayInt64::Pow;
+%newobject MEDCoupling::DataArrayInt64::BuildUnion;
+%newobject MEDCoupling::DataArrayInt64::BuildIntersection;
+%newobject MEDCoupling::DataArrayInt64::Range;
+%newobject MEDCoupling::DataArrayInt64::indicesOfSubPart;
+%newobject MEDCoupling::DataArrayInt64::fromNoInterlace;
+%newobject MEDCoupling::DataArrayInt64::toNoInterlace;
+%newobject MEDCoupling::DataArrayInt64::buildComplement;
+%newobject MEDCoupling::DataArrayInt64::buildUnion;
+%newobject MEDCoupling::DataArrayInt64::buildSubstraction;
+%newobject MEDCoupling::DataArrayInt64::buildSubstractionOptimized;
+%newobject MEDCoupling::DataArrayInt64::buildIntersection;
+%newobject MEDCoupling::DataArrayInt64::buildUnique;
+%newobject MEDCoupling::DataArrayInt64::buildUniqueNotSorted;
+%newobject MEDCoupling::DataArrayInt64::deltaShiftIndex;
+%newobject MEDCoupling::DataArrayInt64::buildExplicitArrByRanges;
+%newobject MEDCoupling::DataArrayInt64::buildExplicitArrOfSliceOnScaledArr;
+%newobject MEDCoupling::DataArrayInt64::findRangeIdForEachTuple;
+%newobject MEDCoupling::DataArrayInt64::findIdInRangeForEachTuple;
+%newobject MEDCoupling::DataArrayInt64::duplicateEachTupleNTimes;
+%newobject MEDCoupling::DataArrayInt64::buildPermutationArr;
+%newobject MEDCoupling::DataArrayInt64::buildPermArrPerLevel;
+%newobject MEDCoupling::DataArrayInt64::getDifferentValues;
+%newobject MEDCoupling::DataArrayInt64::FindPermutationFromFirstToSecond;
+%newobject MEDCoupling::DataArrayInt64::CheckAndPreparePermutation;
+%newobject MEDCoupling::DataArrayInt64::__neg__;
+%newobject MEDCoupling::DataArrayInt64::__add__;
+%newobject MEDCoupling::DataArrayInt64::__radd__;
+%newobject MEDCoupling::DataArrayInt64::__sub__;
+%newobject MEDCoupling::DataArrayInt64::__rsub__;
+%newobject MEDCoupling::DataArrayInt64::__mul__;
+%newobject MEDCoupling::DataArrayInt64::__rmul__;
+%newobject MEDCoupling::DataArrayInt64::__div__;
+%newobject MEDCoupling::DataArrayInt64::__rdiv__;
+%newobject MEDCoupling::DataArrayInt64::__mod__;
+%newobject MEDCoupling::DataArrayInt64::__rmod__;
+%newobject MEDCoupling::DataArrayInt64::__pow__;
+%newobject MEDCoupling::DataArrayInt64::__rpow__;
+%newobject MEDCoupling::DataArrayInt64Tuple::buildDAInt;
%newobject MEDCoupling::DataArrayChar::convertToIntArr;
%newobject MEDCoupling::DataArrayChar::renumber;
%newobject MEDCoupling::DataArrayChar::renumberR;
%feature("unref") DataArray "$this->decrRef();"
%feature("unref") DataArrayDouble "$this->decrRef();"
-%feature("unref") DataArrayInt "$this->decrRef();"
+%feature("unref") DataArrayInt32 "$this->decrRef();"
+%feature("unref") DataArrayInt64 "$this->decrRef();"
%feature("unref") DataArrayChar "$this->decrRef();"
%feature("unref") DataArrayAsciiChar "$this->decrRef();"
%feature("unref") DataArrayByte "$this->decrRef();"
AX_SPHER = 5
} MEDCouplingAxisType;
- class DataArrayInt;
+ class DataArrayInt32;
+ class DataArrayInt64;
+
+#ifndef MEDCOUPLING_USE_64BIT_IDS
+typedef DataArrayInt32 DataArrayIdType;
+#define DataArrayIdType DataArrayInt32
+#else
+typedef DataArrayInt64 DataArrayIdType;
+#define DataArrayIdType DataArrayInt64
+#endif
class MapII : public RefCountObject, public TimeLabel
{
{
public:
static PartDefinition *New(int start, int stop, int step);
- static PartDefinition *New(DataArrayInt *listOfIds);
- virtual DataArrayInt *toDAI() const;
+ static PartDefinition *New(DataArrayIdType *listOfIds);
+ virtual DataArrayIdType *toDAI() const;
virtual int getNumberOfElems() const;
virtual std::string getRepr() const;
virtual PartDefinition *composeWith(const PartDefinition *other) const;
class DataArrayPartDefinition : public PartDefinition
{
public:
- static DataArrayPartDefinition *New(DataArrayInt *listOfIds);
+ static DataArrayPartDefinition *New(DataArrayIdType *listOfIds);
%extend
{
- DataArrayPartDefinition(DataArrayInt *listOfIds)
+ DataArrayPartDefinition(DataArrayIdType *listOfIds)
{
return DataArrayPartDefinition::New(listOfIds);
}
int getEffectiveStop() const;
%extend
{
- SlicePartDefinition(int start, int stop, int step)
+ SlicePartDefinition(mcIdType start, mcIdType stop, mcIdType step)
{
return SlicePartDefinition::New(start,stop,step);
}
PyObject *getSlice() const
{
- int a,b,c;
+ mcIdType a,b,c;
self->getSlice(a,b,c);
return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
}
public:
void setName(const std::string& name);
void copyStringInfoFrom(const DataArray& other);
- void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds);
- void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other);
+ void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<std::size_t>& compoIds);
+ void copyPartOfStringInfoFrom2(const std::vector<std::size_t>& compoIds, const DataArray& other);
bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const;
bool areInfoEquals(const DataArray& other) const;
std::string cppRepr(const std::string& varName) const;
void checkNbOfComps(int nbOfCompo, const std::string& msg) const;
void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const;
void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const;
- void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const;
+ void checkNbOfElems(mcIdType nbOfElems, const std::string& msg) const;
static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg);
static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg);
static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step);
PyObject *getInfoOnComponents() const
{
const std::vector<std::string>& comps=self->getInfoOnComponents();
- PyObject *ret=PyList_New((int)comps.size());
- for(int i=0;i<(int)comps.size();i++)
+ PyObject *ret=PyList_New((mcIdType)comps.size());
+ for(std::size_t i=0;i<comps.size();i++)
PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
return ret;
}
void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li)
{
- std::vector<int> tmp;
+ std::vector<std::size_t> tmp;
convertPyToNewIntArr3(li,tmp);
self->copyPartOfStringInfoFrom(other,tmp);
}
void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other)
{
- std::vector<int> tmp;
+ std::vector<std::size_t> tmp;
convertPyToNewIntArr3(li,tmp);
self->copyPartOfStringInfoFrom2(tmp,other);
}
virtual void renumberInPlace(PyObject *li)
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
if (!SWIG_IsOK(res1))
{
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
if(size!=self->getNumberOfTuples())
{
throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
}
else
{
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
if(!da2)
throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
da2->checkAllocated();
- int size=self->getNumberOfTuples();
+ mcIdType size=self->getNumberOfTuples();
if(size!=self->getNumberOfTuples())
{
throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
virtual void renumberInPlaceR(PyObject *li)
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
if (!SWIG_IsOK(res1))
{
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
if(size!=self->getNumberOfTuples())
{
throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
}
else
{
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
if(!da2)
throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
da2->checkAllocated();
- int size=self->getNumberOfTuples();
+ mcIdType size=self->getNumberOfTuples();
if(size!=self->getNumberOfTuples())
{
throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
}
//tuplesSelec in PyObject * because DataArrayInt is not already existing !
- virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec)
+ virtual void setContigPartOfSelectedValues(mcIdType tupleIdStart, PyObject *aBase, PyObject *tuplesSelec)
{
static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
- DataArrayInt *tuplesSelecPtr2=0;
+ DataArrayIdType *tuplesSelecPtr2=0;
if(tuplesSelecPtr)
{
- tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
+ tuplesSelecPtr2=dynamic_cast<DataArrayIdType *>(tuplesSelecPtr);
if(!tuplesSelecPtr2)
throw INTERP_KERNEL::Exception(msg);
}
self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
}
- virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step)
+ virtual void setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, PyObject *aBase, mcIdType bg, mcIdType end2, mcIdType step)
{
DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
virtual DataArray *selectByTupleRanges(PyObject *li) const
{
- std::vector<std::pair<int,int> > ranges;
+ std::vector<std::pair<mcIdType,mcIdType> > ranges;
convertPyToVectorPairInt(li,ranges);
return self->selectByTupleRanges(ranges);
}
virtual DataArray *selectByTupleId(PyObject *li) const
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
if (!SWIG_IsOK(res1))
{
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
return self->selectByTupleId(tmp,tmp+size);
}
else
{
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
if(!da2)
throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
da2->checkAllocated();
virtual DataArray *selectByTupleIdSafe(PyObject *li) const
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
if (!SWIG_IsOK(res1))
{
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
return self->selectByTupleIdSafe(tmp,tmp+size);
}
else
{
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
if(!da2)
throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
da2->checkAllocated();
virtual PyObject *keepSelectedComponents(PyObject *li) const
{
- std::vector<int> tmp;
+ std::vector<std::size_t> tmp;
convertPyToNewIntArr3(li,tmp);
DataArray *ret=self->keepSelectedComponents(tmp);
return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
}
- static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices)
+ static PyObject *GetSlice(PyObject *slic, mcIdType sliceId, mcIdType nbOfSlices)
{
if(!PySlice_Check(slic))
throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
- int a,b;
- DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
+ mcIdType a,b;
+ DataArray::GetSlice(ToIdType(strt),ToIdType(stp),ToIdType(step),sliceId,nbOfSlices,a,b);
return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
}
- PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const
+ PyObject *getSlice(PyObject *slic, mcIdType sliceId, mcIdType nbOfSlices) const
{
if(!PySlice_Check(slic))
throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
- int a,b;
- DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
+ mcIdType a,b;
+ DataArray::GetSlice(ToIdType(strt),ToIdType(stp),ToIdType(step),sliceId,nbOfSlices,a,b);
return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
}
- static int GetNumberOfItemGivenBES(PyObject *slic)
+ static mcIdType GetNumberOfItemGivenBES(PyObject *slic)
{
if(!PySlice_Check(slic))
throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
- return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
+ return DataArray::GetNumberOfItemGivenBES(ToIdType(strt),ToIdType(stp),ToIdType(step),"");
}
- static int GetNumberOfItemGivenBESRelative(PyObject *slic)
+ static mcIdType GetNumberOfItemGivenBESRelative(PyObject *slic)
{
if(!PySlice_Check(slic))
throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
- return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
+ return DataArray::GetNumberOfItemGivenBESRelative(ToIdType(strt),ToIdType(stp),ToIdType(step),"");
}
static DataArray *Aggregate(PyObject *arrs)
return DataArray::Aggregate(tmp);
}
- int getNumberOfItemGivenBES(PyObject *slic) const
+ mcIdType getNumberOfItemGivenBES(PyObject *slic) const
{
if(!PySlice_Check(slic))
throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
- return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
+ return DataArray::GetNumberOfItemGivenBES(ToIdType(strt),ToIdType(stp),ToIdType(step),"");
}
- int getNumberOfItemGivenBESRelative(PyObject *slic)
+ mcIdType getNumberOfItemGivenBESRelative(PyObject *slic)
{
if(!PySlice_Check(slic))
throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
- return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
+ return DataArray::GetNumberOfItemGivenBESRelative(ToIdType(strt),ToIdType(stp),ToIdType(step),"");
}
PyObject *__getstate__() const
const std::vector<std::string> &a1(self->getInfoOnComponents());
PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
//
- int sz(a1.size());
+ std::size_t sz(a1.size());
PyObject *ret1(PyList_New(sz));
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
PyTuple_SetItem(ret,1,ret1);
//
static const char MSG[]="DataArrayDouble.__setstate__ : expected input is a tuple of size 2 with string as 1st arg and list of string as 2nd arg !";
if(!PyTuple_Check(inp))
throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
- int sz(PyTuple_Size(inp));
+ std::size_t sz(PyTuple_Size(inp));
if(sz!=2)
throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
PyObject *a0(PyTuple_GetItem(inp,0));
return self->reprNotTooLong();
}
- int __len__() const
+ mcIdType __len__() const
{
if(self->isAllocated())
{
PyObject *getValuesAsTuple() const
{
const float *vals(self->begin());
- int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
+ std::size_t nbOfComp(self->getNumberOfComponents());
+ mcIdType nbOfTuples(self->getNumberOfTuples());
return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
}
class DataArrayFloatTuple
{
public:
- int getNumberOfCompo() const;
- DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const;
+ std::size_t getNumberOfCompo() const;
+ DataArrayFloat *buildDAFloat(mcIdType nbOfTuples, mcIdType nbOfCompo) const;
%extend
{
std::string __str__() const
}
};
- class DataArrayInt;
class DataArrayDoubleIterator;
class DataArrayDouble : public DataArray
DataArrayDouble *toNoInterlace() const;
DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const;
void transpose();
- DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const;
+ DataArrayDouble *changeNbOfComponents(std::size_t newNbOfComp, double dftValue) const;
void meldWith(const DataArrayDouble *other);
DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const;
DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const;
- DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const;
- DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const;
+ DataArrayIdType *findClosestTupleId(const DataArrayDouble *other) const;
+ DataArrayIdType *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const;
void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true);
- void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp);
- void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec);
+ void setPartOfValuesSimple1(double a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp);
+ void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayIdType *tuplesSelec);
double getIJ(int tupleId, int compoId) const;
double front() const;
double back() const;
DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const;
void applyFuncFast32(const std::string& func);
void applyFuncFast64(const std::string& func);
- DataArrayInt *findIdsInRange(double vmin, double vmax) const;
- DataArrayInt *findIdsNotInRange(double vmin, double vmax) const;
- DataArrayInt *findIdsStrictlyNegative() const;
+ DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
+ DataArrayIdType *findIdsNotInRange(double vmin, double vmax) const;
+ DataArrayIdType *findIdsStrictlyNegative() const;
static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2);
static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2);
static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2);
void divideEqual(const DataArrayDouble *other);
static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2);
void powEqual(const DataArrayDouble *other);
- MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(double val) const;
- MCAuto<DataArrayInt> findIdsGreaterThan(double val) const;
- MCAuto<DataArrayInt> findIdsLowerOrEqualTo(double val) const;
- MCAuto<DataArrayInt> findIdsLowerThan(double val) const;
- MCAuto<DataArrayInt> convertToIntArr() const;
+ MCAuto<DataArrayIdType> findIdsGreaterOrEqualTo(double val) const;
+ MCAuto<DataArrayIdType> findIdsGreaterThan(double val) const;
+ MCAuto<DataArrayIdType> findIdsLowerOrEqualTo(double val) const;
+ MCAuto<DataArrayIdType> findIdsLowerThan(double val) const;
+ MCAuto<DataArrayInt32> convertToIntArr() const;
MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const;
MCAuto<DataArrayDouble> cumSum() const;
MCAuto<DataArrayFloat> convertToFloatArr() const;
{
double val;
std::vector<double> bb;
- int sw,nbTuples=-1;
+ mcIdType sw; mcIdType nbTuples=-1;
const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
self->pushBackValsSilent(tmp,tmp+nbTuples);
return self->doubleValue();
}
- int __len__() const
+ mcIdType __len__() const
{
if(self->isAllocated())
{
{
if(PyInt_Check(nbOfTuples))
{
- int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples));
if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
if(nbOfComp && nbOfComp != Py_None)
{
if(PyInt_Check(nbOfComp))
{//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
- int nbOfCompo=PyInt_AS_LONG(nbOfComp);
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp));
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
}
else
{//DataArrayDouble.setValues([1.,3.,4.],3)
- int tmpp1=-1;
+ mcIdType tmpp1=-1;
std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
}
}
else
{// DataArrayDouble.setValues([1.,3.,4.])
- int tmpp1=-1,tmpp2=-1;
+ mcIdType tmpp1=-1,tmpp2=-1;
std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
}
PyObject *getValuesAsTuple() const
{
const double *vals(self->begin());
- int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
+ std::size_t nbOfComp(self->getNumberOfComponents());
+ mcIdType nbOfTuples(self->getNumberOfTuples());
return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
}
DataArrayDouble *a,*a2;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
const double *seg2Ptr(convertObjToPossibleCpp5_Safe(seg2,sw,val,a,aa,bb,msg,2,2,true));
const double *tri3Ptr(convertObjToPossibleCpp5_Safe(tri3,sw,val2,a2,aa2,bb2,msg,3,2,true));
//
DataArrayDouble *a,*a2;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
static PyObject *GiveBaseForPlane(PyObject *normalVector)
{
const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
- double val,val2;
- DataArrayDouble *a,*a2;
- DataArrayDoubleTuple *aa,*aa2;
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
double res[9];
DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
DataArrayDouble *a,*a2;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
DataArrayDouble *renumber(PyObject *li)
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
if (!SWIG_IsOK(res1))
{
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
if(size!=self->getNumberOfTuples())
{
throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
}
else
{
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
if(!da2)
throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
da2->checkAllocated();
- int size=self->getNumberOfTuples();
+ mcIdType size=self->getNumberOfTuples();
if(size!=self->getNumberOfTuples())
{
throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
DataArrayDouble *renumberR(PyObject *li)
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
if (!SWIG_IsOK(res1))
{
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
if(size!=self->getNumberOfTuples())
{
throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
}
else
{
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
if(!da2)
throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
da2->checkAllocated();
- int size=self->getNumberOfTuples();
+ mcIdType size=self->getNumberOfTuples();
if(size!=self->getNumberOfTuples())
{
throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
}
}
- DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple)
+ DataArrayDouble *renumberAndReduce(PyObject *li, mcIdType newNbOfTuple)
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
if (!SWIG_IsOK(res1))
{
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
if(size!=self->getNumberOfTuples())
{
throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
}
else
{
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
if(!da2)
throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
da2->checkAllocated();
- int size=self->getNumberOfTuples();
+ mcIdType size=self->getNumberOfTuples();
if(size!=self->getNumberOfTuples())
{
throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
PyObject *minimalDistanceTo(const DataArrayDouble *other) const
{
- int thisTupleId,otherTupleId;
+ mcIdType thisTupleId,otherTupleId;
double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
PyObject *ret=PyTuple_New(3);
PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
PyObject *getMaxValue() const
{
- int tmp;
+ mcIdType tmp;
double r1=self->getMaxValue(tmp);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
PyObject *getMaxValue2() const
{
- DataArrayInt *tmp;
+ DataArrayIdType *tmp;
double r1=self->getMaxValue2(tmp);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *getMinValue() const
{
- int tmp;
+ mcIdType tmp;
double r1=self->getMinValue(tmp);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
PyObject *getMinValue2() const
{
- DataArrayInt *tmp;
+ DataArrayIdType *tmp;
double r1=self->getMinValue2(tmp);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *getMinMaxPerComponent() const
{
- int nbOfCompo(self->getNumberOfComponents());
+ std::size_t nbOfCompo(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
self->getMinMaxPerComponent(tmp);
- PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
+ PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,ToIdType(nbOfCompo));
return ret;
}
PyObject *normMaxPerComponent() const
{
- int nbOfCompo(self->getNumberOfComponents());
+ std::size_t nbOfCompo(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp(new double[nbOfCompo]);
self->normMaxPerComponent(tmp);
- return convertDblArrToPyList<double>(tmp,nbOfCompo);
+ return convertDblArrToPyList<double>(tmp,ToIdType(nbOfCompo));
}
PyObject *accumulate() const
{
- int sz=self->getNumberOfComponents();
+ std::size_t sz=self->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->accumulate(tmp);
- return convertDblArrToPyList<double>(tmp,sz);
+ return convertDblArrToPyList<double>(tmp,ToIdType(sz));
}
DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const
{
- int sw,sz,val;
- std::vector<int> val2;
- const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
+ mcIdType sw, sz,val;
+ std::vector<mcIdType> val2;
+ const mcIdType *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
return self->accumulatePerChunck(bg,bg+sz);
}
- PyObject *findCommonTuples(double prec, int limitNodeId=-1) const
+ PyObject *findCommonTuples(double prec, mcIdType limitNodeId=-1) const
{
- DataArrayInt *comm, *commIndex;
+ DataArrayIdType *comm, *commIndex;
self->findCommonTuples(prec,limitNodeId,comm,commIndex);
PyObject *res = PyList_New(2);
- PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return res;
}
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
- int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
- const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
+ mcIdType sw;
+ mcIdType tupleId=-1;
+ std::size_t nbOfCompo=self->getNumberOfComponents();
+ const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,(int)nbOfCompo,true);
//
double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
PyObject *ret=PyTuple_New(2);
void setSelectedComponents(const DataArrayDouble *a, PyObject *li)
{
- std::vector<int> tmp;
+ std::vector<std::size_t> tmp;
convertPyToNewIntArr3(li,tmp);
self->setSelectedComponents(a,tmp);
}
return res;
}
- PyObject *getTuple(int tupleId)
+ PyObject *getTuple(mcIdType tupleId)
{
- int sz=self->getNumberOfComponents();
+ std::size_t sz=self->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->getTuple(tupleId,tmp);
- return convertDblArrToPyList<double>(tmp,sz);
+ return convertDblArrToPyList<double>(tmp,ToIdType(sz));
}
static DataArrayDouble *Aggregate(PyObject *li)
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
- int nbComp=self->getNumberOfComponents(),nbTuples=-1;
+ mcIdType sw;
+ std::size_t nbComp=self->getNumberOfComponents();
+ mcIdType nbTuples=-1;
const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
- const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
+ const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,(int)nbComp,true,nbTuples);
MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,DeallocType::CPP_DEALLOC,nbTuples,nbComp);
- DataArrayInt *c=0,*cI=0;
+ DataArrayIdType *c=0,*cI=0;
self->computeTupleIdsNearTuples(inpu,eps,c,cI);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const
{
- DataArrayInt *ret1=0;
+ DataArrayIdType *ret1=0;
bool ret0=self->areIncludedInMe(other,prec,ret1);
PyObject *ret=PyTuple_New(2);
PyObject *ret0Py=ret0?Py_True:Py_False;
Py_XINCREF(ret0Py);
PyTuple_SetItem(ret,0,ret0Py);
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
//
#ifndef WITHOUT_AUTOFIELD
void *argp;
}
case 4:
{
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
default:
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
}
case 4:
{
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
return DataArrayDouble::Add(self,aaa);
}
default:
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
//
#ifndef WITHOUT_AUTOFIELD
void *argp;
}
case 4:
{
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
default:
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
}
case 4:
{
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
return DataArrayDouble::Substract(aaa,self);
}
default:
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
//
#ifndef WITHOUT_AUTOFIELD
void *argp;
}
case 4:
{
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
default:
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
//
#ifndef WITHOUT_AUTOFIELD
void *argp;
}
case 4:
{
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
default:
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
}
case 4:
{
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
return DataArrayDouble::Divide(aaa,self);
}
default:
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
}
case 4:
{
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
return DataArrayDouble::Pow(self,aaa);
}
default:
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
}
case 4:
{
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
return DataArrayDouble::Pow(aaa,self);
}
default:
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
}
case 4:
{
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
self->powEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
{
- DataArrayInt *c=0,*cI=0;
+ DataArrayIdType *c=0,*cI=0;
//
self->computeTupleIdsNearTuples(other,eps,c,cI);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *maxPerTupleWithCompoId() const
{
- DataArrayInt *ret1=0;
+ DataArrayIdType *ret1=0;
DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
}
class DataArrayDoubleTuple
{
public:
- int getNumberOfCompo() const;
+ std::size_t getNumberOfCompo() const;
DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const;
%extend
{
PyObject *__getitem__(PyObject *obj)
{
const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
+ mcIdType sw;
+ mcIdType singleVal;
+ std::vector<mcIdType> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
const double *pt=self->getConstPointer();
- int nbc=self->getNumberOfCompo();
+ mcIdType nbc=ToIdType(self->getNumberOfCompo());
convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 2:
{
PyObject *t=PyTuple_New(multiVal.size());
- for(int j=0;j<(int)multiVal.size();j++)
+ for(std::size_t j=0;j<multiVal.size();j++)
{
- int cid=multiVal[j];
+ mcIdType cid=multiVal[j];
if(cid>=nbc)
{
std::ostringstream oss;
}
case 3:
{
- int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
+ mcIdType sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
PyObject *t=PyTuple_New(sz);
- for(int j=0;j<sz;j++)
+ for(mcIdType j=0;j<sz;j++)
PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
return t;
}
{
const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
- int sw1,sw2;
+ mcIdType sw1,sw2;
double singleValV;
std::vector<double> multiValV;
MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
- int nbc=self->getNumberOfCompo();
+ mcIdType nbc=ToIdType(self->getNumberOfCompo());
convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
+ mcIdType singleVal;
+ std::vector<mcIdType> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
double *pt=self->getPointer();
convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
switch(sw2)
{
case 1:
{
- for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
+ for(std::vector<mcIdType>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
{
if(*it>=nbc)
{
oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- for(int i=0;i<(int)multiVal.size();i++)
+ for(std::size_t i=0;i<multiVal.size();i++)
{
- int pos=multiVal[i];
+ mcIdType pos=multiVal[i];
if(pos>=nbc)
{
std::ostringstream oss;
case 3:
{
const double *ptV=daIntTyyppV->getConstPointer();
- if(nbc>daIntTyyppV->getNumberOfCompo())
+ if(nbc>(mcIdType)daIntTyyppV->getNumberOfCompo())
{
std::ostringstream oss;
oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
}
case 3:
{
- int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
+ mcIdType sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
switch(sw1)
{
case 1:
{
- for(int j=0;j<sz;j++)
+ for(mcIdType j=0;j<sz;j++)
pt[slic.first+j*slic.second.second]=singleValV;
return self;
}
case 2:
{
- if(sz!=(int)multiValV.size())
+ if(sz!=(mcIdType)multiValV.size())
{
std::ostringstream oss;
oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- for(int j=0;j<sz;j++)
+ for(mcIdType j=0;j<sz;j++)
pt[slic.first+j*slic.second.second]=multiValV[j];
return self;
}
case 3:
{
const double *ptV=daIntTyyppV->getConstPointer();
- if(sz>daIntTyyppV->getNumberOfCompo())
+ if(sz>(mcIdType)daIntTyyppV->getNumberOfCompo())
{
std::ostringstream oss;
oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- for(int j=0;j<sz;j++)
+ for(mcIdType j=0;j<sz;j++)
pt[slic.first+j*slic.second.second]=ptV[j];
return self;
}
}
};
- class DataArrayIntIterator;
-
- class DataArrayInt : public DataArray
+ class DataArrayChar : public DataArray
{
public:
- static DataArrayInt *New();
- int intValue() const;
+ virtual DataArrayChar *buildEmptySpecializedDAChar() const;
int getHashCode() const;
bool empty() const;
- void aggregate(const DataArrayInt *other);
- DataArrayInt *performCopyOrIncrRef(bool deepCopy) const;
- void deepCopyFrom(const DataArrayInt& other);
+ void deepCopyFrom(const DataArrayChar& other);
void reserve(std::size_t nbOfElems);
- void pushBackSilent(int val);
- int popBackSilent();
+ void pushBackSilent(char val);
+ char popBackSilent();
void pack() const;
void allocIfNecessary(int nbOfTuple, int nbOfCompo);
- bool isEqual(const DataArrayInt& other) const;
- bool isEqualWithoutConsideringStr(const DataArrayInt& other) const;
- bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const;
- DataArrayInt *buildPermutationArr(const DataArrayInt& other) const;
- DataArrayInt *sumPerTuple() const;
- void sort(bool asc=true);
+ bool isEqual(const DataArrayChar& other) const;
+ bool isEqualWithoutConsideringStr(const DataArrayChar& other) const;
void reverse();
- void checkMonotonic(bool increasing) const;
- bool isMonotonic(bool increasing) const;
- void checkStrictlyMonotonic(bool increasing) const;
- bool isStrictlyMonotonic(bool increasing) const;
void fillWithZero();
- void fillWithValue(int val);
- void iota(int init=0);
+ void fillWithValue(char val);
std::string repr() const;
std::string reprZip() const;
- std::string reprNotTooLong() const;
- DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const;
- DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const;
- DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const;
- MCAuto< MapII > invertArrayN2O2O2NOptimized() const;
- MCAuto< MapII > giveN2OOptimized() const;
- DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const;
- DataArrayInt *fromNoInterlace() const;
- DataArrayInt *toNoInterlace() const;
- DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const;
- DataArrayInt *checkAndPreparePermutation() const;
- DataArrayInt *buildPermArrPerLevel() const;
- bool isIota(int sizeExpected) const;
- bool isUniform(int val) const;
- int checkUniformAndGuess() const;
- bool hasUniqueValues() const;
- DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const;
- void transpose();
- DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const;
- void meldWith(const DataArrayInt *other);
- void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true);
- void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp);
- void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec);
- void getTuple(int tupleId, int *res) const;
- int getIJ(int tupleId, int compoId) const;
- int getIJSafe(int tupleId, int compoId) const;
- int front() const;
- int back() const;
- void setIJ(int tupleId, int compoId, int newVal);
- void setIJSilent(int tupleId, int compoId, int newVal);
- int *getPointer();
- const int *getConstPointer() const;
- DataArrayIntIterator *iterator();
- const int *begin() const;
- const int *end() const;
- DataArrayInt *findIdsEqual(int val) const;
- DataArrayInt *findIdsNotEqual(int val) const;
- int changeValue(int oldValue, int newValue);
- int findIdFirstEqualTuple(const std::vector<int>& tupl) const;
- int findIdFirstEqual(int value) const;
- int findIdFirstEqual(const std::vector<int>& vals) const;
- int findIdSequence(const std::vector<int>& vals) const;
- bool presenceOfTuple(const std::vector<int>& tupl) const;
- bool presenceOfValue(int value) const;
- bool presenceOfValue(const std::vector<int>& vals) const;
- int count(int value) const;
- int accumulate(int compId) const;
- int getMaxValueInArray() const;
- int getMaxAbsValueInArray() const;
- int getMinValueInArray() const;
- void abs();
- DataArrayInt *computeAbs() const;
- void applyLin(int a, int b, int compoId);
- void applyLin(int a, int b);
- void applyInv(int numerator);
- DataArrayInt *negate() const;
- void applyDivideBy(int val);
- void applyModulus(int val);
- void applyRModulus(int val);
- void applyPow(int val);
- void applyRPow(int val);
- DataArrayInt *findIdsInRange(int vmin, int vmax) const;
- DataArrayInt *findIdsNotInRange(int vmin, int vmax) const;
- DataArrayInt *findIdsStrictlyNegative() const;
- bool checkAllIdsInRange(int vmin, int vmax) const;
- static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2);
- static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2);
- static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups);
- static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr);
- static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr);
- static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2);
- DataArrayInt *buildComplement(int nbOfElement) const;
- DataArrayInt *buildSubstraction(const DataArrayInt *other) const;
- DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const;
- DataArrayInt *buildUnion(const DataArrayInt *other) const;
- DataArrayInt *buildIntersection(const DataArrayInt *other) const;
- DataArrayInt *buildUnique() const;
- DataArrayInt *buildUniqueNotSorted() const;
- DataArrayInt *deltaShiftIndex() const;
- void computeOffsets();
- void computeOffsetsFull();
- DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const;
- DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const;
- DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const;
- void sortEachPairToMakeALinkedList();
- DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const;
- DataArrayInt *getDifferentValues() const;
- static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2);
- void addEqual(const DataArrayInt *other);
- static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2);
- void substractEqual(const DataArrayInt *other);
- static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2);
- void multiplyEqual(const DataArrayInt *other);
- static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2);
- void divideEqual(const DataArrayInt *other);
- static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2);
- void modulusEqual(const DataArrayInt *other);
- static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2);
- void powEqual(const DataArrayInt *other);
- MCAuto<DataArrayInt> fromLinkedListOfPairToList() const;
- MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const;
- MCAuto<DataArrayInt> findIdsGreaterThan(int val) const;
- MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const;
- MCAuto<DataArrayInt> findIdsLowerThan(int val) const;
- MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const;
- MCAuto<DataArrayDouble> convertToDblArr() const;
- MCAuto<DataArrayFloat> convertToFloatArr() const;
+ DataArrayInt *convertToIntArr() const;
+ DataArrayChar *renumber(const mcIdType *old2New) const;
+ DataArrayChar *renumberR(const mcIdType *new2Old) const;
+ DataArrayChar *renumberAndReduce(const mcIdType *old2NewBg, mcIdType newNbOfTuple) const;
+ bool isUniform(char val) const;
+ void sort(bool asc=true);
+ DataArrayChar *subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd=-1) const;
+ DataArrayChar *changeNbOfComponents(std::size_t newNbOfComp, char dftValue) const;
+ void meldWith(const DataArrayChar *other);
+ void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayIdType *tuplesSelec);
+ char front() const;
+ char back() const;
+ void setIJ(mcIdType tupleId, int compoId, char newVal);
+ void setIJSilent(mcIdType tupleId, int compoId, char newVal);
+ char *getPointer();
+ DataArrayIdType *findIdsEqual(char val) const;
+ DataArrayIdType *findIdsNotEqual(char val) const;
+ int findIdFirstEqualTuple(const std::vector<char>& tupl) const;
+ bool presenceOfTuple(const std::vector<char>& tupl) const;
+ char getMaxValue(mcIdType& tupleId) const;
+ char getMaxValueInArray() const;
+ char getMinValue(mcIdType& tupleId) const;
+ char getMinValueInArray() const;
+ DataArrayIdType *findIdsInRange(char vmin, char vmax) const;
+ static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2);
+ static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2);
+ %extend
+ {
+ mcIdType __len__() const
+ {
+ if(self->isAllocated())
+ {
+ return self->getNumberOfTuples();
+ }
+ else
+ {
+ throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
+ }
+ }
+
+ PyObject *isEqualIfNotWhy(const DataArrayChar& other) const
+ {
+ std::string ret1;
+ bool ret0=self->isEqualIfNotWhy(other,ret1);
+ PyObject *ret=PyTuple_New(2);
+ PyObject *ret0Py=ret0?Py_True:Py_False;
+ Py_XINCREF(ret0Py);
+ PyTuple_SetItem(ret,0,ret0Py);
+ PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
+ return ret;
+ }
+
+ DataArrayChar *renumber(PyObject *li)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumber(tmp);
+ }
+ else
+ {
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
+ da2->checkAllocated();
+ mcIdType size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumber(da2->getConstPointer());
+ }
+ }
+
+ DataArrayChar *renumberR(PyObject *li)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberR(tmp);
+ }
+ else
+ {
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
+ da2->checkAllocated();
+ mcIdType size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberR(da2->getConstPointer());
+ }
+ }
+
+ DataArrayChar *renumberAndReduce(PyObject *li, mcIdType newNbOfTuple)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ mcIdType size;
+ INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberAndReduce(tmp,newNbOfTuple);
+ }
+ else
+ {
+ DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
+ da2->checkAllocated();
+ mcIdType size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
+ }
+ }
+
+ static DataArrayChar *Aggregate(PyObject *dachs)
+ {
+ std::vector<const MEDCoupling::DataArrayChar *> tmp;
+ convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
+ return DataArrayChar::Aggregate(tmp);
+ }
+
+ static DataArrayChar *Meld(PyObject *dachs)
+ {
+ std::vector<const MEDCoupling::DataArrayChar *> tmp;
+ convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
+ return DataArrayChar::Meld(tmp);
+ }
+ }
+ };
+
+ class DataArrayByteIterator;
+
+ class DataArrayByte : public DataArrayChar
+ {
public:
- static DataArrayInt *Range(int begin, int end, int step);
+ static DataArrayByte *New();
+ DataArrayByteIterator *iterator();
+ DataArrayByte *performCopyOrIncrRef(bool deepCopy) const;
+ char byteValue() const;
%extend
{
- DataArrayInt()
+ DataArrayByte()
{
- return DataArrayInt::New();
+ return DataArrayByte::New();
}
- static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
+ static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
{
- const char *msgBase="MEDCoupling::DataArrayInt::New : Available API are : \n-DataArrayInt.New()\n-DataArrayInt.New([1,3,4])\n-DataArrayInt.New([1,3,4],3)\n-DataArrayInt.New([1,3,4,5],2,2)\n-DataArrayInt.New([1,3,4,5,7,8],3,2)\n-DataArrayInt.New([(1,3),(4,5),(7,8)])\n-DataArrayInt.New(5)\n-DataArrayInt.New(5,2)";
- std::string msg(msgBase);
-#ifdef WITH_NUMPY
- msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
-#endif
- msg+=" !";
+ const char *msg="MEDCoupling::DataArrayByte::New : Available API are : \n-DataArrayByte.New()\n--DataArrayByte.New([1,3,4])\n-DataArrayByte.New([1,3,4],3)\n-DataArrayByte.New([1,3,4,5],2,2)\n-DataArrayByte.New(5)\n-DataArrayByte.New(5,2) !";
if(PyList_Check(elt0) || PyTuple_Check(elt0))
{
if(nbOfTuples)
{
if(PyInt_Check(nbOfTuples))
{
- int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples));
if(nbOfTuples1<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
+ throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
if(nbOfComp)
{
if(PyInt_Check(nbOfComp))
- {//DataArrayInt.New([1,3,4,5],2,2)
- int nbOfCompo=PyInt_AS_LONG(nbOfComp);
+ {//DataArrayByte.New([1,3,4,5],2,2)
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp));
if(nbOfCompo<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
+ throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
+ MCAuto<DataArrayByte> ret=DataArrayByte::New();
+ std::vector<mcIdType> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
return ret.retn();
}
else
- throw INTERP_KERNEL::Exception(msg.c_str());
+ throw INTERP_KERNEL::Exception(msg);
}
else
- {//DataArrayInt.New([1,3,4],3)
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- int tmpp1=-1;
- std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
+ {//DataArrayByte.New([1,3,4],3)
+ MCAuto<DataArrayByte> ret=DataArrayByte::New();
+ mcIdType tmpp1=-1;
+ std::vector<mcIdType> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
return ret.retn();
}
}
else
- throw INTERP_KERNEL::Exception(msg.c_str());
+ throw INTERP_KERNEL::Exception(msg);
}
else
- {// DataArrayInt.New([1,3,4])
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- int tmpp1=-1,tmpp2=-1;
- std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
+ {// DataArrayByte.New([1,3,4])
+ MCAuto<DataArrayByte> ret=DataArrayByte::New();
+ mcIdType tmpp1=-1,tmpp2=-1;
+ std::vector<mcIdType> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
return ret.retn();
}
}
else if(PyInt_Check(elt0))
{
- int nbOfTuples1=PyInt_AS_LONG(elt0);
+ mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(elt0));
if(nbOfTuples1<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
+ throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
if(nbOfTuples)
{
if(!nbOfComp)
{
if(PyInt_Check(nbOfTuples))
- {//DataArrayInt.New(5,2)
- int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
+ {//DataArrayByte.New(5,2)
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfTuples));
if(nbOfCompo<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
+ MCAuto<DataArrayByte> ret=DataArrayByte::New();
ret->alloc(nbOfTuples1,nbOfCompo);
return ret.retn();
}
else
- throw INTERP_KERNEL::Exception(msg.c_str());
+ throw INTERP_KERNEL::Exception(msg);
}
else
- throw INTERP_KERNEL::Exception(msg.c_str());
+ throw INTERP_KERNEL::Exception(msg);
}
else
- {//DataArrayInt.New(5)
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ {//DataArrayByte.New(5)
+ MCAuto<DataArrayByte> ret=DataArrayByte::New();
ret->alloc(nbOfTuples1,1);
return ret.retn();
}
}
#ifdef WITH_NUMPY
else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
- {//DataArrayInt.New(numpyArray)
- return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
+ {//DataArrayDouble.New(numpyArray)
+ return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
}
#endif
else
- throw INTERP_KERNEL::Exception(msg.c_str());
- throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
+ throw INTERP_KERNEL::Exception(msg);
}
- DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
+ DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
{
- return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
+ return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
}
-
- std::string __str__() const
+
+ std::string __repr__() const
{
- return self->reprNotTooLong();
+ std::ostringstream oss;
+ self->reprQuickOverview(oss);
+ return oss.str();
}
-
- int __len__() const
+
+ int __int__() const
{
- if(self->isAllocated())
- {
- return self->getNumberOfTuples();
- }
- else
- {
- throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
- }
+ return (int) self->byteValue();
}
- int __int__() const
+ DataArrayByteIterator *__iter__()
{
- return self->intValue();
+ return self->iterator();
}
- DataArrayIntIterator *__iter__()
+ mcIdType getIJ(mcIdType tupleId, mcIdType compoId) const
{
- return self->iterator();
+ return (mcIdType)self->getIJ(tupleId,compoId);
}
-
- PyObject *accumulate() const
+
+ mcIdType getIJSafe(mcIdType tupleId, mcIdType compoId) const
{
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
- self->accumulate(tmp);
- return convertIntArrToPyList(tmp,sz);
+ return (mcIdType)self->getIJSafe(tupleId,compoId);
}
- DataArrayInt *accumulatePerChunck(PyObject *indexArr) const
+ std::string __str__() const
{
- int sw,sz,val;
- std::vector<int> val2;
- const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
- return self->accumulatePerChunck(bg,bg+sz);
+ return self->repr();
}
- DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const
+ PyObject *toStrList() const
{
- int sw,sz,val;
- std::vector<int> val2;
- const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
- return self->findIdsEqualTuple(bg,bg+sz);
+ const char *vals=self->getConstPointer();
+ std::size_t nbOfComp=self->getNumberOfComponents();
+ mcIdType nbOfTuples=self->getNumberOfTuples();
+ return convertCharArrToPyListOfTuple(vals,(int)nbOfComp,nbOfTuples);
}
-
- DataArrayInt *findIdForEach(PyObject *vals) const
+
+ bool presenceOfTuple(PyObject *tupl) const
{
- int sw,sz,val;
- std::vector<int> val2;
- const int *bg(convertIntStarLikePyObjToCppIntStar(vals,sw,sz,val,val2));
- MCAuto<DataArrayInt> ret(self->findIdForEach(bg,bg+sz));
- return ret.retn();
+ mcIdType sz=-1,sw=-1;
+ mcIdType ival=-1; std::vector<mcIdType> ivval;
+ const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
+ std::vector<char> vals(sz);
+ std::copy(pt,pt+sz,vals.begin());
+ return self->presenceOfTuple(vals);
}
- PyObject *splitInBalancedSlices(int nbOfSlices) const
+ bool presenceOfValue(PyObject *vals) const
{
- std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
- PyObject *ret=PyList_New(slcs.size());
- for(std::size_t i=0;i<slcs.size();i++)
- PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
- return ret;
+ mcIdType sz=-1,sw=-1;
+ mcIdType ival=-1; std::vector<mcIdType> ivval;
+ const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
+ std::vector<char> vals2(sz);
+ std::copy(pt,pt+sz,vals2.begin());
+ return self->presenceOfValue(vals2);
}
- DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const
+ mcIdType findIdFirstEqual(PyObject *vals) const
{
- if(!PySlice_Check(slic))
- throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
- Py_ssize_t strt=2,stp=2,step=2;
- GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
- if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
- throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
- return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
+ mcIdType sz=-1,sw=-1;
+ mcIdType ival=-1; std::vector<mcIdType> ivval;
+ const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
+ std::vector<char> vals2(sz);
+ std::copy(pt,pt+sz,vals2.begin());
+ return self->findIdFirstEqual(vals2);
}
- PyObject *getMinMaxValues() const
+ mcIdType findIdFirstEqualTuple(PyObject *tupl) const
{
- int a,b;
- self->getMinMaxValues(a,b);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyInt_FromLong(a));
- PyTuple_SetItem(ret,1,PyInt_FromLong(b));
- return ret;
- }
-
- static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI)
- {
- int newNbOfTuples=-1;
- int szArr,szArrI,sw,iTypppArr,iTypppArrI;
- std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
- const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
- const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
- DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
- PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
- return ret;
+ mcIdType sz=-1,sw=-1;
+ mcIdType ival=-1; std::vector<mcIdType> ivval;
+ const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
+ std::vector<char> vals(sz);
+ std::copy(pt,pt+sz,vals.begin());
+ return self->findIdFirstEqualTuple(vals);
}
- static DataArrayInt *CheckAndPreparePermutation(PyObject *arr)
+ mcIdType findIdSequence(PyObject *strOrListOfInt) const
{
- MCAuto<DataArrayInt> ret(DataArrayInt::New());
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
- int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
- ret->useArray(pt,true,MEDCoupling::DeallocType::C_DEALLOC,szArr,1);
- return ret.retn();
+ mcIdType sz=-1,sw=-1;
+ mcIdType ival=-1; std::vector<mcIdType> ivval;
+ const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
+ std::vector<char> vals(sz);
+ std::copy(pt,pt+sz,vals.begin());
+ return self->findIdSequence(vals);
}
- void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
+ PyObject *getTuple(mcIdType tupleId)
{
- const char *msg="MEDCoupling::DataArrayInt::setValues : Available API are : \n-DataArrayInt.setValues([1,3,4])\n-DataArrayInt.setValues([1,3,4],3)\n-DataArrayInt.setValues([1,3,4,5],2,2)\n-DataArrayInt.New(5)\n !";
- if(PyList_Check(li) || PyTuple_Check(li))
- {
- if(nbOfTuples && nbOfTuples != Py_None)
- {
- if(PyInt_Check(nbOfTuples))
- {
- int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
- if(nbOfTuples1<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
- if(nbOfComp && nbOfComp != Py_None)
- {
- if(PyInt_Check(nbOfComp))
- {//DataArrayInt.setValues([1,3,4,5],2,2)
- int nbOfCompo=PyInt_AS_LONG(nbOfComp);
- if(nbOfCompo<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
- std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
- self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- {//DataArrayInt.setValues([1,3,4],3)
- int tmpp1=-1;
- std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
- self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
- }
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- {// DataArrayInt.setValues([1,3,4])
- int tmpp1=-1,tmpp2=-1;
- std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
- self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
- }
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
-
- PyObject *getValues() const
- {
- const int *vals=self->getConstPointer();
- return convertIntArrToPyList(vals,self->getNbOfElems());
- }
-
-#ifdef WITH_NUMPY
- PyObject *toNumPyArray() // not const. It is not a bug !
- {
- return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
- }
-#endif
-
- PyObject *isEqualIfNotWhy(const DataArrayInt& other) const
- {
- std::string ret1;
- bool ret0=self->isEqualIfNotWhy(other,ret1);
- PyObject *ret=PyTuple_New(2);
- PyObject *ret0Py=ret0?Py_True:Py_False;
- Py_XINCREF(ret0Py);
- PyTuple_SetItem(ret,0,ret0Py);
- PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
- return ret;
- }
-
- PyObject *getValuesAsTuple() const
- {
- const int *vals=self->getConstPointer();
- int nbOfComp=self->getNumberOfComponents();
- int nbOfTuples=self->getNumberOfTuples();
- return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
- }
-
- static PyObject *MakePartition(PyObject *gps, int newNb)
- {
- std::vector<const DataArrayInt *> groups;
- std::vector< std::vector<int> > fidsOfGroups;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
- MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
- PyObject *ret = PyList_New(2);
- PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- int sz=fidsOfGroups.size();
- PyObject *ret1 = PyList_New(sz);
- for(int i=0;i<sz;i++)
- PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
- PyList_SetItem(ret,1,ret1);
- return ret;
- }
-
- void transformWithIndArr(PyObject *li)
- {
- void *da=0;
- int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ));
- if (!SWIG_IsOK(res1))
- {
- int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
- if(SWIG_IsOK(res2))
- {
- MapII *m=reinterpret_cast<MapII *>(da);
- self->transformWithIndArr(*m);
- }
- else
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- self->transformWithIndArr(tmp,tmp+size);
- }
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
- }
- }
-
- DataArrayInt *findIdsEqualList(PyObject *obj)
- {
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
- switch(sw)
- {
- case 1:
- return self->findIdsEqualList(&singleVal,&singleVal+1);
- case 2:
- return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
- case 4:
- return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
- default:
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
- }
- }
-
- DataArrayInt *findIdsNotEqualList(PyObject *obj)
- {
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
- switch(sw)
- {
- case 1:
- return self->findIdsNotEqualList(&singleVal,&singleVal+1);
- case 2:
- return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
- case 4:
- return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
- default:
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
- }
- }
-
- PyObject *splitByValueRange(PyObject *li) const
- {
- DataArrayInt *ret0=0,*ret1=0,*ret2=0;
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
- }
- PyObject *ret = PyList_New(3);
- PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- DataArrayInt *transformWithIndArrR(PyObject *li) const
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- return self->transformWithIndArrR(tmp,tmp+size);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
- }
- }
-
- DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple)
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumberAndReduce(tmp,newNbOfTuple);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- int size=self->getNumberOfTuples();
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
- }
- }
-
- DataArrayInt *renumber(PyObject *li)
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumber(tmp);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- int size=self->getNumberOfTuples();
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumber(da2->getConstPointer());
- }
- }
-
- DataArrayInt *renumberR(PyObject *li)
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumberR(tmp);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- int size=self->getNumberOfTuples();
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumberR(da2->getConstPointer());
- }
- }
-
- void setSelectedComponents(const DataArrayInt *a, PyObject *li)
- {
- std::vector<int> tmp;
- convertPyToNewIntArr3(li,tmp);
- self->setSelectedComponents(a,tmp);
- }
-
- PyObject *explodeComponents() const
- {
- std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
- std::size_t sz(retCpp.size());
- PyObject *res(PyList_New(sz));
- for(std::size_t i=0;i<sz;i++)
- PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return res;
- }
-
- PyObject *getTuple(int tupleId)
- {
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
- self->getTuple(tupleId,tmp);
- return convertIntArrToPyList(tmp,sz);
- }
-
- PyObject *changeSurjectiveFormat(int targetNb) const
- {
- DataArrayInt *arr=0;
- DataArrayInt *arrI=0;
- self->changeSurjectiveFormat(targetNb,arr,arrI);
- PyObject *res = PyList_New(2);
- PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
- PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
- return res;
- }
-
- static DataArrayInt *Meld(PyObject *li)
- {
- std::vector<const DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
- return DataArrayInt::Meld(tmp);
- }
-
- static DataArrayInt *Aggregate(PyObject *li)
- {
- std::vector<const DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
- return DataArrayInt::Aggregate(tmp);
- }
-
- static DataArrayInt *AggregateIndexes(PyObject *li)
- {
- std::vector<const DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
- return DataArrayInt::AggregateIndexes(tmp);
- }
-
- static DataArrayInt *BuildUnion(PyObject *li)
- {
- std::vector<const DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
- return DataArrayInt::BuildUnion(tmp);
- }
-
- static DataArrayInt *BuildIntersection(PyObject *li)
- {
- std::vector<const DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
- return DataArrayInt::BuildIntersection(tmp);
- }
-
- PyObject *getMaxValue() const
- {
- int tmp;
- int r1=self->getMaxValue(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
- PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
- return ret;
- }
-
- PyObject *getMaxAbsValue(std::size_t& tupleId) const
- {
- std::size_t tmp;
- int r1=self->getMaxAbsValue(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
- PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
- return ret;
- }
-
- PyObject *getMinValue() const
- {
- int tmp;
- int r1=self->getMinValue(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
- PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
- return ret;
- }
-
- int index(PyObject *obj) const
- {
- int nbOfCompo=self->getNumberOfComponents();
- switch(nbOfCompo)
- {
- case 1:
- {
- if(PyInt_Check(obj))
- {
- int val=(int)PyInt_AS_LONG(obj);
- return self->findIdFirstEqual(val);
- }
- else
- throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
- }
- default:
- {
- std::vector<int> arr;
- convertPyToNewIntArr3(obj,arr);
- return self->findIdFirstEqualTuple(arr);
- }
- }
- }
-
- bool __contains__(PyObject *obj) const
- {
- int nbOfCompo=self->getNumberOfComponents();
- switch(nbOfCompo)
- {
- case 0:
- return false;
- case 1:
- {
- if(PyInt_Check(obj))
- {
- int val=(int)PyInt_AS_LONG(obj);
- return self->presenceOfValue(val);
- }
- else
- throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
- }
- default:
- {
- std::vector<int> arr;
- convertPyToNewIntArr3(obj,arr);
- return self->presenceOfTuple(arr);
- }
- }
- }
-
- PyObject *__getitem__(PyObject *obj)
- {
- const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
- const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
- self->checkAllocated();
- int nbOfTuples=self->getNumberOfTuples();
- int nbOfComponents=self->getNumberOfComponents();
- int it1,ic1;
- std::vector<int> vt1,vc1;
- std::pair<int, std::pair<int,int> > pt1,pc1;
- DataArrayInt *dt1=0,*dc1=0;
- int sw;
- convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
- MCAuto<DataArrayInt> ret;
- switch(sw)
- {
- case 1:
- {
- if(nbOfComponents==1)
- return PyInt_FromLong(self->getIJSafe(it1,0));
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 2:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- case 3:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- case 4:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- case 5:
- return PyInt_FromLong(self->getIJSafe(it1,ic1));
- case 6:
- {
- ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- std::vector<int> v2(1,ic1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 7:
- {
- ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
- std::vector<int> v2(1,ic1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 8:
- {
- ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- std::vector<int> v2(1,ic1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 9:
- {
- ret=self->selectByTupleIdSafe(&it1,&it1+1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 10:
- {
- ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 11:
- {
- ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 12:
- {
- ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 13:
- {
- ret=self->selectByTupleIdSafe(&it1,&it1+1);
- int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
- std::vector<int> v2(nbOfComp);
- for(int i=0;i<nbOfComp;i++)
- v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 14:
- {
- ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
- std::vector<int> v2(nbOfComp);
- for(int i=0;i<nbOfComp;i++)
- v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 15:
- {
- ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
- int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
- std::vector<int> v2(nbOfComp);
- for(int i=0;i<nbOfComp;i++)
- v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 16:
- {
- ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
- std::vector<int> v2(nbOfComp);
- for(int i=0;i<nbOfComp;i++)
- v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__setitem__(PyObject *obj, PyObject *value)
- {
- self->checkAllocated();
- const char msg[]="Unexpected situation in __setitem__ !";
- int nbOfTuples=self->getNumberOfTuples();
- int nbOfComponents=self->getNumberOfComponents();
- int sw1,sw2;
- int i1;
- std::vector<int> v1;
- DataArrayInt *d1=0;
- DataArrayIntTuple *dd1=0;
- convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
- int it1,ic1;
- std::vector<int> vt1,vc1;
- std::pair<int, std::pair<int,int> > pt1,pc1;
- DataArrayInt *dt1=0,*dc1=0;
- convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
- MCAuto<DataArrayInt> tmp;
- switch(sw2)
- {
- case 1:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 2:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 3:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 4:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 5:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 6:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 7:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 8:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 9:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
- return self;
- case 3:
- self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 10:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
- return self;
- case 3:
- self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 11:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
- return self;
- case 3:
- self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 12:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
- return self;
- case 3:
- self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 13:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 14:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 15:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 16:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- return self;
- }
-
- DataArrayInt *__neg__() const
- {
- return self->negate();
- }
-
- DataArrayInt *__add__(PyObject *obj)
- {
- const char msg[]="Unexpected situation in __add__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyLin(1,val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Add(self,aaaa);
- }
- case 3:
- {
- return DataArrayInt::Add(self,a);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Add(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__radd__(PyObject *obj)
- {
- const char msg[]="Unexpected situation in __radd__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyLin(1,val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Add(self,aaaa);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Add(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
- {
- const char msg[]="Unexpected situation in __iadd__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- self->applyLin(1,val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- self->addEqual(bb);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- self->addEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- self->addEqual(aaaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__sub__(PyObject *obj)
- {
- const char msg[]="Unexpected situation in __sub__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyLin(1,-val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Substract(self,aaaa);
- }
- case 3:
- {
- return DataArrayInt::Substract(self,a);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Substract(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__rsub__(PyObject *obj)
- {
- const char msg[]="Unexpected situation in __rsub__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyLin(-1,val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Substract(aaaa,self);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Substract(aaaa,self);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
- {
- const char msg[]="Unexpected situation in __isub__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- self->applyLin(1,-val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- self->substractEqual(bb);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- self->substractEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- self->substractEqual(aaaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__mul__(PyObject *obj)
- {
- const char msg[]="Unexpected situation in __mul__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyLin(val,0);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Multiply(self,aaaa);
- }
- case 3:
- {
- return DataArrayInt::Multiply(self,a);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Multiply(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__rmul__(PyObject *obj)
- {
- const char msg[]="Unexpected situation in __rmul__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyLin(val,0);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Multiply(self,aaaa);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Multiply(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
- {
- const char msg[]="Unexpected situation in __imul__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- self->applyLin(val,0);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- self->multiplyEqual(bb);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- self->multiplyEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- self->multiplyEqual(aaaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__div__(PyObject *obj)
- {
- const char msg[]="Unexpected situation in __div__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyDivideBy(val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Divide(self,aaaa);
- }
- case 3:
- {
- return DataArrayInt::Divide(self,a);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Divide(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__rdiv__(PyObject *obj)
- {
- const char msg[]="Unexpected situation in __rdiv__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyInv(val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Divide(aaaa,self);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Divide(aaaa,self);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
- {
- const char msg[]="Unexpected situation in __idiv__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- self->applyDivideBy(val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- self->divideEqual(bb);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- self->divideEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- self->divideEqual(aaaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__mod__(PyObject *obj)
- {
- const char msg[]="Unexpected situation in __mod__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyModulus(val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Modulus(self,aaaa);
- }
- case 3:
- {
- return DataArrayInt::Modulus(self,a);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Modulus(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__rmod__(PyObject *obj)
- {
- const char msg[]="Unexpected situation in __rmod__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyRModulus(val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Modulus(aaaa,self);
- }
- case 3:
- {
- return DataArrayInt::Modulus(a,self);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Modulus(aaaa,self);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___imod___(PyObject *trueSelf, PyObject *obj)
- {
- const char msg[]="Unexpected situation in __imod__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- self->applyModulus(val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- self->modulusEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- self->modulusEqual(aaaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__pow__(PyObject *obj)
- {
- const char msg[]="Unexpected situation in __pow__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyPow(val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Pow(self,aaaa);
- }
- case 3:
- {
- return DataArrayInt::Pow(self,a);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Pow(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__rpow__(PyObject *obj)
- {
- const char msg[]="Unexpected situation in __rpow__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyRPow(val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Pow(aaaa,self);
- }
- case 3:
- {
- return DataArrayInt::Pow(a,self);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Pow(aaaa,self);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
- {
- const char msg[]="Unexpected situation in __ipow__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- self->applyPow(val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- self->powEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- self->powEqual(aaaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- std::string __repr__() const
- {
- std::ostringstream oss;
- self->reprQuickOverview(oss);
- return oss.str();
- }
-
- void pushBackValsSilent(PyObject *li)
- {
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
- self->pushBackValsSilent(tmp,tmp+szArr);
- }
-
- PyObject *partitionByDifferentValues() const
- {
- std::vector<int> ret1;
- std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
- std::size_t sz=ret0.size();
- PyObject *pyRet=PyTuple_New(2);
- PyObject *pyRet0=PyList_New((int)sz);
- PyObject *pyRet1=PyList_New((int)sz);
- for(std::size_t i=0;i<sz;i++)
- {
- PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
- }
- PyTuple_SetItem(pyRet,0,pyRet0);
- PyTuple_SetItem(pyRet,1,pyRet1);
- return pyRet;
- }
-
- PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const
- {
- DataArrayInt *ret0=0,*ret1=0;
- self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
- PyObject *pyRet=PyTuple_New(2);
- PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return pyRet;
- }
-
- PyObject *isRange() const
- {
- int a(0),b(0),c(0);
- bool ret(self->isRange(a,b,c));
- PyObject *pyRet=PyTuple_New(2);
- PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
- Py_XINCREF(ret0Py);
- PyTuple_SetItem(pyRet,0,ret0Py);
- if(ret)
- ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
- else
- {
- ret1Py=Py_None;
- Py_XINCREF(ret1Py);
- }
- PyTuple_SetItem(pyRet,1,ret1Py);
- return pyRet;
- }
-
- static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
- {
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- if(!arrIndx)
- throw INTERP_KERNEL::Exception("DataArrayInt::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
- convertIntStarOrSliceLikePyObjToCpp(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
- switch(sw)
- {
- case 1:
- return DataArrayInt::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
- case 2:
- return DataArrayInt::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
- case 4:
- return DataArrayInt::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
- default:
- throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
- }
- }
-
- static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *arrOut=0,*arrIndexOut=0;
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- if(!arrIndxIn)
- throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
- convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
- switch(sw)
- {
- case 1:
- {
- DataArrayInt::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
- break;
- }
- case 2:
- {
- DataArrayInt::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
- break;
- }
- case 4:
- {
- DataArrayInt::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
- break;
- }
- default:
- throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
- }
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- static PyObject *ExtractFromIndexedArraysSlice(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *arrOut=0,*arrIndexOut=0;
- DataArrayInt::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- static PyObject *ExtractFromIndexedArraysSlice(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
- {
- if(!PySlice_Check(slic))
- throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : the first param is not a pyslice !");
- Py_ssize_t strt=2,stp=2,step=2;
- if(!arrIndxIn)
- throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : last array is null !");
- arrIndxIn->checkAllocated();
- if(arrIndxIn->getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : number of components of last argument must be equal to one !");
- GetIndicesOfSlice(slic,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArraysSlice (wrap) : Invalid slice regarding nb of elements !");
- DataArrayInt *arrOut=0,*arrIndexOut=0;
- DataArrayInt::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- static PyObject *SetPartOfIndexedArrays(PyObject *li,
- const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
- const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *arrOut=0,*arrIndexOut=0;
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- if(!arrIndxIn)
- throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArrays : null pointer as arrIndex !");
- convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
- switch(sw)
- {
- case 1:
- {
- DataArrayInt::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
- break;
- }
- case 2:
- {
- DataArrayInt::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
- break;
- }
- case 4:
- {
- DataArrayInt::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
- break;
- }
- default:
- throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
- }
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
- const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
- {
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- if(!arrIndxIn)
- throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
- convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
- switch(sw)
- {
- case 1:
- {
- DataArrayInt::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
- break;
- }
- case 2:
- {
- DataArrayInt::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
- break;
- }
- case 4:
- {
- DataArrayInt::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
- break;
- }
- default:
- throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
- }
- }
-
- } // end extent
- };
-
- class DataArrayIntTuple;
-
- class DataArrayIntIterator
- {
- public:
- DataArrayIntIterator(DataArrayInt *da);
- ~DataArrayIntIterator();
- %extend
- {
- PyObject *next()
- {
- DataArrayIntTuple *ret=self->nextt();
- if(ret)
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
- else
- {
- PyErr_SetString(PyExc_StopIteration,"No more data.");
- return 0;
- }
- }
- }
- };
-
- class DataArrayIntTuple
- {
- public:
- int getNumberOfCompo() const;
- DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const;
- %extend
- {
- std::string __str__() const
- {
- return self->repr();
- }
-
- int __int__() const
- {
- return self->intValue();
- }
-
- DataArrayInt *buildDAInt()
- {
- return self->buildDAInt(1,self->getNumberOfCompo());
- }
-
- PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
- {
- MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
- MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
- {
- MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
- MEDCoupling_DataArrayInt____isub___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
- {
- MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
- MEDCoupling_DataArrayInt____imul___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
- {
- MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
- MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *___imod___(PyObject *trueSelf, PyObject *obj)
- {
- MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
- MEDCoupling_DataArrayInt____imod___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *__len__()
- {
- return PyInt_FromLong(self->getNumberOfCompo());
- }
-
- PyObject *__getitem__(PyObject *obj)
- {
- const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- const int *pt=self->getConstPointer();
- int nbc=self->getNumberOfCompo();
- convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
- switch(sw)
- {
- case 1:
- {
- if(singleVal>=nbc)
- {
- std::ostringstream oss;
- oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
- PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
- return 0;
- }
- if(singleVal>=0)
- return PyInt_FromLong(pt[singleVal]);
- else
- {
- if(nbc+singleVal>0)
- return PyInt_FromLong(pt[nbc+singleVal]);
- else
- {
- std::ostringstream oss;
- oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- }
- case 2:
- {
- PyObject *t=PyTuple_New(multiVal.size());
- for(int j=0;j<(int)multiVal.size();j++)
- {
- int cid=multiVal[j];
- if(cid>=nbc)
- {
- std::ostringstream oss;
- oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
- }
- return t;
- }
- case 3:
- {
- int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
- PyObject *t=PyTuple_New(sz);
- for(int j=0;j<sz;j++)
- PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
- return t;
- }
- default:
- throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
- }
- }
-
- DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value)
- {
- const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
- const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
- int sw1,sw2;
- int singleValV;
- std::vector<int> multiValV;
- std::pair<int, std::pair<int,int> > slicV;
- MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
- int nbc=self->getNumberOfCompo();
- convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- int *pt=self->getPointer();
- convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
- switch(sw2)
- {
- case 1:
- {
- if(singleVal>=nbc)
- {
- std::ostringstream oss;
- oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- switch(sw1)
- {
- case 1:
- {
- pt[singleVal]=singleValV;
- return self;
- }
- case 2:
- {
- if(multiValV.size()!=1)
- {
- std::ostringstream oss;
- oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- pt[singleVal]=multiValV[0];
- return self;
- }
- case 4:
- {
- pt[singleVal]=daIntTyyppV->getConstPointer()[0];
- return self;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
- case 2:
- {
- switch(sw1)
- {
- case 1:
- {
- for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
- {
- if(*it>=nbc)
- {
- std::ostringstream oss;
- oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- pt[*it]=singleValV;
- }
- return self;
- }
- case 2:
- {
- if(multiVal.size()!=multiValV.size())
- {
- std::ostringstream oss;
- oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- for(int i=0;i<(int)multiVal.size();i++)
- {
- int pos=multiVal[i];
- if(pos>=nbc)
- {
- std::ostringstream oss;
- oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- pt[multiVal[i]]=multiValV[i];
- }
- return self;
- }
- case 4:
- {
- const int *ptV=daIntTyyppV->getConstPointer();
- if(nbc>daIntTyyppV->getNumberOfCompo())
- {
- std::ostringstream oss;
- oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- std::copy(ptV,ptV+nbc,pt);
- return self;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
- case 3:
- {
- int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
- switch(sw1)
- {
- case 1:
- {
- for(int j=0;j<sz;j++)
- pt[slic.first+j*slic.second.second]=singleValV;
- return self;
- }
- case 2:
- {
- if(sz!=(int)multiValV.size())
- {
- std::ostringstream oss;
- oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- for(int j=0;j<sz;j++)
- pt[slic.first+j*slic.second.second]=multiValV[j];
- return self;
- }
- case 4:
- {
- const int *ptV=daIntTyyppV->getConstPointer();
- if(sz>daIntTyyppV->getNumberOfCompo())
- {
- std::ostringstream oss;
- oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- for(int j=0;j<sz;j++)
- pt[slic.first+j*slic.second.second]=ptV[j];
- return self;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
- }
- };
-
- class DataArrayChar : public DataArray
- {
- public:
- virtual DataArrayChar *buildEmptySpecializedDAChar() const;
- int getHashCode() const;
- bool empty() const;
- void deepCopyFrom(const DataArrayChar& other);
- void reserve(std::size_t nbOfElems);
- void pushBackSilent(char val);
- char popBackSilent();
- void pack() const;
- void allocIfNecessary(int nbOfTuple, int nbOfCompo);
- bool isEqual(const DataArrayChar& other) const;
- bool isEqualWithoutConsideringStr(const DataArrayChar& other) const;
- void reverse();
- void fillWithZero();
- void fillWithValue(char val);
- std::string repr() const;
- std::string reprZip() const;
- DataArrayInt *convertToIntArr() const;
- DataArrayChar *renumber(const int *old2New) const;
- DataArrayChar *renumberR(const int *new2Old) const;
- DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const;
- bool isUniform(char val) const;
- void sort(bool asc=true);
- DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const;
- DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const;
- void meldWith(const DataArrayChar *other);
- void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec);
- char front() const;
- char back() const;
- void setIJ(int tupleId, int compoId, char newVal);
- void setIJSilent(int tupleId, int compoId, char newVal);
- char *getPointer();
- DataArrayInt *findIdsEqual(char val) const;
- DataArrayInt *findIdsNotEqual(char val) const;
- int findIdFirstEqualTuple(const std::vector<char>& tupl) const;
- bool presenceOfTuple(const std::vector<char>& tupl) const;
- char getMaxValue(int& tupleId) const;
- char getMaxValueInArray() const;
- char getMinValue(int& tupleId) const;
- char getMinValueInArray() const;
- DataArrayInt *findIdsInRange(char vmin, char vmax) const;
- static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2);
- static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2);
- %extend
- {
- int __len__() const
- {
- if(self->isAllocated())
- {
- return self->getNumberOfTuples();
- }
- else
- {
- throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
- }
- }
-
- PyObject *isEqualIfNotWhy(const DataArrayChar& other) const
- {
- std::string ret1;
- bool ret0=self->isEqualIfNotWhy(other,ret1);
- PyObject *ret=PyTuple_New(2);
- PyObject *ret0Py=ret0?Py_True:Py_False;
- Py_XINCREF(ret0Py);
- PyTuple_SetItem(ret,0,ret0Py);
- PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
- return ret;
- }
-
- DataArrayChar *renumber(PyObject *li)
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumber(tmp);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- int size=self->getNumberOfTuples();
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumber(da2->getConstPointer());
- }
- }
-
- DataArrayChar *renumberR(PyObject *li)
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumberR(tmp);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- int size=self->getNumberOfTuples();
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumberR(da2->getConstPointer());
- }
- }
-
- DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple)
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumberAndReduce(tmp,newNbOfTuple);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- int size=self->getNumberOfTuples();
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
- }
- }
-
- static DataArrayChar *Aggregate(PyObject *dachs)
- {
- std::vector<const MEDCoupling::DataArrayChar *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
- return DataArrayChar::Aggregate(tmp);
- }
-
- static DataArrayChar *Meld(PyObject *dachs)
- {
- std::vector<const MEDCoupling::DataArrayChar *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
- return DataArrayChar::Meld(tmp);
- }
- }
- };
-
- class DataArrayByteIterator;
-
- class DataArrayByte : public DataArrayChar
- {
- public:
- static DataArrayByte *New();
- DataArrayByteIterator *iterator();
- DataArrayByte *performCopyOrIncrRef(bool deepCopy) const;
- char byteValue() const;
- %extend
- {
- DataArrayByte()
- {
- return DataArrayByte::New();
- }
-
- static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
- {
- const char *msg="MEDCoupling::DataArrayByte::New : Available API are : \n-DataArrayByte.New()\n--DataArrayByte.New([1,3,4])\n-DataArrayByte.New([1,3,4],3)\n-DataArrayByte.New([1,3,4,5],2,2)\n-DataArrayByte.New(5)\n-DataArrayByte.New(5,2) !";
- if(PyList_Check(elt0) || PyTuple_Check(elt0))
- {
- if(nbOfTuples)
- {
- if(PyInt_Check(nbOfTuples))
- {
- int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
- if(nbOfTuples1<0)
- throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
- if(nbOfComp)
- {
- if(PyInt_Check(nbOfComp))
- {//DataArrayByte.New([1,3,4,5],2,2)
- int nbOfCompo=PyInt_AS_LONG(nbOfComp);
- if(nbOfCompo<0)
- throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
- MCAuto<DataArrayByte> ret=DataArrayByte::New();
- std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
- ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
- return ret.retn();
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- {//DataArrayByte.New([1,3,4],3)
- MCAuto<DataArrayByte> ret=DataArrayByte::New();
- int tmpp1=-1;
- std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
- ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
- return ret.retn();
- }
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- {// DataArrayByte.New([1,3,4])
- MCAuto<DataArrayByte> ret=DataArrayByte::New();
- int tmpp1=-1,tmpp2=-1;
- std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
- ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
- return ret.retn();
- }
- }
- else if(PyInt_Check(elt0))
- {
- int nbOfTuples1=PyInt_AS_LONG(elt0);
- if(nbOfTuples1<0)
- throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
- if(nbOfTuples)
- {
- if(!nbOfComp)
- {
- if(PyInt_Check(nbOfTuples))
- {//DataArrayByte.New(5,2)
- int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
- if(nbOfCompo<0)
- throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
- MCAuto<DataArrayByte> ret=DataArrayByte::New();
- ret->alloc(nbOfTuples1,nbOfCompo);
- return ret.retn();
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- {//DataArrayByte.New(5)
- MCAuto<DataArrayByte> ret=DataArrayByte::New();
- ret->alloc(nbOfTuples1,1);
- return ret.retn();
- }
- }
-#ifdef WITH_NUMPY
- else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
- {//DataArrayDouble.New(numpyArray)
- return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
- }
-#endif
- else
- throw INTERP_KERNEL::Exception(msg);
- }
-
- DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
- {
- return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
- }
-
- std::string __repr__() const
- {
- std::ostringstream oss;
- self->reprQuickOverview(oss);
- return oss.str();
- }
-
- int __int__() const
- {
- return (int) self->byteValue();
- }
-
- DataArrayByteIterator *__iter__()
- {
- return self->iterator();
- }
-
- int getIJ(int tupleId, int compoId) const
- {
- return (int)self->getIJ(tupleId,compoId);
- }
-
- int getIJSafe(int tupleId, int compoId) const
- {
- return (int)self->getIJSafe(tupleId,compoId);
- }
-
- std::string __str__() const
- {
- return self->repr();
- }
-
- PyObject *toStrList() const
- {
- const char *vals=self->getConstPointer();
- int nbOfComp=self->getNumberOfComponents();
- int nbOfTuples=self->getNumberOfTuples();
- return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
- }
-
- bool presenceOfTuple(PyObject *tupl) const
- {
- int sz=-1,sw=-1;
- int ival=-1; std::vector<int> ivval;
- const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
- std::vector<char> vals(sz);
- std::copy(pt,pt+sz,vals.begin());
- return self->presenceOfTuple(vals);
- }
-
- bool presenceOfValue(PyObject *vals) const
- {
- int sz=-1,sw=-1;
- int ival=-1; std::vector<int> ivval;
- const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
- std::vector<char> vals2(sz);
- std::copy(pt,pt+sz,vals2.begin());
- return self->presenceOfValue(vals2);
- }
-
- int findIdFirstEqual(PyObject *vals) const
- {
- int sz=-1,sw=-1;
- int ival=-1; std::vector<int> ivval;
- const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
- std::vector<char> vals2(sz);
- std::copy(pt,pt+sz,vals2.begin());
- return self->findIdFirstEqual(vals2);
- }
-
- int findIdFirstEqualTuple(PyObject *tupl) const
- {
- int sz=-1,sw=-1;
- int ival=-1; std::vector<int> ivval;
- const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
- std::vector<char> vals(sz);
- std::copy(pt,pt+sz,vals.begin());
- return self->findIdFirstEqualTuple(vals);
- }
-
- int findIdSequence(PyObject *strOrListOfInt) const
- {
- int sz=-1,sw=-1;
- int ival=-1; std::vector<int> ivval;
- const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
- std::vector<char> vals(sz);
- std::copy(pt,pt+sz,vals.begin());
- return self->findIdSequence(vals);
- }
-
- PyObject *getTuple(int tupleId)
- {
- int sz=self->getNumberOfComponents();
+ std::size_t sz=self->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
self->getTuple(tupleId,tmp);
PyObject *ret=PyTuple_New(sz);
- for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
+ for(std::size_t i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((mcIdType)tmp[i]));
return ret;
}
PyObject *getMaxValue() const
{
- int tmp;
- int r1=(int)self->getMaxValue(tmp);
+ mcIdType tmp;
+ mcIdType r1=(mcIdType)self->getMaxValue(tmp);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
PyObject *getMinValue() const
{
- int tmp;
- int r1=(int)self->getMinValue(tmp);
+ mcIdType tmp;
+ mcIdType r1=(mcIdType)self->getMinValue(tmp);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
return ret;
}
- int index(PyObject *obj) const
+ mcIdType index(PyObject *obj) const
{
- int nbOfCompo=self->getNumberOfComponents();
+ std::size_t nbOfCompo=self->getNumberOfComponents();
switch(nbOfCompo)
{
case 1:
{
if(PyInt_Check(obj))
{
- int val=(int)PyInt_AS_LONG(obj);
+ char val=(char)PyInt_AS_LONG(obj);
return self->findIdFirstEqual(val);
}
else
bool __contains__(PyObject *obj) const
{
- int nbOfCompo=self->getNumberOfComponents();
+ std::size_t nbOfCompo=self->getNumberOfComponents();
switch(nbOfCompo)
{
case 0:
{
if(PyInt_Check(obj))
{
- int val=(int)PyInt_AS_LONG(obj);
+ char val=(char)PyInt_AS_LONG(obj);
return self->presenceOfValue(val);
}
else
{
self->checkAllocated();
const char msg[]="Unexpected situation in __setitem__ !";
- int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
- int sw1,sw2;
- int i1;
+ mcIdType nbOfTuples(self->getNumberOfTuples());
+ int nbOfComponents((int)self->getNumberOfComponents());
+ mcIdType sw1,sw2;
+ int int1;
std::vector<int> v1;
- DataArrayInt *d1=0;
+ DataArrayIdType *d1=0;
DataArrayIntTuple *dd1=0;
- convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
- int it1,ic1;
- std::vector<int> vt1,vc1;
- std::pair<int, std::pair<int,int> > pt1,pc1;
- DataArrayInt *dt1=0,*dc1=0;
+ convertIntStarLikePyObjToCpp(value,sw1,int1,v1,d1,dd1);
+ mcIdType it1,ic1;
+ std::vector<mcIdType> vt1,vc1;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > pt1,pc1;
+ DataArrayIdType *dt1=0,*dc1=0;
convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
- MCAuto<DataArrayInt> tmp;
+ MCAuto<DataArrayIdType> tmp;
+ char i1 = (char)int1;
switch(sw2)
{
case 1:
{
public:
std::string repr() const;
- DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const;
+ DataArrayByte *buildDAByte(mcIdType nbOfTuples, mcIdType nbOfCompo) const;
%extend
{
std::string __str__() const
{
if(PyInt_Check(nbOfTuples))
{
- int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples));
if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
if(nbOfComp)
{
if(PyInt_Check(nbOfComp))
{//DataArrayAsciiChar.New([1,3,4,5],2,2)
- int nbOfCompo=PyInt_AS_LONG(nbOfComp);
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp));
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
- std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
+ std::vector<mcIdType> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
return ret.retn();
}
else
{//DataArrayAsciiChar.New([1,3,4],3)
MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
- int tmpp1=-1;
- std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
+ mcIdType tmpp1=-1;
+ std::vector<mcIdType> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
return ret.retn();
}
{
// DataArrayAsciiChar.New([1,3,4])
MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
- int tmpp1=-1,tmpp2=-1;
- std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
+ mcIdType tmpp1=-1,tmpp2=-1;
+ std::vector<mcIdType> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
return ret.retn();
}
}
else if(PyInt_Check(elt0))
{
- int nbOfTuples1=PyInt_AS_LONG(elt0);
+ mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(elt0));
if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
if(nbOfTuples)
{
if(PyInt_Check(nbOfTuples))
{//DataArrayAsciiChar.New(5,2)
- int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfTuples));
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
return self->iterator();
}
- std::string getIJ(int tupleId, int compoId) const
+ std::string getIJ(mcIdType tupleId, mcIdType compoId) const
{
char tmp[2]; tmp[1]='\0';
tmp[0]=self->getIJ(tupleId,compoId);
return std::string(tmp);
}
- std::string getIJSafe(int tupleId, int compoId) const
+ std::string getIJSafe(mcIdType tupleId, mcIdType compoId) const
{
char tmp[2]; tmp[1]='\0';
tmp[0]=self->getIJSafe(tupleId,compoId);
PyObject *toStrList() const
{
const char *vals=self->getConstPointer();
- int nbOfComp=self->getNumberOfComponents();
- int nbOfTuples=self->getNumberOfTuples();
- return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
+ std::size_t nbOfComp=self->getNumberOfComponents();
+ mcIdType nbOfTuples=self->getNumberOfTuples();
+ return convertCharArrToPyListOfTuple(vals,(int)nbOfComp,nbOfTuples);
}
bool presenceOfTuple(PyObject *tupl) const
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
}
- int findIdFirstEqual(PyObject *vals) const
+ mcIdType findIdFirstEqual(PyObject *vals) const
{
if(PyString_Check(vals))
{
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
}
- int findIdFirstEqualTuple(PyObject *tupl) const
+ mcIdType findIdFirstEqualTuple(PyObject *tupl) const
{
if(PyString_Check(tupl))
{
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
}
- int findIdSequence(PyObject *strOrListOfInt) const
+ mcIdType findIdSequence(PyObject *strOrListOfInt) const
{
if(PyString_Check(strOrListOfInt))
{
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
}
- PyObject *getTuple(int tupleId) const
+ PyObject *getTuple(mcIdType tupleId) const
{
- int sz=self->getNumberOfComponents();
+ std::size_t sz=self->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
self->getTuple(tupleId,tmp);
return PyString_FromString(tmp);
PyObject *getMaxValue() const
{
- int tmp;
+ mcIdType tmp;
char tmp2[2]; tmp2[1]='\0';
tmp2[0]=self->getMaxValue(tmp);
PyObject *ret=PyTuple_New(2);
PyObject *getMinValue() const
{
- int tmp;
+ mcIdType tmp;
char tmp2[2]; tmp2[1]='\0';
tmp2[0]=self->getMinValue(tmp);
PyObject *ret=PyTuple_New(2);
return ret;
}
- int index(PyObject *obj) const
+ mcIdType index(PyObject *obj) const
{
- int nbOfCompo=self->getNumberOfComponents();
+ std::size_t nbOfCompo=self->getNumberOfComponents();
switch(nbOfCompo)
{
case 1:
bool __contains__(PyObject *obj) const
{
- int nbOfCompo=self->getNumberOfComponents();
+ std::size_t nbOfCompo=self->getNumberOfComponents();
switch(nbOfCompo)
{
case 0:
PyObject *__getitem__(PyObject *obj) const
{
- int sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- std::pair<int, std::pair<int,int> > sTyyppArr;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
+ mcIdType sw,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > sTyyppArr;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
switch(sw)
{
case 4:
return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
default:
- throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayIdType and slice in input !");
}
}
DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value)
{
- static const char msg[]="DataArrayAsciiChar::__setitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input, and 4 types accepted in value : string, list or tuple of strings having same size, not null DataArrayChar instance.";
- int sw1,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- std::pair<int, std::pair<int,int> > sTyyppArr;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- int nbOfCompo=self->getNumberOfComponents();
- int nbOfTuples=self->getNumberOfTuples();
+ static const char msg[]="DataArrayAsciiChar::__setitem__ : supporting int, list of int, tuple of int, DataArrayIdType and slice in input, and 4 types accepted in value : string, list or tuple of strings having same size, not null DataArrayChar instance.";
+ mcIdType sw1,iTypppArr;
+ std::vector<mcIdType> stdvecTyyppArr;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > sTyyppArr;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
+ mcIdType nbOfCompo=ToIdType(self->getNumberOfComponents());
+ mcIdType nbOfTuples=self->getNumberOfTuples();
convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
- int sw2;
+ mcIdType sw2;
char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
switch(sw1)
}
}
case 4:
- {//DataArrayInt
+ {//DataArrayIdType
switch(sw2)
{
{//value char
class DataArrayAsciiCharTuple
{
public:
- int getNumberOfCompo() const;
- DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const;
+ std::size_t getNumberOfCompo() const;
+ DataArrayAsciiChar *buildDAAsciiChar(mcIdType nbOfTuples, mcIdType nbOfCompo) const;
%extend
{
std::string __str__() const
};
}
+%include "DataArrayInt.i"
+
%pythoncode %{
def MEDCouplingStdReduceFunct(cls,params):
a,b=params
raise InterpKernelException("PyWrap of DataArrayDouble.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
return MEDCouplingStdReduceFunct,(DataArrayDouble,((self.toNumPyArray(),),(self.__getstate__()),))
-def MEDCouplingDataArrayIntReduce(self):
+def MEDCouplingDataArrayInt32Reduce(self):
if not MEDCouplingHasNumPyBindings():
- raise InterpKernelException("PyWrap of DataArrayInt.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
- return MEDCouplingStdReduceFunct,(DataArrayInt,((self.toNumPyArray(),),(self.__getstate__()),))
+ raise InterpKernelException("PyWrap of DataArrayIdType.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
+ return MEDCouplingStdReduceFunct,(DataArrayInt32,((self.toNumPyArray(),),(self.__getstate__()),))
+
+def MEDCouplingDataArrayInt64Reduce(self):
+ if not MEDCouplingHasNumPyBindings():
+ raise InterpKernelException("PyWrap of DataArrayIdType.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
+ return MEDCouplingStdReduceFunct,(DataArrayInt64,((self.toNumPyArray(),),(self.__getstate__()),))
def MEDCouplingDataArrayByteReduce(self):
if not MEDCouplingHasNumPyBindings():
if not MEDCouplingHasNumPyBindings():
raise InterpKernelException("PyWrap of DataArrayFloat.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
return MEDCouplingStdReduceFunct,(DataArrayFloat,((self.toNumPyArray(),),(self.__getstate__()),))
+
+if MEDCouplingUse64BitIDs():
+ DataArrayInt=DataArrayInt64
+else:
+ DataArrayInt=DataArrayInt32
+pass
+
%}
a=a.cumsum(dtype=int32)
a=array(a,dtype=int64) ; a=array(a,dtype=int32)
self.assertEqual(getrefcount(a),2)
- d=DataArrayInt(a)
+ d=DataArrayInt32(a)
d[:]=2
#
- e=DataArrayInt(sz) ; e.fillWithValue(2)
+ e=DataArrayInt32(sz) ; e.fillWithValue(2)
self.assertTrue(d.isEqual(e))
#
a[:]=4 ; e.fillWithValue(4)
self.assertEqual(getrefcount(a),3)
self.assertEqual(getrefcount(b),2)
b[:]=5
- d=DataArrayInt(b)
+ d=DataArrayInt32(b)
#
- e=DataArrayInt(sz*2) ; e.fillWithValue(5)
+ e=DataArrayInt32(sz*2) ; e.fillWithValue(5)
self.assertTrue(d.isEqual(e))
pass
c=a.reshape(2,sz)
b[:]=6
b[7:17]=7
- d=DataArrayInt(b)
- self.assertTrue(d.isEqual(DataArrayInt([6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,6,6,6])))
+ d=DataArrayInt32(b)
+ self.assertTrue(d.isEqual(DataArrayInt32([6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,6,6,6])))
#
a=zeros((10,2),dtype=int32)
b=a.T
c=b.view()
a.shape=20
a[3:]=10.
- d=DataArrayInt(a)
- self.assertTrue(d.isEqual(DataArrayInt([0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10])))
+ d=DataArrayInt32(a)
+ self.assertTrue(d.isEqual(DataArrayInt32([0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10])))
pass
@unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
def test5(self):
a=arange(20,dtype=int32)
self.assertEqual(weakref.getweakrefcount(a),0)
- d=DataArrayInt(a)
+ d=DataArrayInt32(a)
self.assertEqual(weakref.getweakrefcount(a),1)
self.assertTrue(not a.flags["OWNDATA"])
self.assertTrue(d.isIota(20))
gc.collect()
self.assertTrue(a.flags["OWNDATA"])
a[:]=4 # a can be used has usual
- self.assertTrue(DataArrayInt(a).isUniform(4))
+ self.assertTrue(DataArrayInt32(a).isUniform(4))
pass
@unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
def test6(self):
a=arange(20,dtype=int32)
- d=DataArrayInt(a) # d owns data of a
- e=DataArrayInt(a) # a not owned -> e only an access to chunk of a
+ d=DataArrayInt32(a) # d owns data of a
+ e=DataArrayInt32(a) # a not owned -> e only an access to chunk of a
self.assertTrue(d.isIota(d.getNumberOfTuples()))
self.assertTrue(e.isIota(e.getNumberOfTuples()))
a[:]=6
a=array(0,dtype=int32) ; a.resize(10,2)
b=a.reshape(20)
c=a.reshape(2,10)
- d=DataArrayInt(b) # d owns data of a
- e=DataArrayInt(b) # a not owned -> e only an access to chunk of a
- f=DataArrayInt(b) # a not owned -> e only an access to chunk of a
+ d=DataArrayInt32(b) # d owns data of a
+ e=DataArrayInt32(b) # a not owned -> e only an access to chunk of a
+ f=DataArrayInt32(b) # a not owned -> e only an access to chunk of a
del d # d removed -> a ownes again data
##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called
import gc
def test8(self):
a=arange(20,dtype=int32)
self.assertTrue(a.flags["OWNDATA"])
- d=DataArrayInt(a) # d owns data of a
+ d=DataArrayInt32(a) # d owns data of a
self.assertTrue(not a.flags["OWNDATA"])
d.pushBackSilent(20)# d pushBack so release of chunk of data -> a becomes owner of its data again
self.assertTrue(a.flags["OWNDATA"])
- self.assertTrue(d.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])))
+ self.assertTrue(d.isEqual(DataArrayInt32([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])))
self.assertEqual(a.tolist(),[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])
pass
a.resize(sz//2,2)
a[:]=4
self.assertEqual(getrefcount(a),2)
- d=DataArrayInt(a)
+ d=DataArrayInt32(a)
self.assertEqual(10,d.getNumberOfTuples())
self.assertEqual(2,d.getNumberOfComponents())
self.assertEqual(sz,d.getNbOfElems())
- self.assertTrue(d.isEqual(DataArrayInt([(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4)])))
+ self.assertTrue(d.isEqual(DataArrayInt32([(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4)])))
a[:]=7
- self.assertTrue(d.isEqual(DataArrayInt([(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7)])))
+ self.assertTrue(d.isEqual(DataArrayInt32([(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7)])))
#
b=a.reshape((2,5,2))
self.assertRaises(InterpKernelException,DataArrayInt.New,b) # b has not dimension in [0,1] !
#tests that only DataArray*(npArray) constructor is available
a=array(0,dtype=int32)
a.resize(20)
- DataArrayInt(a)
+ DataArrayInt32(a)
self.assertRaises(InterpKernelException,DataArrayInt.New,a,20)
self.assertRaises(InterpKernelException,DataArrayInt.New,a,20,1)
a=array(0,dtype=float64)
@unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
def test25(self):
a=arange(10,dtype=int32)
- b=DataArrayInt(a)
- c=DataArrayInt(a)
- d=DataArrayInt(a)
+ b=DataArrayInt32(a)
+ c=DataArrayInt32(a)
+ d=DataArrayInt32(a)
self.assertTrue(b.isIota(10))
self.assertTrue(c.isIota(10))
self.assertTrue(d.isIota(10))
self.assertTrue(c.isIota(11))
#
a=arange(10,dtype=int32)
- b=DataArrayInt(a)
- c=DataArrayInt(a)
+ b=DataArrayInt32(a)
+ c=DataArrayInt32(a)
self.assertTrue(b.isIota(10))
self.assertTrue(c.isIota(10))
b.pushBackSilent(10) # c and a,b are dissociated
self.assertEqual(a.ndim,2)
self.assertEqual(a.size,15)
self.assertEqual(a.shape,(5,3))
- self.assertEqual(a.strides,(12,4))
- self.assertEqual(a.nbytes,60)
- self.assertEqual(a.itemsize,4)
+ self.assertEqual(a.strides,(3*MEDCouplingSizeOfIDs()//8,MEDCouplingSizeOfIDs()//8))
+ self.assertEqual(a.nbytes,15*MEDCouplingSizeOfIDs()//8)
+ self.assertEqual(a.itemsize,MEDCouplingSizeOfIDs()//8)
self.assertEqual(a.tolist(),[[0,1,2],[3,4,5],[6,7,8],[9,10,11],[12,13,14]])
#
d2=d.convertToDblArr()
f.setName("aname")
a=f.getArray()
b=a[:] ; b.iota(7000)
- f.setArray(DataArrayInt.Meld(a,b))
+ f.setArray(DataArrayInt32.Meld(a,b))
f.getArray().setInfoOnComponents(["u1","vv2"])
f.checkConsistencyLight();
#
return false;
#endif
}
+
+ bool MEDCouplingUse64BitIDs()
+ {
+#ifndef MEDCOUPLING_USE_64BIT_IDS
+ return false;
+#else
+ return true;
+#endif
+ }
std::string MEDCouplingCompletionScript()
{
def MEDCouplingDataArrayFloatIdiv(self,*args):
import _MEDCouplingRemapper
return _MEDCouplingRemapper.DataArrayFloat____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntIadd(self,*args):
+def MEDCouplingDataArrayInt32Iadd(self,*args):
import _MEDCouplingRemapper
- return _MEDCouplingRemapper.DataArrayInt____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntIsub(self,*args):
+ return _MEDCouplingRemapper.DataArrayInt32____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32Isub(self,*args):
import _MEDCouplingRemapper
- return _MEDCouplingRemapper.DataArrayInt____isub___(self, self, *args)
-def MEDCouplingDataArrayIntImul(self,*args):
+ return _MEDCouplingRemapper.DataArrayInt32____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32Imul(self,*args):
import _MEDCouplingRemapper
- return _MEDCouplingRemapper.DataArrayInt____imul___(self, self, *args)
-def MEDCouplingDataArrayIntIdiv(self,*args):
+ return _MEDCouplingRemapper.DataArrayInt32____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32Idiv(self,*args):
import _MEDCouplingRemapper
- return _MEDCouplingRemapper.DataArrayInt____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntImod(self,*args):
+ return _MEDCouplingRemapper.DataArrayInt32____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32Imod(self,*args):
import _MEDCouplingRemapper
- return _MEDCouplingRemapper.DataArrayInt____imod___(self, self, *args)
-def MEDCouplingDataArrayIntIpow(self,*args):
+ return _MEDCouplingRemapper.DataArrayInt32____imod___(self, self, *args)
+def MEDCouplingDataArrayInt32Ipow(self,*args):
import _MEDCouplingRemapper
- return _MEDCouplingRemapper.DataArrayInt____ipow___(self, self, *args)
+ return _MEDCouplingRemapper.DataArrayInt32____ipow___(self, self, *args)
+def MEDCouplingDataArrayInt64Iadd(self,*args):
+ import _MEDCouplingRemapper
+ return _MEDCouplingRemapper.DataArrayInt64____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64Isub(self,*args):
+ import _MEDCouplingRemapper
+ return _MEDCouplingRemapper.DataArrayInt64____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64Imul(self,*args):
+ import _MEDCouplingRemapper
+ return _MEDCouplingRemapper.DataArrayInt64____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64Idiv(self,*args):
+ import _MEDCouplingRemapper
+ return _MEDCouplingRemapper.DataArrayInt64____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64Imod(self,*args):
+ import _MEDCouplingRemapper
+ return _MEDCouplingRemapper.DataArrayInt64____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64Ipow(self,*args):
+ import _MEDCouplingRemapper
+ return _MEDCouplingRemapper.DataArrayInt64____ipow___(self, self, *args)
def MEDCouplingDataArrayDoubleTupleIadd(self,*args):
import _MEDCouplingRemapper
return _MEDCouplingRemapper.DataArrayDoubleTuple____iadd___(self, self, *args)
def MEDCouplingDataArrayDoubleTupleIdiv(self,*args):
import _MEDCouplingRemapper
return _MEDCouplingRemapper.DataArrayDoubleTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIadd(self,*args):
+def MEDCouplingDataArrayInt32TupleIadd(self,*args):
+ import _MEDCouplingRemapper
+ return _MEDCouplingRemapper.DataArrayInt32Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIsub(self,*args):
+ import _MEDCouplingRemapper
+ return _MEDCouplingRemapper.DataArrayInt32Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImul(self,*args):
+ import _MEDCouplingRemapper
+ return _MEDCouplingRemapper.DataArrayInt32Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIdiv(self,*args):
+ import _MEDCouplingRemapper
+ return _MEDCouplingRemapper.DataArrayInt32Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImod(self,*args):
+ import _MEDCouplingRemapper
+ return _MEDCouplingRemapper.DataArrayInt32Tuple____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIadd(self,*args):
import _MEDCouplingRemapper
- return _MEDCouplingRemapper.DataArrayIntTuple____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIsub(self,*args):
+ return _MEDCouplingRemapper.DataArrayInt64Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIsub(self,*args):
import _MEDCouplingRemapper
- return _MEDCouplingRemapper.DataArrayIntTuple____isub___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImul(self,*args):
+ return _MEDCouplingRemapper.DataArrayInt64Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImul(self,*args):
import _MEDCouplingRemapper
- return _MEDCouplingRemapper.DataArrayIntTuple____imul___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIdiv(self,*args):
+ return _MEDCouplingRemapper.DataArrayInt64Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIdiv(self,*args):
import _MEDCouplingRemapper
- return _MEDCouplingRemapper.DataArrayIntTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImod(self,*args):
+ return _MEDCouplingRemapper.DataArrayInt64Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImod(self,*args):
import _MEDCouplingRemapper
- return _MEDCouplingRemapper.DataArrayIntTuple____imod___(self, self, *args)
+ return _MEDCouplingRemapper.DataArrayInt64Tuple____imod___(self, self, *args)
def MEDCouplingDenseMatrixIadd(self,*args):
import _MEDCouplingRemapper
return _MEDCouplingRemapper.DenseMatrix____iadd___(self, self, *args)
{
PyObject *getCrudeMatrix() const
{
- const std::vector<std::map<int,double> >& m=self->getCrudeMatrix();
+ const std::vector<std::map<mcIdType,double> >& m=self->getCrudeMatrix();
std::size_t sz=m.size();
PyObject *ret=PyList_New(sz);
for(std::size_t i=0;i<sz;i++)
{
- const std::map<int,double>& row=m[i];
+ const std::map<mcIdType,double>& row=m[i];
PyObject *ret0=PyDict_New();
- for(std::map<int,double>::const_iterator it=row.begin();it!=row.end();it++)
+ for(std::map<mcIdType,double>::const_iterator it=row.begin();it!=row.end();it++)
PyDict_SetItem(ret0,PyInt_FromLong((*it).first),PyFloat_FromDouble((*it).second));
PyList_SetItem(ret,i,ret0);
}
#endif
void setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, PyObject *m)
{
- std::vector<std::map<int,double> > mCpp;
+ std::vector<std::map<mcIdType,double> > mCpp;
if(isCSRMatrix(m))
{
#if defined(WITH_NUMPY) && defined(WITH_SCIPY)
PyObject *indptr(PyObject_GetAttrString(m,"indptr"));
PyObject *indices(PyObject_GetAttrString(m,"indices"));
PyObject *data(PyObject_GetAttrString(m,"data"));
- MCAuto<DataArrayInt> indptrPtr(MEDCoupling_DataArrayInt_New__SWIG_1(indptr,NULL,NULL));
- MCAuto<DataArrayInt> indicesPtr(MEDCoupling_DataArrayInt_New__SWIG_1(indices,NULL,NULL));
+ MCAuto<DataArrayInt32> indptrPtr, indicesPtr;
+ // csr_matrix.indptr and csr_matrix.indices are always dtype==int32
+// #if defined(MEDCOUPLING_USE_64BIT_IDS)
+// indptrPtr = MEDCoupling_DataArrayInt64_New__SWIG_1(indptr,NULL,NULL);
+// indicesPtr = MEDCoupling_DataArrayInt64_New__SWIG_1(indices,NULL,NULL);
+// #else
+ indptrPtr = MEDCoupling_DataArrayInt32_New__SWIG_1(indptr,NULL,NULL);
+ indicesPtr = MEDCoupling_DataArrayInt32_New__SWIG_1(indices,NULL,NULL);
+//#endif
MCAuto<DataArrayDouble> dataPtr(MEDCoupling_DataArrayDouble_New__SWIG_1(data,NULL,NULL));
convertCSR_MCDataToVectMapIntDouble(indptrPtr,indicesPtr,dataPtr,mCpp);
Py_XDECREF(data); Py_XDECREF(indptr); Py_XDECREF(indices);
void setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, PyObject *m)
{
- std::vector<std::map<int,double> > mCpp;
+ std::vector<std::map<mcIdType,double> > mCpp;
convertToVectMapIntDouble(m,mCpp);
self->setCrudeMatrixEx(src,target,mCpp);
}
vals*=1e-5
eps0=DataArrayDouble(m0.data)-vals ; eps0.abs()
self.assertTrue(eps0.findIdsInRange(1e-17,1e300).empty())
- self.assertTrue(DataArrayInt(m0.indices).isEqual(DataArrayInt([0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27])))
- self.assertTrue(DataArrayInt(m0.indptr).isEqual(DataArrayInt([0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255,258,261,264,267,270,273,276,279,282,285,288,291,294,297,300,303,306,309,312])))
+ self.assertTrue(DataArrayInt32(m0.indices).isEqual(DataArrayInt32([0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27])))
+ self.assertTrue(DataArrayInt32(m0.indptr).isEqual(DataArrayInt32([0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255,258,261,264,267,270,273,276,279,282,285,288,291,294,297,300,303,306,309,312])))
#
rem2=MEDCouplingRemapper() ; rem2.setIntersectionType(Barycentric)
rem2.prepare(b,a,"P0P1")
rem.setMinDotBtwPlane3DSurfIntersect(0.99)# this line is important it is to tell to remapper to select only cells with very close orientation
rem.prepare(skinAndNonConformCells,skinAndNonConformCells,"P0P0")
mat=rem.getCrudeCSRMatrix()
- indptr=DataArrayInt(mat.indptr)
+ indptr=DataArrayInt32(mat.indptr) #not depend on MEDCouplingUse64BitIDs()
indptr2=indptr.deltaShiftIndex()
cellIdsOfNonConformCells=indptr2.findIdsNotEqual(1)
cellIdsOfSkin=indptr2.findIdsEqual(1)
virtual MEDCouplingTimeDiscretization *negate() const;
virtual MEDCouplingTimeDiscretization *maxPerTuple() const;
virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector<int>& compoIds) const;
- virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds);
- virtual void changeNbOfComponents(int newNbOfComp, double dftValue);
+ virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<std::size_t>& compoIds);
+ virtual void changeNbOfComponents(std::size_t newNbOfComp, double dftValue);
virtual void sortPerTuple(bool asc);
virtual void setUniformValue(int nbOfTuple, int nbOfCompo, double value);
virtual void setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value);
MEDCoupling::DataArrayDouble *a;
MEDCoupling::DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
MEDCoupling::DataArrayDouble *a;
MEDCoupling::DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
MEDCoupling::DataArrayDouble *a;
MEDCoupling::DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
MEDCoupling::DataArrayDouble *a;
MEDCoupling::DataArrayDoubleTuple *aa;
std::vector<double> bb;
- int sw;
+ mcIdType sw;
convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
template<class T>
typename MEDCoupling::Traits<T>::FieldType *fieldT_buildSubPart(const MEDCoupling::MEDCouplingFieldT<T> *self, PyObject *li)
{
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
+ mcIdType sw;
+ mcIdType singleVal;
+ std::vector<mcIdType> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
const MEDCoupling::MEDCouplingMesh *mesh=self->getMesh();
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
- int nbc=mesh->getNumberOfCells();
+ mcIdType nbc=mesh->getNumberOfCells();
convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
{
if(nbc+singleVal>0)
{
- int tmp=nbc+singleVal;
+ mcIdType tmp=nbc+singleVal;
return self->buildSubPart(&tmp,&tmp+1);
}
else
return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
}
default:
- throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
}
}
template<class T>
typename MEDCoupling::Traits<T>::FieldType *fieldT__getitem__(const MEDCoupling::MEDCouplingFieldT<T> *self, PyObject *li)
{
- const char msg[]="MEDCouplingFieldDouble::__getitem__ : invalid call Available API are : \n-myField[dataArrayInt]\n-myField[slice]\n-myField[pythonListOfCellIds]\n-myField[integer]\n-myField[dataArrayInt,1]\n-myField[slice,1]\n-myField[pythonListOfCellIds,1]\n-myField[integer,1]\n";
+ const char msg[]="MEDCouplingFieldDouble::__getitem__ : invalid call Available API are : \n-myField[DataArrayIdType]\n-myField[slice]\n-myField[pythonListOfCellIds]\n-myField[integer]\n-myField[DataArrayIdType,1]\n-myField[slice,1]\n-myField[pythonListOfCellIds,1]\n-myField[integer,1]\n";
if(PyTuple_Check(li))
{
Py_ssize_t sz=PyTuple_Size(li);
if(sz!=2)
throw INTERP_KERNEL::Exception(msg);
PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
+ mcIdType sw;
+ std::size_t singleVal;
+ std::vector<std::size_t> multiVal;
+ std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
+ MEDCoupling::DataArrayIdType *daIntTyypp=0;
if(!self->getArray())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
try
- { convertIntStarOrSliceLikePyObjToCpp(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
+ { convertIntStarOrSliceLikePyObjToCpp(elt1,ToIdType(self->getArray()->getNumberOfComponents()),sw,singleVal,multiVal,slic,daIntTyypp); }
catch(INTERP_KERNEL::Exception& e)
{ std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
typename MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::FieldType > ret0(fieldT_buildSubPart<T>(self,elt0));
{
case 1:
{
- std::vector<int> v2(1,singleVal);
+ std::vector<std::size_t> v2(1,singleVal);
MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aarr(ret0Arr->keepSelectedComponents(v2));
ret0->setArray(aarr);
return ret0.retn();
}
case 3:
{
- int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !"));
- std::vector<int> v2(nbOfComp);
- for(int i=0;i<nbOfComp;i++)
+ mcIdType nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !"));
+ std::vector<std::size_t> v2(nbOfComp);
+ for(mcIdType i=0;i<nbOfComp;i++)
v2[i]=slic.first+i*slic.second.second;
MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aarr(ret0Arr->keepSelectedComponents(v2));
ret0->setArray(aarr);
PyObject *field_getTinySerializationInformation(const FIELDT *self)
{
std::vector<double> a0;
- std::vector<int> a1;
+ std::vector<mcIdType> a1;
std::vector<std::string> a2;
self->getTinySerializationDbleInformation(a0);
self->getTinySerializationIntInformation(a1);
PyObject *ret(PyTuple_New(3));
PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
- int sz(a2.size());
+ std::size_t sz(a2.size());
PyObject *ret2(PyList_New(sz));
{
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
}
PyTuple_SetItem(ret,2,ret2);
template<class T>
PyObject *field_serialize(const typename MEDCoupling::Traits<T>::FieldType *self)
{
- MEDCoupling::DataArrayInt *ret0(0);
+ MEDCoupling::DataArrayIdType *ret0(0);
std::vector<typename MEDCoupling::Traits<T>::ArrayType *> ret1;
self->serialize(ret0,ret1);
if(ret0)
ret0->incrRef();
std::size_t sz(ret1.size());
PyObject *ret(PyTuple_New(2));
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyObject *ret1Py(PyList_New(sz));
for(std::size_t i=0;i<sz;i++)
{
static const char MSG[]="MEDCouplingFieldDouble.__setstate__ : expected input is a tuple of size 3 !";
if(!PyTuple_Check(inp))
throw INTERP_KERNEL::Exception(MSG);
- int sz(PyTuple_Size(inp));
+ std::size_t sz(PyTuple_Size(inp));
if(sz!=3)
throw INTERP_KERNEL::Exception(MSG);
// mesh
PyObject *elt0(PyTuple_GetItem(inp,0));
PyObject *elt1(PyTuple_GetItem(inp,1));
std::vector<double> a0;
- std::vector<int> a1;
+ std::vector<mcIdType> a1;
std::vector<std::string> a2;
- MEDCoupling::DataArrayInt *b0(0);
+ MEDCoupling::DataArrayIdType *b0(0);
std::vector<typename MEDCoupling::Traits<T>::ArrayType *>b1;
{
if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
throw INTERP_KERNEL::Exception(MSG);
PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
- int tmp(-1);
+ mcIdType tmp(-1);
fillArrayWithPyListDbl3(a0py,tmp,a0);
convertPyToNewIntArr3(a1py,a1);
fillStringVector(a2py,a2);
throw INTERP_KERNEL::Exception(MSG);
PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
void *argp(0);
- int status(SWIG_ConvertPtr(b0py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0));
+ int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits<mcIdType>::TI,0|0));
if(!SWIG_IsOK(status))
throw INTERP_KERNEL::Exception(MSG);
- b0=reinterpret_cast<MEDCoupling::DataArrayInt *>(argp);
+ b0=reinterpret_cast<MEDCoupling::DataArrayIdType *>(argp);
convertFromPyObjVectorOfObj<typename MEDCoupling::Traits<T>::ArrayType *>(b1py,SWIGTITraits<T>::TI,MEDCoupling::Traits<T>::ArrayTypeName,b1);
}
self->checkForUnserialization(a1,b0,b1);
self->finishUnserialization(a1,a0,a2);
}
-PyObject *Mesh_getCellsContainingPointsLike(PyObject *p, double eps, const MEDCoupling::MEDCouplingMesh *self, std::function<void(const double *,int,double,MEDCoupling::MCAuto<MEDCoupling::DataArrayInt>&,MEDCoupling::MCAuto<MEDCoupling::DataArrayInt>&)> func)
+PyObject *Mesh_getCellsContainingPointsLike(PyObject *p, double eps, const MEDCoupling::MEDCouplingMesh *self, std::function<void(const double *,mcIdType,double,MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType>&,MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType>&)> func)
{
- MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> elts,eltsIndex;
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elts,eltsIndex;
int spaceDim=self->getSpaceDimension();
void *da=0;
int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
if (!SWIG_IsOK(res1))
{
- int size;
+ mcIdType size;
INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
- int nbOfPoints=size/spaceDim;
+ mcIdType nbOfPoints=size/spaceDim;
if(size%spaceDim!=0)
{
throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
if(!da2)
throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
da2->checkAllocated();
- int size=da2->getNumberOfTuples();
- int nbOfCompo=da2->getNumberOfComponents();
+ mcIdType size=da2->getNumberOfTuples();
+ mcIdType nbOfCompo=ToIdType(da2->getNumberOfComponents());
if(nbOfCompo!=spaceDim)
{
throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
func(da2->getConstPointer(),size,eps,elts,eltsIndex);
}
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
# NumPy is an optional pre-requisite!
assert(MEDCoupling.MEDCouplingHasNumPyBindings())
a=numpy.arange(20,dtype=numpy.int32)
-d=DataArrayInt(a) # d owns data of a
-e=DataArrayInt(a) # a not owned -> e only an access to chunk of a
+d=DataArrayInt32(a) # d owns data of a
+e=DataArrayInt32(a) # a not owned -> e only an access to chunk of a
a1=d.toNumPyArray()
#! [UG_DataArrayNumpy_0]
MEDCouplingBasicsTest4.py
MEDCouplingBasicsTest5.py
MEDCouplingBasicsTest6.py
+ MEDCouplingBasicsTest7.py
MEDCouplingIntersectTest.py
MEDCouplingExamplesTest.py
MEDCouplingRemapperTest.py
ADD_DEFINITIONS(${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${XDR_DEFINITIONS})
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
IF(MEDCOUPLING_ENABLE_PYTHON)
ADD_SUBDIRECTORY(Swig)
ENDIF(MEDCOUPLING_ENABLE_PYTHON)
#define __MEDFILEBASIS_HXX__
#include "InterpKernelException.hxx"
+#include "MEDCouplingMemArray.hxx"
#include <string>
#include <vector>
+#include <med.h>
+
namespace MEDCoupling
{
class MEDFileString
};
}
+namespace MEDCoupling
+{
+
+ class DataArrayMedInt : public DataArrayDiscreteSigned< med_int >
+ {
+ friend class DataArrayDiscrete<med_int>;
+ public:
+ template<class INTARRAY>
+ static DataArrayMedInt *Copy( const INTARRAY* array );
+ static DataArrayMedInt *New() { return new DataArrayMedInt(); }
+ DataArrayMedInt *deepCopy() const { return new DataArrayMedInt(*this); }
+ //DataArrayMedInt *buildNewEmptyInstance() const { return new DataArrayMedInt(); }//ko
+ DataArray *buildNewEmptyInstance() const { if ( sizeof(med_int)==sizeof(long)) return DataArrayInt64::New(); return DataArrayInt32::New(); }
+ public:
+ DataArray *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
+ DataArray *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); }
+ DataArray *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+ DataArray *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const { return this->myKeepSelectedComponents(compoIds); }
+ DataArray *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return this->mySelectByTupleIdSafeSlice(bg,end2,step); }
+ DataArray *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const { return this->mySelectByTupleRanges(ranges); }
+ private:
+ ~DataArrayMedInt() { }
+ DataArrayMedInt() { }
+ };
+
+ template< class T1, class T2 >
+ MCAuto<T1> StaticCast( const MCAuto< T2 >& array )
+ {
+ DataArray *src = const_cast< T2* >((const T2*) array );
+ T1* tgt = static_cast<T1*>( src );
+ if ( tgt )
+ tgt->incrRef();
+ return tgt;
+ }
+
+ template< class INTARRAY >
+ MCAuto<DataArrayMedInt> ToMedIntArray(const MCAuto<INTARRAY>& intArray )
+ {
+ if ( sizeof( med_int ) == sizeof( typename INTARRAY::Type ))
+ return StaticCast< DataArrayMedInt >( intArray );
+ return DataArrayMedInt::Copy((const INTARRAY*) intArray );
+ }
+
+ template< class INT >
+ MCAuto<DataArrayMedInt> ToMedIntArray(const typename MEDCoupling::Traits<INT>::ArrayType* intArray )
+ {
+ if ( sizeof( med_int ) == sizeof( INT ))
+ {
+ typedef typename MEDCoupling::Traits<INT>::ArrayType INTARRAY;
+ MCAuto< INTARRAY > ia = const_cast< INTARRAY* >( intArray );
+ ia->incrRef();
+ return StaticCast< DataArrayMedInt >( ia );
+ }
+ return DataArrayMedInt::Copy( intArray );
+ }
+
+ template< class INT >
+ MCAuto< typename MEDCoupling::Traits<INT>::ArrayType> FromMedIntArray(MCAuto<DataArrayMedInt>& medIntArray )
+ {
+ typedef typename MEDCoupling::Traits<INT>::ArrayType INTARRAY;
+ if ( sizeof( med_int ) == sizeof( INT ))
+ return StaticCast< INTARRAY >( medIntArray );
+
+ INTARRAY* intArray = INTARRAY::New();
+ intArray->alloc( medIntArray->getNumberOfTuples(), medIntArray->getNumberOfComponents() );
+ intArray->copyStringInfoFrom( * medIntArray.operator->() );
+ std::copy( medIntArray->begin(), medIntArray->end(), intArray->getPointer() );
+ return intArray;
+ }
+
+ template< class INT >
+ MCAuto<DataArrayMedInt> ToMedIntArray(const std::vector<INT>& intVec )
+ {
+ DataArrayMedInt* medIntArray = DataArrayMedInt::New();
+ if ( sizeof( med_int ) == sizeof( INT ))
+ {
+ medIntArray->useArray( reinterpret_cast<const med_int*>(intVec.data()), /*owner=*/false, DeallocType::CPP_DEALLOC, intVec.size(), /*nbComp=*/1 );
+ }
+ else
+ {
+ medIntArray->alloc( intVec.size(), 1 );
+ std::copy( intVec.begin(), intVec.end(), medIntArray->getPointer() );
+ }
+ return medIntArray;
+ }
+
+ template< class INT >
+ med_int ToMedInt( INT i )
+ {
+ return static_cast< med_int >( i );
+ }
+
+ template< class INT >
+ INT FromMedInt( med_int mi )
+ {
+ return static_cast< INT >( mi );
+ }
+
+ template<class INTARRAY>
+ DataArrayMedInt * DataArrayMedInt::Copy( const INTARRAY* intArray )
+ {
+ DataArrayMedInt* medIntArray = DataArrayMedInt::New();
+ medIntArray->alloc( intArray->getNumberOfTuples(), intArray->getNumberOfComponents() );
+ medIntArray->copyStringInfoFrom( *intArray );
+ std::copy( intArray->begin(), intArray->end(), medIntArray->getPointer() );
+ return medIntArray;
+ }
+}
+
#endif
const DataArrayDouble *coo(mesh->getCoords());
if(!coo)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : null coords !");
- MCAuto<DataArrayInt> conn(zeStr->getConn());
+ MCAuto<DataArrayIdType> conn(zeStr->getConn());
if(conn.isNull())
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : null connectivity !");
conn->checkAllocated();
if(conn->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : excepted to be single compo !");
- int nbCells(conn->getNumberOfTuples());
MCAuto<DataArrayDouble> connOut(coo->selectByTupleIdSafe(conn->begin(),conn->end()));
MCAuto<MEDCouplingUMesh> mcOut(MEDCouplingUMesh::Build0DMeshFromCoords(connOut));
mcOut->setName(BuildNewMeshName(mesh->getName(),MED_BALL_STR));
mOut->setMeshAtLevel(0,mcOut);
- const DataArrayInt *ff1(mesh->getFamilyFieldAtLevel(1));
+ const DataArrayIdType *ff1(mesh->getFamilyFieldAtLevel(1));
if(ff1)
{
- MCAuto<DataArrayInt> ff1o(ff1->selectByTupleIdSafe(conn->begin(),conn->end()));
+ MCAuto<DataArrayIdType> ff1o(ff1->selectByTupleIdSafe(conn->begin(),conn->end()));
mOut->setFamilyFieldArr(1,ff1o);
}
- const DataArrayInt *nf1(mesh->getNumberFieldAtLevel(1));
+ const DataArrayIdType *nf1(mesh->getNumberFieldAtLevel(1));
if(nf1)
{
- MCAuto<DataArrayInt> nf1o(nf1->selectByTupleIdSafe(conn->begin(),conn->end()));
+ MCAuto<DataArrayIdType> nf1o(nf1->selectByTupleIdSafe(conn->begin(),conn->end()));
mOut->setRenumFieldArr(1,nf1o);
}
MCAuto<MEDFileUMeshPerTypeCommon> md(zeStr->getMeshDef());
- const DataArrayInt *ff0(md->getFam());
+ const DataArrayIdType *ff0(md->getFam());
if(ff0)
- mOut->setFamilyFieldArr(0,const_cast<DataArrayInt *>(ff0));
- const DataArrayInt *nf0(md->getNum());
+ mOut->setFamilyFieldArr(0,const_cast<DataArrayIdType *>(ff0));
+ const DataArrayIdType *nf0(md->getNum());
if(nf0)
- mOut->setRenumFieldArr(0,const_cast<DataArrayInt *>(nf0));
+ mOut->setRenumFieldArr(0,const_cast<DataArrayIdType *>(nf0));
mOut->copyFamGrpMapsFrom(*mesh);
const std::vector< MCAuto<DataArray> >& vars(zeStr->getVars());
for(std::vector< MCAuto<DataArray> >::const_iterator it=vars.begin();it!=vars.end();it++)
std::vector<std::string> pfls(zeGuideForPfl->getPflsReallyUsed());
if(pfls.size()>=2)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLSInFields : drink less coffee");
- MCAuto<DataArrayInt> pflMyLove;
+ MCAuto<DataArrayIdType> pflMyLove;
if(pfls.size()==1)
pflMyLove.takeRef(zeGuideForPfl->getProfile(pfls[0]));
// Yeah we have pfls
MCAuto<MEDCouplingUMesh> LocInfo::BuildMeshCommon(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs, MCAuto<DataArrayDouble>& ptsForLoc)
{
- MCAuto<DataArrayInt> conn(zeStr->getConn());
+ MCAuto<DataArrayIdType> conn(zeStr->getConn());
conn=conn->deepCopy(); conn->rearrange(1);
MCAuto<MEDCouplingUMesh> geoMesh;
{
//
if(!pfl.empty())
{
- const DataArrayInt *pflArr(globs->getProfile(pfl));
+ const DataArrayIdType *pflArr(globs->getProfile(pfl));
geoMesh=geoMesh->buildPartOfMySelf(pflArr->begin(),pflArr->end(),true);
}
//
MCConstAuto<DataArrayDouble> angleVrille;
if(!pfl.empty())
{
- const DataArrayInt *pflArr(globs->getProfile(pfl));
+ const DataArrayIdType *pflArr(globs->getProfile(pfl));
angleVrille=angleDeVrille->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
}
else
//
MCAuto<MEDCouplingFieldDouble> dir(geoMesh->buildDirectionVectorField());
MCAuto<DataArrayDouble> rot(dir->getArray()->fromCartToSpher());
- int nbCompo(ptsForLoc->getNumberOfComponents());
+ std::size_t nbCompo(ptsForLoc->getNumberOfComponents());
MCAuto<DataArrayDouble> secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.));
- int nbSecPts(secPts->getNumberOfTuples()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size());
+ mcIdType nbSecPts(secPts->getNumberOfTuples()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size()));
{
const int TAB[3]={2,0,1};
- std::vector<int> v(TAB,TAB+3);
+ std::vector<std::size_t> v(TAB,TAB+3);
secPts=secPts->keepSelectedComponents(v);
}
const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.};
for(int l=0;l<nbg;l++)
{
MCAuto<DataArrayDouble> p2(p->deepCopy());
- for(int k=0;k<nbCompo;k++)
+ for(std::size_t k=0;k<nbCompo;k++)
p2->applyLin(1.,ptsForLoc->getIJ(j*nbg+l,k),k);
arrs[j*nbg+l]=p2;
}
{
MCAuto<DataArrayDouble> ptsForLoc;
MCAuto<MEDCouplingUMesh> geoMesh(BuildMeshCommon(gt,pfl,loc,zeStr,mesh,section,globs,ptsForLoc));
- int nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size());
+ mcIdType nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size()));
MCConstAuto<DataArrayDouble> zeThickness;
if(!pfl.empty())
{
- const DataArrayInt *pflArr(globs->getProfile(pfl));
+ const DataArrayIdType *pflArr(globs->getProfile(pfl));
zeThickness=thickness->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
}
else
MCAuto<MEDCouplingFieldDouble> ortho(geoMesh->buildOrthogonalField());
orthoArr.takeRef(ortho->getArray());
}
- int nbCompo(orthoArr->getNumberOfComponents());
+ mcIdType nbCompo(ToIdType(orthoArr->getNumberOfComponents()));
MCAuto<DataArrayDouble> secPts(section->getCoords()->duplicateEachTupleNTimes(nbCompo));
secPts->rearrange(nbCompo);
std::vector< MCAuto<DataArrayDouble> > arrs(nbCells*nbg);
- for(int j=0;j<nbCells;j++)
+ for(mcIdType j=0;j<nbCells;j++)
{
double thck(zeThickness->getIJ(j,0)),eccentricity(zeThickness->getIJ(j,1));
MCAuto<DataArrayDouble> fact(DataArrayDouble::New()),fact2(DataArrayDouble::New()); fact->alloc(1,nbCompo); fact2->alloc(1,nbCompo);
static const char MSG1[]="BuildMeshPipeSEG3 : not recognized pattern ! Send mail to anthony.geay@edf.fr with corresponding MED file !";
MCAuto<DataArrayDouble> ptsForLoc;
MCAuto<MEDCouplingUMesh> geoMesh(BuildMeshCommon(INTERP_KERNEL::NORM_SEG3,pfl,loc,zeStr,mesh,section,globs,ptsForLoc));
- int nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size());
+ mcIdType nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size()));
MCConstAuto<DataArrayDouble> zeAngle,zeScale;
if(!pfl.empty())
{
- const DataArrayInt *pflArr(globs->getProfile(pfl));
+ const DataArrayIdType *pflArr(globs->getProfile(pfl));
zeAngle=angle->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
zeScale=scale->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
}
dir=geoMesh2->buildDirectionVectorField();
}
MCAuto<DataArrayDouble> rot(dir->getArray()->fromCartToSpher());
- int nbCompo(ptsForLoc->getNumberOfComponents());
+ std::size_t nbCompo(ptsForLoc->getNumberOfComponents());
MCAuto<DataArrayDouble> secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.));
{
const int TAB[3]={2,0,1};
- std::vector<int> v(TAB,TAB+3);
+ std::vector<std::size_t> v(TAB,TAB+3);
secPts=secPts->keepSelectedComponents(v);
}
const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.};
double AX1[3]; AX1[2]=0.;
std::vector< MCAuto<DataArrayDouble> > arrs(nbCells*nbg);
- for(int j=0;j<nbCells;j++)
+ for(mcIdType j=0;j<nbCells;j++)
{
constexpr int DIM=3;
MCAuto<DataArrayDouble> p(secPts->deepCopy());
MCAuto<DataArrayDouble> p3(p->deepCopy());
DataArrayDouble::Rotate3DAlg(CENTER,dir->getArray()->begin()+j*3,zeAngle->getIJ(j,l),nbSecPts,p3->begin(),p3->getPointer());
MCAuto<DataArrayDouble> p2(p3->deepCopy());
- for(int k=0;k<nbCompo;k++)
+ for(std::size_t k=0;k<nbCompo;k++)
p2->applyLin(1.,ptsForLoc->getIJ(j*nbg+l,k),k);
arrs[j*nbg+l]=p2;
}
if(um->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception(MSG1);
gt=um->getTypeOfCell(0);
- std::vector<int> v;
+ std::vector<mcIdType> v;
um->getNodeIdsOfCell(0,v);
std::size_t sz2(v.size());
for(std::size_t j=0;j<sz2;j++)
- if(v[j]!=j)
+ if(v[j]!=ToIdType(j))
throw INTERP_KERNEL::Exception(MSG1);
}
const std::vector< MCAuto<MEDFileEltStruct4Mesh> >& strs(mesh->getAccessOfUndergroundEltStrs());
if(!ms)
return false;
std::vector< MEDFileMesh * > meshesImpacted;
- std::vector< DataArrayInt * > renumParamsOfMeshImpacted;//same size as meshesImpacted
- std::vector< std::vector<int> > oldCodeOfMeshImpacted,newCodeOfMeshImpacted;//same size as meshesImpacted
- std::vector<MCAuto<DataArrayInt> > memSaverIfThrow;//same size as meshesImpacted
+ std::vector< DataArrayIdType * > renumParamsOfMeshImpacted;//same size as meshesImpacted
+ std::vector< std::vector<mcIdType> > oldCodeOfMeshImpacted,newCodeOfMeshImpacted;//same size as meshesImpacted
+ std::vector<MCAuto<DataArrayIdType> > memSaverIfThrow;//same size as meshesImpacted
for(int i=0;i<ms->getNumberOfMeshes();i++)
{
MEDFileMesh *m=ms->getMeshAtPos(i);
if(m)
{
- std::vector<int> oldCode,newCode;
- DataArrayInt *o2nRenumCell=0;
+ std::vector<mcIdType> oldCode,newCode;
+ DataArrayIdType *o2nRenumCell=0;
bool modif=m->unPolyze(oldCode,newCode,o2nRenumCell);
if(!modif)
continue;
std::size_t sz(mfds.size()),i(0);
MCAuto<MEDFileData> ret(MEDFileData::New());
std::vector<const MEDFileUMesh *> ms(sz);
- std::vector< std::vector< std::pair<int,int> > > dts(sz);
+ std::vector< std::vector< std::pair<int,mcIdType> > > dts(sz);
for(std::vector<const MEDFileData *>::const_iterator it=mfds.begin();it!=mfds.end();it++,i++)
{
const MEDFileData *elt(*it);
#include "MEDFileEquivalence.hxx"
#include "MEDFileSafeCaller.txx"
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDLoaderBase.hxx"
#include "MEDFileMesh.hxx"
#include "InterpKernelAutoPtr.hxx"
MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceSize,(fid,meshName.c_str(),_name.c_str(),dt,it,MED_NODE,MED_NONE,&ncor));
if(ncor>0)
{
- MCAuto<DataArrayInt> da(DataArrayInt::New());
+ MCAuto<DataArrayMedInt> da(DataArrayMedInt::New());
da->alloc(ncor*2);
MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceRd,(fid,meshName.c_str(),_name.c_str(),dt,it,MED_NODE,MED_NONE,da->getPointer()));
da->applyLin(1,-1);
da->rearrange(2);
- MCAuto<MEDFileEquivalenceNode> node(new MEDFileEquivalenceNode(this,da));
+ MCAuto<MEDFileEquivalenceNode> node(new MEDFileEquivalenceNode(this,FromMedIntArray<int>(da)));
_node=node;
}
_cell=MEDFileEquivalenceCell::Load(fid,this);
int MEDFileEquivalences::size() const
{
- return _equ.size();
+ return (int)_equ.size();
}
std::vector<std::string> MEDFileEquivalences::getEquivalenceNames() const
int MEDFileEquivalences::PresenceOfEquivalences(med_idt fid, const std::string& meshName)
{
med_int nequ(MEDnEquivalence(fid,meshName.c_str()));
- return nequ;
+ return FromMedInt<int>(nequ);
}
MEDFileEquivalences *MEDFileEquivalences::Load(med_idt fid, int nbOfEq, MEDFileMesh *owner)
{
INTERP_KERNEL::AutoPtr<char> equ(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> desc(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
- int nstep,nocstpncor;
+ med_int nstep,nocstpncor;
MEDFILESAFECALLERRD0(MEDequivalenceInfo,(fid,meshName.c_str(),i+1,equ,desc,&nstep,&nocstpncor));
std::string eqName(MEDLoaderBase::buildStringFromFortran(equ,MED_NAME_SIZE)),eqDescName(MEDLoaderBase::buildStringFromFortran(desc,MED_COMMENT_SIZE));
MCAuto<MEDFileEquivalencePair> eqv(MEDFileEquivalencePair::Load(ret,fid,eqName,eqDescName));
INTERP_KERNEL::AutoPtr<char> name(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
MEDLoaderBase::safeStrCpy(meshName.c_str(),MED_NAME_SIZE,meshName2,getFather()->getMesh()->getTooLongStrPolicy());
MEDLoaderBase::safeStrCpy(equName.c_str(),MED_NAME_SIZE,name,getFather()->getMesh()->getTooLongStrPolicy());
- MCAuto<DataArrayInt> da2(da->deepCopy()); da2->rearrange(1); da2->applyLin(1,1); da2->rearrange(2);
- MEDFILESAFECALLERWR0(MEDequivalenceCorrespondenceWr,(fid,meshName2,name,dt,it,medtype,medgt,da2->getNumberOfTuples(),da2->begin()));
+ MCAuto<DataArrayMedInt> da2(DataArrayMedInt::Copy(da)); da2->rearrange(1); da2->applyLin(1,1); da2->rearrange(2);
+ MEDFILESAFECALLERWR0(MEDequivalenceCorrespondenceWr,(fid,meshName2,name,dt,it,medtype,medgt,ToMedInt(da2->getNumberOfTuples()),da2->begin()));
}
std::size_t MEDFileEquivalenceCellType::getHeapMemorySizeWithoutChildren() const
return ;
MEDFileEquivalences::CheckDataArray(da);
MEDFileMesh *mm(getMesh());
- int totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax));
+ mcIdType totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax));
//
MCAuto<DataArrayInt> tmp(da->deepCopy()); tmp->rearrange(1);
int maxv,minv;
//
std::vector<INTERP_KERNEL::NormalizedCellType> gts(mm->getGeoTypesAtLevel(meshDimRelToMax));
int startId(0),endId;
- std::vector<int> compS(1,0);
+ std::vector<std::size_t> compS(1,0);
for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it=gts.begin();it!=gts.end();it++)
{
- endId=startId+mm->getNumberOfCellsWithType(*it);
+ endId=startId+(int)mm->getNumberOfCellsWithType(*it);
MCAuto<DataArrayInt> da0(da->keepSelectedComponents(compS));
- MCAuto<DataArrayInt> ids(da0->findIdsInRange(startId,endId));
+ MCAuto<DataArrayIdType> ids(da0->findIdsInRange(startId,endId));
MCAuto<DataArrayInt> da1(da->selectByTupleIdSafe(ids->begin(),ids->end()));
da1->applyLin(1,-startId);
setArrayForType(*it,da1);
MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceSize,(fid,meshName.c_str(),name.c_str(),dt,it,MED_CELL,typmai[i],&ncor));
if(ncor>0)
{
- MCAuto<DataArrayInt> da(DataArrayInt::New());
+ MCAuto<DataArrayMedInt> da(DataArrayMedInt::New());
da->alloc(ncor*2);
MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceRd,(fid,meshName.c_str(),name.c_str(),dt,it,MED_CELL,typmai[i],da->getPointer()));
da->applyLin(1,-1);
da->rearrange(2);
- MCAuto<MEDFileEquivalenceCellType> ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],da));
+ MCAuto<MEDFileEquivalenceCellType> ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],FromMedIntArray<int>(da)));
_types.push_back(ct);
}
}
int MEDFileFields::getNumberOfFields() const
{
- return _fields.size();
+ return (int)_fields.size();
}
std::vector<std::string> MEDFileFields::getFieldsNames() const
MEDFileFields::MEDFileFields(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
try:MEDFileFieldGlobsReal(fid)
{
- int nbFields(MEDnField(fid));
+ med_int nbFields(MEDnField(fid));
_fields.resize(nbFields);
med_field_type typcha;
for(int i=0;i<nbFields;i++)
void MEDFileFields::destroyFieldsAtPos2(int bg, int end, int step)
{
static const char msg[]="MEDFileFields::destroyFieldsAtPos2";
- int nbOfEntriesToKill(DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg));
+ mcIdType nbOfEntriesToKill(DataArrayIdType::GetNumberOfItemGivenBESRelative(bg,end,step,msg));
std::vector<bool> b(_fields.size(),true);
int k=bg;
for(int i=0;i<nbOfEntriesToKill;i++,k+=step)
* \return If true a renumbering has been performed. The structure in \a this has been modified. If false, nothing has been done: it is typically the case if \a meshName is not referred by any
* field in \a this.
*/
-bool MEDFileFields::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N)
+bool MEDFileFields::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N)
{
bool ret(false);
for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
*
* \return A new object that the caller is responsible to deallocate.
*/
-MEDFileFields *MEDFileFields::extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+MEDFileFields *MEDFileFields::extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const
{
if(!mm)
throw INTERP_KERNEL::Exception("MEDFileFields::extractPart : input mesh is NULL !");
{
public:
PFLData():_add_pts_in_pfl(0) { }
- PFLData(const MCAuto<DataArrayInt>& mat, const MCAuto<DataArrayInt>& pfl, int nbOfNewPts):_matrix(mat),_pfl(pfl),_add_pts_in_pfl(nbOfNewPts) { }
+ PFLData(const MCAuto<DataArrayIdType>& mat, const MCAuto<DataArrayIdType>& pfl, mcIdType nbOfNewPts):_matrix(mat),_pfl(pfl),_add_pts_in_pfl(nbOfNewPts) { }
std::string getPflName() const { if(_pfl.isNull()) { return std::string(); } else { return _pfl->getName(); } }
- int getNbOfAddPtsInPfl() const { return _add_pts_in_pfl; }
- MCAuto<DataArrayInt> getProfile() const { return _pfl; }
- MCAuto<DataArrayInt> getMatrix() const { return _matrix; }
+ mcIdType getNbOfAddPtsInPfl() const { return _add_pts_in_pfl; }
+ MCAuto<DataArrayIdType> getProfile() const { return _pfl; }
+ MCAuto<DataArrayIdType> getMatrix() const { return _matrix; }
private:
- MCAuto<DataArrayInt> _matrix;
- MCAuto<DataArrayInt> _pfl;
- int _add_pts_in_pfl;
+ MCAuto<DataArrayIdType> _matrix;
+ MCAuto<DataArrayIdType> _pfl;
+ mcIdType _add_pts_in_pfl;
};
class MEDFileFieldLin2QuadVisitor : public MEDFileFieldVisitor
//
void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd);
private:
- void updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, int deltaNbNodes);
+ void updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, mcIdType deltaNbNodes);
private:
const MEDFileUMesh *_lin;
const MEDFileUMesh *_quad;
updateData(pmtdToModify,(*itCache).second.getNbOfAddPtsInPfl());
return ;
}
- MCAuto<DataArrayInt> pfl;
+ MCAuto<DataArrayIdType> pfl;
if(pflName.empty())
- pfl=DataArrayInt::Range(0,pmptpd->getNumberOfVals(),1);
+ pfl=DataArrayIdType::Range(0,pmptpd->getNumberOfVals(),1);
else
pfl=_lin_globs->getProfile(pflName)->deepCopy();
//
MCAuto<MEDCouplingUMesh> mesh3D(_lin->getMeshAtLevel(0)),mesh3DQuadratic(_quad->getMeshAtLevel(0));
- MCAuto<DataArrayInt> cellIds(mesh3D->getCellIdsLyingOnNodes(pfl->begin(),pfl->end(),true));
+ MCAuto<DataArrayIdType> cellIds(mesh3D->getCellIdsLyingOnNodes(pfl->begin(),pfl->end(),true));
MCAuto<MEDCouplingUMesh> mesh3DQuadraticRestricted(mesh3DQuadratic->buildPartOfMySelf(cellIds->begin(),cellIds->end(),true));
- MCAuto<DataArrayInt> mesh3DQuadraticRestrictedNodeIds(mesh3DQuadraticRestricted->computeFetchedNodeIds());
+ MCAuto<DataArrayIdType> mesh3DQuadraticRestrictedNodeIds(mesh3DQuadraticRestricted->computeFetchedNodeIds());
mesh3DQuadraticRestrictedNodeIds->checkMonotonic(true);
- MCAuto<DataArrayInt> newPtsIds(mesh3DQuadraticRestrictedNodeIds->buildSubstraction(pfl));
+ MCAuto<DataArrayIdType> newPtsIds(mesh3DQuadraticRestrictedNodeIds->buildSubstraction(pfl));
MCAuto<MEDCoupling1SGTUMesh> allSeg3;
{
- MCAuto<DataArrayInt> a,b,c,d;
+ MCAuto<DataArrayIdType> a,b,c,d;
MCAuto<MEDCouplingUMesh> seg3Tmp(mesh3DQuadraticRestricted->explodeIntoEdges(a,b,c,d));
allSeg3=MEDCoupling1SGTUMesh::New(seg3Tmp);
}
if(allSeg3->getCellModelEnum()!=INTERP_KERNEL::NORM_SEG3)
throw INTERP_KERNEL::Exception("MEDFileFieldLin2QuadVisitor::newPerMeshPerTypePerDisc : invalid situation where SEG3 expected !");
- MCAuto<DataArrayInt> midPts,cellSeg3Ids,matrix;
+ MCAuto<DataArrayIdType> midPts,cellSeg3Ids,matrix;
{
- DataArrayInt *nodeConn(allSeg3->getNodalConnectivity());
+ DataArrayIdType *nodeConn(allSeg3->getNodalConnectivity());
nodeConn->rearrange(3);
{
- std::vector<int> v(1,2);
+ std::vector<std::size_t> v(1,2);
midPts=nodeConn->keepSelectedComponents(v);
}
- cellSeg3Ids=DataArrayInt::FindPermutationFromFirstToSecond(midPts,newPtsIds);
+ cellSeg3Ids=DataArrayIdType::FindPermutationFromFirstToSecond(midPts,newPtsIds);
{
- std::vector<int> v(2); v[0]=0; v[1]=1;
- MCAuto<DataArrayInt> tmp(nodeConn->keepSelectedComponents(v));
+ std::vector<std::size_t> v(2); v[0]=0; v[1]=1;
+ MCAuto<DataArrayIdType> tmp(nodeConn->keepSelectedComponents(v));
matrix=tmp->selectByTupleId(cellSeg3Ids->begin(),cellSeg3Ids->end());
}
nodeConn->rearrange(1);
}
- MCAuto<DataArrayInt> pflq;
+ MCAuto<DataArrayIdType> pflq;
if(!pflName.empty())
{
- std::vector<const DataArrayInt *> vs(2);
+ std::vector<const DataArrayIdType *> vs(2);
vs[0]=pfl; vs[1]=newPtsIds;
- pflq=DataArrayInt::Aggregate(vs);
+ pflq=DataArrayIdType::Aggregate(vs);
pflq->setName(pflName);
}
PFLData pdata(matrix,pflq,newPtsIds->getNumberOfTuples());
updateData(pmtdToModify,pdata.getNbOfAddPtsInPfl());
}
-void MEDFileFieldLin2QuadVisitor::updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, int deltaNbNodes)
+void MEDFileFieldLin2QuadVisitor::updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, mcIdType deltaNbNodes)
{
pmtd->incrementNbOfVals(deltaNbNodes);
}
return ;
if(_1ts_update_requested)
{
- MCAuto<DataArrayInt> matrix,oldPfl;
+ MCAuto<DataArrayIdType> matrix,oldPfl;
for(std::vector<std::string>::const_iterator it=_pfls_to_be_updated.begin();it!=_pfls_to_be_updated.end();it++)
{
std::map< std::string, PFLData >::const_iterator it2(_cache.find(*it));
DataArrayDouble *arr(_cur_f1ts->getUndergroundDataArray());
MCAuto<DataArrayDouble> res;
{
- std::vector<int> v(1,0),v2(1,1);
- MCAuto<DataArrayInt> pts0(matrix->keepSelectedComponents(v));
- MCAuto<DataArrayInt> pts1(matrix->keepSelectedComponents(v2));
+ std::vector<std::size_t> v(1,0),v2(1,1);
+ MCAuto<DataArrayIdType> pts0(matrix->keepSelectedComponents(v));
+ MCAuto<DataArrayIdType> pts1(matrix->keepSelectedComponents(v2));
if(oldPfl.isNotNull())
{
pts0=oldPfl->findIdForEach(pts0->begin(),pts0->end());
{
std::string tmp(fieldName);
std::vector<std::string> poss;
- for(std::size_t i=0;i<_fields.size();i++)
+ for(unsigned int i=0;i<_fields.size();i++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *f(_fields[i]);
if(f)
MEDLOADER_EXPORT void destroyFieldsAtPos(const int *startIds, const int *endIds);
MEDLOADER_EXPORT void destroyFieldsAtPos2(int bg, int end, int step);
MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
- MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N);
+ MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N);
MEDLOADER_EXPORT void accept(MEDFileFieldVisitor& visitor) const;
MEDLOADER_EXPORT MCAuto<MEDFileFields> linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const;
public:
- MEDLOADER_EXPORT MEDFileFields *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
+ MEDLOADER_EXPORT MEDFileFields *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const;
public:
MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const;
* \sa getUndergroundDataArrayTemplate()
*/
template<class T>
- typename Traits<T>::ArrayType *MEDFileField1TSTemplateWithoutSDA<T>::getUndergroundDataArrayTemplateExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+ typename Traits<T>::ArrayType *MEDFileField1TSTemplateWithoutSDA<T>::getUndergroundDataArrayTemplateExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
if(this->_field_per_mesh.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !");
}
template<class T>
- void MEDFileField1TSTemplateWithoutSDA<T>::aggregate(const std::vector<typename MLFieldTraits<T>::F1TSWSDAType const *>& f1tss, const std::vector< std::vector< std::pair<int,int> > >& dts)
+ void MEDFileField1TSTemplateWithoutSDA<T>::aggregate(const std::vector<typename MLFieldTraits<T>::F1TSWSDAType const *>& f1tss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
{
if(f1tss.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSTemplateWithoutSDA::aggregate : empty vector !");
setName(refPt->getName());
const DataArray *arr(refPt->getUndergroundDataArray());
- int nbCompo(arr->getNumberOfComponents());
+ std::size_t nbCompo(arr->getNumberOfComponents());
for(typename std::vector<typename MLFieldTraits<T>::F1TSWSDAType const *>::const_iterator it=f1tss.begin();it!=f1tss.end();it++)
{
const typename Traits<T>::ArrayType *myArr((*it)->getUndergroundDataArrayTemplate());
if(myArr->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDFileField1TSTemplateWithoutSDA::aggregate : arrays must have same number of components !");
}
- std::vector<std::pair< int, std::pair<int,int> > > extractInfo;
- int start(0);
+ std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > > extractInfo;
+ mcIdType start(0);
MCAuto<MEDFileFieldPerMesh> fpm(MEDFileFieldPerMesh::Aggregate(start,pms,dts,this,extractInfo));
_field_per_mesh.push_back(fpm);
int iteration,order;
_arr=Traits<T>::ArrayType::New();
_arr->alloc(start,nbCompo); _arr->copyStringInfoFrom(*arr);
start=0;
- for(std::vector<std::pair< int, std::pair<int,int> > >::const_iterator it=extractInfo.begin();it!=extractInfo.end();it++)
+ for(std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >::const_iterator it=extractInfo.begin();it!=extractInfo.end();it++)
{
const DataArray *zeArr(das[(*it).first]);
_arr->setContigPartOfSelectedValuesSlice(start,zeArr,(*it).second.first,(*it).second.second,1);
* \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
*/
template<class T>
- typename Traits<T>::ArrayType *MEDFileTemplateField1TS<T>::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const
+ typename Traits<T>::ArrayType *MEDFileTemplateField1TS<T>::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const
{
MCAuto<DataArray> arr(contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull()));
return ReturnSafelyTypedDataArray(arr);
}
template<class T>
- typename Traits<T>::ArrayType *MEDFileTemplateField1TS<T>::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+ typename Traits<T>::ArrayType *MEDFileTemplateField1TS<T>::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
return contentNotNull()->getUndergroundDataArrayTemplateExt(entries);
}
* \sa setFieldNoProfileSBT, setFieldProfileFlatly
*/
template<class T>
- void MEDFileTemplateField1TS<T>::setFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+ void MEDFileTemplateField1TS<T>::setFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile)
{
setFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,true);
}
* \sa setFieldProfile
*/
template<class T>
- void MEDFileTemplateField1TS<T>::setFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+ void MEDFileTemplateField1TS<T>::setFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile)
{
setFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,false);
}
template<class T>
- void MEDFileTemplateField1TS<T>::setFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller)
+ void MEDFileTemplateField1TS<T>::setFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller)
{
setFileName("");
MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::NewWithoutCheck(*field));
* \sa MEDFileUMesh::deduceNodeSubPartFromCellSubPart , MEDFileUMesh::extractPart
*/
template<class T>
- typename MLFieldTraits<T>::F1TSType *MEDFileTemplateField1TS<T>::extractPartImpl(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+ typename MLFieldTraits<T>::F1TSType *MEDFileTemplateField1TS<T>::extractPartImpl(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const
{
if(!mm)
throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : input mesh is NULL !");
getNonEmptyLevels(mm->getName(),levs);
for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
{
- std::map<int, MCAuto<DataArrayInt> >::const_iterator it2(extractDef.find(*lev));
+ std::map<int, MCAuto<DataArrayIdType> >::const_iterator it2(extractDef.find(*lev));
if(it2!=extractDef.end())
{
- MCAuto<DataArrayInt> t((*it2).second);
+ MCAuto<DataArrayIdType> t((*it2).second);
if(t.isNull())
throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a value with null pointer 1 !");
MCAuto<typename Traits<T>::FieldType> f(getFieldOnMeshAtLevel(ON_CELLS,(*lev),mm));
}
else
{
- std::map<int, MCAuto<DataArrayInt> >::const_iterator it2(extractDef.find(1));
+ std::map<int, MCAuto<DataArrayIdType> >::const_iterator it2(extractDef.find(1));
if(it2==extractDef.end())
throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a NODE field and no extract array available for NODE !");
- MCAuto<DataArrayInt> t((*it2).second);
+ MCAuto<DataArrayIdType> t((*it2).second);
if(t.isNull())
throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a value with null pointer 1 !");
MCAuto<typename Traits<T>::FieldType> f(getFieldOnMeshAtLevel(ON_NODES,0,mm));
* \return A new object that the caller is responsible to deallocate.
*/
template<class T>
- typename MLFieldTraits<T>::FMTSType *MEDFileTemplateFieldMultiTS<T>::extractPartImpl(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+ typename MLFieldTraits<T>::FMTSType *MEDFileTemplateFieldMultiTS<T>::extractPartImpl(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const
{
if(!mm)
throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::extractPart : mesh is null !");
* \param [in] order - the iteration order number of required time step.
* \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
* \param [in] mesh - the supporting mesh.
- * \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the
+ * \param [out] pfl - a new instance of DataArrayIdType holding ids of mesh entities the
* field of interest lies on. If the field lies on all entities of the given
* dimension, all ids in \a pfl are zero. The caller is to delete this array
* using decrRef() as it is no more needed.
* \throw If no field values of the required parameters are available.
*/
template<class T>
- typename Traits<T>::ArrayType *MEDFileTemplateFieldMultiTS<T>::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const
+ typename Traits<T>::ArrayType *MEDFileTemplateFieldMultiTS<T>::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const
{
const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
const typename MLFieldTraits<T>::F1TSWSDAType *myF1TSC(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(&myF1TS));
* \sa setFieldNoProfileSBT, appendFieldProfileFlatly
*/
template<class T>
- void MEDFileTemplateFieldMultiTS<T>::appendFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+ void MEDFileTemplateFieldMultiTS<T>::appendFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile)
{
appendFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,true);
}
* same as appendFieldProfile except that here profile is created unconditionaly
*/
template<class T>
- void MEDFileTemplateFieldMultiTS<T>::appendFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+ void MEDFileTemplateFieldMultiTS<T>::appendFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile)
{
appendFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,false);
}
template<class T>
- void MEDFileTemplateFieldMultiTS<T>::appendFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller)
+ void MEDFileTemplateFieldMultiTS<T>::appendFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller)
{
const typename Traits<T>::ArrayType *arr(NULL);
if(field)
}
template<class T>
- typename Traits<T>::ArrayType *MEDFileTemplateFieldMultiTS<T>::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+ typename Traits<T>::ArrayType *MEDFileTemplateFieldMultiTS<T>::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
DataArray *ret(contentNotNull()->getUndergroundDataArrayExt(iteration,order,entries));
if(!ret)
const DataArray *arr(getUndergroundDataArray());
if(!arr)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::splitComponents : no array defined !");
- int nbOfCompo=arr->getNumberOfComponents();
+ std::size_t nbOfCompo=arr->getNumberOfComponents();
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret(nbOfCompo);
- for(int i=0;i<nbOfCompo;i++)
+ for(std::size_t i=0;i<nbOfCompo;i++)
{
ret[i]=deepCopy();
- std::vector<int> v(1,i);
+ std::vector<std::size_t> v(1,i);
MCAuto<DataArray> arr2=arr->keepSelectedComponents(v);
ret[i]->setArray(arr2);
}
* Length of this and of nested sequences is the same as that of \a typesF.
* \throw If no field is lying on \a mname.
*/
-std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector< std::vector< std::pair<mcIdType,mcIdType> > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
{
if(_field_per_mesh.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !");
(*it)->convertMedBallIntoClassic();
}
-void MEDFileAnyTypeField1TSWithoutSDA::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl)
+void MEDFileAnyTypeField1TSWithoutSDA::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl)
{
if(!pfl)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : null pfl !");
MEDFileFieldPerMeshPerTypePerDisc *disc(fpm->getLeafGivenTypeAndLocId(ct,0));
if(disc->getType()!=tof)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : error !");
- int s(disc->getStart()),e(disc->getEnd()),nt(pfl->getNumberOfTuples());
+ mcIdType s(disc->getStart()),e(disc->getEnd()),nt(pfl->getNumberOfTuples());
DataArray *arr(getUndergroundDataArray());
- int nt2(arr->getNumberOfTuples()),delta((e-s)-nt);
+ mcIdType nt2(arr->getNumberOfTuples()),delta((e-s)-nt);
if(delta<0)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : internal error !");
MCAuto<DataArray> arr0(arr->selectByTupleIdSafeSlice(0,s,1)),arr1(arr->selectByTupleIdSafeSlice(s,e,1)),arr2(arr->selectByTupleIdSafeSlice(e,nt2,1));
if((*it)->getMeshName()==tmp)
return i;
}
- int sz=_field_per_mesh.size();
+ std::size_t sz=_field_per_mesh.size();
_field_per_mesh.resize(sz+1);
_field_per_mesh[sz]=MEDFileFieldPerMesh::New(this,mesh);
- return sz;
+ return (int)sz;
}
-bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
+bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N,
MEDFileFieldGlobsReal& glob)
{
bool ret=false;
std::vector<INTERP_KERNEL::NormalizedCellType> types;
std::vector< std::vector<TypeOfField> > typesF;
std::vector< std::vector<std::string> > pfls,locs;
- std::vector< std::vector<std::pair<int,int> > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs));
+ std::vector< std::vector<std::pair<mcIdType,mcIdType> > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs));
std::set<TypeOfField> allEnt;
for(std::vector< std::vector<TypeOfField> >::const_iterator it1=typesF.begin();it1!=typesF.end();it1++)
for(std::vector<TypeOfField>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
std::set<TypeOfField>::const_iterator it3(allEnt.begin());
for(std::size_t i=0;i<allEnt.size();i++,it3++)
{
- std::vector< std::pair<int,int> > its;
+ std::vector< std::pair<mcIdType,mcIdType> > its;
ret[i]=shallowCpy();
- int newLgth(ret[i]->keepOnlySpatialDiscretization(*it3,its));
+ mcIdType newLgth(ret[i]->keepOnlySpatialDiscretization(*it3,its));
ret[i]->updateData(newLgth,its);
}
return ret;
std::vector<INTERP_KERNEL::NormalizedCellType> types;
std::vector< std::vector<TypeOfField> > typesF;
std::vector< std::vector<std::string> > pfls,locs;
- std::vector< std::vector<std::pair<int,int> > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs));
+ std::vector< std::vector<std::pair<mcIdType,mcIdType> > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs));
std::set<TypeOfField> allEnt;
std::size_t nbOfMDPGT(0),ii(0);
for(std::vector< std::vector<TypeOfField> >::const_iterator it1=typesF.begin();it1!=typesF.end();it1++,ii++)
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret(nbOfMDPGT);
for(std::size_t i=0;i<nbOfMDPGT;i++)
{
- std::vector< std::pair<int,int> > its;
+ std::vector< std::pair<mcIdType,mcIdType> > its;
ret[i]=shallowCpy();
- int newLgth(ret[i]->keepOnlyGaussDiscretization(i,its));
+ mcIdType newLgth(ret[i]->keepOnlyGaussDiscretization(i,its));
ret[i]->updateData(newLgth,its);
}
return ret;
}
-int MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair<int,int> >& its)
+mcIdType MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
- int globalCounter(0);
+ mcIdType globalCounter(0);
for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
(*it)->keepOnlySpatialDiscretization(tof,globalCounter,its);
return globalCounter;
}
-int MEDFileAnyTypeField1TSWithoutSDA::keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair<int,int> >& its)
+mcIdType MEDFileAnyTypeField1TSWithoutSDA::keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
- int globalCounter(0);
+ mcIdType globalCounter(0);
for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
(*it)->keepOnlyGaussDiscretization(idOfDisc,globalCounter,its);
return globalCounter;
}
-void MEDFileAnyTypeField1TSWithoutSDA::updateData(int newLgth, const std::vector< std::pair<int,int> >& oldStartStops)
+void MEDFileAnyTypeField1TSWithoutSDA::updateData(mcIdType newLgth, const std::vector< std::pair<mcIdType,mcIdType> >& oldStartStops)
{
if(_nb_of_tuples_to_be_allocated>=0)
{
newArr->alloc(newLgth,getNumberOfComponents());
if(oldArr)
newArr->copyStringInfoFrom(*oldArr);
- int pos=0;
- for(std::vector< std::pair<int,int> >::const_iterator it=oldStartStops.begin();it!=oldStartStops.end();it++)
+ mcIdType pos=0;
+ for(std::vector< std::pair<mcIdType,mcIdType> >::const_iterator it=oldStartStops.begin();it!=oldStartStops.end();it++)
{
if((*it).second<(*it).first)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::updateData : the range in the leaves was invalid !");
mm=ms->getMeshWithName(getMeshName());
}
//
- _field_per_mesh[0]=MEDFileFieldPerMesh::NewOnRead(fid,this,0,meshnumdt,meshnumit,nasc,mm,entities);
+ _field_per_mesh[0]=MEDFileFieldPerMesh::NewOnRead(fid,this,0,FromMedInt<int>(meshnumdt),FromMedInt<int>(meshnumit),nasc,mm,entities);
_nb_of_tuples_to_be_allocated=0;
_field_per_mesh[0]->loadOnlyStructureOfDataRecursively(fid,_nb_of_tuples_to_be_allocated,nasc);
}
const MEDCouplingMesh *mesh(field->getMesh());
//
TypeOfField type(field->getTypeOfField());
- std::vector<DataArrayInt *> dummy;
+ std::vector<DataArrayIdType *> dummy;
if(mesh)
setMeshName(mesh->getName());
- int start(copyTinyInfoFrom(th,field,arr));
+ mcIdType start(copyTinyInfoFrom(th,field,arr));
int pos(addNewEntryIfNecessary(mesh));
if(type!=ON_NODES)
{
- std::vector<int> code=MEDFileField1TSWithoutSDA::CheckSBTMesh(mesh);
+ std::vector<mcIdType> code=MEDFileField1TSWithoutSDA::CheckSBTMesh(mesh);
_field_per_mesh[pos]->assignFieldNoProfileNoRenum(start,code,field,arr,glob,nasc);
}
else
* \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
* \sa setFieldNoProfileSBT()
*/
-void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller)
+void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller)
{
if(!field)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input field is null !");
if(!arrOfVals || !arrOfVals->isAllocated())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input array is null or not allocated !");
TypeOfField type=field->getTypeOfField();
- std::vector<DataArrayInt *> idsInPflPerType;
- std::vector<DataArrayInt *> idsPerType;
- std::vector<int> code,code2;
+ std::vector<DataArrayIdType *> idsInPflPerType;
+ std::vector<DataArrayIdType *> idsPerType;
+ std::vector<mcIdType> code,code2;
MCAuto<MEDCouplingMesh> m(mesh->getMeshAtLevel(meshDimRelToMax));
if(type!=ON_NODES)
{
m->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
- std::vector< MCAuto<DataArrayInt> > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin());
- std::vector< MCAuto<DataArrayInt> > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin());
- std::vector<const DataArrayInt *> idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin());
+ std::vector< MCAuto<DataArrayIdType> > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin());
+ std::vector< MCAuto<DataArrayIdType> > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin());
+ std::vector<const DataArrayIdType *> idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin());
// start of check
MCAuto<MEDCouplingFieldTemplate> field2=field->clone(false);
- int nbOfTuplesExp=field2->getNumberOfTuplesExpectedRegardingCode(code,idsPerType3);
+ mcIdType nbOfTuplesExp=field2->getNumberOfTuplesExpectedRegardingCode(code,idsPerType3);
if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples())
{
std::ostringstream oss; oss << "MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : The array is expected to have " << nbOfTuplesExp << " tuples ! It has " << arrOfVals->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
// end of check
- int start(copyTinyInfoFrom(th,field,arrOfVals));
+ mcIdType start(copyTinyInfoFrom(th,field,arrOfVals));
code2=m->getDistributionOfTypes();
//
- int pos=addNewEntryIfNecessary(m);
+ mcIdType pos=addNewEntryIfNecessary(m);
_field_per_mesh[pos]->assignFieldProfile(start,profile,code,code2,idsInPflPerType,idsPerType,field,arrOfVals,m,glob,nasc);
}
else
{
if(!profile || !profile->isAllocated() || profile->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input profile is null, not allocated or with number of components != 1 !");
- std::vector<int> v(3); v[0]=-1; v[1]=profile->getNumberOfTuples(); v[2]=0;
- std::vector<const DataArrayInt *> idsPerType3(1); idsPerType3[0]=profile;
- int nbOfTuplesExp=field->getNumberOfTuplesExpectedRegardingCode(v,idsPerType3);
+ std::vector<mcIdType> v(3); v[0]=-1; v[1]=profile->getNumberOfTuples(); v[2]=0;
+ std::vector<const DataArrayIdType *> idsPerType3(1); idsPerType3[0]=profile;
+ mcIdType nbOfTuplesExp=field->getNumberOfTuplesExpectedRegardingCode(v,idsPerType3);
if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples())
{
std::ostringstream oss; oss << "MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : For node field, the array is expected to have " << nbOfTuplesExp << " tuples ! It has " << arrOfVals->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int start(copyTinyInfoFrom(th,field,arrOfVals));
- int pos(addNewEntryIfNecessary(m));
+ mcIdType start(copyTinyInfoFrom(th,field,arrOfVals));
+ mcIdType pos(addNewEntryIfNecessary(m));
_field_per_mesh[pos]->assignNodeFieldProfile(start,profile,field,arrOfVals,glob,nasc);
}
}
/*!
* \param [in] newNbOfTuples - The new nb of tuples to be allocated.
*/
-void MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile(int newNbOfTuples)
+void MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile(mcIdType newNbOfTuples)
{
if(_nb_of_tuples_to_be_allocated>=0)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile : the object is expected to be appended to a data coming from a file but not loaded ! Load before appending data !");
* \throw If \a this->_arr is already allocated but has different number of components
* than \a field.
*/
-int MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr)
+mcIdType MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr)
{
if(!field)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom : input field is NULL !");
}
else
{
- int oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples();
- int newNbOfTuples=oldNbOfTuples+arr->getNumberOfTuples();
+ mcIdType oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples();
+ mcIdType newNbOfTuples=oldNbOfTuples+arr->getNumberOfTuples();
getOrCreateAndGetArray()->reAlloc(newNbOfTuples);
_nb_of_tuples_to_be_allocated=-3;
return oldNbOfTuples;
* Returns number of components in \a this field
* \return int - the number of components.
*/
-int MEDFileAnyTypeField1TSWithoutSDA::getNumberOfComponents() const
+std::size_t MEDFileAnyTypeField1TSWithoutSDA::getNumberOfComponents() const
{
return getOrCreateAndGetArray()->getNumberOfComponents();
}
MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
MCAuto<MEDCouplingMesh> m(mesh->getMeshAtLevel(meshDimRelToMax,false));
- const DataArrayInt *d(mesh->getNumberFieldAtLevel(meshDimRelToMax)),*e(mesh->getNumberFieldAtLevel(1));
+ const DataArrayIdType *d(mesh->getNumberFieldAtLevel(meshDimRelToMax)),*e(mesh->getNumberFieldAtLevel(1));
if(meshDimRelToMax==1)
(static_cast<MEDCouplingUMesh *>((MEDCouplingMesh *)m))->setMeshDimension(0);
return MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(type,renumPol,glob,m,d,e,arrOut,nasc);
* \throw If no field of \a this is lying on \a mesh.
* \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
*/
-MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayIdType *cellRenum, const DataArrayIdType *nodeRenum, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
static const char msg1[]="MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : request for a renumbered field following mesh numbering whereas it is a profile field !";
bool isPfl=false;
oss << "\"" << nasc.getName() << "\" not defined on all nodes !";
throw INTERP_KERNEL::Exception(oss.str());
}
- MCAuto<DataArrayInt> nodeRenumSafe=nodeRenum->checkAndPreparePermutation();
+ MCAuto<DataArrayIdType> nodeRenumSafe=nodeRenum->checkAndPreparePermutation();
if(!dynamic_cast<DataArrayDouble *>((DataArray *)arrOut))
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : node renumbering not implemented for not double DataArrays !");
ret->renumberNodes(nodeRenumSafe->getConstPointer());
* \param [in] type - a spatial discretization of the field.
* \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
* \param [in] mesh - the supporting mesh.
- * \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the
+ * \param [out] pfl - a new instance of DataArrayIdType holding ids of mesh entities the
* field of interest lies on. If the field lies on all entities of the given
* dimension, all ids in \a pfl are zero. The caller is to delete this array
* using decrRef() as it is no more needed.
* \throw If no field of \a this is lying on \a mesh.
* \throw If no field values of the given \a type are available.
*/
-DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const
+DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const
{
MCAuto<MEDCouplingMesh> m(mesh->getMeshAtLevel(meshDimRelToMax));
MCAuto<DataArray> ret=_field_per_mesh[0]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc);
* These values are in full-interlace mode.
* \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
*/
-std::vector<int> MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh *mesh)
+std::vector<mcIdType> MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh *mesh)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::CheckSBTMesh : input mesh is NULL !");
std::set<INTERP_KERNEL::NormalizedCellType> geoTypes=mesh->getAllGeoTypes();
- int nbOfTypes=geoTypes.size();
- std::vector<int> code(3*nbOfTypes);
- MCAuto<DataArrayInt> arr1=DataArrayInt::New();
+ std::size_t nbOfTypes=geoTypes.size();
+ std::vector<mcIdType> code(3*nbOfTypes);
+ MCAuto<DataArrayIdType> arr1=DataArrayIdType::New();
arr1->alloc(nbOfTypes,1);
- int *arrPtr=arr1->getPointer();
+ mcIdType *arrPtr=arr1->getPointer();
std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=geoTypes.begin();
- for(int i=0;i<nbOfTypes;i++,it++)
- arrPtr[i]=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,*it));
- MCAuto<DataArrayInt> arr2=arr1->checkAndPreparePermutation();
- const int *arrPtr2=arr2->getConstPointer();
+ for(std::size_t i=0;i<nbOfTypes;i++,it++)
+ arrPtr[i]=ToIdType(std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,*it)));
+ MCAuto<DataArrayIdType> arr2=arr1->checkAndPreparePermutation();
+ const mcIdType *arrPtr2=arr2->getConstPointer();
int i=0;
for(it=geoTypes.begin();it!=geoTypes.end();it++,i++)
{
- int pos=arrPtr2[i];
- int nbCells=mesh->getNumberOfCellsWithType(*it);
- code[3*pos]=(int)(*it);
+ mcIdType pos=arrPtr2[i];
+ mcIdType nbCells=mesh->getNumberOfCellsWithType(*it);
+ code[3*pos]=(mcIdType)(*it);
code[3*pos+1]=nbCells;
code[3*pos+2]=-1;//no profiles
}
- std::vector<const DataArrayInt *> idsPerType;//no profiles
- DataArrayInt *da=mesh->checkTypeConsistencyAndContig(code,idsPerType);
+ std::vector<const DataArrayIdType *> idsPerType;//no profiles
+ DataArrayIdType *da=mesh->checkTypeConsistencyAndContig(code,idsPerType);
if(da)
{
da->decrRef();
if(mname.empty())
if(_field_per_mesh.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !");
- std::vector< std::vector< std::pair<int,int> > > ret0=_field_per_mesh[0]->getFieldSplitedByType(types,typesF,pfls,locs);
- int nbOfRet=ret0.size();
+ std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret0=_field_per_mesh[0]->getFieldSplitedByType(types,typesF,pfls,locs);
+ std::size_t nbOfRet=ret0.size();
std::vector< std::vector<DataArrayDouble *> > ret(nbOfRet);
- for(int i=0;i<nbOfRet;i++)
+ for(std::size_t i=0;i<nbOfRet;i++)
{
- const std::vector< std::pair<int,int> >& p=ret0[i];
- int nbOfRet1=p.size();
+ const std::vector< std::pair<mcIdType,mcIdType> >& p=ret0[i];
+ std::size_t nbOfRet1=p.size();
ret[i].resize(nbOfRet1);
- for(int j=0;j<nbOfRet1;j++)
+ for(std::size_t j=0;j<nbOfRet1;j++)
{
DataArrayDouble *tmp=_arr->selectByTupleIdSafeSlice(p[j].first,p[j].second,1);
ret[i][j]=tmp;
* \throw If no field values are available.
* \sa getUndergroundDataArray()
*/
-DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
return getUndergroundDataArrayTemplateExt(entries);
}
MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order,
const std::vector<std::string>& infos):MEDFileField1TSNDTemplateWithoutSDA<int>(fieldName,meshName,csit,iteration,order,infos)
{
- DataArrayInt *arr(getOrCreateAndGetArrayTemplate());
+ DataArrayInt32 *arr(getOrCreateAndGetArrayTemplate());
arr->setInfoAndChangeNbOfCompo(infos);
}
}
/*!
- * Returns a pointer to the underground DataArrayInt instance and a
+ * Returns a pointer to the underground DataArrayIdType instance and a
* sequence describing parameters of a support of each part of \a this field. The
- * caller should not decrRef() the returned DataArrayInt. This method allows for a
+ * caller should not decrRef() the returned DataArrayIdType. This method allows for a
* direct access to the field values. This method is intended for the field lying on one
* mesh only.
* \param [in,out] entries - the sequence describing parameters of a support of each
* first part describes a type of mesh entity and an id of discretization of a
* current field part. The second part describes a range of values [begin,end)
* within the returned array relating to the current field part.
- * \return DataArrayInt * - the pointer to the field values array.
+ * \return DataArrayIdType * - the pointer to the field values array.
* \throw If the number of underlying meshes is not equal to 1.
* \throw If no field values are available.
* \sa getUndergroundDataArray()
*/
-DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
return getUndergroundDataArrayIntExt(entries);
}
/*!
* Returns a pointer to the underground DataArrayInt instance and a
* sequence describing parameters of a support of each part of \a this field. The
- * caller should not decrRef() the returned DataArrayInt. This method allows for a
+ * caller should not decrRef() the returned DataArrayIdType. This method allows for a
* direct access to the field values. This method is intended for the field lying on one
* mesh only.
* \param [in,out] entries - the sequence describing parameters of a support of each
* \throw If no field values are available.
* \sa getUndergroundDataArray()
*/
-DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
if(_field_per_mesh.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !");
* \throw If no field values are available.
* \sa getUndergroundDataArray()
*/
-DataArray *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+DataArray *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
return getUndergroundDataArrayFloatExt(entries);
}
* \throw If no field values are available.
* \sa getUndergroundDataArray()
*/
-DataArrayFloat *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayFloatExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+DataArrayFloat *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayFloatExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
if(_field_per_mesh.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !");
med_int numdt,numit;
med_float dt;
MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,fieldName.c_str(),1,&numdt,&numit,&dt));
- ret->setTime(numdt,numit,dt);
+ ret->setTime(FromMedInt<int>(numdt),FromMedInt<int>(numit),dt);
ret->_csit=1;
if(loadAll)
ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,entities);
med_int numdt,numit;
med_float dt;
MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,fieldName.c_str(),1,&numdt,&numit,&dt));
- ret->setTime(numdt,numit,dt);
+ ret->setTime(FromMedInt<int>(numdt),FromMedInt<int>(numit),dt);
ret->_csit=1;
if(loadAll)
ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,entities);
{
if(checkFieldId)
{
- int nbFields=MEDnField(fid);
+ med_int nbFields=MEDnField(fid);
if(fieldIdCFormat>=nbFields)
{
std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::LocateField2(fileName) : in file \'" << FileNameFromFID(fid) << "\' number of fields is " << nbFields << " ! Trying to request for id " << fieldIdCFormat << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
}
- int ncomp(MEDfieldnComponent(fid,fieldIdCFormat+1));
+ med_int ncomp(MEDfieldnComponent(fid,fieldIdCFormat+1));
INTERP_KERNEL::AutoPtr<char> comp(MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE));
INTERP_KERNEL::AutoPtr<char> unit(MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE));
INTERP_KERNEL::AutoPtr<char> dtunit(MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE));
INTERP_KERNEL::AutoPtr<char> nomcha(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> nomMaa(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
med_bool localMesh;
- int nbOfStep;
+ med_int nbOfStep;
MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,fieldIdCFormat+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep));
fieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE);
dtunitOut=MEDLoaderBase::buildStringFromFortran(dtunit,MED_LNAME_SIZE);
infos.clear(); infos.resize(ncomp);
for(int j=0;j<ncomp;j++)
infos[j]=MEDLoaderBase::buildUnionUnit((char *)comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE,(char *)unit+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
- return nbOfStep;
+ return FromMedInt<int>(nbOfStep);
}
/*!
*/
int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut, std::string& meshName)
{
- int nbFields=MEDnField(fid);
+ med_int nbFields=MEDnField(fid);
bool found=false;
std::vector<std::string> fns(nbFields);
int nbOfStep2(-1);
MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
std::string oldPflName=disc->getProfile();
std::vector<std::string> vv=getPflsReallyUsedMulti();
- int nbOfOcc=std::count(vv.begin(),vv.end(),oldPflName);
+ std::size_t nbOfOcc=std::count(vv.begin(),vv.end(),oldPflName);
if(forceRenameOnGlob || (!existsPfl(newPflName) && nbOfOcc==1))
{
disc->setProfile(newPflName);
- DataArrayInt *pfl=getProfile(oldPflName.c_str());
+ DataArrayIdType *pfl=getProfile(oldPflName.c_str());
pfl->setName(newPflName);
}
else
MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
std::string oldLocName=disc->getLocalization();
std::vector<std::string> vv=getLocsReallyUsedMulti();
- int nbOfOcc=std::count(vv.begin(),vv.end(),oldLocName);
+ std::size_t nbOfOcc=std::count(vv.begin(),vv.end(),oldLocName);
if(forceRenameOnGlob || (!existsLoc(newLocName) && nbOfOcc==1))
{
disc->setLocalization(newLocName);
void MEDFileAnyTypeField1TS::writeLL(med_idt fid) const
{
- int nbComp(getNumberOfComponents());
+ std::size_t nbComp(getNumberOfComponents());
INTERP_KERNEL::AutoPtr<char> comp(MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE));
INTERP_KERNEL::AutoPtr<char> unit(MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE));
- for(int i=0;i<nbComp;i++)
+ for(std::size_t i=0;i<nbComp;i++)
{
std::string info=getInfo()[i];
std::string c,u;
}
if(getName().empty())
throw INTERP_KERNEL::Exception("MEDFileField1TS::write : MED file does not accept field with empty name !");
- MEDFILESAFECALLERWR0(MEDfieldCr,(fid,getName().c_str(),getMEDFileFieldType(),nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
+ MEDFILESAFECALLERWR0(MEDfieldCr,(fid,getName().c_str(),getMEDFileFieldType(),ToMedInt(nbComp),comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
writeGlobals(fid,*this);
contentNotNullBase()->writeLL(fid,*this,*contentNotNullBase());
}
return contentNotNullBase()->getMeshOrder();
}
-int MEDFileAnyTypeField1TS::getNumberOfComponents() const
+std::size_t MEDFileAnyTypeField1TS::getNumberOfComponents() const
{
return contentNotNullBase()->getNumberOfComponents();
}
return contentNotNullBase()->convertMedBallIntoClassic();
}
-void MEDFileAnyTypeField1TS::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl)
+void MEDFileAnyTypeField1TS::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl)
{
return contentNotNullBase()->makeReduction(ct,tof,pfl);
}
return contentNotNullBase()->getTypesOfFieldAvailable();
}
-std::vector< std::vector<std::pair<int,int> > > MEDFileAnyTypeField1TS::getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
+std::vector< std::vector<std::pair<mcIdType,mcIdType> > > MEDFileAnyTypeField1TS::getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
{
return contentNotNullBase()->getFieldSplitedByType(mname,types,typesF,pfls,locs);
return ret.retn();
}
-int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr)
+mcIdType MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr)
{
MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::New(*field));
return copyTinyInfoFrom(field->timeDiscrSafe(),ft,arr);
}
-int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr)
+mcIdType MEDFileAnyTypeField1TS::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr)
{
return contentNotNullBase()->copyTinyInfoFrom(th,field,arr);
}
//
MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector<int>& levs) const;
MEDLOADER_EXPORT void convertMedBallIntoClassic();
- MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl);
- MEDLOADER_EXPORT std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
+ MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl);
+ MEDLOADER_EXPORT std::vector< std::vector<std::pair<mcIdType,mcIdType> > > getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
//
MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId);
MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const;
MEDLOADER_EXPORT void deepCpyLeavesFrom(const MEDFileAnyTypeField1TSWithoutSDA& other);
MEDLOADER_EXPORT void accept(MEDFileFieldVisitor& visitor) const;
public:
- MEDLOADER_EXPORT int getNumberOfComponents() const;
+ MEDLOADER_EXPORT std::size_t getNumberOfComponents() const;
MEDLOADER_EXPORT const std::vector<std::string>& getInfo() const;
MEDLOADER_EXPORT std::vector<std::string>& getInfo();
MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const;
MEDLOADER_EXPORT void setInfo(const std::vector<std::string>& infos);
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
- MEDLOADER_EXPORT int copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr);
+ MEDLOADER_EXPORT mcIdType copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr);
MEDLOADER_EXPORT void setFieldNoProfileSBT(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- MEDLOADER_EXPORT void setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller=true);
+ MEDLOADER_EXPORT void setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller=true);
MEDLOADER_EXPORT virtual void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const;
MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *deepCopy() const = 0;
MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const = 0;
MEDLOADER_EXPORT virtual std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > splitComponents() const;
MEDLOADER_EXPORT virtual const char *getTypeStr() const = 0;
MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArray() const = 0;
- MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const = 0;
+ MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const = 0;
MEDLOADER_EXPORT virtual void setArray(DataArray *arr) = 0;
MEDLOADER_EXPORT virtual DataArray *createNewEmptyDataArrayInstance() const = 0;
MEDLOADER_EXPORT virtual DataArray *getOrCreateAndGetArray() = 0;
MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
- MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
- DataArray *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const;
+ MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayIdType *cellRenum, const DataArrayIdType *nodeRenum, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ DataArray *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const;
public:
- MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
+ MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob);
MEDLOADER_EXPORT std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > splitDiscretizations() const;
MEDLOADER_EXPORT std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > splitMultiDiscrPerGeoTypes() const;
- MEDLOADER_EXPORT int keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair<int,int> >& its);
- MEDLOADER_EXPORT int keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair<int,int> >& its);
+ MEDLOADER_EXPORT mcIdType keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair<mcIdType,mcIdType> >& its);
+ MEDLOADER_EXPORT mcIdType keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair<mcIdType,mcIdType> >& its);
public:
- MEDLOADER_EXPORT void allocNotFromFile(int newNbOfTuples);
+ MEDLOADER_EXPORT void allocNotFromFile(mcIdType newNbOfTuples);
MEDLOADER_EXPORT bool allocIfNecessaryTheArrayToReceiveDataFromFile();
MEDLOADER_EXPORT void loadOnlyStructureOfDataRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities);
MEDLOADER_EXPORT void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
protected:
int getMeshIdFromMeshName(const std::string& mName) const;
int addNewEntryIfNecessary(const MEDCouplingMesh *mesh);
- void updateData(int newLgth, const std::vector< std::pair<int,int> >& oldStartStops);
+ void updateData(mcIdType newLgth, const std::vector< std::pair<mcIdType,mcIdType> >& oldStartStops);
protected:
std::vector< MCAuto< MEDFileFieldPerMesh > > _field_per_mesh;
int _iteration;
// -2 means allocated and read from a file
// -1 means not allocated and build from scratch
// >=0 means not allocated and read from a file
- mutable int _nb_of_tuples_to_be_allocated;
+ mutable mcIdType _nb_of_tuples_to_be_allocated;
};
class MEDFileIntField1TSWithoutSDA;
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getOrCreateAndGetArrayTemplate();
MEDLOADER_EXPORT typename Traits<T>::ArrayType const *getOrCreateAndGetArrayTemplate() const;
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayTemplate() const;
- MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayTemplateExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayTemplateExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
MEDLOADER_EXPORT DataArray *getOrCreateAndGetArray();
MEDLOADER_EXPORT const DataArray *getOrCreateAndGetArray() const;
MEDLOADER_EXPORT DataArray *getUndergroundDataArray() const;
- MEDLOADER_EXPORT void aggregate(const typename std::vector< typename MLFieldTraits<T>::F1TSWSDAType const * >& f1tss, const std::vector< std::vector< std::pair<int,int> > >& dts);
+ MEDLOADER_EXPORT void aggregate(const typename std::vector< typename MLFieldTraits<T>::F1TSWSDAType const * >& f1tss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts);
MEDLOADER_EXPORT void copyTimeInfoFrom(const typename Traits<T>::FieldType *mcf);
protected:
MCAuto< typename Traits<T>::ArrayType > _arr;
{
public:
MEDLOADER_EXPORT const char *getTypeStr() const;
- MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
MEDLOADER_EXPORT static void CheckMeshDimRel(int meshDimRelToMax);
- MEDLOADER_EXPORT static std::vector<int> CheckSBTMesh(const MEDCouplingMesh *mesh);
+ MEDLOADER_EXPORT static std::vector<mcIdType> CheckSBTMesh(const MEDCouplingMesh *mesh);
MEDLOADER_EXPORT static MEDFileField1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
public:
MEDLOADER_EXPORT MEDFileField1TSWithoutSDA();
MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *deepCopy() const;
MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *shallowCpy() const;
MEDLOADER_EXPORT const char *getTypeStr() const;
- MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
- MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
+ MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
protected:
MEDFileIntField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
public:
MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *deepCopy() const;
MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *shallowCpy() const;
MEDLOADER_EXPORT const char *getTypeStr() const;
- MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
- MEDLOADER_EXPORT DataArrayFloat *getUndergroundDataArrayFloatExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
+ MEDLOADER_EXPORT DataArrayFloat *getUndergroundDataArrayFloatExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
protected:
MEDFileFloatField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
public:
MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
MEDLOADER_EXPORT int getMeshIteration() const;
MEDLOADER_EXPORT int getMeshOrder() const;
- MEDLOADER_EXPORT int getNumberOfComponents() const;
+ MEDLOADER_EXPORT std::size_t getNumberOfComponents() const;
MEDLOADER_EXPORT bool isDealingTS(int iteration, int order) const;
MEDLOADER_EXPORT std::pair<int,int> getDtIt() const;
MEDLOADER_EXPORT void fillIteration(std::pair<int,int>& p) const;
MEDLOADER_EXPORT std::vector<std::string>& getInfo();
MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const;
MEDLOADER_EXPORT std::vector<TypeOfField> getTypesOfFieldAvailable() const;
- MEDLOADER_EXPORT std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
+ MEDLOADER_EXPORT std::vector< std::vector<std::pair<mcIdType,mcIdType> > > getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId);
MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const;
MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector<int>& levs) const;
MEDLOADER_EXPORT void convertMedBallIntoClassic();
- MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl);
- MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const = 0;
+ MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl);
+ MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const = 0;
MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *shallowCpy() const = 0;
public:
MEDLOADER_EXPORT void loadArrays();
MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitDiscretizations() const;
MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitMultiDiscrPerGeoTypes() const;
MEDLOADER_EXPORT MEDFileAnyTypeField1TS *deepCopy() const;
- MEDLOADER_EXPORT int copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr);
- MEDLOADER_EXPORT int copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr);
+ MEDLOADER_EXPORT mcIdType copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr);
+ MEDLOADER_EXPORT mcIdType copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr);
public:
//! underground method see MEDFileField1TSWithoutSDA::setProfileNameOnLeaf
MEDLOADER_EXPORT void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
MEDLOADER_EXPORT static typename MLFieldTraits<T>::F1TSType *New(const typename MLFieldTraits<T>::F1TSWSDAType& other, bool shallowCopyOfContent);
public:
MEDLOADER_EXPORT static typename Traits<T>::ArrayType *ReturnSafelyTypedDataArray(MCAuto<DataArray>& arr);
- MEDLOADER_EXPORT typename Traits<T>::ArrayType *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
+ MEDLOADER_EXPORT typename Traits<T>::ArrayType *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const;
MEDLOADER_EXPORT void setArray(DataArray *arr);
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArray() const;
- MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
MEDLOADER_EXPORT static MCAuto<typename Traits<T>::FieldType> SetDataArrayInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr);
MEDLOADER_EXPORT static MCAuto<MEDCouplingFieldDouble> ToFieldTemplateWithTime(const typename Traits<T>::FieldType *f);
public:
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
MEDLOADER_EXPORT void setFieldNoProfileSBT(const typename Traits<T>::FieldType *field);
- MEDLOADER_EXPORT void setFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
- MEDLOADER_EXPORT void setFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
- MEDLOADER_EXPORT typename MLFieldTraits<T>::F1TSType *extractPartImpl(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
- MEDLOADER_EXPORT MEDFileAnyTypeField1TS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); }
+ MEDLOADER_EXPORT void setFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
+ MEDLOADER_EXPORT void setFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
+ MEDLOADER_EXPORT typename MLFieldTraits<T>::F1TSType *extractPartImpl(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const;
+ MEDLOADER_EXPORT MEDFileAnyTypeField1TS *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); }
protected:
~MEDFileTemplateField1TS() { }
MEDFileTemplateField1TS();
MEDFileTemplateField1TS(const typename MLFieldTraits<T>::F1TSWSDAType& other, bool shallowCopyOfContent):MEDFileAnyTypeField1TS(other,shallowCopyOfContent) { }
const typename MLFieldTraits<T>::F1TSWSDAType *contentNotNull() const;
typename MLFieldTraits<T>::F1TSWSDAType *contentNotNull();
- void setFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller);
+ void setFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller);
};
/*!
#include "MEDFileBlowStrEltUp.hxx"
#include "MEDFileFieldVisitor.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDCouplingFieldDiscretization.hxx"
#include "MCType.hxx"
{
if(id>=(int)_pfls.size())
_pfls.resize(id+1);
- _pfls[id]=DataArrayInt::New();
- int lgth(MEDprofileSizeByName(fid,pflName.c_str()));
- _pfls[id]->setName(pflName);
- _pfls[id]->alloc(lgth,1);
- MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName.c_str(),_pfls[id]->getPointer()));
+ MCAuto<DataArrayMedInt> miPfl=DataArrayMedInt::New();
+ med_int lgth(MEDprofileSizeByName(fid,pflName.c_str()));
+ miPfl->setName(pflName);
+ miPfl->alloc(lgth,1);
+ MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName.c_str(),miPfl->getPointer()));
+ _pfls[id]=FromMedIntArray<mcIdType>(miPfl);
_pfls[id]->applyLin(1,-1,0);//Converting into C format
}
void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int i)
{
INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
- int sz;
+ med_int sz;
MEDFILESAFECALLERRD0(MEDprofileInfo,(fid,i+1,pflName,&sz));
std::string pflCpp=MEDLoaderBase::buildStringFromFortran(pflName,MED_NAME_SIZE);
if(i>=(int)_pfls.size())
_pfls.resize(i+1);
- _pfls[i]=DataArrayInt::New();
- _pfls[i]->alloc(sz,1);
- _pfls[i]->setName(pflCpp.c_str());
- MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName,_pfls[i]->getPointer()));
+ MCAuto<DataArrayMedInt> miPfl=DataArrayMedInt::New();
+ miPfl->alloc(sz,1);
+ miPfl->setName(pflCpp.c_str());
+ MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName,miPfl->getPointer()));
+ _pfls[i]=FromMedIntArray<mcIdType>(miPfl);
_pfls[i]->applyLin(1,-1,0);//Converting into C format
}
void MEDFileFieldGlobs::writeGlobals(med_idt fid, const MEDFileWritable& opt) const
{
- int nbOfPfls=_pfls.size();
- for(int i=0;i<nbOfPfls;i++)
+ std::size_t nbOfPfls=_pfls.size();
+ for(std::size_t i=0;i<nbOfPfls;i++)
{
- MCAuto<DataArrayInt> cpy=_pfls[i]->deepCopy();
+ MCAuto<DataArrayMedInt> cpy=DataArrayMedInt::Copy((const DataArrayIdType*)_pfls[i]);
cpy->applyLin(1,1,0);
INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
MEDLoaderBase::safeStrCpy(_pfls[i]->getName().c_str(),MED_NAME_SIZE,pflName,opt.getTooLongStrPolicy());
- MEDFILESAFECALLERWR0(MEDprofileWr,(fid,pflName,_pfls[i]->getNumberOfTuples(),cpy->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDprofileWr,(fid,pflName,ToMedInt(_pfls[i]->getNumberOfTuples()),cpy->getConstPointer()));
}
//
- int nbOfLocs=_locs.size();
- for(int i=0;i<nbOfLocs;i++)
+ std::size_t nbOfLocs=_locs.size();
+ for(std::size_t i=0;i<nbOfLocs;i++)
_locs[i]->writeLL(fid);
}
void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps)
{
std::vector<std::string> pfls=getPfls();
- for(std::vector< MCAuto<DataArrayInt> >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++)
+ for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++)
{
std::vector<std::string>::iterator it2=std::find(pfls.begin(),pfls.end(),(*it)->getName());
if(it2==pfls.end())
}
else
{
- int id=std::distance(pfls.begin(),it2);
+ std::size_t id=std::distance(pfls.begin(),it2);
if(!(*it)->isEqual(*_pfls[id]))
{
std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Profile \"" << (*it)->getName() << "\" already exists and is different from those expecting to be append !";
}
else
{
- int id=std::distance(locs.begin(),it2);
+ std::size_t id=std::distance(locs.begin(),it2);
if(!(*it)->isEqual(*_locs[id],eps))
{
std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Localization \"" << (*it)->getName() << "\" already exists and is different from those expecting to be append !";
void MEDFileFieldGlobs::loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& real)
{
std::vector<std::string> profiles=real.getPflsReallyUsed();
- int sz=profiles.size();
+ std::size_t sz=profiles.size();
_pfls.resize(sz);
- for(int i=0;i<sz;i++)
+ for(unsigned int i=0;i<sz;i++)
loadProfileInFile(fid,i,profiles[i].c_str());
//
std::vector<std::string> locs=real.getLocsReallyUsed();
sz=locs.size();
_locs.resize(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
_locs[i]=MEDFileFieldLoc::New(fid,locs[i].c_str());
}
void MEDFileFieldGlobs::loadAllGlobals(med_idt fid, const MEDFileEntities *entities)
{
- int nProfil=MEDnProfile(fid);
+ med_int nProfil=MEDnProfile(fid);
for(int i=0;i<nProfil;i++)
loadProfileInFile(fid,i);
- int sz=MEDnLocalization(fid);
+ med_int sz=MEDnLocalization(fid);
_locs.resize(sz);
for(int i=0;i<sz;i++)
{
std::vector<const BigMemoryObject *> MEDFileFieldGlobs::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< MCAuto< DataArrayInt > >::const_iterator it=_pfls.begin();it!=_pfls.end();it++)
- ret.push_back((const DataArrayInt *)*it);
+ for(std::vector< MCAuto< DataArrayIdType > >::const_iterator it=_pfls.begin();it!=_pfls.end();it++)
+ ret.push_back((const DataArrayIdType *)*it);
for(std::vector< MCAuto<MEDFileFieldLoc> >::const_iterator it=_locs.begin();it!=_locs.end();it++)
ret.push_back((const MEDFileFieldLoc *)*it);
return ret;
{
MCAuto<MEDFileFieldGlobs> ret=new MEDFileFieldGlobs(*this);
std::size_t i=0;
- for(std::vector< MCAuto<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
+ for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
{
- if((const DataArrayInt *)*it)
+ if((const DataArrayIdType *)*it)
ret->_pfls[i]=(*it)->deepCopy();
}
i=0;
MCAuto<MEDFileFieldGlobs> ret=MEDFileFieldGlobs::New();
for(std::vector<std::string>::const_iterator it1=pfls.begin();it1!=pfls.end();it1++)
{
- DataArrayInt *pfl=const_cast<DataArrayInt *>(getProfile((*it1).c_str()));
+ DataArrayIdType *pfl=const_cast<DataArrayIdType *>(getProfile((*it1).c_str()));
if(!pfl)
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::shallowCpyPart : internal error ! pfl null !");
pfl->incrRef();
- MCAuto<DataArrayInt> pfl2(pfl);
+ MCAuto<DataArrayIdType> pfl2(pfl);
ret->_pfls.push_back(pfl2);
}
for(std::vector<std::string>::const_iterator it2=locs.begin();it2!=locs.end();it2++)
MCAuto<MEDFileFieldGlobs> ret=MEDFileFieldGlobs::New();
for(std::vector<std::string>::const_iterator it1=pfls.begin();it1!=pfls.end();it1++)
{
- DataArrayInt *pfl=const_cast<DataArrayInt *>(getProfile((*it1).c_str()));
+ DataArrayIdType *pfl=const_cast<DataArrayIdType *>(getProfile((*it1).c_str()));
if(!pfl)
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::deepCpyPart : internal error ! pfl null !");
ret->_pfls.push_back(pfl->deepCopy());
for(std::size_t i=0;i<n;i++)
{
oss << " - #" << i << " ";
- const DataArrayInt *pfl=_pfls[i];
+ const DataArrayIdType *pfl=_pfls[i];
if(pfl)
oss << "\"" << pfl->getName() << "\"\n";
else
void MEDFileFieldGlobs::changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(std::vector< MCAuto<DataArrayInt> >::iterator it=_pfls.begin();it!=_pfls.end();it++)
+ for(std::vector< MCAuto<DataArrayIdType> >::iterator it=_pfls.begin();it!=_pfls.end();it++)
{
- DataArrayInt *elt(*it);
+ DataArrayIdType *elt(*it);
if(elt)
{
std::string name(elt->getName());
{
public:
PflFinder(const std::string& pfl):_pfl(pfl) { }
- bool operator() (const MCAuto<DataArrayInt>& loc) { return loc->getName()==_pfl; }
+ bool operator() (const MCAuto<DataArrayIdType>& loc) { return loc->getName()==_pfl; }
private:
const std::string _pfl;
};
oss << "\"" << (*it)->getName() << "\", ";
throw INTERP_KERNEL::Exception(oss.str());
}
- return std::distance(_locs.begin(),it);
+ return (int)std::distance(_locs.begin(),it);
}
int MEDFileFieldGlobs::getProfileId(const std::string& pfl) const
{
- std::vector< MCAuto<DataArrayInt> >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pfl));
+ std::vector< MCAuto<DataArrayIdType> >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pfl));
if(it==_pfls.end())
{
std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfileId : no such profile name : \"" << pfl << "\" Possible localizations are : ";
oss << "\"" << (*it)->getName() << "\", ";
throw INTERP_KERNEL::Exception(oss.str());
}
- return std::distance(_pfls.begin(),it);
+ return (int)std::distance(_pfls.begin(),it);
}
/*!
* The returned value is never null.
*/
-const DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) const
+const DataArrayIdType *MEDFileFieldGlobs::getProfile(const std::string& pflName) const
{
return getProfileFromId(getProfileId(pflName));
}
-const DataArrayInt *MEDFileFieldGlobs::getProfileFromId(int pflId) const
+const DataArrayIdType *MEDFileFieldGlobs::getProfileFromId(int pflId) const
{
if(pflId<0 || pflId>=(int)_pfls.size())
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::getProfileFromId : Invalid profile id !");
/*!
* The returned value is never null. Borrowed reference returned.
*/
-DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName)
+DataArrayIdType *MEDFileFieldGlobs::getProfile(const std::string& pflName)
{
std::string pflNameCpp(pflName);
- std::vector< MCAuto<DataArrayInt> >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp));
+ std::vector< MCAuto<DataArrayIdType> >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp));
if(it==_pfls.end())
{
std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfile: no such profile name : \"" << pflNameCpp << "\" Possible profiles are : ";
return *it;
}
-DataArrayInt *MEDFileFieldGlobs::getProfileFromId(int pflId)
+DataArrayIdType *MEDFileFieldGlobs::getProfileFromId(int pflId)
{
if(pflId<0 || pflId>=(int)_pfls.size())
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::getProfileFromId : Invalid profile id !");
void MEDFileFieldGlobs::killProfileIds(const std::vector<int>& pflIds)
{
- std::vector< MCAuto<DataArrayInt> > newPfls;
+ std::vector< MCAuto<DataArrayIdType> > newPfls;
int i=0;
- for(std::vector< MCAuto<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
+ for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
{
if(std::find(pflIds.begin(),pflIds.end(),i)==pflIds.end())
newPfls.push_back(*it);
std::vector<std::string> MEDFileFieldGlobs::getPfls() const
{
- int sz=_pfls.size();
+ std::size_t sz=_pfls.size();
std::vector<std::string> ret(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
ret[i]=_pfls[i]->getName();
return ret;
}
std::vector<std::string> MEDFileFieldGlobs::getLocs() const
{
- int sz=_locs.size();
+ std::size_t sz=_locs.size();
std::vector<std::string> ret(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
ret[i]=_locs[i]->getName();
return ret;
}
std::vector< std::vector<int> > MEDFileFieldGlobs::whichAreEqualProfiles() const
{
- std::map<int,std::vector<int> > m;
+ std::map<mcIdType,std::vector<int> > m;
int i=0;
- for(std::vector< MCAuto<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
+ for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
{
- const DataArrayInt *tmp=(*it);
+ const DataArrayIdType *tmp=(*it);
if(tmp)
{
m[tmp->getHashCode()].push_back(i);
}
}
std::vector< std::vector<int> > ret;
- for(std::map<int,std::vector<int> >::const_iterator it2=m.begin();it2!=m.end();it2++)
+ for(std::map<mcIdType,std::vector<int> >::const_iterator it2=m.begin();it2!=m.end();it2++)
{
if((*it2).second.size()>1)
{
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::whichAreEqualLocs : no implemented yet ! Sorry !");
}
-void MEDFileFieldGlobs::appendProfile(DataArrayInt *pfl)
+void MEDFileFieldGlobs::appendProfile(DataArrayIdType *pfl)
{
std::string name(pfl->getName());
if(name.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::appendProfile : unsupported profiles with no name !");
- for(std::vector< MCAuto<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++)
+ for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++)
if(name==(*it)->getName())
{
if(!pfl->isEqual(*(*it)))
/*!
* Returns a profile array by its name.
* \param [in] pflName - the name of the profile of interest.
- * \return const DataArrayInt * - the profile array having the name \a pflName.
+ * \return const DataArrayIdType * - the profile array having the name \a pflName.
* \throw If there is no a profile named \a pflName.
*/
-const DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) const
+const DataArrayIdType *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) const
{
return contentNotNull()->getProfile(pflName);
}
/*!
* Returns a profile array by its id.
* \param [in] pflId - the id of the profile of interest.
- * \return const DataArrayInt * - the profile array having the id \a pflId.
+ * \return const DataArrayIdType * - the profile array having the id \a pflId.
* \throw If there is no a profile with id \a pflId.
*/
-const DataArrayInt *MEDFileFieldGlobsReal::getProfileFromId(int pflId) const
+const DataArrayIdType *MEDFileFieldGlobsReal::getProfileFromId(int pflId) const
{
return contentNotNull()->getProfileFromId(pflId);
}
/*!
* Returns a profile array, apt for modification, by its name.
* \param [in] pflName - the name of the profile of interest.
- * \return DataArrayInt * - Borrowed reference - a non-const pointer to the profile array having the name \a pflName.
+ * \return DataArrayIdType * - Borrowed reference - a non-const pointer to the profile array having the name \a pflName.
* \throw If there is no a profile named \a pflName.
*/
-DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName)
+DataArrayIdType *MEDFileFieldGlobsReal::getProfile(const std::string& pflName)
{
return contentNotNull()->getProfile(pflName);
}
/*!
* Returns a profile array, apt for modification, by its id.
* \param [in] pflId - the id of the profile of interest.
- * \return DataArrayInt * - Borrowed reference - a non-const pointer to the profile array having the id \a pflId.
+ * \return DataArrayIdType * - Borrowed reference - a non-const pointer to the profile array having the id \a pflId.
* \throw If there is no a profile with id \a pflId.
*/
-DataArrayInt *MEDFileFieldGlobsReal::getProfileFromId(int pflId)
+DataArrayIdType *MEDFileFieldGlobsReal::getProfileFromId(int pflId)
{
return contentNotNull()->getProfileFromId(pflId);
}
* \throw If a profile with the same name as that of \a pfl already exists but contains
* different ids.
*/
-void MEDFileFieldGlobsReal::appendProfile(DataArrayInt *pfl)
+void MEDFileFieldGlobsReal::appendProfile(DataArrayIdType *pfl)
{
contentNotNull()->appendProfile(pfl);
}
std::string getFileName() const { return _file_name; }
const MEDFileFieldLoc& getLocalizationFromId(int locId) const;
const MEDFileFieldLoc& getLocalization(const std::string& locName) const;
- const DataArrayInt *getProfileFromId(int pflId) const;
- const DataArrayInt *getProfile(const std::string& pflName) const;
+ const DataArrayIdType *getProfileFromId(int pflId) const;
+ const DataArrayIdType *getProfile(const std::string& pflName) const;
MEDFileFieldLoc& getLocalizationFromId(int locId);
MEDFileFieldLoc& getLocalization(const std::string& locName);
- DataArrayInt *getProfile(const std::string& pflName);
- DataArrayInt *getProfileFromId(int pflId);
+ DataArrayIdType *getProfile(const std::string& pflName);
+ DataArrayIdType *getProfileFromId(int pflId);
void killProfileIds(const std::vector<int>& pflIds);
void killLocalizationIds(const std::vector<int>& locIds);
void killStructureElementsInGlobs();
//
- void appendProfile(DataArrayInt *pfl);
+ void appendProfile(DataArrayIdType *pfl);
void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
//
static std::string CreateNewNameNotIn(const std::string& prefix, const std::vector<std::string>& namesToAvoid);
MEDFileFieldGlobs();
~MEDFileFieldGlobs();
protected:
- std::vector< MCAuto<DataArrayInt> > _pfls;
+ std::vector< MCAuto<DataArrayIdType> > _pfls;
std::vector< MCAuto<MEDFileFieldLoc> > _locs;
std::string _file_name;
};
MEDLOADER_EXPORT const MEDFileFieldLoc& getLocalization(const std::string& locName) const;
MEDLOADER_EXPORT MEDFileFieldLoc& getLocalizationFromId(int locId);
MEDLOADER_EXPORT MEDFileFieldLoc& getLocalization(const std::string& locName);
- MEDLOADER_EXPORT const DataArrayInt *getProfile(const std::string& pflName) const;
- MEDLOADER_EXPORT const DataArrayInt *getProfileFromId(int pflId) const;
- MEDLOADER_EXPORT DataArrayInt *getProfile(const std::string& pflName);
- MEDLOADER_EXPORT DataArrayInt *getProfileFromId(int pflId);
+ MEDLOADER_EXPORT const DataArrayIdType *getProfile(const std::string& pflName) const;
+ MEDLOADER_EXPORT const DataArrayIdType *getProfileFromId(int pflId) const;
+ MEDLOADER_EXPORT DataArrayIdType *getProfile(const std::string& pflName);
+ MEDLOADER_EXPORT DataArrayIdType *getProfileFromId(int pflId);
MEDLOADER_EXPORT void killProfileIds(const std::vector<int>& pflIds);
MEDLOADER_EXPORT void killLocalizationIds(const std::vector<int>& locIds);
//
- MEDLOADER_EXPORT void appendProfile(DataArrayInt *pfl);
+ MEDLOADER_EXPORT void appendProfile(DataArrayIdType *pfl);
MEDLOADER_EXPORT void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
protected:
MEDFileFieldGlobs *contentNotNull();
{
med_geometry_type geotype;
med_geometry_type sectiongeotype;
- int nsectionmeshcell;
+ med_int nsectionmeshcell, dim, nb_gauss_pt;
INTERP_KERNEL::AutoPtr<char> geointerpname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> sectionmeshname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
- MEDlocalizationInfoByName(fid,locName.c_str(),&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype);
+ MEDlocalizationInfoByName(fid,locName.c_str(),&geotype,&dim,&nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype);
+ _dim=FromMedInt<int>(dim);
+ _nb_gauss_pt=FromMedInt<int>(nb_gauss_pt);
_gt=new MEDFileGTKeeperSta((INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+34,geotype))));
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType()));
_nb_node_per_cell=cm.getNumberOfNodes();
{
med_geometry_type geotype;
med_geometry_type sectiongeotype;
- int nsectionmeshcell;
+ med_int nsectionmeshcell,dim,nb_gauss_pt;
INTERP_KERNEL::AutoPtr<char> locName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> geointerpname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> sectionmeshname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
- MEDFILESAFECALLERRD0(MEDlocalizationInfo,(fid,id+1,locName,&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype));
+ MEDFILESAFECALLERRD0(MEDlocalizationInfo,(fid,id+1,locName,&geotype,&dim,&nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype));
+ _dim=FromMedInt<int>(dim);
+ _nb_gauss_pt=FromMedInt<int>(nb_gauss_pt);
_name=locName;
std::string sectionName(MEDLoaderBase::buildStringFromFortran(sectionmeshname,MED_NAME_SIZE));
if(sectionName.empty())
const MEDFileUMesh *section(entities2->getSupMeshWithName(sectionName));
_gt=new MEDFileGTKeeperDyn(um,section,se);
{
- int dummy;
- MEDFILESAFECALLERRD0(MEDmeshGeotypeParameter,(fid,geotype,&dummy,&_nb_node_per_cell));
+ med_int dummy, nb_node_per_cell;
+ MEDFILESAFECALLERRD0(MEDmeshGeotypeParameter,(fid,geotype,&dummy,&nb_node_per_cell));
+ _nb_node_per_cell=FromMedInt<int>(nb_node_per_cell);
}
}
_ref_coo.resize(_dim*_nb_node_per_cell);
}
MEDFileFieldLoc::MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType,
- const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w):_name(locName),_gt(new MEDFileGTKeeperSta(geoType)),_ref_coo(refCoo),_gs_coo(gsCoo),_w(w)
+ const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w):_gt(new MEDFileGTKeeperSta(geoType)),_name(locName),_ref_coo(refCoo),_gs_coo(gsCoo),_w(w)
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType()));
_dim=cm.getDimension();
_nb_node_per_cell=cm.getNumberOfNodes();
- _nb_gauss_pt=_w.size();
+ _nb_gauss_pt=(int)_w.size();
}
oss << "\n - Dimension : " << _dim << "\n - Number of gauss points : ";
oss << _nb_gauss_pt << "\n - Number of nodes in cell : " << _nb_node_per_cell;
oss << "\n - Ref coords are : ";
- int sz=_ref_coo.size();
+ std::size_t sz=_ref_coo.size();
if(sz%_dim==0)
{
- int nbOfTuples=sz/_dim;
- for(int i=0;i<nbOfTuples;i++)
+ std::size_t nbOfTuples=sz/_dim;
+ for(std::size_t i=0;i<nbOfTuples;i++)
{
oss << "(";
for(int j=0;j<_dim;j++)
sz=_gs_coo.size();
if(sz%_dim==0)
{
- int nbOfTuples=sz/_dim;
- for(int i=0;i<nbOfTuples;i++)
+ std::size_t nbOfTuples=sz/_dim;
+ for(std::size_t i=0;i<nbOfTuples;i++)
{
oss << "(";
for(int j=0;j<_dim;j++)
return oss.str();
}
-void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
_type=field->getTypeOfField();
_start=start;
}
case ON_GAUSS_NE:
{
- MCAuto<DataArrayInt> arr=field->getDiscretization()->getOffsetArr(field->getMesh());
- const int *arrPtr=arr->getConstPointer();
+ MCAuto<DataArrayIdType> arr=field->getDiscretization()->getOffsetArr(field->getMesh());
+ const mcIdType *arrPtr=arr->getConstPointer();
getOrCreateAndGetArray()->setContigPartOfSelectedValuesSlice(_start,arrr,arrPtr[offset],arrPtr[offset+nbOfCells],1);
_end=_start+(arrPtr[offset+nbOfCells]-arrPtr[offset]);
_nval=nbOfCells;
case ON_GAUSS_PT:
{
const MEDCouplingFieldDiscretization *disc(field->getDiscretization());
- const MEDCouplingGaussLocalization& gsLoc(field->getGaussLocalization(_loc_id));
+ const MEDCouplingGaussLocalization& gsLoc(field->getGaussLocalization(FromIdType<int>(_loc_id)));
const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc));
if(!disc2)
throw INTERP_KERNEL::Exception("assignFieldNoProfile : invalid call to this method ! Internal Error !");
- const DataArrayInt *dai(disc2->getArrayOfDiscIds());
- MCAuto<DataArrayInt> dai2(disc2->getOffsetArr(field->getMesh()));
- const int *dai2Ptr(dai2->getConstPointer());
- int nbi(gsLoc.getWeights().size());
- MCAuto<DataArrayInt> da2(dai->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1));
- MCAuto<DataArrayInt> da3(da2->findIdsEqual(_loc_id));
- const int *da3Ptr(da3->getConstPointer());
+ const DataArrayIdType *dai(disc2->getArrayOfDiscIds());
+ MCAuto<DataArrayIdType> dai2(disc2->getOffsetArr(field->getMesh()));
+ const mcIdType *dai2Ptr(dai2->getConstPointer());
+ mcIdType nbi(ToIdType(gsLoc.getWeights().size()));
+ MCAuto<DataArrayIdType> da2(dai->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1));
+ MCAuto<DataArrayIdType> da3(da2->findIdsEqual(_loc_id));
+ const mcIdType *da3Ptr(da3->getConstPointer());
if(da3->getNumberOfTuples()!=nbOfCells)
{//profile : for gauss even in NoProfile !!!
std::ostringstream oss; oss << "Pfl_" << nasc.getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id;
da3->setName(_profile.c_str());
glob.appendProfile(da3);
}
- MCAuto<DataArrayInt> da4(DataArrayInt::New());
+ MCAuto<DataArrayIdType> da4(DataArrayIdType::New());
_nval=da3->getNbOfElems();
da4->alloc(_nval*nbi,1);
- int *da4Ptr(da4->getPointer());
- for(int i=0;i<_nval;i++)
+ mcIdType *da4Ptr(da4->getPointer());
+ for(mcIdType i=0;i<_nval;i++)
{
- int ref=dai2Ptr[offset+da3Ptr[i]];
- for(int j=0;j<nbi;j++)
+ mcIdType ref=dai2Ptr[offset+da3Ptr[i]];
+ for(mcIdType j=0;j<nbi;j++)
*da4Ptr++=ref+j;
}
std::ostringstream oss2; oss2 << "Loc_" << nasc.getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id;
* \b WARNING if not null the MED file profile can be subdivided again in case of Gauss points.
* \param [in] mesh is the mesh coming from the MEDFileMesh instance in correspondence with the MEDFileField. The mesh inside the \a field is simply ignored.
*/
-void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
_profile.clear();
_type=field->getTypeOfField();
}
case ON_GAUSS_NE:
{
- MCAuto<DataArrayInt> arr=field->getDiscretization()->getOffsetArr(mesh);
- MCAuto<DataArrayInt> arr2=arr->deltaShiftIndex();
- MCAuto<DataArrayInt> arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end());
+ MCAuto<DataArrayIdType> arr=field->getDiscretization()->getOffsetArr(mesh);
+ MCAuto<DataArrayIdType> arr2=arr->deltaShiftIndex();
+ MCAuto<DataArrayIdType> arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end());
arr3->computeOffsetsFull();
- MCAuto<DataArrayInt> tmp=idsInPfl->buildExplicitArrByRanges(arr3);
- int trueNval=tmp->getNumberOfTuples();
+ MCAuto<DataArrayIdType> tmp=idsInPfl->buildExplicitArrByRanges(arr3);
+ mcIdType trueNval=tmp->getNumberOfTuples();
_nval=idsInPfl->getNumberOfTuples();
getOrCreateAndGetArray()->setContigPartOfSelectedValues(_start,arrr,tmp);
_end=_start+trueNval;
const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(field->getDiscretization());
if(!disc2)
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !");
- const DataArrayInt *da1=disc2->getArrayOfDiscIds();
- const MEDCouplingGaussLocalization& gsLoc=field->getGaussLocalization(_loc_id);
- MCAuto<DataArrayInt> da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end());
- MCAuto<DataArrayInt> da3=da2->findIdsEqual(_loc_id);
- MCAuto<DataArrayInt> da4=idsInPfl->selectByTupleId(da3->begin(),da3->end());
+ const DataArrayIdType *da1=disc2->getArrayOfDiscIds();
+ const MEDCouplingGaussLocalization& gsLoc=field->getGaussLocalization(FromIdType<int>(_loc_id));
+ MCAuto<DataArrayIdType> da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end());
+ MCAuto<DataArrayIdType> da3=da2->findIdsEqual(_loc_id);
+ MCAuto<DataArrayIdType> da4=idsInPfl->selectByTupleId(da3->begin(),da3->end());
//
MCAuto<MEDCouplingMesh> mesh2=mesh->buildPart(multiTypePfl->begin(),multiTypePfl->end());
- MCAuto<DataArrayInt> arr=disc2->getOffsetArr(mesh2);
+ MCAuto<DataArrayIdType> arr=disc2->getOffsetArr(mesh2);
//
- MCAuto<DataArrayInt> tmp=DataArrayInt::New();
- int trueNval=0;
- for(const int *pt=da4->begin();pt!=da4->end();pt++)
+ MCAuto<DataArrayIdType> tmp=DataArrayIdType::New();
+ mcIdType trueNval=0;
+ for(const mcIdType *pt=da4->begin();pt!=da4->end();pt++)
trueNval+=arr->getIJ(*pt+1,0)-arr->getIJ(*pt,0);
tmp->alloc(trueNval,1);
- int *tmpPtr=tmp->getPointer();
- for(const int *pt=da4->begin();pt!=da4->end();pt++)
- for(int j=arr->getIJ(*pt,0);j<arr->getIJ(*pt+1,0);j++)
+ mcIdType *tmpPtr=tmp->getPointer();
+ for(const mcIdType *pt=da4->begin();pt!=da4->end();pt++)
+ for(mcIdType j=arr->getIJ(*pt,0);j<arr->getIJ(*pt+1,0);j++)
*tmpPtr++=j;
//
_nval=da4->getNumberOfTuples();
oss << "_loc_" << _loc_id;
if(locIds)
{
- MCAuto<DataArrayInt> da5=locIds->selectByTupleId(da3->begin(),da3->end());
+ MCAuto<DataArrayIdType> da5=locIds->selectByTupleId(da3->begin(),da3->end());
da5->setName(oss.str());
glob.appendProfile(da5);
_profile=oss.str();
start=_end;
}
-void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob)
+void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob)
{
_start=start;
_nval=arrr->getNumberOfTuples();
return new MEDFileFieldPerMeshPerTypePerDisc(fath,type,profileIt,pd);
}
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId)
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId)
{
return new MEDFileFieldPerMeshPerTypePerDisc(fath,type,locId,std::string());
}
return ret.retn();
}
-MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField atype, int profileIt, const PartDefinition *pd)
+MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField atype, mcIdType profileIt, const PartDefinition *pd)
try:_type(atype),_father(fath),_profile_it(profileIt),_pd(const_cast<PartDefinition *>(pd))
{
if(pd)
throw e;
}
-MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId, const std::string& dummy):_type(type),_father(fath),_loc_id(locId)
+MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId, const std::string& dummy):_type(type),_father(fath),_loc_id(locId)
{
}
{
}
-MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc():_type(ON_CELLS),_father(0),_start(-std::numeric_limits<int>::max()),_end(-std::numeric_limits<int>::max()),
- _nval(-std::numeric_limits<int>::max()),_loc_id(-std::numeric_limits<int>::max())
+MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc():_type(ON_CELLS),_father(0),_start(-std::numeric_limits<mcIdType>::max()),_end(-std::numeric_limits<mcIdType>::max()),
+ _nval(-std::numeric_limits<mcIdType>::max()),_loc_id(-std::numeric_limits<int>::max())
{
}
{
med_entity_type mentiCpy(menti);
INTERP_KERNEL::AutoPtr<char> locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
- int nbi,tmp1;
+ med_int nbi,tmp1;
med_int nbValsInFile(MEDfieldnValueWithProfileByName(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile.c_str(),MED_COMPACT_PFLMODE,&tmp1,locname,&nbi));
if(nbValsInFile==0 && menti==MED_CELL)
{//
if(!_profile.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile : not implemented !");
INTERP_KERNEL::AutoPtr<char> pflname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
- int profilesize,nbi;
- int overallNval(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
+ med_int profilesize,nbi;
+ med_int overallNval(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,FromIdType<int>(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
const SlicePartDefinition *spd(dynamic_cast<const SlicePartDefinition *>(pd));
if(spd)
{
- int start,stop,step;
+ mcIdType start,stop,step;
spd->getSlice(start,stop,step);
- int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(start,stop,step,"MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile"));
+ mcIdType nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(start,stop,step,"MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile"));
med_filter filter=MED_FILTER_INIT;
MEDFILESAFECALLERRD0(MEDfilterBlockOfEntityCr,(fid,/*nentity*/overallNval,/*nvaluesperentity*/nbi,/*nconstituentpervalue*/nbOfCompo,
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
- /*start*/start+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad,
+ /*start*/ToMedInt(start+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad),
/*lastblocksize=useless because count=1*/0,&filter));
MEDFILESAFECALLERRD0(MEDfieldValueAdvancedRd,(fid,fieldName.c_str(),iteration,order,menti,mgeoti,&filter,startFeedingPtr));
MEDfilterClose(&filter);
if(dpd)
{
dpd->checkConsistencyLight();
- MCAuto<DataArrayInt> myIds(dpd->toDAI());
- int a(myIds->getMinValueInArray()),b(myIds->getMaxValueInArray());
+ MCAuto<DataArrayIdType> myIds(dpd->toDAI());
+ mcIdType a(myIds->getMinValueInArray()),b(myIds->getMaxValueInArray());
myIds=myIds->deepCopy();// WARNING deep copy here because _pd is modified by applyLin !!!
myIds->applyLin(1,-a);
- int nbOfEltsToLoad(b-a+1);
+ mcIdType nbOfEltsToLoad(b-a+1);
med_filter filter=MED_FILTER_INIT;
{//TODO : manage int32 !
MCAuto<DataArrayDouble> tmp(DataArrayDouble::New());
tmp->alloc(nbOfEltsToLoad,nbOfCompo);
MEDFILESAFECALLERRD0(MEDfilterBlockOfEntityCr,(fid,/*nentity*/overallNval,/*nvaluesperentity*/nbi,/*nconstituentpervalue*/nbOfCompo,
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
- /*start*/a+1,/*stride*/1,/*count*/1,/*blocksize*/nbOfEltsToLoad,
+ /*start*/ToMedInt(a+1),/*stride*/1,/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad),
/*lastblocksize=useless because count=1*/0,&filter));
MEDFILESAFECALLERRD0(MEDfieldValueAdvancedRd,(fid,fieldName.c_str(),iteration,order,menti,mgeoti,&filter,reinterpret_cast<unsigned char *>(tmp->getPointer())));
MCAuto<DataArrayDouble> feeder(DataArrayDouble::New());
return _father;
}
-void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc)
{
INTERP_KERNEL::AutoPtr<char> locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> pflname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
std::string fieldName(nasc.getName()),meshName(getMeshName());
- int iteration(getIteration()),order(getOrder()),profilesize,nbi;
+ med_int iteration(getIteration()),order(getOrder()),profilesize,nbi;
TypeOfField type(getType());
med_geometry_type mgeoti;
med_entity_type menti;
_father->entriesForMEDfile(type,mgeoti,menti);
- int zeNVal(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
+ med_int zeNVal(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,FromIdType<int>(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
if(zeNVal==0 && type==ON_CELLS)
{//eheh maybe there's a surprise :)
- int zeNVal1(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_FACE,mgeoti,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
+ med_int zeNVal1(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_FACE,mgeoti,FromIdType<int>(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
if(zeNVal1==0)
{
- int zeNVal2(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_EDGE,mgeoti,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
+ med_int zeNVal2(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_EDGE,mgeoti,FromIdType<int>(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
if(zeNVal2!=0)
zeNVal=zeNVal2;
}
std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypePerDisc::loadBigArray : Invalid start ("<< _start << ") regarding admissible range of allocated array [0," << arr->getNumberOfTuples() << "] !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int nbOfCompo(arr->getNumberOfComponents());
+ int nbOfCompo((int)arr->getNumberOfComponents());
DataArrayDouble *arrD(dynamic_cast<DataArrayDouble *>(arr));
if(arrD)
{
goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast<unsigned char*>(startFeeding));
return ;
}
- DataArrayInt *arrI(dynamic_cast<DataArrayInt *>(arr));
+ DataArrayInt32 *arrI(dynamic_cast<DataArrayInt32 *>(arr));
if(arrI)
{
int *startFeeding(arrI->getPointer()+_start*nbOfCompo);
/*!
* Set a \c this->_start **and** \c this->_end keeping the same delta between the two.
*/
-void MEDFileFieldPerMeshPerTypePerDisc::setNewStart(int newValueOfStart)
+void MEDFileFieldPerMeshPerTypePerDisc::setNewStart(mcIdType newValueOfStart)
{
- int delta=_end-_start;
+ mcIdType delta=_end-_start;
_start=newValueOfStart;
_end=_start+delta;
}
_type=newType;
}
-int MEDFileFieldPerMeshPerTypePerDisc::getNumberOfComponents() const
+std::size_t MEDFileFieldPerMeshPerTypePerDisc::getNumberOfComponents() const
{
return _father->getNumberOfComponents();
}
-int MEDFileFieldPerMeshPerTypePerDisc::getNumberOfTuples() const
+mcIdType MEDFileFieldPerMeshPerTypePerDisc::getNumberOfTuples() const
{
return _end-_start;
}
-void MEDFileFieldPerMeshPerTypePerDisc::incrementNbOfVals(int deltaNbVal)
+void MEDFileFieldPerMeshPerTypePerDisc::incrementNbOfVals(mcIdType deltaNbVal)
{
- int nbi((_end-_start)/_nval);
+ mcIdType nbi((_end-_start)/_nval);
_nval+=deltaNbVal;
_end+=nbi*deltaNbVal;
}
}
}
-void MEDFileFieldPerMeshPerTypePerDisc::getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
+void MEDFileFieldPerMeshPerTypePerDisc::getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
{
if(type!=_type)
return ;
- dads.push_back(std::pair<int,int>(_start,_end));
+ dads.push_back(std::pair<mcIdType,mcIdType>(_start,_end));
geoTypes.push_back(getGeoType());
if(_profile.empty())
pfls.push_back(0);
}
}
-void MEDFileFieldPerMeshPerTypePerDisc::fillValues(int discId, int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+void MEDFileFieldPerMeshPerTypePerDisc::fillValues(int discId, mcIdType& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
- entries[startEntryId]=std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int> ,std::pair<int,int> >(std::pair<INTERP_KERNEL::NormalizedCellType,int>(getGeoType(),discId),std::pair<int,int>(_start,_end));
+ entries[startEntryId]=std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,mcIdType> ,std::pair<mcIdType,mcIdType> >(std::pair<INTERP_KERNEL::NormalizedCellType,mcIdType>(getGeoType(),discId),std::pair<mcIdType,mcIdType>(_start,_end));
startEntryId++;
}
if(!arr->isAllocated())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : the array to be written is not allocated !");
const DataArrayDouble *arrD(dynamic_cast<const DataArrayDouble *>(arr));
- const DataArrayInt *arrI(dynamic_cast<const DataArrayInt *>(arr));
+ const DataArrayInt32 *arrI(dynamic_cast<const DataArrayInt32 *>(arr));
const DataArrayFloat *arrF(dynamic_cast<const DataArrayFloat *>(arr));
const unsigned char *locToWrite=0;
if(arrD)
else
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : not recognized type of values ! Supported are FLOAT64 FLOAT32 and INT32 !");
MEDFILESAFECALLERWR0(MEDfieldValueWithProfileWr,(fid,nasc.getName().c_str(),getIteration(),getOrder(),getTime(),menti,mgeoti,
- MED_COMPACT_PFLMODE,_profile.c_str(),_localization.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,_nval,
+ MED_COMPACT_PFLMODE,_profile.c_str(),_localization.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,ToMedInt(_nval),
locToWrite));
}
-void MEDFileFieldPerMeshPerTypePerDisc::getCoarseData(TypeOfField& type, std::pair<int,int>& dad, std::string& pfl, std::string& loc) const
+void MEDFileFieldPerMeshPerTypePerDisc::getCoarseData(TypeOfField& type, std::pair<mcIdType,mcIdType>& dad, std::string& pfl, std::string& loc) const
{
type=_type;
pfl=_profile;
* \param [out] ptToFill memory zone where the output will be stored.
* \return the size of data pushed into output param \a ptToFill
*/
-int MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(int offset, const std::vector<int>& codeOfMesh, const MEDFileFieldGlobsReal& glob, int *ptToFill) const
+mcIdType MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(mcIdType offset, const std::vector<mcIdType>& codeOfMesh, const MEDFileFieldGlobsReal& glob, mcIdType *ptToFill) const
{
- _loc_id=offset;
+ _loc_id=FromIdType<int>(offset);
std::ostringstream oss;
std::size_t nbOfType=codeOfMesh.size()/3;
int found=-1;
oss << "MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode : not found geometric type " << cm.getRepr() << " in the referenced mesh of field !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int *work=ptToFill;
+ mcIdType *work=ptToFill;
if(_profile.empty())
{
if(_nval!=codeOfMesh[3*found+1])
oss << " whereas mesh has " << codeOfMesh[3*found+1] << " for this geometric type !";
throw INTERP_KERNEL::Exception(oss.str());
}
- for(int ii=codeOfMesh[3*found+2];ii<codeOfMesh[3*found+2]+_nval;ii++)
+ for(mcIdType ii=codeOfMesh[3*found+2];ii<codeOfMesh[3*found+2]+_nval;ii++)
*work++=ii;
}
else
{
- const DataArrayInt *pfl=glob.getProfile(_profile.c_str());
+ const DataArrayIdType *pfl=glob.getProfile(_profile.c_str());
if(pfl->getNumberOfTuples()!=_nval)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getGeoType());
oss << pfl->getNumberOfTuples() << " whereas the number of ids is set to " << _nval << " for this geometric type !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int offset2=codeOfMesh[3*found+2];
- for(const int *pflId=pfl->begin();pflId!=pfl->end();pflId++)
+ mcIdType offset2=codeOfMesh[3*found+2];
+ for(const mcIdType *pflId=pfl->begin();pflId!=pfl->end();pflId++)
{
if(*pflId<codeOfMesh[3*found+1])
*work++=offset2+*pflId;
return _nval;
}
-int MEDFileFieldPerMeshPerTypePerDisc::fillTupleIds(int *ptToFill) const
+mcIdType MEDFileFieldPerMeshPerTypePerDisc::fillTupleIds(mcIdType *ptToFill) const
{
- for(int i=_start;i<_end;i++)
+ for(mcIdType i=_start;i<_end;i++)
*ptToFill++=i;
return _end-_start;
}
-int MEDFileFieldPerMeshPerTypePerDisc::ConvertType(TypeOfField type, int locId)
+int MEDFileFieldPerMeshPerTypePerDisc::ConvertType(TypeOfField type, mcIdType locId)
{
switch(type)
{
case ON_GAUSS_NE:
return -1;
case ON_GAUSS_PT:
- return locId;
+ return FromIdType<int>(locId);
default:
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::ConvertType : not managed type of field !");
}
* \param [out] result All new entries will be appended on it.
* \return false if the configuration of renumbering leads to an unnecessary resplit of input \a entriesOnSameDisc. If not true is returned (the most general case !)
*/
-bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(int offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
- const DataArrayInt *explicitIdsInMesh,
- const std::vector<int>& newCode,
+bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(mcIdType offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
+ const DataArrayIdType *explicitIdsInMesh,
+ const std::vector<mcIdType>& newCode,
MEDFileFieldGlobsReal& glob, DataArrayDouble *arr,
std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >& result)
{
if(entriesOnSameDisc.empty())
return false;
TypeOfField type=entriesOnSameDisc[0]->getType();
- int szEntities=0,szTuples=0;
+ mcIdType szEntities=0,szTuples=0;
for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++)
{ szEntities+=(*it)->_nval; szTuples+=(*it)->_end-(*it)->_start; }
- int nbi=szTuples/szEntities;
+ mcIdType nbi=szTuples/szEntities;
if(szTuples%szEntities!=0)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks : internal error the splitting into same dicretization failed !");
- MCAuto<DataArrayInt> renumTuples=DataArrayInt::New(); renumTuples->alloc(szTuples,1);
- MCAuto<DataArrayInt> ranges=MEDCouplingUMesh::ComputeRangesFromTypeDistribution(newCode);
- std::vector< MCAuto<DataArrayInt> > newGeoTypesPerChunk(entriesOnSameDisc.size());
- std::vector< const DataArrayInt * > newGeoTypesPerChunk2(entriesOnSameDisc.size());
- std::vector< MCAuto<DataArrayInt> > newGeoTypesPerChunk_bis(entriesOnSameDisc.size());
- std::vector< const DataArrayInt * > newGeoTypesPerChunk3(entriesOnSameDisc.size());
- MCAuto<DataArrayInt> newGeoTypesPerChunk4=DataArrayInt::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi);
+ MCAuto<DataArrayIdType> renumTuples=DataArrayIdType::New(); renumTuples->alloc(szTuples,1);
+ MCAuto<DataArrayIdType> ranges=MEDCouplingUMesh::ComputeRangesFromTypeDistribution(newCode);
+ std::vector< MCAuto<DataArrayIdType> > newGeoTypesPerChunk(entriesOnSameDisc.size());
+ std::vector< const DataArrayIdType * > newGeoTypesPerChunk2(entriesOnSameDisc.size());
+ std::vector< MCAuto<DataArrayIdType> > newGeoTypesPerChunk_bis(entriesOnSameDisc.size());
+ std::vector< const DataArrayIdType * > newGeoTypesPerChunk3(entriesOnSameDisc.size());
+ MCAuto<DataArrayIdType> newGeoTypesPerChunk4=DataArrayIdType::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi);
int id=0;
for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++,id++)
{
- int startOfEltIdOfChunk=(*it)->_start;
- MCAuto<DataArrayInt> newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval);
- MCAuto<DataArrayInt> rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges);
- MCAuto<DataArrayInt> idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges);
+ mcIdType startOfEltIdOfChunk=(*it)->_start;
+ MCAuto<DataArrayIdType> newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval);
+ MCAuto<DataArrayIdType> rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges);
+ MCAuto<DataArrayIdType> idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges);
//
- MCAuto<DataArrayInt> tmp=rangeIdsForChunk->duplicateEachTupleNTimes(nbi); rangeIdsForChunk->rearrange(nbi);
+ MCAuto<DataArrayIdType> tmp=rangeIdsForChunk->duplicateEachTupleNTimes(nbi); rangeIdsForChunk->rearrange(nbi);
newGeoTypesPerChunk4->setPartOfValues1(tmp,(*it)->_tmp_work1-offset,(*it)->_tmp_work1+(*it)->_nval*nbi-offset,1,0,nbi,1);
//
newGeoTypesPerChunk[id]=rangeIdsForChunk; newGeoTypesPerChunk2[id]=rangeIdsForChunk;
newGeoTypesPerChunk_bis[id]=idsInRrangeForChunk; newGeoTypesPerChunk3[id]=idsInRrangeForChunk;
}
- MCAuto<DataArrayInt> newGeoTypesEltIdsAllGather=DataArrayInt::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear();
- MCAuto<DataArrayInt> newGeoTypesEltIdsAllGather2=DataArrayInt::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear();
- MCAuto<DataArrayInt> diffVals=newGeoTypesEltIdsAllGather->getDifferentValues();
- MCAuto<DataArrayInt> renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel();
+ MCAuto<DataArrayIdType> newGeoTypesEltIdsAllGather=DataArrayIdType::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear();
+ MCAuto<DataArrayIdType> newGeoTypesEltIdsAllGather2=DataArrayIdType::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear();
+ MCAuto<DataArrayIdType> diffVals=newGeoTypesEltIdsAllGather->getDifferentValues();
+ MCAuto<DataArrayIdType> renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel();
//
- MCAuto<DataArrayInt> renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel();
+ MCAuto<DataArrayIdType> renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel();
//
MCAuto<DataArrayDouble> arrPart=arr->subArray(offset,offset+szTuples);
arrPart->renumberInPlace(renumTupleIds->begin());
- arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,arrPart->getNumberOfComponents(),1);
+ arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,ToIdType(arrPart->getNumberOfComponents()),1);
bool ret=false;
- const int *idIt=diffVals->begin();
+ const mcIdType *idIt=diffVals->begin();
std::list<const MEDFileFieldPerMeshPerTypePerDisc *> li(entriesOnSameDisc.begin(),entriesOnSameDisc.end());
- int offset2=0;
- for(int i=0;i<diffVals->getNumberOfTuples();i++,idIt++)
+ mcIdType offset2=0;
+ for(mcIdType i=0;i<diffVals->getNumberOfTuples();i++,idIt++)
{
- MCAuto<DataArrayInt> ids=newGeoTypesEltIdsAllGather->findIdsEqual(*idIt);
- MCAuto<DataArrayInt> subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end());
- int nbEntityElts=subIds->getNumberOfTuples();
+ MCAuto<DataArrayIdType> ids=newGeoTypesEltIdsAllGather->findIdsEqual(*idIt);
+ MCAuto<DataArrayIdType> subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end());
+ mcIdType nbEntityElts=subIds->getNumberOfTuples();
bool ret2;
MCAuto<MEDFileFieldPerMeshPerTypePerDisc> eltToAdd=MEDFileFieldPerMeshPerTypePerDisc::
NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIota(newCode[3*(*idIt)+1]),nbi,
* and corresponding entry erased from \a entriesOnSameDisc.
* \return a newly allocated chunk
*/
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayInt *idsOfMeshElt,
- bool isPfl, int nbi, int offset,
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayIdType *idsOfMeshElt,
+ bool isPfl, mcIdType nbi, mcIdType offset,
std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
MEDFileFieldGlobsReal& glob,
bool ¬InExisting)
{
- int nbMeshEntities=idsOfMeshElt->getNumberOfTuples();
+ mcIdType nbMeshEntities=idsOfMeshElt->getNumberOfTuples();
std::list< const MEDFileFieldPerMeshPerTypePerDisc *>::iterator it=entriesOnSameDisc.begin();
for(;it!=entriesOnSameDisc.end();it++)
{
else
if(!(*it)->_profile.empty())
{
- const DataArrayInt *pfl=glob.getProfile((*it)->_profile.c_str());
+ const DataArrayIdType *pfl=glob.getProfile((*it)->_profile.c_str());
if(pfl->isEqualWithoutConsideringStr(*idsOfMeshElt))
break;
}
return ret;
}
-void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- std::vector<int> pos=addNewEntryIfNecessary(field,offset,nbOfCells);
- for(std::vector<int>::const_iterator it=pos.begin();it!=pos.end();it++)
+ std::vector<mcIdType> pos=addNewEntryIfNecessary(field,offset,nbOfCells);
+ for(std::vector<mcIdType>::const_iterator it=pos.begin();it!=pos.end();it++)
_field_pm_pt_pd[*it]->assignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc);
}
* \param [in] nbOfEltsInWholeMesh nb of elts of type \a this->_geo_type in \b WHOLE mesh
* \param [in] mesh is the mesh coming from the MEDFileMesh instance in correspondence with the MEDFileField. The mesh inside the \a field is simply ignored.
*/
-void MEDFileFieldPerMeshPerTypeCommon::assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypeCommon::assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- std::vector<int> pos=addNewEntryIfNecessary(field,idsInPfl);
- for(std::vector<int>::const_iterator it=pos.begin();it!=pos.end();it++)
+ std::vector<mcIdType> pos=addNewEntryIfNecessary(field,idsInPfl);
+ for(std::vector<mcIdType>::const_iterator it=pos.begin();it!=pos.end();it++)
_field_pm_pt_pd[*it]->assignFieldProfile(isPflAlone,start,multiTypePfl,idsInPfl,locIds,nbOfEltsInWholeMesh,field,arr,mesh,glob,nasc);
}
-void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
+void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
{
_field_pm_pt_pd.resize(1);
_field_pm_pt_pd[0]=MEDFileFieldPerMeshPerTypePerDisc::New(this,ON_NODES,-3);
_field_pm_pt_pd[0]->assignNodeFieldNoProfile(start,field,arr,glob);
}
-void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- MCAuto<DataArrayInt> pfl2=pfl->deepCopy();
+ MCAuto<DataArrayIdType> pfl2=pfl->deepCopy();
if(!arr || !arr->isAllocated())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile : input array is null, or not allocated !");
_field_pm_pt_pd.resize(1);
_field_pm_pt_pd[0]->assignFieldProfile(true,start,pfl,pfl2,pfl2,-1,field,arr,0,glob,nasc);//mesh is not requested so 0 is send.
}
-std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells)
+std::vector<mcIdType> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells)
{
TypeOfField type=field->getTypeOfField();
if(type!=ON_GAUSS_PT)
{
int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0);
- int sz=_field_pm_pt_pd.size();
+ std::size_t sz=_field_pm_pt_pd.size();
bool found=false;
- for(int j=0;j<sz && !found;j++)
+ for(std::size_t j=0;j<sz && !found;j++)
{
if(_field_pm_pt_pd[j]->getLocId()==locIdToFind)
{
_field_pm_pt_pd.resize(sz+1);
_field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
}
- std::vector<int> ret(1,(int)sz);
+ std::vector<mcIdType> ret(1,(mcIdType)sz);
return ret;
}
else
{
- std::vector<int> ret2=addNewEntryIfNecessaryGauss(field,offset,nbOfCells);
- int sz2=ret2.size();
- std::vector<int> ret3(sz2);
- int k=0;
- for(int i=0;i<sz2;i++)
+ std::vector<mcIdType> ret2=addNewEntryIfNecessaryGauss(field,offset,nbOfCells);
+ std::size_t sz2=ret2.size();
+ std::vector<mcIdType> ret3(sz2);
+ mcIdType k=0;
+ for(std::size_t i=0;i<sz2;i++)
{
- int sz=_field_pm_pt_pd.size();
- int locIdToFind=ret2[i];
+ mcIdType sz=ToIdType(_field_pm_pt_pd.size());
+ mcIdType locIdToFind=ret2[i];
bool found=false;
- for(int j=0;j<sz && !found;j++)
+ for(mcIdType j=0;j<sz && !found;j++)
{
if(_field_pm_pt_pd[j]->getLocId()==locIdToFind)
{
- _field_pm_pt_pd[j]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
+ _field_pm_pt_pd[j]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,FromIdType<int>(locIdToFind));
ret3[k++]=j;
found=true;
}
if(!found)
{
_field_pm_pt_pd.resize(sz+1);
- _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
+ _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,FromIdType<int>(locIdToFind));
ret3[k++]=sz;
}
}
}
}
-std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells)
+std::vector<mcIdType> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells)
{
const MEDCouplingFieldDiscretization *disc=field->getDiscretization();
const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc);
if(!disc2)
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !");
- const DataArrayInt *da=disc2->getArrayOfDiscIds();
+ const DataArrayIdType *da=disc2->getArrayOfDiscIds();
if(!da)
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss (no profile) : no localization ids per cell array available ! The input Gauss node field is maybe invalid !");
- MCAuto<DataArrayInt> da2=da->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1);
- MCAuto<DataArrayInt> retTmp=da2->getDifferentValues();
+ MCAuto<DataArrayIdType> da2=da->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1);
+ MCAuto<DataArrayIdType> retTmp=da2->getDifferentValues();
if(retTmp->presenceOfValue(-1))
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !");
- std::vector<int> ret(retTmp->begin(),retTmp->end());
+ std::vector<mcIdType> ret(retTmp->begin(),retTmp->end());
return ret;
}
-std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells)
+std::vector<mcIdType> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells)
{
TypeOfField type=field->getTypeOfField();
if(type!=ON_GAUSS_PT)
{
int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0);
- int sz=_field_pm_pt_pd.size();
+ std::size_t sz=_field_pm_pt_pd.size();
bool found=false;
- for(int j=0;j<sz && !found;j++)
+ for(std::size_t j=0;j<sz && !found;j++)
{
if(_field_pm_pt_pd[j]->getLocId()==locIdToFind)
{
_field_pm_pt_pd.resize(sz+1);
_field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
}
- std::vector<int> ret(1,0);
+ std::vector<mcIdType> ret(1,0);
return ret;
}
else
{
- std::vector<int> ret2=addNewEntryIfNecessaryGauss(field,subCells);
- int sz2=ret2.size();
- std::vector<int> ret3(sz2);
- int k=0;
- for(int i=0;i<sz2;i++)
+ std::vector<mcIdType> ret2=addNewEntryIfNecessaryGauss(field,subCells);
+ std::size_t sz2=ret2.size();
+ std::vector<mcIdType> ret3(sz2);
+ mcIdType k=0;
+ for(std::size_t i=0;i<sz2;i++)
{
- int sz=_field_pm_pt_pd.size();
- int locIdToFind=ret2[i];
+ mcIdType sz=ToIdType(_field_pm_pt_pd.size());
+ mcIdType locIdToFind=ret2[i];
bool found=false;
- for(int j=0;j<sz && !found;j++)
+ for(mcIdType j=0;j<sz && !found;j++)
{
if(_field_pm_pt_pd[j]->getLocId()==locIdToFind)
{
}
}
-std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells)
+std::vector<mcIdType> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells)
{
const MEDCouplingFieldDiscretization *disc=field->getDiscretization();
const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc);
if(!disc2)
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !");
- const DataArrayInt *da=disc2->getArrayOfDiscIds();
+ const DataArrayIdType *da=disc2->getArrayOfDiscIds();
if(!da)
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : no localization ids per cell array available ! The input Gauss node field is maybe invalid !");
- MCAuto<DataArrayInt> da2=da->selectByTupleIdSafe(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples());
- MCAuto<DataArrayInt> retTmp=da2->getDifferentValues();
+ MCAuto<DataArrayIdType> da2=da->selectByTupleIdSafe(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples());
+ MCAuto<DataArrayIdType> retTmp=da2->getDifferentValues();
if(retTmp->presenceOfValue(-1))
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !");
- std::vector<int> ret(retTmp->begin(),retTmp->end());
+ std::vector<mcIdType> ret(retTmp->begin(),retTmp->end());
return ret;
}
}
}
-void MEDFileFieldPerMeshPerTypeCommon::fillFieldSplitedByType(std::vector< std::pair<int,int> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const
+void MEDFileFieldPerMeshPerTypeCommon::fillFieldSplitedByType(std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const
{
- int sz=_field_pm_pt_pd.size();
+ std::size_t sz=_field_pm_pt_pd.size();
dads.resize(sz); types.resize(sz); pfls.resize(sz); locs.resize(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
_field_pm_pt_pd[i]->getCoarseData(types[i],dads[i],pfls[i],locs[i]);
}
return _father->getMeshName();
}
-void MEDFileFieldPerMeshPerTypeCommon::getSizes(int& globalSz, int& nbOfEntries) const
+void MEDFileFieldPerMeshPerTypeCommon::getSizes(mcIdType& globalSz, mcIdType& nbOfEntries) const
{
for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
{
globalSz+=(*it)->getNumberOfTuples();
}
- nbOfEntries+=(int)_field_pm_pt_pd.size();
+ nbOfEntries+=(mcIdType)_field_pm_pt_pd.size();
}
-int MEDFileFieldPerMeshPerTypeCommon::getNumberOfComponents() const
+std::size_t MEDFileFieldPerMeshPerTypeCommon::getNumberOfComponents() const
{
return _father->getNumberOfComponents();
}
(*it1)->changeLocsRefsNamesGen(mapOfModif);
}
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(int locId)
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(mcIdType locId)
{
if(_field_pm_pt_pd.empty())
{
std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no localizations for geotype \"" << getGeoTypeRepr() << "\" !";
throw INTERP_KERNEL::Exception(oss.str());
}
- if(locId>=0 && locId<(int)_field_pm_pt_pd.size())
+ if(locId>=0 && locId<ToIdType(_field_pm_pt_pd.size()))
return _field_pm_pt_pd[locId];
std::ostringstream oss2; oss2 << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no such locId available (" << locId;
oss2 << ") for geometric type \"" << getGeoTypeRepr() << "\" It should be in [0," << _field_pm_pt_pd.size() << ") !";
return static_cast<MEDFileFieldPerMeshPerTypePerDisc*>(0);
}
-const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(int locId) const
+const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(mcIdType locId) const
{
if(_field_pm_pt_pd.empty())
{
std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no localizations for geotype \"" << getGeoTypeRepr() << "\" !";
throw INTERP_KERNEL::Exception(oss.str());
}
- if(locId>=0 && locId<(int)_field_pm_pt_pd.size())
+ if(locId>=0 && locId<ToIdType(_field_pm_pt_pd.size()))
return _field_pm_pt_pd[locId];
std::ostringstream oss2; oss2 << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no such locId available (" << locId;
oss2 << ") for geometric type \"" << getGeoTypeRepr() << "\" It should be in [0," << _field_pm_pt_pd.size() << ") !";
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypeCommon::locIdOfLeaf : not found such a leaf in this !");
}
-void MEDFileFieldPerMeshPerTypeCommon::fillValues(int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+void MEDFileFieldPerMeshPerTypeCommon::fillValues(mcIdType& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
int i=0;
for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++)
* \param [out] its - list of pair (start,stop) kept
* \return bool - false if the type of field \a tof is not contained in \a this.
*/
-bool MEDFileFieldPerMeshPerTypeCommon::keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& its)
+bool MEDFileFieldPerMeshPerTypeCommon::keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
bool ret(false);
std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > newPmPtPd;
if((*it)->getType()==tof)
{
newPmPtPd.push_back(*it);
- std::pair<int,int> bgEnd; bgEnd.first=(*it)->getStart(); bgEnd.second=(*it)->getEnd();
+ std::pair<mcIdType,mcIdType> bgEnd; bgEnd.first=(*it)->getStart(); bgEnd.second=(*it)->getEnd();
(*it)->setNewStart(globalNum);
globalNum=(*it)->getEnd();
its.push_back(bgEnd);
* \param [out] its - list of pair (start,stop) kept
* \return bool - false if the type of field \a tof is not contained in \a this.
*/
-bool MEDFileFieldPerMeshPerTypeCommon::keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& its)
+bool MEDFileFieldPerMeshPerTypeCommon::keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
if(_field_pm_pt_pd.size()<=idOfDisc)
return false;
MCAuto<MEDFileFieldPerMeshPerTypePerDisc> elt(_field_pm_pt_pd[idOfDisc]);
std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > newPmPtPd(1,elt);
- std::pair<int,int> bgEnd; bgEnd.first=_field_pm_pt_pd[idOfDisc]->getStart(); bgEnd.second=_field_pm_pt_pd[idOfDisc]->getEnd();
+ std::pair<mcIdType,mcIdType> bgEnd; bgEnd.first=_field_pm_pt_pd[idOfDisc]->getStart(); bgEnd.second=_field_pm_pt_pd[idOfDisc]->getEnd();
elt->setNewStart(globalNum);
globalNum=elt->getEnd();
its.push_back(bgEnd);
return true;
}
-void MEDFileFieldPerMeshPerTypeCommon::loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypeCommon::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc)
{
for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
(*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc);
return ret.retn();
}
-void MEDFileFieldPerMeshPerType::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
+void MEDFileFieldPerMeshPerType::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
{
if(_geo_type!=INTERP_KERNEL::NORM_ERROR)
{
INTERP_KERNEL::AutoPtr<char> locName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
med_geometry_type mgeoti;
med_entity_type menti(ConvertIntoMEDFileType(type,geoType,mgeoti));
- int nbProfiles(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),menti,mgeoti,pflName,locName));
+ med_int nbProfiles(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),menti,mgeoti,pflName,locName));
_field_pm_pt_pd.resize(nbProfiles);
for(int i=0;i<nbProfiles;i++)
{
}
if(type==ON_CELLS)
{
- int nbProfiles2(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,mgeoti,pflName,locName));
+ med_int nbProfiles2(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,mgeoti,pflName,locName));
for(int i=0;i<nbProfiles2;i++)
_field_pm_pt_pd.push_back(MEDFileFieldPerMeshPerTypePerDisc::NewOnRead(this,ON_GAUSS_NE,i,pd));
}
return ;
// dark side of the force.
{
- int nbProfiles1(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_FACE,mgeoti,pflName,locName));
- int nbProfiles2(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_EDGE,mgeoti,pflName,locName));
+ med_int nbProfiles1(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_FACE,mgeoti,pflName,locName));
+ med_int nbProfiles2(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_EDGE,mgeoti,pflName,locName));
if(nbProfiles1==0 && nbProfiles2==0)
return ;// OK definitely nothing in field
menti=nbProfiles1>=nbProfiles2?MED_DESCENDING_FACE:MED_DESCENDING_EDGE;//not enough words to describe the beauty
}
}
-MCAuto<MEDFileFieldPerMeshPerType> MEDFileFieldPerMeshPerType::Aggregate(int &start, const std::vector<std::pair<int,const MEDFileFieldPerMeshPerType *> >& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo)
+MCAuto<MEDFileFieldPerMeshPerType> MEDFileFieldPerMeshPerType::Aggregate(mcIdType &start, const std::vector<std::pair<int,const MEDFileFieldPerMeshPerType *> >& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo)
{
MCAuto<MEDFileFieldPerMeshPerType> ret(MEDFileFieldPerMeshPerType::New(father,gt));
std::map<TypeOfField, std::vector< std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc * > > > m;
_se.takeRef(se);
INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
INTERP_KERNEL::AutoPtr<char> locName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
- int nbProfiles(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,_se->getDynGT(),pflName,locName));
+ med_int nbProfiles(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,_se->getDynGT(),pflName,locName));
_field_pm_pt_pd.resize(nbProfiles);
for(int i=0;i<nbProfiles;i++)
{
return ret.retn();
}
-void MEDFileFieldPerMeshPerTypeDyn::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
+void MEDFileFieldPerMeshPerTypeDyn::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
{
throw INTERP_KERNEL::Exception("not implemented yet !");
}
mesh->getTime(_mesh_iteration,_mesh_order);
}
-void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(mcIdType& start, const std::vector<mcIdType>& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- int nbOfTypes=code.size()/3;
- int offset=0;
- for(int i=0;i<nbOfTypes;i++)
+ std::size_t nbOfTypes=code.size()/3;
+ mcIdType offset=0;
+ for(std::size_t i=0;i<nbOfTypes;i++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)code[3*i];
- int nbOfCells=code[3*i+1];
- int pos=addNewEntryIfNecessary(type);
+ mcIdType nbOfCells=code[3*i+1];
+ mcIdType pos=addNewEntryIfNecessary(type);
_field_pm_pt[pos]->assignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc);
offset+=nbOfCells;
}
* \param [in] idsPerType is a vector containing the profiles needed to be created for MED file format. \b WARNING these processed MED file profiles can be subdivided again in case of Gauss points.
* \param [in] mesh is the mesh coming from the MEDFileMesh instance in correspondence with the MEDFileField. The mesh inside the \a field is simply ignored.
*/
-void MEDFileFieldPerMesh::assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<int>& code2, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMesh::assignFieldProfile(mcIdType& start, const DataArrayIdType *multiTypePfl, const std::vector<mcIdType>& code, const std::vector<mcIdType>& code2, const std::vector<DataArrayIdType *>& idsInPflPerType, const std::vector<DataArrayIdType *>& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- int nbOfTypes(code.size()/3);
- for(int i=0;i<nbOfTypes;i++)
+ std::size_t nbOfTypes(code.size()/3);
+ for(std::size_t i=0;i<nbOfTypes;i++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)code[3*i];
- int pos=addNewEntryIfNecessary(type);
- DataArrayInt *pfl=0;
+ mcIdType pos=addNewEntryIfNecessary(type);
+ DataArrayIdType *pfl=0;
if(code[3*i+2]!=-1)
pfl=idsPerType[code[3*i+2]];
- int nbOfTupes2=code2.size()/3;
- int found=0;
+ std::size_t nbOfTupes2=code2.size()/3;
+ std::size_t found=0;
for(;found<nbOfTupes2;found++)
if(code[3*i]==code2[3*found])
break;
}
}
-void MEDFileFieldPerMesh::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
+void MEDFileFieldPerMesh::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
{
- int pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
+ mcIdType pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
_field_pm_pt[pos]->assignNodeFieldNoProfile(start,field,arr,glob);
}
-void MEDFileFieldPerMesh::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMesh::assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- int pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
+ mcIdType pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
_field_pm_pt[pos]->assignNodeFieldProfile(start,pfl,field,arr,glob,nasc);
}
-void MEDFileFieldPerMesh::loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMesh::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc)
{
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
(*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc);
void MEDFileFieldPerMesh::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const
{
- int nbOfTypes=_field_pm_pt.size();
- for(int i=0;i<nbOfTypes;i++)
+ std::size_t nbOfTypes=_field_pm_pt.size();
+ for(std::size_t i=0;i<nbOfTypes;i++)
{
_field_pm_pt[i]->copyOptionsFrom(*this);
_field_pm_pt[i]->writeLL(fid,nasc);
(*it)->fillTypesOfFieldAvailable(types);
}
-std::vector< std::vector< std::pair<int,int> > > MEDFileFieldPerMesh::getFieldSplitedByType(std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> > & locs) const
+std::vector< std::vector< std::pair<mcIdType,mcIdType> > > MEDFileFieldPerMesh::getFieldSplitedByType(std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> > & locs) const
{
- int sz=_field_pm_pt.size();
- std::vector< std::vector<std::pair<int,int> > > ret(sz);
+ std::size_t sz=_field_pm_pt.size();
+ std::vector< std::vector<std::pair<mcIdType,mcIdType> > > ret(sz);
types.resize(sz); typesF.resize(sz); pfls.resize(sz); locs.resize(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
types[i]=_field_pm_pt[i]->getGeoType();
_field_pm_pt[i]->fillFieldSplitedByType(ret[i],typesF[i],pfls[i],locs[i]);
return _father->getOrder();
}
-int MEDFileFieldPerMesh::getNumberOfComponents() const
+std::size_t MEDFileFieldPerMesh::getNumberOfComponents() const
{
return _father->getNumberOfComponents();
}
* - 'notNullPfls' contains sz2 values that are extracted from 'pfls' in which null profiles have been removed.
* 'code' and 'notNullPfls' are in MEDCouplingUMesh::checkTypeConsistencyAndContig format.
*/
-void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& locs, std::vector<int>& code, std::vector<DataArrayInt *>& notNullPfls)
+void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<const DataArrayIdType *>& pfls, const std::vector<int>& locs, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& notNullPfls)
{
int notNullPflsSz=0;
- int nbOfArrs=geoTypes.size();
- for(int i=0;i<nbOfArrs;i++)
+ std::size_t nbOfArrs=geoTypes.size();
+ for(std::size_t i=0;i<nbOfArrs;i++)
if(pfls[i])
notNullPflsSz++;
std::set<INTERP_KERNEL::NormalizedCellType> geoTypes3(geoTypes.begin(),geoTypes.end());
- int nbOfDiffGeoTypes=geoTypes3.size();
+ std::size_t nbOfDiffGeoTypes=geoTypes3.size();
code.resize(3*nbOfDiffGeoTypes);
notNullPfls.resize(notNullPflsSz);
notNullPflsSz=0;
- int j=0;
- for(int i=0;i<nbOfDiffGeoTypes;i++)
+ std::size_t j=0;
+ for(std::size_t i=0;i<nbOfDiffGeoTypes;i++)
{
- int startZone=j;
+ std::size_t startZone=j;
INTERP_KERNEL::NormalizedCellType refType=geoTypes[j];
- std::vector<const DataArrayInt *> notNullTmp;
+ std::vector<const DataArrayIdType *> notNullTmp;
if(pfls[j])
notNullTmp.push_back(pfls[j]);
j++;
}
else
break;
- std::vector< std::pair<int,int> > tmpDads(dads.begin()+startZone,dads.begin()+j);
- std::vector<const DataArrayInt *> tmpPfls(pfls.begin()+startZone,pfls.begin()+j);
+ std::vector< std::pair<mcIdType,mcIdType> > tmpDads(dads.begin()+startZone,dads.begin()+j);
+ std::vector<const DataArrayIdType *> tmpPfls(pfls.begin()+startZone,pfls.begin()+j);
std::vector<int> tmpLocs(locs.begin()+startZone,locs.begin()+j);
- code[3*i]=(int)refType;
+ code[3*i]=(mcIdType)refType;
std::vector<INTERP_KERNEL::NormalizedCellType> refType2(1,refType);
code[3*i+1]=ComputeNbOfElems(glob,type,refType2,tmpDads,tmpLocs);
if(notNullTmp.empty())
code[3*i+2]=-1;
else
{
- notNullPfls[notNullPflsSz]=DataArrayInt::Aggregate(notNullTmp);
+ notNullPfls[notNullPflsSz]=DataArrayIdType::Aggregate(notNullTmp);
code[3*i+2]=notNullPflsSz++;
}
}
/*!
* 'dads' 'geoTypes' and 'locs' are input parameters that should have same size sz. sz should be >=1.
*/
-int MEDFileFieldPerMesh::ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs)
+mcIdType MEDFileFieldPerMesh::ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs)
{
- int sz=dads.size();
- int ret=0;
- for(int i=0;i<sz;i++)
+ std::size_t sz=dads.size();
+ mcIdType ret=0;
+ for(std::size_t i=0;i<sz;i++)
{
if(locs[i]==-1)
{
_field_pm_pt[0]=DynamicCast<MEDFileFieldPerMeshPerType,MEDFileFieldPerMeshPerTypeCommon>(pt2);
}
-bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
+bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N,
MEDFileFieldGlobsReal& glob)
{
if(getMeshName()!=meshName)
return false;
std::set<INTERP_KERNEL::NormalizedCellType> typesToKeep;
for(std::size_t i=0;i<oldCode.size()/3;i++) typesToKeep.insert((INTERP_KERNEL::NormalizedCellType)oldCode[3*i]);
- std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > entries;
+ std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > entries;
std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> entriesKept;
std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> otherEntries;
getUndergroundDataArrayExt(entries);
DataArrayDouble *arr(dynamic_cast<DataArrayDouble *>(arr0));//tony
if(!arr0)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArray storing values is double ! Not managed for the moment !");
- int sz=0;
+ mcIdType sz=0;
if(!arr)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArrayDouble storing values of field is null !");
- for(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >::const_iterator it=entries.begin();it!=entries.end();it++)
+ for(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >::const_iterator it=entries.begin();it!=entries.end();it++)
{
if(typesToKeep.find((*it).first.first)!=typesToKeep.end())
{
else
otherEntries.push_back(getLeafGivenTypeAndLocId((*it).first.first,(*it).first.second));
}
- MCAuto<DataArrayInt> renumDefrag=DataArrayInt::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero();
+ MCAuto<DataArrayIdType> renumDefrag=DataArrayIdType::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero();
////////////////////
- MCAuto<DataArrayInt> explicitIdsOldInMesh=DataArrayInt::New(); explicitIdsOldInMesh->alloc(sz,1);//sz is a majorant of the real size. A realloc will be done after
- int *workI2=explicitIdsOldInMesh->getPointer();
- int sz1=0,sz2=0,sid=1;
+ MCAuto<DataArrayIdType> explicitIdsOldInMesh=DataArrayIdType::New(); explicitIdsOldInMesh->alloc(sz,1);//sz is a majorant of the real size. A realloc will be done after
+ mcIdType *workI2=explicitIdsOldInMesh->getPointer();
+ mcIdType sz1=0,sz2=0,sid=1;
std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptML=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKept);
// std::vector<int> tupleIdOfStartOfNewChuncksV(entriesKeptML.size());
for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator itL1=entriesKeptML.begin();itL1!=entriesKeptML.end();itL1++,sid++)
{
// tupleIdOfStartOfNewChuncksV[sid-1]=sz2;
- MCAuto<DataArrayInt> explicitIdsOldInArr=DataArrayInt::New(); explicitIdsOldInArr->alloc(sz,1);
- int *workI=explicitIdsOldInArr->getPointer();
+ MCAuto<DataArrayIdType> explicitIdsOldInArr=DataArrayIdType::New(); explicitIdsOldInArr->alloc(sz,1);
+ mcIdType *workI=explicitIdsOldInArr->getPointer();
for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator itL2=(*itL1).begin();itL2!=(*itL1).end();itL2++)
{
- int delta1=(*itL2)->fillTupleIds(workI); workI+=delta1; sz1+=delta1;
+ mcIdType delta1=(*itL2)->fillTupleIds(workI); workI+=delta1; sz1+=delta1;
(*itL2)->setLocId(sz2);
(*itL2)->_tmp_work1=(*itL2)->getStart();
- int delta2=(*itL2)->fillEltIdsFromCode(sz2,oldCode,glob,workI2); workI2+=delta2; sz2+=delta2;
+ mcIdType delta2=(*itL2)->fillEltIdsFromCode(sz2,oldCode,glob,workI2); workI2+=delta2; sz2+=delta2;
}
renumDefrag->setPartOfValuesSimple3(sid,explicitIdsOldInArr->begin(),explicitIdsOldInArr->end(),0,1,1);
}
explicitIdsOldInMesh->reAlloc(sz2);
- int tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2;
+ mcIdType tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2;
////////////////////
- MCAuto<DataArrayInt> permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0;
+ MCAuto<DataArrayIdType> permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0;
// perform redispatching of non concerned MEDFileFieldPerMeshPerTypePerDisc
std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > otherEntriesNew;
for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=otherEntries.begin();it!=otherEntries.end();it++)
for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesKept.begin();it!=entriesKept.end();it++)
{
MCAuto<MEDFileFieldPerMeshPerTypePerDisc> elt=MEDFileFieldPerMeshPerTypePerDisc::New(*(*it));
- int newStart=elt->getLocId();
+ mcIdType newStart=elt->getLocId();
elt->setLocId((*it)->getGeoType());
elt->setNewStart(newStart);
elt->_tmp_work1=permArrDefrag->getIJ(elt->_tmp_work1,0);
}
MCAuto<DataArrayDouble> arr2=arr->renumber(permArrDefrag->getConstPointer());
// perform redispatching of concerned MEDFileFieldPerMeshPerTypePerDisc -> values are in arr2
- MCAuto<DataArrayInt> explicitIdsNewInMesh=renumO2N->selectByTupleId(explicitIdsOldInMesh->begin(),explicitIdsOldInMesh->end());
+ MCAuto<DataArrayIdType> explicitIdsNewInMesh=renumO2N->selectByTupleId(explicitIdsOldInMesh->begin(),explicitIdsOldInMesh->end());
std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptPerDisc=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKeptNew2);
bool ret=false;
for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator it4=entriesKeptPerDisc.begin();it4!=entriesKeptPerDisc.end();it4++)
* \param [in,out] globalNum a global numbering counter for the renumbering.
* \param [out] its - list of pair (start,stop) kept
*/
-void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& its)
+void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > ret;
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- std::vector< std::pair<int,int> > its2;
+ std::vector< std::pair<mcIdType,mcIdType> > its2;
if((*it)->keepOnlySpatialDiscretization(tof,globalNum,its2))
{
ret.push_back(*it);
* \param [in,out] globalNum a global numbering counter for the renumbering.
* \param [out] its - list of pair (start,stop) kept
*/
-void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& its)
+void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > ret;
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- std::vector< std::pair<int,int> > its2;
+ std::vector< std::pair<mcIdType,mcIdType> > its2;
if((*it)->keepOnlyGaussDiscretization(idOfDisc,globalNum,its2))
{
ret.push_back(*it);
if(_field_pm_pt.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !");
//
- std::vector< std::pair<int,int> > dads;
- std::vector<const DataArrayInt *> pfls;
- std::vector<DataArrayInt *> notNullPflsPerGeoType;
- std::vector<int> locs,code;
+ std::vector< std::pair<mcIdType,mcIdType> > dads;
+ std::vector<const DataArrayIdType *> pfls;
+ std::vector<DataArrayIdType *> notNullPflsPerGeoType;
+ std::vector<int> locs;
+ std::vector<mcIdType>code;
std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes;
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
(*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes);
throw INTERP_KERNEL::Exception(oss.str());
}
//
- std::vector< MCAuto<DataArrayInt> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
- std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ std::vector< MCAuto<DataArrayIdType> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ std::vector< const DataArrayIdType *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
if(type!=ON_NODES)
{
- DataArrayInt *arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3);
+ DataArrayIdType *arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3);
if(!arr)
return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc);
else
{
- MCAuto<DataArrayInt> arr2(arr);
+ MCAuto<DataArrayIdType> arr2(arr);
return finishField2(type,glob,dads,locs,geoTypes,mesh,arr,isPfl,arrOut,nasc);
}
}
{
if(code.size()!=3)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : internal error #1 !");
- int nb=code[1];
+ mcIdType nb=code[1];
if(code[2]==-1)
{
if(nb!=mesh->getNumberOfNodes())
}
}
-DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const
+DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const
{
if(_field_pm_pt.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !");
//
- std::vector<std::pair<int,int> > dads;
- std::vector<const DataArrayInt *> pfls;
- std::vector<DataArrayInt *> notNullPflsPerGeoType;
- std::vector<int> locs,code;
+ std::vector<std::pair<mcIdType,mcIdType> > dads;
+ std::vector<const DataArrayIdType *> pfls;
+ std::vector<DataArrayIdType *> notNullPflsPerGeoType;
+ std::vector<int> locs;
+ std::vector<mcIdType> code;
std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes;
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
(*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes);
std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl : " << "The field \"" << nasc.getName() << "\" exists but not with such spatial discretization or such dimension specified !";
throw INTERP_KERNEL::Exception(oss.str());
}
- std::vector< MCAuto<DataArrayInt> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
- std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ std::vector< MCAuto<DataArrayIdType> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ std::vector< const DataArrayIdType *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
if(type!=ON_NODES)
{
- MCAuto<DataArrayInt> arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3);
+ MCAuto<DataArrayIdType> arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3);
return finishField4(dads,arr,mesh->getNumberOfCells(),pfl);
}
else
{
if(code.size()!=3)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : internal error #1 !");
- int nb=code[1];
+ mcIdType nb=code[1];
if(code[2]==-1)
{
if(nb!=mesh->getNumberOfNodes())
}
}
-void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
- int globalSz=0;
- int nbOfEntries=0;
+ mcIdType globalSz=0;
+ mcIdType nbOfEntries=0;
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
(*it)->getSizes(globalSz,nbOfEntries);
}
}
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId)
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId)
{
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
throw INTERP_KERNEL::Exception(oss.str());
}
-const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const
+const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId) const
{
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
* \param [in] dts - (Distribution of types) = level 1 : meshes to aggregate. Level 2 : all geo type. Level 3 pair specifying geo type and number of elem in geotype.
* \param [out] extractInfo - Gives information about the where the data comes from. It is a vector of triplet. First element in the triplet the mesh pos. The 2nd one the start pos. The 3rd the end pos.
*/
-MCAuto<MEDFileFieldPerMeshPerTypePerDisc> MEDFileFieldPerMeshPerTypePerDisc::Aggregate(int &start, const std::vector< std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo)
+MCAuto<MEDFileFieldPerMeshPerTypePerDisc> MEDFileFieldPerMeshPerTypePerDisc::Aggregate(mcIdType &start, const std::vector< std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo)
{
MCAuto<MEDFileFieldPerMeshPerTypePerDisc> ret(new MEDFileFieldPerMeshPerTypePerDisc(father,tof));
if(pms.empty())
INTERP_KERNEL::NormalizedCellType gt(pms[0].second->getGeoType());
std::size_t i(0);
std::vector< std::pair<int,int> > filteredDTS;
- for(std::vector< std::vector< std::pair<int,int> > >::const_iterator it=dts.begin();it!=dts.end();it++,i++)
- for(std::vector< std::pair<int,int> >::const_iterator it2=(*it).begin();it2!=(*it).end();it2++)
+ for(std::vector< std::vector< std::pair<int,mcIdType> > >::const_iterator it=dts.begin();it!=dts.end();it++,i++)
+ for(std::vector< std::pair<int,mcIdType> >::const_iterator it2=(*it).begin();it2!=(*it).end();it2++)
if((*it2).first==gt)
filteredDTS.push_back(std::pair<int,int>(i,(*it2).second));
if(pms.size()!=filteredDTS.size())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : not implemented yet for generated profiles !");
std::vector<std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator it1(pms.begin());
std::vector< std::pair<int,int> >::const_iterator it2(filteredDTS.begin());
- int zeStart(start),nval(0);
+ mcIdType zeStart(start),nval(0);
for(;it1!=pms.end();it1++,it2++)
{
if((*it1).first!=(*it2).first)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : not implemented yet for generated profiles 2 !");
- int s1((*it1).second->getStart()),e1((*it1).second->getEnd());
+ mcIdType s1((*it1).second->getStart()),e1((*it1).second->getEnd());
extractInfo.push_back(std::pair<int, std::pair<int,int> >((*it1).first,std::pair<int,int>(s1,e1)));
start+=e1-s1;
nval+=((*it1).second)->getNumberOfVals();
return ret;
}
-MCAuto<MEDFileFieldPerMesh> MEDFileFieldPerMesh::Aggregate(int &start, const std::vector<const MEDFileFieldPerMesh *>& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo)
+MCAuto<MEDFileFieldPerMesh> MEDFileFieldPerMesh::Aggregate(mcIdType &start, const std::vector<const MEDFileFieldPerMesh *>& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo)
{
MCAuto<MEDFileFieldPerMesh> ret(new MEDFileFieldPerMesh(father,pms[0]->getMeshName(),pms[0]->getMeshIteration(),pms[0]->getMeshOrder()));
std::map<INTERP_KERNEL::NormalizedCellType, std::vector< std::pair<int,const MEDFileFieldPerMeshPerType *> > > m;
int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type)
{
int i=0;
- int pos=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,type));
+ std::size_t pos=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,type));
std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it2=_field_pm_pt.begin();
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++)
{
return i;
else
{
- int pos2=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,curType));
+ std::size_t pos2=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,curType));
if(pos>pos2)
it2=it+1;
}
}
- int ret=std::distance(_field_pm_pt.begin(),it2);
+ std::size_t ret=std::distance(_field_pm_pt.begin(),it2);
_field_pm_pt.insert(it2,MEDFileFieldPerMeshPerType::New(this,type));
- return ret;
+ return (int)ret;
}
/*!
* \param [in] mesh is \b NOT the global mesh, but the possibly reduced mesh. \a mesh parameter will be directly aggregated in the returned field
*/
MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
- const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
+ const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs,
const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
isPfl=false;
da->setName("");
if(type==ON_GAUSS_PT)
{
- int offset=0;
- int nbOfArrs=dads.size();
- for(int i=0;i<nbOfArrs;i++)
+ mcIdType offset=0;
+ std::size_t nbOfArrs=dads.size();
+ for(std::size_t i=0;i<nbOfArrs;i++)
{
- std::vector<std::pair<int,int> > dads2(1,dads[i]); const std::vector<int> locs2(1,locs[i]);
+ std::vector<std::pair<mcIdType,mcIdType> > dads2(1,dads[i]); const std::vector<int> locs2(1,locs[i]);
const std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes2(1,INTERP_KERNEL::NORM_ERROR);
- int nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2);
- MCAuto<DataArrayInt> di=DataArrayInt::New();
+ mcIdType nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2);
+ MCAuto<DataArrayIdType> di=DataArrayIdType::New();
di->alloc(nbOfElems,1);
di->iota(offset);
const MEDFileFieldLoc& fl=glob->getLocalizationFromId(locs[i]);
* \param [in] mesh is the global mesh.
*/
MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
- const std::vector<std::pair<int,int> >& dads, const std::vector<int>& locs,
+ const std::vector<std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs,
const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+ const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
if(da->isIota(mesh->getNumberOfCells()))
return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc);
* This method is the complement of MEDFileFieldPerMesh::finishField2 method except that this method works for node profiles.
*/
MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileFieldGlobsReal *glob,
- const std::vector<std::pair<int,int> >& dads, const std::vector<int>& locs,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+ const std::vector<std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs,
+ const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
if(da->isIota(mesh->getNumberOfNodes()))
return finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc);
if(meshu->getNodalConnectivity()==0)
{
MCAuto<MEDCouplingFieldDouble> ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl,arrOut,nasc);
- int nb=da->getNbOfElems();
- const int *ptr=da->getConstPointer();
+ mcIdType nb=da->getNbOfElems();
+ const mcIdType *ptr=da->getConstPointer();
MEDCouplingUMesh *meshuc=const_cast<MEDCouplingUMesh *>(meshu);
meshuc->allocateCells(nb);
- for(int i=0;i<nb;i++)
+ for(mcIdType i=0;i<nb;i++)
meshuc->insertNextCell(INTERP_KERNEL::NORM_POINT1,1,ptr+i);
meshuc->finishInsertingCells();
ret->setMesh(meshuc);
//
MCAuto<MEDCouplingFieldDouble> ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc);
isPfl=true;
- DataArrayInt *arr2=0;
- MCAuto<DataArrayInt> cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
+ DataArrayIdType *arr2=0;
+ MCAuto<DataArrayIdType> cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
MCAuto<MEDCouplingMesh> mesh2=mesh->buildPartAndReduceNodes(cellIds->getConstPointer(),cellIds->getConstPointer()+cellIds->getNbOfElems(),arr2);
- MCAuto<DataArrayInt> arr3(arr2);
- int nnodes=mesh2->getNumberOfNodes();
- if(nnodes==(int)da->getNbOfElems())
+ MCAuto<DataArrayIdType> arr3(arr2);
+ mcIdType nnodes=mesh2->getNumberOfNodes();
+ if(nnodes==(mcIdType)da->getNbOfElems())
{
- MCAuto<DataArrayInt> da3=da->transformWithIndArrR(arr2->begin(),arr2->end());
+ MCAuto<DataArrayIdType> da3=da->transformWithIndArrR(arr2->begin(),arr2->end());
arrOut->renumberInPlace(da3->getConstPointer());
mesh2->setName(mesh->getName().c_str());
ret->setMesh(mesh2);
/*!
* This method is the most light method of field retrieving.
*/
-DataArray *MEDFileFieldPerMesh::finishField4(const std::vector<std::pair<int,int> >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const
+DataArray *MEDFileFieldPerMesh::finishField4(const std::vector<std::pair<mcIdType,mcIdType> >& dads, const DataArrayIdType *pflIn, mcIdType nbOfElems, DataArrayIdType *&pflOut) const
{
if(!pflIn)
{
- pflOut=DataArrayInt::New();
+ pflOut=DataArrayIdType::New();
pflOut->alloc(nbOfElems,1);
pflOut->iota(0);
}
else
{
- pflOut=const_cast<DataArrayInt*>(pflIn);
+ pflOut=const_cast<DataArrayIdType*>(pflIn);
pflOut->incrRef();
}
- MCAuto<DataArrayInt> safePfl(pflOut);
+ MCAuto<DataArrayIdType> safePfl(pflOut);
MCAuto<DataArray> da=getOrCreateAndGetArray()->selectByTupleRanges(dads);
const std::vector<std::string>& infos=getInfo();
- int nbOfComp=infos.size();
- for(int i=0;i<nbOfComp;i++)
+ std::size_t nbOfComp=infos.size();
+ for(std::size_t i=0;i<nbOfComp;i++)
da->setInfoOnComponent(i,infos[i].c_str());
safePfl->incrRef();
return da.retn();
INTERP_KERNEL::AutoCppPtr<MFFPMIter> iter0(MFFPMIter::NewCell(entities));
for(iter0->begin();!iter0->finished();iter0->next())
{
- int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL ,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
+ med_int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL ,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
std::string name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
- int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
+ med_int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
std::string name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
if(nbProfile>0 || nbProfile2>0)
{
}
if(MFFPMIter::IsPresenceOfNode(entities))
{
- int nbProfile(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,meshCsit+1,meshName,pflName,locName));
+ med_int nbProfile(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,meshCsit+1,meshName,pflName,locName));
if(nbProfile>0)
{
const PartDefinition *pd(0);
std::vector<int> dynGT(entities->getDynGTAvail());
for(std::vector<int>::const_iterator it=dynGT.begin();it!=dynGT.end();it++)
{
- int nbPfl(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,*it,pflName,locName));
+ med_int nbPfl(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,*it,pflName,locName));
if(nbPfl>0)
{
_field_pm_pt.push_back(MEDFileFieldPerMeshPerTypeDyn::NewOnRead(fid,this,entities,*it,nasc));
iter0=MFFPMIter::NewCell(entities);
for(iter0->begin();!iter0->finished();iter0->next())
{
- int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_FACE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
+ med_int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_FACE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
std::string name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
- int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_EDGE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
+ med_int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_EDGE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
std::string name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
if(nbProfile>0 || nbProfile2>0)
{
{
public:
static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd);
- static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId);
+ static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId);
static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other);
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDFileFieldPerMeshPerTypePerDisc *deepCopy(MEDFileFieldPerMeshPerTypeCommon *father) const;
- void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob);
- void getCoarseData(TypeOfField& type, std::pair<int,int>& dad, std::string& pfl, std::string& loc) const;
+ void assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob);
+ void getCoarseData(TypeOfField& type, std::pair<mcIdType,mcIdType>& dad, std::string& pfl, std::string& loc) const;
void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
const MEDFileFieldPerMeshPerTypeCommon *getFather() const;
- void loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc);
+ void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc);
void loadBigArray(med_idt fid, const MEDFileFieldNameScope& nasc);
- void setNewStart(int newValueOfStart);
+ void setNewStart(mcIdType newValueOfStart);
int getIteration() const;
int getOrder() const;
double getTime() const;
void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
void setType(TypeOfField newType);
INTERP_KERNEL::NormalizedCellType getGeoType() const;
- int getNumberOfComponents() const;
- int getNumberOfTuples() const;
- int getStart() const { return _start; }
- int getEnd() const { return _end; }
- void setEnd(int endd) { _end=endd; }
- int getNumberOfVals() const { return _nval; }
- void incrementNbOfVals(int deltaNbVal);
+ std::size_t getNumberOfComponents() const;
+ mcIdType getNumberOfTuples() const;
+ mcIdType getStart() const { return _start; }
+ mcIdType getEnd() const { return _end; }
+ void setEnd(mcIdType endd) { _end=endd; }
+ mcIdType getNumberOfVals() const { return _nval; }
+ void incrementNbOfVals(mcIdType deltaNbVal);
DataArray *getOrCreateAndGetArray();
const DataArray *getOrCreateAndGetArray() const;
const std::vector<std::string>& getInfo() const;
void setProfile(const std::string& newPflName);
std::string getLocalization() const;
void setLocalization(const std::string& newLocName);
- int getLocId() const { return _loc_id; }
- void setLocId(int newId) const { _loc_id=newId; }
+ mcIdType getLocId() const { return _loc_id; }
+ void setLocId(mcIdType newId) const { _loc_id=newId; }
void setFather(MEDFileFieldPerMeshPerTypeCommon *newFather) { _father=newFather; }
void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
- void getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs,
+ void getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs,
std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
- void fillValues(int discId, int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
- int fillEltIdsFromCode(int offset, const std::vector<int>& codeOfMesh, const MEDFileFieldGlobsReal& glob, int *ptToFill) const;
- int fillTupleIds(int *ptToFill) const;
- static int ConvertType(TypeOfField type, int locId);
+ void fillValues(int discId, mcIdType& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
+ mcIdType fillEltIdsFromCode(mcIdType offset, const std::vector<mcIdType>& codeOfMesh, const MEDFileFieldGlobsReal& glob, mcIdType *ptToFill) const;
+ mcIdType fillTupleIds(mcIdType *ptToFill) const;
+ static int ConvertType(TypeOfField type, mcIdType locId);
static std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > SplitPerDiscretization(const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entries);
- static bool RenumberChunks(int offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
- const DataArrayInt *explicitIdsInMesh, const std::vector<int>& newCode,
+ static bool RenumberChunks(mcIdType offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
+ const DataArrayIdType *explicitIdsInMesh, const std::vector<mcIdType>& newCode,
MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >& result);
- static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayInt *idsOfMeshElt,
- bool isPfl, int nbi, int offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
+ static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayIdType *idsOfMeshElt,
+ bool isPfl, mcIdType nbi, mcIdType offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
MEDFileFieldGlobsReal& glob, bool ¬InExisting);
- static MCAuto<MEDFileFieldPerMeshPerTypePerDisc> Aggregate(int &start, const std::vector<std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo);
+ static MCAuto<MEDFileFieldPerMeshPerTypePerDisc> Aggregate(mcIdType &start, const std::vector<std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo);
MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type):_type(type),_father(fath),_start(-1),_end(-1),_nval(-1),_loc_id(-5),_profile_it(-1) { }
private:
- MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd);
- MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const std::string& dummy);
+ MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const PartDefinition *pd);
+ MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const std::string& dummy);
MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other);
MEDFileFieldPerMeshPerTypePerDisc();
private:
private:
TypeOfField _type;
MEDFileFieldPerMeshPerTypeCommon *_father;
- int _start;
- int _end;
+ mcIdType _start;
+ mcIdType _end;
//! _nval is different than end-start in case of ON_GAUSS_PT and ON_GAUSS_NE ! (_nval=(_end-_start)/nbi)
- int _nval;
+ mcIdType _nval;
std::string _profile;
std::string _localization;
//! only on assignment -3 : ON_NODES, -2 : ON_CELLS, -1 : ON_GAUSS_NE, 0..* : ON_GAUSS_PT
- mutable int _loc_id;
- mutable int _profile_it;
+ mutable mcIdType _loc_id;
+ mutable mcIdType _profile_it;
MCAuto<PartDefinition> _pd;
public:
- mutable int _tmp_work1;
+ mutable mcIdType _tmp_work1;
};
class MEDFileFieldVisitor;
public:
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
- void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
- void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
+ void assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
const MEDFileFieldPerMesh *getFather() const;
- void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc);
+ void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc);
void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
bool isUniqueLevel(int& dim) const;
void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
- void fillFieldSplitedByType(std::vector< std::pair<int,int> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const;
+ void fillFieldSplitedByType(std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const;
int getIteration() const;
int getOrder() const;
double getTime() const;
std::string getMeshName() const;
- void getSizes(int& globalSz, int& nbOfEntries) const;
- int getNumberOfComponents() const;
+ void getSizes(mcIdType& globalSz, mcIdType& nbOfEntries) const;
+ std::size_t getNumberOfComponents() const;
bool presenceOfMultiDiscPerGeoType() const;
void pushDiscretization(MEDFileFieldPerMeshPerTypePerDisc *disc);
DataArray *getOrCreateAndGetArray();
std::vector<std::string> getLocsReallyUsedMulti() const;
void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
- MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId);
- const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) const;
- int getNumberOfLoc() const { return _field_pm_pt_pd.size(); }
+ MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(mcIdType locId);
+ const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(mcIdType locId) const;
+ int getNumberOfLoc() const { return (int)_field_pm_pt_pd.size(); }
int locIdOfLeaf(const MEDFileFieldPerMeshPerTypePerDisc *leaf) const;
- void fillValues(int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ void fillValues(mcIdType& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
void setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves);
- bool keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& its);
- bool keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& its);
+ bool keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its);
+ bool keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its);
static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType);
MEDFileFieldPerMeshPerTypeCommon(MEDFileFieldPerMesh *father):_father(father) { }
void setFather(MEDFileFieldPerMesh *father);
virtual void simpleRepr(int bkOffset, std::ostream& oss, int id) const = 0;
virtual std::string getGeoTypeRepr() const = 0;
virtual MEDFileFieldPerMeshPerTypeCommon *deepCopy(MEDFileFieldPerMesh *father) const = 0;
- virtual void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const = 0;
+ virtual void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const = 0;
protected:
void deepCopyElements();
- std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells);
- std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells);
- std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells);
- std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells);
+ std::vector<mcIdType> addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells);
+ std::vector<mcIdType> addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells);
+ std::vector<mcIdType> addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells);
+ std::vector<mcIdType> addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells);
private:
MEDFileFieldPerMesh *_father;
protected:
public:
static MEDFileFieldPerMeshPerType *New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType);
static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd);
- static MCAuto<MEDFileFieldPerMeshPerType> Aggregate(int &start, const std::vector< std::pair<int,const MEDFileFieldPerMeshPerType *> >& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo);
+ static MCAuto<MEDFileFieldPerMeshPerType> Aggregate(mcIdType &start, const std::vector< std::pair<int,const MEDFileFieldPerMeshPerType *> >& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo);
public:// overload of abstract methods
void getDimension(int& dim) const;
INTERP_KERNEL::NormalizedCellType getGeoType() const;
void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
std::string getGeoTypeRepr() const;
MEDFileFieldPerMeshPerType *deepCopy(MEDFileFieldPerMesh *father) const;
- void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
+ void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
private:
MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd);
MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *father, INTERP_KERNEL::NormalizedCellType gt);
void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
std::string getGeoTypeRepr() const;
MEDFileFieldPerMeshPerTypeDyn *deepCopy(MEDFileFieldPerMesh *father) const;
- void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
+ void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
private:
MEDFileFieldPerMeshPerTypeDyn(med_idt fid, MEDFileFieldPerMesh *fath, const MEDFileStructureElement *se, const MEDFileFieldNameScope& nasc);
private:
MEDFileFieldPerMesh *deepCopy(MEDFileAnyTypeField1TSWithoutSDA *father) const;
void simpleRepr(int bkOffset,std::ostream& oss, int id) const;
void copyTinyInfoFrom(const MEDCouplingMesh *mesh);
- void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<int>& code2, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- void assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
- void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc);
+ void assignFieldProfile(mcIdType& start, const DataArrayIdType *multiTypePfl, const std::vector<mcIdType>& code, const std::vector<mcIdType>& code2, const std::vector<DataArrayIdType *>& idsInPflPerType, const std::vector<DataArrayIdType *>& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void assignFieldNoProfileNoRenum(mcIdType& start, const std::vector<mcIdType>& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
+ void assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc);
void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
- std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
+ std::vector< std::vector< std::pair<mcIdType,mcIdType> > > getFieldSplitedByType(std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
void accept(MEDFileFieldVisitor& visitor) const;
void getDimension(int& dim) const;
bool isUniqueLevel(int& dim) const;
int getMeshOrder() const { return _mesh_order; }
std::string getMeshName() const;
void setMeshName(const std::string& meshName);
- int getNumberOfComponents() const;
+ std::size_t getNumberOfComponents() const;
bool presenceOfMultiDiscPerGeoType() const;
bool presenceOfStructureElements() const;
bool onlyStructureElements() const;
std::vector<std::string> getLocsReallyUsedMulti() const;
void convertMedBallIntoClassic();
bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
- bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
- void keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& its);
- void keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& its);
+ bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob);
+ void keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its);
+ void keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its);
void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
- DataArray *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const;
- void getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
- MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId);
- const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const;
- static MCAuto<MEDFileFieldPerMesh> Aggregate(int &start, const std::vector<const MEDFileFieldPerMesh *>& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo);
+ DataArray *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const;
+ void getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
+ MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId);
+ const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId) const;
+ static MCAuto<MEDFileFieldPerMesh> Aggregate(mcIdType &start, const std::vector<const MEDFileFieldPerMesh *>& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo);
private:
int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type);
MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
- const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
MEDCouplingFieldDouble *finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
- const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
+ const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs,
const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
MEDCouplingFieldDouble *finishFieldNode2(const MEDFileFieldGlobsReal *glob,
- const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
- DataArray *finishField4(const std::vector< std::pair<int,int> >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const;
+ const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs,
+ const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ DataArray *finishField4(const std::vector< std::pair<mcIdType,mcIdType> >& dads, const DataArrayIdType *pflIn, mcIdType nbOfElems, DataArrayIdType *&pflOut) const;
void assignNewLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves);
static void SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type,
- const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& locs,
- std::vector<int>& code, std::vector<DataArrayInt *>& notNullPfls);
- static int ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs);
+ const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<const DataArrayIdType *>& pfls, const std::vector<int>& locs,
+ std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& notNullPfls);
+ static mcIdType ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs);
MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities);
MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
- MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_father(fath),_mesh_iteration(meshIt),_mesh_order(meshOrd) { }
+ MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_mesh_iteration(meshIt),_mesh_order(meshOrd),_father(fath) { }
private:
int _mesh_iteration;
int _mesh_order;
MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2(int bg, int end, int step) const
{
static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2";
- int nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
+ mcIdType nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
ret->setInfo(_infos);
- int sz=(int)_time_steps.size();
- int j=bg;
+ std::size_t sz=_time_steps.size();
+ std::size_t j=bg;
for(int i=0;i<nbOfEntriesToKeep;i++,j+=step)
{
if(j>=0 && j<sz)
/*!
* See doc at MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt
*/
-DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
return getTimeStepEntry(iteration,order).getUndergroundDataArrayExt(entries);
}
-bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N,
MEDFileFieldGlobsReal& glob)
{
bool ret=false;
{
case MED_FLOAT64:
{
- _time_steps[i]=MEDFileField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos);
+ _time_steps[i]=MEDFileField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt<int>(numdt),FromMedInt<int>(numo),_infos);
break;
}
case MED_INT32:
{
- _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos);
+ _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt<int>(numdt),FromMedInt<int>(numo),_infos);
break;
}
case MED_FLOAT32:
{
- _time_steps[i]=MEDFileFloatField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos);
+ _time_steps[i]=MEDFileFloatField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt<int>(numdt),FromMedInt<int>(numo),_infos);
break;
}
case MED_INT:
{
if(sizeof(med_int)==sizeof(int))
{
- _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos);
+ _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt<int>(numdt),FromMedInt<int>(numo),_infos);
break;
}
}
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::writeLL : no time steps set !");
checkThatNbOfCompoOfTSMatchThis();
std::vector<std::string> infos(getInfo());
- int nbComp=infos.size();
+ std::size_t nbComp=infos.size();
INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
- for(int i=0;i<nbComp;i++)
+ for(unsigned int i=0;i<nbComp;i++)
{
std::string info=infos[i];
std::string c,u;
}
if(_name.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::write : MED file does not accept field with empty name !");
- MEDFILESAFECALLERWR0(MEDfieldCr,(fid,_name.c_str(),getMEDFileFieldType(),nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
- int nbOfTS=_time_steps.size();
- for(int i=0;i<nbOfTS;i++)
+ MEDFILESAFECALLERWR0(MEDfieldCr,(fid,_name.c_str(),getMEDFileFieldType(),ToMedInt(nbComp),comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
+ std::size_t nbOfTS=_time_steps.size();
+ for(std::size_t i=0;i<nbOfTS;i++)
_time_steps[i]->writeLL(fid,opts,*this);
}
int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNumberOfTS() const
{
- return _time_steps.size();
+ return (int)_time_steps.size();
}
void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS()
void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2(int bg, int end, int step)
{
static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2";
- int nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
+ mcIdType nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
if(nbOfEntriesToKill==0)
return ;
std::size_t sz=_time_steps.size();
std::vector<bool> b(sz,true);
int j=bg;
- for(int i=0;i<nbOfEntriesToKill;i++,j+=step)
+ for(mcIdType i=0;i<nbOfEntriesToKill;i++,j+=step)
b[j]=false;
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
for(std::size_t i=0;i<sz;i++)
std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getIterations() const
{
- int lgth=_time_steps.size();
+ std::size_t lgth=_time_steps.size();
std::vector< std::pair<int,int> > ret(lgth);
- for(int i=0;i<lgth;i++)
+ for(std::size_t i=0;i<lgth;i++)
_time_steps[i]->fillIteration(ret[i]);
return ret;
}
std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTypesOfFieldAvailable() const
{
- int lgth=_time_steps.size();
+ std::size_t lgth=_time_steps.size();
std::vector< std::vector<TypeOfField> > ret(lgth);
- for(int i=0;i<lgth;i++)
+ for(std::size_t i=0;i<lgth;i++)
_time_steps[i]->fillTypesOfFieldAvailable(ret[i]);
return ret;
}
/*!
* entry point for users that want to iterate into MEDFile DataStructure without any overhead.
*/
-std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector< std::vector< std::pair<mcIdType,mcIdType> > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
{
return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs);
}
_time_steps.push_back(obj);
}
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller)
{
if(!field)
throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
const MEDFileAnyTypeField1TSWithoutSDA *tsPtr(ts);
if(tsPtr)
{
- if(tsPtr->getNumberOfComponents()!=(int)_infos.size())
+ if(tsPtr->getNumberOfComponents()!=_infos.size())
{
std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element with " << tsPtr->getNumberOfComponents() << " components ! Should be " << _infos.size() << " !";
throw INTERP_KERNEL::Exception(oss.str());
return contentNotNullBase()->getTypesOfFieldAvailable();
}
-std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector< std::vector< std::pair<mcIdType,mcIdType> > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
{
return contentNotNullBase()->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
}
}
template<class T>
-MCAuto<MEDFileAnyTypeField1TS> AggregateHelperF1TS(const std::vector< typename MLFieldTraits<T>::F1TSType const *>& f1tss, const std::vector< std::vector< std::pair<int,int> > >& dts)
+MCAuto<MEDFileAnyTypeField1TS> AggregateHelperF1TS(const std::vector< typename MLFieldTraits<T>::F1TSType const *>& f1tss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
{
MCAuto< typename MLFieldTraits<T>::F1TSType > ret(MLFieldTraits<T>::F1TSType::New());
if(f1tss.empty())
}
template<class T>
-MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< typename MLFieldTraits<T>::FMTSType const *>& fmtss, const std::vector< std::vector< std::pair<int,int> > >& dts)
+MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< typename MLFieldTraits<T>::FMTSType const *>& fmtss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
{
MCAuto< typename MLFieldTraits<T>::FMTSType > ret(MLFieldTraits<T>::FMTSType::New());
if(fmtss.empty())
/*!
* \a dts and \a ftmss are expected to have same size.
*/
-MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileAnyTypeFieldMultiTS::Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,int> > >& dts)
+MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileAnyTypeFieldMultiTS::Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
{
if(fmtss.empty())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : input vector is empty !");
MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const;
MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
- MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller);
- MEDLOADER_EXPORT std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
+ MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller);
+ MEDLOADER_EXPORT std::vector< std::vector< std::pair<mcIdType,mcIdType> > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
MEDLOADER_EXPORT std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const;
MEDLOADER_EXPORT DataArray *getUndergroundDataArray(int iteration, int order) const;
- MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
- MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
+ MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
+ MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob);
MEDLOADER_EXPORT void accept(MEDFileFieldVisitor& visitor) const;
MEDLOADER_EXPORT void loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& opts) const;
MEDLOADER_EXPORT int getNumberOfComponents() const;
MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const;
MEDLOADER_EXPORT std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const;
- MEDLOADER_EXPORT std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
+ MEDLOADER_EXPORT std::vector< std::vector< std::pair<mcIdType,mcIdType> > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> getContent();
public:
MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const = 0;
- MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const = 0;
- MEDLOADER_EXPORT static MCAuto<MEDFileAnyTypeFieldMultiTS> Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,int> > >& dts);
+ MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const = 0;
+ MEDLOADER_EXPORT static MCAuto<MEDFileAnyTypeFieldMultiTS> Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts);
public:
MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const;
MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *New(med_idt fid, const std::string& fieldName, bool loadAll=true);
MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *New(const typename MLFieldTraits<T>::FMTSWSDAType& other, bool shallowCopyOfContent);
MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll=true);
- MEDLOADER_EXPORT typename MLFieldTraits<T>::FMTSType *extractPartImpl(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
- MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); }
+ MEDLOADER_EXPORT typename MLFieldTraits<T>::FMTSType *extractPartImpl(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const;
+ MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); }
//
MEDLOADER_EXPORT typename Traits<T>::FieldType *field(int iteration, int order, const MEDFileMesh *mesh) const;
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
- MEDLOADER_EXPORT typename Traits<T>::ArrayType *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
+ MEDLOADER_EXPORT typename Traits<T>::ArrayType *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const;
//
MEDLOADER_EXPORT void appendFieldNoProfileSBT(const typename Traits<T>::FieldType *field);
- MEDLOADER_EXPORT void appendFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
- MEDLOADER_EXPORT void appendFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ MEDLOADER_EXPORT void appendFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
+ MEDLOADER_EXPORT void appendFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
//
MEDLOADER_EXPORT typename MLFieldTraits<T>::F1TSType *getTimeStepAtPos(int pos) const;
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArray(int iteration, int order) const;
- MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
MEDLOADER_EXPORT typename MLFieldTraits<T>::FMTSType *buildNewEmptyImpl() const;
MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
protected:
const typename MLFieldTraits<T>::FMTSWSDAType *contentNotNull() const;
typename MLFieldTraits<T>::FMTSWSDAType *contentNotNull();
- void appendFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller);
+ void appendFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller);
protected:
~MEDFileTemplateFieldMultiTS() { }
MEDFileTemplateFieldMultiTS();
std::size_t MEDFileMeshStruct::getHeapMemorySizeWithoutChildren() const
{
std::size_t ret(0);
- for(std::vector< std::vector<int> >::const_iterator it0=_geo_types_distrib.begin();it0!=_geo_types_distrib.end();it0++)
+ for(std::vector< std::vector<mcIdType> >::const_iterator it0=_geo_types_distrib.begin();it0!=_geo_types_distrib.end();it0++)
ret+=(*it0).capacity()*sizeof(int);
- ret+=_geo_types_distrib.capacity()*sizeof(std::vector<int>);
+ ret+=_geo_types_distrib.capacity()*sizeof(std::vector<mcIdType>);
return ret;
}
int MEDFileMeshStruct::getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const
{
int j=0;
- for(std::vector< std::vector<int> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++,j--)
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++,j--)
{
std::size_t sz=(*it1).size();
if(sz%3!=0)
/*!
* \sa MEDFileMeshStruct::doesManageGeoType
*/
-int MEDFileMeshStruct::getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const
+mcIdType MEDFileMeshStruct::getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const
{
- for(std::vector< std::vector<int> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++)
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++)
{
std::size_t sz=(*it1).size();
if(sz%3!=0)
*/
bool MEDFileMeshStruct::doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const
{
- for(std::vector< std::vector<int> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++)
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++)
{
std::size_t sz=(*it1).size();
if(sz%3!=0)
std::size_t nbGeo(sz/3);
if(nbGeo!=1)
throw INTERP_KERNEL::Exception(MSG);
- std::vector<int> arr(3); arr[0]=(int)t; arr[1]=_mesh->buildImplicitPartIfAny(t); arr[2]=-1;
+ std::vector<mcIdType> arr(3); arr[0]=(mcIdType)t; arr[1]=_mesh->buildImplicitPartIfAny(t); arr[2]=-1;
_geo_types_distrib.push_back(arr);
}
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New : unrecognized type of mesh ! Must be in [MEDFileUMesh,MEDFileCMesh,MEDFileCurveLinearMesh] !");
}
-MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities)
+MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities)
{
if(!m)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New 2 : null input pointer !");
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New 2 : unrecognized type of mesh ! Must be in [MEDFileUMesh,MEDFileCMesh,MEDFileCurveLinearMesh] !");
}
-MEDMeshMultiLev *MEDMeshMultiLev::NewOnlyOnNode(const MEDFileMesh *m, const DataArrayInt *pflOnNode)
+MEDMeshMultiLev *MEDMeshMultiLev::NewOnlyOnNode(const MEDFileMesh *m, const DataArrayIdType *pflOnNode)
{
MCAuto<MEDMeshMultiLev> ret(MEDMeshMultiLev::New(m,m->getNonEmptyLevels()));
ret->selectPartOfNodes(pflOnNode);
return ret.retn();
}
-void MEDMeshMultiLev::setNodeReduction(const DataArrayInt *nr)
+void MEDMeshMultiLev::setNodeReduction(const DataArrayIdType *nr)
{
if(nr)
nr->incrRef();
- _node_reduction=const_cast<DataArrayInt*>(nr);
+ _node_reduction=const_cast<DataArrayIdType*>(nr);
}
-void MEDMeshMultiLev::setCellReduction(const DataArrayInt *cr)
+void MEDMeshMultiLev::setCellReduction(const DataArrayIdType *cr)
{
if(_pfls.size()!=1)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::setCellReduction : can be used only for single geo type mesh !");
- _pfls[0]=const_cast<DataArrayInt*>(cr);
+ _pfls[0]=const_cast<DataArrayIdType*>(cr);
if(cr)
cr->incrRef();
}
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::isFastlyTheSameStruct : unexpected situation for nodes !");
const MEDFileField1TSStructItem2& p(fst[0]);
std::string pflName(p.getPflName());
- const DataArrayInt *nr(_node_reduction);
+ const DataArrayIdType *nr(_node_reduction);
if(pflName.empty() && !nr)
return true;
if(!pflName.empty() && !nr)
std::size_t sz(fst.getNumberOfItems());
if(sz!=_geo_types.size())
return false;
- int strt(0);
- for(std::size_t i=0;i<sz;i++)
+ mcIdType strt(0);
+ for(unsigned int i=0;i<sz;i++)
{
const MEDFileField1TSStructItem2& p(fst[i]);
if(!p.isFastlyEqual(strt,_geo_types[i],getPflNameOfId(i).c_str()))
* \param [out] famIds - Can be null. If not null the instance has to be dealt by the caller (decrRef).
* \param [out] isWithoutCopy - When true the returned instance \a famIds if not null is directly those in the data structure.
*/
-void MEDMeshMultiLev::retrieveFamilyIdsOnCells(DataArrayInt *& famIds, bool& isWithoutCopy) const
+void MEDMeshMultiLev::retrieveFamilyIdsOnCells(DataArrayIdType *& famIds, bool& isWithoutCopy) const
{
- const DataArrayInt *fids(_cell_fam_ids);
+ const DataArrayIdType *fids(_cell_fam_ids);
if(!fids)
{ famIds=0; isWithoutCopy=true; return ; }
std::size_t sz(_geo_types.size());
bool presenceOfPfls(false);
for(std::size_t i=0;i<sz && !presenceOfPfls;i++)
{
- const DataArrayInt *pfl(_pfls[i]);
+ const DataArrayIdType *pfl(_pfls[i]);
if(pfl)
presenceOfPfls=true;
}
if(!presenceOfPfls)
- { famIds=const_cast<DataArrayInt *>(fids); famIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(famIds); return ; }
+ { famIds=const_cast<DataArrayIdType *>(fids); famIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(famIds); return ; }
//bad luck the slowest part
isWithoutCopy=false;
- std::vector< MCAuto<DataArrayInt> > retSafe(sz);
- std::vector< const DataArrayInt *> ret(sz);
- int start(0);
+ std::vector< MCAuto<DataArrayIdType> > retSafe(sz);
+ std::vector< const DataArrayIdType *> ret(sz);
+ mcIdType start(0);
for(std::size_t i=0;i<sz;i++)
{
- const DataArrayInt *pfl(_pfls[i]);
- int lgth(_nb_entities[i]);
+ const DataArrayIdType *pfl(_pfls[i]);
+ mcIdType lgth(_nb_entities[i]);
if(pfl)
{
- MCAuto<DataArrayInt> tmp(fids->selectByTupleIdSafeSlice(start,start+lgth,1));
+ MCAuto<DataArrayIdType> tmp(fids->selectByTupleIdSafeSlice(start,start+lgth,1));
retSafe[i]=tmp->selectByTupleIdSafe(pfl->begin(),pfl->end());
}
else
ret[i]=retSafe[i];
start+=lgth;
}
- famIds=DataArrayInt::Aggregate(ret);
+ famIds=DataArrayIdType::Aggregate(ret);
}
/*!
* \param [out] numIds - Can be null. If not null the instance has to be dealt by the caller (decrRef).
* \param [out] isWithoutCopy - When true the returned instance \a numIds if not null is directly those in the data structure.
*/
-void MEDMeshMultiLev::retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isWithoutCopy) const
+void MEDMeshMultiLev::retrieveNumberIdsOnCells(DataArrayIdType *& numIds, bool& isWithoutCopy) const
{
- const DataArrayInt *nids(_cell_num_ids);
+ const DataArrayIdType *nids(_cell_num_ids);
if(!nids)
{ numIds=0; isWithoutCopy=true; return ; }
std::size_t sz(_geo_types.size());
bool presenceOfPfls(false);
for(std::size_t i=0;i<sz && !presenceOfPfls;i++)
{
- const DataArrayInt *pfl(_pfls[i]);
+ const DataArrayIdType *pfl(_pfls[i]);
if(pfl)
presenceOfPfls=true;
}
if(!presenceOfPfls)
- { numIds=const_cast<DataArrayInt *>(nids); numIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(numIds); return ; }
+ { numIds=const_cast<DataArrayIdType *>(nids); numIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(numIds); return ; }
//bad luck the slowest part
isWithoutCopy=false;
- std::vector< MCAuto<DataArrayInt> > retSafe(sz);
- std::vector< const DataArrayInt *> ret(sz);
- int start(0);
+ std::vector< MCAuto<DataArrayIdType> > retSafe(sz);
+ std::vector< const DataArrayIdType *> ret(sz);
+ mcIdType start(0);
for(std::size_t i=0;i<sz;i++)
{
- const DataArrayInt *pfl(_pfls[i]);
- int lgth(_nb_entities[i]);
+ const DataArrayIdType *pfl(_pfls[i]);
+ mcIdType lgth(_nb_entities[i]);
if(pfl)
{
- MCAuto<DataArrayInt> tmp(nids->selectByTupleIdSafeSlice(start,start+lgth,1));
+ MCAuto<DataArrayIdType> tmp(nids->selectByTupleIdSafeSlice(start,start+lgth,1));
retSafe[i]=tmp->selectByTupleIdSafe(pfl->begin(),pfl->end());
}
else
ret[i]=retSafe[i];
start+=lgth;
}
- numIds=DataArrayInt::Aggregate(ret);
+ numIds=DataArrayIdType::Aggregate(ret);
}
/*!
* \param [out] famIds - Can be null. If not null the instance has to be dealt by the caller (decrRef).
* \param [out] isWithoutCopy - When true the returned instance \a famIds if not null is directly those in the data structure.
*/
-void MEDMeshMultiLev::retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isWithoutCopy) const
+void MEDMeshMultiLev::retrieveFamilyIdsOnNodes(DataArrayIdType *& famIds, bool& isWithoutCopy) const
{
- const DataArrayInt *fids(_node_fam_ids);
+ const DataArrayIdType *fids(_node_fam_ids);
if(!fids)
{ famIds=0; isWithoutCopy=true; return ; }
- const DataArrayInt *nr(_node_reduction);
+ const DataArrayIdType *nr(_node_reduction);
if(nr)
{
isWithoutCopy=false;
}
else
{
- famIds=const_cast<DataArrayInt *>(fids); famIds->incrRef();
+ famIds=const_cast<DataArrayIdType *>(fids); famIds->incrRef();
isWithoutCopy=_mesh->isObjectInTheProgeny(famIds);
}
}
* \param [out] numIds - Can be null. If not null the instance has to be dealt by the caller (decrRef).
* \param [out] isWithoutCopy - When true the returned instance \a numIds if not null is directly those in the data structure.
*/
-void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isWithoutCopy) const
+void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayIdType *& numIds, bool& isWithoutCopy) const
{
- const DataArrayInt *fids(_node_num_ids);
+ const DataArrayIdType *fids(_node_num_ids);
if(!fids)
{ numIds=0; isWithoutCopy=true; return ; }
- const DataArrayInt *nr(_node_reduction);
+ const DataArrayIdType *nr(_node_reduction);
if(nr)
{
isWithoutCopy=false;
}
else
{
- numIds=const_cast<DataArrayInt *>(fids); numIds->incrRef();
+ numIds=const_cast<DataArrayIdType *>(fids); numIds->incrRef();
isWithoutCopy=_mesh->isObjectInTheProgeny(numIds);
}
}
* This method returns, if any, a new object containing the global node ids **BUT CONTRARY TO OTHER RETRIEVE METHODS** the returned object is always a NON AGGREGATED object. So the returned object if not null
* can be used as this safely.
*/
-DataArrayInt *MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny() const
+DataArrayIdType *MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny() const
{
const MEDFileUMesh *umesh(dynamic_cast<const MEDFileUMesh *>(_mesh));
if(!umesh)
const PartDefinition *pd(umesh->getPartDefAtLevel(1));
if(!pd)
return 0;
- MCAuto<DataArrayInt> tmp(pd->toDAI());
- const DataArrayInt *tmpCpp(tmp);
+ MCAuto<DataArrayIdType> tmp(pd->toDAI());
+ const DataArrayIdType *tmpCpp(tmp);
if(!tmpCpp)
return 0;
//
- const DataArrayInt *nr(_node_reduction);
+ const DataArrayIdType *nr(_node_reduction);
if(nr)
return tmp->selectByTupleIdSafe(nr->begin(),nr->end());
else
return _geo_types;
}
-void MEDMeshMultiLev::setFamilyIdsOnCells(DataArrayInt *famIds)
+void MEDMeshMultiLev::setFamilyIdsOnCells(DataArrayIdType *famIds)
{
_cell_fam_ids=famIds;
if(famIds)
famIds->incrRef();
}
-void MEDMeshMultiLev::setNumberIdsOnCells(DataArrayInt *numIds)
+void MEDMeshMultiLev::setNumberIdsOnCells(DataArrayIdType *numIds)
{
_cell_num_ids=numIds;
if(numIds)
numIds->incrRef();
}
-void MEDMeshMultiLev::setFamilyIdsOnNodes(DataArrayInt *famIds)
+void MEDMeshMultiLev::setFamilyIdsOnNodes(DataArrayIdType *famIds)
{
_node_fam_ids=famIds;
if(famIds)
famIds->incrRef();
}
-void MEDMeshMultiLev::setNumberIdsOnNodes(DataArrayInt *numIds)
+void MEDMeshMultiLev::setNumberIdsOnNodes(DataArrayIdType *numIds)
{
_node_num_ids=numIds;
if(numIds)
std::size_t sz(_pfls.size());
if(id<0 || id>=(int)sz)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::getPflNameOfId : invalid input id !");
- const DataArrayInt *pfl(_pfls[id]);
+ const DataArrayIdType *pfl(_pfls[id]);
if(!pfl)
return std::string("");
return pfl->getName();
* Returns the number of cells having geometric type \a t.
* The profiles are **NOT** taken into account here.
*/
-int MEDMeshMultiLev::getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const
+mcIdType MEDMeshMultiLev::getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const
{
std::size_t sz(_nb_entities.size());
for(std::size_t i=0;i<sz;i++)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::getNumberOfCells : not existing geometric type in this !");
}
-int MEDMeshMultiLev::getNumberOfNodes() const
+mcIdType MEDMeshMultiLev::getNumberOfNodes() const
{
return _nb_nodes;
}
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes !");
const MEDFileField1TSStructItem2& p(fst[0]);
std::string pflName(p.getPflName());
- const DataArrayInt *nr(_node_reduction);
+ const DataArrayIdType *nr(_node_reduction);
if(pflName.empty() && !nr)
return vals->deepCopy();
if(pflName.empty() && nr)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 2 !");
if(!pflName.empty() && nr)
{
- MCAuto<DataArrayInt> p1(globs->getProfile(pflName.c_str())->deepCopy());
- MCAuto<DataArrayInt> p2(nr->deepCopy());
+ MCAuto<DataArrayIdType> p1(globs->getProfile(pflName.c_str())->deepCopy());
+ MCAuto<DataArrayIdType> p2(nr->deepCopy());
p1->sort(true); p2->sort(true);
if(!p1->isEqualWithoutConsideringStr(*p2))
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : it appears that a profile on nodes does not cover the cells correctly !");
- p1=DataArrayInt::FindPermutationFromFirstToSecond(globs->getProfile(pflName.c_str()),nr);
+ p1=DataArrayIdType::FindPermutationFromFirstToSecond(globs->getProfile(pflName.c_str()),nr);
MCAuto<DataArray> ret(vals->deepCopy());
ret->renumberInPlace(p1->begin());
return ret.retn();
}
if(!pflName.empty() && !nr)
{
- MCAuto<DataArrayInt> p1(globs->getProfile(pflName.c_str())->deepCopy());
+ MCAuto<DataArrayIdType> p1(globs->getProfile(pflName.c_str())->deepCopy());
p1->sort(true);
if(!p1->isIota(getNumberOfNodes()))
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 4 !");
std::vector< const DataArray *> arr(s.size());
std::vector< MCAuto<DataArray> > arrSafe(s.size());
int iii(0);
- int nc(vals->getNumberOfComponents());
+ mcIdType nc(ToIdType(vals->getNumberOfComponents()));
std::vector<std::string> compInfo(vals->getInfoOnComponents());
for(std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator it=_geo_types.begin();it!=_geo_types.end();it++,iii++)
{
- const DataArrayInt *thisP(_pfls[iii]);
+ const DataArrayIdType *thisP(_pfls[iii]);
std::vector<const MEDFileField1TSStructItem2 *> ps;
for(std::size_t i=0;i<sz;i++)
{
if(ps.size()==1)
{
int nbi(ps[0]->getNbOfIntegrationPts(globs));
- const DataArrayInt *otherP(ps[0]->getPfl(globs));
+ const DataArrayIdType *otherP(ps[0]->getPfl(globs));
const std::pair<int,int>& strtStop(ps[0]->getStartStop());
MCAuto<DataArray> ret(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1));
if(!thisP && !otherP)
}
if(thisP && otherP)
{
- MCAuto<DataArrayInt> p1(otherP->invertArrayN2O2O2N(getNumberOfCells(ps[0]->getGeo())));
- MCAuto<DataArrayInt> p2(thisP->deepCopy());
+ MCAuto<DataArrayIdType> p1(otherP->invertArrayN2O2O2N(getNumberOfCells(ps[0]->getGeo())));
+ MCAuto<DataArrayIdType> p2(thisP->deepCopy());
p2->transformWithIndArr(p1->begin(),p1->end());
//p1=p2->findIdsNotEqual(-1);
//p1=p2->selectByTupleIdSafe(p1->begin(),p1->end());
}
if(!thisP && otherP)
{
- MCAuto<DataArrayInt> p1(otherP->deepCopy());
+ MCAuto<DataArrayIdType> p1(otherP->deepCopy());
p1->sort(true);
p1->checkAllIdsInRange(0,getNumberOfCells(ps[0]->getGeo()));
- p1=DataArrayInt::FindPermutationFromFirstToSecond(otherP,p1);
+ p1=DataArrayIdType::FindPermutationFromFirstToSecond(otherP,p1);
ret->rearrange(nbi*nc); ret->renumberInPlace(p1->begin()); ret->rearrange(nc); ret->setInfoOnComponents(compInfo);
arrSafe[iii]=ret; arr[iii]=ret;
continue;
}
else
{
- std::vector< const DataArrayInt * >otherPS(ps.size());
+ std::vector< const DataArrayIdType * >otherPS(ps.size());
std::vector< const DataArray * > arr2(ps.size());
std::vector< MCAuto<DataArray> > arr2Safe(ps.size());
- std::vector< const DataArrayInt * > nbis(ps.size());
- std::vector< MCAuto<DataArrayInt> > nbisSafe(ps.size());
+ std::vector< const DataArrayIdType * > nbis(ps.size());
+ std::vector< MCAuto<DataArrayIdType> > nbisSafe(ps.size());
int jj(0);
for(std::vector<const MEDFileField1TSStructItem2 *>::const_iterator it2=ps.begin();it2!=ps.end();it2++,jj++)
{
int nbi((*it2)->getNbOfIntegrationPts(globs));
- const DataArrayInt *otherPfl((*it2)->getPfl(globs));
+ const DataArrayIdType *otherPfl((*it2)->getPfl(globs));
const std::pair<int,int>& strtStop((*it2)->getStartStop());
MCAuto<DataArray> ret2(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1));
if(!otherPfl)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for cells 4 !");
arr2[jj]=ret2; arr2Safe[jj]=ret2; otherPS[jj]=otherPfl;
- nbisSafe[jj]=DataArrayInt::New(); nbisSafe[jj]->alloc(otherPfl->getNumberOfTuples(),1); nbisSafe[jj]->fillWithValue(nbi);
+ nbisSafe[jj]=DataArrayIdType::New(); nbisSafe[jj]->alloc(otherPfl->getNumberOfTuples(),1); nbisSafe[jj]->fillWithValue(nbi);
nbis[jj]=nbisSafe[jj];
}
MCAuto<DataArray> arr3(DataArray::Aggregate(arr2));
- MCAuto<DataArrayInt> otherP(DataArrayInt::Aggregate(otherPS));
- MCAuto<DataArrayInt> zenbis(DataArrayInt::Aggregate(nbis));
- MCAuto<DataArrayInt> otherPN(otherP->invertArrayN2O2O2N(getNumberOfCells(*it)));
- MCAuto<DataArrayInt> p1;
+ MCAuto<DataArrayIdType> otherP(DataArrayIdType::Aggregate(otherPS));
+ MCAuto<DataArrayIdType> zenbis(DataArrayIdType::Aggregate(nbis));
+ MCAuto<DataArrayIdType> otherPN(otherP->invertArrayN2O2O2N(getNumberOfCells(*it)));
+ MCAuto<DataArrayIdType> p1;
if(thisP)
- p1=DataArrayInt::FindPermutationFromFirstToSecond(otherP,thisP);
+ p1=DataArrayIdType::FindPermutationFromFirstToSecond(otherP,thisP);
else
p1=otherP->deepCopy();
- MCAuto<DataArrayInt> zenbisN(zenbis->renumber(p1->begin()));
+ MCAuto<DataArrayIdType> zenbisN(zenbis->renumber(p1->begin()));
zenbisN->computeOffsetsFull();
jj=0;
for(std::vector<const MEDFileField1TSStructItem2 *>::const_iterator it2=ps.begin();it2!=ps.end();it2++,jj++)
{
//int nbi((*it2)->getNbOfIntegrationPts(globs));
- const DataArrayInt *otherPfl((*it2)->getPfl(globs));
+ const DataArrayIdType *otherPfl((*it2)->getPfl(globs));
const std::pair<int,int>& strtStop((*it2)->getStartStop());
MCAuto<DataArray> ret2(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1));
//
- MCAuto<DataArrayInt> p2(otherPfl->deepCopy());
+ MCAuto<DataArrayIdType> p2(otherPfl->deepCopy());
p2->transformWithIndArr(otherPN->begin(),otherPN->end());
p2->transformWithIndArr(p1->begin(),p1->end());
- MCAuto<DataArrayInt> idsN(p2->buildExplicitArrByRanges(zenbisN));
+ MCAuto<DataArrayIdType> idsN(p2->buildExplicitArrByRanges(zenbisN));
arr3->setPartOfValuesBase3(ret2,idsN->begin(),idsN->end(),0,nc,1);
}
arrSafe[iii]=arr3; arr[iii]=arr3;
/*!
* This method is called to add NORM_POINT1 cells in \a this so that orphan nodes in \a verticesToAdd will be fetched.
*/
-void MEDMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr)
+void MEDMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr)
{
- int nbOfVertices(verticesToAdd->getNumberOfTuples());
+ mcIdType nbOfVertices(verticesToAdd->getNumberOfTuples());
std::size_t sz(_pfls.size());
_pfls.resize(sz+1);
_geo_types.resize(sz+1,INTERP_KERNEL::NORM_POINT1);
_nb_entities.resize(sz+1,nbOfVertices);
_node_reduction=nr; nr->incrRef();
_nb_nodes+=nbOfVertices;
- const DataArrayInt *cf(_cell_fam_ids),*cn(_cell_num_ids),*nf(_node_fam_ids),*nn(_node_num_ids);
+ const DataArrayIdType *cf(_cell_fam_ids),*cn(_cell_num_ids),*nf(_node_fam_ids),*nn(_node_num_ids);
if(cf)
{
- MCAuto<DataArrayInt> tmp;
- std::vector<const DataArrayInt *> a(2);
+ MCAuto<DataArrayIdType> tmp;
+ std::vector<const DataArrayIdType *> a(2);
a[0]=cf;
if(nf)
tmp=nf->selectByTupleIdSafe(verticesToAdd->begin(),verticesToAdd->end());
else
{
- tmp=DataArrayInt::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero();
+ tmp=DataArrayIdType::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero();
}
a[1]=tmp;
- _cell_fam_ids=DataArrayInt::Aggregate(a);
+ _cell_fam_ids=DataArrayIdType::Aggregate(a);
}
if(cn)
{
- MCAuto<DataArrayInt> tmp;
- std::vector<const DataArrayInt *> a(2);
+ MCAuto<DataArrayIdType> tmp;
+ std::vector<const DataArrayIdType *> a(2);
a[0]=cn;
if(nn)
tmp=nn->selectByTupleIdSafe(verticesToAdd->begin(),verticesToAdd->end());
else
{
- tmp=DataArrayInt::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero();
+ tmp=DataArrayIdType::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero();
}
a[1]=tmp;
- _cell_num_ids=DataArrayInt::Aggregate(a);
+ _cell_num_ids=DataArrayIdType::Aggregate(a);
}
}
{
}
-MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):_mesh(mesh),_geo_types(gts),_nb_entities(nbEntities),_nb_nodes(nbNodes)
+MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh, mcIdType nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities):_mesh(mesh),_geo_types(gts),_nb_entities(nbEntities),_nb_nodes(nbNodes)
{
std::size_t sz(_geo_types.size());
if(sz!=pfls.size() || sz!=nbEntities.size())
{
if(pfls[i])
pfls[i]->incrRef();
- _pfls[i]=const_cast<DataArrayInt *>(pfls[i]);
+ _pfls[i]=const_cast<DataArrayIdType *>(pfls[i]);
}
}
bool cellFamIdsNoCpy(levs.size()==1);
if(cellFamIdsNoCpy)
{
- const DataArrayInt *tmp(m->getFamilyFieldAtLevel(levs[0]));
+ const DataArrayIdType *tmp(m->getFamilyFieldAtLevel(levs[0]));
if(tmp)
{
tmp->incrRef();
- _cell_fam_ids=(const_cast<DataArrayInt *>(tmp));
+ _cell_fam_ids=(const_cast<DataArrayIdType *>(tmp));
}
}
else
{
- std::vector<const DataArrayInt *> tmps(levs.size());
+ std::vector<const DataArrayIdType *> tmps(levs.size());
bool f(true);
for(std::size_t i=0;i<levs.size();i++)
{
f=false;
}
if(f && !tmps.empty())
- _cell_fam_ids=DataArrayInt::Aggregate(tmps);
+ _cell_fam_ids=DataArrayIdType::Aggregate(tmps);
}
bool cellNumIdsNoCpy(levs.size()==1);
if(cellNumIdsNoCpy)
{
- const DataArrayInt *tmp(m->getNumberFieldAtLevel(levs[0]));
+ const DataArrayIdType *tmp(m->getNumberFieldAtLevel(levs[0]));
if(tmp)
{
tmp->incrRef();
- _cell_num_ids=(const_cast<DataArrayInt *>(tmp));
+ _cell_num_ids=(const_cast<DataArrayIdType *>(tmp));
}
}
else
{
- std::vector<const DataArrayInt *> tmps(levs.size());
+ std::vector<const DataArrayIdType *> tmps(levs.size());
bool n(true);
for(std::size_t i=0;i<levs.size();i++)
{
n=false;
}
if(n && !tmps.empty())
- _cell_num_ids=DataArrayInt::Aggregate(tmps);
+ _cell_num_ids=DataArrayIdType::Aggregate(tmps);
}
// node part
{
- const DataArrayInt *tmp(m->getFamilyFieldAtLevel(1));
+ const DataArrayIdType *tmp(m->getFamilyFieldAtLevel(1));
if(tmp)
{
tmp->incrRef();
- _node_fam_ids=(const_cast<DataArrayInt *>(tmp));
+ _node_fam_ids=(const_cast<DataArrayIdType *>(tmp));
}
}
{
- const DataArrayInt *tmp(m->getNumberFieldAtLevel(1));
+ const DataArrayIdType *tmp(m->getNumberFieldAtLevel(1));
if(tmp)
{
tmp->incrRef();
- _node_num_ids=(const_cast<DataArrayInt *>(tmp));
+ _node_num_ids=(const_cast<DataArrayIdType *>(tmp));
}
}
}
-MEDUMeshMultiLev *MEDUMeshMultiLev::New(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities)
+MEDUMeshMultiLev *MEDUMeshMultiLev::New(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities)
{
return new MEDUMeshMultiLev(m,gts,pfls,nbEntities);
}
-MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities)
+MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities):MEDMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities)
{
std::size_t sz(gts.size());
if(sz<1)
int lev((int)dim-m->getMeshDimension());
if(isSameDim && isNoPfl && m->getGeoTypesAtLevel(lev)==gts)//optimized part
{
- const DataArrayInt *famIds(m->getFamilyFieldAtLevel(lev));
+ const DataArrayIdType *famIds(m->getFamilyFieldAtLevel(lev));
if(famIds)
- { _cell_fam_ids=const_cast<DataArrayInt*>(famIds); famIds->incrRef(); }
- const DataArrayInt *numIds(m->getNumberFieldAtLevel(lev));
+ { _cell_fam_ids=const_cast<DataArrayIdType*>(famIds); famIds->incrRef(); }
+ const DataArrayIdType *numIds(m->getNumberFieldAtLevel(lev));
if(numIds)
- { _cell_num_ids=const_cast<DataArrayInt*>(numIds); numIds->incrRef(); }
+ { _cell_num_ids=const_cast<DataArrayIdType*>(numIds); numIds->incrRef(); }
famIds=m->getFamilyFieldAtLevel(1);
if(famIds)
- { _node_fam_ids=const_cast<DataArrayInt*>(famIds); famIds->incrRef(); }
+ { _node_fam_ids=const_cast<DataArrayIdType*>(famIds); famIds->incrRef(); }
numIds=m->getNumberFieldAtLevel(1);
if(numIds)
- { _node_num_ids=const_cast<DataArrayInt*>(numIds); numIds->incrRef(); }
+ { _node_num_ids=const_cast<DataArrayIdType*>(numIds); numIds->incrRef(); }
return ;
}
//
- std::vector< MCAuto<DataArrayInt> > famIdsSafe(sz);
- std::vector<const DataArrayInt *> famIds(sz);
+ std::vector< MCAuto<DataArrayIdType> > famIdsSafe(sz);
+ std::vector<const DataArrayIdType *> famIds(sz);
bool f(true);
for(std::size_t i=0;i<sz;i++)
{
f=false;
}
if(f)
- _cell_fam_ids=DataArrayInt::Aggregate(famIds);
- std::vector< MCAuto<DataArrayInt> > numIdsSafe(sz);
- std::vector<const DataArrayInt *> numIds(sz);
+ _cell_fam_ids=DataArrayIdType::Aggregate(famIds);
+ std::vector< MCAuto<DataArrayIdType> > numIdsSafe(sz);
+ std::vector<const DataArrayIdType *> numIds(sz);
bool n(true);
for(std::size_t i=0;i<sz;i++)
{
n=false;
}
if(n)
- _cell_num_ids=DataArrayInt::Aggregate(numIds);
+ _cell_num_ids=DataArrayIdType::Aggregate(numIds);
// node ids management
- const DataArrayInt *nodeFamIds(m->getFamilyFieldAtLevel(1));
+ const DataArrayIdType *nodeFamIds(m->getFamilyFieldAtLevel(1));
if(nodeFamIds)
- { _node_fam_ids=const_cast<DataArrayInt*>(nodeFamIds); nodeFamIds->incrRef(); }
- const DataArrayInt *nodeNumIds(m->getNumberFieldAtLevel(1));
+ { _node_fam_ids=const_cast<DataArrayIdType*>(nodeFamIds); nodeFamIds->incrRef(); }
+ const DataArrayIdType *nodeNumIds(m->getNumberFieldAtLevel(1));
if(nodeNumIds)
- { _node_num_ids=const_cast<DataArrayInt*>(nodeNumIds); nodeNumIds->incrRef(); }
+ { _node_num_ids=const_cast<DataArrayIdType*>(nodeNumIds); nodeNumIds->incrRef(); }
}
-void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes)
+void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayIdType *pflNodes)
{
if(!pflNodes || !pflNodes->isAllocated())
return ;
std::size_t sz(_parts.size());
- std::vector< MCAuto<DataArrayInt> > a(sz);
- std::vector< const DataArrayInt *> aa(sz);
+ std::vector< MCAuto<DataArrayIdType> > a(sz);
+ std::vector< const DataArrayIdType *> aa(sz);
for(std::size_t i=0;i<sz;i++)
{
- const DataArrayInt *pfl(_pfls[i]);
+ const DataArrayIdType *pfl(_pfls[i]);
MCAuto<MEDCoupling1GTUMesh> m(_parts[i]);
if(pfl)
m=dynamic_cast<MEDCoupling1GTUMesh *>(_parts[i]->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
- DataArrayInt *cellIds=0;
+ DataArrayIdType *cellIds=0;
m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds);
- MCAuto<DataArrayInt> cellIdsSafe(cellIds);
+ MCAuto<DataArrayIdType> cellIdsSafe(cellIds);
MCAuto<MEDCouplingPointSet> m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end()));
- int tmp=-1;
- MCAuto<DataArrayInt> o2n(m2->getNodeIdsInUse(tmp));
+ mcIdType tmp=-1;
+ MCAuto<DataArrayIdType> o2n(m2->getNodeIdsInUse(tmp));
a[i]=o2n->invertArrayO2N2N2O(tmp); aa[i]=a[i];
if(pfl)
_pfls[i]=pfl->selectByTupleIdSafe(cellIds->begin(),cellIds->end());
_pfls[i]=cellIdsSafe;
}
if(!aa.empty())
- _node_reduction=DataArrayInt::Aggregate(aa);//general case
+ _node_reduction=DataArrayIdType::Aggregate(aa);//general case
else
_node_reduction=pflNodes->deepCopy();//case where no cells in read mesh.
_node_reduction->sort(true);
if(_node_reduction->getNumberOfTuples()>pflNodes->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::selectPartOfNodes : internal error in MEDCoupling during cell select from a list of nodes !");
// Here the cells available in _parts is not enough to cover all the nodes in pflNodes. So adding vertices cells in _parts...
- MCAuto<DataArrayInt> pflNodes2(pflNodes->deepCopy());
+ MCAuto<DataArrayIdType> pflNodes2(pflNodes->deepCopy());
pflNodes2->sort(true);
- MCAuto<DataArrayInt> diff(pflNodes2->buildSubstractionOptimized(_node_reduction));
+ MCAuto<DataArrayIdType> diff(pflNodes2->buildSubstractionOptimized(_node_reduction));
appendVertices(diff,pflNodes2);
}
* If returned value is false output pointer \a coords is not the internal pointer. If returned value is true output pointer \a coords is directly the internal pointer.
* If true is returned, the \a coords output parameter should be used with care (non const method call) to avoid to change the internal state of MEDFileUMesh instance.
*/
-bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const
+bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayIdType *&cellLocations, DataArrayIdType *& cells, DataArrayIdType *&faceLocations, DataArrayIdType *&faces) const
{
const DataArrayDouble *tmp(0);
if(_parts.empty())
if(!tmp)
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : the coordinates are null !");
MCAuto<DataArrayDouble> a(const_cast<DataArrayDouble *>(tmp)); tmp->incrRef();
- int szBCE(0),szD(0),szF(0);
+ mcIdType szBCE(0),szD(0),szF(0);
bool isPolyh(false);
int iii(0);
for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++)
if(!cur)
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : a part is null !");
//
- const DataArrayInt *pfl(_pfls[iii]);
+ const DataArrayIdType *pfl(_pfls[iii]);
MCAuto<MEDCoupling1GTUMesh> cur2;
if(!pfl)
{ cur2=const_cast<MEDCoupling1GTUMesh *>(cur); cur2->incrRef(); }
else
{ cur2=dynamic_cast<MEDCoupling1GTUMesh *>(cur->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); cur=cur2; }
//
- int curNbCells(cur->getNumberOfCells());
+ mcIdType curNbCells(cur->getNumberOfCells());
szBCE+=curNbCells;
if((*it)->getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED)
szD+=cur->getNodalConnectivity()->getNumberOfTuples()+curNbCells;
else
{
isPolyh=true;
- MCAuto<DataArrayInt> tmp2(cur->computeEffectiveNbOfNodesPerCell());
- szD+=tmp2->accumulate(0)+curNbCells;
+ MCAuto<DataArrayIdType> tmp2(cur->computeEffectiveNbOfNodesPerCell());
+ szD+=tmp2->accumulate((std::size_t)0)+curNbCells;
szF+=2*curNbCells+cur->getNodalConnectivity()->getNumberOfTuples();
}
}
MCAuto<DataArrayByte> b(DataArrayByte::New()); b->alloc(szBCE,1); char *bPtr(b->getPointer());
- MCAuto<DataArrayInt> c(DataArrayInt::New()); c->alloc(szBCE,1); int *cPtr(c->getPointer());
- MCAuto<DataArrayInt> d(DataArrayInt::New()); d->alloc(szD,1); int *dPtr(d->getPointer());
- MCAuto<DataArrayInt> e(DataArrayInt::New()),f(DataArrayInt::New()); int *ePtr(0),*fPtr(0);
+ MCAuto<DataArrayIdType> c(DataArrayIdType::New()); c->alloc(szBCE,1); mcIdType *cPtr(c->getPointer());
+ MCAuto<DataArrayIdType> d(DataArrayIdType::New()); d->alloc(szD,1); mcIdType *dPtr(d->getPointer());
+ MCAuto<DataArrayIdType> e(DataArrayIdType::New()),f(DataArrayIdType::New()); mcIdType *ePtr(0),*fPtr(0);
if(isPolyh)
{ e->alloc(szBCE,1); ePtr=e->getPointer(); f->alloc(szF,1); fPtr=f->getPointer(); }
- int k(0);
+ mcIdType k(0);
iii=0;
for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++)
{
const MEDCoupling1GTUMesh *cur(*it);
//
- const DataArrayInt *pfl(_pfls[iii]);
+ const DataArrayIdType *pfl(_pfls[iii]);
MCAuto<MEDCoupling1GTUMesh> cur2;
if(!pfl)
{ cur2=const_cast<MEDCoupling1GTUMesh *>(cur); cur2->incrRef(); }
else
{ cur2=dynamic_cast<MEDCoupling1GTUMesh *>(cur->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); cur=cur2; }
//
- int curNbCells(cur->getNumberOfCells());
+ mcIdType curNbCells(cur->getNumberOfCells());
int gt((int)cur->getCellModelEnum());
if(gt<0 || gt>=PARAMEDMEM_2_VTKTYPE_LGTH)
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : invalid geometric type !");
std::fill(bPtr,bPtr+curNbCells,gtvtk); bPtr+=curNbCells;
const MEDCoupling1SGTUMesh *scur(dynamic_cast<const MEDCoupling1SGTUMesh *>(cur));
const MEDCoupling1DGTUMesh *dcur(dynamic_cast<const MEDCoupling1DGTUMesh *>(cur));
- const int *connPtr(cur->getNodalConnectivity()->begin());
+ const mcIdType *connPtr(cur->getNodalConnectivity()->begin());
if(!scur && !dcur)
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : internal error !");
if(scur)
{
if(cur->getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA27)
{
- int nnpc(scur->getNumberOfNodesPerCell());
- for(int i=0;i<curNbCells;i++,connPtr+=nnpc)
+ mcIdType nnpc(scur->getNumberOfNodesPerCell());
+ for(mcIdType i=0;i<curNbCells;i++,connPtr+=nnpc)
{
*dPtr++=nnpc;
dPtr=std::copy(connPtr,connPtr+nnpc,dPtr);
}
else
{
- for(int i=0;i<curNbCells;i++,connPtr+=27)
+ for(mcIdType i=0;i<curNbCells;i++,connPtr+=27)
{
*dPtr++=27;
for(int j=0;j<27;j++,dPtr++)
}
else
{
- const int *connIPtr(dcur->getNodalConnectivityIndex()->begin());
+ const mcIdType *connIPtr(dcur->getNodalConnectivityIndex()->begin());
if(cur->getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED)
{
for(int i=0;i<curNbCells;i++,connIPtr++)
}
else
{
- for(int i=0;i<curNbCells;i++,connIPtr++)
+ for(mcIdType i=0;i<curNbCells;i++,connIPtr++)
{
- std::set<int> s(connPtr+connIPtr[0],connPtr+connIPtr[1]); s.erase(-1);
- *dPtr++=(int)s.size();
+ std::set<mcIdType> s(connPtr+connIPtr[0],connPtr+connIPtr[1]); s.erase(-1);
+ *dPtr++=(mcIdType)s.size();
dPtr=std::copy(s.begin(),s.end(),dPtr);
- *cPtr++=k; k+=(int)s.size()+1;
+ *cPtr++=k; k+=(mcIdType)s.size()+1;
}
}
if(isPolyh)
{ std::fill(ePtr,ePtr+curNbCells,-1); ePtr+=curNbCells; }
else
{
- int kk(0);
+ mcIdType kk(0);
for(int i=0;i<curNbCells;i++,connIPtr++)
{
- int nbFace(std::count(connPtr+connIPtr[0],connPtr+connIPtr[1],-1)+1);
+ mcIdType nbFace(ToIdType(std::count(connPtr+connIPtr[0],connPtr+connIPtr[1],-1)+1));
*fPtr++=nbFace;
- const int *work(connPtr+connIPtr[0]);
+ const mcIdType *work(connPtr+connIPtr[0]);
for(int j=0;j<nbFace;j++)
{
- const int *work2=std::find(work,connPtr+connIPtr[1],-1);
- *fPtr++=std::distance(work,work2);
+ const mcIdType *work2=std::find(work,connPtr+connIPtr[1],-1);
+ *fPtr++=ToIdType(std::distance(work,work2));
fPtr=std::copy(work,work2,fPtr);
work=work2+1;
}
return _mesh->isObjectInTheProgeny(coords);
}
-void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto<DataArrayDouble>& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const
+void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto<DataArrayDouble>& coords, DataArrayIdType *nodalConnVTK, DataArrayIdType *polyhedNodalConnVTK) const
{
- const DataArrayInt *nr(_node_reduction);
+ const DataArrayIdType *nr(_node_reduction);
if(!nr)
return ;
if(nodalConnVTK->empty() && !polyhedNodalConnVTK)
coords=(coords->selectByTupleIdSafe(nr->begin(),nr->end()));
return ;
}
- int sz(coords->getNumberOfTuples());
+ mcIdType sz(coords->getNumberOfTuples());
std::vector<bool> b(sz,false);
- const int *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end());
+ const mcIdType *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end());
while(work!=endW)
{
- int nb(*work++);
- for(int i=0;i<nb && work!=endW;i++,work++)
+ mcIdType nb(*work++);
+ for(mcIdType i=0;i<nb && work!=endW;i++,work++)
{
if(*work>=0 && *work<sz)
b[*work]=true;
work=polyhedNodalConnVTK->begin(); endW=polyhedNodalConnVTK->end();
while(work!=endW)
{
- int nb(*work++);
- for(int i=0;i<nb && work!=endW;i++)
+ mcIdType nb(*work++);
+ for(mcIdType i=0;i<nb && work!=endW;i++)
{
- int nb2(*work++);
- for(int j=0;j<nb2 && work!=endW;j++,work++)
+ mcIdType nb2(*work++);
+ for(mcIdType j=0;j<nb2 && work!=endW;j++,work++)
{
if(*work>=0 && *work<sz)
b[*work]=true;
}
}
}
- int szExp(std::count(b.begin(),b.end(),true));
- if(szExp!=nr->getNumberOfTuples())
+ std::size_t szExp(std::count(b.begin(),b.end(),true));
+ if(ToIdType(szExp)!=nr->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::reorderNodesIfNecessary : internal error #3 !");
// Go renumbering !
- MCAuto<DataArrayInt> o2n(DataArrayInt::New()); o2n->alloc(sz,1);
- int *o2nPtr(o2n->getPointer());
+ MCAuto<DataArrayIdType> o2n(DataArrayIdType::New()); o2n->alloc(sz,1);
+ mcIdType *o2nPtr(o2n->getPointer());
int newId(0);
for(int i=0;i<sz;i++,o2nPtr++)
if(b[i]) *o2nPtr=newId++; else *o2nPtr=-1;
- const int *o2nPtrc(o2n->begin());
- MCAuto<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(nr->getNumberOfTuples()));
- MCAuto<DataArrayInt> perm(DataArrayInt::FindPermutationFromFirstToSecond(n2o,nr));
- const int *permPtr(perm->begin());
- int *work2(nodalConnVTK->getPointer()),*endW2(nodalConnVTK->getPointer()+nodalConnVTK->getNumberOfTuples());
+ const mcIdType *o2nPtrc(o2n->begin());
+ MCAuto<DataArrayIdType> n2o(o2n->invertArrayO2N2N2O(nr->getNumberOfTuples()));
+ MCAuto<DataArrayIdType> perm(DataArrayIdType::FindPermutationFromFirstToSecond(n2o,nr));
+ const mcIdType *permPtr(perm->begin());
+ mcIdType *work2(nodalConnVTK->getPointer()),*endW2(nodalConnVTK->getPointer()+nodalConnVTK->getNumberOfTuples());
while(work2!=endW2)
{
- int nb(*work2++);
- for(int i=0;i<nb && work2!=endW2;i++,work2++)
+ mcIdType nb(*work2++);
+ for(mcIdType i=0;i<nb && work2!=endW2;i++,work2++)
*work2=permPtr[o2nPtrc[*work2]];
}
if(polyhedNodalConnVTK)
work2=polyhedNodalConnVTK->getPointer(); endW2=polyhedNodalConnVTK->getPointer()+polyhedNodalConnVTK->getNumberOfTuples();
while(work2!=endW2)
{
- int nb(*work2++);
- for(int i=0;i<nb && work2!=endW2;i++)
+ mcIdType nb(*work2++);
+ for(mcIdType i=0;i<nb && work2!=endW2;i++)
{
- int nb2(*work2++);
- for(int j=0;j<nb2 && work2!=endW2;j++,work2++)
+ mcIdType nb2(*work2++);
+ for(mcIdType j=0;j<nb2 && work2!=endW2;j++,work2++)
*work2=permPtr[o2nPtrc[*work2]];
}
}
}
-void MEDUMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr)
+void MEDUMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr)
{
- int nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1
+ mcIdType nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1
MEDMeshMultiLev::appendVertices(verticesToAdd,nr);
MCAuto<MEDCoupling1SGTUMesh> elt(MEDCoupling1SGTUMesh::New("",INTERP_KERNEL::NORM_POINT1));
elt->allocateCells(nbOfCells);
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
- int pt(verticesToAdd->getIJ(i,0));
+ mcIdType pt(verticesToAdd->getIJ(i,0));
elt->insertNextCell(&pt,&pt+1);
}
if(_parts.empty())
initStdFieldOfIntegers(m);
}
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(m,nbOfNodes,gts,pfls,nbEntities),_is_internal(true)
+MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, mcIdType nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities):MEDMeshMultiLev(m,nbOfNodes,gts,pfls,nbEntities),_is_internal(true)
{
initStdFieldOfIntegers(m);
}
void MEDStructuredMeshMultiLev::initStdFieldOfIntegers(const MEDFileStructuredMesh *m)
{
// ids fields management
- const DataArrayInt *tmp(0);
+ const DataArrayIdType *tmp(0);
tmp=m->getFamilyFieldAtLevel(0);
if(tmp)
{
tmp->incrRef();
- _cell_fam_ids=const_cast<DataArrayInt *>(tmp);
+ _cell_fam_ids=const_cast<DataArrayIdType *>(tmp);
}
tmp=m->getNumberFieldAtLevel(0);
if(tmp)
{
tmp->incrRef();
- _cell_num_ids=const_cast<DataArrayInt *>(tmp);
+ _cell_num_ids=const_cast<DataArrayIdType *>(tmp);
}
//
tmp=0;
if(tmp)
{
tmp->incrRef();
- _node_fam_ids=const_cast<DataArrayInt *>(tmp);
+ _node_fam_ids=const_cast<DataArrayIdType *>(tmp);
}
tmp=m->getNumberFieldAtLevel(1);
if(tmp)
{
tmp->incrRef();
- _node_num_ids=const_cast<DataArrayInt *>(tmp);
+ _node_num_ids=const_cast<DataArrayIdType *>(tmp);
}
// faces (if any)
tmp=m->getFamilyFieldAtLevel(-1);
if(tmp)
{
tmp->incrRef();
- _face_fam_ids=const_cast<DataArrayInt *>(tmp);
+ _face_fam_ids=const_cast<DataArrayIdType *>(tmp);
}
tmp=m->getNumberFieldAtLevel(-1);
if(tmp)
{
tmp->incrRef();
- _face_num_ids=const_cast<DataArrayInt *>(tmp);
+ _face_num_ids=const_cast<DataArrayIdType *>(tmp);
}
}
MEDCoupling1GTUMesh *facesIfPresent((static_cast<const MEDFileStructuredMesh *>(_mesh))->getImplicitFaceMesh());
if(!facesIfPresent)
return false;
- const DataArrayInt *pfl(0),*nr(_node_reduction);
+ const DataArrayIdType *pfl(0),*nr(_node_reduction);
if(!_pfls.empty())
pfl=_pfls[0];
MCAuto<MEDCoupling1GTUMesh> facesIfPresent2(facesIfPresent); facesIfPresent->incrRef();
void MEDStructuredMeshMultiLev::dealWithImplicitUnstructuredMesh(const MEDFileMesh *m)
{
- const DataArrayInt *tmp(0);
+ const DataArrayIdType *tmp(0);
tmp=m->getFamilyFieldAtLevel(-1);
if(tmp)
{
tmp->incrRef();
- _cell_fam_ids=const_cast<DataArrayInt *>(tmp);
+ _cell_fam_ids=const_cast<DataArrayIdType *>(tmp);
}
tmp=m->getNumberFieldAtLevel(-1);
if(tmp)
{
tmp->incrRef();
- _cell_num_ids=const_cast<DataArrayInt *>(tmp);
+ _cell_num_ids=const_cast<DataArrayIdType *>(tmp);
}
}
-void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes)
+void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayIdType *pflNodes)
{
if(!pflNodes || !pflNodes->isAllocated())
return ;
- std::vector<int> ngs(getNodeGridStructure());
- MCAuto<DataArrayInt> conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size()));
- MCAuto<MEDCoupling1SGTUMesh> m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(ngs.size())));
+ std::vector<mcIdType> ngs(getNodeGridStructure());
+ MCAuto<DataArrayIdType> conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size()));
+ MCAuto<MEDCoupling1SGTUMesh> m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension((int)ngs.size())));
m->setNodalConnectivity(conn);
- const DataArrayInt *pfl(_pfls[0]);
+ const DataArrayIdType *pfl(_pfls[0]);
if(pfl)
{
m=dynamic_cast<MEDCoupling1SGTUMesh *>(m->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
}
- DataArrayInt *cellIds=0;
+ DataArrayIdType *cellIds=0;
m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds);
- MCAuto<DataArrayInt> cellIdsSafe(cellIds);
+ MCAuto<DataArrayIdType> cellIdsSafe(cellIds);
MCAuto<MEDCouplingPointSet> m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end()));
- int tmp=-1;
+ mcIdType tmp=-1;
_node_reduction=m2->getNodeIdsInUse(tmp);
if(pfl)
_pfls[0]=pfl->selectByTupleIdSafe(cellIds->begin(),cellIds->end());
return new MEDCMeshMultiLev(m,levs);
}
-MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities)
+MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities)
{
return new MEDCMeshMultiLev(m,gts,pfls,nbEntities);
}
}
}
-MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities)
+MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities)
{
if(!m)
throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : null input pointer !");
{
}
-std::vector<int> MEDCMeshMultiLev::getNodeGridStructure() const
+std::vector<mcIdType> MEDCMeshMultiLev::getNodeGridStructure() const
{
- std::vector<int> ret(_coords.size());
+ std::vector<mcIdType> ret(_coords.size());
for(std::size_t i=0;i<_coords.size();i++)
ret[i]=_coords[i]->getNumberOfTuples();
return ret;
MEDMeshMultiLev *retSpecific(0);
if(prepareForImplicitUnstructuredMeshCase(retSpecific))
return retSpecific;
- const DataArrayInt *pfl(0),*nr(_node_reduction);
+ const DataArrayIdType *pfl(0),*nr(_node_reduction);
if(!_pfls.empty())
pfl=_pfls[0];
- MCAuto<DataArrayInt> nnr;
- std::vector<int> cgs,ngs(getNodeGridStructure());
+ MCAuto<DataArrayIdType> nnr;
+ std::vector<mcIdType> cgs,ngs(getNodeGridStructure());
cgs.resize(ngs.size());
- std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus<int>(),-1));
+ std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus<mcIdType>(),-1));
if(pfl)
{
- std::vector< std::pair<int,int> > cellParts;
+ std::vector< std::pair<mcIdType,mcIdType> > cellParts;
MCAuto<MEDMeshMultiLev> ret2;
if(MEDCouplingStructuredMesh::IsPartStructured(pfl->begin(),pfl->end(),cgs,cellParts))
{
else
{
MCAuto<MEDCouplingCMesh> m(MEDCouplingCMesh::New());
- for(std::size_t i=0;i<ngs.size();i++)
+ for(unsigned int i=0;i<ngs.size();i++)
m->setCoordsAt(i,_coords[i]);
MCAuto<MEDCoupling1SGTUMesh> m2(m->build1SGTUnstructured());
MCAuto<MEDCoupling1GTUMesh> m3=dynamic_cast<MEDCoupling1GTUMesh *>(m2->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
{ m3->zipCoords(); nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); }
ret2=(MEDUMeshMultiLev *)ret; ret2->incrRef();
}
- const DataArrayInt *famIds(_cell_fam_ids),*numIds(_cell_num_ids);
+ const DataArrayIdType *famIds(_cell_fam_ids),*numIds(_cell_num_ids);
if(famIds)
{
- MCAuto<DataArrayInt> tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
+ MCAuto<DataArrayIdType> tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
ret2->setFamilyIdsOnCells(tmp);
}
if(numIds)
{
- MCAuto<DataArrayInt> tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
+ MCAuto<DataArrayIdType> tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
ret2->setNumberIdsOnCells(tmp);
}
return ret2.retn();
return new MEDCurveLinearMeshMultiLev(m,levs);
}
-MEDCurveLinearMeshMultiLev *MEDCurveLinearMeshMultiLev::New(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities)
+MEDCurveLinearMeshMultiLev *MEDCurveLinearMeshMultiLev::New(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities)
{
return new MEDCurveLinearMeshMultiLev(m,gts,pfls,nbEntities);
}
_structure=m->getMesh()->getNodeGridStructure();
}
-MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities)
+MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities)
{
if(!m)
throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : null input pointer !");
{
}
-std::vector<int> MEDCurveLinearMeshMultiLev::getNodeGridStructure() const
+std::vector<mcIdType> MEDCurveLinearMeshMultiLev::getNodeGridStructure() const
{
return _structure;
}
MEDMeshMultiLev *retSpecific(0);
if(prepareForImplicitUnstructuredMeshCase(retSpecific))
return retSpecific;
- const DataArrayInt *pfl(0),*nr(_node_reduction);
+ const DataArrayIdType *pfl(0),*nr(_node_reduction);
if(!_pfls.empty())
pfl=_pfls[0];
- MCAuto<DataArrayInt> nnr;
- std::vector<int> cgs,ngs(getNodeGridStructure());
+ MCAuto<DataArrayIdType> nnr;
+ std::vector<mcIdType> cgs,ngs(getNodeGridStructure());
cgs.resize(ngs.size());
- std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus<int>(),-1));
+ std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus<mcIdType>(),-1));
if(pfl)
{
- std::vector< std::pair<int,int> > cellParts,nodeParts;
+ std::vector< std::pair<mcIdType,mcIdType> > cellParts,nodeParts;
MCAuto<MEDMeshMultiLev> ret2;
if(MEDCouplingStructuredMesh::IsPartStructured(pfl->begin(),pfl->end(),cgs,cellParts))
{
nodeParts=cellParts;
- std::vector<int> st(ngs.size());
+ std::vector<mcIdType> st(ngs.size());
for(std::size_t i=0;i<ngs.size();i++)
{
nodeParts[i].second++;
st[i]=nodeParts[i].second-nodeParts[i].first;
}
- MCAuto<DataArrayInt> p(MEDCouplingStructuredMesh::BuildExplicitIdsFrom(ngs,nodeParts));
+ MCAuto<DataArrayIdType> p(MEDCouplingStructuredMesh::BuildExplicitIdsFrom(ngs,nodeParts));
MCAuto<MEDCurveLinearMeshMultiLev> ret(new MEDCurveLinearMeshMultiLev(*this));
ret->_is_internal=false;
if(nr)
{ m3->zipCoords(); nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); }
ret2=(MEDUMeshMultiLev *)ret; ret2->incrRef();
}
- const DataArrayInt *famIds(_cell_fam_ids),*numIds(_cell_num_ids);
+ const DataArrayIdType *famIds(_cell_fam_ids),*numIds(_cell_num_ids);
if(famIds)
{
- MCAuto<DataArrayInt> tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
+ MCAuto<DataArrayIdType> tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
ret2->setFamilyIdsOnCells(tmp);
}
if(numIds)
{
- MCAuto<DataArrayInt> tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
+ MCAuto<DataArrayIdType> tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
ret2->setNumberIdsOnCells(tmp);
}
return ret2.retn();
}
}
-void MEDCurveLinearMeshMultiLev::buildVTUArrays(DataArrayDouble *&coords, std::vector<int>& nodeStrct, bool& isInternal) const
+void MEDCurveLinearMeshMultiLev::buildVTUArrays(DataArrayDouble *&coords, std::vector<mcIdType>& nodeStrct, bool& isInternal) const
{
isInternal=_is_internal;
nodeStrct=_structure;
{
}
-MEDFileField1TSStructItem2::MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair<int,int>& b, const std::string& c, const std::string& d):_geo_type(a),_start_end(b),_pfl(DataArrayInt::New()),_loc(d),_nb_of_entity(-1)
+MEDFileField1TSStructItem2::MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair<mcIdType,mcIdType>& b, const std::string& c, const std::string& d):_geo_type(a),_start_end(b),_pfl(DataArrayIdType::New()),_loc(d),_nb_of_entity(-1)
{
_pfl->setName(c.c_str());
}
MEDFileMeshStruct *mstUnConstCasted(const_cast<MEDFileMeshStruct *>(mst));
mstUnConstCasted->appendIfImplicitType(_geo_type);
}
- int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
+ mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
checkInRange(nbOfEnt,1,globs);
}
void MEDFileField1TSStructItem2::checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs)
{
- int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
+ mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
checkInRange(nbOfEnt,(int)cm.getNumberOfNodes(),globs);
}
if(_loc.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkWithMeshStructForGaussPT : no localization specified !");
const MEDFileFieldLoc& loc=globs->getLocalization(_loc.c_str());
- int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
+ mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
checkInRange(nbOfEnt,loc.getNumberOfGaussPoints(),globs);
}
if(_loc.empty())
{
if(getPflName().empty())
- return (_start_end.second-_start_end.first)/_nb_of_entity;
+ return (int)((_start_end.second-_start_end.first)/_nb_of_entity);
else
- return (_start_end.second-_start_end.first)/getPfl(globs)->getNumberOfTuples();
+ return (int)((_start_end.second-_start_end.first)/getPfl(globs)->getNumberOfTuples());
}
else
{
return _pfl->getName();
}
-const DataArrayInt *MEDFileField1TSStructItem2::getPfl(const MEDFileFieldGlobsReal *globs) const
+const DataArrayIdType *MEDFileField1TSStructItem2::getPfl(const MEDFileFieldGlobsReal *globs) const
{
if(!_pfl->isAllocated())
{
* \param [in] nbOfEntity - number of entity that can be either cells or nodes. Not other possibility.
* \param [in] nip - number of integration points. 1 for ON_CELLS and NO_NODES
*/
-void MEDFileField1TSStructItem2::checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs)
+void MEDFileField1TSStructItem2::checkInRange(mcIdType nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs)
{
_nb_of_entity=nbOfEntity;
if(_pfl->getName().empty())
{
if(!globs)
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkInRange : Presence of a profile on field whereas no globals found in file !");
- const DataArrayInt *pfl=globs->getProfile(_pfl->getName().c_str());
+ const DataArrayIdType *pfl=globs->getProfile(_pfl->getName().c_str());
if(!pfl)
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkInRange : Presence of a profile on field whereas no such profile found in file !");
pfl->checkAllIdsInRange(0,nbOfEntity);
}
}
-bool MEDFileField1TSStructItem2::isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const
+bool MEDFileField1TSStructItem2::isFastlyEqual(mcIdType& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const
{
if(startExp!=_start_end.first)
return false;
return false;
if(_pfl->getName().empty() && other._pfl->getName().empty())
return true;
- const DataArrayInt *pfl1(getPfl(globs)),*pfl2(other.getPfl(globs));
+ const DataArrayIdType *pfl1(getPfl(globs)),*pfl2(other.getPfl(globs));
return pfl1->isEqualWithoutConsideringStr(*pfl2);
}
if(objs.size()==1)
return MEDFileField1TSStructItem2(*objs[0]);
INTERP_KERNEL::NormalizedCellType gt(objs[0]->_geo_type);
- int nbEntityRef(objs[0]->_nb_of_entity);
+ mcIdType nbEntityRef(objs[0]->_nb_of_entity);
std::size_t sz(objs.size());
- std::vector<const DataArrayInt *> arrs(sz);
+ std::vector<const DataArrayIdType *> arrs(sz);
for(std::size_t i=0;i<sz;i++)
{
const MEDFileField1TSStructItem2 *obj(objs[i]);
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : invalid situation ! Several same geo type chunk must all lie on profiles !");
arrs[i]=globs->getProfile(obj->_pfl->getName().c_str());
}
- MCAuto<DataArrayInt> arr(DataArrayInt::Aggregate(arrs));
+ MCAuto<DataArrayIdType> arr(DataArrayIdType::Aggregate(arrs));
arr->sort();
- int oldNbTuples(arr->getNumberOfTuples());
+ mcIdType oldNbTuples(arr->getNumberOfTuples());
arr=arr->buildUnique();
if(oldNbTuples!=arr->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : some entities are present several times !");
if(arr->isIota(nbEntityRef))
{
- std::pair<int,int> p(0,nbEntityRef);
+ std::pair<mcIdType,mcIdType> p(0,nbEntityRef);
std::string a,b;
MEDFileField1TSStructItem2 ret(gt,p,a,b);
ret._nb_of_entity=nbEntityRef;
else
{
arr->setName(NEWLY_CREATED_PFL_NAME);
- std::pair<int,int> p(0,oldNbTuples);
+ std::pair<mcIdType,mcIdType> p(0,oldNbTuples);
std::string a,b;
MEDFileField1TSStructItem2 ret(gt,p,a,b);
ret._nb_of_entity=nbEntityRef;
std::vector<const BigMemoryObject *> MEDFileField1TSStructItem2::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- ret.push_back((const DataArrayInt *)_pfl);
+ ret.push_back((const DataArrayIdType *)_pfl);
return ret;
}
{
case ON_NODES:
{
- int nbOfEnt=mst->getNumberOfNodes();
+ mcIdType nbOfEnt=mst->getNumberOfNodes();
if(_items.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::checkWithMeshStruct : for nodes field only one subdivision supported !");
_items[0].checkInRange(nbOfEnt,1,globs);
int theFirstLevFull;
bool ret0=isFullyOnOneLev(meshSt,theFirstLevFull);
const MEDFileField1TSStructItem2& otherNodeIt(other._items[0]);
- int nbOfNodes(meshSt->getNumberOfNodes());
+ mcIdType nbOfNodes(meshSt->getNumberOfNodes());
if(otherNodeIt.getPflName().empty())
{//on all nodes
if(!ret0)
}
else
{
- const DataArrayInt *pfl=globs->getProfile(otherNodeIt.getPflName().c_str());
- MCAuto<DataArrayInt> cpyPfl(pfl->deepCopy());
+ const DataArrayIdType *pfl=globs->getProfile(otherNodeIt.getPflName().c_str());
+ MCAuto<DataArrayIdType> cpyPfl(pfl->deepCopy());
cpyPfl->sort();
if(cpyPfl->isIota(nbOfNodes))
{//on all nodes also !
{
std::size_t sz(_items.size());
std::vector<INTERP_KERNEL::NormalizedCellType> a0(sz);
- std::vector<const DataArrayInt *> a1(sz);
- std::vector<int> a2(sz);
+ std::vector<const DataArrayIdType *> a1(sz);
+ std::vector<mcIdType> a2(sz);
std::size_t i(0);
for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++,i++)
{
std::vector< std::vector<std::string> > pfls,locs;
std::vector< std::vector<TypeOfField> > typesF;
std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes;
- std::vector< std::vector<std::pair<int,int> > > strtEnds=ref->getFieldSplitedByType(std::string(),geoTypes,typesF,pfls,locs);
+ std::vector< std::vector<std::pair<mcIdType,mcIdType> > > strtEnds=ref->getFieldSplitedByType(std::string(),geoTypes,typesF,pfls,locs);
std::size_t nbOfGeoTypes(geoTypes.size());
if(nbOfGeoTypes==0)
throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : not null by empty ref !");
int MEDFileFastCellSupportComparator::getNumberOfTS() const
{
- return _f1ts_cmps.size();
+ return (int)_f1ts_cmps.size();
}
std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileFastCellSupportComparator::getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
const MEDFileMesh *getTheMesh() const { return _mesh; }
- int getNumberOfNodes() const { return _nb_nodes; }
+ mcIdType getNumberOfNodes() const { return _nb_nodes; }
bool doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const;
- int getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const;
+ mcIdType getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const;
int getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const;
int getNumberOfLevs() const;
int getNumberOfGeoTypesInLev(int relativeLev) const;
private:
const MEDFileMesh *_mesh;
std::string _name;
- int _nb_nodes;
- std::vector< std::vector<int> > _geo_types_distrib;
+ mcIdType _nb_nodes;
+ std::vector< std::vector<mcIdType> > _geo_types_distrib;
};
class MEDFileField1TSStructItem;
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
public:
- static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+ static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector<int>& levs);
- static MEDMeshMultiLev *NewOnlyOnNode(const MEDFileMesh *m, const DataArrayInt *pflOnNode);
- void setNodeReduction(const DataArrayInt *nr);
- void setCellReduction(const DataArrayInt *cr);
+ static MEDMeshMultiLev *NewOnlyOnNode(const MEDFileMesh *m, const DataArrayIdType *pflOnNode);
+ void setNodeReduction(const DataArrayIdType *nr);
+ void setCellReduction(const DataArrayIdType *cr);
bool isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs) const;
MEDLOADER_EXPORT DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
- MEDLOADER_EXPORT void retrieveFamilyIdsOnCells(DataArrayInt *& famIds, bool& isWithoutCopy) const;
- MEDLOADER_EXPORT void retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isWithoutCopy) const;
- MEDLOADER_EXPORT void retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isWithoutCopy) const;
- MEDLOADER_EXPORT void retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isWithoutCopy) const;
- MEDLOADER_EXPORT DataArrayInt *retrieveGlobalNodeIdsIfAny() const;
+ MEDLOADER_EXPORT void retrieveFamilyIdsOnCells(DataArrayIdType *& famIds, bool& isWithoutCopy) const;
+ MEDLOADER_EXPORT void retrieveNumberIdsOnCells(DataArrayIdType *& numIds, bool& isWithoutCopy) const;
+ MEDLOADER_EXPORT void retrieveFamilyIdsOnNodes(DataArrayIdType *& famIds, bool& isWithoutCopy) const;
+ MEDLOADER_EXPORT void retrieveNumberIdsOnNodes(DataArrayIdType *& numIds, bool& isWithoutCopy) const;
+ MEDLOADER_EXPORT DataArrayIdType *retrieveGlobalNodeIdsIfAny() const;
MEDLOADER_EXPORT std::vector< INTERP_KERNEL::NormalizedCellType > getGeoTypes() const;
- void setFamilyIdsOnCells(DataArrayInt *famIds);
- void setNumberIdsOnCells(DataArrayInt *numIds);
- void setFamilyIdsOnNodes(DataArrayInt *famIds);
- void setNumberIdsOnNodes(DataArrayInt *numIds);
- virtual void selectPartOfNodes(const DataArrayInt *pflNodes) = 0;
+ void setFamilyIdsOnCells(DataArrayIdType *famIds);
+ void setNumberIdsOnCells(DataArrayIdType *numIds);
+ void setFamilyIdsOnNodes(DataArrayIdType *famIds);
+ void setNumberIdsOnNodes(DataArrayIdType *numIds);
+ virtual void selectPartOfNodes(const DataArrayIdType *pflNodes) = 0;
virtual MEDMeshMultiLev *prepare() const = 0;
- int getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const;
- int getNumberOfNodes() const;
+ mcIdType getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const;
+ mcIdType getNumberOfNodes() const;
protected:
std::string getPflNameOfId(int id) const;
DataArray *constructDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
- virtual void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr);
+ virtual void appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr);
protected:
MEDMeshMultiLev(const MEDFileMesh *mesh);
MEDMeshMultiLev(const MEDMeshMultiLev& other);
- MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+ MEDMeshMultiLev(const MEDFileMesh *mesh, mcIdType nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
protected:
const MEDFileMesh *_mesh;
- std::vector< MCAuto<DataArrayInt> > _pfls;
+ std::vector< MCAuto<DataArrayIdType> > _pfls;
std::vector< INTERP_KERNEL::NormalizedCellType > _geo_types;
- std::vector<int> _nb_entities;
- MCAuto<DataArrayInt> _node_reduction;
- int _nb_nodes;
+ std::vector<mcIdType> _nb_entities;
+ MCAuto<DataArrayIdType> _node_reduction;
+ mcIdType _nb_nodes;
//
- MCAuto<DataArrayInt> _cell_fam_ids;
- MCAuto<DataArrayInt> _cell_num_ids;
- MCAuto<DataArrayInt> _node_fam_ids;
- MCAuto<DataArrayInt> _node_num_ids;
+ MCAuto<DataArrayIdType> _cell_fam_ids;
+ MCAuto<DataArrayIdType> _cell_num_ids;
+ MCAuto<DataArrayIdType> _node_fam_ids;
+ MCAuto<DataArrayIdType> _node_num_ids;
public:
MEDLOADER_EXPORT static const int PARAMEDMEM_2_VTKTYPE_LGTH=34;
MEDLOADER_EXPORT static const unsigned char PARAMEDMEM_2_VTKTYPE[PARAMEDMEM_2_VTKTYPE_LGTH];
{
public:
static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector<int>& levs);
- static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
- void selectPartOfNodes(const DataArrayInt *pflNodes);
+ static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
+ void selectPartOfNodes(const DataArrayIdType *pflNodes);
MEDMeshMultiLev *prepare() const;
MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MCAuto<MEDCoupling1GTUMesh>& part);
- MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const;
+ MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayIdType *&cellLocations, DataArrayIdType *& cells, DataArrayIdType *&faceLocations, DataArrayIdType *&faces) const;
protected:
- void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr);
+ void appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr);
private:
- void reorderNodesIfNecessary(MCAuto<DataArrayDouble>& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const;
+ void reorderNodesIfNecessary(MCAuto<DataArrayDouble>& coords, DataArrayIdType *nodalConnVTK, DataArrayIdType *polyhedNodalConnVTK) const;
private:
MEDUMeshMultiLev(const MEDUMeshMultiLev& other);
MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<int>& levs);
- MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+ MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
private:
std::vector< MCAuto<MEDCoupling1GTUMesh> > _parts;
//! this attribute is used only for mesh with no cells but having coordinates. For classical umeshes those pointer is equal to pointer of coordinates of instances in this->_parts.
class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
{
public:
- void selectPartOfNodes(const DataArrayInt *pflNodes);
- virtual std::vector<int> getNodeGridStructure() const = 0;
+ void selectPartOfNodes(const DataArrayIdType *pflNodes);
+ virtual std::vector<mcIdType> getNodeGridStructure() const = 0;
protected:
MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other);
MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector<int>& lev);
- MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+ MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, mcIdType nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
void dealWithImplicitUnstructuredMesh(const MEDFileMesh *m);
protected:
void moveFaceToCell() const;
void initStdFieldOfIntegers(const MEDFileStructuredMesh *m);
protected:
bool _is_internal;
- MCAuto<DataArrayInt> _face_fam_ids;
- MCAuto<DataArrayInt> _face_num_ids;
+ MCAuto<DataArrayIdType> _face_fam_ids;
+ MCAuto<DataArrayIdType> _face_num_ids;
};
class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
{
public:
static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector<int>& levs);
- static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
- std::vector<int> getNodeGridStructure() const;
+ static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
+ std::vector<mcIdType> getNodeGridStructure() const;
MEDMeshMultiLev *prepare() const;
MEDLOADER_EXPORT std::vector< DataArrayDouble * > buildVTUArrays(bool& isInternal) const;
private:
MEDCMeshMultiLev(const MEDCMeshMultiLev& other);
MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<int>& levs);
- MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+ MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
private:
std::vector< MCAuto<DataArrayDouble> > _coords;
};
{
public:
static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector<int>& levs);
- static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls , const std::vector<int>& nbEntities);
- std::vector<int> getNodeGridStructure() const;
+ static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls , const std::vector<mcIdType>& nbEntities);
+ std::vector<mcIdType> getNodeGridStructure() const;
MEDMeshMultiLev *prepare() const;
- MEDLOADER_EXPORT void buildVTUArrays(DataArrayDouble *&coords, std::vector<int>& nodeStrct, bool& isInternal) const;
+ MEDLOADER_EXPORT void buildVTUArrays(DataArrayDouble *&coords, std::vector<mcIdType>& nodeStrct, bool& isInternal) const;
private:
MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshMultiLev& other);
MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<int>& levs);
- MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+ MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
private:
MCAuto<DataArrayDouble> _coords;
- std::vector<int> _structure;
+ std::vector<mcIdType> _structure;
};
class MEDFileField1TSStructItem2 : public BigMemoryObject
{
public:
MEDFileField1TSStructItem2();
- MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair<int,int>& b, const std::string& pfl, const std::string& loc);
+ MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair<mcIdType,mcIdType>& b, const std::string& pfl, const std::string& loc);
void checkWithMeshStructForCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs);
void checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs);
void checkWithMeshStructForGaussPT(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs);
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
//
- const DataArrayInt *getPfl(const MEDFileFieldGlobsReal *globs) const;
+ const DataArrayIdType *getPfl(const MEDFileFieldGlobsReal *globs) const;
INTERP_KERNEL::NormalizedCellType getGeo() const { return _geo_type; }
- int getNbEntity() const { return _nb_of_entity; }
- const std::pair<int,int>& getStartStop() const { return _start_end; }
+ mcIdType getNbEntity() const { return _nb_of_entity; }
+ const std::pair<mcIdType,mcIdType>& getStartStop() const { return _start_end; }
std::string getPflName() const;
int getNbOfIntegrationPts(const MEDFileFieldGlobsReal *globs) const;
//! warning this method also set _nb_of_entity attribute !
- void checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs);
- bool isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const;
+ void checkInRange(mcIdType nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs);
+ bool isFastlyEqual(mcIdType& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const;
bool operator==(const MEDFileField1TSStructItem2& other) const;
bool isCellSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const;
bool isNodeSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const;
static const char NEWLY_CREATED_PFL_NAME[];
private:
INTERP_KERNEL::NormalizedCellType _geo_type;
- std::pair<int,int> _start_end;
- MCAuto<DataArrayInt> _pfl;
+ std::pair<mcIdType,mcIdType> _start_end;
+ MCAuto<DataArrayIdType> _pfl;
std::string _loc;
- int _nb_of_entity;
+ mcIdType _nb_of_entity;
};
class MEDFileField1TSStructItem : public BigMemoryObject
//
#include "MEDFileJoint.hxx"
+#include "MEDFileBasis.hxx"
#include "MEDLoader.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDFileSafeCaller.txx"
std::size_t MEDFileJointCorrespondence::getHeapMemorySizeWithoutChildren() const
{
- return sizeof(MCAuto<DataArrayInt>);
+ return sizeof(MCAuto<DataArrayIdType>);
}
std::vector<const BigMemoryObject *> MEDFileJointCorrespondence::getDirectChildrenWithNull() const
* \param [in] loc_geo_type - the local geometry type of correspondence.
* \param [in] rem_geo_type - the remote geometry type of correspondence.
*/
-MEDFileJointCorrespondence::MEDFileJointCorrespondence(DataArrayInt* correspondence,
+MEDFileJointCorrespondence::MEDFileJointCorrespondence(DataArrayIdType* correspondence,
bool isNodal,
INTERP_KERNEL::NormalizedCellType loc_geo_type,
INTERP_KERNEL::NormalizedCellType rem_geo_type):
MEDFileJointCorrespondence::setCorrespondence( correspondence );
}
-MEDFileJointCorrespondence* MEDFileJointCorrespondence::New(DataArrayInt* correspondence,
+MEDFileJointCorrespondence* MEDFileJointCorrespondence::New(DataArrayIdType* correspondence,
INTERP_KERNEL::NormalizedCellType loc_geo_type,
INTERP_KERNEL::NormalizedCellType rem_geo_type)
{
/*!
* Returns a new MEDFileJointCorrespondence of nodes
*/
-MEDFileJointCorrespondence *MEDFileJointCorrespondence::New(DataArrayInt* correspondence)
+MEDFileJointCorrespondence *MEDFileJointCorrespondence::New(DataArrayIdType* correspondence)
{
return new MEDFileJointCorrespondence(correspondence);
}
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
std::ostringstream oss; oss << "MEDFileJointCorrespondence : error on attempt to write in file : \"" << fileName << "\"";
- MEDFileUtilities::CheckMEDCode(fid,fid,oss.str());
+ MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str());
if (( !_is_nodal ) &&
( _loc_geo_type == INTERP_KERNEL::NORM_ERROR ||
throw INTERP_KERNEL::Exception( "Geometric type not specified for a cell Joint" );
}
- if ( (const DataArrayInt *)_correspondence )
+ if ( (const DataArrayIdType *)_correspondence )
{
writeLL(fid, localMeshName, jointName, order, iteration);
}
order, iteration,
MED_NODE, MED_NONE,
MED_NODE, MED_NONE,
- _correspondence->getNbOfElems()/2,
- _correspondence->getConstPointer()));
+ ToMedInt(_correspondence->getNbOfElems()/2),
+ ToMedIntArray(_correspondence)->getConstPointer()));
}
else
{
order, iteration,
MED_CELL, typmai3[ _loc_geo_type ],
MED_CELL, typmai3[ _rem_geo_type ],
- _correspondence->getNbOfElems()/2,
- _correspondence->getConstPointer()));
+ ToMedInt(_correspondence->getNbOfElems()/2),
+ ToMedIntArray(_correspondence)->getConstPointer()));
}
}
-void MEDFileJointCorrespondence::setCorrespondence(DataArrayInt *corr)
+void MEDFileJointCorrespondence::setCorrespondence(DataArrayIdType *corr)
{
_correspondence=corr;
if ( corr )
oss << "- entity type of the correspondence : " << ( getIsNodal() ? "NODE" : "CELL" ) << "\n";
oss << "- Local geometry type of the correspondence : " << INTERP_KERNEL::CellModel::GetCellModel( _loc_geo_type ).getRepr() << "\n";
oss << "- Remote geometry type of the correspondence : " << INTERP_KERNEL::CellModel::GetCellModel( _rem_geo_type ).getRepr() << "\n";
- if ( (const DataArrayInt *)_correspondence )
+ if ( (const DataArrayIdType *)_correspondence )
{
oss << "- Number entity of the correspondence : " << getCorrespondence()->getNumberOfTuples() << "\n";
- const DataArrayInt* tmp=getCorrespondence();
+ const DataArrayIdType* tmp=getCorrespondence();
oss << "- Correspondence : <<";
- for(const int *it=tmp->begin();it!=tmp->end();it++)
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++)
oss<< *it << " ";
}
else
std::size_t MEDFileJointOneStep::getHeapMemorySizeWithoutChildren() const
{
- return _correspondences.capacity()*sizeof(MCAuto<DataArrayInt>);
+ return _correspondences.capacity()*sizeof(MCAuto<DataArrayIdType>);
}
std::vector<const BigMemoryObject *> MEDFileJointOneStep::getDirectChildrenWithNull() const
MEDFileJointOneStep::MEDFileJointOneStep(med_idt fid, const std::string& mName, const std::string& jointName, int num)
{
- int order, iteration, ncorrespondence;
+ med_int order, iteration, ncorrespondence;
MEDFILESAFECALLERRD0(MEDsubdomainComputingStepInfo,(fid, mName.c_str(), jointName.c_str(), num, &order, &iteration, &ncorrespondence));
- MEDFileJointOneStep::setOrder(order);
- MEDFileJointOneStep::setIteration(iteration);
+ MEDFileJointOneStep::setOrder(FromMedInt<int>(order));
+ MEDFileJointOneStep::setIteration(FromMedInt<int>(iteration));
for ( int cur_it = 1; cur_it <= ncorrespondence; ++cur_it )
{
- int num_entity;
+ med_int num_entity;
med_entity_type loc_ent_type, rem_ent_type;
med_geometry_type loc_geo_type, rem_geo_type;
MEDFILESAFECALLERRD0(MEDsubdomainCorrespondenceSizeInfo,(fid, mName.c_str(), jointName.c_str(), order, iteration, cur_it,
&loc_ent_type, &loc_geo_type, &rem_ent_type, &rem_geo_type, &num_entity));
if ( num_entity > 0 )
{
- MCAuto<DataArrayInt> correspondence=DataArrayInt::New();
+ MCAuto<DataArrayMedInt> correspondence=DataArrayMedInt::New();
correspondence->alloc(num_entity*2, 1);
MEDFILESAFECALLERRD0(MEDsubdomainCorrespondenceRd,(fid, mName.c_str(), jointName.c_str(), order, iteration, loc_ent_type,
loc_geo_type, rem_ent_type, rem_geo_type, correspondence->getPointer()));
cor->setIsNodal( loc_ent_type == MED_NODE );
cor->setLocalGeometryType ( convertGeometryType( loc_geo_type ));
cor->setRemoteGeometryType( convertGeometryType( rem_geo_type ));
- cor->setCorrespondence( correspondence );
+ cor->setCorrespondence( FromMedIntArray<mcIdType>(correspondence ));
_correspondences.push_back(cor);
}
}
med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
std::ostringstream oss; oss << "MEDFileJointOneStep : error on attempt to write in file : \"" << fileName << "\"";
- MEDFileUtilities::CheckMEDCode(fid,fid,oss.str());
+ MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str());
if ( _correspondences.empty() )
throw INTERP_KERNEL::Exception("MEDFileJointOneStep::write : no correspondences defined !");
writeLL(fid, localMeshName, jointName);
int MEDFileJointOneStep::getNumberOfCorrespondences() const
{
- return _correspondences.size();
+ return (int)_correspondences.size();
}
/** Return a borrowed reference (caller is not responsible) */
INTERP_KERNEL::AutoPtr<char> joint_name=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
INTERP_KERNEL::AutoPtr<char> desc_name=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
INTERP_KERNEL::AutoPtr<char> rem_mesh_name=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
- int domain_number=0, nstep=0, nocstpncorrespondence=0;
+ med_int domain_number=0, nstep=0, nocstpncorrespondence=0;
MEDFILESAFECALLERRD0(MEDsubdomainJointInfo,(fid,mName.c_str(), curJoint, joint_name, desc_name, &domain_number,rem_mesh_name,
&nstep, &nocstpncorrespondence));
setLocalMeshName(mName);
setRemoteMeshName(MEDLoaderBase::buildStringFromFortran(rem_mesh_name,MED_NAME_SIZE));
setDescription(MEDLoaderBase::buildStringFromFortran(desc_name,MED_COMMENT_SIZE));
setJointName(MEDLoaderBase::buildStringFromFortran(joint_name,MED_NAME_SIZE));
- setDomainNumber(domain_number);
+ setDomainNumber(FromMedInt<int>(domain_number));
for(int cur_step=1; cur_step <= nstep; ++cur_step)
{
MEDFileJointOneStep *cor=MEDFileJointOneStep::New(fid, mName.c_str(), getJointName(), cur_step);
int MEDFileJoint::getNumberOfSteps() const
{
- return _joint.size();
+ return (int)_joint.size();
}
/** Return a borrowed reference (caller is not responsible) */
int MEDFileJoints::getNumberOfJoints() const
{
- return _joints.size();
+ return (int)_joints.size();
}
/** Return a borrowed reference (caller is not responsible) */
MEDFileJoints::MEDFileJoints(med_idt fid, const std::string& meshName)
{
- int num_joint=MEDnSubdomainJoint(fid, meshName.c_str() );
+ med_int num_joint=MEDnSubdomainJoint(fid, meshName.c_str() );
for(int i = 1; i <= num_joint; i++)
_joints.push_back(MEDFileJoint::New(fid,meshName,i));
}
{
public:
MEDLOADER_EXPORT static MEDFileJointCorrespondence *New();
- MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayInt* correspondence); // nodes
- MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayInt* correspondence, // cells
+ MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence); // nodes
+ MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells
INTERP_KERNEL::NormalizedCellType loc_geo_type,
INTERP_KERNEL::NormalizedCellType rem_geo_type);
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const { return _loc_geo_type; }
MEDLOADER_EXPORT void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type) { _rem_geo_type=type; }
MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const { return _rem_geo_type; }
- MEDLOADER_EXPORT void setCorrespondence(DataArrayInt *corr);
- MEDLOADER_EXPORT const DataArrayInt *getCorrespondence() const { return _correspondence; }
+ MEDLOADER_EXPORT void setCorrespondence(DataArrayIdType *corr);
+ MEDLOADER_EXPORT const DataArrayIdType *getCorrespondence() const { return _correspondence; }
MEDLOADER_EXPORT void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
MEDLOADER_EXPORT std::string simpleRepr() const;
MEDLOADER_EXPORT void writeLL(med_idt fid, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
private:
MEDFileJointCorrespondence();
- MEDFileJointCorrespondence(DataArrayInt* correspondence,
+ MEDFileJointCorrespondence(DataArrayIdType* correspondence,
bool is_nodal = true,
INTERP_KERNEL::NormalizedCellType loc_geo_type = INTERP_KERNEL::NORM_ERROR,
INTERP_KERNEL::NormalizedCellType rem_geo_type = INTERP_KERNEL::NORM_ERROR);
bool _is_nodal;
INTERP_KERNEL::NormalizedCellType _loc_geo_type;
INTERP_KERNEL::NormalizedCellType _rem_geo_type;
- MCAuto<DataArrayInt> _correspondence;
+ MCAuto<DataArrayIdType> _correspondence;
};
/*!
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
+#include "MEDCouplingMemArray.txx"
#include "InterpKernelAutoPtr.hxx"
for(std::vector<std::string>::const_iterator it2=(*it).second.begin();it2!=(*it).second.end();it2++)
ret+=(*it2).capacity();
}
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
- ret+=(*it).first.capacity()+sizeof(int);
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
+ ret+=(*it).first.capacity()+sizeof(mcIdType);
return ret;
}
* \return std::vector<int> - sequence of ids of the families.
* \throw If the name of a nonexistent group is specified.
*/
-std::vector<int> MEDFileMesh::getFamiliesIdsOnGroup(const std::string& name) const
+std::vector<mcIdType> MEDFileMesh::getFamiliesIdsOnGroup(const std::string& name) const
{
std::string oname(name);
std::map<std::string, std::vector<std::string> >::const_iterator it=_groups.find(oname);
_groups[oname]=fams;
for(std::vector<std::string>::const_iterator it1=fams.begin();it1!=fams.end();it1++)
{
- std::map<std::string,int>::iterator it2=_families.find(*it1);
+ std::map<std::string,mcIdType>::iterator it2=_families.find(*it1);
if(it2==_families.end())
_families[*it1]=0;
}
* \param [in] famIds - a sequence of ids of families constituting the group.
* \throw If a family name is not found by its id.
*/
-void MEDFileMesh::setFamiliesIdsOnGroup(const std::string& name, const std::vector<int>& famIds)
+void MEDFileMesh::setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds)
{
std::string oname(name);
std::vector<std::string> fams(famIds.size());
int i=0;
- for(std::vector<int>::const_iterator it1=famIds.begin();it1!=famIds.end();it1++,i++)
+ for(std::vector<mcIdType>::const_iterator it1=famIds.begin();it1!=famIds.end();it1++,i++)
{
std::string name2=getFamilyNameGivenId(*it1);
fams[i]=name2;
void MEDFileMesh::setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps)
{
std::string fName(famName);
- const std::map<std::string,int>::const_iterator it=_families.find(fName);
+ const std::map<std::string,mcIdType>::const_iterator it=_families.find(fName);
if(it==_families.end())
{
std::vector<std::string> fams=getFamiliesNames();
{
std::vector<std::string> ret(_families.size());
int i=0;
- for(std::map<std::string, int >::const_iterator it=_families.begin();it!=_families.end();it++,i++)
+ for(std::map<std::string, mcIdType >::const_iterator it=_families.begin();it!=_families.end();it++,i++)
ret[i]=(*it).first;
return ret;
}
std::vector<std::string> allGrps(getGroupsNames());
for(std::vector<std::string>::const_iterator it=allGrps.begin();it!=allGrps.end();it++)
{
- std::vector<int> levs(getGrpNonEmptyLevelsExt((*it)));
+ std::vector<mcIdType> levs(getGrpNonEmptyLevelsExt((*it)));
if(std::find(levs.begin(),levs.end(),meshDimRelToMaxExt)!=levs.end())
ret.push_back(*it);
}
/*!
* Returns all relative mesh levels (including nodes) where a given group is defined.
* \param [in] grp - the name of the group of interest.
- * \return std::vector<int> - a sequence of the relative dimensions.
+ * \return std::vector<mcIdType> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileMesh::getGrpNonEmptyLevelsExt(const std::string& grp) const
+std::vector<mcIdType> MEDFileMesh::getGrpNonEmptyLevelsExt(const std::string& grp) const
{
std::vector<std::string> fams(getFamiliesOnGroup(grp));
return getFamsNonEmptyLevelsExt(fams);
* Returns all relative mesh levels (**excluding nodes**) where given groups are defined.
* To include nodes, call getGrpsNonEmptyLevelsExt() method.
* \param [in] grps - a sequence of names of the groups of interest.
- * \return std::vector<int> - a sequence of the relative dimensions.
+ * \return std::vector<mcIdType> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileMesh::getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const
+std::vector<mcIdType> MEDFileMesh::getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const
{
std::vector<std::string> fams(getFamiliesOnGroups(grps));
return getFamsNonEmptyLevels(fams);
/*!
* Returns all relative mesh levels (including nodes) where given groups are defined.
* \param [in] grps - a sequence of names of the groups of interest.
- * \return std::vector<int> - a sequence of the relative dimensions.
+ * \return std::vector<mcIdType> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileMesh::getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const
+std::vector<mcIdType> MEDFileMesh::getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const
{
std::vector<std::string> fams(getFamiliesOnGroups(grps));
return getFamsNonEmptyLevelsExt(fams);
* Returns all relative mesh levels (**excluding nodes**) where a given group is defined.
* To include nodes, call getGrpNonEmptyLevelsExt() method.
* \param [in] grp - the name of the group of interest.
- * \return std::vector<int> - a sequence of the relative dimensions.
+ * \return std::vector<mcIdType> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileMesh::getGrpNonEmptyLevels(const std::string& grp) const
+std::vector<mcIdType> MEDFileMesh::getGrpNonEmptyLevels(const std::string& grp) const
{
std::vector<std::string> fams(getFamiliesOnGroup(grp));
return getFamsNonEmptyLevels(fams);
* Returns all relative mesh levels (**excluding nodes**) where a given family is defined.
* To include nodes, call getFamNonEmptyLevelsExt() method.
* \param [in] fam - the name of the family of interest.
- * \return std::vector<int> - a sequence of the relative dimensions.
+ * \return std::vector<mcIdType> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileMesh::getFamNonEmptyLevels(const std::string& fam) const
+std::vector<mcIdType> MEDFileMesh::getFamNonEmptyLevels(const std::string& fam) const
{
std::vector<std::string> fams(1,std::string(fam));
return getFamsNonEmptyLevels(fams);
/*!
* Returns all relative mesh levels (including nodes) where a given family is defined.
* \param [in] fam - the name of the family of interest.
- * \return std::vector<int> - a sequence of the relative dimensions.
+ * \return std::vector<mcIdType> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileMesh::getFamNonEmptyLevelsExt(const std::string& fam) const
+std::vector<mcIdType> MEDFileMesh::getFamNonEmptyLevelsExt(const std::string& fam) const
{
std::vector<std::string> fams(1,std::string(fam));
return getFamsNonEmptyLevelsExt(fams);
void MEDFileMesh::assignFamilyNameWithGroupName()
{
std::map<std::string, std::vector<std::string> > groups(_groups);
- std::map<std::string,int> newFams;
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ std::map<std::string,mcIdType> newFams;
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
std::vector<std::string> grps=getGroupsOnFamily((*it).first);
if(grps.size()==1 && groups[grps[0]].size()==1)
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
const std::vector<std::string> &famsOnGrp((*it).second);
- std::vector<int> famIds(getFamiliesIdsOnGroup(name));
- const DataArrayInt *famArr(getFamilyFieldAtLevel(meshDimRelToMaxExt));
+ std::vector<mcIdType> famIds(getFamiliesIdsOnGroup(name));
+ const DataArrayIdType *famArr(getFamilyFieldAtLevel(meshDimRelToMaxExt));
if(!famArr)
return ;
- MCAuto<DataArrayInt> vals(famArr->getDifferentValues());
- MCAuto<DataArrayInt> famIds2(DataArrayInt::NewFromStdVector(famIds));
- MCAuto<DataArrayInt> idsToKill(famIds2->buildIntersection(vals));
+ MCAuto<DataArrayIdType> vals(famArr->getDifferentValues());
+ MCAuto<DataArrayIdType> famIds2(DataArrayIdType::NewFromStdVector(famIds));
+ MCAuto<DataArrayIdType> idsToKill(famIds2->buildIntersection(vals));
if(idsToKill->empty())
return ;
std::vector<std::string> newFamsOnGrp;
void MEDFileMesh::removeFamily(const std::string& name)
{
std::string oname(name);
- std::map<std::string, int >::iterator it=_families.find(oname);
+ std::map<std::string, mcIdType >::iterator it=_families.find(oname);
std::vector<std::string> fams=getFamiliesNames();
if(it==_families.end())
{
*/
std::vector<std::string> MEDFileMesh::removeOrphanFamilies()
{
- MCAuto<DataArrayInt> allFamIdsInUse=computeAllFamilyIdsInUse();
+ MCAuto<DataArrayIdType> allFamIdsInUse=computeAllFamilyIdsInUse();
std::vector<std::string> ret;
- if(!((DataArrayInt*)allFamIdsInUse))
+ if(!((DataArrayIdType*)allFamIdsInUse))
{
ret=getFamiliesNames();
_families.clear(); _groups.clear();
return ret;
}
- std::map<std::string,int> famMap;
+ std::map<std::string,mcIdType> famMap;
std::map<std::string, std::vector<std::string> > grps(_groups);
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
if(allFamIdsInUse->presenceOfValue((*it).second))
famMap[(*it).first]=(*it).second;
*/
void MEDFileMesh::removeFamiliesReferedByNoGroups()
{
- std::map<std::string,int> fams;
+ std::map<std::string,mcIdType> fams;
std::set<std::string> sfams;
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
sfams.insert((*it).first);
for(std::map<std::string, std::vector<std::string> >::const_iterator it0=_groups.begin();it0!=_groups.end();it0++)
for(std::vector<std::string>::const_iterator it1=(*it0).second.begin();it1!=(*it0).second.end();it1++)
removeFamiliesReferedByNoGroups();
//
std::vector<int> levels(getNonEmptyLevelsExt());
- std::set<int> idsRefed;
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ std::set<mcIdType> idsRefed;
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
idsRefed.insert((*it).second);
if((*it).second==0)
}
for(std::vector<int>::const_iterator it=levels.begin();it!=levels.end();it++)
{
- const DataArrayInt *fams(0);
+ const DataArrayIdType *fams(0);
try
{
fams=getFamilyFieldAtLevel(*it);
if(!fams)
continue;
std::vector<bool> v(fams->getNumberOfTuples(),false);
- for(std::set<int>::const_iterator pt=idsRefed.begin();pt!=idsRefed.end();pt++)
+ for(std::set<mcIdType>::const_iterator pt=idsRefed.begin();pt!=idsRefed.end();pt++)
fams->switchOnTupleEqualTo(*pt,v);
- MCAuto<DataArrayInt> unfetchedIds(DataArrayInt::BuildListOfSwitchedOff(v));
+ MCAuto<DataArrayIdType> unfetchedIds(DataArrayIdType::BuildListOfSwitchedOff(v));
if(!unfetchedIds->empty())
{
- MCAuto<DataArrayInt> newFams(fams->deepCopy());
+ MCAuto<DataArrayIdType> newFams(fams->deepCopy());
newFams->setPartOfValuesSimple3(0,unfetchedIds->begin(),unfetchedIds->end(),0,1,1);
setFamilyFieldArr(*it,newFams);
}
}
//
std::map<std::string, std::vector<std::string> > newGroups(_groups);
- std::map<std::string,int> newFams(_families);
+ std::map<std::string,mcIdType> newFams(_families);
std::vector<int> levels(getNonEmptyLevelsExt());
- std::map<int, std::vector<int> > famIdsToSubstitute;
+ std::map<mcIdType, std::vector<mcIdType> > famIdsToSubstitute;
// iterate on all different set of groups
std::set<std::string> familiesToKill;
for(auto setOfCommonGrp : setOfFamilies)
{
for(std::vector<int>::const_iterator it=levels.begin();it!=levels.end();it++)
{
- DataArrayInt *fams(nullptr);
+ DataArrayIdType *fams(nullptr);
try
{
fams=getFamilyFieldAtLevel(*it);
catch(INTERP_KERNEL::Exception& e) { }
if(!fams)
continue;
- MCAuto<DataArrayInt> idsToModif(fams->findIdsEqualList(famIdsSubstSession.second.data(),famIdsSubstSession.second.data()+famIdsSubstSession.second.size()));
+ MCAuto<DataArrayIdType> idsToModif(fams->findIdsEqualList(famIdsSubstSession.second.data(),famIdsSubstSession.second.data()+famIdsSubstSession.second.size()));
fams->setPartOfValuesSimple3(famIdsSubstSession.first,idsToModif->begin(),idsToModif->end(),0,1,1);
}
}
* \param [in] oldId - a current id of the family.
* \param [in] newId - a new family id.
*/
-void MEDFileMesh::changeFamilyId(int oldId, int newId)
+void MEDFileMesh::changeFamilyId(mcIdType oldId, mcIdType newId)
{
changeFamilyIdArr(oldId,newId);
- std::map<std::string,int> fam2;
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ std::map<std::string,mcIdType> fam2;
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
if((*it).second==oldId)
fam2[(*it).first]=newId;
void MEDFileMesh::changeFamilyName(const std::string& oldName, const std::string& newName)
{
std::string oname(oldName);
- std::map<std::string, int >::iterator it=_families.find(oname);
+ std::map<std::string, mcIdType >::iterator it=_families.find(oname);
std::vector<std::string> fams=getFamiliesNames();
if(it==_families.end())
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
std::string nname(newName);
- std::map<std::string, int >::iterator it2=_families.find(nname);
+ std::map<std::string, mcIdType >::iterator it2=_families.find(nname);
if(it2!=_families.end())
{
std::ostringstream oss; oss << "Such familyname \"" << newName << " already exists ! Kill it before !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int cpy=(*it).second;
+ mcIdType cpy=(*it).second;
_families.erase(it);
_families[newName]=cpy;
for(std::map<std::string, std::vector<std::string> >::iterator it3=_groups.begin();it3!=_groups.end();it3++)
{
if(_families==other->_families)
return true;
- std::map<std::string,int> fam0;
- std::map<std::string,int> fam1;
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ std::map<std::string,mcIdType> fam0;
+ std::map<std::string,mcIdType> fam1;
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
if((*it).second!=0)
fam0[(*it).first]=(*it).second;
- for(std::map<std::string,int>::const_iterator it=other->_families.begin();it!=other->_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=other->_families.begin();it!=other->_families.end();it++)
if((*it).second!=0)
fam1[(*it).first]=(*it).second;
return fam0==fam1;
* \param [in] famId - the family id.
* \return bool - \c true the family with the id \a famId exists in \a this mesh.
*/
-bool MEDFileMesh::existsFamily(int famId) const
+bool MEDFileMesh::existsFamily(mcIdType famId) const
{
- for(std::map<std::string,int>::const_iterator it2=_families.begin();it2!=_families.end();it2++)
+ for(std::map<std::string,mcIdType>::const_iterator it2=_families.begin();it2!=_families.end();it2++)
if((*it2).second==famId)
return true;
return false;
* \param [in] familyName - the family name.
* \param [in] id - a new id of the family.
*/
-void MEDFileMesh::setFamilyId(const std::string& familyName, int id)
+void MEDFileMesh::setFamilyId(const std::string& familyName, mcIdType id)
{
std::string fname(familyName);
_families[fname]=id;
}
-void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, int id)
+void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, mcIdType id)
{
std::string fname(familyName);
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
if((*it).second==id)
{
if((*it).first!=familyName)
* \param [in] famId - an id of the family.
* \throw If a family with the same name or id already exists in \a this mesh.
*/
-void MEDFileMesh::addFamily(const std::string& familyName, int famId)
+void MEDFileMesh::addFamily(const std::string& familyName, mcIdType famId)
{
std::string fname(familyName);
- std::map<std::string,int>::const_iterator it=_families.find(fname);
+ std::map<std::string,mcIdType>::const_iterator it=_families.find(fname);
if(it==_families.end())
{
- for(std::map<std::string,int>::const_iterator it2=_families.begin();it2!=_families.end();it2++)
+ for(std::map<std::string,mcIdType>::const_iterator it2=_families.begin();it2!=_families.end();it2++)
if((*it2).second==famId)
{
std::ostringstream oss;
oss << std::endl << "Please choose an another group name or call removeGroup(\"" << grpName << "\") method !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- const DataArrayInt *fieldFamIds=getFamilyFieldAtLevel(meshDimRelToMaxExt);
+ const DataArrayIdType *fieldFamIds=getFamilyFieldAtLevel(meshDimRelToMaxExt);
if(fieldFamIds==0)
throw INTERP_KERNEL::Exception("MEDFileMesh::createGroupOnAll : Family field arr ids is not defined for this level !");
- MCAuto<DataArrayInt> famIds=fieldFamIds->getDifferentValues();
+ MCAuto<DataArrayIdType> famIds=fieldFamIds->getDifferentValues();
std::vector<std::string> familiesOnWholeGroup;
- for(const int *it=famIds->begin();it!=famIds->end();it++)
+ for(const mcIdType *it=famIds->begin();it!=famIds->end();it++)
{
bool tmp;
familiesOnWholeGroup.push_back(findOrCreateAndGiveFamilyWithId(*it,tmp));
* famIds should exclusively belong.
* \return bool - \c true if no modification is done in \a this mesh by this method.
*/
-bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& vMeshDimRelToMaxExt)
+bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& vMeshDimRelToMaxExt)
{
std::set<int> levsInput(vMeshDimRelToMaxExt.begin(),vMeshDimRelToMaxExt.end());
std::vector<int> levs=getNonEmptyLevelsExt();
std::set<int> levs2(levs.begin(),levs.end());
std::vector<int> levsToTest;
std::set_difference(levs2.begin(),levs2.end(),levsInput.begin(),levsInput.end(),std::back_insert_iterator< std::vector<int> >(levsToTest));
- std::set<int> famIds2(famIds.begin(),famIds.end());
+ std::set<mcIdType> famIds2(famIds.begin(),famIds.end());
bool ret=true;
- int maxFamId=1;
+ mcIdType maxFamId=1;
if(!_families.empty())
maxFamId=getMaxFamilyId()+1;
std::vector<std::string> allFams=getFamiliesNames();
for(std::vector<int>::const_iterator it=levsToTest.begin();it!=levsToTest.end();it++)
{
- const DataArrayInt *fieldFamIds=getFamilyFieldAtLevel(*it);
+ const DataArrayIdType *fieldFamIds=getFamilyFieldAtLevel(*it);
if(fieldFamIds)
{
- MCAuto<DataArrayInt> famIds3=fieldFamIds->getDifferentValues();
- std::vector<int> tmp;
- std::set_intersection(famIds3->begin(),famIds3->end(),famIds2.begin(),famIds2.end(),std::back_insert_iterator< std::vector<int> >(tmp));
- for(std::vector<int>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ MCAuto<DataArrayIdType> famIds3=fieldFamIds->getDifferentValues();
+ std::vector<mcIdType> tmp;
+ std::set_intersection(famIds3->begin(),famIds3->end(),famIds2.begin(),famIds2.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
+ for(std::vector<mcIdType>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
{
ret=false;
std::string famName=getFamilyNameGivenId(*it2);
std::string zeName=CreateNameNotIn(oss.str(),allFams);
addFamilyOnAllGroupsHaving(famName,zeName);
_families[zeName]=maxFamId;
- (const_cast<DataArrayInt *>(fieldFamIds))->changeValue(*it2,maxFamId);
+ (const_cast<DataArrayIdType *>(fieldFamIds))->changeValue(*it2,maxFamId);
maxFamId++;
}
}
}
}
-void MEDFileMesh::checkNoGroupClash(const DataArrayInt *famArr, const std::string& grpName) const
+void MEDFileMesh::checkNoGroupClash(const DataArrayIdType *famArr, const std::string& grpName) const
{
std::vector<std::string> grpsNames(getGroupsNames());
if(std::find(grpsNames.begin(),grpsNames.end(),grpName)==grpsNames.end())
return ;
- std::vector<int> famIds(getFamiliesIdsOnGroup(grpName));
+ std::vector<mcIdType> famIds(getFamiliesIdsOnGroup(grpName));
if(famArr->presenceOfValue(famIds))
{
std::ostringstream oss; oss << "MEDFileUMesh::addGroup : Group with name \"" << grpName << "\" already exists at specified level ! Destroy it before calling this method !";
/*!
* \param [in] ids ids and group name of the new group to add. The ids should be sorted and different each other (MED file norm).
- * \parma [in,out] famArr family array on level of interest to be renumbered. The input pointer should be not \c NULL (no check of that will be performed)
+ * \param [in,out] famArr family array on level of interest to be renumbered. The input pointer should be not \c NULL (no check of that will be performed)
*/
-void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, DataArrayInt *famArr)
+void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayIdType *ids, DataArrayIdType *famArr)
{
if(!ids)
throw INTERP_KERNEL::Exception("MEDFileUMesh::addGroup : NULL pointer in input !");
throw INTERP_KERNEL::Exception("MEDFileUMesh::addGroup : empty group name ! MED file format do not accept empty group name !");
ids->checkStrictlyMonotonic(true);
checkNoGroupClash(famArr,grpName);
- MCAuto<DataArrayInt> famArrTmp; famArrTmp.takeRef(famArr);
- std::list< MCAuto<DataArrayInt> > allFamIds(getAllNonNullFamilyIds());
+ MCAuto<DataArrayIdType> famArrTmp; famArrTmp.takeRef(famArr);
+ std::list< MCAuto<DataArrayIdType> > allFamIds(getAllNonNullFamilyIds());
allFamIds.erase(std::find(allFamIds.begin(),allFamIds.end(),famArrTmp));
- MCAuto<DataArrayInt> famIds=famArr->selectByTupleIdSafe(ids->begin(),ids->end());
- MCAuto<DataArrayInt> diffFamIds=famIds->getDifferentValues();
- std::vector<int> familyIds;
- std::vector< MCAuto<DataArrayInt> > idsPerfamiliyIds;
- int maxVal=getTheMaxAbsFamilyId()+1;
- std::map<std::string,int> families(_families);
+ MCAuto<DataArrayIdType> famIds=famArr->selectByTupleIdSafe(ids->begin(),ids->end());
+ MCAuto<DataArrayIdType> diffFamIds=famIds->getDifferentValues();
+ std::vector<mcIdType> familyIds;
+ std::vector< MCAuto<DataArrayIdType> > idsPerfamiliyIds;
+ mcIdType maxVal=getTheMaxAbsFamilyId()+1;
+ std::map<std::string,mcIdType> families(_families);
std::map<std::string, std::vector<std::string> > groups(_groups);
std::vector<std::string> fams;
bool created(false);
- for(const int *famId=diffFamIds->begin();famId!=diffFamIds->end();famId++)
+ for(const mcIdType *famId=diffFamIds->begin();famId!=diffFamIds->end();famId++)
{
- MCAuto<DataArrayInt> ids2Tmp=famIds->findIdsEqual(*famId);
- MCAuto<DataArrayInt> ids2=ids->selectByTupleId(ids2Tmp->begin(),ids2Tmp->end());
- MCAuto<DataArrayInt> ids1=famArr->findIdsEqual(*famId);
- MCAuto<DataArrayInt> ret0(ids1->buildSubstractionOptimized(ids2));
+ MCAuto<DataArrayIdType> ids2Tmp=famIds->findIdsEqual(*famId);
+ MCAuto<DataArrayIdType> ids2=ids->selectByTupleId(ids2Tmp->begin(),ids2Tmp->end());
+ MCAuto<DataArrayIdType> ids1=famArr->findIdsEqual(*famId);
+ MCAuto<DataArrayIdType> ret0(ids1->buildSubstractionOptimized(ids2));
if(ret0->empty())
{
bool isFamPresent=false;
- for(std::list< MCAuto<DataArrayInt> >::const_iterator itl=allFamIds.begin();itl!=allFamIds.end() && !isFamPresent;itl++)
+ for(std::list< MCAuto<DataArrayIdType> >::const_iterator itl=allFamIds.begin();itl!=allFamIds.end() && !isFamPresent;itl++)
isFamPresent=(*itl)->presenceOfValue(*famId);
if(!isFamPresent && *famId!=0)
{ familyIds.push_back(*famId); idsPerfamiliyIds.push_back(ret0); fams.push_back(FindOrCreateAndGiveFamilyWithId(families,*famId,created)); } // adding *famId in grp
}
for(std::size_t i=0;i<familyIds.size();i++)
{
- DataArrayInt *da=idsPerfamiliyIds[i];
+ DataArrayIdType *da=idsPerfamiliyIds[i];
famArr->setPartOfValuesSimple3(familyIds[i],da->begin(),da->end(),0,1,1);
}
_families=families;
* \return std::string - the name of the existing or the created family.
* \throw If it is not possible to create a unique family name.
*/
-std::string MEDFileMesh::findOrCreateAndGiveFamilyWithId(int id, bool& created)
+std::string MEDFileMesh::findOrCreateAndGiveFamilyWithId(mcIdType id, bool& created)
{
return FindOrCreateAndGiveFamilyWithId(_families,id,created);
}
* will be modified.
* This method will throws an exception if it is not possible to create a unique family name.
*/
-std::string MEDFileMesh::FindOrCreateAndGiveFamilyWithId(std::map<std::string,int>& families, int id, bool& created)
+std::string MEDFileMesh::FindOrCreateAndGiveFamilyWithId(std::map<std::string,mcIdType>& families, mcIdType id, bool& created)
{
std::vector<std::string> famAlreadyExisting(families.size());
int ii=0;
- for(std::map<std::string,int>::const_iterator it=families.begin();it!=families.end();it++,ii++)
+ for(std::map<std::string,mcIdType>::const_iterator it=families.begin();it!=families.end();it++,ii++)
{
if((*it).second!=id)
{
* Sets names and ids of all families in \a this mesh.
* \param [in] info - a map of a family name to a family id.
*/
-void MEDFileMesh::setFamilyInfo(const std::map<std::string,int>& info)
+void MEDFileMesh::setFamilyInfo(const std::map<std::string,mcIdType>& info)
{
_families=info;
}
/*!
* Returns an id of the family having a given name.
* \param [in] name - the name of the family of interest.
- * \return int - the id of the family of interest.
+ * \return mcIdType - the id of the family of interest.
* \throw If no family with such a \a name exists.
*/
-int MEDFileMesh::getFamilyId(const std::string& name) const
+mcIdType MEDFileMesh::getFamilyId(const std::string& name) const
{
- std::map<std::string, int>::const_iterator it=_families.find(name);
+ std::map<std::string, mcIdType>::const_iterator it=_families.find(name);
if(it==_families.end())
{
std::vector<std::string> fams(getFamiliesNames());
/*!
* Returns ids of the families having given names.
* \param [in] fams - a sequence of the names of families of interest.
- * \return std::vector<int> - a sequence of the ids of families of interest.
+ * \return std::vector<mcIdType> - a sequence of the ids of families of interest.
* \throw If \a fams contains a name of an inexistent family.
*/
-std::vector<int> MEDFileMesh::getFamiliesIds(const std::vector<std::string>& fams) const
+std::vector<mcIdType> MEDFileMesh::getFamiliesIds(const std::vector<std::string>& fams) const
{
- std::vector<int> ret(fams.size());
+ std::vector<mcIdType> ret(fams.size());
int i=0;
for(std::vector<std::string>::const_iterator it=fams.begin();it!=fams.end();it++,i++)
{
- std::map<std::string, int>::const_iterator it2=_families.find(*it);
+ std::map<std::string, mcIdType>::const_iterator it2=_families.find(*it);
if(it2==_families.end())
{
std::vector<std::string> fams2=getFamiliesNames();
/*!
* Returns a maximal abs(id) of families in \a this mesh.
- * \return int - the maximal norm of family id.
+ * \return mcIdType - the maximal norm of family id.
* \throw If there are no families in \a this mesh.
*/
-int MEDFileMesh::getMaxAbsFamilyId() const
+mcIdType MEDFileMesh::getMaxAbsFamilyId() const
{
if(_families.empty())
throw INTERP_KERNEL::Exception("MEDFileMesh::getMaxFamilyId : no families set !");
- int ret=-std::numeric_limits<int>::max();
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ mcIdType ret=-std::numeric_limits<mcIdType>::max();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
ret=std::max(std::abs((*it).second),ret);
}
/*!
* Returns a maximal id of families in \a this mesh.
- * \return int - the maximal family id.
+ * \return mcIdType - the maximal family id.
* \throw If there are no families in \a this mesh.
*/
-int MEDFileMesh::getMaxFamilyId() const
+mcIdType MEDFileMesh::getMaxFamilyId() const
{
if(_families.empty())
throw INTERP_KERNEL::Exception("MEDFileMesh::getMaxFamilyId : no families set !");
- int ret=-std::numeric_limits<int>::max();
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ mcIdType ret=-std::numeric_limits<mcIdType>::max();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
ret=std::max((*it).second,ret);
}
/*!
* Returns a minimal id of families in \a this mesh.
- * \return int - the minimal family id.
+ * \return mcIdType - the minimal family id.
* \throw If there are no families in \a this mesh.
*/
-int MEDFileMesh::getMinFamilyId() const
+mcIdType MEDFileMesh::getMinFamilyId() const
{
if(_families.empty())
throw INTERP_KERNEL::Exception("MEDFileMesh::getMinFamilyId : no families set !");
- int ret=std::numeric_limits<int>::max();
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ mcIdType ret=std::numeric_limits<mcIdType>::max();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
ret=std::min((*it).second,ret);
}
/*!
* Returns a maximal id of families in \a this mesh. Not only named families are
* considered but all family fields as well.
- * \return int - the maximal family id.
+ * \return mcIdType - the maximal family id.
*/
-int MEDFileMesh::getTheMaxAbsFamilyId() const
+mcIdType MEDFileMesh::getTheMaxAbsFamilyId() const
{
- int m1=-std::numeric_limits<int>::max();
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ mcIdType m1=-std::numeric_limits<mcIdType>::max();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
m1=std::max(std::abs((*it).second),m1);
- int m2=getMaxAbsFamilyIdInArrays();
+ mcIdType m2=getMaxAbsFamilyIdInArrays();
return std::max(m1,m2);
}
/*!
* Returns a maximal id of families in \a this mesh. Not only named families are
* considered but all family fields as well.
- * \return int - the maximal family id.
+ * \return mcIdType - the maximal family id.
*/
-int MEDFileMesh::getTheMaxFamilyId() const
+mcIdType MEDFileMesh::getTheMaxFamilyId() const
{
- int m1=-std::numeric_limits<int>::max();
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ mcIdType m1=-std::numeric_limits<mcIdType>::max();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
m1=std::max((*it).second,m1);
- int m2=getMaxFamilyIdInArrays();
+ mcIdType m2=getMaxFamilyIdInArrays();
return std::max(m1,m2);
}
/*!
* Returns a minimal id of families in \a this mesh. Not only named families are
* considered but all family fields as well.
- * \return int - the minimal family id.
+ * \return mcIdType - the minimal family id.
*/
-int MEDFileMesh::getTheMinFamilyId() const
+mcIdType MEDFileMesh::getTheMinFamilyId() const
{
- int m1=std::numeric_limits<int>::max();
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ mcIdType m1=std::numeric_limits<mcIdType>::max();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
m1=std::min((*it).second,m1);
- int m2=getMinFamilyIdInArrays();
+ mcIdType m2=getMinFamilyIdInArrays();
return std::min(m1,m2);
}
*
* \sa MEDFileMesh::computeAllFamilyIdsInUse
*/
-DataArrayInt *MEDFileMesh::getAllFamiliesIdsReferenced() const
+DataArrayIdType *MEDFileMesh::getAllFamiliesIdsReferenced() const
{
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- std::set<int> v;
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ std::set<mcIdType> v;
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
v.insert((*it).second);
- ret->alloc((int)v.size(),1);
+ ret->alloc((mcIdType)v.size(),1);
std::copy(v.begin(),v.end(),ret->getPointer());
return ret.retn();
}
*
* \sa MEDFileMesh::getAllFamiliesIdsReferenced
*/
-DataArrayInt *MEDFileMesh::computeAllFamilyIdsInUse() const
+DataArrayIdType *MEDFileMesh::computeAllFamilyIdsInUse() const
{
std::vector<int> famLevs=getFamArrNonEmptyLevelsExt();
- MCAuto<DataArrayInt> ret;
+ MCAuto<DataArrayIdType> ret;
for(std::vector<int>::const_iterator it=famLevs.begin();it!=famLevs.end();it++)
{
- const DataArrayInt *arr=getFamilyFieldAtLevel(*it);//arr not null due to spec of getFamArrNonEmptyLevelsExt
- MCAuto<DataArrayInt> dv=arr->getDifferentValues();
- if((DataArrayInt *) ret)
+ const DataArrayIdType *arr=getFamilyFieldAtLevel(*it);//arr not null due to spec of getFamArrNonEmptyLevelsExt
+ MCAuto<DataArrayIdType> dv=arr->getDifferentValues();
+ if((DataArrayIdType *) ret)
ret=dv->buildUnion(ret);
else
ret=dv;
bool MEDFileMesh::ensureDifferentFamIdsPerLevel()
{
std::vector<int> levs=getNonEmptyLevelsExt();
- std::set<int> allFamIds;
- int maxId=getMaxFamilyId()+1;
- std::map<int,std::vector<int> > famIdsToRenum;
+ std::set<mcIdType> allFamIds;
+ mcIdType maxId=getMaxFamilyId()+1;
+ std::map<int,std::vector<mcIdType> > famIdsToRenum;
for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
{
- const DataArrayInt *fam=getFamilyFieldAtLevel(*it);
+ const DataArrayIdType *fam=getFamilyFieldAtLevel(*it);
if(fam)
{
- MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
- std::set<int> r2;
+ MCAuto<DataArrayIdType> tmp=fam->getDifferentValues();
+ std::set<mcIdType> r2;
std::set_intersection(tmp->begin(),tmp->end(),allFamIds.begin(),allFamIds.end(),std::inserter(r2,r2.end()));
if(!r2.empty())
famIdsToRenum[*it].insert(famIdsToRenum[*it].end(),r2.begin(),r2.end());
- std::set<int> r3;
+ std::set<mcIdType> r3;
std::set_union(tmp->begin(),tmp->end(),allFamIds.begin(),allFamIds.end(),std::inserter(r3,r3.end()));
}
}
if(famIdsToRenum.empty())
return true;
- MCAuto<DataArrayInt> allIds=getAllFamiliesIdsReferenced();
- for(std::map<int,std::vector<int> >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++)
+ MCAuto<DataArrayIdType> allIds=getAllFamiliesIdsReferenced();
+ for(std::map<int,std::vector<mcIdType> >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++)
{
- DataArrayInt *fam=const_cast<DataArrayInt *>(getFamilyFieldAtLevel((*it2).first));
- int *famIdsToChange=fam->getPointer();
- std::map<int,int> ren;
- for(std::vector<int>::const_iterator it3=(*it2).second.begin();it3!=(*it2).second.end();it3++,maxId++)
+ DataArrayIdType *fam=const_cast<DataArrayIdType *>(getFamilyFieldAtLevel((*it2).first));
+ mcIdType *famIdsToChange=fam->getPointer();
+ std::map<mcIdType,mcIdType> ren;
+ for(std::vector<mcIdType>::const_iterator it3=(*it2).second.begin();it3!=(*it2).second.end();it3++,maxId++)
{
if(allIds->presenceOfValue(*it3))
{
addFamilyOnGrp((*it4),newFam);
}
}
- MCAuto<DataArrayInt> ids=fam->findIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size());
- for(const int *id=ids->begin();id!=ids->end();id++)
+ MCAuto<DataArrayIdType> ids=fam->findIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size());
+ for(const mcIdType *id=ids->begin();id!=ids->end();id++)
famIdsToChange[*id]=ren[famIdsToChange[*id]];
}
return false;
void MEDFileMesh::normalizeFamIdsTrio()
{
ensureDifferentFamIdsPerLevel();
- MCAuto<DataArrayInt> allIds=getAllFamiliesIdsReferenced();
+ MCAuto<DataArrayIdType> allIds=getAllFamiliesIdsReferenced();
std::vector<int> levs=getNonEmptyLevelsExt();
std::set<int> levsS(levs.begin(),levs.end());
std::set<std::string> famsFetched;
- std::map<std::string,int> families;
+ std::map<std::string,mcIdType> families;
if(std::find(levs.begin(),levs.end(),0)!=levs.end())
{
levsS.erase(0);
- const DataArrayInt *fam=getFamilyFieldAtLevel(0);
+ const DataArrayIdType *fam=getFamilyFieldAtLevel(0);
if(fam)
{
- int refId=1;
- MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
- std::map<int,int> ren;
- for(const int *it=tmp->begin();it!=tmp->end();it++,refId++)
+ mcIdType refId=1;
+ MCAuto<DataArrayIdType> tmp=fam->getDifferentValues();
+ std::map<mcIdType,mcIdType> ren;
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId++)
ren[*it]=refId;
- int nbOfTuples=fam->getNumberOfTuples();
- int *start=const_cast<DataArrayInt *>(fam)->getPointer();
- for(int *w=start;w!=start+nbOfTuples;w++)
+ mcIdType nbOfTuples=fam->getNumberOfTuples();
+ mcIdType *start=const_cast<DataArrayIdType *>(fam)->getPointer();
+ for(mcIdType *w=start;w!=start+nbOfTuples;w++)
*w=ren[*w];
- for(const int *it=tmp->begin();it!=tmp->end();it++)
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++)
{
if(allIds->presenceOfValue(*it))
{
if(std::find(levs.begin(),levs.end(),-1)!=levs.end())
{
levsS.erase(-1);
- const DataArrayInt *fam=getFamilyFieldAtLevel(-1);
+ const DataArrayIdType *fam=getFamilyFieldAtLevel(-1);
if(fam)
{
- int refId=-1;
- MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
- std::map<int,int> ren;
- for(const int *it=tmp->begin();it!=tmp->end();it++,refId--)
+ mcIdType refId=-1;
+ MCAuto<DataArrayIdType> tmp=fam->getDifferentValues();
+ std::map<mcIdType,mcIdType> ren;
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId--)
ren[*it]=refId;
- int nbOfTuples=fam->getNumberOfTuples();
- int *start=const_cast<DataArrayInt *>(fam)->getPointer();
- for(int *w=start;w!=start+nbOfTuples;w++)
+ mcIdType nbOfTuples=fam->getNumberOfTuples();
+ mcIdType *start=const_cast<DataArrayIdType *>(fam)->getPointer();
+ for(mcIdType *w=start;w!=start+nbOfTuples;w++)
*w=ren[*w];
- for(const int *it=tmp->begin();it!=tmp->end();it++)
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++)
{
if(allIds->presenceOfValue(*it))
{
}
for(std::set<int>::const_iterator it2=levsS.begin();it2!=levsS.end();it2++)
{
- DataArrayInt *fam=const_cast<DataArrayInt*>(getFamilyFieldAtLevel(*it2));
+ DataArrayIdType *fam=const_cast<DataArrayIdType*>(getFamilyFieldAtLevel(*it2));
if(fam)
{
- MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
+ MCAuto<DataArrayIdType> tmp=fam->getDifferentValues();
fam->fillWithZero();
- for(const int *it3=tmp->begin();it3!=tmp->end();it3++)
+ for(const mcIdType *it3=tmp->begin();it3!=tmp->end();it3++)
if(allIds->presenceOfValue(*it3))
{
std::string famName=getFamilyNameGivenId(*it3);
void MEDFileMesh::normalizeFamIdsMEDFile()
{
ensureDifferentFamIdsPerLevel();
- MCAuto<DataArrayInt> allIds=getAllFamiliesIdsReferenced();
+ MCAuto<DataArrayIdType> allIds=getAllFamiliesIdsReferenced();
std::vector<int> levs=getNonEmptyLevelsExt();
std::set<int> levsS(levs.begin(),levs.end());
std::set<std::string> famsFetched;
- std::map<std::string,int> families;
- int refId=1;
+ std::map<std::string,mcIdType> families;
+ mcIdType refId=1;
if(std::find(levs.begin(),levs.end(),1)!=levs.end())
{
levsS.erase(1);
- const DataArrayInt *fam=getFamilyFieldAtLevel(1);
+ const DataArrayIdType *fam=getFamilyFieldAtLevel(1);
if(fam)
{
- MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
- std::map<int,int> ren;
- for(const int *it=tmp->begin();it!=tmp->end();it++,refId++)
+ MCAuto<DataArrayIdType> tmp=fam->getDifferentValues();
+ std::map<mcIdType,mcIdType> ren;
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId++)
ren[*it]=refId;
- int nbOfTuples=fam->getNumberOfTuples();
- int *start=const_cast<DataArrayInt *>(fam)->getPointer();
- for(int *w=start;w!=start+nbOfTuples;w++)
+ mcIdType nbOfTuples=fam->getNumberOfTuples();
+ mcIdType *start=const_cast<DataArrayIdType *>(fam)->getPointer();
+ for(mcIdType *w=start;w!=start+nbOfTuples;w++)
*w=ren[*w];
- for(const int *it=tmp->begin();it!=tmp->end();it++)
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++)
{
if(allIds->presenceOfValue(*it))
{
refId=-1;
for(std::set<int>::const_reverse_iterator it2=levsS.rbegin();it2!=levsS.rend();it2++)
{
- const DataArrayInt *fam=getFamilyFieldAtLevel(*it2);
+ const DataArrayIdType *fam=getFamilyFieldAtLevel(*it2);
if(fam)
{
- MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
- std::map<int,int> ren;
- for(const int *it=tmp->begin();it!=tmp->end();it++,refId--)
+ MCAuto<DataArrayIdType> tmp=fam->getDifferentValues();
+ std::map<mcIdType,mcIdType> ren;
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId--)
ren[*it]=refId;
- int nbOfTuples=fam->getNumberOfTuples();
- int *start=const_cast<DataArrayInt *>(fam)->getPointer();
- for(int *w=start;w!=start+nbOfTuples;w++)
+ mcIdType nbOfTuples=fam->getNumberOfTuples();
+ mcIdType *start=const_cast<DataArrayIdType *>(fam)->getPointer();
+ for(mcIdType *w=start;w!=start+nbOfTuples;w++)
*w=ren[*w];
- for(const int *it=tmp->begin();it!=tmp->end();it++)
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++)
{
if(allIds->presenceOfValue(*it))
{
* \return std::string - the name of the found family.
* \throw If no family with the given \a id exists.
*/
-std::string MEDFileMesh::getFamilyNameGivenId(int id) const
+std::string MEDFileMesh::getFamilyNameGivenId(mcIdType id) const
{
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
if((*it).second==id)
return (*it).first;
std::ostringstream oss; oss << "MEDFileUMesh::getFamilyNameGivenId : no such family id : " << id;
* This method is nearly like getFamilyFieldAtLevel method. Except that if the array does not exist at the specified level \a meshDimRelToMaxExt
* an empty one is created.
*/
-DataArrayInt *MEDFileMesh::getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
+DataArrayIdType *MEDFileMesh::getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
{
- DataArrayInt *ret(getFamilyFieldAtLevel(meshDimRelToMaxExt));
+ DataArrayIdType *ret(getFamilyFieldAtLevel(meshDimRelToMaxExt));
if(ret)
return ret;
- MCAuto<DataArrayInt> arr(DataArrayInt::New());
+ MCAuto<DataArrayIdType> arr(DataArrayIdType::New());
arr->alloc(getSizeAtLevel(meshDimRelToMaxExt),1);
arr->fillWithZero();
setFamilyFieldArr(meshDimRelToMaxExt,arr);
* \param [in] grp - the name of the group of interest.
* \param [in] renum - if \c true, the optional numbers of entities, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of mesh entities of the group. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the name of a nonexistent group is specified.
* \throw If the family field is missing for \a meshDimRelToMaxExt.
*/
-DataArrayInt *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum) const
+DataArrayIdType *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum) const
{
std::vector<std::string> tmp(1);
tmp[0]=grp;
- DataArrayInt *ret=getGroupsArr(meshDimRelToMaxExt,tmp,renum);
+ DataArrayIdType *ret=getGroupsArr(meshDimRelToMaxExt,tmp,renum);
ret->setName(grp);
return ret;
}
* \param [in] grps - the names of the groups of interest.
* \param [in] renum - if \c true, the optional numbers of entities, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of mesh entities of the groups. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the name of a nonexistent group is present in \a grps.
* \throw If the family field is missing for \a meshDimRelToMaxExt.
*/
-DataArrayInt *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum) const
+DataArrayIdType *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum) const
{
std::vector<std::string> fams2=getFamiliesOnGroups(grps);
return getFamiliesArr(meshDimRelToMaxExt,fams2,renum);
* \param [in] fam - the name of the family of interest.
* \param [in] renum - if \c true, the optional numbers of entities, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of mesh entities of the family. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the family field is missing for \a meshDimRelToMaxExt.
*/
-DataArrayInt *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum) const
+DataArrayIdType *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum) const
{
std::vector<std::string> tmp(1);
tmp[0]=fam;
- DataArrayInt *ret=getFamiliesArr(meshDimRelToMaxExt,tmp,renum);
+ DataArrayIdType *ret=getFamiliesArr(meshDimRelToMaxExt,tmp,renum);
ret->setName(fam);
return ret;
}
* \param [in] grp - the name of the group of interest.
* \param [in] renum - if \c true, the optional numbers of nodes, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of nodes of the group. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the name of a nonexistent group is specified.
* \throw If the family field is missing for nodes.
*/
-DataArrayInt *MEDFileMesh::getNodeGroupArr(const std::string& grp, bool renum) const
+DataArrayIdType *MEDFileMesh::getNodeGroupArr(const std::string& grp, bool renum) const
{
std::vector<std::string> tmp(1);
tmp[0]=grp;
- DataArrayInt *ret=getNodeGroupsArr(tmp,renum);
+ DataArrayIdType *ret=getNodeGroupsArr(tmp,renum);
ret->setName(grp);
return ret;
}
* \param [in] grps - the names of the groups of interest.
* \param [in] renum - if \c true, the optional numbers of nodes, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of nodes of the groups. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the name of a nonexistent group is present in \a grps.
* \throw If the family field is missing for nodes.
*/
-DataArrayInt *MEDFileMesh::getNodeGroupsArr(const std::vector<std::string>& grps, bool renum) const
+DataArrayIdType *MEDFileMesh::getNodeGroupsArr(const std::vector<std::string>& grps, bool renum) const
{
return getGroupsArr(1,grps,renum);
}
* \param [in] grp - the name of the group of interest.
* \param [in] renum - if \c true, the optional numbers of nodes, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of nodes of the group. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the name of a nonexistent group is specified.
* \throw If the family field is missing for nodes.
*/
-DataArrayInt *MEDFileMesh::getNodeFamilyArr(const std::string& fam, bool renum) const
+DataArrayIdType *MEDFileMesh::getNodeFamilyArr(const std::string& fam, bool renum) const
{
std::vector<std::string> tmp(1);
tmp[0]=fam;
- DataArrayInt *ret=getNodeFamiliesArr(tmp,renum);
+ DataArrayIdType *ret=getNodeFamiliesArr(tmp,renum);
ret->setName(fam);
return ret;
}
* \param [in] fams - the names of the families of interest.
* \param [in] renum - if \c true, the optional numbers of nodes, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of nodes of the families. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the family field is missing for nodes.
*/
-DataArrayInt *MEDFileMesh::getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum) const
+DataArrayIdType *MEDFileMesh::getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum) const
{
return getFamiliesArr(1,fams,renum);
}
* \throw If \a grps includes invalid ids (or numbers if \a renum == \c true ).
* \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
*/
-void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector<const DataArrayInt *>& grps, bool renum)
+void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector<const DataArrayIdType *>& grps, bool renum)
{
if(grps.empty())
return ;
std::vector<std::string> grpsName2(grps.size());
int i=0;
- for(std::vector<const DataArrayInt *>::const_iterator it=grps.begin();it!=grps.end();it++,i++)
+ for(std::vector<const DataArrayIdType *>::const_iterator it=grps.begin();it!=grps.end();it++,i++)
{
grpsName.insert((*it)->getName());
grpsName2[i]=(*it)->getName();
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsAtLevel : groups name must be different each other !");
if(grpsName.find(std::string(""))!=grpsName.end())
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsAtLevel : groups name must be different empty string !");
- int sz=getSizeAtLevel(meshDimRelToMaxExt);
- MCAuto<DataArrayInt> fam;
- std::vector< std::vector<int> > fidsOfGroups;
+ mcIdType sz=getSizeAtLevel(meshDimRelToMaxExt);
+ MCAuto<DataArrayIdType> fam;
+ std::vector< std::vector<mcIdType> > fidsOfGroups;
if(!renum)
{
- fam=DataArrayInt::MakePartition(grps,sz,fidsOfGroups);
+ fam=DataArrayIdType::MakePartition(grps,sz,fidsOfGroups);
}
else
{
- std::vector< MCAuto<DataArrayInt> > grps2(grps.size());
+ std::vector< MCAuto<DataArrayIdType> > grps2(grps.size());
for(unsigned int ii=0;ii<grps.size();ii++)
{
grps2[ii]=MEDFileUMeshSplitL1::Renumber(getRevNumberFieldAtLevel(meshDimRelToMaxExt),grps[ii]);
grps2[ii]->setName(grps[ii]->getName());
}
- std::vector<const DataArrayInt *> grps3(grps2.begin(),grps2.end());
- fam=DataArrayInt::MakePartition(grps3,sz,fidsOfGroups);
+ std::vector<const DataArrayIdType *> grps3(grps2.begin(),grps2.end());
+ fam=DataArrayIdType::MakePartition(grps3,sz,fidsOfGroups);
}
- int offset=1;
+ mcIdType offset=1;
if(!_families.empty())
offset=getMaxAbsFamilyId()+1;
TranslateFamilyIds(meshDimRelToMaxExt==1?offset:-offset,fam,fidsOfGroups);
- MCAuto<DataArrayInt> ids=fam->getDifferentValues();
+ MCAuto<DataArrayIdType> ids=fam->getDifferentValues();
appendFamilyEntries(ids,fidsOfGroups,grpsName2);
setFamilyFieldArr(meshDimRelToMaxExt,fam);
}
* not in '_families'. Groups information are given in parameters in order to give to families representative names.
* For the moment, the two last input parameters are not taken into account.
*/
-void MEDFileMesh::appendFamilyEntries(const DataArrayInt *famIds, const std::vector< std::vector<int> >& fidsOfGrps, const std::vector<std::string>& grpNames)
+void MEDFileMesh::appendFamilyEntries(const DataArrayIdType *famIds, const std::vector< std::vector<mcIdType> >& fidsOfGrps, const std::vector<std::string>& grpNames)
{
- std::map<int,std::string> famInv;
- for(const int *it=famIds->begin();it!=famIds->end();it++)
+ std::map<mcIdType,std::string> famInv;
+ for(const mcIdType *it=famIds->begin();it!=famIds->end();it++)
{
std::ostringstream oss;
oss << "Family_" << (*it);
famInv[*it]=oss.str();
}
int i=0;
- for(std::vector< std::vector<int> >::const_iterator it1=fidsOfGrps.begin();it1!=fidsOfGrps.end();it1++,i++)
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=fidsOfGrps.begin();it1!=fidsOfGrps.end();it1++,i++)
{
- for(std::vector<int>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
+ for(std::vector<mcIdType>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
{
_groups[grpNames[i]].push_back(famInv[*it2]);
}
/*!
* \sa getAllDistributionOfTypes
*/
-std::vector<int> MEDFileMesh::getDistributionOfTypes(int meshDimRelToMax) const
+std::vector<mcIdType> MEDFileMesh::getDistributionOfTypes(int meshDimRelToMax) const
{
MCAuto<MEDCouplingMesh> mLev(getMeshAtLevel(meshDimRelToMax));
return mLev->getDistributionOfTypes();
loadEquivalences(fid);
}
-void MEDFileMesh::TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector<int> >& famIdsPerGrp)
+void MEDFileMesh::TranslateFamilyIds(mcIdType offset, DataArrayIdType *famArr, std::vector< std::vector<mcIdType> >& famIdsPerGrp)
{
famArr->applyLin(offset>0?1:-1,offset,0);
- for(std::vector< std::vector<int> >::iterator it1=famIdsPerGrp.begin();it1!=famIdsPerGrp.end();it1++)
+ for(std::vector< std::vector<mcIdType> >::iterator it1=famIdsPerGrp.begin();it1!=famIdsPerGrp.end();it1++)
{
if(offset<0)
- std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::negate<int>());
- std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::bind2nd(std::plus<int>(),offset));
+ std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::negate<mcIdType>());
+ std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::bind2nd(std::plus<mcIdType>(),offset));
}
}
//attempt #2
if(len>=1)
{
- for(std::size_t i=1;i<30;i++)
+ for(char i=1;i<30;i++)
{
std::string tmp1(nameTry.at(0),i);
tmp1+=nameTry;
throw INTERP_KERNEL::Exception("MEDFileMesh::CreateNameNotIn : impossible to find a not already used name !");
}
-int MEDFileMesh::PutInThirdComponentOfCodeOffset(std::vector<int>& code, int strt)
+mcIdType MEDFileMesh::PutInThirdComponentOfCodeOffset(std::vector<mcIdType>& code, mcIdType strt)
{
std::size_t nbOfChunks=code.size()/3;
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("MEDFileMesh::PutInThirdComponentOfCodeOffset : code has invalid size : should be of size 3*x !");
- int ret=strt;
+ mcIdType ret=strt;
for(std::size_t i=0;i<nbOfChunks;i++)
{
code[3*i+2]=ret;
void MEDFileMesh::getFamilyRepr(std::ostream& oss) const
{
oss << "(**************************)\n(* FAMILIES OF THE MESH : *)\n(**************************)\n";
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
oss << "- Family with name \"" << (*it).first << "\" with number " << (*it).second << std::endl;
oss << " - Groups lying on this family : ";
m2D->setCoords(m3D->getCoords());
ret->setMeshAtLevel(0,m3D);
ret->setMeshAtLevel(-1,m2D);
- ret->setFamilyId(GetSpeStr4ExtMesh(),std::numeric_limits<int>::max()-mem->get2DCellIdForExtrusion());
+ ret->setFamilyId(GetSpeStr4ExtMesh(),std::numeric_limits<med_int>::max()-mem->get2DCellIdForExtrusion());
return ret.retn();
}
* \param [in] mrs - the request for what to be loaded.
* \return MEDFileUMesh * - a new instance of MEDFileUMesh. The caller is to delete this mesh using decrRef() as it is no more needed.
*/
-MEDFileUMesh *MEDFileUMesh::LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
+MEDFileUMesh *MEDFileUMesh::LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY));
* Please refer to the other MEDFileUMesh::LoadPartOf method that has the same semantic and the same parameter (excepted the first).
* This method is \b NOT wrapped into python.
*/
-MEDFileUMesh *MEDFileUMesh::LoadPartOf(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
+MEDFileUMesh *MEDFileUMesh::LoadPartOf(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New());
ret->loadPartUMeshFromFile(fid,mName,types,slicPerTyp,dt,it,mrs);
{
std::vector<const BigMemoryObject *> ret(MEDFileMesh::getDirectChildrenWithNull());
ret.push_back((const DataArrayDouble*)_coords);
- ret.push_back((const DataArrayInt *)_fam_coords);
- ret.push_back((const DataArrayInt *)_num_coords);
- ret.push_back((const DataArrayInt *)_global_num_coords);
- ret.push_back((const DataArrayInt *)_rev_num_coords);
+ ret.push_back((const DataArrayIdType *)_fam_coords);
+ ret.push_back((const DataArrayIdType *)_num_coords);
+ ret.push_back((const DataArrayIdType *)_global_num_coords);
+ ret.push_back((const DataArrayIdType *)_rev_num_coords);
ret.push_back((const DataArrayAsciiChar *)_name_coords);
ret.push_back((const PartDefinition *)_part_coords);
for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
}
}
{
- const DataArrayInt *famc1(_fam_coords),*famc2(otherC->_fam_coords);
+ const DataArrayIdType *famc1(_fam_coords),*famc2(otherC->_fam_coords);
if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0))
{
what="Mismatch of families arr on nodes ! One is defined and not other !";
}
}
{
- const DataArrayInt *numc1(_num_coords),*numc2(otherC->_num_coords);
+ const DataArrayIdType *numc1(_num_coords),*numc2(otherC->_num_coords);
if((numc1==0 && numc2!=0) || (numc1!=0 && numc2==0))
{
what="Mismatch of numbering arr on nodes ! One is defined and not other !";
}
}
{
- const DataArrayInt *gnumc1(_global_num_coords),*gnumc2(otherC->_global_num_coords);
+ const DataArrayIdType *gnumc1(_global_num_coords),*gnumc2(otherC->_global_num_coords);
if((gnumc1==0 && gnumc2!=0) || (gnumc1!=0 && gnumc2==0))
{
what="Mismatch of numbering arr on nodes ! One is defined and not other !";
}
else
{
- int nbCoo = _coords->getNumberOfTuples();
+ mcIdType nbCoo = _coords->getNumberOfTuples();
if (_fam_coords.isNotNull())
_fam_coords->checkNbOfTuplesAndComp(nbCoo,1,"MEDFileUMesh::checkConsistency(): inconsistent internal node family array!");
if (_num_coords.isNotNull())
{
_num_coords->checkNbOfTuplesAndComp(nbCoo,1,"MEDFileUMesh::checkConsistency(): inconsistent internal node numbering array!");
- int pos;
- int maxValue=_num_coords->getMaxValue(pos);
+ mcIdType pos;
+ mcIdType maxValue=_num_coords->getMaxValue(pos);
if (!_rev_num_coords || _rev_num_coords->getNumberOfTuples() != (maxValue+1))
throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): inconsistent internal revert node numbering array!");
}
if (_ms.size())
{
std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();
- std::vector< const DataArrayInt * > v;
+ std::vector< const DataArrayIdType * > v;
bool voidOrNot = ((*it)->_num == 0);
for (it++; it != _ms.end(); it++)
if( ((*it)->_num == 0) != voidOrNot )
{
// don't forget the 1st one:
v.push_back(_ms[0]->_num);
- MCAuto<DataArrayInt> inter = DataArrayInt::BuildIntersection(v);
+ MCAuto<DataArrayIdType> inter = DataArrayIdType::BuildIntersection(v);
if (inter->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): overlapping entity numbering between mesh sub-levels!");
}
*
* \sa loadLL
*/
-void MEDFileUMesh::loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
+void MEDFileUMesh::loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
MEDFileUMeshL2 loaderl2;
MEDCoupling::MEDCouplingMeshType meshType;
loaderl2.loadAll(fid,mid,mName,dt,it,mrs);
dispatchLoadedPart(fid,loaderl2,mName,mrs);
// Structure element part...
- int nModels(-1);
+ med_int nModels(-1);
{
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
nModels=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,MED_GEO_ALL,MED_CONNECTIVITY,MED_NODAL,&chgt,&trsf);
INTERP_KERNEL::AutoPtr<char> desc=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,maa,_too_long_str);
MEDLoaderBase::safeStrCpy(_desc_name.c_str(),MED_COMMENT_SIZE,desc,_too_long_str);
- int spaceDim=coo?coo->getNumberOfComponents():0;
+ int spaceDim=(int)(coo?coo->getNumberOfComponents():0);
int mdim(0);
if(!_ms.empty())
mdim=getMeshDimension();
std::vector<int> MEDFileUMesh::getFamArrNonEmptyLevelsExt() const
{
std::vector<int> ret;
- const DataArrayInt *famCoo(_fam_coords);
+ const DataArrayIdType *famCoo(_fam_coords);
if(famCoo)
ret.push_back(1);
int lev=0;
* \param [in] fams - the name of the family of interest.
* \return std::vector<int> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileUMesh::getFamsNonEmptyLevels(const std::vector<std::string>& fams) const
+std::vector<mcIdType> MEDFileUMesh::getFamsNonEmptyLevels(const std::vector<std::string>& fams) const
{
- std::vector<int> ret;
+ std::vector<mcIdType> ret;
std::vector<int> levs(getNonEmptyLevels());
- std::vector<int> famIds(getFamiliesIds(fams));
+ std::vector<mcIdType> famIds(getFamiliesIds(fams));
for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
if(_ms[-(*it)]->presenceOfOneFams(famIds))
ret.push_back(*it);
* \param [in] fams - the names of the families of interest.
* \return std::vector<int> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileUMesh::getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const
+std::vector<mcIdType> MEDFileUMesh::getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const
{
- std::vector<int> ret0(getFamsNonEmptyLevels(fams));
- const DataArrayInt *famCoords(_fam_coords);
+ std::vector<mcIdType> ret0(getFamsNonEmptyLevels(fams));
+ const DataArrayIdType *famCoords(_fam_coords);
if(!famCoords)
return ret0;
- std::vector<int> famIds(getFamiliesIds(fams));
+ std::vector<mcIdType> famIds(getFamiliesIds(fams));
if(famCoords->presenceOfValue(famIds))
{
- std::vector<int> ret(ret0.size()+1);
+ std::vector<mcIdType> ret(ret0.size()+1);
ret[0]=1;
std::copy(ret0.begin(),ret0.end(),ret.begin()+1);
return ret;
return ret0;
}
-int MEDFileUMesh::getMaxAbsFamilyIdInArrays() const
+mcIdType MEDFileUMesh::getMaxAbsFamilyIdInArrays() const
{
- int ret=-std::numeric_limits<int>::max(),tmp=-1;
- if((const DataArrayInt *)_fam_coords)
+ mcIdType ret=-std::numeric_limits<mcIdType>::max(),tmp=-1;
+ if((const DataArrayIdType *)_fam_coords)
{
- int val=_fam_coords->getMaxValue(tmp);
+ mcIdType val=_fam_coords->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
if((const MEDFileUMeshSplitL1 *)(*it))
{
- const DataArrayInt *da=(*it)->getFamilyField();
+ const DataArrayIdType *da=(*it)->getFamilyField();
if(da)
{
- int val=da->getMaxValue(tmp);
+ mcIdType val=da->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
}
return ret;
}
-int MEDFileUMesh::getMaxFamilyIdInArrays() const
+mcIdType MEDFileUMesh::getMaxFamilyIdInArrays() const
{
- int ret=-std::numeric_limits<int>::max(),tmp=-1;
- if((const DataArrayInt *)_fam_coords)
+ mcIdType ret=-std::numeric_limits<mcIdType>::max(),tmp=-1;
+ if((const DataArrayIdType *)_fam_coords)
{
- int val=_fam_coords->getMaxValue(tmp);
+ mcIdType val=_fam_coords->getMaxValue(tmp);
ret=std::max(ret,val);
}
for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
if((const MEDFileUMeshSplitL1 *)(*it))
{
- const DataArrayInt *da=(*it)->getFamilyField();
+ const DataArrayIdType *da=(*it)->getFamilyField();
if(da)
{
- int val=da->getMaxValue(tmp);
+ mcIdType val=da->getMaxValue(tmp);
ret=std::max(ret,val);
}
}
return ret;
}
-int MEDFileUMesh::getMinFamilyIdInArrays() const
+mcIdType MEDFileUMesh::getMinFamilyIdInArrays() const
{
- int ret=std::numeric_limits<int>::max(),tmp=-1;
- if((const DataArrayInt *)_fam_coords)
+ mcIdType ret=std::numeric_limits<mcIdType>::max(),tmp=-1;
+ if((const DataArrayIdType *)_fam_coords)
{
- int val=_fam_coords->getMinValue(tmp);
+ mcIdType val=_fam_coords->getMinValue(tmp);
ret=std::min(ret,val);
}
for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
if((const MEDFileUMeshSplitL1 *)(*it))
{
- const DataArrayInt *da=(*it)->getFamilyField();
+ const DataArrayIdType *da=(*it)->getFamilyField();
if(da)
{
- int val=da->getMinValue(tmp);
+ mcIdType val=da->getMinValue(tmp);
ret=std::min(ret,val);
}
}
const DataArrayDouble *coo=_coords;
if(!coo)
throw INTERP_KERNEL::Exception(" MEDFileUMesh::getSpaceDimension : no coords set !");
- return coo->getNumberOfComponents();
+ return (int)coo->getNumberOfComponents();
}
/*!
/*!
* Returns number of mesh entities of a given relative dimension in \a this mesh.
* \param [in] meshDimRelToMaxExt - the relative dimension of interest.
- * \return int - the number of entities.
+ * \return mcIdType - the number of entities.
* \throw If no mesh entities of dimension \a meshDimRelToMaxExt are available in \a this mesh.
*/
-int MEDFileUMesh::getSizeAtLevel(int meshDimRelToMaxExt) const
+mcIdType MEDFileUMesh::getSizeAtLevel(int meshDimRelToMaxExt) const
{
if(meshDimRelToMaxExt==1)
{
/*!
* Returns the family field for mesh entities of a given dimension.
* \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
- * \return const DataArrayInt * - the family field. It is an array of ids of families
+ * \return const DataArrayIdType * - the family field. It is an array of ids of families
* each mesh entity belongs to. It can be \c NULL.
*/
-const DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
+const DataArrayIdType *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
{
if(meshDimRelToMaxExt==1)
return _fam_coords;
return l1->getFamilyField();
}
-DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt)
+DataArrayIdType *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt)
{
if(meshDimRelToMaxExt==1)
return _fam_coords;
/*!
* Returns the optional numbers of mesh entities of a given dimension.
* \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
- * \return const DataArrayInt * - the array of the entity numbers.
+ * \return const DataArrayIdType * - the array of the entity numbers.
* \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
*/
-const DataArrayInt *MEDFileUMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const
+const DataArrayIdType *MEDFileUMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const
{
if(meshDimRelToMaxExt==1)
return _num_coords;
return l1->getNameField();
}
-MCAuto<DataArrayInt> MEDFileUMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
+MCAuto<DataArrayIdType> MEDFileUMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
{
if(meshDimRelToMaxExt!=1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::getGlobalNumFieldAtLevel : not implemented yet for structured mesh !");
return l1->getPartDef(gt);
}
-int MEDFileUMesh::getNumberOfNodes() const
+mcIdType MEDFileUMesh::getNumberOfNodes() const
{
const DataArrayDouble *coo(_coords);
if(!coo)
return coo->getNumberOfTuples();
}
-int MEDFileUMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const
+mcIdType MEDFileUMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const
{
const MEDFileUMeshSplitL1 *l1(getMeshAtLevSafe(meshDimRelToMaxExt));
return l1->getNumberOfCells();
return false;
}
-int MEDFileUMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const
+mcIdType MEDFileUMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const
{
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildImplicitPartIfAny : unstructured meshes do not have implicit part !");
}
m->computeNodeIdsAlg(nodesFetched);
else
{
- const DataArrayInt *arr(globs->getProfile(st[i].getPflName()));
+ const DataArrayIdType *arr(globs->getProfile(st[i].getPflName()));
MCAuto<MEDCoupling1GTUMesh> m2(dynamic_cast<MEDCoupling1GTUMesh *>(m->buildPartOfMySelf(arr->begin(),arr->end(),true)));
m2->computeNodeIdsAlg(nodesFetched);
}
/*!
* Returns the optional numbers of mesh entities of a given dimension transformed using
- * DataArrayInt::invertArrayN2O2O2N().
+ * DataArrayIdType::invertArrayN2O2O2N().
* \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
- * \return const DataArrayInt * - the array of the entity numbers transformed using
- * DataArrayInt::invertArrayN2O2O2N().
+ * \return const DataArrayIdType * - the array of the entity numbers transformed using
+ * DataArrayIdType::invertArrayN2O2O2N().
* \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
*/
-const DataArrayInt *MEDFileUMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
+const DataArrayIdType *MEDFileUMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
{
if(meshDimRelToMaxExt==1)
{
synchronizeTinyInfoOnLeaves();
if(meshDimRelToMaxExt==1)
{
- MCAuto<DataArrayInt> arr=getFamiliesArr(1,fams,renum);
+ MCAuto<DataArrayIdType> arr=getFamiliesArr(1,fams,renum);
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New();
MCAuto<DataArrayDouble> c=_coords->selectByTupleId(arr->getConstPointer(),arr->getConstPointer()+arr->getNbOfElems());
ret->setCoords(c);
return ret.retn();
}
- std::vector<int> famIds=getFamiliesIds(fams);
+ std::vector<mcIdType> famIds=getFamiliesIds(fams);
const MEDFileUMeshSplitL1 *l1=getMeshAtLevSafe(meshDimRelToMaxExt);
MCAuto<MEDCouplingUMesh> zeRet;
if(!famIds.empty())
* \param [in] fams - the names of the families of interest.
* \param [in] renum - if \c true, the optional numbers of entities, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of mesh entities of the families. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the family field is missing for \a meshDimRelToMaxExt.
*/
-DataArrayInt *MEDFileUMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum) const
+DataArrayIdType *MEDFileUMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum) const
{
- std::vector<int> famIds=getFamiliesIds(fams);
+ std::vector<mcIdType> famIds=getFamiliesIds(fams);
if(meshDimRelToMaxExt==1)
{
- if((const DataArrayInt *)_fam_coords)
+ if((const DataArrayIdType *)_fam_coords)
{
- MCAuto<DataArrayInt> da;
+ MCAuto<DataArrayIdType> da;
if(!famIds.empty())
da=_fam_coords->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size());
else
return l1->getWholeMesh(renum);
}
-std::vector<int> MEDFileUMesh::getDistributionOfTypes(int meshDimRelToMax) const
+std::vector<mcIdType> MEDFileUMesh::getDistributionOfTypes(int meshDimRelToMax) const
{
const MEDFileUMeshSplitL1 *l1(getMeshAtLevSafe(meshDimRelToMax));
return l1->getDistributionOfTypes();
*
* \sa getDistributionOfTypes
*/
-std::vector< std::pair<int,int> > MEDFileUMesh::getAllDistributionOfTypes() const
+std::vector< std::pair<int,mcIdType> > MEDFileUMesh::getAllDistributionOfTypes() const
{
- std::vector< std::pair<int,int> > ret;
+ std::vector< std::pair<int,mcIdType> > ret;
std::vector<int> nel(getNonEmptyLevels());
for(std::vector<int>::reverse_iterator it=nel.rbegin();it!=nel.rend();it++)
{
std::vector<INTERP_KERNEL::NormalizedCellType> gt(getGeoTypesAtLevel(*it));
for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it1=gt.begin();it1!=gt.end();it1++)
{
- int nbCells(getNumberOfCellsWithType(*it1));
- ret.push_back(std::pair<int,int>(*it1,nbCells));
+ mcIdType nbCells(getNumberOfCellsWithType(*it1));
+ ret.push_back(std::pair<int,mcIdType>(*it1,nbCells));
}
}
- ret.push_back(std::pair<int,int>(INTERP_KERNEL::NORM_ERROR,getNumberOfNodes()));
+ ret.push_back(std::pair<int,mcIdType>(INTERP_KERNEL::NORM_ERROR,getNumberOfNodes()));
return ret;
}
return sp->getGeoTypes();
}
-int MEDFileUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
+mcIdType MEDFileUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(ct);
const MEDFileUMeshSplitL1 *sp(getMeshAtLevSafe( ((int)cm.getDimension())-getMeshDimension() ));
/*!
* This method extracts from whole family field ids the part relative to the input parameter \a gt.
* \param [in] gt - the geometric type for which the family field is asked.
- * \return DataArrayInt * - a pointer to DataArrayInt that the caller is to
+ * \return DataArrayIdType * - a pointer to DataArrayIdType that the caller is to
* delete using decrRef() as it is no more needed.
* \sa MEDFileUMesh::extractNumberFieldOnGeoType
*/
-DataArrayInt *MEDFileUMesh::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
+DataArrayIdType *MEDFileUMesh::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt);
int lev=(int)cm.getDimension()-getMeshDimension();
/*!
* This method extracts from whole number field ids the part relative to the input parameter \a gt.
* \param [in] gt - the geometric type for which the number field is asked.
- * \return DataArrayInt * - a pointer to DataArrayInt that the caller is to
+ * \return DataArrayIdType * - a pointer to DataArrayIdType that the caller is to
* delete using decrRef() as it is no more needed.
* \sa MEDFileUMesh::extractFamilyFieldOnGeoType
*/
-DataArrayInt *MEDFileUMesh::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
+DataArrayIdType *MEDFileUMesh::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt);
int lev=(int)cm.getDimension()-getMeshDimension();
if(coords==(DataArrayDouble *)_coords)
return ;
coords->checkAllocated();
- int nbOfTuples(coords->getNumberOfTuples());
+ mcIdType nbOfTuples(coords->getNumberOfTuples());
_coords.takeRef(coords);
- _fam_coords=DataArrayInt::New();
+ _fam_coords=DataArrayIdType::New();
_fam_coords->alloc(nbOfTuples,1);
_fam_coords->fillWithZero();
_num_coords.nullify(); _rev_num_coords.nullify(); _name_coords.nullify(); _global_num_coords.nullify();
if(coords==(DataArrayDouble *)_coords)
return ;
coords->checkAllocated();
- int nbOfTuples(coords->getNumberOfTuples());
+ mcIdType nbOfTuples(coords->getNumberOfTuples());
if(_coords.isNull())
{
_coords=coords;
}
else
{
- int oldNbTuples(_coords->getNumberOfTuples());
+ mcIdType oldNbTuples(_coords->getNumberOfTuples());
if(oldNbTuples!=nbOfTuples)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setCoordsForced : number of tuples is not the same -> invoke setCoords instead !");
_coords=coords;
{
if(meshDimRelToMaxExt==1)
{
- if((DataArrayInt *)_fam_coords)
+ if((DataArrayIdType *)_fam_coords)
_fam_coords->fillWithZero();
return ;
}
void MEDFileUMesh::optimizeFamilies()
{
std::vector<int> levs=getNonEmptyLevelsExt();
- std::set<int> allFamsIds;
+ std::set<mcIdType> allFamsIds;
for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
{
- const DataArrayInt *ffield=getFamilyFieldAtLevel(*it);
- MCAuto<DataArrayInt> ids=ffield->getDifferentValues();
- std::set<int> res;
+ const DataArrayIdType *ffield=getFamilyFieldAtLevel(*it);
+ MCAuto<DataArrayIdType> ids=ffield->getDifferentValues();
+ std::set<mcIdType> res;
std::set_union(ids->begin(),ids->end(),allFamsIds.begin(),allFamsIds.end(),std::inserter(res,res.begin()));
allFamsIds=res;
}
std::set<std::string> famNamesToKill;
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
if(allFamsIds.find((*it).second)!=allFamsIds.end())
famNamesToKill.insert((*it).first);
* \param[out] cellsNotModified ids of the rest of cells bordering the new boundary whose connectivity remains unchanged.
* \sa clearNodeAndCellNumbers()
*/
-void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated,
- DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified)
+void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayIdType *&nodesDuplicated,
+ DataArrayIdType *&cellsModified, DataArrayIdType *&cellsNotModified)
{
typedef MCAuto<MEDCouplingUMesh> MUMesh;
- typedef MCAuto<DataArrayInt> DAInt;
+ typedef MCAuto<DataArrayIdType> DAInt;
std::vector<int> levs=getNonEmptyLevels();
if(std::find(levs.begin(),levs.end(),0)==levs.end() || std::find(levs.begin(),levs.end(),-1)==levs.end())
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group : This method works only for mesh defined on level 0 and -1 !");
MUMesh m0=getMeshAtLevel(0);
MUMesh m1=getMeshAtLevel(-1);
- int nbNodes=m0->getNumberOfNodes();
+ mcIdType nbNodes=m0->getNumberOfNodes();
MUMesh m11=getGroup(-1,grpNameM1);
- DataArrayInt *tmp00=0,*tmp11=0,*tmp22=0;
+ DataArrayIdType *tmp00=0,*tmp11=0,*tmp22=0;
m0->findNodesToDuplicate(*m11,tmp00,tmp11,tmp22);
DAInt nodeIdsToDuplicate(tmp00);
DAInt cellsToModifyConn0(tmp11);
DAInt cellsToModifyConn1(tmp22);
MUMesh tmp0=static_cast<MEDCouplingUMesh *>(m0->buildPartOfMySelf(cellsToModifyConn0->begin(),cellsToModifyConn0->end(),true));
// node renumbering of cells in m1 impacted by duplication of node but not in group 'grpNameM1' on level -1
- DAInt descTmp0=DataArrayInt::New(),descITmp0=DataArrayInt::New(),revDescTmp0=DataArrayInt::New(),revDescITmp0=DataArrayInt::New();
+ DAInt descTmp0=DataArrayIdType::New(),descITmp0=DataArrayIdType::New(),revDescTmp0=DataArrayIdType::New(),revDescITmp0=DataArrayIdType::New();
MUMesh tmp0Desc=tmp0->buildDescendingConnectivity(descTmp0,descITmp0,revDescTmp0,revDescITmp0);
descTmp0=0; descITmp0=0; revDescTmp0=0; revDescITmp0=0;
DAInt cellsInM1ToRenumW2=tmp0Desc->getCellIdsLyingOnNodes(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),false);
MUMesh cellsInM1ToRenumW3=static_cast<MEDCouplingUMesh *>(tmp0Desc->buildPartOfMySelf(cellsInM1ToRenumW2->begin(),cellsInM1ToRenumW2->end(),true));
- DataArrayInt *cellsInM1ToRenumW4Tmp=0;
+ DataArrayIdType *cellsInM1ToRenumW4Tmp=0;
m1->areCellsIncludedIn(cellsInM1ToRenumW3,2,cellsInM1ToRenumW4Tmp);
DAInt cellsInM1ToRenumW4(cellsInM1ToRenumW4Tmp);
DAInt cellsInM1ToRenumW5=cellsInM1ToRenumW4->findIdsInRange(0,m1->getNumberOfCells());
_coords=m0->getCoords(); _coords->incrRef();
// duplication of cells in group 'grpNameM1' on level -1, but not duplicating cells for which nothing has changed
m11->duplicateNodesInConn(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),nbNodes); m11->setCoords(m0->getCoords());
- DataArrayInt * duplCells;
+ DataArrayIdType * duplCells;
m1->areCellsIncludedIn(m11, 0, duplCells);
DAInt zeIds = duplCells->findIdsNotInRange(-1, m1->getNumberOfCells()-1); duplCells->decrRef();
MUMesh m11Part=static_cast<MEDCouplingUMesh *>(m11->buildPartOfMySelf(zeIds->begin(),zeIds->end(),true));
DAInt idInMsOfCellGrpOfSameType(tmp11);
//
newm1->setName(getName());
- const DataArrayInt *fam=getFamilyFieldAtLevel(-1);
+ const DataArrayIdType *fam=getFamilyFieldAtLevel(-1);
if(!fam)
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group(): internal error no family field !");
- DAInt newFam=DataArrayInt::New();
+ DAInt newFam=DataArrayIdType::New();
newFam->alloc(newm1->getNumberOfCells(),1);
// Get a new family ID: care must be taken if we need a positive ID or a negative one:
// Positive ID for family of nodes, negative for all the rest.
- int idd;
+ mcIdType idd;
if (m1->getMeshDimension() == 0)
idd=getMaxFamilyId()+1;
else
idd=getMinFamilyId()-1;
- int globStart=0,start=0,end,globEnd;
- int nbOfChunks=szOfCellGrpOfSameType->getNumberOfTuples();
- for(int i=0;i<nbOfChunks;i++)
+ mcIdType globStart=0,start=0,end,globEnd;
+ mcIdType nbOfChunks=szOfCellGrpOfSameType->getNumberOfTuples();
+ for(mcIdType i=0;i<nbOfChunks;i++)
{
globEnd=globStart+szOfCellGrpOfSameType->getIJ(i,0);
if(idInMsOfCellGrpOfSameType->getIJ(i,0)==0)
fam=_fam_coords;
if(fam)
{
- int newNbOfNodes=getCoords()->getNumberOfTuples();
- newFam=DataArrayInt::New(); newFam->alloc(newNbOfNodes,1);
+ mcIdType newNbOfNodes=getCoords()->getNumberOfTuples();
+ newFam=DataArrayIdType::New(); newFam->alloc(newNbOfNodes,1);
newFam->setPartOfValues1(fam,0,nbNodes,1,0,1,1,true);
newFam->setPartOfValuesSimple1(0,nbNodes,newNbOfNodes,1,0,1,1);
_fam_coords=newFam;
* in this method.
*
* \param [out] oldCode retrieves the distribution of types before the call if true is returned
- * \param [out] newCode etrieves the distribution of types after the call if true is returned
+ * \param [out] newCode retrieves the distribution of types after the call if true is returned
* \param [out] o2nRenumCell tells for **all levels** the old 2 new renumbering of cells.
*
* \return false if no modification has been performed linked to the unpolyzation. Neither cell type, not cell numbers. When false is returned no need of field on cells or on gauss renumbering.
* Inversely, if true is returned, it means that distribution of cell by geometric type has changed and field on cell and field on gauss point must be renumbered.
*/
-bool MEDFileUMesh::unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell)
+bool MEDFileUMesh::unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell)
{
o2nRenumCell=0; oldCode.clear(); newCode.clear();
std::vector<int> levs=getNonEmptyLevels();
bool ret=false;
- std::vector< const DataArrayInt* > renumCellsSplited;//same than memorySaverIfThrow
- std::vector< MCAuto<DataArrayInt> > memorySaverIfThrow;//same than renumCellsSplited only in case of throw
- int start=0;
- int end=0;
+ std::vector< const DataArrayIdType* > renumCellsSplited;//same than memorySaverIfThrow
+ std::vector< MCAuto<DataArrayIdType> > memorySaverIfThrow;//same than renumCellsSplited only in case of throw
+ mcIdType start=0;
+ mcIdType end=0;
for(std::vector<int>::reverse_iterator it=levs.rbegin();it!=levs.rend();it++)
{
MCAuto<MEDCouplingUMesh> m=getMeshAtLevel(*it);
- std::vector<int> code1=m->getDistributionOfTypes();
+ std::vector<mcIdType> code1=m->getDistributionOfTypes();
end=PutInThirdComponentOfCodeOffset(code1,start);
oldCode.insert(oldCode.end(),code1.begin(),code1.end());
bool hasChanged=m->unPolyze();
- DataArrayInt *fake=0;
- MCAuto<DataArrayInt> o2nCellsPart=m->getLevArrPerCellTypes(MEDCouplingUMesh::MEDMEM_ORDER,
+ DataArrayIdType *fake=0;
+ MCAuto<DataArrayIdType> o2nCellsPart=m->getLevArrPerCellTypes(MEDCouplingUMesh::MEDMEM_ORDER,
MEDCouplingUMesh::MEDMEM_ORDER+MEDCouplingUMesh::N_MEDMEM_ORDER,fake);
fake->decrRef();
renumCellsSplited.push_back(o2nCellsPart); memorySaverIfThrow.push_back(o2nCellsPart);
if(hasChanged)
{
- MCAuto<DataArrayInt> o2nCellsPart2=o2nCellsPart->buildPermArrPerLevel();
+ MCAuto<DataArrayIdType> o2nCellsPart2=o2nCellsPart->buildPermArrPerLevel();
m->renumberCells(o2nCellsPart2->getConstPointer(),false);
ret=true;
- MCAuto<DataArrayInt> famField2,numField2;
- const DataArrayInt *famField=getFamilyFieldAtLevel(*it); if(famField) { famField->incrRef(); famField2=const_cast<DataArrayInt *>(famField); }
- const DataArrayInt *numField=getNumberFieldAtLevel(*it); if(numField) { numField->incrRef(); numField2=const_cast<DataArrayInt *>(numField); }
+ MCAuto<DataArrayIdType> famField2,numField2;
+ const DataArrayIdType *famField=getFamilyFieldAtLevel(*it); if(famField) { famField->incrRef(); famField2=const_cast<DataArrayIdType *>(famField); }
+ const DataArrayIdType *numField=getNumberFieldAtLevel(*it); if(numField) { numField->incrRef(); numField2=const_cast<DataArrayIdType *>(numField); }
setMeshAtLevel(*it,m);
- std::vector<int> code2=m->getDistributionOfTypes();
+ std::vector<mcIdType> code2=m->getDistributionOfTypes();
end=PutInThirdComponentOfCodeOffset(code2,start);
newCode.insert(newCode.end(),code2.begin(),code2.end());
//
continue;
if(famField)
{
- MCAuto<DataArrayInt> newFamField=famField->renumber(o2nCellsPart2->getConstPointer());
+ MCAuto<DataArrayIdType> newFamField=famField->renumber(o2nCellsPart2->getConstPointer());
setFamilyFieldArr(*it,newFamField);
}
if(numField)
{
- MCAuto<DataArrayInt> newNumField=numField->renumber(o2nCellsPart2->getConstPointer());
+ MCAuto<DataArrayIdType> newNumField=numField->renumber(o2nCellsPart2->getConstPointer());
setRenumFieldArr(*it,newNumField);
}
}
}
if(ret)
{
- MCAuto<DataArrayInt> renumCells=DataArrayInt::Aggregate(renumCellsSplited);
- MCAuto<DataArrayInt> o2nRenumCellRet=renumCells->buildPermArrPerLevel();
+ MCAuto<DataArrayIdType> renumCells=DataArrayIdType::Aggregate(renumCellsSplited);
+ MCAuto<DataArrayIdType> o2nRenumCellRet=renumCells->buildPermArrPerLevel();
o2nRenumCell=o2nRenumCellRet.retn();
}
return ret;
struct MEDLoaderAccVisit1
{
MEDLoaderAccVisit1():_new_nb_of_nodes(0) { }
- int operator()(bool val) { return val?_new_nb_of_nodes++:-1; }
- int _new_nb_of_nodes;
+ mcIdType operator()(bool val) { return val?_new_nb_of_nodes++:-1; }
+ mcIdType _new_nb_of_nodes;
};
/*! \endcond */
* \throw If no coordinates are set in \a this or if there is in any available mesh in \a this a cell having a nodal connectivity containing a node id not in the range of
* set coordinates.
*/
-DataArrayInt *MEDFileUMesh::zipCoords()
+DataArrayIdType *MEDFileUMesh::zipCoords()
{
const DataArrayDouble *coo(getCoords());
if(!coo)
throw INTERP_KERNEL::Exception("MEDFileUMesh::zipCoords : no coordinates set in this !");
- int nbOfNodes(coo->getNumberOfTuples());
+ mcIdType nbOfNodes(coo->getNumberOfTuples());
std::vector<bool> nodeIdsInUse(nbOfNodes,false);
std::vector<int> neLevs(getNonEmptyLevels());
for(std::vector<int>::const_iterator lev=neLevs.begin();lev!=neLevs.end();lev++)
mesh->computeNodeIdsAlg(nodeIdsInUse);
}
}
- int nbrOfNodesInUse((int)std::count(nodeIdsInUse.begin(),nodeIdsInUse.end(),true));
+ mcIdType nbrOfNodesInUse((mcIdType)std::count(nodeIdsInUse.begin(),nodeIdsInUse.end(),true));
if(nbrOfNodesInUse==nbOfNodes)
return 0;//no need to update _part_coords
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfNodes,1);
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(nbOfNodes,1);
std::transform(nodeIdsInUse.begin(),nodeIdsInUse.end(),ret->getPointer(),MEDLoaderAccVisit1());
- MCAuto<DataArrayInt> ret2(ret->invertArrayO2N2N2OBis(nbrOfNodesInUse));
+ MCAuto<DataArrayIdType> ret2(ret->invertArrayO2N2N2OBis(nbrOfNodesInUse));
MCAuto<DataArrayDouble> newCoords(coo->selectByTupleIdSafe(ret2->begin(),ret2->end()));
- MCAuto<DataArrayInt> newFamCoords;
+ MCAuto<DataArrayIdType> newFamCoords;
MCAuto<DataArrayAsciiChar> newNameCoords;
- if((const DataArrayInt *)_fam_coords)
+ if((const DataArrayIdType *)_fam_coords)
newFamCoords=_fam_coords->selectByTupleIdSafe(ret2->begin(),ret2->end());
- MCAuto<DataArrayInt> newNumCoords,newGlobalNumCoords;
+ MCAuto<DataArrayIdType> newNumCoords,newGlobalNumCoords;
if(_num_coords.isNotNull())
newNumCoords=_num_coords->selectByTupleIdSafe(ret2->begin(),ret2->end());
if(_global_num_coords.isNotNull())
* The extraction of \a this is specified by the extractDef \a input map.
* This map tells for each level of cells, the cells kept in the extraction.
*
- * \return - a new reference of DataArrayInt that represents sorted node ids, the extraction is lying on.
+ * \return - a new reference of DataArrayIdType that represents sorted node ids, the extraction is lying on.
* \sa MEDFileField1TS::extractPart, MEDFileUMesh::extractPart
*/
-DataArrayInt *MEDFileUMesh::deduceNodeSubPartFromCellSubPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef) const
+DataArrayIdType *MEDFileUMesh::deduceNodeSubPartFromCellSubPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef) const
{
std::vector<int> levs(getNonEmptyLevels());
std::vector<bool> fetchedNodes(getNumberOfNodes(),false);
- for(std::map<int, MCAuto<DataArrayInt> >::const_iterator it=extractDef.begin();it!=extractDef.end();it++)
+ for(std::map<int, MCAuto<DataArrayIdType> >::const_iterator it=extractDef.begin();it!=extractDef.end();it++)
{
if((*it).first>1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::deduceNodeSubPartFromCellSubPart : invalid key ! Must be <=1 !");
MCAuto<MEDCouplingUMesh> mPart(m->buildPartOfMySelf((*it).second->begin(),(*it).second->end(),true));
mPart->computeNodeIdsAlg(fetchedNodes);
}
- return DataArrayInt::BuildListOfSwitchedOn(fetchedNodes);
+ return DataArrayIdType::BuildListOfSwitchedOn(fetchedNodes);
}
/*!
* \return - a new reference of MEDFileUMesh
* \sa MEDFileUMesh::deduceNodeSubPartFromCellSubPart, MEDFileFields::extractPart
*/
-MEDFileUMesh *MEDFileUMesh::extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef) const
+MEDFileUMesh *MEDFileUMesh::extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef) const
{
MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New()); ret->setName(getName()); ret->copyFamGrpMapsFrom(*this);
std::vector<int> levs(getNonEmptyLevels());
- for(std::map<int, MCAuto<DataArrayInt> >::const_iterator it=extractDef.begin();it!=extractDef.end();it++)
+ for(std::map<int, MCAuto<DataArrayIdType> >::const_iterator it=extractDef.begin();it!=extractDef.end();it++)
{
if((*it).first>1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::extractPart : invalid key ! Must be <=1 !");
MCAuto<MEDCouplingUMesh> m(getMeshAtLevel((*it).first));
MCAuto<MEDCouplingUMesh> mPart(m->buildPartOfMySelf((*it).second->begin(),(*it).second->end(),true));
ret->setMeshAtLevel((*it).first,mPart);
- const DataArrayInt *fam(getFamilyFieldAtLevel((*it).first)),*num(getNumberFieldAtLevel((*it).first));
+ const DataArrayIdType *fam(getFamilyFieldAtLevel((*it).first)),*num(getNumberFieldAtLevel((*it).first));
if(fam)
{
- MCAuto<DataArrayInt> famPart(fam->selectByTupleIdSafe((*it).second->begin(),(*it).second->end()));
+ MCAuto<DataArrayIdType> famPart(fam->selectByTupleIdSafe((*it).second->begin(),(*it).second->end()));
ret->setFamilyFieldArr((*it).first,famPart);
}
if(num)
{
- MCAuto<DataArrayInt> numPart(num->selectByTupleIdSafe((*it).second->begin(),(*it).second->end()));
+ MCAuto<DataArrayIdType> numPart(num->selectByTupleIdSafe((*it).second->begin(),(*it).second->end()));
ret->setFamilyFieldArr((*it).first,numPart);
}
}
- std::map<int, MCAuto<DataArrayInt> >::const_iterator it2(extractDef.find(1));
+ std::map<int, MCAuto<DataArrayIdType> >::const_iterator it2(extractDef.find(1));
if(it2!=extractDef.end())
{
const DataArrayDouble *coo(ret->getCoords());
if(!coo)
throw INTERP_KERNEL::Exception("MEDFileUMesh::extractPart : trying to extract nodes whereas there is no nodes !");
- MCAuto<DataArrayInt> o2nNodes(((*it2).second)->invertArrayN2O2O2N(coo->getNumberOfTuples()));
+ MCAuto<DataArrayIdType> o2nNodes(((*it2).second)->invertArrayN2O2O2N(coo->getNumberOfTuples()));
MCAuto<DataArrayDouble> cooPart(coo->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end()));
ret->setCoords(cooPart);
- const DataArrayInt *fam(getFamilyFieldAtLevel(1)),*num(getNumberFieldAtLevel(1));
+ const DataArrayIdType *fam(getFamilyFieldAtLevel(1)),*num(getNumberFieldAtLevel(1));
if(fam)
{
- MCAuto<DataArrayInt> famPart(fam->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end()));
+ MCAuto<DataArrayIdType> famPart(fam->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end()));
ret->setFamilyFieldArr(1,famPart);
}
if(num)
{
- MCAuto<DataArrayInt> numPart(num->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end()));
+ MCAuto<DataArrayIdType> numPart(num->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end()));
ret->setFamilyFieldArr(1,numPart);
}
- for(std::map<int, MCAuto<DataArrayInt> >::const_iterator it3=extractDef.begin();it3!=extractDef.end();it3++)
+ for(std::map<int, MCAuto<DataArrayIdType> >::const_iterator it3=extractDef.begin();it3!=extractDef.end();it3++)
{
if((*it3).first==1)
continue;
m1D->checkConsistencyLight();
if(m1D->getMeshDimension()!=1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildExtrudedMesh : input mesh must have a mesh dimension equal to one !");
- int nbRep(m1D->getNumberOfCells());
+ mcIdType nbRep(m1D->getNumberOfCells());
std::vector<int> levs(getNonEmptyLevels());
std::vector<std::string> grps(getGroupsNames());
std::vector< MCAuto<MEDCouplingUMesh> > zeList;
DataArrayDouble *coords(0);
std::size_t nbOfLevsOut(levs.size()+1);
- std::vector< MCAuto<DataArrayInt> > o2ns(nbOfLevsOut);
+ std::vector< MCAuto<DataArrayIdType> > o2ns(nbOfLevsOut);
for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
{
MCAuto<MEDCouplingUMesh> item(getMeshAtLevel(*lev));
{
MCAuto<MEDCouplingUMesh> elt1(getMeshAtLevel(lev+1));
MCAuto<MEDCouplingUMesh> elt2(elt1->clone(false));
- MCAuto<DataArrayInt> tmp(elt2->getNodalConnectivity()->deepCopy());
+ MCAuto<DataArrayIdType> tmp(elt2->getNodalConnectivity()->deepCopy());
elt2->setConnectivity(tmp,elt2->getNodalConnectivityIndex());
elt2->shiftNodeNumbersInConn(nbRep*elt1->getNumberOfNodes());
elt1->setCoords(elt->getCoords()); elt2->setCoords(elt->getCoords());
}
MCAuto<MEDCouplingUMesh> endLev(getMeshAtLevel(levs.back())),endLev2;
endLev=endLev->clone(false); endLev->setCoords(coords);
- MCAuto<DataArrayInt> tmp(endLev->getNodalConnectivity()->deepCopy());
+ MCAuto<DataArrayIdType> tmp(endLev->getNodalConnectivity()->deepCopy());
endLev2=endLev->clone(false); endLev2->setConnectivity(tmp,endLev->getNodalConnectivityIndex());
endLev2->shiftNodeNumbersInConn(nbRep*getNumberOfNodes());
endLev=MEDCouplingUMesh::MergeUMeshesOnSameCoords(endLev,endLev2);
for(std::size_t ii=0;ii!=zeList.size();ii++)
{
int lev(levs[ii]);
- std::vector< MCAuto<DataArrayInt> > outGrps;
- std::vector< const DataArrayInt * > outGrps2;
+ std::vector< MCAuto<DataArrayIdType> > outGrps;
+ std::vector< const DataArrayIdType * > outGrps2;
if(lev<=-1)
{
for(std::vector<std::string>::const_iterator grp=grps.begin();grp!=grps.end();grp++)
{
- MCAuto<DataArrayInt> grpArr(getGroupArr(lev+1,*grp));
+ MCAuto<DataArrayIdType> grpArr(getGroupArr(lev+1,*grp));
if(!grpArr->empty())
{
- MCAuto<DataArrayInt> grpArr1(grpArr->deepCopy()),grpArr2(grpArr->deepCopy());
- int offset0(zeList[ii]->getNumberOfCells());
- int offset1(offset0+getNumberOfCellsAtLevel(lev+1));
+ MCAuto<DataArrayIdType> grpArr1(grpArr->deepCopy()),grpArr2(grpArr->deepCopy());
+ mcIdType offset0(zeList[ii]->getNumberOfCells());
+ mcIdType offset1(offset0+getNumberOfCellsAtLevel(lev+1));
grpArr1->applyLin(1,offset0); grpArr2->applyLin(1,offset1);
std::ostringstream oss; oss << grpArr2->getName() << "_top";
grpArr2->setName(oss.str());
//
for(std::vector<std::string>::const_iterator grp=grps.begin();grp!=grps.end();grp++)
{
- MCAuto<DataArrayInt> grpArr(getGroupArr(lev,*grp));
+ MCAuto<DataArrayIdType> grpArr(getGroupArr(lev,*grp));
if(!grpArr->empty())
{
- int nbCellsB4Extrusion(getNumberOfCellsAtLevel(lev));
- std::vector< MCAuto<DataArrayInt> > grpArrs(nbRep);
- std::vector< const DataArrayInt *> grpArrs2(nbRep);
+ mcIdType nbCellsB4Extrusion(getNumberOfCellsAtLevel(lev));
+ std::vector< MCAuto<DataArrayIdType> > grpArrs(nbRep);
+ std::vector< const DataArrayIdType *> grpArrs2(nbRep);
for(int iii=0;iii<nbRep;iii++)
{
grpArrs[iii]=grpArr->deepCopy(); grpArrs[iii]->applyLin(1,iii*nbCellsB4Extrusion);
grpArrs2[iii]=grpArrs[iii];
}
- MCAuto<DataArrayInt> grpArrExt(DataArrayInt::Aggregate(grpArrs2));
+ MCAuto<DataArrayIdType> grpArrExt(DataArrayIdType::Aggregate(grpArrs2));
grpArrExt->transformWithIndArr(o2ns[ii]->begin(),o2ns[ii]->end());
std::ostringstream grpName; grpName << *grp << "_extruded";
grpArrExt->setName(grpName.str());
}
ret->setGroupsAtLevel(lev,outGrps2);
}
- std::vector< MCAuto<DataArrayInt> > outGrps;
- std::vector< const DataArrayInt * > outGrps2;
+ std::vector< MCAuto<DataArrayIdType> > outGrps;
+ std::vector< const DataArrayIdType * > outGrps2;
for(std::vector<std::string>::const_iterator grp=grps.begin();grp!=grps.end();grp++)
{
- MCAuto<DataArrayInt> grpArr1(getGroupArr(levs.back(),*grp));
+ MCAuto<DataArrayIdType> grpArr1(getGroupArr(levs.back(),*grp));
if(grpArr1->empty())
continue;
- MCAuto<DataArrayInt> grpArr2(grpArr1->deepCopy());
+ MCAuto<DataArrayIdType> grpArr2(grpArr1->deepCopy());
std::ostringstream grpName; grpName << *grp << "_top";
grpArr2->setName(grpName.str());
grpArr2->applyLin(1,getNumberOfCellsAtLevel(levs.back()));
{
checkCartesian();
MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New());
- int initialNbNodes(getNumberOfNodes());
+ mcIdType initialNbNodes(getNumberOfNodes());
MCAuto<MEDCouplingUMesh> m0Tmp(getMeshAtLevel(0));
MCAuto<MEDCouplingUMesh> m0(dynamic_cast<MEDCouplingUMesh *>(m0Tmp->deepCopy()));
{
- MCAuto<DataArrayInt> notUsed(m0->convertLinearCellsToQuadratic(conversionType));
+ MCAuto<DataArrayIdType> notUsed(m0->convertLinearCellsToQuadratic(conversionType));
}
DataArrayDouble *zeCoords(m0->getCoords());
ret->setMeshAtLevel(0,m0);
std::vector<int> levs(getNonEmptyLevels());
- const DataArrayInt *famField(getFamilyFieldAtLevel(0));
+ const DataArrayIdType *famField(getFamilyFieldAtLevel(0));
if(famField)
{
- MCAuto<DataArrayInt> famFieldCpy(famField->deepCopy());
+ MCAuto<DataArrayIdType> famFieldCpy(famField->deepCopy());
ret->setFamilyFieldArr(0,famFieldCpy);
}
famField=getFamilyFieldAtLevel(1);
if(famField)
{
- MCAuto<DataArrayInt> fam(DataArrayInt::New()); fam->alloc(zeCoords->getNumberOfTuples(),1);
+ MCAuto<DataArrayIdType> fam(DataArrayIdType::New()); fam->alloc(zeCoords->getNumberOfTuples(),1);
fam->fillWithZero();
fam->setPartOfValues1(famField,0,initialNbNodes,1,0,1,1);
ret->setFamilyFieldArr(1,fam);
if(m1->getMeshDimension()!=0)
{
{
- MCAuto<DataArrayInt> notUsed(m1->convertLinearCellsToQuadratic(conversionType));
+ MCAuto<DataArrayIdType> notUsed(m1->convertLinearCellsToQuadratic(conversionType));
}//kill unused notUsed var
MCAuto<DataArrayDouble> m1Coords(m1->getCoords()->selectByTupleIdSafeSlice(initialNbNodes,m1->getNumberOfNodes(),1));
- DataArrayInt *b(0);
+ DataArrayIdType *b(0);
bool a(partZeCoords->areIncludedInMe(m1Coords,eps,b));
- MCAuto<DataArrayInt> bSafe(b);
+ MCAuto<DataArrayIdType> bSafe(b);
if(!a)
{
std::ostringstream oss; oss << "MEDFileUMesh::linearCellsToQuadratic : for level " << *lev << " problem to identify nodes generated !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
b->applyLin(1,initialNbNodes);
- MCAuto<DataArrayInt> l0(DataArrayInt::New()); l0->alloc(initialNbNodes,1); l0->iota();
- std::vector<const DataArrayInt *> v(2); v[0]=l0; v[1]=b;
- MCAuto<DataArrayInt> renum(DataArrayInt::Aggregate(v));
+ MCAuto<DataArrayIdType> l0(DataArrayIdType::New()); l0->alloc(initialNbNodes,1); l0->iota();
+ std::vector<const DataArrayIdType *> v(2); v[0]=l0; v[1]=b;
+ MCAuto<DataArrayIdType> renum(DataArrayIdType::Aggregate(v));
m1->renumberNodesInConn(renum->begin());
}
m1->setCoords(zeCoords);
famField=getFamilyFieldAtLevel(*lev);
if(famField)
{
- MCAuto<DataArrayInt> famFieldCpy(famField->deepCopy());
+ MCAuto<DataArrayIdType> famFieldCpy(famField->deepCopy());
ret->setFamilyFieldArr(*lev,famFieldCpy);
}
}
DataArrayDouble *zeCoords(m0->getCoords());
ret->setMeshAtLevel(0,m0);
std::vector<int> levs(getNonEmptyLevels());
- const DataArrayInt *famField(getFamilyFieldAtLevel(0));
+ const DataArrayIdType *famField(getFamilyFieldAtLevel(0));
if(famField)
{
- MCAuto<DataArrayInt> famFieldCpy(famField->deepCopy());
+ MCAuto<DataArrayIdType> famFieldCpy(famField->deepCopy());
ret->setFamilyFieldArr(0,famFieldCpy);
}
famField=getFamilyFieldAtLevel(1);
if(famField)
{
- MCAuto<DataArrayInt> fam(famField->selectByTupleIdSafeSlice(0,zeCoords->getNumberOfTuples(),1));
+ MCAuto<DataArrayIdType> fam(famField->selectByTupleIdSafeSlice(0,zeCoords->getNumberOfTuples(),1));
ret->setFamilyFieldArr(1,fam);
}
ret->copyFamGrpMapsFrom(*this);
MCAuto<MEDCouplingUMesh> m1(dynamic_cast<MEDCouplingUMesh *>(m1Tmp->deepCopy()));
m1->convertQuadraticCellsToLinear();
m1->zipCoords();
- DataArrayInt *b(0);
+ DataArrayIdType *b(0);
bool a(zeCoords->areIncludedInMe(m1->getCoords(),eps,b));
- MCAuto<DataArrayInt> bSafe(b);
+ MCAuto<DataArrayIdType> bSafe(b);
if(!a)
{
std::ostringstream oss; oss << "MEDFileUMesh::quadraticToLinear : for level " << *lev << " problem to identify nodes generated !";
famField=getFamilyFieldAtLevel(*lev);
if(famField)
{
- MCAuto<DataArrayInt> famFieldCpy(famField->deepCopy());
+ MCAuto<DataArrayIdType> famFieldCpy(famField->deepCopy());
ret->setFamilyFieldArr(*lev,famFieldCpy);
}
}
throw INTERP_KERNEL::Exception("MEDFileUMesh::Aggregate : empty input vector !");
std::size_t sz(meshes.size()),i(0);
std::vector<const DataArrayDouble *> coos(sz);
- std::vector<const DataArrayInt *> fam_coos(sz),num_coos(sz);
+ std::vector<const DataArrayIdType *> fam_coos(sz),num_coos(sz);
for(auto it=meshes.begin();it!=meshes.end();it++,i++)
{
if(!(*it))
const MEDFileUMesh *ref(meshes[0]);
int spaceDim(ref->getSpaceDimension()),meshDim(ref->getMeshDimension());
std::vector<int> levs(ref->getNonEmptyLevels());
- std::map<int, std::vector<const DataArrayInt *> > m_fam,m_renum;
+ std::map<int, std::vector<const DataArrayIdType *> > m_fam,m_renum;
std::map<int, std::vector< MCAuto< MEDCouplingUMesh > > > m_mesh2;
std::map<int, std::vector<const MEDCouplingUMesh *> > m_mesh;
- std::map<std::string,int> famNumMap;
- std::map<int, std::string> famNumMap_rev;
+ std::map<std::string,mcIdType> famNumMap;
+ std::map<mcIdType, std::string> famNumMap_rev;
std::map<std::string, std::vector<std::string> > grpFamMap;
- std::set< MCAuto<DataArrayInt> > mem_cleanup; // Memory clean-up. At set deletion (end of method), arrays will be deallocated.
+ std::set< MCAuto<DataArrayIdType> > mem_cleanup; // Memory clean-up. At set deletion (end of method), arrays will be deallocated.
// Identify min family number used:
- int min_fam_num(0);
+ mcIdType min_fam_num(0);
for(const auto& msh : meshes)
{
- const std::map<std::string,int>& locMap1(msh->getFamilyInfo());
+ const std::map<std::string,mcIdType>& locMap1(msh->getFamilyInfo());
for(const auto& it3 : locMap1)
if(it3.second < min_fam_num)
min_fam_num = it3.second;
if(msh->getNonEmptyLevels()!=levs)
throw INTERP_KERNEL::Exception("MEDFileUMesh::Aggregate : levels must be the same for elements in input vector !");
- const std::map<std::string,int>& locMap1(msh->getFamilyInfo());
+ const std::map<std::string,mcIdType>& locMap1(msh->getFamilyInfo());
std::map<std::string, std::string> substitute;
- std::map<int, int> substituteN;
+ std::map<mcIdType, mcIdType> substituteN;
bool fam_conflict(false);
for(const auto& it3 : locMap1)
{
const std::string& famName = it3.first;
- int famNum = it3.second;
+ mcIdType famNum = it3.second;
if (famNumMap_rev.find(famNum) != famNumMap_rev.end()) // Family number is already used!
{
// Is it used by a group of the current mesh or a group from a previous mesh?
// Family field - substitute new family number if needed:
if(fam_conflict)
{
- DataArrayInt* dai(msh->getFamilyFieldAtLevel(level)->deepCopy()); // Need a copy
- mem_cleanup.insert(MCAuto<DataArrayInt>(dai)); // Make sure array will decrRef() at end of method
+ DataArrayIdType* dai(msh->getFamilyFieldAtLevel(level)->deepCopy()); // Need a copy
+ mem_cleanup.insert(MCAuto<DataArrayIdType>(dai)); // Make sure array will decrRef() at end of method
for (const auto& subN : substituteN)
dai->changeValue(subN.first, subN.second);
m_fam[level].push_back(dai);
MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New());
MCAuto<DataArrayDouble> coo(DataArrayDouble::Aggregate(coos));
ret->setCoords(coo);
- if(std::find(fam_coos.begin(),fam_coos.end(),(const DataArrayInt *)0)==fam_coos.end())
+ if(std::find(fam_coos.begin(),fam_coos.end(),(const DataArrayIdType *)0)==fam_coos.end())
{
- MCAuto<DataArrayInt> fam_coo(DataArrayInt::Aggregate(fam_coos));
+ MCAuto<DataArrayIdType> fam_coo(DataArrayIdType::Aggregate(fam_coos));
ret->setFamilyFieldArr(1,fam_coo);
}
- if(std::find(num_coos.begin(),num_coos.end(),(const DataArrayInt *)0)==num_coos.end())
+ if(std::find(num_coos.begin(),num_coos.end(),(const DataArrayIdType *)0)==num_coos.end())
{
- MCAuto<DataArrayInt> num_coo(DataArrayInt::Aggregate(num_coos));
+ MCAuto<DataArrayIdType> num_coo(DataArrayIdType::Aggregate(num_coos));
ret->setRenumFieldArr(1,num_coo);
}
// cells
throw INTERP_KERNEL::Exception("MEDFileUMesh::Aggregate : internal error 1 !");
MCAuto<MEDCouplingUMesh> mesh(MEDCouplingUMesh::MergeUMeshes((*it2).second));
mesh->setCoords(coo); mesh->setName(ref->getName());
- MCAuto<DataArrayInt> renum(mesh->sortCellsInMEDFileFrmt());
+ MCAuto<DataArrayIdType> renum(mesh->sortCellsInMEDFileFrmt());
ret->setMeshAtLevel(level,mesh);
auto it3(m_fam.find(level)),it4(m_renum.find(level));
if(it3==m_fam.end()) // Should never happen (all levels exist for all meshes)
if(it4==m_renum.end())
throw INTERP_KERNEL::Exception("MEDFileUMesh::Aggregate : internal error 3!");
// Set new family field if it was defined for all input meshes
- const std::vector<const DataArrayInt *>& fams((*it3).second);
- if(std::find(fams.begin(),fams.end(),(const DataArrayInt *)0)==fams.end())
+ const std::vector<const DataArrayIdType *>& fams((*it3).second);
+ if(std::find(fams.begin(),fams.end(),(const DataArrayIdType *)0)==fams.end())
{
- MCAuto<DataArrayInt> famm(DataArrayInt::Aggregate(fams));
+ MCAuto<DataArrayIdType> famm(DataArrayIdType::Aggregate(fams));
famm->renumberInPlace(renum->begin());
ret->setFamilyFieldArr(level,famm);
}
// Set optional number field if defined for all input meshes:
- const std::vector<const DataArrayInt *>& renums((*it4).second);
- if(std::find(renums.begin(),renums.end(),(const DataArrayInt *)0)==renums.end())
+ const std::vector<const DataArrayIdType *>& renums((*it4).second);
+ if(std::find(renums.begin(),renums.end(),(const DataArrayIdType *)0)==renums.end())
{
- MCAuto<DataArrayInt> renumm(DataArrayInt::Aggregate(renums));
+ MCAuto<DataArrayIdType> renumm(DataArrayIdType::Aggregate(renums));
renumm->renumberInPlace(renum->begin());
ret->setRenumFieldArr(level,renumm);
}
MCAuto<MEDCouplingUMesh> m3D(getMeshAtLevel(0)),m2D(getMeshAtLevel(-1));
if(m3D.isNull() || m2D.isNull())
throw INTERP_KERNEL::Exception("MEDFileUMesh::convertToExtrudedMesh : this must be defined both at level 0 and level -1 !");
- int zeId(std::numeric_limits<int>::max()-getFamilyId(GetSpeStr4ExtMesh()));
+ mcIdType zeId(std::numeric_limits<med_int>::max()-getFamilyId(GetSpeStr4ExtMesh()));
MCAuto<MEDCouplingMappedExtrudedMesh> ret(MEDCouplingMappedExtrudedMesh::New(m3D,m2D,zeId));
return ret.retn();
}
-void MEDFileUMesh::serialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr, std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD)
+void MEDFileUMesh::serialize(std::vector<double>& tinyDouble, std::vector<mcIdType>& tinyInt, std::vector<std::string>& tinyStr, std::vector< MCAuto<DataArrayIdType> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD)
{
clearNonDiscrAttributes();
forceComputationOfParts();
tinyDouble.clear(); tinyInt.clear(); tinyStr.clear(); bigArraysI.clear(); bigArrayD=0;
- std::vector<int> layer0;
+ std::vector<mcIdType> layer0;
layer0.push_back(getAxisType());//0 i
layer0.push_back(_order); //1 i
layer0.push_back(_iteration);//2 i
tinyStr.push_back(_desc_name);//1 s
for(int i=0;i<getSpaceDimension();i++)
tinyStr.push_back(_coords->getInfoOnComponent(i));
- layer0.push_back((int)_families.size());//4 i <- key info aa layer#0
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ layer0.push_back(ToIdType(_families.size()));//4 i <- key info aa layer#0
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
tinyStr.push_back((*it).first);
layer0.push_back((*it).second);
}
- layer0.push_back((int)_groups.size());//4+aa i <- key info bb layer#0
+ layer0.push_back((mcIdType)_groups.size());//4+aa i <- key info bb layer#0
for(std::map<std::string, std::vector<std::string> >::const_iterator it0=_groups.begin();it0!=_groups.end();it0++)
{
- layer0.push_back((int)(*it0).second.size());
+ layer0.push_back(ToIdType((*it0).second.size()));
tinyStr.push_back((*it0).first);
for(std::vector<std::string>::const_iterator it1=((*it0).second).begin();it1!=((*it0).second).end();it1++)
tinyStr.push_back(*it1);
layer0.push_back(-1);
else
{
- std::vector<int> tmp0;
+ std::vector<mcIdType> tmp0;
pd->serialize(tmp0,bigArraysI);
- tinyInt.push_back(tmp0.size());
+ tinyInt.push_back(ToIdType(tmp0.size()));
tinyInt.insert(tinyInt.end(),tmp0.begin(),tmp0.end());
}
//
- std::vector<int> layer1;
+ std::vector<mcIdType> layer1;
std::vector<int> levs(getNonEmptyLevels());
- layer1.push_back((int)levs.size());// 0 i <- key
+ layer1.push_back((mcIdType)levs.size());// 0 i <- key
layer1.insert(layer1.end(),levs.begin(),levs.end());
for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
{
lev->serialize(layer1,bigArraysI);
}
// put layers all together.
- tinyInt.push_back(layer0.size());
+ tinyInt.push_back(ToIdType(layer0.size()));
tinyInt.insert(tinyInt.end(),layer0.begin(),layer0.end());
- tinyInt.push_back(layer1.size());
+ tinyInt.push_back(ToIdType(layer1.size()));
tinyInt.insert(tinyInt.end(),layer1.begin(),layer1.end());
}
-void MEDFileUMesh::unserialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr,
- std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD)
+void MEDFileUMesh::unserialize(std::vector<double>& tinyDouble, std::vector<mcIdType>& tinyInt, std::vector<std::string>& tinyStr,
+ std::vector< MCAuto<DataArrayIdType> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD)
{
- int sz0(tinyInt[0]);
- std::vector<int> layer0(tinyInt.begin()+1,tinyInt.begin()+1+sz0);
- int sz1(tinyInt[sz0+1]);
- std::vector<int> layer1(tinyInt.begin()+2+sz0,tinyInt.begin()+2+sz0+sz1);
+ mcIdType sz0(tinyInt[0]);
+ std::vector<mcIdType> layer0(tinyInt.begin()+1,tinyInt.begin()+1+sz0);
+ mcIdType sz1(tinyInt[sz0+1]);
+ std::vector<mcIdType> layer1(tinyInt.begin()+2+sz0,tinyInt.begin()+2+sz0+sz1);
//
std::reverse(layer0.begin(),layer0.end());
std::reverse(layer1.begin(),layer1.end());
std::reverse(bigArraysI.begin(),bigArraysI.end());
//
setAxisType((MEDCouplingAxisType)layer0.back()); layer0.pop_back();
- _order=layer0.back(); layer0.pop_back();
- _iteration=layer0.back(); layer0.pop_back();
- int spaceDim(layer0.back()); layer0.pop_back();
+ _order=FromIdType<int>(layer0.back()); layer0.pop_back();
+ _iteration=FromIdType<int>(layer0.back()); layer0.pop_back();
+ mcIdType spaceDim(layer0.back()); layer0.pop_back();
_time=tinyDouble.back(); tinyDouble.pop_back();
_name=tinyStr.back(); tinyStr.pop_back();
_desc_name=tinyStr.back(); tinyStr.pop_back();
_coords->setInfoOnComponent(i,tinyStr.back());
tinyStr.pop_back();
}
- int nbOfFams(layer0.back()); layer0.pop_back();
+ mcIdType nbOfFams(layer0.back()); layer0.pop_back();
_families.clear();
- for(int i=0;i<nbOfFams;i++)
+ for(mcIdType i=0;i<nbOfFams;i++)
{
_families[tinyStr.back()]=layer0.back();
tinyStr.pop_back(); layer0.pop_back();
}
- int nbGroups(layer0.back()); layer0.pop_back();
+ mcIdType nbGroups(layer0.back()); layer0.pop_back();
_groups.clear();
- for(int i=0;i<nbGroups;i++)
+ for(mcIdType i=0;i<nbGroups;i++)
{
std::string grpName(tinyStr.back()); tinyStr.pop_back();
- int nbOfFamsOnGrp(layer0.back()); layer0.pop_back();
+ mcIdType nbOfFamsOnGrp(layer0.back()); layer0.pop_back();
std::vector<std::string> fams(nbOfFamsOnGrp);
- for(int j=0;j<nbOfFamsOnGrp;j++)
+ for(mcIdType j=0;j<nbOfFamsOnGrp;j++)
{
fams[j]=tinyStr.back(); tinyStr.pop_back();
}
_fam_coords=bigArraysI.back(); bigArraysI.pop_back();
_num_coords=bigArraysI.back(); bigArraysI.pop_back();
_part_coords=0;
- int isPd(layer0.back()); layer0.pop_back();
+ mcIdType isPd(layer0.back()); layer0.pop_back();
if(isPd!=-1)
{
- std::vector<int> tmp0(layer0.begin(),layer0.begin()+isPd);
+ std::vector<mcIdType> tmp0(layer0.begin(),layer0.begin()+isPd);
layer0.erase(layer0.begin(),layer0.begin()+isPd);
_part_coords=PartDefinition::Unserialize(tmp0,bigArraysI);
}
if(!layer0.empty())
throw INTERP_KERNEL::Exception("MEDFileUMesh::unserialize : something wrong during unserialization #1 !");
//
- int nbLevs(layer1.back()); layer1.pop_back();
- std::vector<int> levs(layer1.rbegin(),layer1.rbegin()+nbLevs); layer1.erase(layer1.end()-nbLevs,layer1.end());
+ mcIdType nbLevs(layer1.back()); layer1.pop_back();
+ std::vector<mcIdType> levs(layer1.rbegin(),layer1.rbegin()+nbLevs); layer1.erase(layer1.end()-nbLevs,layer1.end());
_ms.clear();
- int maxLev(-(*std::min_element(levs.begin(),levs.end())));
+ mcIdType maxLev(-(*std::min_element(levs.begin(),levs.end())));
_ms.resize(maxLev+1);
- for(int i=0;i<nbLevs;i++)
+ for(mcIdType i=0;i<nbLevs;i++)
{
- int lev(levs[i]);
- int pos(-lev);
+ mcIdType lev(levs[i]);
+ mcIdType pos(-lev);
_ms[pos]=MEDFileUMeshSplitL1::Unserialize(_name,_coords,layer1,bigArraysI);
}
}
/*!
* Adds a group of nodes to \a this mesh.
- * \param [in] ids - a DataArrayInt providing ids and a name of the group to add.
+ * \param [in] ids - a DataArrayIdType providing ids and a name of the group to add.
* The ids should be sorted and different each other (MED file norm).
*
* \warning this method can alter default "FAMILLE_ZERO" family.
* \throw If \a ids does not respect the MED file norm.
* \throw If a group with name \a ids->getName() already exists.
*/
-void MEDFileUMesh::addNodeGroup(const DataArrayInt *ids)
+void MEDFileUMesh::addNodeGroup(const DataArrayIdType *ids)
{
const DataArrayDouble *coords(_coords);
if(!coords)
throw INTERP_KERNEL::Exception("MEDFileUMesh::addNodeGroup : no coords set !");
- int nbOfNodes(coords->getNumberOfTuples());
+ mcIdType nbOfNodes(coords->getNumberOfTuples());
if(_fam_coords.isNull())
- { _fam_coords=DataArrayInt::New(); _fam_coords->alloc(nbOfNodes,1); _fam_coords->fillWithZero(); }
+ { _fam_coords=DataArrayIdType::New(); _fam_coords->alloc(nbOfNodes,1); _fam_coords->fillWithZero(); }
//
addGroupUnderground(true,ids,_fam_coords);
}
/*!
* Adds a group of nodes/cells/faces/edges to \a this mesh.
*
- * \param [in] ids - a DataArrayInt providing ids and a name of the group to add.
+ * \param [in] ids - a DataArrayIdType providing ids and a name of the group to add.
* The ids should be sorted and different each other (MED file norm).
*
* \warning this method can alter default "FAMILLE_ZERO" family.
* \throw If \a ids does not respect the MED file norm.
* \throw If a group with name \a ids->getName() already exists.
*/
-void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids)
+void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids)
{
std::vector<int> levs(getNonEmptyLevelsExt());
if(std::find(levs.begin(),levs.end(),meshDimRelToMaxExt)==levs.end())
if(meshDimRelToMaxExt==1)
{ addNodeGroup(ids); return ; }
MEDFileUMeshSplitL1 *lev(getMeshAtLevSafe(meshDimRelToMaxExt));
- DataArrayInt *fam(lev->getOrCreateAndGetFamilyField());
+ DataArrayIdType *fam(lev->getOrCreateAndGetFamilyField());
addGroupUnderground(false,ids,fam);
}
* \param [in] newFamName - the new family name.
* \throw If no family with the given \a id exists.
*/
-void MEDFileUMesh::setFamilyNameAttachedOnId(int id, const std::string& newFamName)
+void MEDFileUMesh::setFamilyNameAttachedOnId(mcIdType id, const std::string& newFamName)
{
std::string oldName=getFamilyNameGivenId(id);
_families.erase(oldName);
else
if((DataArrayDouble *)_coords!=coo)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsFromScratch : coordinates mismatches !");
- std::vector<DataArrayInt *> corr;
+ std::vector<DataArrayIdType *> corr;
MCAuto<MEDCouplingUMesh> m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,_zipconn_pol,corr);
- std::vector< MCAuto<DataArrayInt> > corr3(corr.begin(),corr.end());
+ std::vector< MCAuto<DataArrayIdType> > corr3(corr.begin(),corr.end());
setMeshAtLevel(meshDimRelToMax,m,renum);
- std::vector<const DataArrayInt *> corr2(corr.begin(),corr.end());
+ std::vector<const DataArrayIdType *> corr2(corr.begin(),corr.end());
setGroupsAtLevel(meshDimRelToMax,corr2,true);
}
if((DataArrayDouble *)_coords!=coo)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsOnSetMesh : coordinates mismatches !");
MEDCouplingUMesh *m=getMeshAtLevel(meshDimRelToMax,renum);
- std::vector< MCAuto<DataArrayInt> > corr(ms.size());
+ std::vector< MCAuto<DataArrayIdType> > corr(ms.size());
int i=0;
for(std::vector<const MEDCouplingUMesh *>::const_iterator it=ms.begin();it!=ms.end();it++,i++)
{
- DataArrayInt *arr=0;
+ DataArrayIdType *arr=0;
bool test=m->areCellsIncludedIn(*it,_zipconn_pol,arr);
corr[i]=arr;
if(!test)
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- std::vector<const DataArrayInt *> corr2(corr.begin(),corr.end());
+ std::vector<const DataArrayIdType *> corr2(corr.begin(),corr.end());
setGroupsAtLevel(meshDimRelToMax,corr2,renum);
}
* \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
* \throw If \a famArr has an invalid size.
*/
-void MEDFileUMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr)
+void MEDFileUMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr)
{
if(meshDimRelToMaxExt==1)
{
* \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
* \throw If \a renumArr has an invalid size.
*/
-void MEDFileUMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr)
+void MEDFileUMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr)
{
if(meshDimRelToMaxExt==1)
{
return _ms[traducedRk]->setNameArr(nameArr);
}
-void MEDFileUMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr)
+void MEDFileUMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr)
{
if(meshDimRelToMaxExt!=1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGlobalNumFieldAtLevel : Only implemented for meshDimRelToMaxExt==1 for the moment !");
/*!
* This method is called by MEDFileMesh::changeFamilyId. It performs only one part of the family id modification.
*/
-void MEDFileUMesh::changeFamilyIdArr(int oldId, int newId)
+void MEDFileUMesh::changeFamilyIdArr(mcIdType oldId, mcIdType newId)
{
- DataArrayInt *arr=_fam_coords;
+ DataArrayIdType *arr=_fam_coords;
if(arr)
arr->changeValue(oldId,newId);
for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
}
}
-std::list< MCAuto<DataArrayInt> > MEDFileUMesh::getAllNonNullFamilyIds() const
+std::list< MCAuto<DataArrayIdType> > MEDFileUMesh::getAllNonNullFamilyIds() const
{
- std::list< MCAuto<DataArrayInt> > ret;
- const DataArrayInt *da(_fam_coords);
+ std::list< MCAuto<DataArrayIdType> > ret;
+ const DataArrayIdType *da(_fam_coords);
if(da)
- { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayIdType>(const_cast<DataArrayIdType *>(da))); }
for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
const MEDFileUMeshSplitL1 *elt(*it);
{
da=elt->getFamilyField();
if(da)
- { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayIdType>(const_cast<DataArrayIdType *>(da))); }
}
}
return ret;
{
if(_num_coords.isNotNull())
{
- int pos;
- int maxValue=_num_coords->getMaxValue(pos);
+ mcIdType pos;
+ mcIdType maxValue=_num_coords->getMaxValue(pos);
_rev_num_coords=_num_coords->invertArrayN2O2O2N(maxValue+1);
}
}
std::vector<const BigMemoryObject *> MEDFileStructuredMesh::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret(MEDFileMesh::getDirectChildrenWithNull());
- ret.push_back((const DataArrayInt *)_fam_nodes);
- ret.push_back((const DataArrayInt *)_num_nodes);
+ ret.push_back((const DataArrayIdType *)_fam_nodes);
+ ret.push_back((const DataArrayIdType *)_num_nodes);
ret.push_back((const DataArrayAsciiChar *)_names_nodes);
- ret.push_back((const DataArrayInt *)_fam_cells);
- ret.push_back((const DataArrayInt *)_num_cells);
+ ret.push_back((const DataArrayIdType *)_fam_cells);
+ ret.push_back((const DataArrayIdType *)_num_cells);
ret.push_back((const DataArrayAsciiChar *)_names_cells);
- ret.push_back((const DataArrayInt *)_fam_faces);
- ret.push_back((const DataArrayInt *)_num_faces);
- ret.push_back((const DataArrayInt *)_rev_num_nodes);
+ ret.push_back((const DataArrayIdType *)_fam_faces);
+ ret.push_back((const DataArrayIdType *)_num_faces);
+ ret.push_back((const DataArrayIdType *)_rev_num_nodes);
ret.push_back((const DataArrayAsciiChar *)_names_faces);
- ret.push_back((const DataArrayInt *)_rev_num_cells);
+ ret.push_back((const DataArrayIdType *)_rev_num_cells);
ret.push_back((const MEDCoupling1SGTUMesh*)_faces_if_necessary);
return ret;
}
-int MEDFileStructuredMesh::getMaxAbsFamilyIdInArrays() const
+mcIdType MEDFileStructuredMesh::getMaxAbsFamilyIdInArrays() const
{
- int ret=-std::numeric_limits<int>::max(),tmp=-1;
- if((const DataArrayInt *)_fam_nodes)
+ mcIdType ret=-std::numeric_limits<mcIdType>::max(),tmp=-1;
+ if((const DataArrayIdType *)_fam_nodes)
{
- int val=_fam_nodes->getMaxValue(tmp);
+ mcIdType val=_fam_nodes->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
- if((const DataArrayInt *)_fam_cells)
+ if((const DataArrayIdType *)_fam_cells)
{
- int val=_fam_cells->getMaxValue(tmp);
+ mcIdType val=_fam_cells->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
- if((const DataArrayInt *)_fam_faces)
+ if((const DataArrayIdType *)_fam_faces)
{
- int val=_fam_faces->getMaxValue(tmp);
+ mcIdType val=_fam_faces->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
return ret;
}
-int MEDFileStructuredMesh::getMaxFamilyIdInArrays() const
+mcIdType MEDFileStructuredMesh::getMaxFamilyIdInArrays() const
{
- int ret=-std::numeric_limits<int>::max(),tmp=-1;
- if((const DataArrayInt *)_fam_nodes)
+ mcIdType ret=-std::numeric_limits<mcIdType>::max(),tmp=-1;
+ if((const DataArrayIdType *)_fam_nodes)
{
- int val=_fam_nodes->getMaxValue(tmp);
+ mcIdType val=_fam_nodes->getMaxValue(tmp);
ret=std::max(ret,val);
}
- if((const DataArrayInt *)_fam_cells)
+ if((const DataArrayIdType *)_fam_cells)
{
- int val=_fam_cells->getMaxValue(tmp);
+ mcIdType val=_fam_cells->getMaxValue(tmp);
ret=std::max(ret,val);
}
- if((const DataArrayInt *)_fam_faces)
+ if((const DataArrayIdType *)_fam_faces)
{
- int val=_fam_faces->getMaxValue(tmp);
+ mcIdType val=_fam_faces->getMaxValue(tmp);
ret=std::max(ret,val);
}
return ret;
}
-int MEDFileStructuredMesh::getMinFamilyIdInArrays() const
+mcIdType MEDFileStructuredMesh::getMinFamilyIdInArrays() const
{
- int ret=std::numeric_limits<int>::max(),tmp=-1;
- if((const DataArrayInt *)_fam_nodes)
+ mcIdType ret=std::numeric_limits<mcIdType>::max(),tmp=-1;
+ if((const DataArrayIdType *)_fam_nodes)
{
- int val=_fam_nodes->getMinValue(tmp);
+ mcIdType val=_fam_nodes->getMinValue(tmp);
ret=std::min(ret,val);
}
- if((const DataArrayInt *)_fam_cells)
+ if((const DataArrayIdType *)_fam_cells)
{
- int val=_fam_cells->getMinValue(tmp);
+ mcIdType val=_fam_cells->getMinValue(tmp);
ret=std::min(ret,val);
}
- if((const DataArrayInt *)_fam_faces)
+ if((const DataArrayIdType *)_fam_faces)
{
- int val=_fam_faces->getMinValue(tmp);
+ mcIdType val=_fam_faces->getMinValue(tmp);
ret=std::min(ret,val);
}
return ret;
what="Mesh types differ ! This is structured and other is NOT !";
return false;
}
- const DataArrayInt *famc1=_fam_nodes;
- const DataArrayInt *famc2=otherC->_fam_nodes;
+ const DataArrayIdType *famc1=_fam_nodes;
+ const DataArrayIdType *famc2=otherC->_fam_nodes;
if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0))
{
what="Mismatch of families arr on nodes ! One is defined and not other !";
void MEDFileStructuredMesh::clearNonDiscrAttributes() const
{
MEDFileMesh::clearNonDiscrAttributes();
- const DataArrayInt *tmp=_fam_nodes;
+ const DataArrayIdType *tmp=_fam_nodes;
if(tmp)
- (const_cast<DataArrayInt *>(tmp))->setName("");
+ (const_cast<DataArrayIdType *>(tmp))->setName("");
tmp=_num_nodes;
if(tmp)
- (const_cast<DataArrayInt *>(tmp))->setName("");
+ (const_cast<DataArrayIdType *>(tmp))->setName("");
tmp=_fam_cells;
if(tmp)
- (const_cast<DataArrayInt *>(tmp))->setName("");
+ (const_cast<DataArrayIdType *>(tmp))->setName("");
tmp=_num_cells;
if(tmp)
- (const_cast<DataArrayInt *>(tmp))->setName("");
+ (const_cast<DataArrayIdType *>(tmp))->setName("");
tmp=_fam_faces;
if(tmp)
- (const_cast<DataArrayInt *>(tmp))->setName("");
+ (const_cast<DataArrayIdType *>(tmp))->setName("");
tmp=_num_faces;
if(tmp)
- (const_cast<DataArrayInt *>(tmp))->setName("");
+ (const_cast<DataArrayIdType *>(tmp))->setName("");
}
/*!
* \param [in] fams - the names of the families of interest.
* \param [in] renum - if \c true, the optional numbers of entities, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of mesh entities of the families. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the family field is missing for \a meshDimRelToMaxExt.
*/
-DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum) const
+DataArrayIdType *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum) const
{
- std::vector<int> famIds(getFamiliesIds(fams));
+ std::vector<mcIdType> famIds(getFamiliesIds(fams));
switch(meshDimRelToMaxExt)
{
case 1:
{
- if((const DataArrayInt *)_fam_nodes)
+ if((const DataArrayIdType *)_fam_nodes)
{
- MCAuto<DataArrayInt> da;
+ MCAuto<DataArrayIdType> da;
if(!famIds.empty())
da=_fam_nodes->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size());
else
}
case 0:
{
- if((const DataArrayInt *)_fam_cells)
+ if((const DataArrayIdType *)_fam_cells)
{
- MCAuto<DataArrayInt> da;
+ MCAuto<DataArrayIdType> da;
if(!famIds.empty())
da=_fam_cells->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size());
else
}
case -1:
{
- if((const DataArrayInt *)_fam_faces)
+ if((const DataArrayIdType *)_fam_faces)
{
- MCAuto<DataArrayInt> da;
+ MCAuto<DataArrayIdType> da;
if(!famIds.empty())
da=_fam_faces->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size());
else
* \throw If \a famArr has an invalid size.
* \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1 and \a meshDimRelToMaxExt != -1.
*/
-void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr)
+void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr)
{
const MEDCouplingStructuredMesh *mesh(getStructuredMesh());
if(!mesh)
{
case 0:
{
- int nbCells(mesh->getNumberOfCells());
+ mcIdType nbCells(mesh->getNumberOfCells());
if(famArr)
famArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of cells of mesh !");
_fam_cells=famArr;
}
case 1:
{
- int nbNodes(mesh->getNumberOfNodes());
+ mcIdType nbNodes(mesh->getNumberOfNodes());
if(famArr)
famArr->checkNbOfTuplesAndComp(nbNodes,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of nodes of mesh !");
_fam_nodes=famArr;
}
case -1:
{
- int nbCells(mesh->getNumberOfCellsOfSubLevelMesh());
+ mcIdType nbCells(mesh->getNumberOfCellsOfSubLevelMesh());
if(famArr)
famArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of faces of mesh !");
_fam_faces=famArr;
* \throw If \a renumArr has an invalid size.
* \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1.
*/
-void MEDFileStructuredMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr)
+void MEDFileStructuredMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr)
{
const MEDCouplingStructuredMesh *mesh=getStructuredMesh();
if(!mesh)
{
case 0:
{
- int nbCells=mesh->getNumberOfCells();
+ mcIdType nbCells=mesh->getNumberOfCells();
renumArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Renum arr ! Mismatch with number of cells of mesh !");
_num_cells=renumArr;
break;
}
case 1:
{
- int nbNodes=mesh->getNumberOfNodes();
+ mcIdType nbNodes=mesh->getNumberOfNodes();
renumArr->checkNbOfTuplesAndComp(nbNodes,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Family arr ! Mismatch with number of nodes of mesh !");
_num_nodes=renumArr;
break;
}
case -1:
{
- int nbCells=mesh->getNumberOfCellsOfSubLevelMesh();
+ mcIdType nbCells=mesh->getNumberOfCellsOfSubLevelMesh();
renumArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Renum arr ! Mismatch with number of faces of mesh !");
_num_faces=renumArr;
break;
{
case 0:
{
- int nbCells=mesh->getNumberOfCells();
+ mcIdType nbCells=mesh->getNumberOfCells();
nameArr->checkNbOfTuplesAndComp(nbCells,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of cells of mesh !");
_names_cells=nameArr;
break;
}
case 1:
{
- int nbNodes=mesh->getNumberOfNodes();
+ mcIdType nbNodes=mesh->getNumberOfNodes();
nameArr->checkNbOfTuplesAndComp(nbNodes,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of nodes of mesh !");
_names_nodes=nameArr;
break;
}
case -1:
{
- int nbCells=mesh->getNumberOfCellsOfSubLevelMesh();
+ mcIdType nbCells=mesh->getNumberOfCellsOfSubLevelMesh();
nameArr->checkNbOfTuplesAndComp(nbCells,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of faces of mesh !");
_names_faces=nameArr;
}
nameArr->incrRef();
}
-void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr)
+void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr)
{
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setGlobalNumFieldAtLevel : not implemented yet !");
}
/*!
* Adds a group of nodes to \a this mesh.
- * \param [in] ids - a DataArrayInt providing ids and a name of the group to add.
+ * \param [in] ids - a DataArrayIdType providing ids and a name of the group to add.
* The ids should be sorted and different each other (MED file norm).
*
* \warning this method can alter default "FAMILLE_ZERO" family.
* \throw If \a ids does not respect the MED file norm.
* \throw If a group with name \a ids->getName() already exists.
*/
-void MEDFileStructuredMesh::addNodeGroup(const DataArrayInt *ids)
+void MEDFileStructuredMesh::addNodeGroup(const DataArrayIdType *ids)
{
addGroup(1,ids);
}
/*!
* Adds a group of nodes/cells/faces/edges to \a this mesh.
*
- * \param [in] ids - a DataArrayInt providing ids and a name of the group to add.
+ * \param [in] ids - a DataArrayIdType providing ids and a name of the group to add.
* The ids should be sorted and different each other (MED file norm).
*
* \warning this method can alter default "FAMILLE_ZERO" family.
* \throw If \a ids does not respect the MED file norm.
* \throw If a group with name \a ids->getName() already exists.
*/
-void MEDFileStructuredMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids)
+void MEDFileStructuredMesh::addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids)
{
- DataArrayInt *fam(getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt));
+ DataArrayIdType *fam(getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt));
addGroupUnderground(false,ids,fam);
return ;
}
/*!
* Returns the family field for mesh entities of a given dimension.
* \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
- * \return const DataArrayInt * - the family field. It is an array of ids of families
+ * \return const DataArrayIdType * - the family field. It is an array of ids of families
* each mesh entity belongs to. It can be \c NULL.
* \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1.
*/
-const DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
+const DataArrayIdType *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
{
switch(meshDimRelToMaxExt)
{
/*!
* Returns the family field for mesh entities of a given dimension.
* \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
- * \return const DataArrayInt * - the family field. It is an array of ids of families
+ * \return const DataArrayIdType * - the family field. It is an array of ids of families
* each mesh entity belongs to. It can be \c NULL.
* \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1.
*/
-DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt)
+DataArrayIdType *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt)
{
switch(meshDimRelToMaxExt)
{
/*!
* Returns the optional numbers of mesh entities of a given dimension.
* \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
- * \return const DataArrayInt * - the array of the entity numbers.
+ * \return const DataArrayIdType * - the array of the entity numbers.
* \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
* \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1.
*/
-const DataArrayInt *MEDFileStructuredMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const
+const DataArrayIdType *MEDFileStructuredMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const
{
switch(meshDimRelToMaxExt)
{
/*!
* Returns the optional numbers of mesh entities of a given dimension transformed using
- * DataArrayInt::invertArrayN2O2O2N().
+ * DataArrayIdType::invertArrayN2O2O2N().
* \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
- * \return const DataArrayInt * - the array of the entity numbers transformed using
- * DataArrayInt::invertArrayN2O2O2N().
+ * \return const DataArrayIdType * - the array of the entity numbers transformed using
+ * DataArrayIdType::invertArrayN2O2O2N().
* \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1.
* \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
*/
-const DataArrayInt *MEDFileStructuredMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
+const DataArrayIdType *MEDFileStructuredMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
{
if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1)
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getRevNumberFieldAtLevel : Only available for levels 0 or 1 !");
if(meshDimRelToMaxExt==0)
{
- if((const DataArrayInt *)_num_cells)
+ if((const DataArrayIdType *)_num_cells)
{
- int pos;
- int maxValue=_num_cells->getMaxValue(pos);
+ mcIdType pos;
+ mcIdType maxValue=_num_cells->getMaxValue(pos);
_rev_num_cells=_num_cells->invertArrayN2O2O2N(maxValue+1);
return _rev_num_cells;
}
}
else
{
- if((const DataArrayInt *)_num_nodes)
+ if((const DataArrayIdType *)_num_nodes)
{
- int pos;
- int maxValue=_num_nodes->getMaxValue(pos);
+ mcIdType pos;
+ mcIdType maxValue=_num_nodes->getMaxValue(pos);
_rev_num_nodes=_num_nodes->invertArrayN2O2O2N(maxValue+1);
return _rev_num_nodes;
}
}
}
-MCAuto<DataArrayInt> MEDFileStructuredMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
+MCAuto<DataArrayIdType> MEDFileStructuredMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
{
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getGlobalNumFieldAtLevel : not implemented yet for structured mesh !");
}
std::vector<int> MEDFileStructuredMesh::getFamArrNonEmptyLevelsExt() const
{
std::vector<int> ret;
- const DataArrayInt *famNodes(_fam_nodes),*famCells(_fam_cells),*famFaces(_fam_faces);
+ const DataArrayIdType *famNodes(_fam_nodes),*famCells(_fam_cells),*famFaces(_fam_faces);
if(famNodes)
ret.push_back(1);
if(famCells)
std::vector<int> MEDFileStructuredMesh::getNumArrNonEmptyLevelsExt() const
{
std::vector<int> ret;
- const DataArrayInt *numNodes(_num_nodes),*numCells(_num_cells),*numFaces(_num_faces);
+ const DataArrayIdType *numNodes(_num_nodes),*numCells(_num_cells),*numFaces(_num_faces);
if(numNodes)
ret.push_back(1);
if(numCells)
/*!
* no implementation here, it is not a bug, but intresically no polyhedra in \a this.
*/
-bool MEDFileStructuredMesh::unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell)
+bool MEDFileStructuredMesh::unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell)
{
oldCode.clear(); newCode.clear(); o2nRenumCell=0;
return false;
}
-void MEDFileStructuredMesh::changeFamilyIdArr(int oldId, int newId)
+void MEDFileStructuredMesh::changeFamilyIdArr(mcIdType oldId, mcIdType newId)
{
- DataArrayInt *arr=_fam_nodes;
+ DataArrayIdType *arr=_fam_nodes;
if(arr)
arr->changeValue(oldId,newId);
arr=_fam_cells;
arr->changeValue(oldId,newId);
}
-std::list< MCAuto<DataArrayInt> > MEDFileStructuredMesh::getAllNonNullFamilyIds() const
+std::list< MCAuto<DataArrayIdType> > MEDFileStructuredMesh::getAllNonNullFamilyIds() const
{
- std::list< MCAuto<DataArrayInt> > ret;
- const DataArrayInt *da(_fam_nodes);
+ std::list< MCAuto<DataArrayIdType> > ret;
+ const DataArrayIdType *da(_fam_nodes);
if(da)
- { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayIdType>(const_cast<DataArrayIdType *>(da))); }
da=_fam_cells;
if(da)
- { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayIdType>(const_cast<DataArrayIdType *>(da))); }
da=_fam_faces;
if(da)
- { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayIdType>(const_cast<DataArrayIdType *>(da))); }
return ret;
}
void MEDFileStructuredMesh::deepCpyAttributes()
{
- if((const DataArrayInt*)_fam_nodes)
+ if((const DataArrayIdType*)_fam_nodes)
_fam_nodes=_fam_nodes->deepCopy();
- if((const DataArrayInt*)_num_nodes)
+ if((const DataArrayIdType*)_num_nodes)
_num_nodes=_num_nodes->deepCopy();
if((const DataArrayAsciiChar*)_names_nodes)
_names_nodes=_names_nodes->deepCopy();
- if((const DataArrayInt*)_fam_cells)
+ if((const DataArrayIdType*)_fam_cells)
_fam_cells=_fam_cells->deepCopy();
- if((const DataArrayInt*)_num_cells)
+ if((const DataArrayIdType*)_num_cells)
_num_cells=_num_cells->deepCopy();
if((const DataArrayAsciiChar*)_names_cells)
_names_cells=_names_cells->deepCopy();
- if((const DataArrayInt*)_fam_faces)
+ if((const DataArrayIdType*)_fam_faces)
_fam_faces=_fam_faces->deepCopy();
- if((const DataArrayInt*)_num_faces)
+ if((const DataArrayIdType*)_num_faces)
_num_faces=_num_faces->deepCopy();
if((const DataArrayAsciiChar*)_names_faces)
_names_faces=_names_faces->deepCopy();
- if((const DataArrayInt*)_rev_num_nodes)
+ if((const DataArrayIdType*)_rev_num_nodes)
_rev_num_nodes=_rev_num_nodes->deepCopy();
- if((const DataArrayInt*)_rev_num_cells)
+ if((const DataArrayIdType*)_rev_num_cells)
_rev_num_cells=_rev_num_cells->deepCopy();
}
}
}
-std::vector<int> MEDFileStructuredMesh::getFamsNonEmptyLevels(const std::vector<std::string>& fams) const
+std::vector<mcIdType> MEDFileStructuredMesh::getFamsNonEmptyLevels(const std::vector<std::string>& fams) const
{
- std::vector<int> ret;
- const DataArrayInt *famCells(_fam_cells),*famFaces(_fam_faces);
+ std::vector<mcIdType> ret;
+ const DataArrayIdType *famCells(_fam_cells),*famFaces(_fam_faces);
if(famCells && famCells->presenceOfValue(ret))
ret.push_back(0);
if(famFaces && famFaces->presenceOfValue(ret))
return ret;
}
-std::vector<int> MEDFileStructuredMesh::getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const
+std::vector<mcIdType> MEDFileStructuredMesh::getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const
{
- std::vector<int> ret(getFamsNonEmptyLevels(fams));
- const DataArrayInt *famNodes(_fam_nodes);
+ std::vector<mcIdType> ret(getFamsNonEmptyLevels(fams));
+ const DataArrayIdType *famNodes(_fam_nodes);
if(famNodes && famNodes->presenceOfValue(ret))
ret.push_back(1);
return ret;
/*!
* Returns number of mesh entities of a given relative dimension in \a this mesh.
* \param [in] meshDimRelToMaxExt - the relative dimension of interest.
- * \return int - the number of entities.
+ * \return mcIdType - the number of entities.
* \throw If no mesh entities of dimension \a meshDimRelToMaxExt are available in \a this mesh.
*/
-int MEDFileStructuredMesh::getSizeAtLevel(int meshDimRelToMaxExt) const
+mcIdType MEDFileStructuredMesh::getSizeAtLevel(int meshDimRelToMaxExt) const
{
const MEDCouplingStructuredMesh *cmesh(getStructuredMesh());
if(!cmesh)
}
}
-int MEDFileStructuredMesh::getNumberOfNodes() const
+mcIdType MEDFileStructuredMesh::getNumberOfNodes() const
{
const MEDCouplingStructuredMesh *cmesh(getStructuredMesh());
if(!cmesh)
return cmesh->getNumberOfNodes();
}
-int MEDFileStructuredMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const
+mcIdType MEDFileStructuredMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const
{
const MEDCouplingStructuredMesh *cmesh(getStructuredMesh());
if(!cmesh)
/*!
* \sa MEDFileStructuredMesh::getImplicitFaceMesh
*/
-int MEDFileStructuredMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const
+mcIdType MEDFileStructuredMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const
{
static const char MSG[]="MEDFileStructuredMesh::buildImplicitPartIfAny : the given geo type is not manageable by a structured mesh !";
const MEDCoupling1SGTUMesh *zeFaceMesh(_faces_if_necessary);
}
}
-int MEDFileStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
+mcIdType MEDFileStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
{
if(ct!=MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(getMeshDimension()))
return 0;
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : The sturture of field is not lying on single geo type ! it is not managed yet for structured mesh !");
if(st[0].getGeo()!=MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(getMeshDimension()))
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : The sturture of field is not lying on expected geo type !");
- if(getNumberOfNodes()!=(int)nodesFetched.size())
+ if(getNumberOfNodes()!=(mcIdType)nodesFetched.size())
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : invalid size of array !");
if(st[0].getPflName().empty())
{
std::fill(nodesFetched.begin(),nodesFetched.end(),true);
return ;
}
- const DataArrayInt *arr(globs->getProfile(st[0].getPflName()));
+ const DataArrayIdType *arr(globs->getProfile(st[0].getPflName()));
const MEDCouplingStructuredMesh *cmesh=getStructuredMesh();//cmesh not null because getNumberOfNodes called before
- int sz(nodesFetched.size());
- for(const int *work=arr->begin();work!=arr->end();work++)
+ mcIdType sz(ToIdType(nodesFetched.size()));
+ for(const mcIdType *work=arr->begin();work!=arr->end();work++)
{
- std::vector<int> conn;
+ std::vector<mcIdType> conn;
cmesh->getNodeIdsOfCell(*work,conn);
- for(std::vector<int>::const_iterator it=conn.begin();it!=conn.end();it++)
+ for(std::vector<mcIdType>::const_iterator it=conn.begin();it!=conn.end();it++)
if(*it>=0 && *it<sz)
nodesFetched[*it]=true;
else
}
void MEDFileStructuredMesh::LoadStrMeshDAFromFile(med_idt fid, int meshDim, int dt, int it, const std::string& mName, MEDFileMeshReadSelector *mrs,
- MCAuto<DataArrayInt>& famCells, MCAuto<DataArrayInt>& numCells, MCAuto<DataArrayAsciiChar>& namesCells)
+ MCAuto<DataArrayIdType>& famCells, MCAuto<DataArrayIdType>& numCells, MCAuto<DataArrayAsciiChar>& namesCells)
{
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
med_geometry_type geoTypeReq=MEDFileStructuredMesh::GetGeoTypeFromMeshDim(meshDim);
- int nbOfElt(0);
+ mcIdType nbOfElt(0);
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf);
if(nbOfElt>0)
{
if(!mrs || mrs->isCellFamilyFieldReading())
{
- famCells=DataArrayInt::New();
- famCells->alloc(nbOfElt,1);
- MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,famCells->getPointer()));
+ MCAuto<DataArrayMedInt> miFamCells=DataArrayMedInt::New();
+ miFamCells->alloc(nbOfElt,1);
+ MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,miFamCells->getPointer()));
+ famCells = FromMedIntArray<mcIdType>( miFamCells );
}
}
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NUMBER,MED_NODAL,&chgt,&trsf);
{
if(!mrs || mrs->isCellNumFieldReading())
{
- numCells=DataArrayInt::New();
- numCells->alloc(nbOfElt,1);
- MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,numCells->getPointer()));
+ MCAuto<DataArrayMedInt> miNumCells=DataArrayMedInt::New();
+ miNumCells->alloc(nbOfElt,1);
+ MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,miNumCells->getPointer()));
+ numCells = FromMedIntArray<mcIdType>( miNumCells );
}
}
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NAME,MED_NODAL,&chgt,&trsf);
setTimeUnit(strm->getTimeUnit());
MEDFileMeshL2::ReadFamiliesAndGrps(fid,mName,_families,_groups,mrs);
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
- int nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf));
+ mcIdType nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf));
if(nbOfElt>0)
{
if(!mrs || mrs->isNodeFamilyFieldReading())
{
- int nbNodes(getNumberOfNodes());
+ mcIdType nbNodes(getNumberOfNodes());
if(nbOfElt>nbNodes)
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::loadStrMeshFromFile : invalid size of family node array regarding number of nodes in this ! File seems to be corrupted !");
- _fam_nodes=DataArrayInt::New();
- _fam_nodes->alloc(nbNodes,1);//yes nbNodes and not nbOfElt see next line.
+ MCAuto<DataArrayMedInt> miFamNodes=DataArrayMedInt::New();
+ miFamNodes->alloc(nbNodes,1);//yes nbNodes and not nbOfElt see next line.
if(nbNodes>nbOfElt)//yes it appends some times... It explains surely the mdump implementation. Bug revealed by PARAVIS EDF #2475 on structured.med file where only 12 first nodes are !=0 so nbOfElt=12 and nbOfNodes=378...
- _fam_nodes->fillWithZero();
- MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_fam_nodes->getPointer()));
+ miFamNodes->fillWithZero();
+ MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,miFamNodes->getPointer()));
+ _fam_nodes = FromMedIntArray<mcIdType>( miFamNodes );
}
}
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_NUMBER,MED_NODAL,&chgt,&trsf);
{
if(!mrs || mrs->isNodeNumFieldReading())
{
- _num_nodes=DataArrayInt::New();
- _num_nodes->alloc(nbOfElt,1);
- MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_num_nodes->getPointer()));
+ MCAuto<DataArrayMedInt> miNumNodes=DataArrayMedInt::New();
+ miNumNodes->alloc(nbOfElt,1);
+ MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,miNumNodes->getPointer()));
+ _num_nodes = FromMedIntArray<mcIdType>( miNumNodes );
}
}
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_NAME,MED_NODAL,&chgt,&trsf);
int meshDim(getStructuredMesh()->getMeshDimension());
med_geometry_type geoTypeReq(GetGeoTypeFromMeshDim(meshDim)),geoTypeReq2(GetGeoTypeFromMeshDim(meshDim-1));
//
- if((const DataArrayInt *)_fam_cells)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_fam_cells->getNumberOfTuples(),_fam_cells->getConstPointer()));
- if((const DataArrayInt *)_fam_faces)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_fam_faces->getNumberOfTuples(),_fam_faces->getConstPointer()));
- if((const DataArrayInt *)_fam_nodes)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_fam_nodes->getNumberOfTuples(),_fam_nodes->getConstPointer()));
- if((const DataArrayInt *)_num_cells)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_num_cells->getNumberOfTuples(),_num_cells->getConstPointer()));
- if((const DataArrayInt *)_num_faces)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_num_faces->getNumberOfTuples(),_num_faces->getConstPointer()));
- if((const DataArrayInt *)_num_nodes)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_num_nodes->getNumberOfTuples(),_num_nodes->getConstPointer()));
+ if((const DataArrayIdType *)_fam_cells)
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,ToMedInt(_fam_cells->getNumberOfTuples()),ToMedIntArray(_fam_cells)->getConstPointer()));
+ if((const DataArrayIdType *)_fam_faces)
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,ToMedInt(_fam_faces->getNumberOfTuples()),ToMedIntArray(_fam_faces)->getConstPointer()));
+ if((const DataArrayIdType *)_fam_nodes)
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,ToMedInt(_fam_nodes->getNumberOfTuples()),ToMedIntArray(_fam_nodes)->getConstPointer()));
+ if((const DataArrayIdType *)_num_cells)
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,ToMedInt(_num_cells->getNumberOfTuples()),ToMedIntArray(_num_cells)->getConstPointer()));
+ if((const DataArrayIdType *)_num_faces)
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,ToMedInt(_num_faces->getNumberOfTuples()),ToMedIntArray(_num_faces)->getConstPointer()));
+ if((const DataArrayIdType *)_num_nodes)
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,ToMedInt(_num_nodes->getNumberOfTuples()),ToMedIntArray(_num_nodes)->getConstPointer()));
if((const DataArrayAsciiChar *)_names_cells)
{
if(_names_cells->getNumberOfComponents()!=MED_SNAME_SIZE)
oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_names_cells->getNumberOfTuples(),_names_cells->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,ToMedInt(_names_cells->getNumberOfTuples()),_names_cells->getConstPointer()));
}
if((const DataArrayAsciiChar *)_names_faces)
{
oss << " ! The array has " << _names_faces->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_names_faces->getNumberOfTuples(),_names_faces->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,ToMedInt(_names_faces->getNumberOfTuples()),_names_faces->getConstPointer()));
}
if((const DataArrayAsciiChar *)_names_nodes)
{
oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_names_nodes->getNumberOfTuples(),_names_nodes->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,ToMedInt(_names_nodes->getNumberOfTuples()),_names_nodes->getConstPointer()));
}
//
MEDFileUMeshL2::WriteFamiliesAndGrps(fid,maa.c_str(),_families,_groups,_too_long_str);
for(int i=0;i<spaceDim;i++)
{
const DataArrayDouble *da=_cmesh->getCoordsAt(i);
- MEDFILESAFECALLERWR0(MEDmeshGridIndexCoordinateWr,(fid,maa,_iteration,_order,_time,i+1,da->getNumberOfTuples(),da->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshGridIndexCoordinateWr,(fid,maa,_iteration,_order,_time,i+1,ToMedInt(da->getNumberOfTuples()),da->getConstPointer()));
}
//
std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
if(_univ_wr_status)
MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa));
MEDFILESAFECALLERWR0(MEDmeshGridTypeWr,(fid,maa,MED_CURVILINEAR_GRID));
- std::vector<int> nodeGridSt=_clmesh->getNodeGridStructure();
- MEDFILESAFECALLERWR0(MEDmeshGridStructWr,(fid,maa,_iteration,_order,_time,&nodeGridSt[0]));
+ std::vector<mcIdType> nodeGridSt=_clmesh->getNodeGridStructure();
+ MEDFILESAFECALLERWR0(MEDmeshGridStructWr,(fid,maa,_iteration,_order,_time,ToMedIntArray(nodeGridSt)->getConstPointer()));
- MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,ToMedInt(coords->getNumberOfTuples()),coords->begin()));
//
std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
MEDFileStructuredMesh::writeStructuredLL(fid,meshName);
int MEDFileMeshes::getNumberOfMeshes() const
{
- return _meshes.size();
+ return (int)_meshes.size();
}
MEDFileMeshesIterator *MEDFileMeshes::iterator()
MEDLOADER_EXPORT void setAxisType(MEDCouplingAxisType at) { _axis_type=at; }
MEDLOADER_EXPORT MEDCouplingAxisType getAxisType() const { return _axis_type; }
MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
- MEDLOADER_EXPORT virtual int getNumberOfNodes() const = 0;
- MEDLOADER_EXPORT virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const = 0;
+ MEDLOADER_EXPORT virtual mcIdType getNumberOfNodes() const = 0;
+ MEDLOADER_EXPORT virtual mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const = 0;
MEDLOADER_EXPORT virtual bool hasImplicitPart() const = 0;
- MEDLOADER_EXPORT virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const = 0;
+ MEDLOADER_EXPORT virtual mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const = 0;
MEDLOADER_EXPORT virtual void releaseImplicitPartIfAny() const = 0;
MEDLOADER_EXPORT virtual std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const = 0;
- MEDLOADER_EXPORT virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const = 0;
+ MEDLOADER_EXPORT virtual mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const = 0;
MEDLOADER_EXPORT virtual std::vector<int> getNonEmptyLevels() const = 0;
MEDLOADER_EXPORT virtual std::vector<int> getNonEmptyLevelsExt() const = 0;
MEDLOADER_EXPORT virtual std::vector<int> getFamArrNonEmptyLevelsExt() const = 0;
MEDLOADER_EXPORT virtual std::vector<int> getNumArrNonEmptyLevelsExt() const = 0;
MEDLOADER_EXPORT virtual std::vector<int> getNameArrNonEmptyLevelsExt() const = 0;
- MEDLOADER_EXPORT virtual int getSizeAtLevel(int meshDimRelToMaxExt) const = 0;
+ MEDLOADER_EXPORT virtual mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const = 0;
MEDLOADER_EXPORT virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const = 0;
- MEDLOADER_EXPORT virtual std::vector<int> getDistributionOfTypes(int meshDimRelToMax) const;
+ MEDLOADER_EXPORT virtual std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
MEDLOADER_EXPORT virtual void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const = 0;
MEDLOADER_EXPORT virtual MEDFileMesh *cartesianize() const = 0;
MEDLOADER_EXPORT virtual bool presenceOfStructureElements() const = 0;
MEDLOADER_EXPORT bool areFamsEqual(const MEDFileMesh *other, std::string& what) const;
MEDLOADER_EXPORT bool areGrpsEqual(const MEDFileMesh *other, std::string& what) const;
MEDLOADER_EXPORT bool existsGroup(const std::string& groupName) const;
- MEDLOADER_EXPORT bool existsFamily(int famId) const;
+ MEDLOADER_EXPORT bool existsFamily(mcIdType famId) const;
MEDLOADER_EXPORT bool existsFamily(const std::string& familyName) const;
- MEDLOADER_EXPORT void setFamilyId(const std::string& familyName, int id);
- MEDLOADER_EXPORT void setFamilyIdUnique(const std::string& familyName, int id);
- MEDLOADER_EXPORT virtual void addFamily(const std::string& familyName, int id);
+ MEDLOADER_EXPORT void setFamilyId(const std::string& familyName, mcIdType id);
+ MEDLOADER_EXPORT void setFamilyIdUnique(const std::string& familyName, mcIdType id);
+ MEDLOADER_EXPORT virtual void addFamily(const std::string& familyName, mcIdType id);
MEDLOADER_EXPORT virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
- MEDLOADER_EXPORT virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs);
+ MEDLOADER_EXPORT virtual bool keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& levs);
MEDLOADER_EXPORT void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
- MEDLOADER_EXPORT std::string findOrCreateAndGiveFamilyWithId(int id, bool& created);
- MEDLOADER_EXPORT void setFamilyInfo(const std::map<std::string,int>& info);
+ MEDLOADER_EXPORT std::string findOrCreateAndGiveFamilyWithId(mcIdType id, bool& created);
+ MEDLOADER_EXPORT void setFamilyInfo(const std::map<std::string,mcIdType>& info);
MEDLOADER_EXPORT void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
MEDLOADER_EXPORT void copyFamGrpMapsFrom(const MEDFileMesh& other);
MEDLOADER_EXPORT void clearGrpMap();
MEDLOADER_EXPORT void clearFamMap();
MEDLOADER_EXPORT void clearFamGrpMaps();
- MEDLOADER_EXPORT const std::map<std::string,int>& getFamilyInfo() const { return _families; }
+ MEDLOADER_EXPORT const std::map<std::string,mcIdType>& getFamilyInfo() const { return _families; }
MEDLOADER_EXPORT const std::map<std::string, std::vector<std::string> >& getGroupInfo() const { return _groups; }
MEDLOADER_EXPORT std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
MEDLOADER_EXPORT std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
- MEDLOADER_EXPORT std::vector<int> getFamiliesIdsOnGroup(const std::string& name) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamiliesIdsOnGroup(const std::string& name) const;
MEDLOADER_EXPORT void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
- MEDLOADER_EXPORT void setFamiliesIdsOnGroup(const std::string& name, const std::vector<int>& famIds);
+ MEDLOADER_EXPORT void setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds);
MEDLOADER_EXPORT std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
MEDLOADER_EXPORT void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
MEDLOADER_EXPORT std::vector<std::string> getGroupsNames() const;
MEDLOADER_EXPORT std::vector<std::string> getFamiliesNames() const;
MEDLOADER_EXPORT std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT std::vector<int> getGrpNonEmptyLevelsExt(const std::string& grp) const;
- MEDLOADER_EXPORT std::vector<int> getGrpNonEmptyLevels(const std::string& grp) const;
- MEDLOADER_EXPORT std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
- MEDLOADER_EXPORT std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
- MEDLOADER_EXPORT virtual std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const = 0;
- MEDLOADER_EXPORT virtual std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const = 0;
- MEDLOADER_EXPORT std::vector<int> getFamNonEmptyLevels(const std::string& fam) const;
- MEDLOADER_EXPORT std::vector<int> getFamNonEmptyLevelsExt(const std::string& fam) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getGrpNonEmptyLevelsExt(const std::string& grp) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getGrpNonEmptyLevels(const std::string& grp) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
+ MEDLOADER_EXPORT virtual std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const = 0;
+ MEDLOADER_EXPORT virtual std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const = 0;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamNonEmptyLevels(const std::string& fam) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamNonEmptyLevelsExt(const std::string& fam) const;
MEDLOADER_EXPORT std::vector<std::string> getFamiliesNamesWithFilePointOfView() const;
MEDLOADER_EXPORT static std::string GetMagicFamilyStr();
MEDLOADER_EXPORT void assignFamilyNameWithGroupName();
MEDLOADER_EXPORT void checkOrphanFamilyZero() const;
MEDLOADER_EXPORT void changeGroupName(const std::string& oldName, const std::string& newName);
MEDLOADER_EXPORT void changeFamilyName(const std::string& oldName, const std::string& newName);
- MEDLOADER_EXPORT void changeFamilyId(int oldId, int newId);
+ MEDLOADER_EXPORT void changeFamilyId(mcIdType oldId, mcIdType newId);
MEDLOADER_EXPORT void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
- MEDLOADER_EXPORT int getFamilyId(const std::string& name) const;
- MEDLOADER_EXPORT int getMaxAbsFamilyId() const;
- MEDLOADER_EXPORT int getMaxFamilyId() const;
- MEDLOADER_EXPORT int getMinFamilyId() const;
- MEDLOADER_EXPORT int getTheMaxAbsFamilyId() const;
- MEDLOADER_EXPORT int getTheMaxFamilyId() const;
- MEDLOADER_EXPORT int getTheMinFamilyId() const;
- MEDLOADER_EXPORT virtual int getMaxAbsFamilyIdInArrays() const = 0;
- MEDLOADER_EXPORT virtual int getMaxFamilyIdInArrays() const = 0;
- MEDLOADER_EXPORT virtual int getMinFamilyIdInArrays() const = 0;
- MEDLOADER_EXPORT DataArrayInt *getAllFamiliesIdsReferenced() const;
- MEDLOADER_EXPORT DataArrayInt *computeAllFamilyIdsInUse() const;
- MEDLOADER_EXPORT std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const;
- MEDLOADER_EXPORT std::string getFamilyNameGivenId(int id) const;
+ MEDLOADER_EXPORT mcIdType getFamilyId(const std::string& name) const;
+ MEDLOADER_EXPORT mcIdType getMaxAbsFamilyId() const;
+ MEDLOADER_EXPORT mcIdType getMaxFamilyId() const;
+ MEDLOADER_EXPORT mcIdType getMinFamilyId() const;
+ MEDLOADER_EXPORT mcIdType getTheMaxAbsFamilyId() const;
+ MEDLOADER_EXPORT mcIdType getTheMaxFamilyId() const;
+ MEDLOADER_EXPORT mcIdType getTheMinFamilyId() const;
+ MEDLOADER_EXPORT virtual mcIdType getMaxAbsFamilyIdInArrays() const = 0;
+ MEDLOADER_EXPORT virtual mcIdType getMaxFamilyIdInArrays() const = 0;
+ MEDLOADER_EXPORT virtual mcIdType getMinFamilyIdInArrays() const = 0;
+ MEDLOADER_EXPORT DataArrayIdType *getAllFamiliesIdsReferenced() const;
+ MEDLOADER_EXPORT DataArrayIdType *computeAllFamilyIdsInUse() const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamiliesIds(const std::vector<std::string>& famNames) const;
+ MEDLOADER_EXPORT std::string getFamilyNameGivenId(mcIdType id) const;
MEDLOADER_EXPORT bool ensureDifferentFamIdsPerLevel();
MEDLOADER_EXPORT void normalizeFamIdsTrio();
MEDLOADER_EXPORT void normalizeFamIdsMEDFile();
MEDLOADER_EXPORT virtual std::string simpleRepr() const;
MEDLOADER_EXPORT virtual std::string advancedRepr() const = 0;
//
- MEDLOADER_EXPORT virtual void setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector<const DataArrayInt *>& grps, bool renum=false);
- MEDLOADER_EXPORT virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) = 0;
- MEDLOADER_EXPORT virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) = 0;
+ MEDLOADER_EXPORT virtual void setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector<const DataArrayIdType *>& grps, bool renum=false);
+ MEDLOADER_EXPORT virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr) = 0;
+ MEDLOADER_EXPORT virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr) = 0;
MEDLOADER_EXPORT virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) = 0;
- MEDLOADER_EXPORT virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr) = 0;
- MEDLOADER_EXPORT virtual void addNodeGroup(const DataArrayInt *ids) = 0;
- MEDLOADER_EXPORT virtual void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) = 0;
- MEDLOADER_EXPORT virtual const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const = 0;
- MEDLOADER_EXPORT virtual DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) = 0;
- MEDLOADER_EXPORT DataArrayInt *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt);
- MEDLOADER_EXPORT virtual const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0;
- MEDLOADER_EXPORT virtual const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0;
+ MEDLOADER_EXPORT virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr) = 0;
+ MEDLOADER_EXPORT virtual void addNodeGroup(const DataArrayIdType *ids) = 0;
+ MEDLOADER_EXPORT virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids) = 0;
+ MEDLOADER_EXPORT virtual const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const = 0;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) = 0;
+ MEDLOADER_EXPORT DataArrayIdType *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt);
+ MEDLOADER_EXPORT virtual const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0;
+ MEDLOADER_EXPORT virtual const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0;
MEDLOADER_EXPORT virtual const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const = 0;
- MEDLOADER_EXPORT virtual MCAuto<DataArrayInt> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const = 0;
- MEDLOADER_EXPORT virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const = 0;
- MEDLOADER_EXPORT virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
- MEDLOADER_EXPORT virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
- MEDLOADER_EXPORT virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
- MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const;
- MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
- MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
- MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
+ MEDLOADER_EXPORT virtual MCAuto<DataArrayIdType> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const = 0;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const = 0;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
// tools
- MEDLOADER_EXPORT virtual bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell) = 0;
+ MEDLOADER_EXPORT virtual bool unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell) = 0;
MEDLOADER_EXPORT int getNumberOfJoints() const;
MEDLOADER_EXPORT MEDFileJoints *getJoints() const;
MEDLOADER_EXPORT void setJoints( MEDFileJoints* joints );
void dealWithTinyInfo(const MEDCouplingMesh *m);
virtual void synchronizeTinyInfoOnLeaves() const = 0;
void getFamilyRepr(std::ostream& oss) const;
- virtual void appendFamilyEntries(const DataArrayInt *famIds, const std::vector< std::vector<int> >& fidsOfGrps, const std::vector<std::string>& grpNames);
- virtual void changeFamilyIdArr(int oldId, int newId) = 0;
- virtual std::list< MCAuto<DataArrayInt> > getAllNonNullFamilyIds() const = 0;
+ virtual void appendFamilyEntries(const DataArrayIdType *famIds, const std::vector< std::vector<mcIdType> >& fidsOfGrps, const std::vector<std::string>& grpNames);
+ virtual void changeFamilyIdArr(mcIdType oldId, mcIdType newId) = 0;
+ virtual std::list< MCAuto<DataArrayIdType> > getAllNonNullFamilyIds() const = 0;
virtual void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) = 0;
void loadLLWithAdditionalItems(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
- void addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, DataArrayInt *famArr);
- static void TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector<int> >& famIdsPerGrp);
+ void addGroupUnderground(bool isNodeGroup, const DataArrayIdType *ids, DataArrayIdType *famArr);
+ static void TranslateFamilyIds(mcIdType offset, DataArrayIdType *famArr, std::vector< std::vector<mcIdType> >& famIdsPerGrp);
static void ChangeAllGroupsContainingFamily(std::map<std::string, std::vector<std::string> >& groups, const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
- static std::string FindOrCreateAndGiveFamilyWithId(std::map<std::string,int>& families, int id, bool& created);
+ static std::string FindOrCreateAndGiveFamilyWithId(std::map<std::string,mcIdType>& families, mcIdType id, bool& created);
static std::string CreateNameNotIn(const std::string& nameTry, const std::vector<std::string>& namesToAvoid);
- static int PutInThirdComponentOfCodeOffset(std::vector<int>& code, int strt);
+ static mcIdType PutInThirdComponentOfCodeOffset(std::vector<mcIdType>& code, mcIdType strt);
void writeJoints(med_idt fid) const;
void loadJointsFromFile(med_idt fid, MEDFileJoints *toUseInstedOfReading=0);
void loadEquivalences(med_idt fid);
bool areEquivalencesEqual(const MEDFileMesh *other, std::string& what) const;
void getEquivalencesRepr(std::ostream& oss) const;
void checkCartesian() const;
- void checkNoGroupClash(const DataArrayInt *famArr, const std::string& grpName) const;
+ void checkNoGroupClash(const DataArrayIdType *famArr, const std::string& grpName) const;
private:
virtual void writeMeshLL(med_idt fid) const = 0;
protected:
MCAuto<MEDFileEquivalences> _equiv;
protected:
std::map<std::string, std::vector<std::string> > _groups;
- std::map<std::string,int> _families;
+ std::map<std::string,mcIdType> _families;
public:
MEDLOADER_EXPORT static const char DFT_FAM_NAME[];
};
MEDLOADER_EXPORT static MEDFileUMesh *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileUMesh>(db); }
MEDLOADER_EXPORT static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
MEDLOADER_EXPORT static MEDFileUMesh *New();
- MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
- MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
MEDLOADER_EXPORT static const char *GetSpeStr4ExtMesh() { return SPE_FAM_STR_EXTRUDED_MESH; }
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT void setName(const std::string& name);
MEDLOADER_EXPORT const std::vector< MCAuto<MEDFileEltStruct4Mesh> >& getAccessOfUndergroundEltStrs() const { return _elt_str; }
//
- MEDLOADER_EXPORT int getMaxAbsFamilyIdInArrays() const;
- MEDLOADER_EXPORT int getMaxFamilyIdInArrays() const;
- MEDLOADER_EXPORT int getMinFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMaxAbsFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMaxFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMinFamilyIdInArrays() const;
MEDLOADER_EXPORT int getMeshDimension() const;
MEDLOADER_EXPORT int getSpaceDimension() const;
MEDLOADER_EXPORT std::string simpleRepr() const;
MEDLOADER_EXPORT std::string advancedRepr() const;
- MEDLOADER_EXPORT int getSizeAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt);
- MEDLOADER_EXPORT const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt);
+ MEDLOADER_EXPORT const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT MCAuto<DataArrayInt> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT MCAuto<DataArrayIdType> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const;
MEDLOADER_EXPORT const PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const;
- MEDLOADER_EXPORT int getNumberOfNodes() const;
- MEDLOADER_EXPORT int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfNodes() const;
+ MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
MEDLOADER_EXPORT bool hasImplicitPart() const;
- MEDLOADER_EXPORT int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
+ MEDLOADER_EXPORT mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
MEDLOADER_EXPORT void releaseImplicitPartIfAny() const;
MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const;
- MEDLOADER_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const;
MEDLOADER_EXPORT MEDFileMesh *cartesianize() const;
MEDLOADER_EXPORT bool presenceOfStructureElements() const;
MEDLOADER_EXPORT std::vector<int> getFamArrNonEmptyLevelsExt() const;
MEDLOADER_EXPORT std::vector<int> getNumArrNonEmptyLevelsExt() const;
MEDLOADER_EXPORT std::vector<int> getNameArrNonEmptyLevelsExt() const;
- MEDLOADER_EXPORT std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
- MEDLOADER_EXPORT std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
MEDLOADER_EXPORT DataArrayDouble *getCoords() const;
MEDLOADER_EXPORT MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
- MEDLOADER_EXPORT DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
+ MEDLOADER_EXPORT DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
- MEDLOADER_EXPORT std::vector<int> getDistributionOfTypes(int meshDimRelToMax) const;
- MEDLOADER_EXPORT std::vector< std::pair<int,int> > getAllDistributionOfTypes() const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
+ MEDLOADER_EXPORT std::vector< std::pair<int,mcIdType> > getAllDistributionOfTypes() const;
MEDLOADER_EXPORT MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
MEDLOADER_EXPORT void forceComputationOfParts() const;
MEDLOADER_EXPORT std::vector<MEDCoupling1GTUMesh *> getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const;
MEDLOADER_EXPORT MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const;
- MEDLOADER_EXPORT DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
- MEDLOADER_EXPORT DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ MEDLOADER_EXPORT DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ MEDLOADER_EXPORT DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
MEDLOADER_EXPORT int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
//
- MEDLOADER_EXPORT void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
+ MEDLOADER_EXPORT void setFamilyNameAttachedOnId(mcIdType id, const std::string& newFamName);
MEDLOADER_EXPORT void setCoords(DataArrayDouble *coords);
MEDLOADER_EXPORT void setCoordsForced(DataArrayDouble *coords);
MEDLOADER_EXPORT void eraseGroupsAtLevel(int meshDimRelToMaxExt);
- MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr);
- MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr);
+ MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
+ MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
- MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr);
- MEDLOADER_EXPORT void addNodeGroup(const DataArrayInt *ids);
- MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids);
+ MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
+ MEDLOADER_EXPORT void addNodeGroup(const DataArrayIdType *ids);
+ MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
MEDLOADER_EXPORT void removeMeshAtLevel(int meshDimRelToMax);
MEDLOADER_EXPORT void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
MEDLOADER_EXPORT void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
MEDLOADER_EXPORT void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum=false);
MEDLOADER_EXPORT void optimizeFamilies();
// tools
- MEDLOADER_EXPORT void buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified);
- MEDLOADER_EXPORT bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell);
- MEDLOADER_EXPORT DataArrayInt *zipCoords();
- MEDLOADER_EXPORT DataArrayInt *deduceNodeSubPartFromCellSubPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef) const;
- MEDLOADER_EXPORT MEDFileUMesh *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef) const;
+ MEDLOADER_EXPORT void buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayIdType *&nodesDuplicated, DataArrayIdType *&cellsModified, DataArrayIdType *&cellsNotModified);
+ MEDLOADER_EXPORT bool unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell);
+ MEDLOADER_EXPORT DataArrayIdType *zipCoords();
+ MEDLOADER_EXPORT DataArrayIdType *deduceNodeSubPartFromCellSubPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef) const;
+ MEDLOADER_EXPORT MEDFileUMesh *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef) const;
MEDLOADER_EXPORT MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
MEDLOADER_EXPORT MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
MEDLOADER_EXPORT MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
MEDLOADER_EXPORT static MCAuto<MEDFileUMesh> Aggregate(const std::vector<const MEDFileUMesh *>& meshes);
MEDLOADER_EXPORT MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
// serialization
- MEDLOADER_EXPORT void serialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr,
- std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD);
- MEDLOADER_EXPORT void unserialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr,
- std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD);
+ MEDLOADER_EXPORT void serialize(std::vector<double>& tinyDouble, std::vector<mcIdType>& tinyInt, std::vector<std::string>& tinyStr,
+ std::vector< MCAuto<DataArrayIdType> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD);
+ MEDLOADER_EXPORT void unserialize(std::vector<double>& tinyDouble, std::vector<mcIdType>& tinyInt, std::vector<std::string>& tinyStr,
+ std::vector< MCAuto<DataArrayIdType> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD);
private:
MEDLOADER_EXPORT ~MEDFileUMesh();
void writeMeshLL(med_idt fid) const;
MEDFileUMesh();
MEDFileUMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
- void loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ void loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
void dispatchLoadedPart(med_idt fid, const MEDFileUMeshL2& loaderl2, const std::string& mName, MEDFileMeshReadSelector *mrs);
const MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt) const;
DataArrayDouble *checkMultiMesh(const std::vector<const MEDCouplingUMesh *>& ms) const;
void computeRevNum() const;
void synchronizeTinyInfoOnLeaves() const;
- void changeFamilyIdArr(int oldId, int newId);
- std::list< MCAuto<DataArrayInt> > getAllNonNullFamilyIds() const;
+ void changeFamilyIdArr(mcIdType oldId, mcIdType newId);
+ std::list< MCAuto<DataArrayIdType> > getAllNonNullFamilyIds() const;
MCAuto<MEDFileUMeshSplitL1>& checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m);
private:
static const char SPE_FAM_STR_EXTRUDED_MESH[];
private:
std::vector< MCAuto<MEDFileUMeshSplitL1> > _ms;
MCAuto<DataArrayDouble> _coords;
- MCAuto<DataArrayInt> _fam_coords; ///< Node family indices
- MCAuto<DataArrayInt> _num_coords;
- MCAuto<DataArrayInt> _global_num_coords;
+ MCAuto<DataArrayIdType> _fam_coords; ///< Node family indices
+ MCAuto<DataArrayIdType> _num_coords;
+ MCAuto<DataArrayIdType> _global_num_coords;
MCAuto<DataArrayAsciiChar> _name_coords;
- mutable MCAuto<DataArrayInt> _rev_num_coords;
+ mutable MCAuto<DataArrayIdType> _rev_num_coords;
MCAuto<PartDefinition> _part_coords;
std::vector< MCAuto<MEDFileEltStruct4Mesh> > _elt_str;
};
public:
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
- MEDLOADER_EXPORT int getMaxAbsFamilyIdInArrays() const;
- MEDLOADER_EXPORT int getMaxFamilyIdInArrays() const;
- MEDLOADER_EXPORT int getMinFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMaxAbsFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMaxFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMinFamilyIdInArrays() const;
MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
MEDLOADER_EXPORT void clearNonDiscrAttributes() const;
- MEDLOADER_EXPORT DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
- MEDLOADER_EXPORT const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt);
- MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr);
- MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr);
+ MEDLOADER_EXPORT DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
+ MEDLOADER_EXPORT const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt);
+ MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
+ MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
- MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr);
- MEDLOADER_EXPORT void addNodeGroup(const DataArrayInt *ids);
- MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids);
- MEDLOADER_EXPORT const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
+ MEDLOADER_EXPORT void addNodeGroup(const DataArrayIdType *ids);
+ MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
+ MEDLOADER_EXPORT const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT MCAuto<DataArrayInt> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT MCAuto<DataArrayIdType> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const;
MEDLOADER_EXPORT std::vector<int> getNonEmptyLevels() const;
MEDLOADER_EXPORT std::vector<int> getNonEmptyLevelsExt() const;
MEDLOADER_EXPORT std::vector<int> getFamArrNonEmptyLevelsExt() const;
MEDLOADER_EXPORT std::vector<int> getNumArrNonEmptyLevelsExt() const;
MEDLOADER_EXPORT std::vector<int> getNameArrNonEmptyLevelsExt() const;
MEDLOADER_EXPORT MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
- MEDLOADER_EXPORT std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
- MEDLOADER_EXPORT std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
- MEDLOADER_EXPORT int getSizeAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT int getNumberOfNodes() const;
- MEDLOADER_EXPORT int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
+ MEDLOADER_EXPORT mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfNodes() const;
+ MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
MEDLOADER_EXPORT bool hasImplicitPart() const;
- MEDLOADER_EXPORT int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
+ MEDLOADER_EXPORT mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
MEDLOADER_EXPORT void releaseImplicitPartIfAny() const;
MEDLOADER_EXPORT MEDCoupling1SGTUMesh *getImplicitFaceMesh() const;
MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const;
- MEDLOADER_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const;
MEDLOADER_EXPORT bool presenceOfStructureElements() const { return false; }
MEDLOADER_EXPORT virtual const MEDCouplingStructuredMesh *getStructuredMesh() const = 0;
// tools
- MEDLOADER_EXPORT bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell);
+ MEDLOADER_EXPORT bool unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell);
protected:
~MEDFileStructuredMesh() { }
- void changeFamilyIdArr(int oldId, int newId);
- std::list< MCAuto<DataArrayInt> > getAllNonNullFamilyIds() const;
+ void changeFamilyIdArr(mcIdType oldId, mcIdType newId);
+ std::list< MCAuto<DataArrayIdType> > getAllNonNullFamilyIds() const;
void deepCpyAttributes();
void loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
void writeStructuredLL(med_idt fid, const std::string& maa) const;
static med_geometry_type GetGeoTypeFromMeshDim(int meshDim);
private:
static void LoadStrMeshDAFromFile(med_idt fid, int meshDim, int dt, int it, const std::string& mName, MEDFileMeshReadSelector *mrs,
- MCAuto<DataArrayInt>& famCells, MCAuto<DataArrayInt>& numCells, MCAuto<DataArrayAsciiChar>& namesCells);
+ MCAuto<DataArrayIdType>& famCells, MCAuto<DataArrayIdType>& numCells, MCAuto<DataArrayAsciiChar>& namesCells);
private:
- MCAuto<DataArrayInt> _fam_nodes;
- MCAuto<DataArrayInt> _num_nodes;
+ MCAuto<DataArrayIdType> _fam_nodes;
+ MCAuto<DataArrayIdType> _num_nodes;
MCAuto<DataArrayAsciiChar> _names_nodes;
- MCAuto<DataArrayInt> _fam_cells;
- MCAuto<DataArrayInt> _num_cells;
+ MCAuto<DataArrayIdType> _fam_cells;
+ MCAuto<DataArrayIdType> _num_cells;
MCAuto<DataArrayAsciiChar> _names_cells;
- MCAuto<DataArrayInt> _fam_faces;
- MCAuto<DataArrayInt> _num_faces;
+ MCAuto<DataArrayIdType> _fam_faces;
+ MCAuto<DataArrayIdType> _num_faces;
MCAuto<DataArrayAsciiChar> _names_faces;
- mutable MCAuto<DataArrayInt> _rev_num_nodes;
- mutable MCAuto<DataArrayInt> _rev_num_cells;
+ mutable MCAuto<DataArrayIdType> _rev_num_nodes;
+ mutable MCAuto<DataArrayIdType> _rev_num_cells;
mutable MCAuto<MEDCoupling1SGTUMesh> _faces_if_necessary;
};
#include "MEDFileMeshElt.hxx"
#include "MEDFileSafeCaller.txx"
#include "MEDFileMeshReadSelector.hxx"
+#include "MEDFileBasis.hxx"
#include "MEDCouplingUMesh.hxx"
return new MEDFileUMeshPerTypeCommon;
}
-void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, int dt, int it, int curNbOfElem, med_geometry_type geoElt,
+void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, int dt, int it, mcIdType curNbOfElem, med_geometry_type geoElt,
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
{
if(!mrs || mrs->isCellFamilyFieldReading())
{
- _fam=DataArrayInt::New();
- _fam->alloc(curNbOfElem,1);
- if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,geoElt,_fam->getPointer())!=0)
- std::fill(_fam->getPointer(),_fam->getPointer()+curNbOfElem,0);
+ MCAuto<DataArrayMedInt> miFam=DataArrayMedInt::New();
+ miFam->alloc(curNbOfElem,1);
+ if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,geoElt,miFam->getPointer())!=0)
+ std::fill(miFam->getPointer(),miFam->getPointer()+curNbOfElem,0);
+ _fam=FromMedIntArray<mcIdType>( miFam );
}
}
_num=0;
{
if(!mrs || mrs->isCellNumFieldReading())
{
- _num=DataArrayInt::New();
- _num->alloc(curNbOfElem,1);
- if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,geoElt,_num->getPointer())!=0)
- _num=0;
+ MCAuto<DataArrayMedInt> miNum=DataArrayMedInt::New();
+ miNum->alloc(curNbOfElem,1);
+ if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,geoElt,miNum->getPointer())!=0)
+ miNum=0;
+ _num=FromMedIntArray<mcIdType>(miNum);
}
}
_names=0;
std::vector<const BigMemoryObject *> MEDFileUMeshPerTypeCommon::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- ret.push_back((const DataArrayInt *)_num);
- ret.push_back((const DataArrayInt *)_fam);
+ ret.push_back((const DataArrayIdType *)_num);
+ ret.push_back((const DataArrayIdType *)_fam);
ret.push_back((const DataArrayAsciiChar *)_names);
return ret;
}
return new MEDFileUMeshPerType(fid,mName,dt,it,mdim,geoElt,geoElt2,whichEntity,mrs);
}
-MEDFileUMeshPerType *MEDFileUMeshPerType::NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, int strt, int stp, int step, MEDFileMeshReadSelector *mrs)
+MEDFileUMeshPerType *MEDFileUMeshPerType::NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, mcIdType strt, mcIdType stp, mcIdType step, MEDFileMeshReadSelector *mrs)
{
int geoElt2i((int)geoElt2);
if(geoElt2i<0 || geoElt2i>=34)
bool MEDFileUMeshPerType::isExisting(med_idt fid, const char *mName, int dt, int it, med_geometry_type geoElt, med_entity_type& whichEntity)
{
static const med_entity_type entities[3]={MED_CELL,MED_DESCENDING_FACE,MED_DESCENDING_EDGE};
- int nbOfElt=0;
+ mcIdType nbOfElt=0;
for(int i=0;i<3;i++)
{
med_bool changement,transformation;
- int tmp(MEDmeshnEntity(fid,mName,dt,it,entities[i],geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ mcIdType tmp(MEDmeshnEntity(fid,mName,dt,it,entities[i],geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
if(tmp>nbOfElt)
{
nbOfElt=tmp;
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
if(!cm.isDynamic())
{
}
void MEDFileUMeshPerType::loadPart(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
- med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs)
+ med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
_pd=PartDefinition::New(strt,end,step);
if(!cm.isDynamic())
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPart : not implemented yet for the dynamic type !");
}
-void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
+void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
_m=MEDCoupling1SGTUMesh::New(mName,type);
MEDCoupling1SGTUMesh *mc(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *)_m));
- MCAuto<DataArrayInt> conn(DataArrayInt::New());
- int nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
+ MCAuto<DataArrayMedInt> conn(DataArrayMedInt::New());
+ mcIdType nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
conn->alloc(nbOfNodesPerCell*curNbOfElem,1);
MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,MED_FULL_INTERLACE,conn->getPointer()));
- std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<int>(),-1));
- mc->setNodalConnectivity(conn);
+ std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<med_int>(),-1));
+ mc->setNodalConnectivity(FromMedIntArray<mcIdType>(conn));
loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs);
}
-void MEDFileUMeshPerType::loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
- med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs)
+void MEDFileUMeshPerType::loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
+ med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs)
{
if(strt<0)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPartStaticType : start pos is negative !");
if(end>curNbOfElem)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPartStaticType : end is after the authorized range !");
- int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,end,step,"MEDFileUMeshPerType::loadPartStaticType"));
+ mcIdType nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,end,step,"MEDFileUMeshPerType::loadPartStaticType"));
_m=MEDCoupling1SGTUMesh::New(mName,type);
MEDCoupling1SGTUMesh *mc(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *)_m));
- MCAuto<DataArrayInt> conn(DataArrayInt::New());
- int nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
+ MCAuto<DataArrayMedInt> conn(DataArrayMedInt::New());
+ mcIdType nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
conn->alloc(nbOfNodesPerCell*nbOfEltsToLoad,1);
med_filter filter=MED_FILTER_INIT;
- MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/nbOfNodesPerCell,
+ MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/ToMedInt(nbOfNodesPerCell),
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
- /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad,
+ /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad),
/*lastblocksize=useless because count=1*/0,&filter);
MEDFILESAFECALLERRD0(MEDmeshElementConnectivityAdvancedRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,&filter,conn->getPointer()));
MEDfilterClose(&filter);
- std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<int>(),-1));
- mc->setNodalConnectivity(conn);
+ std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<med_int>(),-1));
+ mc->setNodalConnectivity(FromMedIntArray<mcIdType>(conn));
loadPartOfCellCommonPart(fid,mName,strt,end,step,dt,it,mdim,curNbOfElem,geoElt,entity,mrs);
}
-void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mName, int strt, int stp, int step, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs)
+void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mName, mcIdType strt, mcIdType stp, mcIdType step, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
_fam=0;
- int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,stp,step,"MEDFileUMeshPerType::loadPartOfCellCommonPart"));
+ mcIdType nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,stp,step,"MEDFileUMeshPerType::loadPartOfCellCommonPart"));
if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
if(!mrs || mrs->isCellFamilyFieldReading())
{
- _fam=DataArrayInt::New();
- _fam->alloc(nbOfEltsToLoad,1);
+ MCAuto<DataArrayMedInt> miFam(DataArrayMedInt::New());
+ miFam->alloc(nbOfEltsToLoad,1);
med_filter filter=MED_FILTER_INIT;
- MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1,
+ MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/1,
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
- /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad,
+ /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad),
/*lastblocksize=useless because count=1*/0,&filter);
- if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_FAMILY_NUMBER,dt,it,entity,geoElt,&filter,_fam->getPointer())!=0)
- _fam->fillWithZero();
+ if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_FAMILY_NUMBER,dt,it,entity,geoElt,&filter,miFam->getPointer())!=0)
+ miFam->fillWithZero();
+ _fam=FromMedIntArray<mcIdType>(miFam);
MEDfilterClose(&filter);
}
}
{
if(!mrs || mrs->isCellNumFieldReading())
{
- _num=DataArrayInt::New();
- _num->alloc(nbOfEltsToLoad,1);
+ MCAuto<DataArrayMedInt> miNum(DataArrayMedInt::New());
+ miNum->alloc(nbOfEltsToLoad,1);
med_filter filter=MED_FILTER_INIT;
- MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1,
+ MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/1,
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
- /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad,
+ /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad),
/*lastblocksize=useless because count=1*/0,&filter);
- if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_NUMBER,dt,it,entity,geoElt,&filter,_num->getPointer())!=0)
- _num->fillWithZero();
+ if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_NUMBER,dt,it,entity,geoElt,&filter,miNum->getPointer())!=0)
+ miNum->fillWithZero();
+ _num=FromMedIntArray<mcIdType>(miNum);
MEDfilterClose(&filter);
}
}
_names=DataArrayAsciiChar::New();
_names->alloc(nbOfEltsToLoad+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
med_filter filter=MED_FILTER_INIT;
- MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1,
+ MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/1,
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
- /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad,
+ /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad),
/*lastblocksize=useless because count=1*/0,&filter);
if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_NAME,dt,it,entity,geoElt,&filter,_names->getPointer())!=0)
_names=0;
}
}
-void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, int arraySize, med_geometry_type geoElt,
+void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType arraySize, med_geometry_type geoElt,
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- med_int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1);
+ mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1);
_m=MEDCoupling1DGTUMesh::New(mName,geoElt==MED_POLYGON?INTERP_KERNEL::NORM_POLYGON:INTERP_KERNEL::NORM_QPOLYG);
MCAuto<MEDCoupling1DGTUMesh> mc(DynamicCast<MEDCoupling1GTUMesh,MEDCoupling1DGTUMesh>(_m));
- MCAuto<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
+ MCAuto<DataArrayMedInt> conn(DataArrayMedInt::New()),connI(DataArrayMedInt::New());
conn->alloc(arraySize,1); connI->alloc(curNbOfElem+1,1);
MEDFILESAFECALLERRD0(MEDmeshPolygon2Rd,(fid,mName,dt,it,MED_CELL,geoElt,MED_NODAL,connI->getPointer(),conn->getPointer()));
- std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<int>(),-1));
- std::transform(connI->begin(),connI->end(),connI->getPointer(),std::bind2nd(std::plus<int>(),-1));
- mc->setNodalConnectivity(conn,connI);
+ std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<med_int>(),-1));
+ std::transform(connI->begin(),connI->end(),connI->getPointer(),std::bind2nd(std::plus<med_int>(),-1));
+ mc->setNodalConnectivity(FromMedIntArray<mcIdType>(conn),FromMedIntArray<mcIdType>(connI));
loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs);
}
-void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, int connFaceLgth, med_geometry_type geoElt,
+void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType connFaceLgth, med_geometry_type geoElt,
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
med_int indexFaceLgth(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation));
- int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1);
+ mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1);
_m=MEDCoupling1DGTUMesh::New(mName,INTERP_KERNEL::NORM_POLYHED);
MCAuto<MEDCoupling1DGTUMesh> mc(DynamicCastSafe<MEDCoupling1GTUMesh,MEDCoupling1DGTUMesh>(_m));
- INTERP_KERNEL::AutoPtr<int> index=new int[curNbOfElem+1];
- INTERP_KERNEL::AutoPtr<int> indexFace=new int[indexFaceLgth];
- INTERP_KERNEL::AutoPtr<int> locConn=new int[connFaceLgth];
+ INTERP_KERNEL::AutoPtr<med_int> index=new med_int[curNbOfElem+1];
+ INTERP_KERNEL::AutoPtr<med_int> indexFace=new med_int[indexFaceLgth];
+ INTERP_KERNEL::AutoPtr<med_int> locConn=new med_int[connFaceLgth];
MEDFILESAFECALLERRD0(MEDmeshPolyhedronRd,(fid,mName,dt,it,MED_CELL,MED_NODAL,index,indexFace,locConn));
- MCAuto<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
- int arraySize=connFaceLgth;
- for(int i=0;i<curNbOfElem;i++)
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New()),connI(DataArrayIdType::New());
+ mcIdType arraySize=connFaceLgth;
+ for(mcIdType i=0;i<curNbOfElem;i++)
arraySize+=index[i+1]-index[i]-1;
- conn=DataArrayInt::New();
+ conn=DataArrayIdType::New();
conn->alloc(arraySize,1);
- int *wFinalConn=conn->getPointer();
+ mcIdType *wFinalConn=conn->getPointer();
connI->alloc(curNbOfElem+1,1);
- int *finalIndex(connI->getPointer());
+ mcIdType *finalIndex(connI->getPointer());
finalIndex[0]=0;
- for(int i=0;i<curNbOfElem;i++)
+ for(mcIdType i=0;i<curNbOfElem;i++)
{
finalIndex[i+1]=finalIndex[i]+index[i+1]-index[i]-1+indexFace[index[i+1]-1]-indexFace[index[i]-1];
- wFinalConn=std::transform(locConn+indexFace[index[i]-1]-1,locConn+indexFace[index[i]]-1,wFinalConn,std::bind2nd(std::plus<int>(),-1));
- for(int j=index[i];j<index[i+1]-1;j++)
+ wFinalConn=std::transform(locConn+indexFace[index[i]-1]-1,locConn+indexFace[index[i]]-1,wFinalConn,std::bind2nd(std::plus<mcIdType>(),-1));
+ for(mcIdType j=index[i];j<index[i+1]-1;j++)
{
*wFinalConn++=-1;
- wFinalConn=std::transform(locConn+indexFace[j]-1,locConn+indexFace[j+1]-1,wFinalConn,std::bind2nd(std::plus<int>(),-1));
+ wFinalConn=std::transform(locConn+indexFace[j]-1,locConn+indexFace[j+1]-1,wFinalConn,std::bind2nd(std::plus<mcIdType>(),-1));
}
}
mc->setNodalConnectivity(conn,connI);
loadCommonPart(fid,mName,dt,it,curNbOfElem,MED_POLYHEDRON,entity,mrs);
}
-void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names)
+void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayIdType *fam, const DataArrayIdType *num, const DataArrayAsciiChar *names)
{
- int nbOfCells=m->getNumberOfCells();
+ mcIdType nbOfCells=m->getNumberOfCells();
if(nbOfCells<1)
return ;
int dt,it;
const MEDCoupling1SGTUMesh *m0(dynamic_cast<const MEDCoupling1SGTUMesh *>(m));
if(!m0)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #1 !");
- MCAuto<DataArrayInt> arr(m0->getNodalConnectivity()->deepCopy());
- std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),1));
- MEDFILESAFECALLERWR0(MEDmeshElementConnectivityWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,nbOfCells,arr->begin()));
+ MCAuto<DataArrayMedInt> arr(DataArrayMedInt::Copy(m0->getNodalConnectivity()));
+ std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<med_int>(),1));
+ MEDFILESAFECALLERWR0(MEDmeshElementConnectivityWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,ToMedInt(nbOfCells),arr->begin()));
}
else
{
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #2 !");
if(ikt==INTERP_KERNEL::NORM_POLYGON || ikt==INTERP_KERNEL::NORM_QPOLYG)
{
- MCAuto<DataArrayInt> arr(m0->getNodalConnectivity()->deepCopy()),arrI(m0->getNodalConnectivityIndex()->deepCopy());
- std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),1));
- std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus<int>(),1));
- MEDFILESAFECALLERWR0(MEDmeshPolygon2Wr,(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,nbOfCells+1,arrI->begin(),arr->begin()));
+ MCAuto<DataArrayMedInt> arr(DataArrayMedInt::Copy(m0->getNodalConnectivity())),arrI(DataArrayMedInt::Copy(m0->getNodalConnectivityIndex()));
+ std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<med_int>(),1));
+ std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus<med_int>(),1));
+ MEDFILESAFECALLERWR0(MEDmeshPolygon2Wr,(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,ToMedInt(nbOfCells+1),arrI->begin(),arr->begin()));
}
else
{
- const int *conn(m0->getNodalConnectivity()->begin()),*connI(m0->getNodalConnectivityIndex()->begin());
- int meshLgth=m0->getNodalConnectivityLength();
- int nbOfFaces=std::count(conn,conn+meshLgth,-1)+nbOfCells;
- INTERP_KERNEL::AutoPtr<int> tab1=new int[nbOfCells+1];
- int *w1=tab1; *w1=1;
- INTERP_KERNEL::AutoPtr<int> tab2=new int[nbOfFaces+1];
- int *w2=tab2; *w2=1;
- INTERP_KERNEL::AutoPtr<int> bigtab=new int[meshLgth];
- int *bt=bigtab;
- for(int i=0;i<nbOfCells;i++,w1++)
+ const mcIdType *conn(m0->getNodalConnectivity()->begin()),*connI(m0->getNodalConnectivityIndex()->begin());
+ mcIdType meshLgth=m0->getNodalConnectivityLength();
+ mcIdType nbOfFaces=ToIdType(std::count(conn,conn+meshLgth,-1)+nbOfCells);
+ INTERP_KERNEL::AutoPtr<med_int> tab1=new med_int[nbOfCells+1];
+ med_int *w1=tab1; *w1=1;
+ INTERP_KERNEL::AutoPtr<med_int> tab2=new med_int[nbOfFaces+1];
+ med_int *w2=tab2; *w2=1;
+ INTERP_KERNEL::AutoPtr<med_int> bigtab=new med_int[meshLgth];
+ med_int *bt=bigtab;
+ for(mcIdType i=0;i<nbOfCells;i++,w1++)
{
int nbOfFaces2=0;
- for(const int *w=conn+connI[i];w!=conn+connI[i+1];w2++)
+ for(const mcIdType *w=conn+connI[i];w!=conn+connI[i+1];w2++)
{
- const int *wend=std::find(w,conn+connI[i+1],-1);
- bt=std::transform(w,wend,bt,std::bind2nd(std::plus<int>(),1));
- int nbOfNode=std::distance(w,wend);
- w2[1]=w2[0]+nbOfNode;
+ const mcIdType *wend=std::find(w,conn+connI[i+1],-1);
+ bt=std::transform(w,wend,bt,std::bind2nd(std::plus<mcIdType>(),1));
+ std::size_t nbOfNode=std::distance(w,wend);
+ w2[1]=w2[0]+(med_int)nbOfNode;
if(wend!=conn+connI[i+1])
w=wend+1;
else
}
w1[1]=w1[0]+nbOfFaces2;
}
- MEDFILESAFECALLERWR0(MEDmeshPolyhedronWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,MED_NODAL,nbOfCells+1,tab1,nbOfFaces+1,tab2,bigtab));
+ MEDFILESAFECALLERWR0(MEDmeshPolyhedronWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,MED_NODAL,ToMedInt(nbOfCells+1),tab1,ToMedInt(nbOfFaces+1),tab2,bigtab));
}
}
if(fam)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,fam->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,ToMedInt(nbOfCells),ToMedIntArray<mcIdType>(fam)->getConstPointer()));
if(num)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,num->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,ToMedInt(nbOfCells),ToMedIntArray<mcIdType>(num)->getConstPointer()));
if(names)
{
if(names->getNumberOfComponents()!=MED_SNAME_SIZE)
oss << " ! The array has " << names->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,names->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,ToMedInt(nbOfCells),names->getConstPointer()));
}
}
{
public:
static MEDFileUMeshPerTypeCommon *New();
- void loadCommonPart(med_idt fid, const char *mName, int dt, int it, int curNbOfElem, med_geometry_type geoElt,
+ void loadCommonPart(med_idt fid, const char *mName, int dt, int it, mcIdType curNbOfElem, med_geometry_type geoElt,
med_entity_type entity, MEDFileMeshReadSelector *mrs);
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
- const DataArrayInt *getFam() const { return _fam; }
- const DataArrayInt *getNum() const { return _num; }
+ const DataArrayIdType *getFam() const { return _fam; }
+ const DataArrayIdType *getNum() const { return _num; }
const DataArrayAsciiChar *getNames() const { return _names; }
protected:
- MCAuto<DataArrayInt> _num;
- MCAuto<DataArrayInt> _fam;
+ MCAuto<DataArrayIdType> _num;
+ MCAuto<DataArrayIdType> _fam;
MCAuto<DataArrayAsciiChar> _names;
};
{
public:
static MEDFileUMeshPerType *New(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType geoElt2, MEDFileMeshReadSelector *mrs);
- static MEDFileUMeshPerType *NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, int strt, int stp, int step, MEDFileMeshReadSelector *mrs);
+ static MEDFileUMeshPerType *NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, mcIdType strt, mcIdType stp, mcIdType step, MEDFileMeshReadSelector *mrs);
static bool isExisting(med_idt fid, const char *mName, int dt, int it, med_geometry_type geoElt, med_entity_type& whichEntity);
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
int getDim() const;
MEDCoupling1GTUMesh *getMesh() const { return const_cast<MEDCoupling1GTUMesh *>((const MEDCoupling1GTUMesh *)_m); }
const PartDefinition *getPartDef() const { return _pd; }
- static void Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names);
+ static void Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayIdType *fam, const DataArrayIdType *num, const DataArrayAsciiChar *names);
private:
MEDFileUMeshPerType();
MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
med_entity_type entity, MEDFileMeshReadSelector *mrs);
void loadPart(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
- med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs);
- void loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
+ med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs);
+ void loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
med_entity_type entity, MEDFileMeshReadSelector *mrs);
- void loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
- med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs);
- void loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, int arraySize, med_geometry_type geoElt,
+ void loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
+ med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs);
+ void loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType arraySize, med_geometry_type geoElt,
med_entity_type entity, MEDFileMeshReadSelector *mrs);
- void loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, int connFaceLgth, med_geometry_type geoElt,
+ void loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType connFaceLgth, med_geometry_type geoElt,
med_entity_type entity, MEDFileMeshReadSelector *mrs);
- void loadPartOfCellCommonPart(med_idt fid, const char *mName, int strt, int stp, int step, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs);
+ void loadPartOfCellCommonPart(med_idt fid, const char *mName, mcIdType strt, mcIdType stp, mcIdType step, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs);
private:
MCAuto<MEDCoupling1GTUMesh> _m;
MCAuto<PartDefinition> _pd;
std::vector<std::string> MeshCls::getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const
{
med_mesh_type type_maillage;
- med_int spaceDim;
+ med_int spaceDim, meshDim, nbSteps;
med_sorting_type stype;
med_axis_type axistype;
- int naxis(MEDmeshnAxis(fid,getID()));
+ med_int naxis(MEDmeshnAxis(fid,getID()));
INTERP_KERNEL::AutoPtr<char> nameTmp(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> axisname(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE));
INTERP_KERNEL::AutoPtr<char> axisunit(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE));
INTERP_KERNEL::AutoPtr<char> univTmp(MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE));
- if(MEDmeshInfo(fid,getID(),nameTmp,&spaceDim,&Mdim,&type_maillage,description.getPointer(),dtunit.getPointer(),
- &stype,&nstep,&axistype,axisname,axisunit)!=0)
+ if(MEDmeshInfo(fid,getID(),nameTmp,&spaceDim,&meshDim,&type_maillage,description.getPointer(),dtunit.getPointer(),
+ &stype,&nbSteps,&axistype,axisname,axisunit)!=0)
throw INTERP_KERNEL::Exception("A problem has been detected when trying to get info on mesh !");
+ Mdim=FromMedInt<int>(meshDim);
+ nstep=FromMedInt<int>(nbSteps);
MEDmeshUniversalNameRd(fid,nameTmp,univName.getPointer());// do not protect MEDFILESAFECALLERRD0 call : Thanks to fra.med.
axType=MEDFileMeshL2::TraduceAxisType(axistype);
switch(type_maillage)
INTERP_KERNEL::AutoPtr<char> msn(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> zeDescription(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
med_axis_type medAxType;
- int nAxis(MEDsupportMeshnAxis(fid,getID()));
+ med_int nAxis(MEDsupportMeshnAxis(fid,getID()));
INTERP_KERNEL::AutoPtr<char> axisName(new char[MED_SNAME_SIZE*nAxis+1]),axisUnit(new char[MED_SNAME_SIZE*nAxis+1]);
- int spaceDim(0),meshDim(0);
+ med_int spaceDim(0),meshDim(0);
MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,getID(),msn,&spaceDim,&meshDim,zeDescription,&medAxType,axisName,axisUnit));
std::string descriptionCpp(MEDLoaderBase::buildStringFromFortran(zeDescription,MED_COMMENT_SIZE));
description.set(descriptionCpp.c_str());
int ret=-1;
med_sorting_type stype;
std::vector<std::string> ms;
- int nstep;
+ med_int nstep;
med_axis_type axistype;
for(int i=0;i<n && found==0;i++)
{
- int naxis(MEDmeshnAxis(fid,i+1));
+ med_int naxis(MEDmeshnAxis(fid,i+1));
INTERP_KERNEL::AutoPtr<char> axisname(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)),axisunit(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE));
MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,i+1,nommaa,&spaceDim,&dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit));
dtunit1=MEDLoaderBase::buildStringFromFortran(dtunit,sizeof(dtunit));
}
if(found==0)
{//last chance ! Is it a support mesh ?
- int nbSM(MEDnSupportMesh(fid));
+ med_int nbSM(MEDnSupportMesh(fid));
for(int i=0;i<nbSM && found==0;i++)
{
- int naxis(MEDsupportMeshnAxis(fid,i+1));
+ med_int naxis(MEDsupportMeshnAxis(fid,i+1));
INTERP_KERNEL::AutoPtr<char> axisname(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)),axisunit(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE));
MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,i+1,nommaa,&spaceDim,&dim,maillage_description,&axistype,axisname,axisunit));
std::string cur(MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa)));
med_int numdt,numit;
med_float dtt;
MEDFILESAFECALLERRD0(MEDmeshComputationStepInfo,(fid,mName.c_str(),1,&numdt,&numit,&dtt));
- dt=numdt; it=numit;
+ dt=FromMedInt<int>(numdt); it=FromMedInt<int>(numit);
return new MeshCls(ret);
}
case 2:
{
meshType=UNSTRUCTURED;
dt=MED_NO_DT; it=MED_NO_IT; dtunit1.clear();
- axType=axType=TraduceAxisType(axistype);
+ axType=TraduceAxisType(axistype);
return new StructMeshCls(ret);
}
default:
return mId->getAxisInfoOnMesh(fid,mName,meshType,axType,nstep,Mdim,_description,_dt_unit,_univ_name);
}
-void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName, std::map<std::string,int>& fams, std::map<std::string, std::vector<std::string> >& grps, MEDFileMeshReadSelector *mrs)
+void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName, std::map<std::string,mcIdType>& fams, std::map<std::string, std::vector<std::string> >& grps, MEDFileMeshReadSelector *mrs)
{
if(mrs && !(mrs->isCellFamilyFieldReading() || mrs->isNodeFamilyFieldReading()))
return ;
char nomfam[MED_NAME_SIZE+1];
med_int numfam;
- int nfam=MEDnFamily(fid,meshName.c_str());
- std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > > crudeFams(nfam);
+ med_int nfam=MEDnFamily(fid,meshName.c_str());
+ std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > > crudeFams(nfam);
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
std::vector<std::string> grps(ngro);
for(int j=0;j<ngro;j++)
grps[j]=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
- crudeFams[i]=std::pair<std::string,std::pair<int,std::vector<std::string> > >(famName,std::pair<int,std::vector<std::string> >(numfam,grps));
+ crudeFams[i]=std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > >(famName,std::pair<mcIdType,std::vector<std::string> >(numfam,grps));
}
RenameFamiliesFromFileToMemInternal(crudeFams);
- for(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >::const_iterator it0=crudeFams.begin();it0!=crudeFams.end();it0++)
+ for(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >::const_iterator it0=crudeFams.begin();it0!=crudeFams.end();it0++)
{
fams[(*it0).first]=(*it0).second.first;
for(std::vector<std::string>::const_iterator it1=(*it0).second.second.begin();it1!=(*it0).second.second.end();it1++)
}
}
-void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map<std::string,int>& fams, const std::map<std::string, std::vector<std::string> >& grps, int tooLongStrPol)
+void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map<std::string,mcIdType>& fams, const std::map<std::string, std::vector<std::string> >& grps, int tooLongStrPol)
{
- std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > > crudeFams(fams.size());
+ std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > > crudeFams(fams.size());
std::size_t ii(0);
- for(std::map<std::string,int>::const_iterator it=fams.begin();it!=fams.end();it++,ii++)
+ for(std::map<std::string,mcIdType>::const_iterator it=fams.begin();it!=fams.end();it++,ii++)
{
std::vector<std::string> grpsOfFam;
for(std::map<std::string, std::vector<std::string> >::const_iterator it1=grps.begin();it1!=grps.end();it1++)
if(std::find((*it1).second.begin(),(*it1).second.end(),(*it).first)!=(*it1).second.end())
grpsOfFam.push_back((*it1).first);
}
- crudeFams[ii]=std::pair<std::string,std::pair<int,std::vector<std::string> > >((*it).first,std::pair<int,std::vector<std::string> >((*it).second,grpsOfFam));
+ crudeFams[ii]=std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > >((*it).first,std::pair<mcIdType,std::vector<std::string> >((*it).second,grpsOfFam));
}
RenameFamiliesFromMemToFileInternal(crudeFams);
- for(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++)
+ for(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++)
{
- int ngro((*it).second.second.size());
+ std::size_t ngro((*it).second.second.size());
INTERP_KERNEL::AutoPtr<char> groName=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE*ngro);
int i=0;
for(std::vector<std::string>::const_iterator it2=(*it).second.second.begin();it2!=(*it).second.second.end();it2++,i++)
MEDLoaderBase::safeStrCpy2((*it2).c_str(),MED_LNAME_SIZE,groName+i*MED_LNAME_SIZE,tooLongStrPol);
INTERP_KERNEL::AutoPtr<char> famName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
MEDLoaderBase::safeStrCpy((*it).first.c_str(),MED_NAME_SIZE,famName,tooLongStrPol);
- int ret=MEDfamilyCr(fid,mname.c_str(),famName,(*it).second.first,ngro,groName);
+ med_int ret=MEDfamilyCr(fid,mname.c_str(),famName,ToMedInt((*it).second.first),ToMedInt(ngro),groName);
ret++;
}
}
-void MEDFileMeshL2::RenameFamiliesPatternInternal(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >& crudeFams, RenameFamiliesPatternFunc func)
+void MEDFileMeshL2::RenameFamiliesPatternInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams, RenameFamiliesPatternFunc func)
{
std::size_t ii(0);
std::vector<std::string> fams(crudeFams.size());
- for(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++)
+ for(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++)
fams[ii]=(*it).first;
if(!func(fams))
return ;
ii=0;
- for(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >::iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++)
+ for(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >::iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++)
(*it).first=fams[ii];
}
* This method is dedicated to the killers that use a same family name to store different family ids. MED file API authorizes it.
* So this method renames families (if needed generally not !) in order to have a discriminant name for families.
*/
-void MEDFileMeshL2::RenameFamiliesFromFileToMemInternal(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >& crudeFams)
+void MEDFileMeshL2::RenameFamiliesFromFileToMemInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams)
{
RenameFamiliesPatternInternal(crudeFams,RenameFamiliesFromFileToMem);
}
bool MEDFileMeshL2::RenameFamiliesFromFileToMem(std::vector< std::string >& famNames)
{
- std::map<std::string,int> m;
+ std::map<std::string,mcIdType> m;
std::set<std::string> s;
for(std::vector< std::string >::const_iterator it=famNames.begin();it!=famNames.end();it++)
{
return false;// the general case !
for(std::vector< std::string >::iterator it=famNames.begin();it!=famNames.end();it++)
{
- std::map<std::string,int>::iterator it2(m.find(*it));
+ std::map<std::string,mcIdType>::iterator it2(m.find(*it));
if(it2!=m.end())
{
std::ostringstream oss; oss << *it << ZE_SEP_FOR_FAMILY_KILLERS << std::setfill('0') << std::setw(ZE_SEP2_FOR_FAMILY_KILLERS) << (*it2).second++;
* This method is dedicated to the killers that use a same family name to store different family ids. MED file API authorizes it.
* So this method renames families (if needed generally not !) in order to have a discriminant name for families.
*/
-void MEDFileMeshL2::RenameFamiliesFromMemToFileInternal(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >& crudeFams)
+void MEDFileMeshL2::RenameFamiliesFromMemToFileInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams)
{
RenameFamiliesPatternInternal(crudeFams,RenameFamiliesFromMemToFile);
}
if(found!=std::string::npos && found>=1)
{
std::string s1((*it).substr(found+sizeof(ZE_SEP_FOR_FAMILY_KILLERS)-1));
- if(s1.size()!=ZE_SEP2_FOR_FAMILY_KILLERS)
+ if((int)s1.size()!=ZE_SEP2_FOR_FAMILY_KILLERS)
continue;
int k(-1);
std::istringstream iss(s1);
loadCoords(fid,infosOnComp,mName,dt,it);
}
-void MEDFileUMeshL2::loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
+void MEDFileUMeshL2::loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
int Mdim;
std::vector<std::string> infosOnComp(loadCommonPart(fid,mId,mName,dt,it,Mdim));
return ;
loadPartOfConnectivity(fid,Mdim,mName,types,slicPerTyp,dt,it,mrs);
med_bool changement,transformation;
- int nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
+ mcIdType nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
std::vector<bool> fetchedNodeIds(nCoords,false);
for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
(*it1)->getMesh()->computeNodeIdsAlg(fetchedNodeIds);
- int nMin(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true)));
- int nMax(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),true)));
+ mcIdType nMin(ToIdType(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true))));
+ mcIdType nMax(ToIdType(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),true))));
nMax=nCoords-nMax;
for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
sortTypes();
}
-void MEDFileUMeshL2::loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
+void MEDFileUMeshL2::loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
std::size_t nbOfTypes(types.size());
if(slicPerTyp.size()!=3*nbOfTypes)
_per_type_mesh[0].clear();
for(std::size_t ii=0;ii<nbOfTypes;ii++)
{
- int strt(slicPerTyp[3*ii+0]),stp(slicPerTyp[3*ii+1]),step(slicPerTyp[3*ii+2]);
+ mcIdType strt(slicPerTyp[3*ii+0]),stp(slicPerTyp[3*ii+1]),step(slicPerTyp[3*ii+2]);
MCAuto<MEDFileUMeshPerType> tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,types[ii],strt,stp,step,mrs));
_per_type_mesh[0].push_back(tmp);
}
{
int spaceDim((int)infosOnComp.size());
med_bool changement,transformation;
- int nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
+ med_int nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
_coords=DataArrayDouble::New();
_coords->alloc(nCoords,spaceDim);
double *coordsPtr(_coords->getPointer());
MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateRd,(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,coordsPtr));
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
- _fam_coords=DataArrayInt::New();
- _fam_coords->alloc(nCoords,1);
- MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_fam_coords->getPointer()));
+ MCAuto<DataArrayMedInt> miFamCoord=DataArrayMedInt::New();
+ miFamCoord->alloc(nCoords,1);
+ MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,miFamCoord->getPointer()));
+ _fam_coords=FromMedIntArray<mcIdType>(miFamCoord);
}
else
_fam_coords=0;
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
- _num_coords=DataArrayInt::New();
- _num_coords->alloc(nCoords,1);
- MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_num_coords->getPointer()));
+ MCAuto<DataArrayMedInt> miNumCoord=DataArrayMedInt::New();
+ miNumCoord->alloc(nCoords,1);
+ MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,miNumCoord->getPointer()));
+ _num_coords=FromMedIntArray<mcIdType>(miNumCoord);
}
else
_num_coords=0;
_name_coords=0;
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_GLOBAL_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
- _global_num_coords=DataArrayInt::New();
- _global_num_coords->alloc(nCoords,1);
- MEDFILESAFECALLERRD0(MEDmeshGlobalNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_global_num_coords->getPointer()));
+ MCAuto<DataArrayMedInt> miNumCoord=DataArrayMedInt::New();
+ miNumCoord->alloc(nCoords,1);
+ MEDFILESAFECALLERRD0(MEDmeshGlobalNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,miNumCoord->getPointer()));
+ _global_num_coords=FromMedIntArray<mcIdType>(miNumCoord);
}
for(int i=0;i<spaceDim;i++)
_coords->setInfoOnComponent(i,infosOnComp[i]);
}
-void MEDFileUMeshL2::loadPartCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, int nMin, int nMax)
+void MEDFileUMeshL2::loadPartCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, mcIdType nMin, mcIdType nMax)
{
med_bool changement,transformation;
- int spaceDim((int)infosOnComp.size()),nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
+ med_int spaceDim((int)infosOnComp.size()),nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
_coords=DataArrayDouble::New();
- int nbNodesToLoad(nMax-nMin);
+ mcIdType nbNodesToLoad(nMax-nMin);
_coords->alloc(nbNodesToLoad,spaceDim);
med_filter filter=MED_FILTER_INIT,filter2=MED_FILTER_INIT;
MEDfilterBlockOfEntityCr(fid,/*nentity*/nCoords,/*nvaluesperentity*/1,/*nconstituentpervalue*/spaceDim,
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
- /*start*/nMin+1,/*stride*/1,/*count*/1,/*blocksize*/nbNodesToLoad,
+ /*start*/ToMedInt(nMin+1),/*stride*/1,/*count*/1,/*blocksize*/ToMedInt(nbNodesToLoad),
/*lastblocksize=useless because count=1*/0,&filter);
MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateAdvancedRd,(fid,mName.c_str(),dt,it,&filter,_coords->getPointer()));
_part_coords=PartDefinition::New(nMin,nMax,1);
MEDfilterClose(&filter);
MEDfilterBlockOfEntityCr(fid,nCoords,1,1,MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,
- MED_NO_PROFILE,nMin+1,1,1,nbNodesToLoad,0,&filter2);
+ MED_NO_PROFILE,ToMedInt(nMin+1),1,1,ToMedInt(nbNodesToLoad),0,&filter2);
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
- _fam_coords=DataArrayInt::New();
- _fam_coords->alloc(nbNodesToLoad,1);
- MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_FAMILY_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_fam_coords->getPointer()));
+ MCAuto<DataArrayMedInt> miFamCoord=DataArrayMedInt::New();
+ miFamCoord->alloc(nbNodesToLoad,1);
+ MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_FAMILY_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,miFamCoord->getPointer()));
+ _fam_coords=FromMedIntArray<mcIdType>(miFamCoord);
}
else
_fam_coords=0;
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
- _num_coords=DataArrayInt::New();
- _num_coords->alloc(nbNodesToLoad,1);
- MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_num_coords->getPointer()));
+ MCAuto<DataArrayMedInt> miNumCoord=DataArrayMedInt::New();
+ miNumCoord->alloc(nbNodesToLoad,1);
+ MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,miNumCoord->getPointer()));
+ _num_coords=FromMedIntArray<mcIdType>(miNumCoord);
}
else
_num_coords=0;
_per_type_mesh.resize(_per_type_mesh.size()-nbOfUselessLev);
}
-void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayInt *globalNumCoords)
+void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayIdType *famCoords, const DataArrayIdType *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayIdType *globalNumCoords)
{
if(!coords)
return ;
- MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,ToMedInt(coords->getNumberOfTuples()),coords->begin()));
if(famCoords)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,ToMedInt(famCoords->getNumberOfTuples()),ToMedIntArray<mcIdType>(famCoords)->begin()));
if(numCoords)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,ToMedInt(numCoords->getNumberOfTuples()),ToMedIntArray<mcIdType>(numCoords)->begin()));
if(nameCoords)
{
if(nameCoords->getNumberOfComponents()!=MED_SNAME_SIZE)
oss << " ! The array has " << nameCoords->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,ToMedInt(nameCoords->getNumberOfTuples()),nameCoords->begin()));
}
if(globalNumCoords)
- MEDFILESAFECALLERWR0(MEDmeshGlobalNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NONE,globalNumCoords->getNumberOfTuples(),globalNumCoords->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshGlobalNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NONE,ToMedInt(globalNumCoords->getNumberOfTuples()),ToMedIntArray<mcIdType>(globalNumCoords)->begin()));
}
bool MEDFileUMeshL2::isFamDefinedOnLev(int levId) const
{
med_data_type dataTypeReq=GetDataTypeCorrespondingToSpaceId(i);
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
- int nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf));
+ med_int nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf));
MCAuto<DataArrayDouble> da=DataArrayDouble::New();
da->alloc(nbOfElt,1);
da->setInfoOnComponent(0,infosOnComp[i]);
_order=it;
//
_clmesh=MEDCouplingCurveLinearMesh::New();
- INTERP_KERNEL::AutoPtr<int> stGrid=new int[Mdim];
- MEDFILESAFECALLERRD0(MEDmeshGridStructRd,(fid,mName.c_str(),dt,it,stGrid));
- _clmesh->setNodeGridStructure(stGrid,((int *)stGrid)+Mdim);
+ MCAuto<DataArrayMedInt> miStGrid=DataArrayMedInt::New();
+ miStGrid->alloc(Mdim,1);
+ MEDFILESAFECALLERRD0(MEDmeshGridStructRd,(fid,mName.c_str(),dt,it,miStGrid->getPointer()));
+ MCAuto<DataArrayIdType> stGrid=FromMedIntArray<mcIdType>(miStGrid);
+ _clmesh->setNodeGridStructure(stGrid->begin(),stGrid->end());
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
- int nbNodes(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf));
+ med_int nbNodes(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf));
MCAuto<DataArrayDouble> da=DataArrayDouble::New();
da->alloc(nbNodes,infosOnComp.size());
da->setInfoOnComponents(infosOnComp);
const std::vector< MCAuto<MEDFileUMeshPerType> >& v=l2.getLev(id);
if(v.empty())
return;
- int sz=v.size();
+ std::size_t sz=v.size();
std::vector<const MEDCoupling1GTUMesh *> ms(sz);
- std::vector<const DataArrayInt *> fams(sz),nums(sz);
+ std::vector<const DataArrayIdType *> fams(sz),nums(sz);
std::vector<const DataArrayChar *> names(sz);
std::vector<const PartDefinition *> pds(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
MEDCoupling1GTUMesh *elt(v[i]->getMesh());
MCAuto<DataArrayDouble> tmp2=l2.getCoords();
_m_by_types.assignDefParts(pds);
if(l2.isFamDefinedOnLev(id))
{
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
fams[i]=v[i]->getFam();
if(sz!=1)
- _fam=DataArrayInt::Aggregate(fams);
+ _fam=DataArrayIdType::Aggregate(fams);
else
{
fams[0]->incrRef();
- _fam=const_cast<DataArrayInt *>(fams[0]);
+ _fam=const_cast<DataArrayIdType *>(fams[0]);
}
}
if(l2.isNumDefinedOnLev(id))
{
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
nums[i]=v[i]->getNum();
if(sz!=1)
- _num=DataArrayInt::Aggregate(nums);
+ _num=DataArrayIdType::Aggregate(nums);
else
{
nums[0]->incrRef();
- _num=const_cast<DataArrayInt *>(nums[0]);
+ _num=const_cast<DataArrayIdType *>(nums[0]);
}
computeRevNum();
}
if(l2.isNamesDefinedOnLev(id))
{
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
names[i]=v[i]->getNames();
_names=dynamic_cast<DataArrayAsciiChar *>(DataArrayChar::Aggregate(names));
}
std::vector<const BigMemoryObject *> ret;
ret.push_back(&_m_by_types);
ret.push_back(&_m);
- ret.push_back((const DataArrayInt*)_fam);
- ret.push_back((const DataArrayInt*)_num);
- ret.push_back((const DataArrayInt*)_rev_num);
+ ret.push_back((const DataArrayIdType*)_fam);
+ ret.push_back((const DataArrayIdType*)_num);
+ ret.push_back((const DataArrayIdType*)_rev_num);
ret.push_back((const DataArrayAsciiChar*)_names);
return ret;
}
{
MCAuto<MEDFileUMeshSplitL1> ret(new MEDFileUMeshSplitL1(*this));
ret->_m_by_types=_m_by_types.deepCopy(coords);
- if((const DataArrayInt *)_fam)
+ if((const DataArrayIdType *)_fam)
ret->_fam=_fam->deepCopy();
- if((const DataArrayInt *)_num)
+ if((const DataArrayIdType *)_num)
ret->_num=_num->deepCopy();
- if((const DataArrayInt *)_rev_num)
+ if((const DataArrayIdType *)_rev_num)
ret->_rev_num=_rev_num->deepCopy();
if((const DataArrayAsciiChar *)_names)
ret->_names=_names->deepCopy();
{
if (!_fam || _fam->getNumberOfTuples() != getSize())
throw INTERP_KERNEL::Exception("MEDFileUMeshSplitL1::checkConsistency(): internal family array has an invalid size!");
- int nbCells = getSize();
+ mcIdType nbCells = getSize();
if (_num)
{
_num->checkNbOfTuplesAndComp(nbCells,1,"MEDFileUMeshSplitL1::checkConsistency(): inconsistent internal node numbering array!");
- int pos;
- int maxValue=_num->getMaxValue(pos);
+ mcIdType pos;
+ mcIdType maxValue=_num->getMaxValue(pos);
if (!_rev_num || _rev_num->getNumberOfTuples() != (maxValue+1))
throw INTERP_KERNEL::Exception("MEDFileUMeshSplitL1::checkConsistency(): inconsistent internal revert node numbering array!");
}
{
if(!_m_by_types.isEqual(other->_m_by_types,eps,what))
return false;
- const DataArrayInt *d1=_fam;
- const DataArrayInt *d2=other->_fam;
+ const DataArrayIdType *d1=_fam;
+ const DataArrayIdType *d2=other->_fam;
if((d1==0 && d2!=0) || (d1!=0 && d2==0))
{
what="Presence of family arr in one sublevel and not in other!";
m->incrRef();
_m=m;
_m_by_types.assignUMesh(dynamic_cast<MEDCouplingUMesh *>(m->deepCopy()));
- MCAuto<DataArrayInt> da=_m_by_types.getUmesh()->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
+ MCAuto<DataArrayIdType> da=_m_by_types.getUmesh()->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
if(!da->isIota(m->getNumberOfCells()))
{
_num=da->invertArrayO2N2N2O(m->getNumberOfCells());
void MEDFileUMeshSplitL1::assignCommonPart()
{
- _fam=DataArrayInt::New();
+ _fam=DataArrayIdType::New();
_fam->alloc(_m_by_types.getSize(),1);
_fam->fillWithValue(0);
}
return _m_by_types.empty();
}
-bool MEDFileUMeshSplitL1::presenceOfOneFams(const std::vector<int>& ids) const
+bool MEDFileUMeshSplitL1::presenceOfOneFams(const std::vector<mcIdType>& ids) const
{
- const DataArrayInt *fam=_fam;
+ const DataArrayIdType *fam=_fam;
if(!fam)
return false;
return fam->presenceOfValue(ids);
void MEDFileUMeshSplitL1::simpleRepr(std::ostream& oss) const
{
- std::vector<int> code=_m_by_types.getDistributionOfTypes();
- int nbOfTypes=code.size()/3;
- for(int i=0;i<nbOfTypes;i++)
+ std::vector<mcIdType> code=_m_by_types.getDistributionOfTypes();
+ std::size_t nbOfTypes=code.size()/3;
+ for(std::size_t i=0;i<nbOfTypes;i++)
{
INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType) code[3*i];
oss << " - Number of cells with type " << INTERP_KERNEL::CellModel::GetCellModel(typ).getRepr() << " : " << code[3*i+1] << std::endl;
}
}
-int MEDFileUMeshSplitL1::getSize() const
+mcIdType MEDFileUMeshSplitL1::getSize() const
{
return _m_by_types.getSize();
}
-MEDCouplingUMesh *MEDFileUMeshSplitL1::getFamilyPart(const int *idsBg, const int *idsEnd, bool renum) const
+MEDCouplingUMesh *MEDFileUMeshSplitL1::getFamilyPart(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const
{
- MCAuto<DataArrayInt> eltsToKeep=_fam->findIdsEqualList(idsBg,idsEnd);
+ MCAuto<DataArrayIdType> eltsToKeep=_fam->findIdsEqualList(idsBg,idsEnd);
MEDCouplingUMesh *m=(MEDCouplingUMesh *)_m_by_types.getUmesh()->buildPartOfMySelf(eltsToKeep->begin(),eltsToKeep->end(),true);
if(renum)
return renumIfNeeded(m,eltsToKeep->begin());
return m;
}
-DataArrayInt *MEDFileUMeshSplitL1::getFamilyPartArr(const int *idsBg, const int *idsEnd, bool renum) const
+DataArrayIdType *MEDFileUMeshSplitL1::getFamilyPartArr(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const
{
- MCAuto<DataArrayInt> da=_fam->findIdsEqualList(idsBg,idsEnd);
+ MCAuto<DataArrayIdType> da=_fam->findIdsEqualList(idsBg,idsEnd);
if(renum)
return renumIfNeededArr(da);
return da.retn();
return _m_by_types.getGeoTypes();
}
-int MEDFileUMeshSplitL1::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
+mcIdType MEDFileUMeshSplitL1::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
{
return _m_by_types.getNumberOfCellsWithType(ct);
}
MEDCouplingUMesh *MEDFileUMeshSplitL1::getWholeMesh(bool renum) const
{
MCAuto<MEDCouplingUMesh> tmp;
- if(renum && ((const DataArrayInt *)_num))
+ if(renum && ((const DataArrayIdType *)_num))
tmp=_m;
else
{ tmp=_m_by_types.getUmesh(); if(tmp) tmp->incrRef(); }
return tmp.retn();
}
-int MEDFileUMeshSplitL1::getNumberOfCells() const
+mcIdType MEDFileUMeshSplitL1::getNumberOfCells() const
{
return _m_by_types.getNumberOfCells();
}
-DataArrayInt *MEDFileUMeshSplitL1::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
+DataArrayIdType *MEDFileUMeshSplitL1::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
{
- const DataArrayInt *fam(_fam);
+ const DataArrayIdType *fam(_fam);
if(!fam)
return 0;
- int start(0),stop(0);
+ mcIdType start(0),stop(0);
_m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop);
return fam->selectByTupleIdSafeSlice(start,stop,1);
}
-DataArrayInt *MEDFileUMeshSplitL1::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
+DataArrayIdType *MEDFileUMeshSplitL1::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
{
- const DataArrayInt *num(_num);
+ const DataArrayIdType *num(_num);
if(!num)
return 0;
- int start(0),stop(0);
+ mcIdType start(0),stop(0);
_m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop);
return num->selectByTupleIdSafeSlice(start,stop,1);
}
-DataArrayInt *MEDFileUMeshSplitL1::getOrCreateAndGetFamilyField()
+DataArrayIdType *MEDFileUMeshSplitL1::getOrCreateAndGetFamilyField()
{
- if((DataArrayInt *)_fam)
+ if((DataArrayIdType *)_fam)
return _fam;
- int nbOfTuples=_m_by_types.getSize();
- _fam=DataArrayInt::New(); _fam->alloc(nbOfTuples,1); _fam->fillWithZero();
+ mcIdType nbOfTuples=_m_by_types.getSize();
+ _fam=DataArrayIdType::New(); _fam->alloc(nbOfTuples,1); _fam->fillWithZero();
return _fam;
}
-const DataArrayInt *MEDFileUMeshSplitL1::getFamilyField() const
+const DataArrayIdType *MEDFileUMeshSplitL1::getFamilyField() const
{
return _fam;
}
-const DataArrayInt *MEDFileUMeshSplitL1::getNumberField() const
+const DataArrayIdType *MEDFileUMeshSplitL1::getNumberField() const
{
return _num;
}
-const DataArrayInt *MEDFileUMeshSplitL1::getRevNumberField() const
+const DataArrayIdType *MEDFileUMeshSplitL1::getRevNumberField() const
{
return _rev_num;
}
/*!
* This method ignores _m and _m_by_types.
*/
-void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,int>& familyIds,
+void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,mcIdType>& familyIds,
std::map<std::string, std::vector<std::string> >& groups)
{
- std::vector< DataArrayInt * > corr;
+ std::vector< DataArrayIdType * > corr;
_m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,0,corr);
- std::vector< MCAuto<DataArrayInt> > corrMSafe(corr.begin(),corr.end());
- std::vector< std::vector<int> > fidsOfGroups;
- std::vector< const DataArrayInt * > corr2(corr.begin(),corr.end());
- _fam=DataArrayInt::MakePartition(corr2,((MEDCouplingUMesh *)_m)->getNumberOfCells(),fidsOfGroups);
- int nbOfCells=((MEDCouplingUMesh *)_m)->getNumberOfCells();
- std::map<int,std::string> newfams;
- std::map<int,int> famIdTrad;
+ std::vector< MCAuto<DataArrayIdType> > corrMSafe(corr.begin(),corr.end());
+ std::vector< std::vector<mcIdType> > fidsOfGroups;
+ std::vector< const DataArrayIdType * > corr2(corr.begin(),corr.end());
+ _fam=DataArrayIdType::MakePartition(corr2,((MEDCouplingUMesh *)_m)->getNumberOfCells(),fidsOfGroups);
+ mcIdType nbOfCells=((MEDCouplingUMesh *)_m)->getNumberOfCells();
+ std::map<mcIdType,std::string> newfams;
+ std::map<mcIdType,mcIdType> famIdTrad;
TraduceFamilyNumber(fidsOfGroups,familyIds,famIdTrad,newfams);
- int *w=_fam->getPointer();
- for(int i=0;i<nbOfCells;i++,w++)
+ mcIdType *w=_fam->getPointer();
+ for(mcIdType i=0;i<nbOfCells;i++,w++)
*w=famIdTrad[*w];
}
void MEDFileUMeshSplitL1::write(med_idt fid, const std::string& mName, int mdim) const
{
std::vector<MEDCoupling1GTUMesh *> ms(_m_by_types.getParts());
- int start=0;
+ mcIdType start=0;
for(std::vector<MEDCoupling1GTUMesh *>::const_iterator it=ms.begin();it!=ms.end();it++)
{
- int nbCells=(*it)->getNumberOfCells();
- int end=start+nbCells;
- MCAuto<DataArrayInt> fam,num;
+ mcIdType nbCells=(*it)->getNumberOfCells();
+ mcIdType end=start+nbCells;
+ MCAuto<DataArrayIdType> fam,num;
MCAuto<DataArrayAsciiChar> names;
- if((const DataArrayInt *)_fam)
+ if((const DataArrayIdType *)_fam)
fam=_fam->subArray(start,end);
- if((const DataArrayInt *)_num)
+ if((const DataArrayIdType *)_num)
num=_num->subArray(start,end);
if((const DataArrayAsciiChar *)_names)
names=static_cast<DataArrayAsciiChar *>(_names->subArray(start,end));
}
}
-void MEDFileUMeshSplitL1::renumberNodesInConn(const int *newNodeNumbersO2N)
+void MEDFileUMeshSplitL1::renumberNodesInConn(const mcIdType *newNodeNumbersO2N)
{
_m_by_types.renumberNodesInConnWithoutComputation(newNodeNumbersO2N);
}
-void MEDFileUMeshSplitL1::serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const
+void MEDFileUMeshSplitL1::serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const
{
bigArraysI.push_back(_fam);
bigArraysI.push_back(_num);
_m_by_types.serialize(tinyInt,bigArraysI);
}
-void MEDFileUMeshSplitL1::unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI)
+void MEDFileUMeshSplitL1::unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI)
{
_fam=bigArraysI.back(); bigArraysI.pop_back();
_num=bigArraysI.back(); bigArraysI.pop_back();
_m_by_types.unserialize(name,coo,tinyInt,bigArraysI);
}
-void MEDFileUMeshSplitL1::changeFamilyIdArr(int oldId, int newId)
+void MEDFileUMeshSplitL1::changeFamilyIdArr(mcIdType oldId, mcIdType newId)
{
- DataArrayInt *arr=_fam;
+ DataArrayIdType *arr=_fam;
if(arr)
arr->changeValue(oldId,newId);
}
-void MEDFileUMeshSplitL1::setFamilyArr(DataArrayInt *famArr)
+void MEDFileUMeshSplitL1::setFamilyArr(DataArrayIdType *famArr)
{
if(!famArr)
{
_fam=0;
return ;
}
- int sz(_m_by_types.getSize());
+ mcIdType sz(_m_by_types.getSize());
famArr->checkNbOfTuplesAndComp(sz,1,"MEDFileUMeshSplitL1::setFamilyArr : Problem in size of Family arr ! ");
famArr->incrRef();
_fam=famArr;
}
-DataArrayInt *MEDFileUMeshSplitL1::getFamilyField()
+DataArrayIdType *MEDFileUMeshSplitL1::getFamilyField()
{
return _fam;
}
-void MEDFileUMeshSplitL1::setRenumArr(DataArrayInt *renumArr)
+void MEDFileUMeshSplitL1::setRenumArr(DataArrayIdType *renumArr)
{
if(!renumArr)
{
_rev_num=0;
return ;
}
- int sz(_m_by_types.getSize());
+ mcIdType sz(_m_by_types.getSize());
renumArr->checkNbOfTuplesAndComp(sz,1,"MEDFileUMeshSplitL1::setRenumArr : Problem in size of numbering arr ! ");
renumArr->incrRef();
_num=renumArr;
_names=0;
return ;
}
- int sz(_m_by_types.getSize());
+ mcIdType sz(_m_by_types.getSize());
nameArr->checkNbOfTuplesAndComp(sz,MED_SNAME_SIZE,"MEDFileUMeshSplitL1::setNameArr : Problem in size of name arr ! ");
nameArr->incrRef();
_names=nameArr;
}
-MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayInt *renum, MEDCouplingUMesh *m, const int *cellIds)
+MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayIdType *renum, MEDCouplingUMesh *m, const mcIdType *cellIds)
{
if(renum==0)
return m;
m->renumberCells(renum->begin(),true);
else
{
- MCAuto<DataArrayInt> locnum=renum->selectByTupleId(cellIds,cellIds+m->getNumberOfCells());
+ MCAuto<DataArrayIdType> locnum=renum->selectByTupleId(cellIds,cellIds+m->getNumberOfCells());
m->renumberCells(locnum->begin(),true);
}
return m;
}
-MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::Unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI)
+MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::Unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI)
{
MCAuto<MEDFileUMeshSplitL1> ret(new MEDFileUMeshSplitL1);
ret->unserialize(name,coo,tinyInt,bigArraysI);
return ret.retn();
}
-MEDCouplingUMesh *MEDFileUMeshSplitL1::renumIfNeeded(MEDCouplingUMesh *m, const int *cellIds) const
+MEDCouplingUMesh *MEDFileUMeshSplitL1::renumIfNeeded(MEDCouplingUMesh *m, const mcIdType *cellIds) const
{
return Renumber2(_num,m,cellIds);
}
-DataArrayInt *MEDFileUMeshSplitL1::Renumber(const DataArrayInt *renum, const DataArrayInt *da)
+DataArrayIdType *MEDFileUMeshSplitL1::Renumber(const DataArrayIdType *renum, const DataArrayIdType *da)
{
- if((const DataArrayInt *)renum==0)
+ if((const DataArrayIdType *)renum==0)
{
da->incrRef();
- return const_cast<DataArrayInt *>(da);
+ return const_cast<DataArrayIdType *>(da);
}
return renum->selectByTupleId(da->begin(),da->end());
}
-DataArrayInt *MEDFileUMeshSplitL1::renumIfNeededArr(const DataArrayInt *da) const
+DataArrayIdType *MEDFileUMeshSplitL1::renumIfNeededArr(const DataArrayIdType *da) const
{
return Renumber(_num,da);
}
-std::vector<int> MEDFileUMeshSplitL1::GetNewFamiliesNumber(int nb, const std::map<std::string,int>& families)
+std::vector<mcIdType> MEDFileUMeshSplitL1::GetNewFamiliesNumber(mcIdType nb, const std::map<std::string,mcIdType>& families)
{
- int id=-1;
- for(std::map<std::string,int>::const_iterator it=families.begin();it!=families.end();it++)
+ mcIdType id=-1;
+ for(std::map<std::string,mcIdType>::const_iterator it=families.begin();it!=families.end();it++)
id=std::max(id,(*it).second);
if(id==-1)
id=0;
- std::vector<int> ret(nb);
- for(int i=1;i<=nb;i++)
+ std::vector<mcIdType> ret(nb);
+ for(mcIdType i=1;i<=nb;i++)
ret[i]=id+i;
return ret;
}
-void MEDFileUMeshSplitL1::TraduceFamilyNumber(const std::vector< std::vector<int> >& fidsGrps, std::map<std::string,int>& familyIds,
- std::map<int,int>& famIdTrad, std::map<int,std::string>& newfams)
+void MEDFileUMeshSplitL1::TraduceFamilyNumber(const std::vector< std::vector<mcIdType> >& fidsGrps, std::map<std::string,mcIdType>& familyIds,
+ std::map<mcIdType,mcIdType>& famIdTrad, std::map<mcIdType,std::string>& newfams)
{
- std::set<int> allfids;
+ std::set<mcIdType> allfids;
//tony
}
void MEDFileUMeshSplitL1::computeRevNum() const
{
- int pos;
- int maxValue=_num->getMaxValue(pos);
+ mcIdType pos;
+ mcIdType maxValue=_num->getMaxValue(pos);
_rev_num=_num->invertArrayN2O2O2N(maxValue+1);
}
return _m;
}
-int MEDFileUMeshAggregateCompute::getNumberOfCells() const
+mcIdType MEDFileUMeshAggregateCompute::getNumberOfCells() const
{
if(_mp_time<=_m_time)
return _m->getNumberOfCells();
- int ret(0);
+ mcIdType ret(0);
for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
ret+=(*it)->getNumberOfCells();
return ret;
return _m->getAllGeoTypesSorted();
}
-int MEDFileUMeshAggregateCompute::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
+mcIdType MEDFileUMeshAggregateCompute::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
{
if(_mp_time>=_m_time)
{
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartWithoutComputation : the geometric type is not existing !");
}
-void MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const
+void MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, mcIdType& start, mcIdType& stop) const
{
start=0; stop=0;
std::vector<MEDCoupling1GTUMesh *> v(retrievePartsWithoutComputation());
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation : the geometric type is not existing !");
}
-void MEDFileUMeshAggregateCompute::renumberNodesInConnWithoutComputation(const int *newNodeNumbersO2N)
+void MEDFileUMeshAggregateCompute::renumberNodesInConnWithoutComputation(const mcIdType *newNodeNumbersO2N)
{
if(_mp_time>_m_time)
{
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartDefOfWithoutComputation : The input geo type is not existing in this !");
}
-void MEDFileUMeshAggregateCompute::serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const
+void MEDFileUMeshAggregateCompute::serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const
{
if(_mp_time<_m_time)
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::serialize : the parts require a computation !");
std::size_t sz(_m_parts.size());
- tinyInt.push_back((int)sz);
+ tinyInt.push_back((mcIdType)sz);
for(std::size_t i=0;i<sz;i++)
{
const MEDCoupling1GTUMesh *mesh(_m_parts[i]);
const MEDCoupling1DGTUMesh *mesh2(dynamic_cast<const MEDCoupling1DGTUMesh *>(mesh));
if(mesh1)
{
- DataArrayInt *elt(mesh1->getNodalConnectivity());
+ DataArrayIdType *elt(mesh1->getNodalConnectivity());
if(elt)
elt->incrRef();
- MCAuto<DataArrayInt> elt1(elt);
+ MCAuto<DataArrayIdType> elt1(elt);
bigArraysI.push_back(elt1);
}
else if(mesh2)
{
- DataArrayInt *elt1(mesh2->getNodalConnectivity()),*elt2(mesh2->getNodalConnectivityIndex());
+ DataArrayIdType *elt1(mesh2->getNodalConnectivity()),*elt2(mesh2->getNodalConnectivityIndex());
if(elt1)
elt1->incrRef();
if(elt2)
elt2->incrRef();
- MCAuto<DataArrayInt> elt11(elt1),elt22(elt2);
+ MCAuto<DataArrayIdType> elt11(elt1),elt22(elt2);
bigArraysI.push_back(elt11); bigArraysI.push_back(elt22);
}
else
tinyInt.push_back(-1);
else
{
- std::vector<int> tinyTmp;
+ std::vector<mcIdType> tinyTmp;
pd->serialize(tinyTmp,bigArraysI);
- tinyInt.push_back((int)tinyTmp.size());
+ tinyInt.push_back((mcIdType)tinyTmp.size());
tinyInt.insert(tinyInt.end(),tinyTmp.begin(),tinyTmp.end());
}
}
}
-void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI)
+void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI)
{
- int nbParts(tinyInt.back()); tinyInt.pop_back();
+ mcIdType nbParts(tinyInt.back()); tinyInt.pop_back();
_part_def.clear(); _part_def.resize(nbParts);
_m_parts.clear(); _m_parts.resize(nbParts);
- for(int i=0;i<nbParts;i++)
+ for(mcIdType i=0;i<nbParts;i++)
{
INTERP_KERNEL::NormalizedCellType tp((INTERP_KERNEL::NormalizedCellType) tinyInt.back()); tinyInt.pop_back();
MCAuto<MEDCoupling1GTUMesh> mesh(MEDCoupling1GTUMesh::New(name,tp));
}
else if(mesh2)
{
- MCAuto<DataArrayInt> elt0,elt1;
+ MCAuto<DataArrayIdType> elt0,elt1;
elt0=bigArraysI.back(); bigArraysI.pop_back();
elt1=bigArraysI.back(); bigArraysI.pop_back();
mesh2->setNodalConnectivity(elt0,elt1);
else
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::unserialize : unrecognized single geo type mesh !");
_m_parts[i]=mesh;
- int pdid(tinyInt.back()); tinyInt.pop_back();
+ mcIdType pdid(tinyInt.back()); tinyInt.pop_back();
if(pdid!=-1)
_part_def[i]=PartDefinition::Unserialize(tinyInt,bigArraysI);
_mp_time=std::max(_mp_time,_m_time)+1;
}
}
-std::vector<int> MEDFileUMeshAggregateCompute::getDistributionOfTypes() const
+std::vector<mcIdType> MEDFileUMeshAggregateCompute::getDistributionOfTypes() const
{
if(_mp_time<_m_time)
{
}
else
{
- std::vector<int> ret;
+ std::vector<mcIdType> ret;
for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
const MEDCoupling1GTUMesh *tmp(*it);
if(!tmp)
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getDistributionOfTypes : part mesh contains null instance !");
- std::vector<int> ret0(tmp->getDistributionOfTypes());
+ std::vector<mcIdType> ret0(tmp->getDistributionOfTypes());
ret.insert(ret.end(),ret0.begin(),ret0.end());
}
return ret;
}
}
-int MEDFileUMeshAggregateCompute::getSize() const
+mcIdType MEDFileUMeshAggregateCompute::getSize() const
{
if(_mp_time<_m_time)
{
}
else
{
- int ret=0;
+ mcIdType ret=0;
for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
const MEDCoupling1GTUMesh *m(*it);
MEDFILESAFECALLERRD0(MEDmeshEntityInfo,(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,iterOnStEltOfMesh+1,geoTypeName,&geoType));
_geo_type=geoType;
_geo_type_name=MEDLoaderBase::buildStringFromFortran(geoTypeName,MED_NAME_SIZE);
- int nCells(0);
+ mcIdType nCells(0);
{
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
nCells=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,geoType,MED_CONNECTIVITY,MED_NODAL,&chgt,&trsf);
}
MCAuto<MEDFileMeshSupports> mss(MEDFileMeshSupports::New(fid));
MCAuto<MEDFileStructureElements> mse(MEDFileStructureElements::New(fid,mss));
- int nbEntities(mse->getNumberOfNodesPerSE(_geo_type_name));
- _conn=DataArrayInt::New(); _conn->alloc(nCells*nbEntities);
- MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,_geo_type,MED_NODAL,MED_FULL_INTERLACE,_conn->getPointer()));
+ mcIdType nbEntities(mse->getNumberOfNodesPerSE(_geo_type_name));
+ MCAuto<DataArrayMedInt> miConn=DataArrayMedInt::New(); miConn->alloc(nCells*nbEntities);
+ MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,_geo_type,MED_NODAL,MED_FULL_INTERLACE,miConn->getPointer()));
+ _conn=FromMedIntArray<mcIdType>(miConn);
_conn->applyLin(1,-1);
_conn->rearrange(nbEntities);
_common=MEDFileUMeshPerTypeCommon::New();
MCAuto<PartDefinition> getPartDefOfCoo() const { return _part_coords; }
std::vector<std::string> getAxisInfoOnMesh(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim);
static INTERP_KERNEL::AutoCppPtr<MeshOrStructMeshCls> GetMeshIdFromName(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& dt, int& it, std::string& dtunit1);
- static void ReadFamiliesAndGrps(med_idt fid, const std::string& mname, std::map<std::string,int>& fams, std::map<std::string, std::vector<std::string> >& grps, MEDFileMeshReadSelector *mrs);
- static void WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map<std::string,int>& fams, const std::map<std::string, std::vector<std::string> >& grps, int tooLongStrPol);
+ static void ReadFamiliesAndGrps(med_idt fid, const std::string& mname, std::map<std::string,mcIdType>& fams, std::map<std::string, std::vector<std::string> >& grps, MEDFileMeshReadSelector *mrs);
+ static void WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map<std::string,mcIdType>& fams, const std::map<std::string, std::vector<std::string> >& grps, int tooLongStrPol);
static bool RenameFamiliesFromFileToMem(std::vector< std::string >& famNames);
static bool RenameFamiliesFromMemToFile(std::vector< std::string >& famNames);
static MEDCoupling::MEDCouplingAxisType TraduceAxisType(med_axis_type at);
static med_grid_type TraduceAxisTypeRevStruct(MEDCoupling::MEDCouplingAxisType at);
private:
typedef bool (*RenameFamiliesPatternFunc)(std::vector< std::string >&);
- static void RenameFamiliesPatternInternal(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >& crudeFams, RenameFamiliesPatternFunc func);
- static void RenameFamiliesFromFileToMemInternal(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >& crudeFams);
- static void RenameFamiliesFromMemToFileInternal(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >& crudeFams);
+ static void RenameFamiliesPatternInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams, RenameFamiliesPatternFunc func);
+ static void RenameFamiliesFromFileToMemInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams);
+ static void RenameFamiliesFromMemToFileInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams);
public:
static const char ZE_SEP_FOR_FAMILY_KILLERS[];
static int ZE_SEP2_FOR_FAMILY_KILLERS;
MEDFileUMeshL2();
std::vector<std::string> loadCommonPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it, int& Mdim);
void loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
- void loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs);
+ void loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs);
void loadConnectivity(med_idt fid, int mdim, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
- void loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs);
+ void loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs);
void loadCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it);
- void loadPartCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, int nMin, int nMax);
- int getNumberOfLevels() const { return _per_type_mesh.size(); }
+ void loadPartCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, mcIdType nMin, mcIdType nMax);
+ int getNumberOfLevels() const { return (int)_per_type_mesh.size(); }
bool emptyLev(int levId) const { return _per_type_mesh[levId].empty(); }
const std::vector< MCAuto<MEDFileUMeshPerType> >& getLev(int levId) const { return _per_type_mesh[levId]; }
bool isFamDefinedOnLev(int levId) const;
bool isNumDefinedOnLev(int levId) const;
bool isNamesDefinedOnLev(int levId) const;
MCAuto<DataArrayDouble> getCoords() const { return _coords; }
- MCAuto<DataArrayInt> getCoordsFamily() const { return _fam_coords; }
- MCAuto<DataArrayInt> getCoordsNum() const { return _num_coords; }
- MCAuto<DataArrayInt> getCoordsGlobalNum() const { return _global_num_coords; }
+ MCAuto<DataArrayIdType> getCoordsFamily() const { return _fam_coords; }
+ MCAuto<DataArrayIdType> getCoordsNum() const { return _num_coords; }
+ MCAuto<DataArrayIdType> getCoordsGlobalNum() const { return _global_num_coords; }
MCAuto<DataArrayAsciiChar> getCoordsName() const { return _name_coords; }
- static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayInt *globalNumCoords);
+ static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayIdType *famCoords, const DataArrayIdType *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayIdType *globalNumCoords);
private:
void sortTypes();
private:
std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > > _per_type_mesh;
MCAuto<DataArrayDouble> _coords;
- MCAuto<DataArrayInt> _fam_coords;
- MCAuto<DataArrayInt> _num_coords;
- MCAuto<DataArrayInt> _global_num_coords;
+ MCAuto<DataArrayIdType> _fam_coords;
+ MCAuto<DataArrayIdType> _num_coords;
+ MCAuto<DataArrayIdType> _global_num_coords;
MCAuto<DataArrayAsciiChar> _name_coords;
};
void assignDefParts(const std::vector<const PartDefinition *>& partDefs);
void assignUMesh(MEDCouplingUMesh *m);
MEDCouplingUMesh *getUmesh() const;
- int getNumberOfCells() const;
+ mcIdType getNumberOfCells() const;
std::vector<MEDCoupling1GTUMesh *> getParts() const;
std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypes() const;
- int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
+ mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
std::vector<MEDCoupling1GTUMesh *> retrievePartsWithoutComputation() const;
MEDCoupling1GTUMesh *retrievePartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const;
- void getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const;
- void renumberNodesInConnWithoutComputation(const int *newNodeNumbersO2N);
+ void getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, mcIdType& start, mcIdType& stop) const;
+ void renumberNodesInConnWithoutComputation(const mcIdType *newNodeNumbersO2N);
bool isStoredSplitByType() const;
std::size_t getTimeOfThis() const;
std::size_t getHeapMemorySizeWithoutChildren() const;
void synchronizeTinyInfo(const MEDFileMesh& master) const;
bool empty() const;
int getMeshDimension() const;
- std::vector<int> getDistributionOfTypes() const;
- int getSize() const;
+ std::vector<mcIdType> getDistributionOfTypes() const;
+ mcIdType getSize() const;
void setCoords(DataArrayDouble *coords);
void forceComputationOfPartsFromUMesh() const;
const PartDefinition *getPartDefOfWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const;
- void serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const;
- void unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI);
+ void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const;
+ void unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI);
private:
std::size_t getTimeOfParts() const;
std::size_t getTimeOfUMesh() const;
void assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts);
void forceComputationOfParts() const;
bool empty() const;
- bool presenceOfOneFams(const std::vector<int>& ids) const;
+ bool presenceOfOneFams(const std::vector<mcIdType>& ids) const;
int getMeshDimension() const;
void simpleRepr(std::ostream& oss) const;
- int getSize() const;
- MEDCouplingUMesh *getFamilyPart(const int *idsBg, const int *idsEnd, bool renum) const;
- DataArrayInt *getFamilyPartArr(const int *idsBg, const int *idsEnd, bool renum) const;
+ mcIdType getSize() const;
+ MEDCouplingUMesh *getFamilyPart(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const;
+ DataArrayIdType *getFamilyPartArr(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const;
MEDCouplingUMesh *getWholeMesh(bool renum) const;
- int getNumberOfCells() const;
+ mcIdType getNumberOfCells() const;
bool isMeshStoredSplitByType() const { return _m_by_types.isStoredSplitByType(); }
std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypes() const;
- int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
+ mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
std::vector<MEDCoupling1GTUMesh *> getDirectUndergroundSingleGeoTypeMeshes() const { return _m_by_types.retrievePartsWithoutComputation(); }
MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const { return _m_by_types.retrievePartWithoutComputation(gt); }
- DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
- DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
- std::vector<int> getDistributionOfTypes() const { return _m_by_types.getDistributionOfTypes(); }
- DataArrayInt *getOrCreateAndGetFamilyField();
- const DataArrayInt *getFamilyField() const;
- const DataArrayInt *getNumberField() const;
+ DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ std::vector<mcIdType> getDistributionOfTypes() const { return _m_by_types.getDistributionOfTypes(); }
+ DataArrayIdType *getOrCreateAndGetFamilyField();
+ const DataArrayIdType *getFamilyField() const;
+ const DataArrayIdType *getNumberField() const;
const DataArrayAsciiChar *getNameField() const;
- const DataArrayInt *getRevNumberField() const;
+ const DataArrayIdType *getRevNumberField() const;
const PartDefinition *getPartDef(INTERP_KERNEL::NormalizedCellType gt) const;
void eraseFamilyField();
- void setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,int>& familyIds,
+ void setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,mcIdType>& familyIds,
std::map<std::string, std::vector<std::string> >& groups);
void write(med_idt fid, const std::string& mName, int mdim) const;
//
- void setFamilyArr(DataArrayInt *famArr);
- DataArrayInt *getFamilyField();
- void setRenumArr(DataArrayInt *renumArr);
+ void setFamilyArr(DataArrayIdType *famArr);
+ DataArrayIdType *getFamilyField();
+ void setRenumArr(DataArrayIdType *renumArr);
void setNameArr(DataArrayAsciiChar *nameArr);
- void changeFamilyIdArr(int oldId, int newId);
+ void changeFamilyIdArr(mcIdType oldId, mcIdType newId);
//
- void renumberNodesInConn(const int *newNodeNumbersO2N);
+ void renumberNodesInConn(const mcIdType *newNodeNumbersO2N);
//
- void serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const;
- void unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI);
+ void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const;
+ void unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI);
//
static void ClearNonDiscrAttributes(const MEDCouplingMesh *tmp);
- static std::vector<int> GetNewFamiliesNumber(int nb, const std::map<std::string,int>& families);
- static void TraduceFamilyNumber(const std::vector< std::vector<int> >& fidsGrps, std::map<std::string,int>& familyIds,
- std::map<int,int>& famIdTrad, std::map<int,std::string>& newfams);
- static DataArrayInt *Renumber(const DataArrayInt *renum, const DataArrayInt *da);
- static MEDCouplingUMesh *Renumber2(const DataArrayInt *renum, MEDCouplingUMesh *m, const int *cellIds);
- static MEDFileUMeshSplitL1 *Unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI);
+ static std::vector<mcIdType> GetNewFamiliesNumber(mcIdType nb, const std::map<std::string,mcIdType>& families);
+ static void TraduceFamilyNumber(const std::vector< std::vector<mcIdType> >& fidsGrps, std::map<std::string,mcIdType>& familyIds,
+ std::map<mcIdType,mcIdType>& famIdTrad, std::map<mcIdType,std::string>& newfams);
+ static DataArrayIdType *Renumber(const DataArrayIdType *renum, const DataArrayIdType *da);
+ static MEDCouplingUMesh *Renumber2(const DataArrayIdType *renum, MEDCouplingUMesh *m, const mcIdType *cellIds);
+ static MEDFileUMeshSplitL1 *Unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI);
private:
MEDFileUMeshSplitL1();
void assignCommonPart();
- MEDCouplingUMesh *renumIfNeeded(MEDCouplingUMesh *m, const int *cellIds) const;
- DataArrayInt *renumIfNeededArr(const DataArrayInt *da) const;
+ MEDCouplingUMesh *renumIfNeeded(MEDCouplingUMesh *m, const mcIdType *cellIds) const;
+ DataArrayIdType *renumIfNeededArr(const DataArrayIdType *da) const;
void computeRevNum() const;
private:
MEDFileUMeshAggregateCompute _m_by_types;
- MCAuto<DataArrayInt> _fam;
- MCAuto<DataArrayInt> _num;
- MCAuto<DataArrayInt> _global_num;
+ MCAuto<DataArrayIdType> _fam;
+ MCAuto<DataArrayIdType> _num;
+ MCAuto<DataArrayIdType> _global_num;
MCAuto<DataArrayAsciiChar> _names;
- mutable MCAuto<DataArrayInt> _rev_num;
+ mutable MCAuto<DataArrayIdType> _rev_num;
MEDFileUMeshPermCompute _m;
};
public:
static MEDFileEltStruct4Mesh *New(med_idt fid, const std::string& mName, int dt, int it, int iterOnStEltOfMesh, MEDFileMeshReadSelector *mrs);
std::string getGeoTypeName() const { return _geo_type_name; }
- MCAuto<DataArrayInt> getConn() const { return _conn; }
+ MCAuto<DataArrayIdType> getConn() const { return _conn; }
MCAuto<MEDFileUMeshPerTypeCommon> getMeshDef() const { return _common; }
const std::vector< MCAuto<DataArray> >& getVars() const { return _vars; }
private:
private:
std::string _geo_type_name;
int _geo_type;
- MCAuto<DataArrayInt> _conn;
+ MCAuto<DataArrayIdType> _conn;
MCAuto<MEDFileUMeshPerTypeCommon> _common;
std::vector< MCAuto<DataArray> > _vars;
};
MEDFileMeshSupports::MEDFileMeshSupports(med_idt fid)
{
- int nbSM(MEDnSupportMesh(fid));
+ med_int nbSM(MEDnSupportMesh(fid));
_supports.resize(nbSM);
for(int i=0;i<nbSM;i++)
{
INTERP_KERNEL::AutoPtr<char> msn(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> description(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
med_axis_type axType;
- int nAxis(MEDsupportMeshnAxis(fid,i+1));
+ med_int nAxis(MEDsupportMeshnAxis(fid,i+1));
INTERP_KERNEL::AutoPtr<char> axisName(new char[MED_SNAME_SIZE*nAxis+1]),axisUnit(new char[MED_SNAME_SIZE*nAxis+1]);
- int spaceDim(0),meshDim(0);
+ med_int spaceDim(0),meshDim(0);
MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,i+1,msn,&spaceDim,&meshDim,description,&axType,axisName,axisUnit));
std::string name(MEDLoaderBase::buildStringFromFortran(msn,MED_NAME_SIZE));
_supports[i]=MEDFileUMesh::New(fid,name);
throw INTERP_KERNEL::Exception(oss.str());
}
-int MEDFileMeshSupports::getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const
+mcIdType MEDFileMeshSupports::getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const
{
const MEDFileUMesh *sup(getSupMeshWithName(name));
switch(entity)
MEDLOADER_EXPORT void writeLL(med_idt fid) const;
MEDLOADER_EXPORT std::vector<std::string> getSupMeshNames() const;
MEDLOADER_EXPORT const MEDFileUMesh *getSupMeshWithName(const std::string& name) const;
- MEDLOADER_EXPORT int getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const;
private:
MEDFileMeshSupports(med_idt fid);
MEDFileMeshSupports();
#include "MEDFileParameter.hxx"
#include "MEDFileSafeCaller.txx"
#include "MEDLoaderBase.hxx"
+#include "MEDFileBasis.hxx"
#include "InterpKernelAutoPtr.hxx"
std::ostringstream oss; oss << "MEDFileParameterDouble1TS::finishLoading : no specified time step (" << dt << "," << it << ") ! Time steps available : ";
for(int i=0;i<nbOfSteps;i++)
{
- int locDt,locIt;
+ med_int locDt,locIt;
double tim;
MEDFILESAFECALLERRD0(MEDparameterComputationStepInfo,(fid,name.c_str(),i+1,&locDt,&locIt,&tim));
if(dt==locDt && it==locIt)
{
- _iteration=locDt; _order=locIt; _time=tim;
+ _iteration=FromMedInt<int>(locDt); _order=FromMedInt<int>(locIt); _time=tim;
MEDFILESAFECALLERRD0(MEDparameterValueRd,(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr)));
return ;
}
void MEDFileParameterDouble1TSWTI::finishLoading(med_idt fid, const std::string& name, int timeStepId)
{
- int locDt,locIt;
+ med_int locDt,locIt;
double dt;
MEDFILESAFECALLERRD0(MEDparameterComputationStepInfo,(fid,name.c_str(),timeStepId+1,&locDt,&locIt,&dt));
- _iteration=locDt; _order=locIt; _time=dt;
+ _iteration=FromMedInt<int>(locDt); _order=FromMedInt<int>(locIt); _time=dt;
MEDFILESAFECALLERRD0(MEDparameterValueRd,(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr)));
}
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
- int nbPar=MEDnParameter(fid);
+ med_int nbPar=MEDnParameter(fid);
std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : ";
INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
INTERP_KERNEL::AutoPtr<char> descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
med_parameter_type paramType;
for(int i=0;i<nbPar;i++)
{
- int nbOfSteps;
+ med_int nbOfSteps;
MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
if(paramNameCpp==paramName && paramType==MED_FLOAT64)
_dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE);
_name=paramNameCpp;
_desc_name=MEDLoaderBase::buildStringFromFortran(descName,MED_COMMENT_SIZE);
- finishLoading(fid,_name,dt,it,nbOfSteps);
+ finishLoading(fid,_name,dt,it,FromMedInt<int>(nbOfSteps));
return ;
}
else
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
- int nbPar=MEDnParameter(fid);
+ med_int nbPar=MEDnParameter(fid);
std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : ";
INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
INTERP_KERNEL::AutoPtr<char> descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
med_parameter_type paramType;
for(int i=0;i<nbPar;i++)
{
- int nbOfSteps;
+ med_int nbOfSteps;
MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
if(paramNameCpp==paramName && paramType==MED_FLOAT64)
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
- int nbPar=MEDnParameter(fid);
+ med_int nbPar=MEDnParameter(fid);
if(nbPar<1)
{
std::ostringstream oss2; oss2 << "No parameter in file \"" << fileName << "\" !";
INTERP_KERNEL::AutoPtr<char> descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
INTERP_KERNEL::AutoPtr<char> unitName=MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE);
med_parameter_type paramType;
- int nbOfSteps;
+ med_int nbOfSteps;
MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
if(paramType==MED_FLOAT64)
MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid)
{
- int nbPar(MEDnParameter(fid));
+ med_int nbPar(MEDnParameter(fid));
if(nbPar<1)
{
std::ostringstream oss; oss << "MEDFileParameterMultiTS : no parameter in file \"" << FileNameFromFID(fid) << "\" !" ;
INTERP_KERNEL::AutoPtr<char> descName(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
INTERP_KERNEL::AutoPtr<char> unitName(MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE));
med_parameter_type paramType;
- int nbOfSteps;
+ med_int nbOfSteps;
MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE));
_dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE);
_name=paramNameCpp;
_desc_name=MEDLoaderBase::buildStringFromFortran(descName,MED_COMMENT_SIZE);
- finishLoading(fid,paramType,nbOfSteps);
+ finishLoading(fid,paramType,FromMedInt<int>(nbOfSteps));
}
MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid, const std::string& paramName)
{
- int nbPar(MEDnParameter(fid));
+ med_int nbPar(MEDnParameter(fid));
std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : ";
INTERP_KERNEL::AutoPtr<char> pName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> descName(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
med_parameter_type paramType;
for(int i=0;i<nbPar;i++)
{
- int nbOfSteps;
+ med_int nbOfSteps;
MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE));
if(paramNameCpp==paramName)
_dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE);
_name=paramNameCpp;
_desc_name=MEDLoaderBase::buildStringFromFortran(descName,MED_COMMENT_SIZE);
- finishLoading(fid,paramType,nbOfSteps);
+ finishLoading(fid,paramType,FromMedInt<int>(nbOfSteps));
return ;
}
else
_param_per_ts.resize(nbOfSteps);
for(int i=0;i<nbOfSteps;i++)
{
- int dt,it;
+ med_int dt,it;
double tim;
MEDFILESAFECALLERRD0(MEDparameterComputationStepInfo,(fid,_name.c_str(),i+1,&dt,&it,&tim));
switch(typ)
{
case MED_FLOAT64:
- _param_per_ts[i]=MEDFileParameterDouble1TSWTI::New(dt,it,tim);
+ _param_per_ts[i]=MEDFileParameterDouble1TSWTI::New(FromMedInt<int>(dt),FromMedInt<int>(it),tim);
_param_per_ts[i]->readValue(fid,_name.c_str());
break;
/*case MED_INT32;
MEDFileParameters::MEDFileParameters(med_idt fid)
{
- int nbPar=MEDnParameter(fid);
+ med_int nbPar=MEDnParameter(fid);
_params.resize(nbPar);
INTERP_KERNEL::AutoPtr<char> pName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> descName(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
med_parameter_type paramType;
for(int i=0;i<nbPar;i++)
{
- int nbOfSteps;
+ med_int nbOfSteps;
MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE));
_params[i]=MEDFileParameterMultiTS::New(fid,paramNameCpp);
std::string modelName(getModelName());
INTERP_KERNEL::AutoPtr<char> constattname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),profilename(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
med_attribute_type constatttype;
- int nbCompo;
+ med_int nbCompo;
med_entity_type met;
- int pflSz;
- MEDFILESAFECALLERRD0(MEDstructElementConstAttInfo,(fid,modelName.c_str(),idCstAtt+1,constattname,&constatttype,&nbCompo,&met,profilename,&pflSz));
+ med_int miPflSz;
+ MEDFILESAFECALLERRD0(MEDstructElementConstAttInfo,(fid,modelName.c_str(),idCstAtt+1,constattname,&constatttype,&nbCompo,&met,profilename,&miPflSz));
std::string name(MEDLoaderBase::buildStringFromFortran(constattname,MED_NAME_SIZE));
setName(name);
setProfile(MEDLoaderBase::buildStringFromFortran(profilename,MED_NAME_SIZE));
_tof=MEDFileMesh::ConvertFromMEDFileEntity(met);
//
_val=MEDFileStructureElement::BuildFrom(constatttype);
- nbCompo=MEDFileStructureElement::EffectiveNbCompo(constatttype,nbCompo);
+ nbCompo=MEDFileStructureElement::EffectiveNbCompo(constatttype,FromMedInt<int>(nbCompo));
+ mcIdType pflSz = miPflSz;
if(pflSz==0 && getProfile().empty())
{
switch(met)
INTERP_KERNEL::AutoPtr<char> varattname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),profilename(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
med_attribute_type varatttype;
{
- int pflSz;
- MEDFILESAFECALLERRD0(MEDstructElementVarAttInfo,(fid,modelName.c_str(),idVarAtt+1,varattname,&varatttype,&_nb_compo));
+ //int pflSz;
+ med_int nbComp;
+ MEDFILESAFECALLERRD0(MEDstructElementVarAttInfo,(fid,modelName.c_str(),idVarAtt+1,varattname,&varatttype,&nbComp));
+ _nb_compo=FromMedInt<int>(nbComp);
}
setName(MEDLoaderBase::buildStringFromFortran(varattname,MED_NAME_SIZE));
_gen=MEDFileStructureElement::BuildFrom(varatttype);
INTERP_KERNEL::AutoPtr<char> modelName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),supportMeshName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
med_geometry_type sgeoType;
med_entity_type entiyType;
- int nConsAttr(0),nVarAttr(0);
+ med_int nConsAttr(0),nVarAttr(0);
{
med_bool anyPfl;
- int nnode(0),ncell(0);
- MEDFILESAFECALLERRD0(MEDstructElementInfo,(fid,idSE+1,modelName,&_id_type,&_dim,supportMeshName,&entiyType,&nnode,&ncell,&sgeoType,&nConsAttr,&anyPfl,&nVarAttr));
+ med_int nnode(0),ncell(0),dim(0);
+ med_geometry_type idType;
+ MEDFILESAFECALLERRD0(MEDstructElementInfo,(fid,idSE+1,modelName,&idType,&dim,supportMeshName,&entiyType,&nnode,&ncell,&sgeoType,&nConsAttr,&anyPfl,&nVarAttr));
+ _id_type=(int)idType;
+ _dim=FromMedInt<int>(dim);
}
_name=MEDLoaderBase::buildStringFromFortran(modelName,MED_NAME_SIZE);
_sup_mesh_name=MEDLoaderBase::buildStringFromFortran(supportMeshName,MED_NAME_SIZE);
MEDFileStructureElements::MEDFileStructureElements(med_idt fid, const MEDFileMeshSupports *ms)
{
- int nbSE(MEDnStructElement(fid));
+ med_int nbSE(MEDnStructElement(fid));
_elems.resize(nbSE);
for(int i=0;i<nbSE;i++)
_elems[i]=MEDFileStructureElement::New(fid,i,ms);
int MEDFileStructureElements::getNumberOf() const
{
- return _elems.size();
+ return (int)_elems.size();
}
std::vector<int> MEDFileStructureElements::getDynGTAvail() const
throw INTERP_KERNEL::Exception(oss.str());
}
-int MEDFileStructureElements::getNumberOfNodesPerSE(const std::string& seName) const
+mcIdType MEDFileStructureElements::getNumberOfNodesPerSE(const std::string& seName) const
{
if(seName=="MED_PARTICLE")
return 1;
MEDLOADER_EXPORT int getNumberOf() const;
MEDLOADER_EXPORT std::vector<int> getDynGTAvail() const;
MEDLOADER_EXPORT const MEDFileStructureElement *getWithGT(int idGT) const;
- MEDLOADER_EXPORT int getNumberOfNodesPerSE(const std::string& seName) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfNodesPerSE(const std::string& seName) const;
MEDLOADER_EXPORT const MEDFileStructureElement *getSEWithName(const std::string& seName) const;
MEDLOADER_EXPORT std::vector<std::string> getVarAttsOf(const std::string& seName) const;
MEDLOADER_EXPORT const MEDFileSEVarAtt *getVarAttOf(const std::string &seName, const std::string& varName) const;
#include "MEDFileSafeCaller.txx"
#include "MEDLoaderBase.hxx"
#include "MEDLoader.hxx"
+#include "MEDFileBasis.hxx"
#include "InterpKernelAutoPtr.hxx"
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
oss << " has been detected readable but ";
- int major,minor,release;
+ med_int major,minor,release;
MEDfileNumVersionRd(fid,&major,&minor,&release);
if(major<2 || (major==2 && minor<2))
{
std::string MEDCoupling::MEDFileWritable::FileNameFromFID(med_idt fid)
{
- int lgth(MEDfileName(fid,0,0));
+ med_int lgth(MEDfileName(fid,0,0));
if(lgth<=0)
return std::string();
INTERP_KERNEL::AutoPtr<char> tmp(new char[lgth+1]);
med_access_mode medmod(MEDFileUtilities::TraduceWriteMode(mode));
MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),medmod));
std::ostringstream oss; oss << "MEDFileWritableStandAlone : error on attempt to write in file : \"" << fileName << "\"";
- MEDFileUtilities::CheckMEDCode(fid,fid,oss.str());
+ MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str());
writeLL(fid);
}
med_mesh_type type_maillage;
med_int Sdim,Mdim;
std::string trueMeshName;
- med_int meshId=getIdFromMeshName(fid,meshName,trueMeshName);
+ int meshId=FromMedInt<int>(getIdFromMeshName(fid,meshName,trueMeshName));
INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
med_sorting_type sortingType;
med_int nstep;
med_axis_type axisType;
- int naxis(MEDmeshnAxis(fid,meshId));
+ med_int naxis(MEDmeshnAxis(fid,meshId));
INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&Sdim,&Mdim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit));
{
med_geometry_type curMedType=typmai[i];
med_bool changement,transformation;
- int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
- int curNbOfElemF(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));//limitation
- int curNbOfElem;
+ med_int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ med_int curNbOfElemF(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));//limitation
+ med_int curNbOfElem;
med_entity_type whichEntity;
MEDLoaderNS::dispatchElems(curNbOfElemM,curNbOfElemF,curNbOfElem,whichEntity);
if(curNbOfElem>0)
return ret;
}
-med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName)
- {
+int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName)
+{
if(meshName.empty())
{
std::vector<std::string> meshes=getMeshNamesFid(fid);
throw INTERP_KERNEL::Exception(os2.str().c_str());
}
trueMeshName=meshName;
- return iter-meshes.begin()+1;
- }
+ return (int)( iter-meshes.begin()+1 );
+}
std::vector<std::string> MEDLoaderNS::getMeshNamesFid(med_idt fid)
{
std::vector<std::string> ret(n);
for(int i=0;i<n;i++)
{
- int naxis(MEDmeshnAxis(fid,i+1));
+ med_int naxis(MEDmeshnAxis(fid,i+1));
INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
- int nstep;
+ med_int nstep;
MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,i+1,nommaa,&space_dim,&mesh_dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit));
std::string cur=MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa));
ret[i]=cur;
/*!
* This methods allows to merger all entities and to considerate only cell types.
*/
-void MEDLoaderNS::dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entity_type& whichEntity)
+void MEDLoaderNS::dispatchElems(med_int nbOfElemCell, med_int nbOfElemFace, med_int& nbOfElem, med_entity_type& whichEntity)
{
if(nbOfElemCell>=nbOfElemFace)
{
med_err ret(MEDlibraryNumVersion(&majj,&minn,&rell));
if(ret!=0)
throw INTERP_KERNEL::Exception("MEDFileVersion : fail to call MEDlibraryNumVersion ! It looks very bad !");
- major=majj;
- minor=minn;
- release=rell;
+ major=FromMedInt<int>(majj);
+ minor=FromMedInt<int>(minn);
+ release=FromMedInt<int>(rell);
}
/*!
* - the space dimension
* - the number of nodes
*/
-std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > MEDCoupling::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes)
+std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > MEDCoupling::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, mcIdType& numberOfNodes)
{
MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
std::set<int> poss;
char maillage_description[MED_COMMENT_SIZE+1];
med_mesh_type type_maillage;
std::string trueMeshName;
- med_int meshId=MEDLoaderNS::getIdFromMeshName(fid,meshName,trueMeshName);
+ int meshId=MEDLoaderNS::getIdFromMeshName(fid,meshName,trueMeshName);
INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
med_sorting_type sortingType;
- med_int nstep;
+ med_int nstep, mDim, sDim;
med_axis_type axisType;
- int naxis(MEDmeshnAxis(fid,meshId));
+ med_int naxis(MEDmeshnAxis(fid,meshId));
INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
- MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&spaceDim,&meshDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit));
+ MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&sDim,&mDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit));
+ meshDim=FromMedInt<int>(mDim);
+ spaceDim=FromMedInt<int>(sDim);
if(type_maillage!=MED_UNSTRUCTURED_MESH)
{
std::ostringstream oss; oss << "GetUMeshGlobalInfo : Mesh \""<< meshName << "\" in file \"" << fileName;
for(int i=0;i<MED_N_CELL_FIXED_GEO;i++)
{
med_geometry_type curMedType=typmai[i];
- int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ med_int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
if(curNbOfElemM>0)
{
INTERP_KERNEL::NormalizedCellType typp=typmai2[i];
{
ret[maxLev-dims[i]].push_back(geoTypes[i]);
}
- numberOfNodes=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation);
+ numberOfNodes=ToIdType(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
return ret;
}
med_int numfam;
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
bool found=false;
for(int i=0;i<nfam && !found;i++)
{
- int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
- int profilesize,nbi;
+ med_int profilesize,nbi;
if(curMeshName==meshName)
{
bool found=false;
std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
if(nbPdt>0)
{
- int profilesize,nbi;
+ med_int profilesize,nbi;
MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,1,&numdt,&numo,&dt));
med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
pflname,&profilesize,locname,&nbi));
{
for(int k=0;k<nbPdt;k++)
{
- int profilesize,nbi;
+ med_int profilesize,nbi;
MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,k+1,&numdt,&numo,&dt));
med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
pflname,&profilesize,locname,&nbi));
{
for(int k=0;k<nbPdt;k++)
{
- int profilesize,nbi;
+ med_int profilesize,nbi;
MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,k+1,&numdt,&numo,&dt));
med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
pflname,&profilesize,locname,&nbi));
if(!mmuPtr)
throw INTERP_KERNEL::Exception("ReadFieldsOnSameMesh : only unstructured mesh is managed !");
MCAuto<MEDCouplingUMesh> m=mmuPtr->getMeshAtLevel(meshDimRelToMax);
- const DataArrayInt *o2n=mmuPtr->getNumberFieldAtLevel(meshDimRelToMax);
+ const DataArrayIdType *o2n=mmuPtr->getNumberFieldAtLevel(meshDimRelToMax);
MCAuto<MEDCouplingUMesh> m2(m->clone(true));
if(o2n)
m2->renumberCells(o2n->begin(),true);
MCAuto<typename Traits<T>::FieldType> ret(ff->getFieldOnMeshAtLevel(type,m));
if(muPtr.isNotNull())
{
- const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
+ const DataArrayIdType *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
if(num)
ret->renumberCells(num->begin());
}
{
if(muPtr.isNotNull())
{
- const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
+ const DataArrayIdType *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
if(num)
ret->renumberCells(num->begin());
}
}
else
{
- DataArrayInt *pfl(nullptr),*arr2(nullptr);
+ DataArrayIdType *pfl(nullptr),*arr2(nullptr);
MCAuto<typename Traits<T>::ArrayType> arr(ff->getFieldWithProfile(ON_NODES,meshDimRelToMax,mm,pfl));
- MCAuto<DataArrayInt> pflSafe(pfl);
- MCAuto<DataArrayInt> mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end()));
+ MCAuto<DataArrayIdType> pflSafe(pfl);
+ MCAuto<DataArrayIdType> mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end()));
MCAuto<MEDCouplingUMesh> mzip(static_cast<MEDCouplingUMesh *>(m->buildPartAndReduceNodes(mp->begin(),mp->end(),arr2)));
- MCAuto<DataArrayInt> arr2Safe(arr2);
- MCAuto<DataArrayInt> arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes()));
- MCAuto<DataArrayInt> pflSorted(pflSafe->deepCopy()); pflSorted->sort(true);
+ MCAuto<DataArrayIdType> arr2Safe(arr2);
+ MCAuto<DataArrayIdType> arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes()));
+ MCAuto<DataArrayIdType> pflSorted(pflSafe->deepCopy()); pflSorted->sort(true);
if(!arr3->isEqualWithoutConsideringStr(*pflSorted))
throw INTERP_KERNEL::Exception("ReadFieldNode : not implemented yet !");
if(!arr3->isEqualWithoutConsideringStr(*pflSafe))
{
- MCAuto<DataArrayInt> o2n2(pflSafe->checkAndPreparePermutation());
- MCAuto<DataArrayInt> n2o2(o2n2->invertArrayO2N2N2O(o2n2->getNumberOfTuples()));
+ MCAuto<DataArrayIdType> o2n2(pflSafe->checkAndPreparePermutation());
+ MCAuto<DataArrayIdType> n2o2(o2n2->invertArrayO2N2N2O(o2n2->getNumberOfTuples()));
mzip->renumberNodes(n2o2->begin(),n2o2->getNumberOfTuples());
arr->setName("");
ret->setArray(arr);
{
MCAuto<MEDFileUMesh> mmu(MEDFileUMesh::New());
AssignStaticWritePropertiesTo(*mmu);
- MCAuto<DataArrayInt> o2n(um->getRenumArrForMEDFileFrmt());
- MCAuto<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples()));
+ MCAuto<DataArrayIdType> o2n(um->getRenumArrForMEDFileFrmt());
+ MCAuto<DataArrayIdType> n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples()));
f2->renumberCells(o2n->begin(),false);
mmu->setMeshAtLevel(0,const_cast<MEDCouplingUMesh *>(static_cast<const MEDCouplingUMesh *>(f2->getMesh())));
mmu->setRenumFieldArr(0,n2o);
MEDCouplingUMesh *m(dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh())));
if(!m)
throw INTERP_KERNEL::Exception("WriteField : only umesh in input field supported !");
- MCAuto<DataArrayInt> o2n(m->getRenumArrForMEDFileFrmt());
+ MCAuto<DataArrayIdType> o2n(m->getRenumArrForMEDFileFrmt());
f2->renumberCells(o2n->begin(),false);
m=static_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
MCAuto<MEDCouplingUMesh> mread(mmuPtr->getMeshAtLevel(m->getMeshDimension()-mm->getMeshDimension()));
m->tryToShareSameCoordsPermute(*mread,_EPS_FOR_NODE_COMP);
else
mread->setCoords(m->getCoords());
- DataArrayInt *part(NULL);
+ DataArrayIdType *part(NULL);
bool b(mread->areCellsIncludedIn(m,_COMP_FOR_CELL,part));
- MCAuto<DataArrayInt> partSafe(part);
+ MCAuto<DataArrayIdType> partSafe(part);
if(!b)
{
std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart) with the mesh you intend to write ! This is maybe due to a too strict policy ! Try with to lease it by calling SetCompPolicyForCell !";
}
else
{
- DataArrayInt *part(NULL);
+ DataArrayIdType *part(NULL);
bool b(mread->getCoords()->areIncludedInMe(m->getCoords(),_EPS_FOR_NODE_COMP,part));
- MCAuto<DataArrayInt> partSafe(part);
+ MCAuto<DataArrayIdType> partSafe(part);
if(!b)
{
std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart regarding nodes) with the mesh you intend to write ! This is maybe due to a too strict epsilon ! Try with to lease it by calling SetEpsilonForNodeComp !";
MEDCouplingUMesh *m(dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f->getMesh())));
if(m)
{
- MCAuto<DataArrayInt> o2n(m->getRenumArrForMEDFileFrmt());
+ MCAuto<DataArrayIdType> o2n(m->getRenumArrForMEDFileFrmt());
MCAuto< typename MEDCoupling::Traits<T>::FieldType > f2(f->deepCopy());
f2->renumberCells(o2n->begin(),false);
f1ts->setFieldNoProfileSBT(f2);
#include "MEDCouplingRefCountObject.hxx"
#include "NormalizedUnstructuredMesh.hxx"
#include "MCAuto.hxx"
+#include "MCIdType.hxx"
#include <list>
#include <vector>
MEDLOADER_EXPORT void MEDFileVersion(int& major, int& minor, int& release);
MEDLOADER_EXPORT void CheckFileForRead(const std::string& fileName);
MEDLOADER_EXPORT std::vector<std::string> GetMeshNames(const std::string& fileName);
- MEDLOADER_EXPORT std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes);
+ MEDLOADER_EXPORT std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, mcIdType& numberOfNodes);
MEDLOADER_EXPORT std::vector< std::pair<std::string,std::string> > GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName);
MEDLOADER_EXPORT std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName);
MEDLOADER_EXPORT std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName);
return EXIST_RW;
}
-char *MEDLoaderBase::buildEmptyString(int lgth)
+char *MEDLoaderBase::buildEmptyString(std::size_t lgth)
{
char *ret=new char[lgth+1];
std::fill(ret,ret+lgth,' ');
return ;
}
}
- int n(strlen(src));
+ std::size_t n(strlen(src));
std::fill(dest,dest+maxLgth,' ');
strncpy(dest,src,n);
}
{
public:
static int getStatusOfFile(const std::string& fileName);
- static char *buildEmptyString(int lgth);
+ static char *buildEmptyString(std::size_t lgth);
static void getDirAndBaseName(const std::string& fullName, std::string& dirName, std::string& baseName);
static std::string getPathSep();
static std::string joinPath(const std::string& dirName, const std::string& baseName);
namespace MEDLoaderNS
{
int readUMeshDimFromFile(const std::string& fileName, const std::string& meshName, std::vector<int>& possibilities);
- void dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entity_type& whichEntity);
+ void dispatchElems(med_int nbOfElemCell, med_int nbOfElemFace, med_int& nbOfElem, med_entity_type& whichEntity);
template<class T>
void writeFieldWithoutReadingAndMappingOfMeshInFile(const std::string& fileName, const typename MEDCoupling::Traits<T>::FieldType *f, bool writeFromScratch);
- med_int getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName);
+ int getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName);
std::vector<std::string> getMeshNamesFid(med_idt fid);
}
TInt GetNbRef() const { return myNbRef; }
- TCoordSlice GetCoord(TInt theRefId) { return &myRefCoord[0] + theRefId * myDim; }
+ TCoordSlice GetCoord(std::size_t theRefId) { return &myRefCoord[0] + theRefId * myDim; }
};
//---------------------------------------------------------------
/*!
TGaussDef(const int geomType, const int nbPoints, const int variant=1);
int dim() const { return SauvUtilities::getDimension( NormalizedCellType( myType )); }
- int nbPoints() const { return myWeights.capacity(); }
+ std::size_t nbPoints() const { return myWeights.capacity(); }
private:
void add(const double x, const double weight);
THexa20a::THexa20a(TInt theDim, TInt theNbRef):
TShapeFun(theDim,theNbRef)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break;
THexa27a::THexa27a():
THexa20a(3,27)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 20: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = -1.0; break;
THexa20b::THexa20b(TInt theDim, TInt theNbRef):
TShapeFun(theDim,theNbRef)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break;
TPenta6a::TPenta6a():
TShapeFun(3,6)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
TPenta6b::TPenta6b():
TShapeFun(3,6)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
TPenta15a::TPenta15a():
TShapeFun(3,15)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
TPenta15b::TPenta15b():
TShapeFun(3,15)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
TPyra5a::TPyra5a():
TShapeFun(3,5)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
TPyra5b::TPyra5b():
TShapeFun(3,5)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
TPyra13a::TPyra13a():
TShapeFun(3,13)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
TPyra13b::TPyra13b():
TShapeFun(3,13)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
{
if ( ma._sortedNodeIDs )
{
- _sortedNodeIDs = new int[ _nodes.size() ];
+ _sortedNodeIDs = new TID[ _nodes.size() ];
std::copy( ma._sortedNodeIDs, ma._sortedNodeIDs + _nodes.size(), _sortedNodeIDs );
}
}
SauvUtilities::Link Cell::link(int i) const
{
- int i2 = ( i + 1 ) % _nodes.size();
+ std::size_t i2 = ( i + 1 ) % _nodes.size();
if ( _reverse )
return std::make_pair( _nodes[i2]->_number, _nodes[i]->_number );
else
if ( !_sortedNodeIDs )
{
size_t l=_nodes.size();
- _sortedNodeIDs = new int[ l ];
+ _sortedNodeIDs = new TID[ l ];
for (size_t i=0; i!=l; ++i)
_sortedNodeIDs[i]=_nodes[i]->_number;
if ( _nodes.size() == 1 )
return _nodes[0] < ma._nodes[0];
- const int* v1 = getSortedNodes();
- const int* v2 = ma.getSortedNodes();
- for ( const int* vEnd = v1 + _nodes.size(); v1 < vEnd; ++v1, ++v2 )
+ const TID* v1 = getSortedNodes();
+ const TID* v2 = ma.getSortedNodes();
+ for ( const TID* vEnd = v1 + _nodes.size(); v1 < vEnd; ++v1, ++v2 )
if(*v1 != *v2)
return *v1 < *v2;
return false;
*/
//================================================================================
-int Group::size() const
+mcIdType Group::size() const
{
- int sizze = 0;
+ std::size_t sizze = 0;
if ( !_relocTable.empty() )
sizze = _relocTable.size();
else if ( _medGroup )
else
for ( size_t i = 0; i < _groups.size(); ++i )
sizze += _groups[i]->size();
- return sizze;
+ return ToIdType( sizze );
}
//================================================================================
bool aResult = true;
// Check the state of the buffer;
// if there is too little left, read the next portion of data
- int nBytesRest = _eptr - _ptr;
+ std::size_t nBytesRest = _eptr - _ptr;
if (nBytesRest < GIBI_MaxOutputLen)
{
if (nBytesRest > 0)
{
// move the remaining portion to the buffer beginning
- for ( int i = 0; i < nBytesRest; ++i )
+ for ( std::size_t i = 0; i < nBytesRest; ++i )
_start[i] = _ptr[i];
//memcpy (_tmpBuf, _ptr, nBytesRest);
//memcpy (_start, _tmpBuf, nBytesRest);
nBytesRest = 0;
}
_ptr = _start;
- const int nBytesRead = ::read (_file,
- &_start [nBytesRest],
- GIBI_BufferSize - nBytesRest);
+ const std::size_t nBytesRead = ::read (_file,
+ &_start [nBytesRest],
+ GIBI_BufferSize - nBytesRest);
nBytesRest += nBytesRead;
_eptr = &_start [nBytesRest];
}
float ASCIIReader::getFloat() const
{
- return getDouble();
+ return (float)getDouble();
}
//================================================================================
// correct pointers to sub-groups
for ( size_t j = 0; j < _groups[i]._groups.size(); ++j )
{
- int iG = _groups[i]._groups[j] - &_groups[0];
+ std::size_t iG = _groups[i]._groups[j] - &_groups[0];
newGroups[i]._groups[j] = & newGroups[ iG ];
}
}
for ( size_t i = 0; i < groupsToFix->size(); ++i )
if ( (*groupsToFix)[i] )
{
- int iG = (*groupsToFix)[i] - &_groups[0];
+ std::size_t iG = (*groupsToFix)[i] - &_groups[0];
(*groupsToFix)[i] = & newGroups[ iG ];
}
for ( size_t j = 0; j < fields[i]->_sub.size(); ++j )
if ( fields[i]->_sub[j]._support )
{
- int iG = fields[i]->_sub[j]._support - &_groups[0];
+ std::size_t iG = fields[i]->_sub[j]._support - &_groups[0];
fields[i]->_sub[j]._support = & newGroups[ iG ];
}
if ( fields[i]->_group )
{
- int iG = fields[i]->_group - &_groups[0];
+ std::size_t iG = fields[i]->_group - &_groups[0];
fields[i]->_group = & newGroups[ iG ];
}
}
if (medName.find( fields[ifi]->_name + "." ) == 0 )
{
std::vector<DoubleField::_Sub_data>& aSubDs = fields[ifi]->_sub;
- int nbSub = aSubDs.size();
- for (int isu = 0; isu < nbSub; isu++)
+ std::size_t nbSub = aSubDs.size();
+ for (std::size_t isu = 0; isu < nbSub; isu++)
for (int ico = 0; ico < aSubDs[isu].nbComponents(); ico++)
{
if (aSubDs[isu].compName(ico) == gibiName)
for ( size_t j = 0; j < grp._cells.size(); ++j )
if ( faces.insert( grp._cells[j] ).second )
{
- for ( size_t k = 0; k < grp._cells[j]->_nodes.size(); ++k )
+ for ( unsigned int k = 0; k < grp._cells[j]->_nodes.size(); ++k )
linkFacesMap[ grp._cells[j]->link( k ) ].push_back( grp._cells[j] );
fgm.insert( std::make_pair( grp._cells[j], &grp ));
}
// check if re-numeration is needed (to try to keep elem oreder as in sauve file )
bool ok = true, renumEntity = false;
CellsByDimIterator cellsIt( *this, dim );
- int prevNbElems = 0;
+ mcIdType prevNbElems = 0;
while ( const std::set<Cell> * typeCells = cellsIt.nextType() )
{
TID minNumber = std::numeric_limits<TID>::max(), maxNumber = 0;
if ( elemIt->_number < minNumber ) minNumber = elemIt->_number;
if ( elemIt->_number > maxNumber ) maxNumber = elemIt->_number;
}
- TID typeSize = typeCells->size();
+ mcIdType typeSize = ToIdType( typeCells->size() );
if ( typeSize != maxNumber - minNumber + 1 )
ok = false;
if ( prevNbElems+1 != (int)minNumber )
if ( ok && renumEntity ) // each geom type was numerated separately
{
cellsIt.init( dim );
- prevNbElems = cellsIt.nextType()->size(); // no need to renumber the first type
+ prevNbElems = ToIdType( cellsIt.nextType()->size()); // no need to renumber the first type
while ( const std::set<Cell> * typeCells = cellsIt.nextType() )
{
for ( elemIt = typeCells->begin(), elemEnd = typeCells->end(); elemIt!=elemEnd; ++elemIt)
elemIt->_number += prevNbElems;
- prevNbElems += typeCells->size();
+ prevNbElems += ToIdType( typeCells->size() );
}
}
if ( !ok )
DataArrayDouble* coordArray = DataArrayDouble::New();
coordArray->alloc( _nbNodes, _spaceDim );
double * coordPrt = coordArray->getPointer();
- for ( int i = 0, nb = _points.size(); i < nb; ++i )
+ for ( unsigned int i = 0; i < _points.size(); ++i )
{
Node* n = getNode( i+1 );
if ( n->isUsed() )
{
CellsByDimIterator dimCells( *this, dim );
- int nbOfCells = 0;
+ mcIdType nbOfCells = 0;
while ( const std::set<Cell > * cells = dimCells.nextType() )
- nbOfCells += cells->size();
+ nbOfCells += ToIdType( cells->size() );
if ( nbOfCells == 0 )
continue;
dimMesh->setMeshDimension( dim );
dimMesh->allocateCells( nbOfCells );
- int prevNbCells = 0;
+ mcIdType prevNbCells = 0;
dimCells.init( dim );
while ( const std::set<Cell > * cells = dimCells.nextType() )
{
// fill connectivity array to take into account order of elements in the sauv file
- const int nbCellNodes = cells->begin()->_nodes.size();
+ const mcIdType nbCellNodes = ToIdType( cells->begin()->_nodes.size() );
std::vector< TID > connectivity( cells->size() * nbCellNodes );
- int * nodalConnOfCell;
+ TID * nodalConnOfCell;
for ( elemIt = cells->begin(), elemEnd = cells->end(); elemIt != elemEnd; ++elemIt )
{
const Cell& cell = *elemIt;
- const int index = cell._number - 1 - prevNbCells;
+ const TID index = cell._number - 1 - prevNbCells;
nodalConnOfCell = &connectivity[ index * nbCellNodes ];
if ( cell._reverse )
- for ( int i = nbCellNodes-1; i >= 0; --i )
+ for ( mcIdType i = nbCellNodes-1; i >= 0; --i )
*nodalConnOfCell++ = cell._nodes[i]->_number - 1;
else
- for ( int i = 0; i < nbCellNodes; ++i )
+ for ( mcIdType i = 0; i < nbCellNodes; ++i )
*nodalConnOfCell++ = cell._nodes[i]->_number - 1;
}
- prevNbCells += cells->size();
+ prevNbCells += ToIdType( cells->size() );
// fill dimMesh
TCellType cellType = dimCells.type();
{
const int meshDimRelToMaxExt = ( dim == 0 ? 1 : dim - meshDim );
- std::vector<const DataArrayInt *> medGroups;
- std::vector<MCAuto<DataArrayInt> > refGroups;
+ std::vector<const DataArrayIdType *> medGroups;
+ std::vector<MCAuto<DataArrayIdType> > refGroups;
for ( size_t i = 0; i < _groups.size(); ++i )
{
Group& grp = _groups[i];
}
}
// create a med group
- grp._medGroup = DataArrayInt::New();
+ grp._medGroup = DataArrayIdType::New();
grp._medGroup->setName( grp._name.c_str() );
grp._medGroup->alloc( cell2order.size(), /*nbOfCompo=*/1 );
- int * idsPtr = grp._medGroup->getPointer();
+ TID * idsPtr = grp._medGroup->getPointer();
TCellToOrderMap::iterator cell2orderIt, cell2orderEnd = cell2order.end();
for ( cell2orderIt = cell2order.begin(); cell2orderIt != cell2orderEnd; ++cell2orderIt )
*idsPtr++ = (*cell2orderIt).first->_number - 1;
{
int dim = getDim( grp );
- int nbElems = 0;
+ mcIdType nbElems = 0;
if ( dim == 0 )
{
nbElems = _nbNodes;
{
CellsByDimIterator dimCells( *this, dim );
while ( const std::set<Cell > * cells = dimCells.nextType() )
- nbElems += cells->size();
+ nbElems += ToIdType( cells->size() );
int meshDim = 3;
for ( ; meshDim > 0; --meshDim )
MEDFileFields* fields = MEDFileFields::New();
- for ( size_t i = 0; i < _nodeFields.size(); ++i )
+ for ( unsigned int i = 0; i < _nodeFields.size(); ++i )
setFields( _nodeFields[i], fields, mesh, i+1, usedFieldNames );
- for ( size_t i = 0; i < _cellFields.size(); ++i )
+ for ( unsigned int i = 0; i < _cellFields.size(); ++i )
setFields( _cellFields[i], fields, mesh, i+1, usedFieldNames );
return fields;
std::cout << "Castem field #" << castemID << " <" << fld->_name
<< "> is incompatible with MED format, so we split it into several fields:" << std::endl;
- for ( size_t iSub = 0; iSub < fld->_sub.size(); )
+ for ( unsigned int iSub = 0; iSub < fld->_sub.size(); )
{
// set field name
if ( !uniteSubs || fld->_name.empty() )
double * valPtr = values->getPointer();
if ( uniteSubs )
{
- int nbElems = fld->_group->size();
- for ( int elemShift = 0; elemShift < nbElems && iSub < fld->_sub.size(); )
+ mcIdType nbElems = fld->_group->size();
+ for ( mcIdType elemShift = 0; elemShift < nbElems && iSub < fld->_sub.size(); )
elemShift += fld->setValues( valPtr, iSub++, elemShift );
setTS( fld, values, medFields, mesh );
}
bool DoubleField::isMedCompatible(bool& sameNbGauss) const
{
- for ( size_t iSub = 0; iSub < _sub.size(); ++iSub )
+ for ( unsigned int iSub = 0; iSub < _sub.size(); ++iSub )
{
if ( !getSupport(iSub) || !getSupport(iSub)->_medGroup )
THROW_IK_EXCEPTION("SauvReader INTERNAL ERROR: NULL field support");
*/
//================================================================================
-int DoubleField::getNbTuples( const int iSub ) const
+mcIdType DoubleField::getNbTuples( const int iSub ) const
{
- int nb = 0;
+ mcIdType nb = 0;
if ( hasCommonSupport() && !_group->_groups.empty() )
for ( size_t i = 0; i < _group->_groups.size(); ++i )
nb += _sub[i].nbGauss() * _sub[i]._support->size();
*/
//================================================================================
-int DoubleField::setValues( double * valPtr, const int iSub, const int elemShift ) const
+mcIdType DoubleField::setValues( double * valPtr, const int iSub, const mcIdType elemShift ) const
{
// find values for iSub
int iComp = 0;
// Set values
- const std::vector< unsigned >& relocTable = getSupport( iSub )->_relocTable;
+ const std::vector< mcIdType >& relocTable = getSupport( iSub )->_relocTable;
- const int nbElems = _sub[iSub]._support->size();
+ const mcIdType nbElems = _sub[iSub]._support->size();
const int nbGauss = _sub[iSub].nbGauss();
const int nbComponents = _sub[iSub].nbComponents();
const int nbValsByElem = nbComponents * nbGauss;
// check nb values
- int nbVals = 0;
+ mcIdType nbVals = 0;
for ( iComp = 0; iComp < nbComponents; ++iComp )
- nbVals += compValues[iComp].size();
+ nbVals += ToIdType( compValues[iComp].size() );
const bool isConstField = ( nbVals == nbComponents ); // one value per component (issue 22321)
if ( !isConstField && nbVals != nbElems * nbValsByElem )
THROW_IK_EXCEPTION("SauvMedConvertor.cxx: support size mismatches field size");
// compute nb values in previous subs
- int valsShift = 0;
- for ( int iS = iSub-1, shift = elemShift; shift > 0; --iS)
+ mcIdType valsShift = 0;
+ for ( mcIdType iS = iSub-1, shift = elemShift; shift > 0; --iS)
{
- int nbE = _sub[iS]._support->size();
+ mcIdType nbE = _sub[iS]._support->size();
shift -= nbE;
valsShift += nbE * _sub[iS].nbComponents() * _sub[iS].nbGauss();
}
if ( isConstField )
- for ( int iE = 0; iE < nbElems; ++iE )
+ for ( mcIdType iE = 0; iE < nbElems; ++iE )
{
- int iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift );
+ mcIdType iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift );
for ( iComp = 0; iComp < nbComponents; ++iComp )
valPtr[ iMed + iComp ] = compValues[iComp][ 0 ];
}
else
- for ( int iE = 0; iE < nbElems; ++iE )
+ for ( mcIdType iE = 0; iE < nbElems; ++iE )
{
- int iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift );
+ mcIdType iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift );
for ( iComp = 0; iComp < nbComponents; ++iComp )
for ( int iG = 0; iG < nbGauss; ++iG )
valPtr[ iMed + iG * nbComponents + iComp ] = compValues[iComp][ iE * nbGauss + iG ];
struct IntermediateMED;
// ==============================================================================
- typedef int TID; // an ID countered from 1
+ typedef mcIdType TID; // an ID countered from 1
typedef std::pair<TID,TID> Link; // a pair of node numbers
typedef INTERP_KERNEL::NormalizedCellType TCellType;
reference is converted into a copy of the medGroup
(issue 0021311)
*/
- MEDCoupling::DataArrayInt* _medGroup; // result of conversion
- std::vector< unsigned > _relocTable; // for _cells[i] gives its index in _medGroup
+ MEDCoupling::DataArrayIdType* _medGroup; // result of conversion
+ std::vector< mcIdType > _relocTable; // for _cells[i] gives its index in _medGroup
bool empty() const { return _cells.empty() && _groups.empty(); }
- int size() const;
+ mcIdType size() const;
Group():_cellType(INTERP_KERNEL::NORM_ERROR), _isProfile(false), _medGroup(NULL) {}
};
void setData( int nb_comp, Group* supp )
{ _support = supp; _comp_names.resize(nb_comp); _nb_gauss.resize(nb_comp,1); }
- int nbComponents() const { return _comp_names.size(); }
+ int nbComponents() const { return (int)_comp_names.size(); }
std::string & compName( int i_comp ) { return _comp_names[ i_comp ]; }
bool isSameNbGauss() const { return *std::max_element( _nb_gauss.begin(), _nb_gauss.end() ) ==
*std::min_element( _nb_gauss.begin(), _nb_gauss.end() ); }
bool isMedCompatible(bool& sameNbGauss) const;
MEDCoupling::TypeOfField getMedType( const int iSub=0 ) const;
MEDCoupling::TypeOfTimeDiscretization getMedTimeDisc() const;
- int getNbTuples( const int iSub=0 ) const;
+ mcIdType getNbTuples( const int iSub=0 ) const;
int getNbValuesPerElement( const int iSub=0 ) const;
int getNbGauss( const int iSub=0 ) const;
const Group* getSupport( const int iSub=0 ) const;
- int setValues( double * valPtr, const int iSub, const int elemShift=0 ) const;
+ mcIdType setValues( double * valPtr, const int iSub, const mcIdType elemShift=0 ) const;
void splitSubWithDiffNbGauss();
//virtual void dump(std::ostream&) const;
~IntermediateMED();
Node* getNode( TID nID ) { return _points.getNode( nID ); }
- int getNbCellsOfType( TCellType type ) const { return _cellsByType[type].size(); }
+ mcIdType getNbCellsOfType( TCellType type ) const { return ToIdType(_cellsByType[type].size()); }
const Cell* insert(TCellType type, const Cell& ma) { return &( *_cellsByType[type].insert( ma ).first ); }
Group* addNewGroup(std::vector<SauvUtilities::Group*>* groupsToFix=0);
MEDCoupling::MEDFileData* convertInMEDFileDS();
while ( isSwapped )
{
isSwapped = false;
- for ( size_t i = 1; i < groups.size(); ++i )
+ for ( std::size_t i = 1; i < groups.size(); ++i )
{
- int nbN1 = groups[i-1]->empty() ? 0 : groups[i-1]->_cells[0]->_nodes.size();
- int nbN2 = groups[i ]->empty() ? 0 : groups[i ]->_cells[0]->_nodes.size();
+ std::size_t nbN1 = groups[i-1]->empty() ? 0 : groups[i-1]->_cells[0]->_nodes.size();
+ std::size_t nbN2 = groups[i ]->empty() ? 0 : groups[i ]->_cells[0]->_nodes.size();
if ( nbN1 > nbN2 )
{
isSwapped = isModified = true;
const int fixedLength = 71;
while ((int)aWholeString.length() < stringLen)
{
- int remainLen = stringLen - aWholeString.length();
+ int remainLen = (int)(stringLen - aWholeString.length());
int len;
if ( remainLen > fixedLength )
{
while ((int)aWholeString.length() < stringLen)
{
getNextLine( line );
- int remainLen = stringLen - aWholeString.length();
+ int remainLen = (int)(stringLen - aWholeString.length());
if ( remainLen > fixedLength )
{
aWholeString += line + 1;
if (!healedName.empty())
{
string name = healedName;
- int len = name.length();
- for (int i = 0; i < len; ++i)
- name[i] = toupper(name[i]);
+ std::size_t len = name.length();
+ for (std::size_t i = 0; i < len; ++i)
+ name[i] = (char)toupper(name[i]);
bool doResave = false; // only for tracing
void SauvWriter::fillSubMeshes( int& nbSauvObjects, map<string,int>& nameNbMap )
{
// evaluate nb of _subs in order to avoid re-allocation of _subs
- int nbSubs = 1; // for the very mesh
+ std::size_t nbSubs = 1; // for the very mesh
nbSubs += _fileMesh->getFamilyInfo().size() + 4; // + 4 zero families (for each dimRelExt)
nbSubs += _fileMesh->getGroupInfo().size();
nbSubs += evaluateNbProfileSubMeshes();
{
int dimRelExt = dims[ iDim ];
MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(dimRelExt);
- const DataArrayInt * famIds = _fileMesh->getFamilyFieldAtLevel(dimRelExt);
+ const DataArrayIdType * famIds = _fileMesh->getFamilyFieldAtLevel(dimRelExt);
if ( !famIds ) continue;
- int curFamID = 0;
+ mcIdType curFamID = 0;
SubMesh* curSubMesh = addSubMesh( "", dimRelExt ); // submesh of zero family
_famIDs2Sub[0] = curSubMesh;
- int sub0Index = _subs.size()-1;
+ std::size_t sub0Index = _subs.size()-1;
- const int * famID = famIds->begin(), * famIDEnd = famIds->end();
- for ( int cellID = 0; famID < famIDEnd; ++famID, cellID++ )
+ const mcIdType * famID = famIds->begin(), * famIDEnd = famIds->end();
+ for ( mcIdType cellID = 0; famID < famIDEnd; ++famID, cellID++ )
{
if ( *famID != curFamID )
{
curFamID = *famID;
- map< int, SubMesh* >::iterator f2s = _famIDs2Sub.insert( make_pair( curFamID, nilSm )).first;
+ map< mcIdType, SubMesh* >::iterator f2s = _famIDs2Sub.insert( make_pair( curFamID, nilSm )).first;
if ( !f2s->second )
f2s->second = addSubMesh( "", dimRelExt ); // no names for families
curSubMesh = f2s->second;
else if ( dimRelExt == 0 )
{
// make a submesh including all cells
- if ( sub0Index == (int)(_subs.size()-1) )
+ if ( sub0Index == _subs.size()-1 )
{
_famIDs2Sub[0]->_name = _fileMesh->getName(); // there is the zero family only
}
curSubMesh = addSubMesh( _fileMesh->getName(), dimRelExt );
if ( _famIDs2Sub[0]->nbTypes() == 0 )
sub0Index++; // skip an empty zero family
- for ( size_t i = sub0Index; i < _subs.size()-1; ++i )
+ for ( std::size_t i = sub0Index; i < _subs.size()-1; ++i )
curSubMesh->_subs.push_back( & _subs[i] );
}
}
std::size_t k = 0;
for ( size_t i = 0; i < famNames.size(); ++i )
{
- int famID = _fileMesh->getFamilyId( famNames[i].c_str() );
- map< int, SubMesh* >::iterator i2f = _famIDs2Sub.find( famID );
+ mcIdType famID = _fileMesh->getFamilyId( famNames[i].c_str() );
+ map< mcIdType, SubMesh* >::iterator i2f = _famIDs2Sub.find( famID );
if ( i2f != _famIDs2Sub.end() )
{
famSubMeshes[ k ] = i2f->second;
if ( !pfl2sm->second )
{
SubMesh* sm = pfl2sm->second = addSubMesh( "", dimRelExt ); // no names for profiles
- const DataArrayInt * pfl = isOnAll ? 0 : fields[i]->getProfile( pfls[iType][iPfl].c_str() );
+ const DataArrayIdType * pfl = isOnAll ? 0 : fields[i]->getProfile( pfls[iType][iPfl].c_str() );
makeProfileIDs( sm, types[iType], pfl );
}
}
int SauvWriter::evaluateNbProfileSubMeshes() const
{
- int nb = 0;
- for ( size_t i = 0; i < _nodeFields.size(); ++i )
+ std::size_t nb = 0;
+ for ( std::size_t i = 0; i < _nodeFields.size(); ++i )
nb += 1 + _nodeFields[i]->getPflsReallyUsed().size();
- for ( size_t i = 0; i < _cellFields.size(); ++i )
+ for ( std::size_t i = 0; i < _cellFields.size(); ++i )
{
nb += _cellFields[i]->getPflsReallyUsed().size();
nb += 2 * types.size(); // x 2 - a type can be on nodes and on cells at the same time
}
- return nb;
+ return (int)nb;
}
//================================================================================
void SauvWriter::makeProfileIDs( SubMesh* sm,
INTERP_KERNEL::NormalizedCellType type,
- const DataArrayInt* profile )
+ const DataArrayIdType* profile )
{
MCAuto< MEDCouplingMesh >
mesh = _fileMesh->getMeshAtLevel(sm->_dimRelExt);
const MEDCouplingUMesh* uMesh = dynamic_cast< const MEDCouplingUMesh* > ((const MEDCouplingMesh*) mesh );
if ( sm->_dimRelExt == 1 ) type = INTERP_KERNEL::NORM_POINT1;
- vector< int >& ids = sm->_cellIDsByType[ type ];
+ vector< mcIdType >& ids = sm->_cellIDsByType[ type ];
if ( sm->_dimRelExt == 1 || !uMesh )
{
{
ids.resize( sm->_dimRelExt == 1 ? mesh->getNumberOfNodes() : mesh->getNumberOfCells() );
for ( size_t i = 0; i < ids.size(); ++i )
- ids[i]=i;
+ ids[i] = ToIdType( i );
}
}
else
{
// profile on cells
- vector<int> code(3);
+ vector<mcIdType> code(3);
code[0] = type;
if ( profile ) // on profile
{
code[1] = mesh->getNumberOfCellsWithType( type );
code[2] = -1;
}
- vector<const DataArrayInt *> idsPerType( 1, profile );
- MCAuto<DataArrayInt>
+ vector<const DataArrayIdType *> idsPerType( 1, profile );
+ MCAuto<DataArrayIdType>
resIDs = uMesh->checkTypeConsistencyAndContig( code, idsPerType );
- if (( const DataArrayInt *) resIDs )
+ if (( const DataArrayIdType *) resIDs )
{
ids.assign( resIDs->begin(), resIDs->end() );
}
else // mesh includes only one type
{
- int nbE = code[1];
+ mcIdType nbE = code[1];
for ( ids.resize( nbE ); nbE; --nbE )
ids[ nbE-1 ] = nbE-1;
}
TFieldCounter fcount( *_sauvFile, 10 ); // 10 integers per line
- for ( size_t iSub = 0; iSub < _subs.size(); ++iSub )
+ for ( unsigned int iSub = 0; iSub < _subs.size(); ++iSub )
{
SubMesh& sm = _subs[iSub];
if ( sm._nbSauvObjects < 1 ) continue;
for ( int iType=0; iType < sm.cellIDsByTypeSize(); ++iType )
{
- const vector<int>& cellIDs = sm._cellIDsByType[iType];
+ const vector<mcIdType>& cellIDs = sm._cellIDsByType[iType];
if ( cellIDs.empty() ) continue;
INTERP_KERNEL::NormalizedCellType
cell = INTERP_KERNEL::CellModel::GetCellModel( cellType );
int castemType = SauvUtilities::med2gibiGeom( cellType );
unsigned nbElemNodes = cell.getNumberOfNodes();
- unsigned nbElems = cellIDs.size();
+ std::size_t nbElems = cellIDs.size();
*_sauvFile << setw(8) << castemType
<< zeroI8
// write color of each element
// * 8000 FORMAT(10I8)
- for ( size_t i = 0; i < nbElems; ++i, fcount++ ) *_sauvFile << zeroI8;
+ for ( std::size_t i = 0; i < nbElems; ++i, fcount++ ) *_sauvFile << zeroI8;
fcount.stop();
// write connectivity
// gibi IDs are in FORTRAN mode while MEDCoupling IDs are in C mode
if ( sm._dimRelExt == 1 ) // nodes
{
- for ( size_t i = 0; i < nbElems; ++i, fcount++ )
+ for ( std::size_t i = 0; i < nbElems; ++i, fcount++ )
*_sauvFile << setw(8) << ( cellIDs[i] + 1 );
}
else
// indices to transform MED connectivity to GIBI one
const int * toMedConn = getGibi2MedQuadraticInterlace( cellType );
- vector< int > cellConn( nbElemNodes ), transformedConn( nbElemNodes );
- for ( size_t i = 0; i < nbElems; ++i )
+ vector< mcIdType > cellConn( nbElemNodes ), transformedConn( nbElemNodes );
+ for ( std::size_t i = 0; i < nbElems; ++i )
{
cellConn.clear();
umesh->getNodeIdsOfCell( cellIDs[i], cellConn );
// write the index connecting nodes with their coordinates
- const int nbNodes = umesh->getNumberOfNodes();
+ const mcIdType nbNodes = umesh->getNumberOfNodes();
*_sauvFile << " ENREGISTREMENT DE TYPE 2" << endl
<< " PILE NUMERO 32NBRE OBJETS NOMMES 0NBRE OBJETS" << setw(8) << nbNodes << endl;
*_sauvFile << setw(8) << nbNodes << endl;
//
TFieldCounter fcount( *_sauvFile, 10 );// * 8000 FORMAT(10I8)
- for ( int i = 0; i < nbNodes; ++i, fcount++ )
+ for ( mcIdType i = 0; i < nbNodes; ++i, fcount++ )
*_sauvFile << setw(8) << i + 1;
fcount.stop();
*_sauvFile << " ENREGISTREMENT DE TYPE 2" << endl;
*_sauvFile << " PILE NUMERO 33NBRE OBJETS NOMMES 0NBRE OBJETS 1" << endl;
//
- const int dim = umesh->getSpaceDimension();
- const int nbValues = nbNodes * ( dim + 1 );
+ const int dim = umesh->getSpaceDimension();
+ const mcIdType nbValues = nbNodes * ( dim + 1 );
*_sauvFile << setw(8) << nbValues << endl;
// * 8003 FORMAT(1P,3E22.14)
*_sauvFile << endl;
string theWholeString; // concatenated long names
- vector<int> theOffsets;
+ vector<std::size_t> theOffsets;
int iStr = 1;
TFieldCounter fcount (*_sauvFile, 10);
// Write the STRING pile
// ----------------------
- const int nbNames = theOffsets.size();
+ const std::size_t nbNames = theOffsets.size();
*_sauvFile << " ENREGISTREMENT DE TYPE 2" << endl
<< " PILE NUMERO 27NBRE OBJETS NOMMES" << zeroI8 << "NBRE OBJETS" << setw(8) << nbNames << endl
<< setw(8) << theWholeString.length() << setw(8) << nbNames << endl;
*_sauvFile << setw(72) << theWholeString.substr(aPos, fixedLength) << endl;
// write the offsets
- for ( size_t i = 0; i < theOffsets.size(); ++i, fcount++ )
+ for ( std::size_t i = 0; i < theOffsets.size(); ++i, fcount++ )
*_sauvFile << setw(8) << theOffsets[i];
}
flds = isNodal ? _nodeFields : _cellFields;
map<string,int> nameNbMap;
- for ( size_t iF = 0; iF < flds.size(); ++iF )
+ for ( unsigned int iF = 0; iF < flds.size(); ++iF )
{
string name = addName( nameNbMap, fldNamePrefixMap, flds[iF]->getName(), iF+1 );
nameGIBItoMED aMEDName;
// (1) write nb subcomponents, nb components(total)
vector< pair<int,int> > iters = _nodeFields[iF]->getIterations();
const vector<string>& compInfo = _nodeFields[iF]->getInfo();
- const int nbSub = iters.size();
- const int nbComp = compInfo.size();
- const int totalNbComp = nbSub * nbComp;
+ const std::size_t nbSub = iters.size();
+ const std::size_t nbComp = compInfo.size();
+ const std::size_t totalNbComp = nbSub * nbComp;
*_sauvFile << setw(8) << nbSub
<< setw(8) << totalNbComp
<< setw(8) << -1 // IFOUR
// (2) for each sub-component (iteration)
// write support, number of values and number of components
fcount.init(10);
- vector< int > vals(3);
+ vector< mcIdType > vals(3);
for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt )
{
pair<int,int> it = iters[iIt];
vector<INTERP_KERNEL::NormalizedCellType> types;
vector< vector<TypeOfField> > typesF;
vector< vector<string> > pfls, locs;
- vector< vector< std::pair<int,int> > > valsVec;
+ vector< vector< std::pair<mcIdType,mcIdType> > > valsVec;
valsVec=_nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
types, typesF, pfls, locs);
// believe that there can be only one type in a nodal field,
<< pfls[0][0] << "|");
vals[0] = -pfl2Sub->second->_id;
vals[1] = (valsVec[0][0].second-valsVec[0][0].first);
- vals[2] = compInfo.size();
+ vals[2] = ToIdType( compInfo.size() );
for ( size_t i = 0; i < vals.size(); ++i, fcount++ )
*_sauvFile << setw(8) << vals[i];
}
fcount.init(8);
*_sauvFile << left;
for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt )
- for ( size_t i = 0; i < compInfo.size(); ++i, fcount++ )
+ for ( std::size_t i = 0; i < compInfo.size(); ++i, fcount++ )
*_sauvFile << " " << setw(4) << mapMedToGibi[compInfo[i]];
*_sauvFile << right;
fcount.stop();
vector<INTERP_KERNEL::NormalizedCellType> types;
vector< vector<TypeOfField> > typesF;
vector< vector<string> > pfls, locs;
- vector< vector< std::pair<int,int> > > valsVec;
+ vector< vector< std::pair<mcIdType,mcIdType> > > valsVec;
valsVec = _nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
types, typesF, pfls, locs);
// believe that there can be only one type in a nodal field,
// (10) 1.00000000000000E+02 1.00000000000000E+02 1.00000000000000E+02
// (10) ...
- for ( size_t iF = 0; iF < _cellFields.size(); ++iF )
+ for ( unsigned int iF = 0; iF < _cellFields.size(); ++iF )
{
// count nb of sub-components
- int iSub, nbSub = 0;
+ std::size_t iSub, nbSub = 0;
vector< pair<int,int> > iters = _cellFields[iF]->getIterations();
for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt )
{
vector<INTERP_KERNEL::NormalizedCellType> types;
vector< vector<TypeOfField> > typesF;
vector< vector<string> > pfls, locs;
- vector< vector< std::pair<int,int> > > valsVec;
+ vector< vector< std::pair<mcIdType,mcIdType> > > valsVec;
valsVec = _cellFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
types, typesF, pfls, locs);
for ( size_t i = 0; i < valsVec.size(); ++i )
*_sauvFile << setw(72) << " " << endl;
// (3) support, nb components
- vector<int> vals(9, 0);
+ vector<mcIdType> vals(9, 0);
const vector<string>& compInfo = _cellFields[iF]->getInfo();
- vals[2] = compInfo.size();
+ vals[2] = ToIdType( compInfo.size() );
fcount.init(10);
for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt )
{
vector<INTERP_KERNEL::NormalizedCellType> types;
vector< vector<TypeOfField> > typesF;
vector< vector<string> > pfls, locs;
- vector< vector< std::pair<int,int> > > valsVec;
+ vector< vector< std::pair<mcIdType,mcIdType> > > valsVec;
valsVec = _cellFields[iF]->getFieldSplitedByType( iter, order, _fileMesh->getName().c_str(),
types, typesF, pfls, locs);
for ( size_t iType = 0; iType < pfls.size(); ++iType )
const vector<string>& compInfo = _cellFields[iF]->getInfo();
// (6) component addresses
- int iComp = 0, nbComp = compInfo.size();
+ std::size_t iComp = 0, nbComp = compInfo.size();
for ( fcount.init(10); iComp < nbComp; ++iComp, fcount++ )
*_sauvFile << setw(8) << 777; // a good number
fcount.stop();
class MEDFileData;
class MEDFileMesh;
class MEDFileFieldMultiTS;
- class DataArrayInt;
+ class DataArrayIdType;
/*!
* \brief Class to write a MEDFileData into a SAUVE format file
*/
struct SubMesh
{
- std::vector<int> _cellIDsByType[ INTERP_KERNEL::NORM_MAXTYPE+1 ];
+ std::vector<mcIdType> _cellIDsByType[ INTERP_KERNEL::NORM_MAXTYPE+1 ];
std::vector<SubMesh*> _subs;
std::string _name;
int _id;
std::map<std::string, std::string>& compMedToGibi );
void makeProfileIDs( SubMesh* sm,
INTERP_KERNEL::NormalizedCellType type,
- const DataArrayInt* profile );
+ const DataArrayIdType* profile );
void writeFileHead();
void writeSubMeshes();
void writeCompoundSubMesh(int iSub);
std::vector< MCAuto< MEDFileFieldMultiTS > > _cellFields;
std::vector<SubMesh> _subs;
- std::map< int, SubMesh* > _famIDs2Sub;
+ std::map< mcIdType, SubMesh* > _famIDs2Sub;
std::map< std::string, SubMesh* > _profile2Sub;
enum
{
SET_SOURCE_FILES_PROPERTIES(MEDLoader.i PROPERTIES SWIG_DEFINITIONS "-shadow")
ENDIF()
SET(SWIG_MODULE_MEDLoader_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
+IF(MEDCOUPLING_USE_64BIT_IDS)
+ STRING(APPEND SWIG_MODULE_MEDLoader_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
+ENDIF(MEDCOUPLING_USE_64BIT_IDS)
SET (MEDLoader_SWIG_DPYS_FILES
MEDLoaderCommon.i
def MEDCouplingDataArrayFloatIdiv(self,*args):
import _MEDLoader
return _MEDLoader.DataArrayFloat____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntIadd(self,*args):
+def MEDCouplingDataArrayInt32Iadd(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayInt____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntIsub(self,*args):
+ return _MEDLoader.DataArrayInt32____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32Isub(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayInt____isub___(self, self, *args)
-def MEDCouplingDataArrayIntImul(self,*args):
+ return _MEDLoader.DataArrayInt32____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32Imul(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayInt____imul___(self, self, *args)
-def MEDCouplingDataArrayIntIdiv(self,*args):
+ return _MEDLoader.DataArrayInt32____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32Idiv(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayInt____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntImod(self,*args):
+ return _MEDLoader.DataArrayInt32____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32Imod(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayInt____imod___(self, self, *args)
-def MEDCouplingDataArrayIntIpow(self,*args):
+ return _MEDLoader.DataArrayInt32____imod___(self, self, *args)
+def MEDCouplingDataArrayInt32Ipow(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayInt____ipow___(self, self, *args)
+ return _MEDLoader.DataArrayInt32____ipow___(self, self, *args)
+def MEDCouplingDataArrayInt64Iadd(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt64____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64Isub(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt64____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64Imul(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt64____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64Idiv(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt64____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64Imod(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt64____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64Ipow(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt64____ipow___(self, self, *args)
def MEDCouplingDataArrayDoubleTupleIadd(self,*args):
import _MEDLoader
return _MEDLoader.DataArrayDoubleTuple____iadd___(self, self, *args)
def MEDCouplingDataArrayDoubleTupleIdiv(self,*args):
import _MEDLoader
return _MEDLoader.DataArrayDoubleTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIadd(self,*args):
+def MEDCouplingDataArrayInt32TupleIadd(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt32Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIsub(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt32Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImul(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt32Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIdiv(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt32Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImod(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt32Tuple____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIadd(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayIntTuple____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIsub(self,*args):
+ return _MEDLoader.DataArrayInt64Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIsub(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayIntTuple____isub___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImul(self,*args):
+ return _MEDLoader.DataArrayInt64Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImul(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayIntTuple____imul___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIdiv(self,*args):
+ return _MEDLoader.DataArrayInt64Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIdiv(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayIntTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImod(self,*args):
+ return _MEDLoader.DataArrayInt64Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImod(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayIntTuple____imod___(self, self, *args)
+ return _MEDLoader.DataArrayInt64Tuple____imod___(self, self, *args)
def MEDCouplingDenseMatrixIadd(self,*args):
import _MEDLoader
return _MEDLoader.DenseMatrix____iadd___(self, self, *args)
PyObject *GetUMeshGlobalInfoSwig(const std::string& fileName, const std::string& meshName)
{
- int meshDim,spaceDim,numberOfNodes;
+ int meshDim,spaceDim;
+ mcIdType numberOfNodes;
std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDCoupling::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
PyObject *ret=PyTuple_New(4);
PyObject *elt0=PyList_New(res.size());
PyTuple_SetItem(ret,0,elt0);
PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
- PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
+ PyTuple_SetItem(ret,3,SWIG_From_long(numberOfNodes));
return ret;
}
PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
{
std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName);
- int size=v.size();
+ std::size_t size=v.size();
PyObject *ret=PyList_New(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
return ret;
}
{
public:
static MEDFileJointCorrespondence *New();
- static MEDFileJointCorrespondence *New(DataArrayInt* correspondence) // nodes
+ static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence) // nodes
;
- static MEDFileJointCorrespondence *New(DataArrayInt* correspondence, // cells
+ static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells
INTERP_KERNEL::NormalizedCellType loc_geo_type,
INTERP_KERNEL::NormalizedCellType rem_geo_type)
;
INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const;
void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type);
INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const;
- void setCorrespondence(DataArrayInt *corr);
+ void setCorrespondence(DataArrayIdType *corr);
void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
std::string simpleRepr() const;
%extend
{
return MEDFileJointCorrespondence::New();
}
- MEDFileJointCorrespondence(DataArrayInt* correspondence)
+ MEDFileJointCorrespondence(DataArrayIdType* correspondence)
{
return MEDFileJointCorrespondence::New(correspondence);
}
- MEDFileJointCorrespondence(DataArrayInt* correspondence, // cells
+ MEDFileJointCorrespondence(DataArrayIdType* correspondence, // cells
INTERP_KERNEL::NormalizedCellType loc_geo_type,
INTERP_KERNEL::NormalizedCellType rem_geo_type)
{
return self->simpleRepr();
}
- DataArrayInt *getCorrespondence() const
+ DataArrayIdType *getCorrespondence() const
{
- const DataArrayInt *ret(self->getCorrespondence());
+ const DataArrayIdType *ret(self->getCorrespondence());
if(ret)
ret->incrRef();
- return const_cast<DataArrayInt *>(ret);
+ return const_cast<DataArrayIdType *>(ret);
}
}
};
private:
MEDFileEquivalenceData();
public:
- void setArray(DataArrayInt *data);
+ void setArray(DataArrayInt32 *data);
%extend
{
- DataArrayInt *getArray()
+ DataArrayInt32 *getArray()
{
- DataArrayInt *ret(self->getArray());
+ DataArrayInt32 *ret(self->getArray());
if(ret) ret->incrRef();
return ret;
}
public:
void clear();
std::size_t size() const;
- void setArray(int meshDimRelToMax, DataArrayInt *da);
- void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da);
+ void setArray(int meshDimRelToMax, DataArrayInt32 *da);
+ void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt32 *da);
%extend
{
- DataArrayInt *getArray(INTERP_KERNEL::NormalizedCellType type)
+ DataArrayInt32 *getArray(INTERP_KERNEL::NormalizedCellType type)
{
- DataArrayInt *ret(self->getArray(type));
+ DataArrayInt32 *ret(self->getArray(type));
if(ret) ret->incrRef();
return ret;
}
void setName(const std::string& name);
std::string getDescription() const;
void setDescription(const std::string& descr);
- void setArray(int meshDimRelToMaxExt, DataArrayInt *da);;
+ void setArray(int meshDimRelToMaxExt, DataArrayInt32 *da);;
%extend
{
MEDFileEquivalenceCell *initCell()
virtual std::vector<int> getFamArrNonEmptyLevelsExt() const;
virtual std::vector<int> getNumArrNonEmptyLevelsExt() const;
virtual std::vector<int> getNameArrNonEmptyLevelsExt() const;
- virtual std::vector<int> getDistributionOfTypes(int meshDimRelToMax) const;
+ virtual std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
virtual MEDFileMesh *cartesianize() const;
std::vector<int> getNonEmptyLevels() const;
std::vector<int> getNonEmptyLevelsExt() const;
void addFamily(const std::string& familyName, int id);
void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
- virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs);
+ virtual bool keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& levs);
void copyFamGrpMapsFrom(const MEDFileMesh& other);
void clearGrpMap();
void clearFamMap();
const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
- std::vector<int> getFamiliesIdsOnGroup(const std::string& name) const;
+ std::vector<mcIdType> getFamiliesIdsOnGroup(const std::string& name) const;
void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
- void setFamiliesIdsOnGroup(const std::string& name, const std::vector<int>& famIds);
+ void setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds);
std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
std::vector<std::string> getGroupsNames() const;
std::vector<std::string> getFamiliesNames() const;
std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
- std::vector<int> getGrpNonEmptyLevelsExt(const std::string& grp) const;
- std::vector<int> getGrpNonEmptyLevels(const std::string& grp) const;
- std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
- std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
- std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
- std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
- std::vector<int> getFamNonEmptyLevels(const std::string& fam) const;
- std::vector<int> getFamNonEmptyLevelsExt(const std::string& fam) const;
+ std::vector<mcIdType> getGrpNonEmptyLevelsExt(const std::string& grp) const;
+ std::vector<mcIdType> getGrpNonEmptyLevels(const std::string& grp) const;
+ std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
+ std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
+ std::vector<mcIdType> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
+ std::vector<mcIdType> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
+ std::vector<mcIdType> getFamNonEmptyLevels(const std::string& fam) const;
+ std::vector<mcIdType> getFamNonEmptyLevelsExt(const std::string& fam) const;
std::vector<std::string> getFamiliesNamesWithFilePointOfView() const;
static std::string GetMagicFamilyStr();
void assignFamilyNameWithGroupName();
void changeFamilyName(const std::string& oldName, const std::string& newName);
void changeFamilyId(int oldId, int newId);
void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
- void setFamilyInfo(const std::map<std::string,int>& info);
+ void setFamilyInfo(const std::map<std::string,mcIdType>& info);
void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
int getFamilyId(const std::string& name) const;
int getMaxAbsFamilyId() const;
virtual int getMaxAbsFamilyIdInArrays() const;
virtual int getMaxFamilyIdInArrays() const;
virtual int getMinFamilyIdInArrays() const;
- DataArrayInt *getAllFamiliesIdsReferenced() const;
- DataArrayInt *computeAllFamilyIdsInUse() const;
- std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const;
+ DataArrayIdType *getAllFamiliesIdsReferenced() const;
+ DataArrayIdType *computeAllFamilyIdsInUse() const;
+ std::vector<mcIdType> getFamiliesIds(const std::vector<std::string>& famNames) const;
std::string getFamilyNameGivenId(int id) const;
bool ensureDifferentFamIdsPerLevel();
void normalizeFamIdsTrio();
virtual std::string advancedRepr() const;
//
virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
- virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr);
- virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr);
+ virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
+ virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
- virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr);
- virtual void addNodeGroup(const DataArrayInt *ids);
- virtual void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids);
- virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
- virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
- virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
- virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
- virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const;
- virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
- virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
- virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
+ virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
+ virtual void addNodeGroup(const DataArrayIdType *ids);
+ virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
+ virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
+ virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
+ virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
+ virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
+ virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const;
+ virtual DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
+ virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
+ virtual DataArrayIdType *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
int getNumberOfJoints();
MEDFileJoints *getJoints();
void setJoints( MEDFileJoints* joints );
void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false)
{
- std::vector<const DataArrayInt *> grps;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",grps);
+ std::vector<const DataArrayIdType *> grps;
+ convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayInt",grps);
self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
}
PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
{
- const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
+ const DataArrayIdType *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
if(tmp)
tmp->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
{
- const DataArrayInt *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt);
+ const DataArrayIdType *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt);
if(tmp)
tmp->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const
{
- const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
+ const DataArrayIdType *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
if(tmp)
tmp->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
{
- const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
+ const DataArrayIdType *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
if(tmp)
tmp->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const
PyObject *unPolyze()
{
- DataArrayInt *ret3=0;
- std::vector<int> ret1,ret2;
+ DataArrayIdType *ret3=0;
+ std::vector<mcIdType> ret1,ret2;
bool ret0=self->unPolyze(ret1,ret2,ret3);
PyObject *ret=PyTuple_New(4);
PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
for(int j=0;j<(int)ret1.size()/3;j++)
{
PyObject *retLev2=PyList_New(3);
- PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
- PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
- PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
+ PyList_SetItem(retLev2,0,PyInt_FromLong(ret1[3*j]));
+ PyList_SetItem(retLev2,1,PyInt_FromLong(ret1[3*j+1]));
+ PyList_SetItem(retLev2,2,PyInt_FromLong(ret1[3*j+2]));
PyList_SetItem(retLev1_0,j,retLev2);
}
PyTuple_SetItem(ret,1,retLev1_0);
for(int j=0;j<(int)ret2.size()/3;j++)
{
PyObject *retLev2=PyList_New(3);
- PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
- PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
- PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
+ PyList_SetItem(retLev2,0,PyInt_FromLong(ret2[3*j]));
+ PyList_SetItem(retLev2,1,PyInt_FromLong(ret2[3*j+1]));
+ PyList_SetItem(retLev2,2,PyInt_FromLong(ret2[3*j+2]));
PyList_SetItem(retLev1_1,j,retLev2);
}
PyTuple_SetItem(ret,2,retLev1_1);
//
- PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
return ret;
}
- virtual DataArrayInt *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
+ virtual DataArrayIdType *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
{
- MCAuto<DataArrayInt> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
+ MCAuto<DataArrayIdType> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
return ret.retn();
}
}
MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
- DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
+ DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
void optimizeFamilies();
- DataArrayInt *zipCoords();
- DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
- DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ DataArrayIdType *zipCoords();
+ DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
return MEDFileUMesh::New();
}
- static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
+ static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector<mcIdType>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
{
std::vector<int> typesCpp1;
convertPyToNewIntArr3(types,typesCpp1);
PyObject *__getstate__()
{
std::vector<double> a0;
- std::vector<int> a1;
+ std::vector<mcIdType> a1;
std::vector<std::string> a2;
- std::vector< MCAuto<DataArrayInt> > a3;
+ std::vector< MCAuto<DataArrayIdType> > a3;
MCAuto<DataArrayDouble> a4;
self->serialize(a0,a1,a2,a3,a4);
PyObject *ret(PyTuple_New(5));
PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
- int sz(a2.size());
+ std::size_t sz(a2.size());
PyObject *ret2(PyList_New(sz));
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
PyTuple_SetItem(ret,2,ret2);
sz=a3.size();
PyObject *ret3(PyList_New(sz));
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
- DataArrayInt *elt(a3[i]);
+ DataArrayIdType *elt(a3[i]);
if(elt)
elt->incrRef();
- PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
}
PyTuple_SetItem(ret,3,ret3);
DataArrayDouble *ret4(a4);
static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
if(!PyTuple_Check(inp))
throw INTERP_KERNEL::Exception(MSG);
- int sz(PyTuple_Size(inp));
+ std::size_t sz(PyTuple_Size(inp));
if(sz!=5)
throw INTERP_KERNEL::Exception(MSG);
std::vector<double> a0;
- std::vector<int> a1;
+ std::vector<mcIdType> a1;
std::vector<std::string> a2;
- std::vector< MCAuto<DataArrayInt> > a3;
+ std::vector< MCAuto<DataArrayIdType> > a3;
MCAuto<DataArrayDouble> a4;
//
PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
- int tmp(-1);
+ mcIdType tmp(-1);
fillArrayWithPyListDbl3(a0py,tmp,a0);
convertPyToNewIntArr3(a1py,a1);
fillStringVector(a2py,a2);
if((DataArrayDouble *)a4)
a4->incrRef();
{
- std::vector< DataArrayInt * > a3Tmp;
- convertFromPyObjVectorOfObj<MEDCoupling::DataArrayInt *>(b0py,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",a3Tmp);
+ std::vector< DataArrayIdType * > a3Tmp;
+ convertFromPyObjVectorOfObj<MEDCoupling::DataArrayIdType *>(b0py,SWIGTITraits<mcIdType>::TI,"DataArrayInt",a3Tmp);
std::size_t sz(a3Tmp.size());
a3.resize(sz);
for(std::size_t i=0;i<sz;i++)
DataArrayDouble *a,*a2;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
MCAuto<MEDFileUMesh> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
PyObject *getAllDistributionOfTypes() const
{
- std::vector< std::pair<int,int> > ret(self->getAllDistributionOfTypes());
+ std::vector< std::pair<int,mcIdType> > ret(self->getAllDistributionOfTypes());
return convertVecPairIntToPy(ret);
}
- DataArrayInt *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
+ DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
{
- std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
+ std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
convertToMapIntDataArrayInt(extractDef,extractDefCpp);
return self->deduceNodeSubPartFromCellSubPart(extractDefCpp);
}
MEDFileUMesh *extractPart(PyObject *extractDef) const
{
- std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
+ std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
convertToMapIntDataArrayInt(extractDef,extractDefCpp);
return self->extractPart(extractDefCpp);
}
PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1)
{
- DataArrayInt *ret0=0,*ret1=0,*ret2=0;
+ DataArrayIdType *ret0=0,*ret1=0,*ret2=0;
self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2);
PyObject *ret=PyTuple_New(3);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
{
PyObject *getProfile(const std::string& pflName) const
{
- const DataArrayInt *ret=self->getProfile(pflName);
+ const DataArrayIdType *ret=self->getProfile(pflName);
if(ret)
ret->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *getProfileFromId(int pflId) const
{
- const DataArrayInt *ret=self->getProfileFromId(pflId);
+ const DataArrayIdType *ret=self->getProfileFromId(pflId);
if(ret)
ret->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *getLocalizationFromId(int locId) const
std::vector< std::vector<TypeOfField> > typesF;
std::vector< std::vector<std::string> > pfls;
std::vector< std::vector<std::string> > locs;
- std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
- int sz=ret.size();
+ std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
+ std::size_t sz=ret.size();
PyObject *ret2=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
- const std::vector< std::pair<int,int> >& dadsI=ret[i];
+ const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
const std::vector<TypeOfField>& typesFI=typesF[i];
const std::vector<std::string>& pflsI=pfls[i];
const std::vector<std::string>& locsI=locs[i];
PyObject *elt=PyTuple_New(2);
PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
- int sz2=ret[i].size();
+ std::size_t sz2=ret[i].size();
PyObject *elt2=PyList_New(sz2);
- for(int j=0;j<sz2;j++)
+ for(std::size_t j=0;j<sz2;j++)
{
PyObject *elt3=PyTuple_New(4);
PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
- PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
+ PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
PyTuple_SetItem(elt3,1,elt4);
PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
MEDFileAnyTypeField1TS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
{
- std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
+ std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
convertToMapIntDataArrayInt(extractDef,extractDefCpp);
return self->extractPart(extractDefCpp,mm);
}
MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
//
void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
- void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
- void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
+ void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
%extend
std::vector< std::vector<std::string> > pfls;
std::vector< std::vector<std::string> > locs;
std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
- int sz=ret.size();
+ std::size_t sz=ret.size();
PyObject *ret2=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
const std::vector<DataArrayDouble *>& dadsI=ret[i];
const std::vector<TypeOfField>& typesFI=typesF[i];
const std::vector<std::string>& locsI=locs[i];
PyObject *elt=PyTuple_New(2);
PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
- int sz2=ret[i].size();
+ std::size_t sz2=ret[i].size();
PyObject *elt2=PyList_New(sz2);
- for(int j=0;j<sz2;j++)
+ for(std::size_t j=0;j<sz2;j++)
{
PyObject *elt3=PyTuple_New(4);
PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
//
void setFieldNoProfileSBT(const MEDCouplingFieldInt *field);
- void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
- void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
+ void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
void copyTimeInfoFrom(MEDCouplingFieldInt *mcf);
MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const;
MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
return MEDFileField1TS_getFieldWithProfile<int>(self,type,meshDimRelToMax,mesh);
}
- DataArrayInt *getUndergroundDataArray() const
+ DataArrayInt32 *getUndergroundDataArray() const
{
- DataArrayInt *ret=self->getUndergroundDataArray();
+ DataArrayInt32 *ret=self->getUndergroundDataArray();
if(ret)
ret->incrRef();
return ret;
MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
//
void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
- void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
- void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
+ void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf);
MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const;
MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
{
if(elt0 && PyInt_Check(elt0))
{//fmts[3]
- int pos=PyInt_AS_LONG(elt0);
+ int pos=(int)PyInt_AS_LONG(elt0);
return pos;
}
else if(elt0 && PyTuple_Check(elt0))
PyObject *o1=PyTuple_GetItem(elt0,1);
if(PyInt_Check(o0) && PyInt_Check(o1))
{//fmts(1,-1)
- int iter=PyInt_AS_LONG(o0);
- int order=PyInt_AS_LONG(o1);
+ int iter=(int)PyInt_AS_LONG(o0);
+ int order=(int)PyInt_AS_LONG(o1);
return self->getPosOfTimeStep(iter,order);
}
else
std::vector< std::vector<TypeOfField> > typesF;
std::vector< std::vector<std::string> > pfls;
std::vector< std::vector<std::string> > locs;
- std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
- int sz=ret.size();
+ std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
+ std::size_t sz=ret.size();
PyObject *ret2=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
- const std::vector< std::pair<int,int> >& dadsI=ret[i];
+ const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
const std::vector<TypeOfField>& typesFI=typesF[i];
const std::vector<std::string>& pflsI=pfls[i];
const std::vector<std::string>& locsI=locs[i];
PyObject *elt=PyTuple_New(2);
PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
- int sz2=ret[i].size();
+ std::size_t sz2=ret[i].size();
PyObject *elt2=PyList_New(sz2);
- for(int j=0;j<sz2;j++)
+ for(std::size_t j=0;j<sz2;j++)
{
PyObject *elt3=PyTuple_New(4);
PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
- PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
+ PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
PyTuple_SetItem(elt3,1,elt4);
PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
{
if(PyList_Check(elts))
{
- int sz=PyList_Size(elts);
+ std::size_t sz=PyList_Size(elts);
std::vector<int> ret(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
PyObject *elt=PyList_GetItem(elts,i);
ret[i]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
{
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
- self->eraseTimeStepIds2(strt,stp,step);
+ self->eraseTimeStepIds2((int)strt,(int)stp,(int)step);
}
else
{
void eraseTimeStepIds(PyObject *li)
{
- int sw;
+ mcIdType sw;
int pos1;
std::vector<int> pos2;
- DataArrayInt *pos3=0;
+ DataArrayInt32 *pos3=0;
DataArrayIntTuple *pos4=0;
convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
switch(sw)
{
if(elt0 && PyList_Check(elt0))
{
- int sz=PyList_Size(elt0);
- MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
+ std::size_t sz=PyList_Size(elt0);
+ MCAuto<DataArrayInt32> da=DataArrayInt32::New(); da->alloc(sz,1);
int *pt=da->getPointer();
- for(int i=0;i<sz;i++,pt++)
+ for(std::size_t i=0;i<sz;i++,pt++)
{
PyObject *elt1=PyList_GetItem(elt0,i);
*pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
{
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
- return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
+ return convertMEDFileFieldMultiTS(self->buildSubPartSlice((int)strt,(int)stp,(int)step),SWIG_POINTER_OWN | 0);
}
else
return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
MEDFileAnyTypeFieldMultiTS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
{
- std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
+ std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
convertToMapIntDataArrayInt(extractDef,extractDefCpp);
return self->extractPart(extractDefCpp,mm);
}
MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
//
void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
- void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
%extend
{
PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
{
- DataArrayInt *ret1=0;
+ DataArrayIdType *ret1=0;
DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
std::vector< std::vector<std::string> > pfls;
std::vector< std::vector<std::string> > locs;
std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
- int sz=ret.size();
+ std::size_t sz=ret.size();
PyObject *ret2=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
const std::vector<DataArrayDouble *>& dadsI=ret[i];
const std::vector<TypeOfField>& typesFI=typesF[i];
const std::vector<std::string>& locsI=locs[i];
PyObject *elt=PyTuple_New(2);
PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
- int sz2=ret[i].size();
+ std::size_t sz2=ret[i].size();
PyObject *elt2=PyList_New(sz2);
- for(int j=0;j<sz2;j++)
+ for(std::size_t j=0;j<sz2;j++)
{
PyObject *elt3=PyTuple_New(4);
PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
PyObject *getUndergroundDataArrayExt(int iteration, int order) const
{
- std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
+ std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > elt1Cpp;
DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
if(elt0)
elt0->incrRef();
PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
PyObject *elt3=PyTuple_New(2);
- PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
- PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
+ PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first));
+ PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second));
PyTuple_SetItem(elt1,0,elt2);
PyTuple_SetItem(elt1,1,elt3);
PyList_SetItem(elt,i,elt1);
static MEDFileIntFieldMultiTS *New(DataArrayByte *db);
//
void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field);
- void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const;
MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
{
- DataArrayInt *ret1=0;
- DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
+ DataArrayIdType *ret1=0;
+ DataArrayInt32 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<int>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
- DataArrayInt *getUndergroundDataArray(int iteration, int order) const
+ DataArrayInt32 *getUndergroundDataArray(int iteration, int order) const
{
- DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
+ DataArrayInt32 *ret=self->getUndergroundDataArray(iteration,order);
if(ret)
ret->incrRef();
return ret;
static MEDFileFloatFieldMultiTS *New(DataArrayByte *db);
//
void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
- void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const;
MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
{
- DataArrayInt *ret1=0;
+ DataArrayIdType *ret1=0;
DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
{
if(obj && PyList_Check(obj))
{
- int sz=PyList_Size(obj);
+ std::size_t sz=PyList_Size(obj);
MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
int *pt=da->getPointer();
- for(int i=0;i<sz;i++,pt++)
+ for(std::size_t i=0;i<sz;i++,pt++)
{
PyObject *elt1=PyList_GetItem(obj,i);
*pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
throw INTERP_KERNEL::Exception(msg);
if(PyInt_Check(elt0))
{//fmts[3]
- return PyInt_AS_LONG(elt0);
+ return (int)PyInt_AS_LONG(elt0);
}
return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
}
{
if(PyList_Check(elts))
{
- int sz=PyList_Size(elts);
+ std::size_t sz=PyList_Size(elts);
std::vector<int> ret(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
PyObject *elt=PyList_GetItem(elts,i);
ret[i]=MEDCoupling_MEDFileFields_getPosOfField(self,elt);
{
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSlice(elts,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
- self->destroyFieldsAtPos2(strt,stp,step);
+ self->destroyFieldsAtPos2((int)strt,(int)stp,(int)step);
}
else
{
MEDFileFields *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
{
- std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
+ std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
convertToMapIntDataArrayInt(extractDef,extractDefCpp);
return self->extractPart(extractDefCpp,mm);
}
void eraseTimeStepIds(PyObject *ids)
{
- int sw;
+ mcIdType sw;
int pos1;
std::vector<int> pos2;
DataArrayInt *pos3=0;
PyObject *o1=PyTuple_GetItem(elt0,1);
if(PyInt_Check(o0) && PyInt_Check(o1))
{//fmts(1,-1)
- int iter=PyInt_AS_LONG(o0);
- int order=PyInt_AS_LONG(o1);
+ int iter=(int)PyInt_AS_LONG(o0);
+ int order=(int)PyInt_AS_LONG(o1);
return self->getPosOfTimeStep(iter,order);
}
else
{
if(PyList_Check(elts))
{
- int sz=PyList_Size(elts);
+ std::size_t sz=PyList_Size(elts);
std::vector<int> ret(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
PyObject *elt=PyList_GetItem(elts,i);
ret[i]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt);
public:
virtual MEDMeshMultiLev *prepare() const;
DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
- DataArrayInt *retrieveGlobalNodeIdsIfAny() const;
+ DataArrayIdType *retrieveGlobalNodeIdsIfAny() const;
protected:
~MEDMeshMultiLev();
public:
{
PyObject *retrieveFamilyIdsOnCells() const
{
- DataArrayInt *famIds(0);
+ DataArrayIdType *famIds(0);
bool isWithoutCopy(false);
self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
PyObject *ret=PyTuple_New(2);
PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
Py_XINCREF(ret1Py);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,1,ret1Py);
return ret;
}
PyObject *retrieveNumberIdsOnCells() const
{
- DataArrayInt *numIds(0);
+ DataArrayIdType *numIds(0);
bool isWithoutCopy(false);
self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
PyObject *ret=PyTuple_New(2);
PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
Py_XINCREF(ret1Py);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,1,ret1Py);
return ret;
}
PyObject *retrieveFamilyIdsOnNodes() const
{
- DataArrayInt *famIds(0);
+ DataArrayIdType *famIds(0);
bool isWithoutCopy(false);
self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy);
PyObject *ret=PyTuple_New(2);
PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
Py_XINCREF(ret1Py);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,1,ret1Py);
return ret;
}
PyObject *retrieveNumberIdsOnNodes() const
{
- DataArrayInt *numIds(0);
+ DataArrayIdType *numIds(0);
bool isWithoutCopy(false);
self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy);
PyObject *ret=PyTuple_New(2);
PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
Py_XINCREF(ret1Py);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,1,ret1Py);
return ret;
}
{
PyObject *buildVTUArrays() const
{
- DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayInt *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
+ DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayIdType *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces));
PyObject *ret0Py=ncc?Py_True:Py_False;
Py_XINCREF(ret0Py);
PyTuple_SetItem(ret,0,ret0Py);
PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
}
PyObject *buildVTUArrays() const
{
DataArrayDouble *ret0(0);
- std::vector<int> ret1;
+ std::vector<mcIdType> ret1;
bool ret2;
self->buildVTUArrays(ret0,ret1,ret2);
std::size_t sz(ret1.size());
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
PyObject *ret1Py=PyList_New(sz);
for(std::size_t i=0;i<sz;i++)
- PyList_SetItem(ret1Py,i,SWIG_From_int(ret1[i]));
+ PyList_SetItem(ret1Py,i,PyInt_FromLong(ret1[i]));
PyTuple_SetItem(ret,1,ret1Py);
PyObject *ret2Py(ret2?Py_True:Py_False);
Py_XINCREF(ret2Py);
m=m.buildUnstructured()
m.setName("mm")
f=m.getMeasureField(False)
- self.assertIn(m.getHeapMemorySize(), list(range(3552 - 100, 3552 + 100 + 4 * strMulFac)))
- self.assertIn(f.getHeapMemorySize(), list(range(4215 - 100, 4215 + 100 + 8 * strMulFac)))
+ cooMem = 100 * 2 * 8
+ nodalMem = 5 * 81 * MEDCouplingSizeOfIDs()//8
+ indexMem = 82 * MEDCouplingSizeOfIDs()//8
+ meshMem = cooMem + nodalMem + indexMem
+ self.assertIn(m.getHeapMemorySize(), list(range(meshMem - 100, meshMem + 100 + 4 * strMulFac)))
+ self.assertIn(f.getHeapMemorySize(), list(range(meshMem + 81*8 - 100, meshMem + 81*8 + 100 + 8 * strMulFac)))
#
mm=MEDFileUMesh()
mm.setMeshAtLevel(0,m)
- self.assertIn(mm.getHeapMemorySize(), list(range(3889 - 100, 4225 + 100 + 10 * strMulFac)))
+ self.assertIn(mm.getHeapMemorySize(), list(range(meshMem + 81*(MEDCouplingSizeOfIDs()//8) - 100, meshMem + 81*(MEDCouplingSizeOfIDs()//8) + 100 + 10 * strMulFac)))
ff=MEDFileField1TS()
ff.setFieldNoProfileSBT(f)
self.assertIn(ff.getHeapMemorySize(), list(range(771 - 40, 871 + 21 + (4 + 1) * strMulFac)))
pfl=DataArrayInt.Range(0,50,1) ; pfl.setName("pfl")
fff.appendFieldProfile(f2,mm,0,pfl)
self.assertIn(fff.getHeapMemorySize(), list(range(2348 - 130, 2608 + 100 + (10 + 2) * strMulFac)))
- self.assertIn(fff.getProfile("pfl").getHeapMemorySize(), list(range(204 - 10, 204 + 10 + 2 * strMulFac)))
- self.assertIn(fff[1, -1].getHeapMemorySize(), list(range(738 - 50, 838 + 30 + 4 * strMulFac)))
+ self.assertIn(fff.getProfile("pfl").getHeapMemorySize(), list(range(50 *(MEDCouplingSizeOfIDs()//8) - 10, 50 *(MEDCouplingSizeOfIDs()//8) + 10 + 2 * strMulFac)))
+ self.assertIn(fff[1, -1].getHeapMemorySize(), list(range(538 + (50 *(MEDCouplingSizeOfIDs()//8)) - 50, 638 + (50 *(MEDCouplingSizeOfIDs()//8)) + 30 + 4 * strMulFac)))
pass
def internalCurveLinearMesh1(self):
self.assertTrue(a.getArray().isEqual(2*f1.getArray()))
f1.setTime(3.,1,2) ; f1.getArray()[:]*=2
self.assertTrue(a.isEqual(f1,1e-12,0)) ; f1.getArray()[:]/=2
- bc=DataArrayInt(6,3) ; bc[:]=0 ; bc.setInfoOnComponents(['power [MW/m^3]','density [g/cm^3]','temperature [K]'])
+ bc=DataArrayInt32(6,3) ; bc[:]=0 ; bc.setInfoOnComponents(['power [MW/m^3]','density [g/cm^3]','temperature [K]'])
for it in ffs1:
a=it.getFieldOnMeshAtLevel(ON_CELLS,0,mm1)
bc+=a.getArray()
nf1=MEDCouplingFieldInt(ON_NODES)
nf1.setTime(9.,10,-1)
nf1.setMesh(f1.getMesh())
- narr=DataArrayInt(12,2) ; narr.setInfoOnComponents(["aa [u1]","bbbvv [ppp]"]) ; narr[:,0]=list(range(12)) ; narr[:,1]=2*narr[:,0]
+ narr=DataArrayInt32(12,2) ; narr.setInfoOnComponents(["aa [u1]","bbbvv [ppp]"]) ; narr[:,0]=list(range(12)) ; narr[:,1]=2*narr[:,0]
nf1.setName("VectorFieldOnNodes") ; nf1.setArray(narr)
nff1=MEDFileIntField1TS.New()
nff1.setFieldNoProfileSBT(nf1)
nf2=MEDCouplingFieldInt(ON_NODES)
nf2.setTime(19.,20,-11)
nf2.setMesh(f1.getMesh())
- narr2=DataArrayInt(8,2) ; narr.setInfoOnComponents(["aapfl [u1]","bbbvvpfl [ppp]"]) ; narr2[:,0]=list(range(8)) ; narr2[:,0]+=10 ; narr2[:,1]=3*narr2[:,0]
+ narr2=DataArrayInt32(8,2) ; narr.setInfoOnComponents(["aapfl [u1]","bbbvvpfl [ppp]"]) ; narr2[:,0]=list(range(8)) ; narr2[:,0]+=10 ; narr2[:,1]=3*narr2[:,0]
nf2.setName("VectorFieldOnNodesPfl") ; narr2.setName(nf2.getName()) ; nf2.setArray(narr2)
nff2=MEDFileIntField1TS.New()
npfl=DataArrayInt([1,2,4,5,6,7,10,11]) ; npfl.setName("npfl")
for delt,(dt,it,t) in zip([0,100,200],ff1.getTimeSteps()):
self.assertEqual(ff1.getFieldSplitedByType(dt,it),fspExp)
arr=ff1.getUndergroundDataArray(dt,it)
- arr.isEqualWithoutConsideringStr(DataArrayInt.Range(delt,delt+7,1))
+ arr.isEqualWithoutConsideringStr(DataArrayInt32.Range(delt,delt+7,1))
pass
self.assertEqual(ff1.getPfls(),('pfl_NORM_QUAD4', 'pfl_NORM_QUAD4', 'pfl_NORM_QUAD4'))
#
for delt,(dt,it,t) in zip([0,100,200],ff1.getTimeSteps()):
self.assertTrue(ff1.getFieldSplitedByType(dt,it),fspExp)
arr=ff1.getUndergroundDataArray(dt,it)
- arr.isEqualWithoutConsideringStr(DataArrayInt.Range(delt,delt+7,1))
+ arr.isEqualWithoutConsideringStr(DataArrayInt32.Range(delt,delt+7,1))
pass
self.assertEqual(ff1.getPfls(),('pfl_NORM_QUAD4',))
pass
eqs=mm.getEquivalences()
eq0=eqs.appendEmptyEquivalenceWithName(eqName)
eq0.setDescription(descEq)
- corr=DataArrayInt([(0,3),(0,4),(0,5),(0,6),(1,7),(1,8),(1,9),(1,10),(2,11),(2,12),(2,13),(2,14)])
+ corr=DataArrayInt32([(0,3),(0,4),(0,5),(0,6),(1,7),(1,8),(1,9),(1,10),(2,11),(2,12),(2,13),(2,14)])
eq0.setArray(-1,corr)
self.assertEqual(eq0.getCell().size(),1)
self.assertTrue(eq0.getCell().getArray(NORM_QUAD4).isEqual(corr))
f=MEDCouplingFieldInt(ON_CELLS) ; f.setMesh(mesh)
fieldName="FieldOnCell"
f.setTime(1.2,1,1) ; f.setName(fieldName)
- arr=DataArrayInt([101,102,103]) ; f.setArray(arr)
+ arr=DataArrayInt32([101,102,103]) ; f.setArray(arr)
fmts.appendFieldProfile(f,mm,0,pfl)
#
mm.write(fname,2)
m.insertNextCell(NORM_QUAD4,[104,105,106,107])
mm[0]=m
mm.write(fname,2)
- arr0=DataArrayInt([10,11,12,13,100,101])
+ arr0=DataArrayInt32([10,11,12,13,100,101])
f=MEDCouplingFieldInt(ON_CELLS) ; f.setArray(arr0) ; f.setMesh(m)
f.setName(fieldName) ; f.setTime(2.,6,7)
f0=f.deepCopy()
fmts=MEDFileIntFieldMultiTS(fname,fieldName)
self.assertTrue(f1.isEqual(fmts.field(8,9,mm),1e-12,0))
## Basic test on nodes on top level
- f2=MEDCouplingFieldInt(ON_NODES) ; arr2=DataArrayInt([200,201,202]) ; arr2.setInfoOnComponent(0,"tutu") ; f2.setArray(arr2) ; f2.setMesh(m) ; f2.setTime(22.,23,24)
+ f2=MEDCouplingFieldInt(ON_NODES) ; arr2=DataArrayInt32([200,201,202]) ; arr2.setInfoOnComponent(0,"tutu") ; f2.setArray(arr2) ; f2.setMesh(m) ; f2.setTime(22.,23,24)
f2.setName(fieldName)
mm.write(fname,2)
ff=MEDFileIntField1TS() ; ff.setFieldNoProfileSBT(f2) ; ff.write(fname,0)
fmts=MEDFileIntFieldMultiTS(fname,fieldName)
self.assertTrue(f2.isEqual(fmts.field(23,24,mm),1e-12,0))
## Node on elements
- f3=MEDCouplingFieldInt(ON_GAUSS_NE) ; f3.setMesh(m) ; arr3=DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]) ; f3.setArray(arr3) ; f3.setTime(0.5,2,3)
+ f3=MEDCouplingFieldInt(ON_GAUSS_NE) ; f3.setMesh(m) ; arr3=DataArrayInt32([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]) ; f3.setArray(arr3) ; f3.setTime(0.5,2,3)
f3.setName(fieldName) ; f3.checkConsistencyLight()
mm.write(fname,2) ; ff=MEDFileIntField1TS() ; ff.setFieldNoProfileSBT(f3) ; ff.write(fname,0)
#
f4=MEDCouplingFieldInt(ON_GAUSS_PT) ; f4.setMesh(m) ; f4.setName(fieldName)
f4.setGaussLocalizationOnType(NORM_TRI3,[0.,0.,1.,0.,1.,1.],[0.1,0.1, 0.2,0.2, 0.3,0.3, 0.4,0.4, 0.5,0.5],[0.2,0.3,0.1,0.05,0.35])
f4.setGaussLocalizationOnType(NORM_QUAD4,[0.,0.,1.,0.,1.,1.,0.,1.],[0.3,0.4, 0.6,0.7],[0.7,0.3]) ; f4.setTime(0.25,4,5)
- arr4=DataArrayInt([0,1,2,3,4 ,10,11,12,13,14, 20,21,22,23,24, 30,31,32,33,34, 45,46, 55,56]) ; arr4.setInfoOnComponent(0,"abc") ; f4.setArray(arr4)
+ arr4=DataArrayInt32([0,1,2,3,4 ,10,11,12,13,14, 20,21,22,23,24, 30,31,32,33,34, 45,46, 55,56]) ; arr4.setInfoOnComponent(0,"abc") ; f4.setArray(arr4)
f4.checkConsistencyLight()
mm.write(fname,2) ; ff=MEDFileIntField1TS() ; ff.setFieldNoProfileSBT(f4) ; ff.write(fname,0)
#
mm[0]=m0
mm.write(fname,2)
# start slowly
- f1=MEDCouplingFieldInt(ON_CELLS) ; f1.setName(fieldName) ; f1.setArray(DataArrayInt([(0,100),(1,101)])) ; f1.setMesh(mm[0]) ; f1.setTime(4.,1,2)
+ f1=MEDCouplingFieldInt(ON_CELLS) ; f1.setName(fieldName) ; f1.setArray(DataArrayInt32([(0,100),(1,101)])) ; f1.setMesh(mm[0]) ; f1.setTime(4.,1,2)
f1ts=MEDFileIntField1TS() ; f1ts.setFieldNoProfileSBT(f1) ; f1ts.write(fname,0)
#
mm=MEDFileMesh.New(fname) ; f1ts=MEDFileIntField1TS(fname,fieldName,1,2)
self.assertTrue(f1.isEqual(f1ts.field(mm),1e-12,0))
# here f1 lying on level -1 not 0 check if "field" method detect it !
- f1=MEDCouplingFieldInt(ON_CELLS) ; f1.setName(fieldName) ; f1.setArray(DataArrayInt([(0,100),(1,101),(0,100),(1,101),(0,100),(1,101)]))
+ f1=MEDCouplingFieldInt(ON_CELLS) ; f1.setName(fieldName) ; f1.setArray(DataArrayInt32([(0,100),(1,101),(0,100),(1,101),(0,100),(1,101)]))
f1.setMesh(mm[-1]) # -1 is very important
f1.setTime(16.,3,4)
f1.checkConsistencyLight()
# nodes on elements
f3=MEDCouplingFieldInt(ON_GAUSS_NE)
f3.setMesh(mm[-1]) # this line is important
- arr3=DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]) ; f3.setArray(arr3) ; f3.setTime(0.5,2,3)
+ arr3=DataArrayInt32([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]) ; f3.setArray(arr3) ; f3.setTime(0.5,2,3)
f3.setName(fieldName) ; f3.checkConsistencyLight()
mm.write(fname,2) ; ff=MEDFileIntField1TS() ; ff.setFieldNoProfileSBT(f3) ; ff.write(fname,0)
#
f4.setName(fieldName)
f4.setGaussLocalizationOnType(NORM_TRI3,[0.,0.,1.,0.,1.,1.],[0.1,0.1, 0.2,0.2, 0.3,0.3, 0.4,0.4, 0.5,0.5],[0.2,0.3,0.1,0.05,0.35])
f4.setGaussLocalizationOnType(NORM_QUAD4,[0.,0.,1.,0.,1.,1.,0.,1.],[0.3,0.4, 0.6,0.7],[0.7,0.3]) ; f4.setTime(0.25,4,5)
- arr4=DataArrayInt([0,1,2,3,4 ,10,11,12,13,14, 20,21,22,23,24, 30,31,32,33,34, 45,46, 55,56]) ; arr4.setInfoOnComponent(0,"abc") ; f4.setArray(arr4)
+ arr4=DataArrayInt32([0,1,2,3,4 ,10,11,12,13,14, 20,21,22,23,24, 30,31,32,33,34, 45,46, 55,56]) ; arr4.setInfoOnComponent(0,"abc") ; f4.setArray(arr4)
f4.checkConsistencyLight()
mm.write(fname,2) ; ff=MEDFileIntField1TS() ; ff.setFieldNoProfileSBT(f4) ; ff.write(fname,0)
mm=MEDFileMesh.New(fname) ; f1ts=MEDFileIntField1TS(fname,fieldName,4,5)
std::vector<std::pair<int,int> > ret;
if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
ret.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
std::pair<int,int> p;
- int size2=PyTuple_Size(o);
+ std::size_t size2=PyTuple_Size(o);
if(size2!=2)
throw INTERP_KERNEL::Exception("tuples in list must be of size 2 (dt,it) !");
PyObject *o0=PyTuple_GetItem(o,0);
static const char msg2[]="Unrecognized python argument : expected a list of string or tuple of string or string !";
if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
v.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
v[i]=convertPyObjectToStr(o,msg0);
}
else if(PyTuple_Check(pyLi))
{
- int size=PyTuple_Size(pyLi);
+ std::size_t size=PyTuple_Size(pyLi);
v.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
v[i]=convertPyObjectToStr(o,msg1);
static PyObject *convertFieldDoubleVecToPy(const std::vector<MEDCoupling::MEDCouplingFieldDouble *>& li)
{
- int sz=li.size();
+ std::size_t sz=li.size();
PyObject *ret=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
PyObject *o=SWIG_NewPointerObj((void*)li[i],SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,SWIG_POINTER_OWN | 0);
PyList_SetItem(ret,i,o);
return ret;
}
-PyObject *convertVecPairIntToPy(const std::vector< std::pair<int,int> >& vec)
+template< class T >
+PyObject *convertVecPairIntToPy(const std::vector< std::pair<int,T> >& vec)
{
PyObject *ret(PyList_New(vec.size()));
int rk=0;
- for(std::vector< std::pair<int,int> >::const_iterator iter=vec.begin();iter!=vec.end();iter++,rk++)
+ for(typename std::vector< std::pair<int,T> >::const_iterator iter=vec.begin();iter!=vec.end();iter++,rk++)
{
PyObject *elt=PyTuple_New(2);
PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
- PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
+ PyTuple_SetItem(elt,1,PyInt_FromLong((*iter).second));
PyList_SetItem(ret,rk,elt);
}
return ret;
PyObject *convertVecPairVecStToPy(const std::vector< std::pair<std::vector<std::string>, std::string > >& vec)
{
- int sz=(int)vec.size();
+ std::size_t sz=vec.size();
PyObject *ret=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
PyObject *t=PyTuple_New(2);
int sz2=(int)vec[i].first.size();
PyObject *convertVectPairStToPy(const std::vector< std::pair<std::string, std::string > >& vec)
{
- int sz=(int)vec.size();
+ std::size_t sz=vec.size();
PyObject *ret=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
PyObject *t=PyTuple_New(2);
PyTuple_SetItem(t,0,PyString_FromString(vec[i].first.c_str()));
const char *msg="convertVecPairStStFromPy : Expecting PyList of Tuples of size 2 ! The first elt in tuple is one string and the 2nd one a string !";
if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
ret.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
std::pair<std::string, std::string> p;
- int size2=PyTuple_Size(o);
+ std::size_t size2=PyTuple_Size(o);
if(size2!=2)
throw INTERP_KERNEL::Exception(msg);
PyObject *o0=PyTuple_GetItem(o,0);
const char *msg="convertVecPairVecStFromPy : Expecting PyList of Tuples of size 2 ! The first elt in tuple is a list of strings and the 2nd one a string !";
if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
ret.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
std::pair<std::vector<std::string>, std::string> p;
- int size2=PyTuple_Size(o);
+ std::size_t size2=PyTuple_Size(o);
if(size2!=2)
throw INTERP_KERNEL::Exception(msg);
PyObject *o0=PyTuple_GetItem(o,0);
if(PyList_Check(o0))
{
- int size3=PyList_Size(o0);
+ std::size_t size3=PyList_Size(o0);
p.first.resize(size3);
- for(int j=0;j<size3;j++)
+ for(std::size_t j=0;j<size3;j++)
{
PyObject *o0j=PyList_GetItem(o0,j);
p.first[j]=convertPyObjectToStr(o0j,msg);
PyObject *o1=PyTuple_GetItem(elt0,1);
if(PyInt_Check(o0) && PyInt_Check(o1))
{//fmts(1,-1)
- int iter=PyInt_AS_LONG(o0);
- int order=PyInt_AS_LONG(o1);
+ int iter=(int)PyInt_AS_LONG(o0);
+ int order=(int)PyInt_AS_LONG(o1);
return self->getPosOfTimeStep(iter,order);
}
else
static const char msg[]="MEDFileFields::__getitem__ : only integer or string with fieldname supported !";
if(PyInt_Check(obj))
{
- return InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfFields());
+ return InterpreteNegativeInt(PyInt_AS_LONG(obj),self->getNumberOfFields());
}
return self->getPosFromFieldName(convertPyObjectToStr(obj,msg));
}
-void convertToMapIntDataArrayInt(PyObject *pyMap, std::map<int, MCAuto<DataArrayInt> >& cppMap)
+void convertToMapIntDataArrayInt(PyObject *pyMap, std::map<int, MCAuto<DataArrayIdType> >& cppMap)
{
if(!PyDict_Check(pyMap))
throw INTERP_KERNEL::Exception("convertToMapIntDataArrayInt : input is not a python map !");
{
if(!PyInt_Check(key))
throw INTERP_KERNEL::Exception("convertToMapIntDataArrayInt : keys in map must be PyInt !");
- long k(PyInt_AS_LONG(key));
+ int k((int)PyInt_AS_LONG(key));
void *argp(0);
- int status(SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0));
+ int status(SWIG_ConvertPtr(value,&argp,SWIGTITraits<mcIdType>::TI,0|0));
if(!SWIG_IsOK(status))
{
std::ostringstream oss; oss << "convertToMapIntDataArrayInt : values in map must be DataArrayInt !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- DataArrayInt *arg(reinterpret_cast<DataArrayInt*>(argp));
- MCAuto<DataArrayInt> arg2(arg);
+ DataArrayIdType *arg(reinterpret_cast<DataArrayIdType*>(argp));
+ MCAuto<DataArrayIdType> arg2(arg);
if(arg)
arg->incrRef();
cppMap[k]=arg2;
template<class T>
PyObject *MEDFileField1TS_getFieldWithProfile(const typename MLFieldTraits<T>::F1TSType *self, TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh)
{
- DataArrayInt *ret1(NULL);
+ DataArrayIdType *ret1(NULL);
typename MEDCoupling::Traits<T>::ArrayType *ret0(self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1));
PyObject *ret(PyTuple_New(2));
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<T>::TI, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
template<class T>
PyObject *MEDFileField1TS_getUndergroundDataArrayExt(const typename MLFieldTraits<T>::F1TSType *self)
{
- std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
+ std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > elt1Cpp;
typename MEDCoupling::Traits<T>::ArrayType *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
if(elt0)
elt0->incrRef();
PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
PyObject *elt3=PyTuple_New(2);
- PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
- PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
+ PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first));
+ PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second));
PyTuple_SetItem(elt1,0,elt2);
PyTuple_SetItem(elt1,1,elt3);
PyList_SetItem(elt,i,elt1);
{
const char fileName[]="file10.med";
MEDCouplingUMesh *mesh1=build3DMesh_1();
- const int part1[5]={1,2,4,13,15};
+ const mcIdType part1[5]={1,2,4,13,15};
MEDCouplingUMesh *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true);
mesh2->setName("mesh2");
- const int part2[4]={3,4,13,14};
+ const mcIdType part2[4]={3,4,13,14};
MEDCouplingUMesh *mesh3=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part2,part2+4,true);
mesh3->setName("mesh3");
MEDCouplingUMesh *mesh4=MEDCouplingUMesh::New();
mesh4->setName("mesh4");
mesh4->setMeshDimension(3);
mesh4->allocateCells(1);
- int conn[4]={0,11,1,3};
+ mcIdType conn[4]={0,11,1,3};
mesh4->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn);
mesh4->finishInsertingCells();
mesh4->setCoords(mesh1->getCoords());
//
MEDCouplingUMesh *mesh5=ReadUMeshFromFile(fileName,mnane);
mesh1->setName(mnane);
- const int part3[18]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
+ const mcIdType part3[18]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
MEDCouplingUMesh *mesh6=(MEDCouplingUMesh *)mesh5->buildPartOfMySelf(part3,part3+18,true);
mesh6->setName(mnane);
mesh5->decrRef();
const char fileName[]="file12.med";
MEDCouplingUMesh *mesh1=build3DMesh_1();
bool b;
- int newNbOfNodes;
- DataArrayInt *da=mesh1->mergeNodes(1e-12,b,newNbOfNodes);
+ mcIdType newNbOfNodes;
+ DataArrayIdType *da=mesh1->mergeNodes(1e-12,b,newNbOfNodes);
da->decrRef();
WriteUMesh(fileName,mesh1,true);
- const int part1[5]={1,2,4,13,15};
+ const mcIdType part1[5]={1,2,4,13,15};
MEDCouplingUMesh *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true);
mesh2->setName(mesh1->getName().c_str());//<- important for the test
//
- int nbOfCells=mesh2->getNumberOfCells();
- CPPUNIT_ASSERT_EQUAL(5,nbOfCells);
+ mcIdType nbOfCells=mesh2->getNumberOfCells();
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),nbOfCells);
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
f1->setName("VectorFieldOnCells");
f1->setMesh(mesh2);
const char fileName[]="file19.med";
const char fileName2[]="file20.med";
MEDCouplingUMesh *m=build2DMesh_1();
- int nbOfNodes=m->getNumberOfNodes();
+ mcIdType nbOfNodes=m->getNumberOfNodes();
WriteUMesh(fileName,m,true);
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
f1->setName("VFieldOnNodes");
array->decrRef();
f1->setTime(3.14,2,7);
f1->checkConsistencyLight();
- const int arr2[2]={1,4};//node ids are 2,4,5,3,6,7
+ const mcIdType arr2[2]={1,4};//node ids are 2,4,5,3,6,7
MEDCouplingFieldDouble *f2=f1->buildSubPart(arr2,arr2+2);
(const_cast<MEDCouplingMesh *>(f2->getMesh()))->setName(f1->getMesh()->getName().c_str());
WriteField(fileName,f2,false);//<- false important for the test
CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12));
f3->decrRef();
//
- const int arr3[6]={1,3,0,5,2,4};
+ const mcIdType arr3[6]={1,3,0,5,2,4};
f2->renumberNodes(arr3);
WriteUMesh(fileName2,m,true);
WriteField(fileName2,f2,false);//<- false important for the test
std::copy(arr2,arr2+24,tmp);
f1->setTime(3.17,2,7);
//
- const int renumArr[12]={3,7,2,1,5,11,10,0,9,6,8,4};
+ const mcIdType renumArr[12]={3,7,2,1,5,11,10,0,9,6,8,4};
f1->renumberNodes(renumArr);
f1->checkConsistencyLight();
WriteField(fileName,f1,false);//<- false important for the test
{
const char fileName[]="file15.med";
MEDCouplingUMesh *mesh=build3DSurfMesh_1();
- const int renumber1[6]={2,5,1,0,3,4};
+ const mcIdType renumber1[6]={2,5,1,0,3,4};
mesh->renumberCells(renumber1,false);
mesh->checkConsistencyLight();
WriteUMesh(fileName,mesh,true);
f1->setTime(3.14,2,7);
f1->checkConsistencyLight();
//
- const int renumber1[6]={2,1,5,0,3,4};
+ const mcIdType renumber1[6]={2,1,5,0,3,4};
f1->renumberCells(renumber1,false);
WriteField(fileName,f1,true);
MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName,mesh->getName().c_str(),0,f1->getName().c_str(),2,7));
const char fileName[]="file17.med";
MEDCouplingUMesh *m=build3DMesh_2();
CPPUNIT_ASSERT_EQUAL(20,(int)m->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(45,m->getNumberOfNodes());
- const int polys[3]={1,4,6};
- std::vector<int> poly2(polys,polys+3);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(45),m->getNumberOfNodes());
+ const mcIdType polys[3]={1,4,6};
+ std::vector<mcIdType> poly2(polys,polys+3);
m->convertToPolyTypes(&poly2[0],&poly2[0]+poly2.size());
- const int renum[20]={1,3,2,8,9,12,13,16,19,0,4,7,5,15,14,17,10,18,6,11};
+ const mcIdType renum[20]={1,3,2,8,9,12,13,16,19,0,4,7,5,15,14,17,10,18,6,11};
m->renumberCells(renum,false);
m->orientCorrectlyPolyhedrons();
// Writing
MEDCouplingUMesh *m3d=build3DMesh_2();
const double pt[3]={0.,0.,-0.3};
const double vec[3]={0.,0.,1.};
- std::vector<int> nodes;
+ std::vector<mcIdType> nodes;
m3d->findNodesOnPlane(pt,vec,1e-12,nodes);
MEDCouplingUMesh *m2d=(MEDCouplingUMesh *)m3d->buildFacePartOfMySelfNode(&nodes[0],&nodes[0]+nodes.size(),true);
- const int renumber[5]={1,2,0,4,3};
+ const mcIdType renumber[5]={1,2,0,4,3};
m2d->renumberCells(renumber,false);
m2d->setName("ExampleOfMultiDimW");
std::vector<const MEDCouplingUMesh *> meshes;
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,mesh->getTypeOfCell(13));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,mesh->getTypeOfCell(14));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(15));
- CPPUNIT_ASSERT_EQUAL((std::size_t)90,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(90),mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(701,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+90,0));
CPPUNIT_ASSERT_EQUAL(705,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+17,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(0));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(1));
- CPPUNIT_ASSERT_EQUAL((std::size_t)11,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(11),mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(132,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+11,0));
CPPUNIT_ASSERT_EQUAL(16,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+3,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(7,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
for(int i=0;i<6;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(6));
- CPPUNIT_ASSERT_EQUAL((std::size_t)36,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(36),mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(254,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+36,0));
CPPUNIT_ASSERT_EQUAL(141,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+8,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15));
- CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0));
CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15));
- CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0));
CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15));
- CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0));
CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15));
- CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0));
CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(538,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(579,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(579),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
for(int i=0;i<514;i++)
CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(i));
std::transform(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+12,expectedVals1,diffValue1,std::minus<double>());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::max_element(diffValue1,diffValue1+12),1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::min_element(diffValue1,diffValue1+12),1e-12);
- CPPUNIT_ASSERT_EQUAL((std::size_t)2768,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2768),mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(651050,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+2768,0));
CPPUNIT_ASSERT_EQUAL(725943,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+539,0));
mesh->decrRef();
CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(538,(int)constMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(579,constMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(579),constMesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<514;i++)
CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,constMesh->getTypeOfCell(i));
std::transform(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+12,expectedVals1,diffValue1,std::minus<double>());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::max_element(diffValue1,diffValue1+12),1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::min_element(diffValue1,diffValue1+12),1e-12);
- CPPUNIT_ASSERT_EQUAL((std::size_t)2768,constMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2768),constMesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(651050,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+2768,0));
CPPUNIT_ASSERT_EQUAL(725943,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+539,0));
const double *values=field->getArray()->getPointer();
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(0));
CPPUNIT_ASSERT_EQUAL(NORM_POLYHED,mesh->getTypeOfCell(1));
CPPUNIT_ASSERT_EQUAL(NORM_POLYHED,mesh->getTypeOfCell(2));
- CPPUNIT_ASSERT_EQUAL((std::size_t)98,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(98),mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(725,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+98,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(110.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(155,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+4,0));
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(17,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(NORM_POLYGON,mesh->getTypeOfCell(0));
CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(1));
CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(15));
CPPUNIT_ASSERT_EQUAL(NORM_TRI3,mesh->getTypeOfCell(16));
CPPUNIT_ASSERT_DOUBLES_EQUAL(110.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12);
- CPPUNIT_ASSERT_EQUAL((std::size_t)83,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(83),mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(619,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+83,0));
mesh->decrRef();
//
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(1,(int)mesh->getAllGeoTypes().size());
for(int i=0;i<3;i++)
CPPUNIT_ASSERT_EQUAL(NORM_POLYGON,mesh->getTypeOfCell(i));
- CPPUNIT_ASSERT_EQUAL((std::size_t)19,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(117,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+19,0));
mesh->decrRef();
//
mesh=ReadUMeshFromFamilies(fileName.c_str(),meshNames[0].c_str(),0,families2);
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(0,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(0,(int)mesh->getAllGeoTypes().size());
mesh->decrRef();
MEDCouplingUMesh *MEDLoaderTest::build1DMesh_1()
{
double coords[6]={ 0.0, 0.3, 0.75, 1.0, 1.4, 1.3 };
- int conn[9]={ 0,1, 1,2, 2,3 , 3,4,5};
+ mcIdType conn[9]={ 0,1, 1,2, 2,3 , 3,4,5};
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setName("1DMesh_1");
mesh->setMeshDimension(1);
MEDCouplingUMesh *MEDLoaderTest::build2DCurveMesh_1()
{
double coords[12]={ 0.0,0.0, 0.3,0.3, 0.75,0.75, 1.0,1.0, 1.4,1.4, 1.3,1.3 };
- int conn[9]={ 0,1, 1,2, 2,3 , 3,4,5};
+ mcIdType conn[9]={ 0,1, 1,2, 2,3 , 3,4,5};
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setName("2DCurveMesh_1");
mesh->setMeshDimension(1);
MEDCouplingUMesh *MEDLoaderTest::build2DMesh_1()
{
double targetCoords[24]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7, -0.05,0.95, 0.2,1.2, 0.45,0.95 };
- int targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4};
+ mcIdType targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(6);
-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7,
-0.05,0.95, 0.2,1.2, 0.45,0.95
};
- int targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4};
+ mcIdType targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(5);
-0.3,-0.3,-0.3, 0.2,-0.3,-0.3, 0.7,-0.3,-0.3, -0.3,0.2,-0.3, 0.2,0.2,-0.3, 0.7,0.2,-0.3, -0.3,0.7,-0.3, 0.2,0.7,-0.3, 0.7,0.7,-0.3
,-0.05,0.95,-0.3, 0.2,1.2,-0.3, 0.45,0.95,-0.3
};
- int targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4};
+ mcIdType targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(6);
0.,0.,3., 1.,1.,3., 1.,1.25,3., 0.,1.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3.,
3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.};
- int conn[354]={
+ mcIdType conn[354]={
// 0
0,11,1,3,15,26,16,18, 1,2,4,7,13,6,-1,1,16,21,6,-1,6,21,28,13,-1,13,7,22,28,-1,7,4,19,22,-1,4,2,17,19,-1,2,1,16,17,-1,16,21,28,22,19,17,
1,6,5,3,16,21,20,18, 13,10,9,6,28,25,24,21,
MEDCouplingUMesh *MEDLoaderTest::build3DMesh_2()
{
MEDCouplingUMesh *m3dsurfBase=build3DSurfMesh_1();
- int numbers[5]={0,1,2,3,5};
+ mcIdType numbers[5]={0,1,2,3,5};
MEDCouplingUMesh *m3dsurf=(MEDCouplingUMesh *)m3dsurfBase->buildPartOfMySelf(numbers,numbers+5,false);
m3dsurfBase->decrRef();
MEDCouplingUMesh *m1dBase=build1DMesh_1();
- int numbers2[4]={0,1,2,3};
+ mcIdType numbers2[4]={0,1,2,3};
MEDCouplingUMesh *m1d=(MEDCouplingUMesh *)m1dBase->buildPartOfMySelf(numbers2,numbers2+4,false);
m1dBase->decrRef();
m1d->changeSpaceDimension(3);
MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnCells_1()
{
MEDCouplingUMesh *mesh=build3DSurfMesh_1();
- int nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
f1->setName("VectorFieldOnCells");
f1->setMesh(mesh);
MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnNodes_1()
{
MEDCouplingUMesh *mesh=build3DSurfMesh_1();
- int nbOfNodes=mesh->getNumberOfNodes();
+ mcIdType nbOfNodes=mesh->getNumberOfNodes();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
f1->setName("VectorFieldOnNodes");
f1->setMesh(mesh);
const int spaceDim = 2;
const int nbOfNodes = 6;
double coords[nbOfNodes*spaceDim] = {0,0, 1,0, 1,1, 0,1, 2,0, 2,1};
- int conn[8]={0,1,2,3, 1,4,5,2};
+ mcIdType conn[8]={0,1,2,3, 1,4,5,2};
MCAuto<MEDCouplingUMesh> mesh2d=MEDCouplingUMesh::New("Mesh",spaceDim);
mesh2d->allocateCells(2);
mesh2d->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
// Create families and groups
- MCAuto<DataArrayInt> fam = DataArrayInt::New();
+ MCAuto<DataArrayIdType> fam = DataArrayIdType::New();
fam->alloc(2,1);
- int elemsFams[2] = {-2,-3};
+ mcIdType elemsFams[2] = {-2,-3};
std::copy(elemsFams,elemsFams+2,fam->getPointer());
m->setFamilyFieldArr(0,fam);
- std::map<std::string,int> theFamilies;
+ std::map<std::string,mcIdType> theFamilies;
theFamilies["FAM_-1"]=-1;
theFamilies["FAM_-2"]=-2;
theFamilies["FAM_-3"]=-3;
-6.111413346910e-07,
-6.111413346910e-07};
- for (int i=0; i < field1d->getNumberOfTuples(); i++)
+ for (mcIdType i=0; i < field1d->getNumberOfTuples(); i++)
{
CPPUNIT_ASSERT_DOUBLES_EQUAL( values[i], field1d->getIJ(i, 0), 1e-12 );
}
pointeM1D->setCoords( coords );
pointeM1D->setMeshDimension( 2 );
pointeM1D->allocateCells( 3 );
- int conn[]=
+ mcIdType conn[]=
{
0,1,2, 0,1,3, 10,11,12,13
};
};
std::copy(vals,vals+d->getNbOfElems(),d->getPointer());
f1->setArray(d);
- MCAuto<DataArrayInt> da=DataArrayInt::New();
- int ids[] =
+ MCAuto<DataArrayIdType> da=DataArrayIdType::New();
+ mcIdType ids[] =
{
0,2
};
CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"groupe4") != groups.end() );
CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"groupe5") != groups.end() );
CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"maa1") != groups.end() );
- CPPUNIT_ASSERT_EQUAL(16,m->getSizeAtLevel(0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(16),m->getSizeAtLevel(0));
MCAuto<MEDCouplingMesh> um0 = m->getMeshAtLevel(0);
CPPUNIT_ASSERT_EQUAL(12, (int)um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TETRA4 ));
CPPUNIT_ASSERT_EQUAL(2, (int)um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PYRA5 ));
// - Nombre de mailles de type MED_HEXA8 : 24
// - Nombre de mailles de type MED_PENTA6 : 3
MEDFileUMesh* m = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0));
- CPPUNIT_ASSERT_EQUAL(6, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 ));
- CPPUNIT_ASSERT_EQUAL(43, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_QUAD4 ));
- CPPUNIT_ASSERT_EQUAL(24, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_HEXA8 ));
- CPPUNIT_ASSERT_EQUAL(3, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PENTA6 ));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(6), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 ));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(43), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_QUAD4 ));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(24), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_HEXA8 ));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PENTA6 ));
}
void SauvLoaderTest::tearDown()
if (access(fileToRemove[i], F_OK) == 0)
#endif
#if defined(WIN32) && defined(UNICODE)
- _wremove(fileToRemove[i]);
+ _wremove(fileToRemove[i]);
#else
remove(fileToRemove[i]);
#endif
ADD_DEFINITIONS(${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${LIBXML2_DEFINITIONS})
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
INCLUDE_DIRECTORIES(
${LIBXML2_INCLUDE_DIR}
${MEDFILE_INCLUDE_DIRS}
,_description("")
,_local_domain_number(0)
,_distant_domain_number(0)
- ,_node_corresp(0)
- ,_face_corresp(0)
,_local_mesh(0)
,_distant_mesh(0)
+ ,_node_corresp(0)
+ ,_face_corresp(0)
{
}
MEDPARTITIONER::ConnectZone::~ConnectZone()
{
- for(std::map < std::pair <int, int>,MEDCouplingSkyLineArray * >::iterator iter=_entity_corresp.begin(); iter!=_entity_corresp.end();iter++)
+ for(std::map < std::pair <mcIdType, mcIdType>,MEDCouplingSkyLineArray * >::iterator iter=_entity_corresp.begin(); iter!=_entity_corresp.end();iter++)
{
iter->second->decrRef();
}
,_description(myConnectZone._description)
,_local_domain_number(myConnectZone._local_domain_number)
,_distant_domain_number(myConnectZone._distant_domain_number)
+ ,_local_mesh(0)
+ ,_distant_mesh(0)
,_node_corresp(myConnectZone._node_corresp)
,_face_corresp(myConnectZone._face_corresp)
,_entity_corresp(myConnectZone._entity_corresp)
- ,_local_mesh(0)
- ,_distant_mesh(0)
{
}
return _distant_mesh;
}
-bool MEDPARTITIONER::ConnectZone::isEntityCorrespPresent(int localEntity, int distantEntity) const
+bool MEDPARTITIONER::ConnectZone::isEntityCorrespPresent(mcIdType localEntity, mcIdType distantEntity) const
{
- typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
+ typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
for(map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++)
{
if ((iter->first).first==localEntity && (iter->first).second==distantEntity)
return false;
}
-const int *MEDPARTITIONER::ConnectZone::getNodeCorrespIndex() const
+const mcIdType *MEDPARTITIONER::ConnectZone::getNodeCorrespIndex() const
{
return _node_corresp->getIndex();
}
-const int *MEDPARTITIONER::ConnectZone::getNodeCorrespValue() const
+const mcIdType *MEDPARTITIONER::ConnectZone::getNodeCorrespValue() const
{
return _node_corresp->getValues();
}
-int MEDPARTITIONER::ConnectZone::getNodeNumber() const
+mcIdType MEDPARTITIONER::ConnectZone::getNodeNumber() const
{
return _node_corresp->getNumberOf();
}
return (const MEDCouplingSkyLineArray *)_node_corresp;
}
-const int *MEDPARTITIONER::ConnectZone::getFaceCorrespIndex() const
+const mcIdType *MEDPARTITIONER::ConnectZone::getFaceCorrespIndex() const
{
return _face_corresp->getIndex();
}
-const int *MEDPARTITIONER::ConnectZone::getFaceCorrespValue() const
+const mcIdType *MEDPARTITIONER::ConnectZone::getFaceCorrespValue() const
{
return _face_corresp->getValues();
}
-int MEDPARTITIONER::ConnectZone::getFaceNumber() const
+mcIdType MEDPARTITIONER::ConnectZone::getFaceNumber() const
{
return _face_corresp->getNumberOf();
}
return _face_corresp;
}
-const int *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(int localEntity,
- int distantEntity) const
+const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(mcIdType localEntity,
+ mcIdType distantEntity) const
{
- typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
+ typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
for(map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++)
{
return 0;
}
-const int *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(int localEntity,
- int distantEntity) const
+const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(mcIdType localEntity,
+ mcIdType distantEntity) const
{
- typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
+ typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
for (map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++)
{
return 0;
}
-int MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(int localEntity,
- int distantEntity) const
+mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(mcIdType localEntity,
+ mcIdType distantEntity) const
{
- typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
+ typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
for(map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++)
{
return 0;
}
-int MEDPARTITIONER::ConnectZone::getEntityCorrespLength(int localEntity,
- int distantEntity) const
+mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespLength(mcIdType localEntity,
+ mcIdType distantEntity) const
{
- typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
+ typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
for (map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++)
{
}
const MEDCouplingSkyLineArray *
-MEDPARTITIONER::ConnectZone::getEntityCorresp(int localEntity, int distantEntity) const
+MEDPARTITIONER::ConnectZone::getEntityCorresp(mcIdType localEntity, mcIdType distantEntity) const
{
- typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
+ typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
for (map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++)
{
return 0;
}
-std::vector< std::pair< int,int > > MEDPARTITIONER::ConnectZone::getEntities() const
+std::vector< std::pair< mcIdType,mcIdType > > MEDPARTITIONER::ConnectZone::getEntities() const
{
- std::vector< std::pair< int,int > > types;
+ std::vector< std::pair< mcIdType,mcIdType > > types;
- std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator
+ std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator
iter = _entity_corresp.begin();
for ( ; iter != _entity_corresp.end(); iter++)
{
* the node-node connections
* to a MEDCouplingSkyLineArray
*/
-void MEDPARTITIONER::ConnectZone::setNodeCorresp(const int * nodeCorresp, int nbnode)
+void MEDPARTITIONER::ConnectZone::setNodeCorresp(const mcIdType * nodeCorresp, mcIdType nbnode)
{
- MCAuto<DataArrayInt> indexArr( DataArrayInt::New() );
- MCAuto<DataArrayInt> valueArr( DataArrayInt::New() );
+ MCAuto<DataArrayIdType> indexArr( DataArrayIdType::New() );
+ MCAuto<DataArrayIdType> valueArr( DataArrayIdType::New() );
indexArr->alloc( nbnode+1 );
valueArr->alloc( 2*nbnode );
- int * index = indexArr->getPointer();
- int * value = valueArr->getPointer();
- for (int i=0; i<nbnode; i++)
+ mcIdType * index = indexArr->getPointer();
+ mcIdType * value = valueArr->getPointer();
+ for (mcIdType i=0; i<nbnode; i++)
{
index[i]=2*i;
value[2*i ]=nodeCorresp[2*i];
* the face-face connections
* to a MEDCouplingSkyLineArray
*/
-void MEDPARTITIONER::ConnectZone::setFaceCorresp(const int * faceCorresp, int nbface)
+void MEDPARTITIONER::ConnectZone::setFaceCorresp(const mcIdType * faceCorresp, mcIdType nbface)
{
- MCAuto<DataArrayInt> indexArr( DataArrayInt::New() );
- MCAuto<DataArrayInt> valueArr( DataArrayInt::New() );
+ MCAuto<DataArrayIdType> indexArr( DataArrayIdType::New() );
+ MCAuto<DataArrayIdType> valueArr( DataArrayIdType::New() );
indexArr->alloc( nbface+1 );
valueArr->alloc( 2*nbface );
- int * index = indexArr->getPointer();
- int * value = valueArr->getPointer();
- for (int i=0; i<nbface; i++)
+ mcIdType * index = indexArr->getPointer();
+ mcIdType * value = valueArr->getPointer();
+ for (mcIdType i=0; i<nbface; i++)
{
index[i]=2*i;
value[2*i]=faceCorresp[2*i];
*
* the resulting MEDCouplingSkyLineArray is put in the map
*/
-void MEDPARTITIONER::ConnectZone::setEntityCorresp(int localEntity, int distantEntity,
- const int *entityCorresp, int nbentity)
+void MEDPARTITIONER::ConnectZone::setEntityCorresp(mcIdType localEntity, mcIdType distantEntity,
+ const mcIdType *entityCorresp, mcIdType nbentity)
{
- MCAuto<DataArrayInt> indexArr( DataArrayInt::New() );
- MCAuto<DataArrayInt> valueArr( DataArrayInt::New() );
+ MCAuto<DataArrayIdType> indexArr( DataArrayIdType::New() );
+ MCAuto<DataArrayIdType> valueArr( DataArrayIdType::New() );
indexArr->alloc( nbentity+1 );
valueArr->alloc( 2*nbentity );
- int * index = indexArr->getPointer();
- int * value = valueArr->getPointer();
- for (int i=0; i<nbentity; i++)
+ mcIdType * index = indexArr->getPointer();
+ mcIdType * value = valueArr->getPointer();
+ for (mcIdType i=0; i<nbentity; i++)
{
index[i]=2*i;
value[2*i ]=entityCorresp[2*i];
setEntityCorresp( localEntity, distantEntity, MEDCouplingSkyLineArray::New(indexArr,valueArr));
}
-void MEDPARTITIONER::ConnectZone::setEntityCorresp(int localEntity, int distantEntity,
+void MEDPARTITIONER::ConnectZone::setEntityCorresp(mcIdType localEntity, mcIdType distantEntity,
MEDCouplingSkyLineArray *array)
{
MEDCouplingSkyLineArray * nullArray = 0;
- std::map < std::pair <int,int>, MEDCouplingSkyLineArray * >::iterator it;
+ std::map < std::pair <mcIdType,mcIdType>, MEDCouplingSkyLineArray * >::iterator it;
it = _entity_corresp.insert
( std::make_pair( std::make_pair(localEntity,distantEntity), nullArray )).first;
if ( it->second != nullArray ) it->second->decrRef();
#include "MEDPARTITIONER.hxx"
#include "MCAuto.hxx"
+#include "MCType.hxx"
namespace MEDCoupling
{
MEDCouplingUMesh *getLocalMesh() const ;
MEDCouplingUMesh *getDistantMesh() const ;
- bool isEntityCorrespPresent(int localEntity,int distantEntity) const;
- const int *getNodeCorrespIndex() const;
- const int *getNodeCorrespValue() const;
- int getNodeNumber() const;
+ bool isEntityCorrespPresent(mcIdType localEntity,mcIdType distantEntity) const;
+ const mcIdType *getNodeCorrespIndex() const;
+ const mcIdType *getNodeCorrespValue() const;
+ mcIdType getNodeNumber() const;
const MEDCouplingSkyLineArray * getNodeCorresp() const;
- const int *getFaceCorrespIndex() const;
- const int *getFaceCorrespValue() const;
- int getFaceNumber() const;
+ const mcIdType *getFaceCorrespIndex() const;
+ const mcIdType *getFaceCorrespValue() const;
+ mcIdType getFaceNumber() const;
const MEDCouplingSkyLineArray * getFaceCorresp() 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;
- const MEDCouplingSkyLineArray * getEntityCorresp(int localEntity,
- int distantEntity) const;
- std::vector< std::pair< int,int > > getEntities() const;
+ const mcIdType *getEntityCorrespIndex(mcIdType localEntity,
+ mcIdType distantEntity) const;
+ const mcIdType *getEntityCorrespValue(mcIdType localEntity,
+ mcIdType distantEntity) const;
+ mcIdType getEntityCorrespNumber(mcIdType localEntity,
+ mcIdType distantEntity) const;
+ mcIdType getEntityCorrespLength(mcIdType localEntity,
+ mcIdType distantEntity) const;
+ const MEDCouplingSkyLineArray * getEntityCorresp(mcIdType localEntity,
+ mcIdType distantEntity) const;
+ std::vector< std::pair< mcIdType,mcIdType > > getEntities() const;
void setName(const std::string& name) ;
void setDescription(const std::string& description) ;
void setLocalMesh(MEDCouplingUMesh * localMesh) ;
void setDistantMesh(MEDCouplingUMesh * distantMesh) ;
- void setNodeCorresp(const int * nodeCorresp, int nbnode);
+ void setNodeCorresp(const mcIdType * nodeCorresp, mcIdType nbnode);
void setNodeCorresp(MEDCouplingSkyLineArray* array);
- void setFaceCorresp(const int * faceCorresp, int nbface);
+ void setFaceCorresp(const mcIdType * faceCorresp, mcIdType nbface);
void setFaceCorresp(MEDCouplingSkyLineArray* array);
- void setEntityCorresp(int localEntity, int distantEntity,
- const int * entityCorresp, int nbentity);
- void setEntityCorresp(int localEntity, int distantEntity,
+ void setEntityCorresp(mcIdType localEntity, mcIdType distantEntity,
+ const mcIdType * entityCorresp, mcIdType nbentity);
+ void setEntityCorresp(mcIdType localEntity, mcIdType distantEntity,
MEDCouplingSkyLineArray *array);
private :
std::string _name;
MCAuto<MEDCouplingSkyLineArray> _node_corresp;
MCAuto<MEDCouplingSkyLineArray> _face_corresp;
- std::map < std::pair <int,int>, MEDCouplingSkyLineArray * > _entity_corresp;
+ std::map < std::pair <mcIdType,mcIdType>, MEDCouplingSkyLineArray * > _entity_corresp;
};
}
# endif
int Graph::nbDomains() const
{
- std::set<int> domains;
+ std::set<mcIdType> domains;
if ( _partition.isNotNull() )
- if ( MEDCoupling::DataArrayInt* array = _partition->getValuesArray() )
+ if ( MEDCoupling::DataArrayIdType* array = _partition->getValuesArray() )
{
- for ( const int * dom = array->begin(); dom != array->end(); ++dom )
+ for ( const mcIdType * dom = array->begin(); dom != array->end(); ++dom )
domains.insert( *dom );
}
- return domains.size();
+ return (int)domains.size();
}
- const int *Graph::getPart() const
+ const mcIdType *Graph::getPart() const
{
return _partition->getValues();
}
- int Graph::nbVertices() const
+ mcIdType Graph::nbVertices() const
{
return _graph->getNumberOf();
}
#include "MEDPARTITIONER.hxx"
#include "MCAuto.hxx"
+#include "MCType.hxx"
#include <string>
virtual void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0) = 0;
//returns the partitioning
- const int *getPart() const;
+ const mcIdType *getPart() const;
//returns the number of graph vertices (which can correspond to the cells in the mesh!)
- int nbVertices() const;
+ mcIdType nbVertices() const;
// returns nb of domains in _partition
int nbDomains() const;
-
+
const MEDCouplingSkyLineArray *getGraph() const { return (const MEDCouplingSkyLineArray*)_graph; }
const MEDCouplingSkyLineArray *getPartition() const { return (const MEDCouplingSkyLineArray*)_partition; }
int nbproc=_domain_selector->nbProcs();
std::vector<BBTreeOfDim* > bbtree(nbdomain,(BBTreeOfDim*) 0);
std::vector<double* > bbxi(nbdomain,(double*) 0);
- std::vector<MEDCoupling::DataArrayInt*> rev(nbdomain,(MEDCoupling::DataArrayInt*) 0);
- std::vector<MEDCoupling::DataArrayInt*> revIndx(nbdomain,(MEDCoupling::DataArrayInt*) 0);
- int meshDim=-1;
+ std::vector<MEDCoupling::DataArrayIdType*> rev(nbdomain,(MEDCoupling::DataArrayIdType*) 0);
+ std::vector<MEDCoupling::DataArrayIdType*> revIndx(nbdomain,(MEDCoupling::DataArrayIdType*) 0);
+ //int meshDim=-1;
int spaceDim=-1;
//init rev and revIndx and bbtree for my domain (of me:proc n)
if(!_domain_selector->isMyDomain(mydomain))
continue;
const MEDCoupling::MEDCouplingUMesh* myMesh=_mesh_collection.getMesh(mydomain);
- meshDim = myMesh->getMeshDimension();
+ //meshDim = myMesh->getMeshDimension();
spaceDim= myMesh->getSpaceDimension();
- rev[mydomain] = MEDCoupling::DataArrayInt::New();
- revIndx[mydomain] = MEDCoupling::DataArrayInt::New();
+ rev[mydomain] = MEDCoupling::DataArrayIdType::New();
+ revIndx[mydomain] = MEDCoupling::DataArrayIdType::New();
myMesh->getReverseNodalConnectivity(rev[mydomain],revIndx[mydomain]);
double* bbx=new double[2*spaceDim*myMesh->getNumberOfNodes()];
for (int i=0; i<myMesh->getNumberOfNodes()*spaceDim; i++)
SendDoubleVec(vec,targetProc);
//retrieving target data for storage in commonDistantNodes array
- std::vector<int> localCorrespondency;
+ std::vector<mcIdType> localCorrespondency;
RecvIntVec(localCorrespondency, targetProc);
for (std::size_t i=0; i<localCorrespondency.size()/2; i++)
{
int sourceProc = isource%nbproc;
std::vector<double> recvVec;
RecvDoubleVec(recvVec,sourceProc);
- std::map<int,int> commonNodes; // (local nodes, distant nodes) list
- for (int inode=0; inode<(recvVec.size()/spaceDim); inode++)
+ std::map<mcIdType,mcIdType> commonNodes; // (local nodes, distant nodes) list
+ for (mcIdType inode=0; inode<ToIdType(recvVec.size()/spaceDim); inode++)
{
double* bbox=new double[2*spaceDim];
for (int i=0; i<spaceDim; i++)
bbox[2*i]=recvVec[inode*spaceDim+i]-1e-12;
bbox[2*i+1]=bbox[2*i]+2e-12;
}
- std::vector<int> inodes;
+ std::vector<mcIdType> inodes;
bbtree[itarget]->getIntersectingElems(bbox,inodes);
delete [] bbox;
}
}
- std::vector<int> nodeCellCorrespondency;
- for (std::map<int,int>::iterator iter=commonNodes.begin(); iter!=commonNodes.end(); iter++)
+ std::vector<mcIdType> nodeCellCorrespondency;
+ for (std::map<mcIdType,mcIdType>::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]; icell<revIndxPtr[iter->first+1]; icell++)
+ const mcIdType* revIndxPtr=revIndx[itarget]->getConstPointer();
+ const mcIdType* revPtr=rev[itarget]->getConstPointer();
+ for (mcIdType icell=revIndxPtr[iter->first]; icell<revIndxPtr[iter->first+1]; icell++)
{
nodeCellCorrespondency.push_back(iter->second); //
- int globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]);
+ mcIdType globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]);
nodeCellCorrespondency.push_back(globalCell);
}
}
std::cout << "proc " << _domain_selector->rank() << " : end JointFinder::findCommonDistantNodes" << std::endl;
}
-std::vector<std::vector<std::multimap<int,int> > >& MEDPARTITIONER::JointFinder::getDistantNodeCell()
+std::vector<std::vector<std::multimap<mcIdType,mcIdType> > >& MEDPARTITIONER::JointFinder::getDistantNodeCell()
{
return _distant_node_cell;
}
-std::vector<std::vector<std::vector<std::pair<int,int> > > >& MEDPARTITIONER::JointFinder::getNodeNode()
+std::vector<std::vector<std::vector<std::pair<mcIdType,mcIdType> > > >& MEDPARTITIONER::JointFinder::getNodeNode()
{
return _node_node;
}
{
for (int itarget=0; itarget<nbdomain; itarget++)
{
- std::multimap<int,int>::iterator it;
+ std::multimap<mcIdType,mcIdType>::iterator it;
for (it=_distant_node_cell[isource][itarget].begin() ; it!=_distant_node_cell[isource][itarget].end(); it++)
{
std::cout << " nc" << _domain_selector->rank() << "|" << itarget << "|" << isource << "|" << (*it).first << "=" << (*it).second;
#define __MEDPARTITIONER_JOINTFINDER_HXX__
#include "MEDPARTITIONER.hxx"
+#include "MCType.hxx"
#include <map>
#include <vector>
~JointFinder();
void findCommonDistantNodes();
void print();
- std::vector<std::vector<std::multimap<int,int> > >& getDistantNodeCell();
- std::vector<std::vector<std::vector<std::pair<int,int> > > >& getNodeNode();
+ std::vector<std::vector<std::multimap<mcIdType,mcIdType> > >& getDistantNodeCell();
+ std::vector<std::vector<std::vector<std::pair<mcIdType,mcIdType> > > >& getNodeNode();
private:
const MeshCollection& _mesh_collection;
const ParaDomainSelector *_domain_selector;
const Topology *_topology;
- std::vector<std::vector<std::multimap<int,int> > > _distant_node_cell;
- std::vector<std::vector<std::vector<std::pair<int,int> > > > _node_node;
+ std::vector<std::vector<std::multimap<mcIdType,mcIdType> > > _distant_node_cell;
+ std::vector<std::vector<std::vector<std::pair<mcIdType,mcIdType> > > > _node_node;
};
}
_create_empty_groups(create_empty_groups),
_joint_finder(0)
{
- std::vector<std::vector<std::vector<int> > > new2oldIds(initialCollection.getTopology()->nbDomain());
- std::vector<MEDCoupling::DataArrayInt*> o2nRenumber;
+ std::vector<std::vector<std::vector<mcIdType> > > new2oldIds(initialCollection.getTopology()->nbDomain());
+ std::vector<MEDCoupling::DataArrayIdType*> o2nRenumber;
castCellMeshes(initialCollection, new2oldIds, o2nRenumber );
//nodeMapping contains the mapping between old nodes and new nodes
// (iolddomain,ioldnode)->(inewdomain,inewnode)
createNodeMapping(initialCollection, nodeMapping);
- std::vector<std::vector<std::vector<int> > > new2oldFaceIds;
+ std::vector<std::vector<std::vector<mcIdType> > > new2oldFaceIds;
castFaceMeshes(initialCollection, nodeMapping, new2oldFaceIds);
////////////////////
castAllFields(initialCollection,"cellFieldDouble");
if (_i_non_empty_mesh<0)
{
- for (size_t i=0; i<_mesh.size(); i++)
+ for (int i=0; i<getNbOfGlobalMeshes(); i++)
{
if (_mesh[i])
{
*/
void MEDPARTITIONER::MeshCollection::castCellMeshes(MeshCollection& initialCollection,
- std::vector<std::vector<std::vector<int> > >& new2oldIds,
- std::vector<MEDCoupling::DataArrayInt*> & o2nRenumber)
+ std::vector<std::vector<std::vector<mcIdType> > >& new2oldIds,
+ std::vector<MEDCoupling::DataArrayIdType*> & o2nRenumber)
{
if (MyGlobals::_Verbose>10)
std::cout << "proc " << MyGlobals::_Rank << " : castCellMeshes" << std::endl;
{
if (!isParallelMode() || initialCollection._domain_selector->isMyDomain(iold))
{
- int size=(initialCollection._mesh)[iold]->getNumberOfCells();
- std::vector<int> globalids(size);
+ mcIdType size=(initialCollection._mesh)[iold]->getNumberOfCells();
+ std::vector<mcIdType> globalids(size);
initialCollection.getTopology()->getCellList(iold, &globalids[0]);
- std::vector<int> ilocalnew(size); //local
+ std::vector<mcIdType> ilocalnew(size); //local
std::vector<int> ipnew(size); //idomain old
_topology->convertGlobalCellList(&globalids[0],size,&ilocalnew[0],&ipnew[0]);
_mesh[inew]=MEDCoupling::MEDCouplingUMesh::MergeUMeshes(meshes);
o2nRenumber[inew]=_mesh[inew]->sortCellsInMEDFileFrmt();
bool areNodesMerged;
- int nbNodesMerged;
+ mcIdType nbNodesMerged;
if (meshes.size()>1)
{
- MEDCoupling::DataArrayInt* array=_mesh[inew]->mergeNodes(1e-12,areNodesMerged,nbNodesMerged);
+ MEDCoupling::DataArrayIdType* array=_mesh[inew]->mergeNodes(1e-12,areNodesMerged,nbNodesMerged);
array->decrRef(); // array is not used in this case
}
_mesh[inew]->zipCoords();
// std::map<pair<double,pair<double, double> >, int > nodeClassifier;
MEDCoupling::DataArrayDouble* coords = initialCollection.getMesh(iold)->getCoords();
double* coordsPtr=coords->getPointer();
- dim = coords->getNumberOfComponents();
- int nvertices=initialCollection.getMesh(iold)->getNumberOfNodes();
+ dim = (int)coords->getNumberOfComponents();
+ mcIdType nvertices=initialCollection.getMesh(iold)->getNumberOfNodes();
bbox=new double[nvertices*2*dim];
for (int i=0; i<nvertices*dim;i++)
for (int inode=0; inode<mesh->getNumberOfNodes();inode++)
{
double* coordsPtr=coords->getPointer()+inode*dim;
- vector<int> elems;
+ vector<mcIdType> elems;
tree->getElementsAroundPoint(coordsPtr,elems);
if (elems.size()==0) continue;
nodeMapping.insert(make_pair(make_pair(iold,elems[0]),make_pair(inew,inode)));
for (int inode=0; inode<_mesh[inew]->getNumberOfNodes();inode++)
{
double* coordsPtr=coords->getPointer()+inode*dim;
- vector<int> elems;
+ vector<mcIdType> elems;
tree->getElementsAroundPoint(coordsPtr,elems);
if (elems.size()==0) continue;
nodeMapping.insert(make_pair(make_pair(iold,elems[0]),make_pair(inew,inode)));
}
-void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCouplingUMesh& meshTwo, std::vector<int>& nodeIds)
+void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCouplingUMesh& meshTwo, std::vector<mcIdType>& nodeIds)
{
using std::vector;
using MEDPARTITIONER::BBTreeOfDim;
//if (!&meshOne || !&meshTwo) return; //empty or not existing
double* bbox;
BBTreeOfDim* tree = 0;
- int nv1=meshOne.getNumberOfNodes();
+ mcIdType nv1=meshOne.getNumberOfNodes();
MEDCoupling::DataArrayDouble* coords=meshOne.getCoords();
- int dim = coords->getNumberOfComponents();
+ int dim = (int)coords->getNumberOfComponents();
bbox=new double[nv1*2*dim];
double* coordsPtr=coords->getPointer();
}
tree=new BBTreeOfDim( dim, bbox,0,0,nv1,1e-9);
- int nv2=meshTwo.getNumberOfNodes();
+ mcIdType nv2=meshTwo.getNumberOfNodes();
nodeIds.resize(nv2,-1);
coords=meshTwo.getCoords();
for (int inode=0; inode<nv2; inode++)
{
double* coordsPtr2=coords->getPointer()+inode*dim;
- vector<int> elems;
+ vector<mcIdType> elems;
tree->getElementsAroundPoint(coordsPtr2,elems);
if (elems.size()==0) continue;
nodeIds[inode]=elems[0];
faces at the interface are duplicated
*/
void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialCollection,
- const std::multimap<std::pair<int,int>, std::pair<int,int> >& nodeMapping,
- std::vector<std::vector<std::vector<int> > >& new2oldIds)
+ const std::multimap<std::pair<int,mcIdType>, std::pair<int,mcIdType> >& nodeMapping,
+ std::vector<std::vector<std::vector<mcIdType> > >& new2oldIds)
{
//splitMeshes structure will contain the partition of
//the old faces on the new ones
//initial face mesh known : in my domain
if (meshesCastFrom[iold] != 0)
{
- for (int ielem=0; ielem<meshesCastFrom[iold]->getNumberOfCells(); ielem++)
+ for (mcIdType ielem=0; ielem<meshesCastFrom[iold]->getNumberOfCells(); ielem++)
{
- vector<int> nodes;
+ vector<mcIdType> nodes;
meshesCastFrom[iold]->getNodeIdsOfCell(ielem,nodes);
- map <int,int> faces;
+ map <int,mcIdType> faces;
//analysis of element ielem
//counters are set for the element
//are incremented for each target node
//the face is considered as going to target domains if the counter of the domain
//is equal to the number of nodes
- for (int inode=0; inode<(int)nodes.size(); inode++)
+ for (std::size_t inode=0; inode<nodes.size(); inode++)
{
- typedef multimap<pair<int,int>,pair<int,int> >::const_iterator MI;
- int mynode=nodes[inode];
+ typedef multimap<pair<int,mcIdType>,pair<int,mcIdType> >::const_iterator MI;
+ mcIdType mynode=nodes[inode];
pair <MI,MI> myRange = nodeMapping.equal_range(make_pair(iold,mynode));
for (MI iter=myRange.first; iter!=myRange.second; iter++)
}
}
- for (map<int,int>::iterator iter=faces.begin(); iter!=faces.end(); iter++)
+ for (map<int,mcIdType>::iterator iter=faces.begin(); iter!=faces.end(); iter++)
{
- if (iter->second==(int)nodes.size())
+ if (iter->second==ToIdType(nodes.size()))
//cvw eligible but may be have to be face of a cell of this->getMesh()[inew]?
//it is not sure here...
//done before writeMedfile on option?... see filterFaceOnCell()
void MEDPARTITIONER::MeshCollection::castIntField(std::vector<MEDCoupling::MEDCouplingUMesh*>& meshesCastFrom,
std::vector<MEDCoupling::MEDCouplingUMesh*>& meshesCastTo,
- std::vector<MEDCoupling::DataArrayInt*>& arrayFrom,
+ std::vector<MEDCoupling::DataArrayIdType*>& arrayFrom,
std::string nameArrayTo)
{
using std::vector;
- int ioldMax=meshesCastFrom.size();
- int inewMax=meshesCastTo.size();
+ std::size_t ioldMax=meshesCastFrom.size();
+ std::size_t inewMax=meshesCastTo.size();
//preparing bounding box trees for accelerating source-target node identifications
std::cout<<"making accelerating structures"<<std::endl;
std::vector<BBTreeOfDim* > acceleratingStructures(ioldMax);
std::vector<MEDCoupling::DataArrayDouble*>bbox(ioldMax);
- for (int iold =0; iold< ioldMax; iold++)
+ for (unsigned int iold =0; iold< ioldMax; iold++)
if (isParallelMode() && _domain_selector->isMyDomain(iold))
{
MEDCoupling::DataArrayDouble* sourceCoords=meshesCastFrom[iold]->computeCellCenterOfMass();
}
// send-recv operations
#ifdef HAVE_MPI
- for (int inew=0; inew<inewMax; inew++)
+ for (unsigned int inew=0; inew<inewMax; inew++)
{
- for (int iold=0; iold<ioldMax; iold++)
+ for (unsigned int iold=0; iold<ioldMax; iold++)
{
//sending arrays for distant domains
if (isParallelMode() && _domain_selector->isMyDomain(iold) && !_domain_selector->isMyDomain(inew))
//send mesh
_domain_selector->sendMesh(*meshesCastFrom[iold],_domain_selector->getProcessorID(inew));
//send vector
- int size=arrayFrom[iold]->getNumberOfTuples(); //cvw may be -1!
- vector<int>sendIds;
+ mcIdType size=arrayFrom[iold]->getNumberOfTuples(); //cvw may be -1!
+ vector<mcIdType> sendIds;
if (MyGlobals::_Verbose>400) std::cout<<"proc "<<_domain_selector->rank()<<" : castIntField SendIntVec size "<<size<<std::endl;
if (size>0) //no empty
{
if (isParallelMode() && !_domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew))
{
//receive mesh
- vector<int> recvIds;
+ vector<mcIdType> recvIds;
MEDCoupling::MEDCouplingUMesh* recvMesh;
_domain_selector->recvMesh(recvMesh,_domain_selector->getProcessorID(iold));
//receive vector
}
#endif
- //local contributions and aggregation
- for (int inew=0; inew<inewMax; inew++)
+ //localc ontributions and aggregation
+ for (unsigned int inew=0; inew<inewMax; inew++)
{
- for (int iold=0; iold<ioldMax; iold++)
+ for (unsigned int iold=0; iold<ioldMax; iold++)
if (!isParallelMode() || ( _domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew)))
{
remapIntField(inew,iold,*meshesCastFrom[iold],*meshesCastTo[inew],arrayFrom[iold]->getConstPointer(),nameArrayTo,acceleratingStructures[iold]);
}
}
- for (int iold=0; iold<ioldMax;iold++)
+ for (unsigned int iold=0; iold<ioldMax;iold++)
if (isParallelMode() && _domain_selector->isMyDomain(iold))
{
bbox[iold]->decrRef();
void MEDPARTITIONER::MeshCollection::remapIntField(int inew, int iold,
const MEDCoupling::MEDCouplingUMesh& sourceMesh,
const MEDCoupling::MEDCouplingUMesh& targetMesh,
- const int* fromArray,
+ const mcIdType* fromArray,
std::string nameArrayTo,
const BBTreeOfDim* myTree)
{
if (sourceMesh.getNumberOfCells()<=0) return; //empty mesh could exist
MEDCoupling::DataArrayDouble* targetCoords=targetMesh.computeCellCenterOfMass();
const double* tc=targetCoords->getConstPointer();
- int targetSize=targetMesh.getNumberOfCells();
- int sourceSize=sourceMesh.getNumberOfCells();
+ mcIdType targetSize=targetMesh.getNumberOfCells();
+ mcIdType sourceSize=sourceMesh.getNumberOfCells();
if (MyGlobals::_Verbose>200)
std::cout<<"remap vers target de taille "<<targetSize<<std::endl;
- std::vector<int> ccI;
+ std::vector<mcIdType> ccI;
std::string str,cle;
str=nameArrayTo+"_toArray";
cle=Cle1ToStr(str,inew);
- int* toArray;
+ mcIdType* toArray;
const BBTreeOfDim* tree;
bool cleantree=false;
MEDCoupling::DataArrayDouble* sourceBBox=0;
- int dim = targetCoords->getNumberOfComponents();
+ int dim = (int)targetCoords->getNumberOfComponents();
if (myTree==0)
{
sourceBBox=sourceMesh.computeCellCenterOfMass()->computeBBoxPerTuple(1e-8);
{
if (MyGlobals::_Is0verbose>100)
std::cout << "create " << cle << " size " << targetSize << std::endl;
- MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New();
p->alloc(targetSize,1);
p->fillWithZero();
toArray=p->getPointer();
toArray=_map_dataarray_int.find(cle)->second->getPointer();
}
- std::map< int, int > isource2nb; // count coincident elements
- std::map<int,int>::iterator i2nb;
+ std::map< mcIdType, int > isource2nb; // count coincident elements
+ std::map< mcIdType, int>::iterator i2nb;
- for (int itargetnode=0; itargetnode<targetSize; itargetnode++)
+ for (mcIdType itargetnode=0; itargetnode<targetSize; itargetnode++)
{
- std::vector<int> intersectingElems;
+ std::vector<mcIdType> intersectingElems;
tree->getElementsAroundPoint(tc+itargetnode*dim,intersectingElems);
if (intersectingElems.size()!=0)
{
- int isourcenode=intersectingElems[0];
+ mcIdType isourcenode=intersectingElems[0];
if ( intersectingElems.size() > 1 )
{
i2nb = isource2nb.insert( std::make_pair( isourcenode, 0 )).first;
std::string nameTo="typeData=6"; //resume the type of field casted
// send-recv operations
- int ioldMax=initialCollection.getMesh().size();
- int inewMax=this->getMesh().size();
- int iFieldMax=initialCollection.getFieldDescriptions().size();
+ std::size_t ioldMax=initialCollection.getMesh().size();
+ std::size_t inewMax=this->getMesh().size();
+ std::size_t iFieldMax=initialCollection.getFieldDescriptions().size();
if (MyGlobals::_Verbose>10)
std::cout << "castAllFields with:\n" << ReprVectorOfString(initialCollection.getFieldDescriptions()) << std::endl;
//see collection.prepareFieldDescriptions()
- for (int ifield=0; ifield<iFieldMax; ifield++)
+ for (std::size_t ifield=0; ifield<iFieldMax; ifield++)
{
std::string descriptionField=initialCollection.getFieldDescriptions()[ifield];
if (descriptionField.find(nameTo)==std::string::npos)
continue; //only nameTo accepted in Fields name description
#ifdef HAVE_MPI
- for (int inew=0; inew<inewMax; inew++)
+ for (unsigned int inew=0; inew<inewMax; inew++)
{
- for (int iold=0; iold<ioldMax; iold++)
+ for (unsigned int iold=0; iold<ioldMax; iold++)
{
//sending arrays for distant domains
if (isParallelMode() && _domain_selector->isMyDomain(iold) && !_domain_selector->isMyDomain(inew))
}
#endif
//local contributions and aggregation
- for (int inew=0; inew<inewMax; inew++)
+ for (unsigned int inew=0; inew<inewMax; inew++)
{
- for (int iold=0; iold<ioldMax; iold++)
+ for (unsigned int iold=0; iold<ioldMax; iold++)
if (!isParallelMode() || ( _domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew)))
{
MEDCoupling::DataArrayDouble* field=initialCollection.getField(descriptionField,iold);
throw INTERP_KERNEL::Exception("Error remapDoubleField only on cellFieldDouble");
std::string key=Cle2ToStr("cellFamily_ccI",inew,iold);
- std::map<std::string,MEDCoupling::DataArrayInt*>::iterator it1;
+ std::map<std::string,MEDCoupling::DataArrayIdType*>::iterator it1;
it1=_map_dataarray_int.find(key);
if (it1==_map_dataarray_int.end())
{
return;
}
//create ccI in remapIntField
- MEDCoupling::DataArrayInt *ccI=it1->second;
+ MEDCoupling::DataArrayIdType *ccI=it1->second;
if (MyGlobals::_Verbose>300)
std::cout << "proc " << MyGlobals::_Rank << " : remapDoubleField " << key << " size " << ccI->getNbOfElems() << std::endl;
- int nbcell=this->getMesh()[inew]->getNumberOfCells();
- int nbcomp=fromArray->getNumberOfComponents();
+ mcIdType nbcell=this->getMesh()[inew]->getNumberOfCells();
+ std::size_t nbcomp=fromArray->getNumberOfComponents();
int nbPtGauss=StrToInt(ExtractFromDescription(descriptionField, "nbPtGauss="));
std::string tag="inewFieldDouble="+IntToStr(inew);
key=descriptionField+SerializeFromString(tag);
- int fromArrayNbOfElem=fromArray->getNbOfElems();
- int fromArrayNbOfComp=fromArray->getNumberOfComponents();
- int fromArrayNbOfCell=fromArrayNbOfElem/fromArrayNbOfComp/nbPtGauss;
+ mcIdType fromArrayNbOfElem=fromArray->getNbOfElems();
+ mcIdType fromArrayNbOfComp=ToIdType(fromArray->getNumberOfComponents());
+ mcIdType fromArrayNbOfCell=fromArrayNbOfElem/fromArrayNbOfComp/nbPtGauss;
if (MyGlobals::_Verbose>1000)
{
else
{
//replaced by setPartOfValuesAdv if nbPtGauss==1
- int iMax=ccI->getNbOfElems();
- int* pccI=ccI->getPointer();
+ mcIdType iMax=ccI->getNbOfElems();
+ mcIdType* pccI=ccI->getPointer();
double* pField=field->getPointer();
double* pFrom=fromArray->getPointer();
- int itarget, isource, delta=nbPtGauss*nbcomp;
- for (int i=0; i<iMax; i=i+2) //cell
+ mcIdType itarget, isource, delta=ToIdType(nbPtGauss*nbcomp);
+ for (mcIdType i=0; i<iMax; i=i+2) //cell
{
itarget=pccI[i];
isource=pccI[i+1];
if ((itarget<0) || (itarget>=nbcell) || (isource<0) || (isource>=fromArrayNbOfCell))
throw INTERP_KERNEL::Exception("Error field override");
- int ita=itarget*delta;
- int iso=isource*delta;
- for (int k=0; k<delta; k++) pField[ita+k]=pFrom[iso+k]; //components and gausspoints
+ mcIdType ita=itarget*delta;
+ mcIdType iso=isource*delta;
+ for (mcIdType k=0; k<delta; k++) pField[ita+k]=pFrom[iso+k]; //components and gausspoints
}
}
}
*/
//================================================================================
- DataArrayInt* sortCorrespondences( DataArrayInt* ids1,
- DataArrayInt* ids2,
- int delta,
- bool removeEqual = false)
+ DataArrayIdType* sortCorrespondences( DataArrayIdType* ids1,
+ DataArrayIdType* ids2,
+ int delta,
+ bool removeEqual = false)
{
// sort
- MCAuto< DataArrayInt > renumN2O = ids1->buildPermArrPerLevel();
+ MCAuto< DataArrayIdType > renumN2O = ids1->buildPermArrPerLevel();
ids1->renumberInPlaceR( renumN2O->begin() );
ids2->renumberInPlaceR( renumN2O->begin() );
}
if ( delta != 0 )
{
- int * id = ids1->getPointer();
+ mcIdType * id = ids1->getPointer();
for ( ; id < ids1->end(); ++id )
++(*id);
id = ids2->getPointer();
}
// join
- DataArrayInt* ids12 = DataArrayInt::Meld( ids1, ids2 ); // two components
+ DataArrayIdType* ids12 = DataArrayIdType::Meld( ids1, ids2 ); // two components
ids12->rearrange( 1 ); // make one component
return ids12;
}
*/
//================================================================================
- void renumber( DataArrayInt* ids, const DataArrayInt* o2nRenumber )
+ void renumber( DataArrayIdType* ids, const DataArrayIdType* o2nRenumber )
{
if ( !ids || !o2nRenumber )
return;
- int * id = ids->getPointer();
- const int * o2n = o2nRenumber->getConstPointer();
+ mcIdType * id = ids->getPointer();
+ const mcIdType * o2n = o2nRenumber->getConstPointer();
for ( ; id < ids->end(); ++id )
{
*id = o2n[ *id ];
//================================================================================
void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeMapping,
- const std::vector<MEDCoupling::DataArrayInt*> & o2nRenumber,
+ const std::vector<MEDCoupling::DataArrayIdType*> & o2nRenumber,
int nbInitialDomains)
{
if ( !MyGlobals::_Create_Joints || _topology->nbDomain() < 2 )
// 1) add node correspondences
// ==================================
- std::vector< std::vector< std::vector< int > > > nodeCorresp( nb_domains );
+ std::vector< std::vector< std::vector< mcIdType > > > nodeCorresp( nb_domains );
for ( int idomain = 0; idomain < nb_domains; ++idomain )
{
nodeCorresp[ idomain ].resize( nb_domains );
if ( ++nmIt2 == nmEnd )
break;
int dom1 = nmIt1->second.first;
- int node1 = nmIt1->second.second;
+ mcIdType node1 = nmIt1->second.second;
for ( ; nmIt2 != nmEnd; ++nmIt2 )
{
int dom2 = nmIt2->second.first;
- int node2 = nmIt2->second.second;
+ mcIdType node2 = nmIt2->second.second;
if ( dom1 != dom2 )
{
nodeCorresp[ dom1 ][ dom2 ].push_back( node1 );
{
for ( int idomainNear = 0; idomainNear < nb_domains; ++idomainNear )
{
- std::vector< int > & corresp = nodeCorresp[ idomain ][ idomainNear ];
+ std::vector< mcIdType > & corresp = nodeCorresp[ idomain ][ idomainNear ];
if ( corresp.empty() )
continue;
czVec.push_back(cz);
}
- cz->setNodeCorresp( &corresp[0], corresp.size()/2 );
+ cz->setNodeCorresp( &corresp[0], ToIdType( corresp.size()/2 ));
}
}
// separate ids of two domains
const MEDCoupling::MEDCouplingSkyLineArray *corrArray = cz->getEntityCorresp( 0, 0 );
- const DataArrayInt* ids12 = corrArray->getValuesArray();
- MCAuto<DataArrayInt> ids1, ids2, ids12Sorted;
+ const DataArrayIdType* ids12 = corrArray->getValuesArray();
+ MCAuto<DataArrayIdType> ids1, ids2, ids12Sorted;
ids1 = ids12->selectByTupleIdSafeSlice( 0, corrArray->getLength(), 2 );
ids2 = ids12->selectByTupleIdSafeSlice( 1, corrArray->getLength(), 2 );
}
else // split and sort
{
- typedef std::pair< std::vector< int >, std::vector< int > > T2Vecs;
+ typedef std::pair< std::vector< mcIdType >, std::vector< mcIdType > > T2Vecs;
T2Vecs idsByType[ INTERP_KERNEL::NORM_MAXTYPE ][ INTERP_KERNEL::NORM_MAXTYPE ];
int t1, t2;
- const int nbIds = ids1->getNbOfElems();
- const int * p1 = ids1->begin(), * p2 = ids2->begin();
- for ( int i = 0; i < nbIds; ++i )
+ const mcIdType nbIds = ids1->getNbOfElems();
+ const mcIdType * p1 = ids1->begin(), * p2 = ids2->begin();
+ for ( mcIdType i = 0; i < nbIds; ++i )
{
t1 = mesh1->getTypeOfCell( p1[ i ]);
t2 = mesh2->getTypeOfCell( p2[ i ]);
// separate ids of two domains
const MEDCoupling::MEDCouplingSkyLineArray *corrArray = cz->getNodeCorresp();
- const DataArrayInt *ids12 = corrArray->getValuesArray();
- MCAuto<DataArrayInt> ids1, ids2, ids12Sorted;
+ const DataArrayIdType *ids12 = corrArray->getValuesArray();
+ MCAuto<DataArrayIdType> ids1, ids2, ids12Sorted;
ids1 = ids12->selectByTupleIdSafeSlice( 0, corrArray->getLength(), 2 );
ids2 = ids12->selectByTupleIdSafeSlice( 1, corrArray->getLength(), 2 );
using MEDCoupling::DataArrayInt;
std::vector<MEDCouplingUMesh*>& faceMeshes = getFaceMesh();
- int nbMeshes = faceMeshes.size();
+ std::size_t nbMeshes = faceMeshes.size();
//preparing bounding box trees for accelerating search of coincident faces
std::vector<BBTreeOfDim* > bbTrees(nbMeshes);
std::vector<DataArrayDouble*>bbox (nbMeshes);
- for (int inew = 0; inew < nbMeshes-1; inew++)
+ for (unsigned int inew = 0; inew < nbMeshes-1; inew++)
if ( !isParallelMode() || _domain_selector->isMyDomain(inew) )
{
DataArrayDouble* bcCoords = faceMeshes[inew]->computeCellCenterOfMass();
}
// loop on domains to find joint faces between them
- for (int inew1 = 0; inew1 < nbMeshes; inew1++ )
+ for (unsigned int inew1 = 0; inew1 < nbMeshes; inew1++ )
{
- for (int inew2 = inew1+1; inew2 < nbMeshes; inew2++ )
+ for (unsigned int inew2 = inew1+1; inew2 < nbMeshes; inew2++ )
{
MEDCouplingUMesh* mesh1 = 0;
MEDCouplingUMesh* mesh2 = 0;
if ( mesh2Here && !mesh2 ) mesh2 = faceMeshes[ inew2 ];
// find coincident faces
- std::vector< int > faces1, faces2;
+ std::vector< mcIdType > faces1, faces2;
if ( mesh1 && mesh2 )
{
const DataArrayDouble* coords2 = mesh2->computeCellCenterOfMass();
- const double* c2 = coords2->getConstPointer();
- const int dim = coords2->getNumberOfComponents();
- const int nbFaces2 = mesh2->getNumberOfCells();
- const int nbFaces1 = mesh1->getNumberOfCells();
+ const double* c2 = coords2->getConstPointer();
+ const std::size_t dim = coords2->getNumberOfComponents();
+ const mcIdType nbFaces2 = mesh2->getNumberOfCells();
+ const mcIdType nbFaces1 = mesh1->getNumberOfCells();
- for (int i2 = 0; i2 < nbFaces2; i2++)
+ for (mcIdType i2 = 0; i2 < nbFaces2; i2++)
{
- std::vector<int> coincFaces;
+ std::vector<mcIdType> coincFaces;
bbTrees[inew1]->getElementsAroundPoint( c2+i2*dim, coincFaces );
if (coincFaces.size()!=0)
{
- int i1 = coincFaces[0];
+ mcIdType i1 = coincFaces[0];
// if ( coincFaces.size() > 1 )
// {
// i2nb = isource2nb.insert( std::make_pair( i1 , 0 )).first;
// delete bounding box trees
- for (int inew = 0; inew < nbMeshes-1; inew++)
+ for (unsigned int inew = 0; inew < nbMeshes-1; inew++)
if (isParallelMode() && _domain_selector->isMyDomain(inew))
{
bbox[inew]->decrRef();
*/
//================================================================================
-void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< int >& faces,
+void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< mcIdType >& faces,
const int inew1,
const int inew2,
const bool is2nd )
_group_info.erase( groupName );
// get family IDs array
- int* famIDs = 0;
+ mcIdType* famIDs = 0;
int inew = (is2nd ? inew2 : inew1 );
- int totalNbFaces = _face_mesh[ inew ] ? _face_mesh[ inew ]->getNumberOfCells() : 0;
+ mcIdType totalNbFaces = _face_mesh[ inew ] ? _face_mesh[ inew ]->getNumberOfCells() : 0;
std::string cle = Cle1ToStr( "faceFamily_toArray", inew );
if ( !_map_dataarray_int.count(cle) )
{
if ( totalNbFaces > 0 )
{
- MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New();
p->alloc( totalNbFaces, 1 );
p->fillWithZero();
famIDs = p->getPointer();
famIDs = _map_dataarray_int.find(cle)->second->getPointer();
}
// find a family ID of an existing JOINT group
- int familyID = 0;
- std::map<std::string, int>::iterator name2id = _family_info.find( groupName );
+ mcIdType familyID = 0;
+ std::map<std::string, mcIdType>::iterator name2id = _family_info.find( groupName );
if ( name2id != _family_info.end() )
familyID = name2id->second;
// remove faces from the familyID-the family
if ( familyID != 0 && famIDs )
- for ( int i = 0; i < totalNbFaces; ++i )
+ for ( mcIdType i = 0; i < totalNbFaces; ++i )
if ( famIDs[i] == familyID )
famIDs[i] = 0;
if ( familyID == 0 ) // generate a family ID for JOINT group
{
- std::set< int > familyIDs;
+ std::set< mcIdType > familyIDs;
for ( name2id = _family_info.begin(); name2id != _family_info.end(); ++name2id )
familyIDs.insert( name2id->second );
// find the next free family ID
throw INTERP_KERNEL::Exception("file does not comply with any recognized format");
}
}
- for ( int idomain = 0; idomain < (int)_mesh.size(); ++idomain )
+ for ( unsigned int idomain = 0; idomain < _mesh.size(); ++idomain )
if ( _mesh[idomain] && _mesh[idomain]->getNumberOfNodes() > 0 )
_i_non_empty_mesh = idomain;
}
}
}
// find non-empty domain mesh
- for ( int idomain = 0; idomain < (int)_mesh.size(); ++idomain )
+ for ( unsigned int idomain = 0; idomain < _mesh.size(); ++idomain )
if ( _mesh[idomain] && _mesh[idomain]->getNumberOfNodes() > 0 )
_i_non_empty_mesh = idomain;
MEDPARTITIONER::MeshCollection::~MeshCollection()
{
- for (int i=0; i<(int)_mesh.size();i++)
+ for (std::size_t i=0; i<_mesh.size();i++)
if (_mesh[i]!=0) _mesh[i]->decrRef();
- for (int i=0; i<(int)_cell_family_ids.size();i++)
+ for (std::size_t i=0; i<_cell_family_ids.size();i++)
if (_cell_family_ids[i]!=0)
_cell_family_ids[i]->decrRef();
- for (int i=0; i<(int)_face_mesh.size();i++)
+ for (std::size_t i=0; i<_face_mesh.size();i++)
if (_face_mesh[i]!=0)
_face_mesh[i]->decrRef();
- for (int i=0; i<(int)_face_family_ids.size();i++)
+ for (std::size_t i=0; i<_face_family_ids.size();i++)
if (_face_family_ids[i]!=0)
_face_family_ids[i]->decrRef();
- for (std::map<std::string, MEDCoupling::DataArrayInt*>::iterator it=_map_dataarray_int.begin() ; it!=_map_dataarray_int.end(); it++ )
+ for (std::map<std::string, MEDCoupling::DataArrayIdType*>::iterator it=_map_dataarray_int.begin() ; it!=_map_dataarray_int.end(); it++ )
if ((*it).second!=0)
(*it).second->decrRef();
return nb;
}
-int MEDPARTITIONER::MeshCollection::getNbOfLocalCells() const
+mcIdType MEDPARTITIONER::MeshCollection::getNbOfLocalCells() const
{
- int nb=0;
+ mcIdType nb=0;
for (size_t i=0; i<_mesh.size(); i++)
{
if (_mesh[i]) nb=nb+_mesh[i]->getNumberOfCells();
return nb;
}
-int MEDPARTITIONER::MeshCollection::getNbOfLocalFaces() const
+mcIdType MEDPARTITIONER::MeshCollection::getNbOfLocalFaces() const
{
- int nb=0;
+ mcIdType nb=0;
for (size_t i=0; i<_face_mesh.size(); i++)
{
if (_face_mesh[i]) nb=nb+_face_mesh[i]->getNumberOfCells();
//looking for reverse nodal connectivity i global numbering
if (isParallelMode() && !_domain_selector->isMyDomain(0))
{
- vector<int> value;
- vector<int> index(1,0);
+ vector<mcIdType> value;
+ vector<mcIdType> index(1,0);
array = MEDCoupling::MEDCouplingSkyLineArray::New(index,value);
return;
using std::make_pair;
using std::pair;
- std::multimap< int, int > node2cell;
- std::map< pair<int,int>, int > cell2cellcounter;
- std::multimap<int,int> cell2cell;
+ std::multimap< mcIdType, mcIdType > node2cell;
+ std::map< pair<mcIdType,mcIdType>, mcIdType > cell2cellcounter;
+ std::multimap<mcIdType,mcIdType> cell2cell;
- std::vector<std::vector<std::multimap<int,int> > > commonDistantNodes;
+ std::vector<std::vector<std::multimap<mcIdType,mcIdType> > > commonDistantNodes;
int nbdomain=_topology->nbDomain();
#ifdef HAVE_MPI
if (isParallelMode())
continue;
meshDim = _mesh[idomain]->getMeshDimension();
- MEDCoupling::DataArrayInt* index=MEDCoupling::DataArrayInt::New();
- MEDCoupling::DataArrayInt* revConn=MEDCoupling::DataArrayInt::New();
- int nbNodes=_mesh[idomain]->getNumberOfNodes();
+ MEDCoupling::DataArrayIdType* index=MEDCoupling::DataArrayIdType::New();
+ MEDCoupling::DataArrayIdType* revConn=MEDCoupling::DataArrayIdType::New();
+ mcIdType nbNodes=_mesh[idomain]->getNumberOfNodes();
_mesh[idomain]->getReverseNodalConnectivity(revConn,index);
//problem saturation over 1 000 000 nodes for 1 proc
if (MyGlobals::_Verbose>100)
std::cout << "proc " << MyGlobals::_Rank << " : getReverseNodalConnectivity done on " << nbNodes << " nodes" << std::endl;
- int* index_ptr=index->getPointer();
- int* revConnPtr=revConn->getPointer();
- for (int i=0; i<nbNodes; i++)
+ mcIdType* index_ptr=index->getPointer();
+ mcIdType* revConnPtr=revConn->getPointer();
+ for (mcIdType i=0; i<nbNodes; i++)
{
- for (int icell=index_ptr[i]; icell<index_ptr[i+1]; icell++)
+ for (mcIdType icell=index_ptr[i]; icell<index_ptr[i+1]; icell++)
{
- int globalNode=_topology->convertNodeToGlobal(idomain,i);
- int globalCell=_topology->convertCellToGlobal(idomain,revConnPtr[icell]);
+ mcIdType globalNode=_topology->convertNodeToGlobal(idomain,i);
+ mcIdType globalCell=_topology->convertCellToGlobal(idomain,revConnPtr[icell]);
node2cell.insert(make_pair(globalNode, globalCell));
}
}
#ifdef HAVE_MPI
for (int iother=0; iother<nbdomain; iother++)
{
- std::multimap<int,int>::iterator it;
+ std::multimap<mcIdType,mcIdType>::iterator it;
int isource=idomain;
int itarget=iother;
for (it=_joint_finder->getDistantNodeCell()[isource][itarget].begin();
it!=_joint_finder->getDistantNodeCell()[isource][itarget].end(); it++)
{
- int globalNode=_topology->convertNodeToGlobal(idomain,(*it).first);
- int globalCell=(*it).second;
+ mcIdType globalNode=_topology->convertNodeToGlobal(idomain,(*it).first);
+ mcIdType globalCell=(*it).second;
node2cell.insert(make_pair(globalNode, globalCell));
}
}
if (MyGlobals::_Verbose>50)
std::cout<< "proc " << MyGlobals::_Rank << " : creating graph arcs on nbNodes " << _topology->nbNodes() << std::endl;
- for (int inode=0;inode<_topology->nbNodes();inode++)
+ for (mcIdType inode=0;inode<_topology->nbNodes();inode++)
{
- typedef multimap<int,int>::const_iterator MI;
+ typedef multimap<mcIdType,mcIdType>::const_iterator MI;
std::pair <MI,MI> nodeRange=node2cell.equal_range(inode);
for (MI cell1=nodeRange.first;cell1!=nodeRange.second;cell1++)
for (MI cell2=nodeRange.first;cell2!=cell1;cell2++)
{
- int icell1=cell1->second;
- int icell2=cell2->second;
- if (icell1>icell2) {int tmp=icell1; icell1=icell2; icell2=tmp;}
- std::map<pair<int,int>,int>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2));
+ mcIdType icell1=cell1->second;
+ mcIdType icell2=cell2->second;
+ if (icell1>icell2) std::swap(icell1,icell2);
+ std::map<pair<mcIdType,mcIdType>,mcIdType>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2));
if (it==cell2cellcounter.end()) cell2cellcounter.insert(make_pair(make_pair(icell1,icell2),1));
else (it->second)++;
}
}
- // for (int icell1=0; icell1<_topology->nbCells(); icell1++) //on all nodes
+ // for (mcIdType icell1=0; icell1<_topology->nbCells(); icell1++) //on all nodes
// {
- // typedef multimap<int,int>::const_iterator MI;
+ // typedef multimap<int,mcIdType>::const_iterator MI;
// std::pair <MI,MI> nodeRange=cell2node.equal_range(icell1);
// for (MI node1=nodeRange.first; node1!=nodeRange.second; node1++) //on nodes with icell
// {
// std::pair<MI,MI> cellRange=node2cell.equal_range(node1->second);
// for (MI cell2=cellRange.first; cell2!=cellRange.second; cell2++) //on one of these cell
// {
- // int icell2=cell2->second;
- // std::map<pair<int,int>,int>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2));
+ // mcIdType icell2=cell2->second;
+ // std::map<pair<int,mcIdType>,mcIdType>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2));
// if (it==cell2cellcounter.end()) cell2cellcounter.insert(make_pair(make_pair(icell1,icell2),1));
// else (it->second)++;
// }
//converting the counter to a multimap structure
- for (std::map<pair<int,int>,int>::const_iterator it=cell2cellcounter.begin();
+ for (std::map<pair<mcIdType,mcIdType>,mcIdType>::const_iterator it=cell2cellcounter.begin();
it!=cell2cellcounter.end();
it++)
if (it->second>=meshDim)
if (MyGlobals::_Verbose>50)
std::cout << "proc " << MyGlobals::_Rank << " : create skylinearray" << std::endl;
//filling up index and value to create skylinearray structure
- std::vector <int> index,value;
+ std::vector <mcIdType> index,value;
index.push_back(0);
- int idep=0;
+ mcIdType idep=0;
for (int idomain=0; idomain<nbdomain; idomain++)
{
if (isParallelMode() && !_domain_selector->isMyDomain(idomain)) continue;
- int nbCells=_mesh[idomain]->getNumberOfCells();
- for (int icell=0; icell<nbCells; icell++)
+ mcIdType nbCells=_mesh[idomain]->getNumberOfCells();
+ for (mcIdType icell=0; icell<nbCells; icell++)
{
- int size=0;
- int globalCell=_topology->convertCellToGlobal(idomain,icell);
- multimap<int,int>::iterator it;
- pair<multimap<int,int>::iterator,multimap<int,int>::iterator> ret;
+ mcIdType size=0;
+ mcIdType globalCell=_topology->convertCellToGlobal(idomain,icell);
+ multimap<mcIdType,mcIdType>::iterator it;
+ pair<multimap<mcIdType,mcIdType>::iterator,multimap<mcIdType,mcIdType>::iterator> ret;
ret=cell2cell.equal_range(globalCell);
for (it=ret.first; it!=ret.second; ++it)
{
- int ival=(*it).second; //no adding one existing yet
- for (int i=idep ; i<idep+size ; i++)
+ mcIdType ival=(*it).second; //no adding one existing yet
+ for (mcIdType i=idep ; i<idep+size ; i++)
{
if (value[i]==ival)
{
{
std::cout << "\nproc " << _domain_selector->rank() << " : end MeshCollection::buildCellGraph " <<
index.size()-1 << " " << value.size() << std::endl;
- int max=index.size()>15?15:index.size();
+ std::size_t max=index.size()>15?15:index.size();
if (index.size()>1)
{
- for (int i=0; i<max; ++i)
+ for (std::size_t i=0; i<max; ++i)
std::cout<<index[i]<<" ";
std::cout << "... " << index[index.size()-1] << std::endl;
- for (int i=0; i<max; ++i)
+ for (std::size_t i=0; i<max; ++i)
std::cout<< value[i] << " ";
- int ll=index[index.size()-1]-1;
+ mcIdType ll=index[index.size()-1]-1;
std::cout << "... (" << ll << ") " << value[ll-1] << " " << value[ll] << std::endl;
}
}
Graph* cellGraph;
std::set<int> domains;
- for (int i=0; i<_topology->nbCells(); i++)
+ for (mcIdType i=0; i<_topology->nbCells(); i++)
{
domains.insert(partition[i]);
}
//cellGraph is a shared pointer
Topology *topology=0;
- int nbdomain=domains.size();
+ int nbdomain=(int)domains.size();
topology=new ParallelTopology (cellGraph, getTopology(), nbdomain, getMeshDimension());
// if (array!=0) delete array;
delete cellGraph;
//to have unique valid fields names/pointers/descriptions for partitionning
//filter _field_descriptions to be in all procs compliant and equal
{
- int nbfiles=MyGlobals::_File_Names.size(); //nb domains
+ std::size_t nbfiles=MyGlobals::_File_Names.size(); //nb domains
if (nbfiles==0)
{
nbfiles=_topology->nbDomain();
}
std::vector<std::string> r2;
//from allgatherv then vector(procs) of serialised vector(fields) of vector(description) data
- for (int i=0; i<(int)_field_descriptions.size(); i++)
+ for (std::size_t i=0; i<_field_descriptions.size(); i++)
{
std::vector<std::string> r1=DeserializeToVectorOfString(_field_descriptions[i]);
- for (int ii=0; ii<(int)r1.size(); ii++)
+ for (std::size_t ii=0; ii<r1.size(); ii++)
r2.push_back(r1[ii]);
}
//here vector(procs*fields) of serialised vector(description) data
_field_descriptions=r2;
- int nbfields=_field_descriptions.size(); //on all domains
+ std::size_t nbfields=_field_descriptions.size(); //on all domains
if ((nbfields%nbfiles)!=0)
{
if (MyGlobals::_Rank==0)
throw INTERP_KERNEL::Exception("incoherent number of fields references in all files .med\n");
}
_field_descriptions.resize(nbfields/nbfiles);
- for (int i=0; i<(int)_field_descriptions.size(); i++)
+ for (std::size_t i=0; i<_field_descriptions.size(); i++)
{
std::string str=_field_descriptions[i];
str=EraseTagSerialized(str,"idomain=");
}
//returns true if inodes of a face are in inodes of a cell
-bool isFaceOncell(std::vector< int >& inodesFace, std::vector< int >& inodesCell)
+bool isFaceOncell(std::vector< mcIdType >& inodesFace, std::vector< mcIdType >& inodesCell)
{
- int ires=0;
- int nbok=inodesFace.size();
- for (int i=0; i<nbok; i++)
+ std::size_t ires=0;
+ std::size_t nbok=inodesFace.size();
+ for (std::size_t i=0; i<nbok; i++)
{
- int ii=inodesFace[i];
+ mcIdType ii=inodesFace[i];
if (ii<0)
std::cout << "isFaceOncell problem inodeface<0" << std::endl;
- for (int j=0; j<(int)inodesCell.size(); j++)
+ for (std::size_t j=0; j<inodesCell.size(); j++)
{
if (ii==inodesCell[j])
{
MEDCoupling::MEDCouplingUMesh* mfac=_face_mesh[inew];
//to have cellnode=f(facenode)... inodeCell=nodeIds[inodeFace]
- std::vector<int> nodeIds;
+ std::vector<mcIdType> nodeIds;
getNodeIds(*mcel, *mfac, nodeIds);
if (nodeIds.size()==0)
continue; //one empty mesh nothing to do
- MEDCoupling::DataArrayInt *revNodalCel=MEDCoupling::DataArrayInt::New();
- MEDCoupling::DataArrayInt *revNodalIndxCel=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType *revNodalCel=MEDCoupling::DataArrayIdType::New();
+ MEDCoupling::DataArrayIdType *revNodalIndxCel=MEDCoupling::DataArrayIdType::New();
mcel->getReverseNodalConnectivity(revNodalCel,revNodalIndxCel);
- int *revC=revNodalCel->getPointer();
- int *revIndxC=revNodalIndxCel->getPointer();
+ mcIdType *revC=revNodalCel->getPointer();
+ mcIdType *revIndxC=revNodalIndxCel->getPointer();
- std::vector< int > faceOnCell;
- std::vector< int > faceNotOnCell;
- int nbface=mfac->getNumberOfCells();
- for (int iface=0; iface<nbface; iface++)
+ std::vector< mcIdType > faceOnCell;
+ std::vector< mcIdType > faceNotOnCell;
+ mcIdType nbface=mfac->getNumberOfCells();
+ for (mcIdType iface=0; iface<nbface; iface++)
{
bool ok;
- std::vector< int > inodesFace;
+ std::vector< mcIdType > inodesFace;
mfac->getNodeIdsOfCell(iface, inodesFace);
- int nbnodFace=inodesFace.size();
+ mcIdType nbnodFace=ToIdType(inodesFace.size());
if ( nbnodFace != mfac->getNumberOfNodesInCell( iface ))
continue; // invalid node ids
//set inodesFace in mcel
nbok += (( inodesFace[i]=nodeIds[inodesFace[i]] ) >= 0 );
if ( nbok != nbnodFace )
continue;
- int inod=inodesFace[0];
+ mcIdType inod=inodesFace[0];
if (inod<0)
{
std::cout << "filterFaceOnCell problem 1" << std::endl;
continue;
}
- int nbcell=revIndxC[inod+1]-revIndxC[inod];
- for (int j=0; j<nbcell; j++) //look for each cell with inod
+ mcIdType nbcell=revIndxC[inod+1]-revIndxC[inod];
+ for (mcIdType j=0; j<nbcell; j++) //look for each cell with inod
{
- int icel=revC[revIndxC[inod]+j];
- std::vector< int > inodesCell;
+ mcIdType icel=revC[revIndxC[inod]+j];
+ std::vector< mcIdType > inodesCell;
mcel->getNodeIdsOfCell(icel, inodesCell);
ok=isFaceOncell(inodesFace, inodesCell);
if (ok) break;
std::string key = Cle1ToStr("faceFamily_toArray",inew);
if ( getMapDataArrayInt().count( key ))
{
- MEDCoupling::DataArrayInt * & fam = getMapDataArrayInt()[ key ];
- MEDCoupling::DataArrayInt * famFilter = MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType * & fam = getMapDataArrayInt()[ key ];
+ MEDCoupling::DataArrayIdType * famFilter = MEDCoupling::DataArrayIdType::New();
famFilter->alloc(faceOnCell.size(),1);
- int* pfamFilter = famFilter->getPointer();
- int* pfam = fam->getPointer();
+ mcIdType* pfamFilter = famFilter->getPointer();
+ mcIdType* pfam = fam->getPointer();
for ( size_t i=0; i<faceOnCell.size(); i++ )
pfamFilter[i]=pfam[faceOnCell[i]];
fam->decrRef();
class JointFinder;
typedef enum{MedAscii, MedXml, Undefined} DriverType;
- typedef std::multimap<std::pair<int,int>, std::pair<int,int> > NodeMapping ;
+ typedef std::multimap<std::pair<int,mcIdType>, std::pair<int,mcIdType> > NodeMapping ;
typedef std::vector<std::pair<int,int> > NodeList;
class MEDPARTITIONER_EXPORT MeshCollection
//getting mesh dimension
int getMeshDimension() const;
int getNbOfLocalMeshes() const;
- int getNbOfGlobalMeshes() const { return _mesh.size(); }
- int getNbOfLocalCells() const;
- int getNbOfLocalFaces() const;
+ int getNbOfGlobalMeshes() const { return (int)_mesh.size(); }
+ mcIdType getNbOfLocalCells() const;
+ mcIdType getNbOfLocalFaces() const;
//getting a reference to mesh vector
std::vector<MEDCoupling::MEDCouplingUMesh*>& getMesh();
MEDCoupling::MEDCouplingUMesh* getFaceMesh(int idomain);
std::vector<MEDCoupling::MEDCouplingUMesh*>& getGroupMeshes(int idomain);
- std::vector<MEDCoupling::DataArrayInt*>& getCellFamilyIds() { return _cell_family_ids; }
- std::vector<MEDCoupling::DataArrayInt*>& getFaceFamilyIds() { return _face_family_ids; }
+ std::vector<MEDCoupling::DataArrayIdType*>& getCellFamilyIds() { return _cell_family_ids; }
+ std::vector<MEDCoupling::DataArrayIdType*>& getFaceFamilyIds() { return _face_family_ids; }
- std::map<std::string, MEDCoupling::DataArrayInt*>& getMapDataArrayInt() { return _map_dataarray_int; }
+ std::map<std::string, MEDCoupling::DataArrayIdType*>& getMapDataArrayInt() { return _map_dataarray_int; }
std::map<std::string, MEDCoupling::DataArrayDouble*>& getMapDataArrayDouble() { return _map_dataarray_double; }
- std::map<std::string,int>& getFamilyInfo() { return _family_info; }
+ std::map<std::string,mcIdType>& getFamilyInfo() { return _family_info; }
std::map<std::string, std::vector<std::string> >& getGroupInfo() { return _group_info; }
MEDCoupling::DataArrayDouble* getField(std::string descriptionField, int iold);
//creates the node mapping between an old collection and the present one
void createNodeMapping(MeshCollection& initialCollection,
- std::multimap<std::pair<int,int>,std::pair<int,int> >& nodeMapping);
+ std::multimap<std::pair<int,mcIdType>,std::pair<int,mcIdType> >& nodeMapping);
void castCellMeshes(MeshCollection& initialCollection,
- std::vector<std::vector<std::vector<int> > >& new2oldIds,
- std::vector<MEDCoupling::DataArrayInt*> & o2nRenumber);
+ std::vector<std::vector<std::vector<mcIdType> > >& new2oldIds,
+ std::vector<MEDCoupling::DataArrayIdType*> & o2nRenumber);
//creates faces on the new collection
void castFaceMeshes(MeshCollection& initialCollection,
- const std::multimap<std::pair<int,int>, std::pair<int,int> >& nodeMapping,
- std::vector<std::vector<std::vector<int> > >& new2oldIds);
+ const std::multimap<std::pair<int,mcIdType>, std::pair<int,mcIdType> >& nodeMapping,
+ std::vector<std::vector<std::vector<mcIdType> > >& new2oldIds);
//constructing connect zones
void buildConnectZones( const NodeMapping& nodeMapping,
- const std::vector<MEDCoupling::DataArrayInt*> & o2nRenumber,
+ const std::vector<MEDCoupling::DataArrayIdType*> & o2nRenumber,
int nbInitialDomains );
// Find faces common with neighbor domains and put them in groups
private:
void castIntField(std::vector<MEDCoupling::MEDCouplingUMesh*>& meshesCastFrom,
std::vector<MEDCoupling::MEDCouplingUMesh*>& meshesCastTo,
- std::vector<MEDCoupling::DataArrayInt*>& arrayFrom,
+ std::vector<MEDCoupling::DataArrayIdType*>& arrayFrom,
std::string nameArrayTo);
void castAllFields(MeshCollection& initialCollection,
std::string nameArrayTo);
- void findCommonDistantNodes(std::vector<std::vector<std::multimap<int,int> > >& commonDistantNodes);
+ void findCommonDistantNodes(std::vector<std::vector<std::multimap<int,mcIdType> > >& commonDistantNodes);
void remapIntField(int inew, int iold,
const MEDCoupling::MEDCouplingUMesh& sourceMesh,
const MEDCoupling::MEDCouplingUMesh& targetMesh,
- const int* fromArray,
+ const mcIdType* fromArray,
std::string nameArrayTo,
const BBTreeOfDim* tree);
std::string nameArrayTo,
std::string descriptionField);
- void createJointGroup( const std::vector< int >& faces,
+ void createJointGroup( const std::vector< mcIdType >& faces,
const int inew1,
const int inew2,
const bool is2nd );
int _i_non_empty_mesh;
//family ids storages
- std::vector<MEDCoupling::DataArrayInt*> _cell_family_ids;
- std::vector<MEDCoupling::DataArrayInt*> _face_family_ids;
+ std::vector<MEDCoupling::DataArrayIdType*> _cell_family_ids;
+ std::vector<MEDCoupling::DataArrayIdType*> _face_family_ids;
//DataArrayInt* storages
- std::map<std::string, MEDCoupling::DataArrayInt*> _map_dataarray_int;
+ std::map<std::string, MEDCoupling::DataArrayIdType*> _map_dataarray_int;
//DataArrayDouble* storages
std::map<std::string, MEDCoupling::DataArrayDouble*> _map_dataarray_double;
std::vector<std::string> _field_descriptions;
//group family conversion
- std::map<std::string, int> _family_info;
+ std::map<std::string, mcIdType> _family_info;
std::map<std::string, std::vector<std::string> > _group_info;
//list of groups that are not to be split
(_collection->getFaceMesh()).push_back(mfm->getLevelM1Mesh(false));
//reading family ids
- MEDCoupling::DataArrayInt* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy());
- MEDCoupling::DataArrayInt* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy());
+ MEDCoupling::DataArrayIdType* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy());
+ MEDCoupling::DataArrayIdType* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy());
(_collection->getCellFamilyIds()).push_back(cellIds);
(_collection->getFaceFamilyIds()).push_back(faceIds);
{
(_collection->getMesh())[idomain]=mfm->getLevel0Mesh(false);
//reading families groups
- MEDCoupling::DataArrayInt* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy());
+ MEDCoupling::DataArrayIdType* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy());
(_collection->getCellFamilyIds())[idomain]=cellIds;
}
catch(...)
{
(_collection->getMesh())[idomain]=CreateEmptyMEDCouplingUMesh(); // or 0 if you want tests;
- MEDCoupling::DataArrayInt* empty=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType* empty=MEDCoupling::DataArrayIdType::New();
empty->alloc(0,1);
(_collection->getCellFamilyIds())[idomain]=empty;
std::cout<<"\nNO Level0Mesh (Cells)\n";
{
(_collection->getFaceMesh())[idomain]=mfm->getLevelM1Mesh(false);
//reading families groups
- MEDCoupling::DataArrayInt* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy());
+ MEDCoupling::DataArrayIdType* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy());
(_collection->getFaceFamilyIds())[idomain]=faceIds;
if (MyGlobals::_Verbose>10)
std::cout << "proc " << MyGlobals::_Rank << " : WITH Faces\n";
catch(...)
{
(_collection->getFaceMesh())[idomain]=CreateEmptyMEDCouplingUMesh(); // or 0 if you want test;
- MEDCoupling::DataArrayInt* empty=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType* empty=MEDCoupling::DataArrayIdType::New();
(_collection->getFaceFamilyIds())[idomain]=empty;
if (MyGlobals::_Verbose>10)
std::cout << "proc " << MyGlobals::_Rank << " : WITHOUT Faces\n";
j1st->pushCorrespondence( corr );
}
- std::vector< std::pair< int,int > > types = cz->getEntities();
+ std::vector< std::pair< mcIdType,mcIdType > > types = cz->getEntities();
INTERP_KERNEL::NormalizedCellType t1, t2;
for ( size_t it = 0; it < types.size(); ++it )
{
r1=SelectTagsInVectorOfString(r1,"DT="+IntToStr(DT));
r1=SelectTagsInVectorOfString(r1,"IT="+IntToStr(IT));
//not saved in file? field->setDescription(ExtractFromDescription(r1[0], "fieldDescription="));
- int nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents="));
+ std::size_t nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents="));
if (nbc==da->getNumberOfComponents())
{
- for (int i=0; i<nbc; i++)
+ for (unsigned int i=0; i<nbc; i++)
da->setInfoOnComponent(i,ExtractFromDescription(r1[0], "componentInfo"+IntToStr(i)+"="));
}
else
meshes = MEDCoupling::MEDFileMeshes::New();
fields = MEDCoupling::MEDFileFields::New();
- for (size_t i=0; i<_collection->getMesh().size(); i++)
+ for (unsigned int i=0; i<_collection->getMesh().size(); i++)
{
MEDCoupling::MEDFileMesh* mfm = getMesh( i );
meshes->pushMesh(mfm);
readMEDFileData(filedata);
std::vector<MEDPARTITIONER::ConnectZone*> cz; // to fill from filedata
- std::vector<int*> cellglobal;
- std::vector<int*> nodeglobal;
- std::vector<int*> faceglobal;
- int size = (_collection->getMesh()).size();
+ std::vector<mcIdType*> cellglobal;
+ std::vector<mcIdType*> nodeglobal;
+ std::vector<mcIdType*> faceglobal;
+ std::size_t size = _collection->getMesh().size();
cellglobal.resize(size);
nodeglobal.resize(size);
faceglobal.resize(size);
- for ( int idomain = 0; idomain < size; ++idomain )
+ for ( unsigned int idomain = 0; idomain < size; ++idomain )
{
cellglobal[idomain]=0;
faceglobal[idomain]=0;
int MeshCollectionMedAsciiDriver::read(const char* filename, ParaDomainSelector* domainSelector)
{
//distributed meshes
- std::vector<int*> cellglobal;
- std::vector<int*> nodeglobal;
- std::vector<int*> faceglobal;
+ std::vector<mcIdType*> cellglobal;
+ std::vector<mcIdType*> nodeglobal;
+ std::vector<mcIdType*> faceglobal;
int nbdomain;
//reading ascii master file
*/
void MeshCollectionMedAsciiDriver::write(const char* filename, ParaDomainSelector* domainSelector) const
{
- int nbdomains=_collection->getMesh().size();
+ std::size_t nbdomains=_collection->getMesh().size();
std::vector<std::string> filenames;
filenames.resize(nbdomains);
//loop on the domains
- for (int idomain=0; idomain<nbdomains; idomain++)
+ for (unsigned idomain=0; idomain<nbdomains; idomain++)
{
std::string distfilename;
std::ostringstream suffix;
file << "#" << " " << std::endl;
file << _collection->getMesh().size() << " " << std::endl;
- for (int idomain=0; idomain<nbdomains; idomain++)
+ for (std::size_t idomain=0; idomain<nbdomains; idomain++)
file << _collection->getName() <<" "<< idomain+1 << " "
<< (_collection->getMesh())[idomain]->getName() << " localhost "
<< filenames[idomain] << " "<< std::endl;
xmlNodePtr mesh_node = xmlNewChild(node, 0, BAD_CAST "mesh",0);
xmlNewProp(mesh_node, BAD_CAST "name", BAD_CAST _collection->getName().c_str());
- int nbdomains= _collection->getMesh().size();
+ int nbdomains= _collection->getNbOfGlobalMeshes();
//loop on the domains
std::string finalMeshName="";
std::cout << "proc " << MyGlobals::_Rank << " : METISGraph::partGraph" << std::endl;
//number of graph vertices
- int n=_graph->getNumberOf();
+ int n=FromIdType<int>(_graph->getNumberOf());
//graph
+#ifdef MEDCOUPLING_USE_64BIT_IDS
+ std::vector<int> indexVec( _graph->getIndex(), _graph->getIndexArray()->end() );
+ std::vector<int> valueVec( _graph->getValues(), _graph->getValuesArray()->end() );
+ int * xadj=indexVec.data();
+ int * adjncy=valueVec.data();
+#else
int * xadj=const_cast<int*>(_graph->getIndex());
int * adjncy=const_cast<int*>(_graph->getValues());
+#endif
//constraints
int * vwgt=_cell_weight;
int * adjwgt=_edge_weight;
for (int i=0; i<n; i++)
partition[i]=0;
}
- vector<int> index(n+1);
- vector<int> value(n);
+ vector<mcIdType> index(n+1);
+ vector<mcIdType> value(n);
index[0]=0;
for (int i=0; i<n; i++)
{
index[i+1]=index[i]+1;
- value[i]=partition[i];
+ value[i]=ToIdType(partition[i]);
}
delete [] partition;
std::cout << "proc " << MyGlobals::_Rank << " : PTSCOTCHGraph::partGraph" << std::endl;
//number of graph vertices
- int n = _graph->getNumberOf();
+ int n = FromIdType<int>(_graph->getNumberOf());
//graph
+#ifdef MEDCOUPLING_USE_64BIT_IDS
+ std::vector<int> indexVec( _graph->getIndex(), _graph->getIndexArray()->end() );
+ std::vector<int> valueVec( _graph->getValues(), _graph->getValuesArray()->end() );
+ int * xadj=indexVec.data();
+ int * adjncy=valueVec.data();
+#else
int * xadj=const_cast<int*>(_graph->getIndex());
int * adjncy=const_cast<int*>(_graph->getValues());
+#endif
//ndomain
int nparts=ndomain;
SCOTCH_stratExit(&scotch_strategy);
SCOTCH_dgraphExit(&scotch_graph);
- std::vector<int> index(n+1);
- std::vector<int> value(n);
+ std::vector<mcIdType> index(n+1);
+ std::vector<mcIdType> value(n);
index[0]=0;
for (int i=0; i<n; i++)
{
index[i+1]=index[i]+1;
- value[i]=partition[i];
+ value[i]=ToIdType(partition[i]);
}
delete [] partition;
_partition = MEDCoupling::MEDCouplingSkyLineArray::New(index,value);
#endif
}
-
std::cout << "proc " << MyGlobals::_Rank << " : ParMETISGraph::partGraph" << std::endl;
// number of graph vertices
- int n=_graph->getNumberOf();
+ int n=FromIdType<int>(_graph->getNumberOf());
//graph
+#ifdef MEDCOUPLING_USE_64BIT_IDS
+ std::vector<int> indexVec( _graph->getIndex(), _graph->getIndexArray()->end() );
+ std::vector<int> valueVec( _graph->getValues(), _graph->getValuesArray()->end() );
+ int * xadj=indexVec.data();
+ int * adjncy=valueVec.data();
+#else
int * xadj=const_cast<int*>(_graph->getIndex());
int * adjncy=const_cast<int*>(_graph->getValues());
++#endif
//constraints
int * vwgt=_cell_weight;
int * adjwgt=_edge_weight;
MPI_Comm *comm);
*/
- vector<int> index(n+1);
- vector<int> value(n);
+ vector<mcIdType> index(n+1);
+ vector<mcIdType> value(n);
index[0]=0;
if (ran.size()>0 && MyGlobals::_Atomize==0) //there is randomize
{
for (int i=0; i<n; i++)
{
index[i+1]=index[i]+1;
- value[ran[i]]=partition[i];
+ value[ran[i]]=ToIdType(partition[i]);
}
}
else
for (int i=0; i<n; i++)
{
index[i+1]=index[i]+1;
- value[i]=partition[i];
+ value[i]=ToIdType(partition[i]);
}
}
delete [] partition;
#include "MEDPARTITIONER_ParaDomainSelector.hxx"
#include "MEDPARTITIONER_UserGraph.hxx"
#include "MEDPARTITIONER_Utils.hxx"
+#include "MEDPARTITIONER_Utils.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingSkyLineArray.hxx"
+#include "MCIdType.hxx"
#include <iostream>
#include <numeric>
#ifdef HAVE_MPI
+
#include <mpi.h>
+
+#ifndef MEDCOUPLING_USE_64BIT_IDS
+#define MPI_ID_TYPE MPI_INT
+#else
+#define MPI_ID_TYPE MPI_LONG
+#endif
+
#endif
/*!
{
evaluateMemory();
// get nb of elems of each domain mesh
- int nb_domains=domain_meshes.size();
- std::vector<int> nb_elems(nb_domains*2, 0); //NumberOfCells & NumberOfNodes
+ int nb_domains=(int)domain_meshes.size();
+ std::vector<mcIdType> nb_elems(nb_domains*2, 0); //NumberOfCells & NumberOfNodes
for (int i=0; i<nb_domains; ++i)
if ( domain_meshes[i] )
{
nb_elems[i*2+1] = domain_meshes[i]->getNumberOfNodes();
}
// receive nb of elems from other procs
- std::vector<int> all_nb_elems;
+ std::vector<mcIdType> all_nb_elems;
if (MyGlobals::_World_Size==1)
{
all_nb_elems=nb_elems;
{
#ifdef HAVE_MPI
all_nb_elems.resize( nb_domains*2 );
- MPI_Allreduce((void*)&nb_elems[0], (void*)&all_nb_elems[0], nb_domains*2, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+ MPI_Allreduce((void*)&nb_elems[0], (void*)&all_nb_elems[0], nb_domains*2, MPI_ID_TYPE, MPI_SUM, MPI_COMM_WORLD);
#else
throw INTERP_KERNEL::Exception("not(HAVE_MPI) incompatible with MPI_World_Size>1");
#endif
}
- int total_nb_cells=0, total_nb_nodes=0;
+ mcIdType total_nb_cells=0, total_nb_nodes=0;
for (int i=0; i<nb_domains; ++i)
{
total_nb_cells+=all_nb_elems[i*2];
if (MyGlobals::_Is0verbose>10)
std::cout << "totalNbCells " << total_nb_cells << " totalNbNodes " << total_nb_nodes << std::endl;
- std::vector<int>& cell_shift_by_domain=_cell_shift_by_domain;
- std::vector<int>& node_shift_by_domain=_node_shift_by_domain;
- std::vector<int>& face_shift_by_domain=_face_shift_by_domain;
+ std::vector<mcIdType>& cell_shift_by_domain=_cell_shift_by_domain;
+ std::vector<mcIdType>& node_shift_by_domain=_node_shift_by_domain;
+ std::vector<mcIdType>& face_shift_by_domain=_face_shift_by_domain;
- std::vector< int > ordered_nbs_cell, ordered_nbs_node, domain_order(nb_domains);
+ std::vector< mcIdType > ordered_nbs_cell, ordered_nbs_node, domain_order(nb_domains);
ordered_nbs_cell.push_back(0);
ordered_nbs_node.push_back(0);
for (int iproc=0; iproc<nbProcs(); ++iproc)
for (int idomain=0; idomain<nb_domains; ++idomain)
if (getProcessorID( idomain )==iproc)
{
- domain_order[idomain] = ordered_nbs_cell.size() - 1;
+ domain_order[idomain] = ToIdType( ordered_nbs_cell.size() - 1 );
ordered_nbs_cell.push_back( ordered_nbs_cell.back() + all_nb_elems[idomain*2] );
ordered_nbs_node.push_back( ordered_nbs_node.back() + all_nb_elems[idomain*2+1] );
}
* The result array is to be used as the first arg of ParMETIS_V3_PartKway() and
* is freed by ParaDomainSelector.
*/
-int *MEDPARTITIONER::ParaDomainSelector::getProcVtxdist() const
+mcIdType *MEDPARTITIONER::ParaDomainSelector::getProcVtxdist() const
{
evaluateMemory();
if (_nb_vert_of_procs.empty())
throw INTERP_KERNEL::Exception("_nb_vert_of_procs not set");
- return const_cast<int*>(& _nb_vert_of_procs[0]);
+ return const_cast<mcIdType*>(& _nb_vert_of_procs[0]);
}
/*!
* gatherNbOf() must be called before.
* Result added to local id on given domain gives id in the whole distributed mesh
*/
-int MEDPARTITIONER::ParaDomainSelector::getDomainCellShift(int domainIndex) const
+mcIdType MEDPARTITIONER::ParaDomainSelector::getDomainCellShift(int domainIndex) const
{
evaluateMemory();
if (_cell_shift_by_domain.empty())
return _cell_shift_by_domain[domainIndex];
}
-int MEDPARTITIONER::ParaDomainSelector::getDomainNodeShift(int domainIndex) const
+mcIdType MEDPARTITIONER::ParaDomainSelector::getDomainNodeShift(int domainIndex) const
{
evaluateMemory();
if (_node_shift_by_domain.empty())
* gatherNbOf() must be called before.
* Result added to global id on this processor gives id in the whole distributed mesh
*/
-int MEDPARTITIONER::ParaDomainSelector::getProcNodeShift() const
+mcIdType MEDPARTITIONER::ParaDomainSelector::getProcNodeShift() const
{
evaluateMemory();
if (_nb_vert_of_procs.empty())
std::vector<int> index_size_of_proc( nbProcs() ); // index sizes - 1
for ( std::size_t i = 1; i < _nb_vert_of_procs.size(); ++i )
- index_size_of_proc[i-1] = _nb_vert_of_procs[ i ] - _nb_vert_of_procs[ i-1 ];
+ index_size_of_proc[i-1] = FromIdType<int>(_nb_vert_of_procs[ i ] - _nb_vert_of_procs[ i-1 ]);
- int index_size = 1 + _cell_shift_by_domain.back();
- int *graph_index = new int[ index_size ];
- const int *index = graph->getGraph()->getIndex();
- int *proc_index_displacement = const_cast<int*>( & _nb_vert_of_procs[0] );
+ mcIdType index_size = 1 + _cell_shift_by_domain.back();
+ mcIdType *graph_index = new mcIdType[ index_size ];
+ const mcIdType *index = graph->getGraph()->getIndex();
+ MCAuto< DataArrayInt > nb_vert_of_procs = FromIdTypeVec( _nb_vert_of_procs );
+ int *proc_index_displacement = nb_vert_of_procs->getPointer();
MPI_Allgatherv((void*) (index+1), // send local index except first 0 (or 1)
index_size_of_proc[_rank], // index size on this proc
- MPI_INT,
+ MPI_ID_TYPE,
(void*) graph_index, // receive indices
& index_size_of_proc[0], // index size on each proc
proc_index_displacement, // displacement of each proc index
- MPI_INT,
+ MPI_ID_TYPE,
MPI_COMM_WORLD);
graph_index[0] = index[0]; // it is not overwritten thanks to proc_index_displacement[0]==1
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];
+ value_size_of_proc[i] = (int)(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];
+ mcIdType 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
// --------------
- int value_size = graph_index[ index_size-1 ] - graph_index[ 0 ];
- int *graph_value = new int[ value_size ];
- const int *value = graph->getGraph()->getValues();
+ mcIdType value_size = graph_index[ index_size-1 ] - graph_index[ 0 ];
+ mcIdType *graph_value = new mcIdType[ value_size ];
+ const mcIdType *value = graph->getGraph()->getValues();
MPI_Allgatherv((void*) value, // send local value
value_size_of_proc[_rank], // value size on this proc
- MPI_INT,
+ MPI_ID_TYPE,
(void*) graph_value, // receive values
& value_size_of_proc[0], // value size on each proc
& proc_value_displacement[0], // displacement of each proc value
- MPI_INT,
+ MPI_ID_TYPE,
MPI_COMM_WORLD);
// -----------------
// Gather partition
// -----------------
- int * partition = new int[ _cell_shift_by_domain.back() ];
- const int* part = graph->getPart();
+ mcIdType * partition = new mcIdType[ _cell_shift_by_domain.back() ];
+ const mcIdType* part = graph->getPart();
MPI_Allgatherv((void*) part, // send local partition
index_size_of_proc[_rank], // index size on this proc
- MPI_INT,
+ MPI_ID_TYPE,
(void*)(partition-1), // -1 compensates proc_index_displacement[0]==1
& index_size_of_proc[0], // index size on each proc
proc_index_displacement, // displacement of each proc index
- MPI_INT,
+ MPI_ID_TYPE,
MPI_COMM_WORLD);
// -----------
/*!
* \brief Set nb of cell/cell pairs in a joint between domains
*/
-void MEDPARTITIONER::ParaDomainSelector::setNbCellPairs( int nb_cell_pairs, int dist_domain, int loc_domain )
+void MEDPARTITIONER::ParaDomainSelector::setNbCellPairs( mcIdType 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
*/
//================================================================================
-int MEDPARTITIONER::ParaDomainSelector::getNbCellPairs( int dist_domain, int loc_domain ) const
+mcIdType MEDPARTITIONER::ParaDomainSelector::getNbCellPairs( int dist_domain, int loc_domain ) const
{
evaluateMemory();
_nb_cell_pairs_by_joint.resize( _nb_result_domains*(_nb_result_domains+1), 0);
evaluateMemory();
- std::vector< int > send_buf = _nb_cell_pairs_by_joint;
+ std::vector< mcIdType > send_buf = _nb_cell_pairs_by_joint;
#ifdef HAVE_MPI
MPI_Allreduce((void*)&send_buf[0],
(void*)&_nb_cell_pairs_by_joint[0],
- _nb_cell_pairs_by_joint.size(),
- MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+ (int)_nb_cell_pairs_by_joint.size(),
+ MPI_ID_TYPE, MPI_SUM, MPI_COMM_WORLD);
#endif
// check that the set nbs of cell pairs are correct,
// namely that each joint is treated on one proc only
*/
//================================================================================
-int MEDPARTITIONER::ParaDomainSelector::getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const
+mcIdType MEDPARTITIONER::ParaDomainSelector::getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const
{
// total_nb_faces includes faces existing before creation of joint faces
// (got in gatherNbOf( MED_FACE )).
evaluateMemory();
- int total_nb_faces = _face_shift_by_domain.empty() ? 0 : _face_shift_by_domain.back();
- int id = total_nb_faces + 1;
+ mcIdType total_nb_faces = _face_shift_by_domain.empty() ? 0 : _face_shift_by_domain.back();
+ mcIdType id = total_nb_faces + 1;
if ( _nb_cell_pairs_by_joint.empty() )
throw INTERP_KERNEL::Exception("gatherNbCellPairs() must be called before");
int dest = getProcessorID( dist_domain );
int tag = 2002 + jointId( loc_domain, dist_domain );
MPI_Status status;
- MPI_Sendrecv((void*)&loc_ids_here[0], loc_ids_here.size(), MPI_INT, dest, tag,
- (void*) loc_ids_dist, loc_ids_here.size(), MPI_INT, dest, tag,
+ MPI_Sendrecv((void*)&loc_ids_here[0], (int)loc_ids_here.size(), MPI_INT, dest, tag,
+ (void*) loc_ids_dist, (int)loc_ids_here.size(), MPI_INT, dest, tag,
MPI_COMM_WORLD, &status);
#endif
evaluateMemory();
std::cout << "proc " << _rank << " : sendMesh '" << mesh.getName() << "' size " << mesh.getNumberOfCells() << " to " << target << std::endl;
// First stage : sending sizes
// ------------------------------
- std::vector<int> tinyInfoLocal;
+ std::vector<mcIdType> tinyInfoLocal;
std::vector<std::string> tinyInfoLocalS;
std::vector<double> tinyInfoLocalD;
//Getting tiny info of local mesh to allow the distant proc to initialize and allocate
//the transmitted mesh.
mesh.getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS);
tinyInfoLocal.push_back(mesh.getNumberOfCells());
- int tinySize=tinyInfoLocal.size();
+ int tinySize=(int)tinyInfoLocal.size();
MPI_Send(&tinySize, 1, MPI_INT, target, 1113, MPI_COMM_WORLD);
- MPI_Send(&tinyInfoLocal[0], tinyInfoLocal.size(), MPI_INT, target, 1112, MPI_COMM_WORLD);
+ MPI_Send(&tinyInfoLocal[0], (int)tinyInfoLocal.size(), MPI_ID_TYPE, target, 1112, MPI_COMM_WORLD);
if (mesh.getNumberOfCells()>0) //no sends if empty
{
- MEDCoupling::DataArrayInt *v1Local=0;
+ MEDCoupling::DataArrayIdType *v1Local=0;
MEDCoupling::DataArrayDouble *v2Local=0;
//serialization of local mesh to send data to distant proc.
mesh.serialize(v1Local,v2Local);
int nbLocalElems=0;
- int* ptLocal=0;
+ mcIdType* ptLocal=0;
if(v1Local) //if empty getNbOfElems() is 1!
{
- nbLocalElems=v1Local->getNbOfElems(); // if empty be 1!
+ nbLocalElems=FromIdType<int>(v1Local->getNbOfElems()); // if empty be 1!
ptLocal=v1Local->getPointer();
}
- MPI_Send(ptLocal, nbLocalElems, MPI_INT, target, 1111, MPI_COMM_WORLD);
+ MPI_Send(ptLocal, nbLocalElems, MPI_ID_TYPE, target, 1111, MPI_COMM_WORLD);
int nbLocalElems2=0;
double *ptLocal2=0;
if(v2Local) //if empty be 0!
{
- nbLocalElems2=v2Local->getNbOfElems();
+ nbLocalElems2=FromIdType<int>(v2Local->getNbOfElems());
ptLocal2=v2Local->getPointer();
}
MPI_Send(ptLocal2, nbLocalElems2, MPI_DOUBLE, target, 1110, MPI_COMM_WORLD);
#else
// First stage : exchanging sizes
// ------------------------------
- std::vector<int> tinyInfoDistant;
+ std::vector<mcIdType> tinyInfoDistant;
std::vector<std::string> tinyInfoLocalS;
std::vector<double> tinyInfoDistantD(1);
//Getting tiny info of local mesh to allow the distant proc to initialize and allocate
tinyInfoDistant.resize(tinyVecSize);
std::fill(tinyInfoDistant.begin(),tinyInfoDistant.end(),0);
- MPI_Recv(&tinyInfoDistant[0], tinyVecSize, MPI_INT,source,1112,MPI_COMM_WORLD, &status);
+ MPI_Recv(&tinyInfoDistant[0], tinyVecSize, MPI_ID_TYPE,source,1112,MPI_COMM_WORLD, &status);
//there was tinyInfoLocal.push_back(mesh.getNumberOfCells());
- int NumberOfCells=tinyInfoDistant[tinyVecSize-1];
+ mcIdType NumberOfCells=tinyInfoDistant[tinyVecSize-1];
if (NumberOfCells>0)
{
- MEDCoupling::DataArrayInt *v1Distant=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType *v1Distant=MEDCoupling::DataArrayIdType::New();
MEDCoupling::DataArrayDouble *v2Distant=MEDCoupling::DataArrayDouble::New();
//Building the right instance of copy of distant mesh.
MEDCoupling::MEDCouplingPointSet *distant_mesh_tmp=
mesh->resizeForUnserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
int nbDistElem=0;
- int *ptDist=0;
+ mcIdType *ptDist=0;
if(v1Distant)
{
- nbDistElem=v1Distant->getNbOfElems();
+ nbDistElem=FromIdType<int>(v1Distant->getNbOfElems());
ptDist=v1Distant->getPointer();
}
- MPI_Recv(ptDist, nbDistElem, MPI_INT, source,1111, MPI_COMM_WORLD, &status);
+ MPI_Recv(ptDist, nbDistElem, MPI_ID_TYPE, source,1111, MPI_COMM_WORLD, &status);
double *ptDist2=0;
nbDistElem=0;
if(v2Distant)
{
- nbDistElem=v2Distant->getNbOfElems();
+ nbDistElem=FromIdType<int>(v2Distant->getNbOfElems());
ptDist2=v2Distant->getPointer();
}
MPI_Recv(ptDist2, nbDistElem, MPI_DOUBLE,source, 1110, MPI_COMM_WORLD, &status);
struct sysinfo si;
int err = sysinfo( &si );
if ( !err )
- used_memory = (( si.totalram - si.freeram + si.totalswap - si.freeswap ) * si.mem_unit ) / 1024;
+ used_memory = (int)(( si.totalram - si.freeram + si.totalswap - si.freeswap ) * si.mem_unit ) / 1024;
#endif
if ( used_memory > _max_memory )
_max_memory = used_memory;
#define __MEDPARTITIONER_PARADOMAINSELECTOR_HXX__
#include "MEDPARTITIONER.hxx"
+#include "MCType.hxx"
#include <memory>
#include <vector>
//identifier for a joint
int jointId( int local_domain, int distant_domain ) const;
- int getNbTotalCells() { return _cell_shift_by_domain.back(); }
- int getNbTotalNodes() { return _node_shift_by_domain.back(); };
- int getNbTotalFaces() { return _face_shift_by_domain.back(); };
+ mcIdType getNbTotalCells() { return _cell_shift_by_domain.back(); }
+ mcIdType getNbTotalNodes() { return _node_shift_by_domain.back(); };
+ mcIdType getNbTotalFaces() { return _face_shift_by_domain.back(); };
//Collect nb of entities on procs
void gatherNbOf(const std::vector<MEDCoupling::MEDCouplingUMesh*>& domain_meshes);
//distribution of the graph vertices among the processors
- int* getProcVtxdist() const;
+ mcIdType* getProcVtxdist() const;
//nb of nodes on processors with lower rank
- int getProcNodeShift() const;
+ mcIdType getProcNodeShift() const;
//nb of cells in domains with lower index
- int getDomainCellShift(int domainIndex) const;
+ mcIdType getDomainCellShift(int domainIndex) const;
//nb of nodes in domains with lower index
- int getDomainNodeShift(int domainIndex) const;
+ mcIdType getDomainNodeShift(int domainIndex) const;
//Gather graphs from all processors into one
std::unique_ptr<Graph> 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 );
+ void setNbCellPairs( mcIdType 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;
+ mcIdType 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;
+ mcIdType 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<int>& loc_ids_here ) const;
int _world_size; //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;
+ std::vector< mcIdType > _nb_cell_pairs_by_joint;
+ std::vector< mcIdType > _nb_vert_of_procs; //graph vertices
+ std::vector< mcIdType > _cell_shift_by_domain;
+ std::vector< mcIdType > _node_shift_by_domain;
+ std::vector< mcIdType > _face_shift_by_domain;
double _init_time;
bool _mesure_memory;
#include "MEDCouplingSkyLineArray.hxx"
#include "MEDCouplingUMesh.hxx"
#include "InterpKernelHashMap.hxx"
+#include "MCIdType.hxx"
#include <set>
#include <map>
//constructing topology according to mesh collection without global numerotation (use setGlobalNumerotation later)
ParallelTopology::ParallelTopology(const std::vector<MEDCoupling::MEDCouplingUMesh*>& meshes)
{
- _nb_domain=meshes.size();
+ _nb_domain=(int)meshes.size();
_nb_cells.resize(_nb_domain);
_nb_nodes.resize(_nb_domain);
// _nb_faces.resize(_nb_domain);
for (int idomain=0; idomain<_nb_domain; idomain++)
{
_loc_to_glob[idomain].resize(_nb_cells[idomain]);
- int domainCellShift=domainSelector->getDomainCellShift(idomain);
- for (int i=0; i<_nb_cells[idomain]; i++)
+ mcIdType domainCellShift=domainSelector->getDomainCellShift(idomain);
+ for (mcIdType i=0; i<_nb_cells[idomain]; i++)
{
- int global=domainCellShift+i ;
+ mcIdType global=domainCellShift+i ;
_glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
_loc_to_glob[idomain][i]=global;
if (MyGlobals::_Verbose>500)
for (int idomain=0; idomain<_nb_domain; idomain++)
{
_node_loc_to_glob[idomain].resize(_nb_nodes[idomain]);
- int domainNodeShift=domainSelector->getDomainNodeShift(idomain);
- for (int i=0; i<_nb_nodes[idomain]; i++)
+ mcIdType domainNodeShift=domainSelector->getDomainNodeShift(idomain);
+ for (mcIdType i=0; i<_nb_nodes[idomain]; i++)
{
- int global=domainNodeShift+i ;
+ mcIdType global=domainNodeShift+i ;
_node_glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
_node_loc_to_glob[idomain][i]=global;
if (MyGlobals::_Verbose>500)
//constructing topology according to mesh collection
ParallelTopology::ParallelTopology(const std::vector<MEDCoupling::MEDCouplingUMesh*>& meshes,
const std::vector<MEDPARTITIONER::ConnectZone*>& cz,
- std::vector<int*>& cellglobal,
- std::vector<int*>& nodeglobal,
- std::vector<int*>& faceglobal)
+ std::vector<mcIdType*>& cellglobal,
+ std::vector<mcIdType*>& nodeglobal,
+ std::vector<mcIdType*>& faceglobal)
{
- _nb_domain=meshes.size();
- int index_global=0;
- int index_node_global=0;
- int index_face_global=0;
+ _nb_domain=(int)meshes.size();
+ mcIdType index_global=0;
+ mcIdType index_node_global=0;
+ mcIdType index_face_global=0;
_nb_cells.resize(_nb_domain);
_nb_nodes.resize(_nb_domain);
{
//int cellDomainShift=_cell_shift_by_domain[idomain];
//creating global numbering from scratch
- for (int i=0; i<_nb_cells[idomain]; i++)
+ for (mcIdType i=0; i<_nb_cells[idomain]; i++)
{
- int global=i ;//cellDomainShift+i;
+ mcIdType global=i ;//cellDomainShift+i;
_glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
_loc_to_glob[idomain][i]=global;
index_global++;
//using global numbering coming from a previous numbering
else
{
- for (int i=0; i<_nb_cells[idomain]; i++)
+ for (mcIdType i=0; i<_nb_cells[idomain]; i++)
{
- int global=cellglobal[idomain][i];
+ mcIdType global=cellglobal[idomain][i];
_glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
//_loc_to_glob[make_pair(idomain,i+1)]=global;
_loc_to_glob[idomain][i]=global;
_nb_total_cells=index_global;
_nb_cells[0]=index_global;
_node_loc_to_glob[idomain].resize(meshes[idomain]->getNumberOfNodes());
- for (int i=0; i<meshes[idomain]->getNumberOfNodes(); i++)
+ for (mcIdType i=0; i<meshes[idomain]->getNumberOfNodes(); i++)
{
_node_glob_to_loc.insert(std::make_pair(i,std::make_pair(0,i)));
_node_loc_to_glob[0][i]=i;
//creating node maps
_nb_nodes[idomain]=meshes[idomain]->getNumberOfNodes();
- INTERP_KERNEL::HashMap <int,std::pair<int,int> > local2distant;
+ INTERP_KERNEL::HashMap <mcIdType,std::pair<int,mcIdType> > local2distant;
_node_loc_to_glob[idomain].resize(_nb_nodes[idomain]);
for (std::size_t icz=0; icz<cz.size(); icz++)
{
if (cz[icz]->getLocalDomainNumber() == idomain &&
cz[icz]->getLocalDomainNumber()>cz[icz]->getDistantDomainNumber())
{
- int nb_node= cz[icz]->getNodeNumber();
- const int* node_corresp=cz[icz]->getNodeCorrespValue();
+ mcIdType nb_node= cz[icz]->getNodeNumber();
+ const mcIdType* node_corresp=cz[icz]->getNodeCorrespValue();
int distant_ip = cz[icz]->getDistantDomainNumber();
- for (int i=0; i< nb_node; i++)
+ for (mcIdType i=0; i< nb_node; i++)
{
- int local= node_corresp[i*2];
- int distant = node_corresp[i*2+1];
+ mcIdType local= node_corresp[i*2];
+ mcIdType distant = node_corresp[i*2+1];
local2distant.insert(std::make_pair(local, std::make_pair(distant_ip,distant)));
}
}
// setting mappings for all nodes
if (nodeglobal[idomain]==0)
{
- for (int inode=0; inode<_nb_nodes[idomain]; inode++)
+ for (mcIdType inode=0; inode<_nb_nodes[idomain]; inode++)
{
if (local2distant.find(inode)==local2distant.end())
{
else
{
int ip = (local2distant.find(inode)->second).first;
- int distant = (local2distant.find(inode)->second).second;
- int global_number=_loc_to_glob[ip][distant];
+ mcIdType distant = (local2distant.find(inode)->second).second;
+ mcIdType global_number=_loc_to_glob[ip][distant];
_node_glob_to_loc.insert(std::make_pair(global_number,std::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++)
+ for (mcIdType inode=0; inode<_nb_nodes[idomain]; inode++)
{
- int global_number=nodeglobal[idomain][inode];
+ mcIdType global_number=nodeglobal[idomain][inode];
_node_glob_to_loc.insert(std::make_pair(global_number,std::make_pair(idomain,inode)));
_node_loc_to_glob[idomain][inode]=global_number;
}
_node_loc_to_glob.resize(_nb_domain);
_face_loc_to_glob.resize(_nb_domain);
- const int* part=graph->getPart(); //all cells for this proc (may be more domains)
+ const mcIdType* part=graph->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)
std::cout << "proc " << MyGlobals::_Rank << " : topology from partition, nbTotalCells " << _nb_total_cells << std::endl;
int icellProc=0; //all cells of my domains are concatenated in part
for (int iold=0; iold<oldTopology->nbDomain(); iold++)
{
- int ioldNbCell=oldTopology->getCellNumber(iold);
+ mcIdType ioldNbCell=oldTopology->getCellNumber(iold);
//std::cout<<"proc "<<MyGlobals::_Rank<<" : cell number old domain "<<iold<<" : "<<ioldNbCell<<std::endl;
//if not my old domains getCellNumber is 0
- std::vector<int> globalids(ioldNbCell);
+ std::vector<mcIdType> globalids(ioldNbCell);
oldTopology->getCellList(iold, &globalids[0]); //unique global numerotation
- for (int icell=0; icell<ioldNbCell; icell++)
+ for (mcIdType icell=0; icell<ioldNbCell; icell++)
{
- int idomain=part[icellProc];
+ int idomain=FromIdType<int>(part[icellProc]);
_nb_cells[idomain]++;
icellProc++;
- int iGlobalCell=globalids[icell];
+ mcIdType iGlobalCell=globalids[icell];
_loc_to_glob[idomain].push_back(iGlobalCell);
_glob_to_loc.insert(std::make_pair(iGlobalCell, std::make_pair(idomain, _nb_cells[idomain])));
}
if ( MyGlobals::_Create_Joints && nb_domain > 1 )
{
- std::vector< std::vector< std::vector< int > > > cellCorresp( nb_domain );
+ std::vector< std::vector< std::vector< mcIdType > > > cellCorresp( nb_domain );
for ( int idomain = 0; idomain < nb_domain; ++idomain )
{
cellCorresp[ idomain ].resize( nb_domain );
}
const MEDCoupling::MEDCouplingSkyLineArray* skylinegraph = graph->getGraph();
- const int* index = skylinegraph->getIndex();
- const int* value = skylinegraph->getValues();
- const int nbCells = skylinegraph->getNumberOf();
+ const mcIdType* index = skylinegraph->getIndex();
+ const mcIdType* value = skylinegraph->getValues();
+ const mcIdType nbCells = skylinegraph->getNumberOf();
- for ( int iGlob = 0; iGlob < nbCells; ++iGlob )
+ for ( mcIdType iGlob = 0; iGlob < nbCells; ++iGlob )
{
- int iGlobDom = part[ iGlob ];
- for ( int i = index[ iGlob ]; i < index[ iGlob+1 ]; i++ )
+ int iGlobDom = FromIdType<int>(part[ iGlob ]);
+ for ( mcIdType i = index[ iGlob ]; i < index[ iGlob+1 ]; i++ )
{
- int iGlobNear = value[ i ];
+ mcIdType iGlobNear = value[ i ];
if ( iGlob > iGlobNear )
continue; // treat ( iGlob, iGlobNear ) pair once
- int iGlobNearDom = part[ iGlobNear ];
+ int iGlobNearDom = FromIdType<int>(part[ iGlobNear ]);
if ( iGlobDom != iGlobNearDom )
{
- int iLoc = convertGlobalCell( iGlob ).second - 1; // to MEDCoupling fmt
- int iLocNear = convertGlobalCell( iGlobNear ).second - 1;
+ mcIdType iLoc = convertGlobalCell( iGlob ).second - 1; // to MEDCoupling fmt
+ mcIdType iLocNear = convertGlobalCell( iGlobNear ).second - 1;
cellCorresp[ iGlobDom ][ iGlobNearDom ].push_back( iLoc );
cellCorresp[ iGlobDom ][ iGlobNearDom ].push_back( iLocNear );
cellCorresp[ iGlobNearDom ][ iGlobDom ].push_back( iLocNear );
{
for ( int idomainNear = 0; idomainNear < nb_domain; ++idomainNear )
{
- std::vector< int > & corresp = cellCorresp[ idomain ][ idomainNear ];
+ std::vector< mcIdType > & corresp = cellCorresp[ idomain ][ idomainNear ];
if ( corresp.empty() )
continue;
MEDPARTITIONER::ConnectZone* cz = new MEDPARTITIONER::ConnectZone();
cz->setName( "Connect Zone defined by MEDPARTITIONER" );
cz->setDistantDomainNumber( idomainNear );
cz->setLocalDomainNumber ( idomain );
- cz->setEntityCorresp( 0,0, &corresp[0], corresp.size()/2 );
+ cz->setEntityCorresp( 0,0, &corresp[0], ToIdType( corresp.size()/2 ));
_connect_zones.push_back( cz );
}
}
* If a node in the list is represented on several domains,
* only the first value is returned
* */
-void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, int* local, int* ip)
+void ParallelTopology::convertGlobalNodeList(const mcIdType* node_list, mcIdType nbnode, mcIdType* local, int* ip)
{
if (_node_glob_to_loc.empty())
throw INTERP_KERNEL::Exception("Node mapping has not yet been built");
- for (int i=0; i< nbnode; i++)
+ for (mcIdType i=0; i< nbnode; i++)
{
- std::pair<int,int> local_node = _node_glob_to_loc.find(node_list[i])->second;
+ std::pair<int,mcIdType> local_node = _node_glob_to_loc.find(node_list[i])->second;
ip[i]=local_node.first;
local[i]=local_node.second;
}
* only the value with domain ip is returned
*
* */
-void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, int* local, int ip)
+void ParallelTopology::convertGlobalNodeList(const mcIdType* node_list, mcIdType nbnode, mcIdType* local, int ip)
{
if (_node_glob_to_loc.empty())
throw INTERP_KERNEL::Exception("Node mapping has not yet been built");
- for (int i=0; i< nbnode; i++)
+ for (mcIdType i=0; i< nbnode; i++)
{
- typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> >::iterator mmiter;
std::pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(node_list[i]);
for (mmiter it=range.first; it !=range.second; it++)
{
* If a node in the list is represented on several domains,
* all the values are put in the array
* */
-void ParallelTopology::convertGlobalNodeListWithTwins(const int* node_list, int nbnode, int*& local, int*& ip,int*& full_array, int& size)
+void ParallelTopology::convertGlobalNodeListWithTwins(const mcIdType* node_list, mcIdType nbnode, mcIdType*& local, int*& ip,mcIdType*& full_array, mcIdType& size)
{
if (_node_glob_to_loc.empty())
throw INTERP_KERNEL::Exception("Node mapping has not yet been built");
size=0;
- for (int i=0; i< nbnode; i++)
+ for (mcIdType i=0; i< nbnode; i++)
{
- int count= _node_glob_to_loc.count(node_list[i]);
+ mcIdType count= ToIdType( _node_glob_to_loc.count(node_list[i]));
size+=count;
}
- int index=0;
+ mcIdType index=0;
ip=new int[size];
- local=new int[size];
- full_array=new int[size];
- for (int i=0; i< nbnode; i++)
+ local=new mcIdType[size];
+ full_array=new mcIdType[size];
+ for (mcIdType i=0; i< nbnode; i++)
{
- typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> >::iterator mmiter;
std::pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(node_list[i]);
for (mmiter it=range.first; it !=range.second; it++)
{
* If a face in the list is represented on several domains,
* all the values are put in the array
* */
-void ParallelTopology::convertGlobalFaceListWithTwins(const int* face_list, int nbface, int*& local, int*& ip, int*& full_array,int& size)
+void ParallelTopology::convertGlobalFaceListWithTwins(const mcIdType* face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array,mcIdType& size)
{
size=0;
- for (int i=0; i< nbface; i++)
+ for (mcIdType i=0; i< nbface; i++)
{
//int count = _face_glob_to_loc.count(face_list[i]);
//if (count >1) MESSAGE_MED("face en doublon "<<face_list[i]);
- size+= _face_glob_to_loc.count(face_list[i]);
+ size+= ToIdType(_face_glob_to_loc.count(face_list[i]));
}
- int index=0;
+ mcIdType index=0;
ip=new int[size];
- local=new int[size];
- full_array=new int[size];
- for (int i=0; i< nbface; i++)
+ local=new mcIdType[size];
+ full_array=new mcIdType[size];
+ for (mcIdType i=0; i< nbface; i++)
{
- typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> >::iterator mmiter;
std::pair<mmiter,mmiter> range=_face_glob_to_loc.equal_range(face_list[i]);
for (mmiter it=range.first; it !=range.second; it++)
{
//!converts a list of global cell numbers
//!to a distributed array with local cell numbers
-void ParallelTopology::convertGlobalCellList(const int* cell_list, int nbcell, int* local, int* ip)
+void ParallelTopology::convertGlobalCellList(const mcIdType* cell_list, mcIdType nbcell, mcIdType* local, int* ip)
{
- for (int i=0; i<nbcell; i++)
+ for (mcIdType i=0; i<nbcell; i++)
{
- INTERP_KERNEL::HashMap<int, std::pair<int,int> >::const_iterator iter = _glob_to_loc.find(cell_list[i]);
+ INTERP_KERNEL::HashMap<mcIdType, std::pair<int,mcIdType> >::const_iterator iter = _glob_to_loc.find(cell_list[i]);
if (iter == _glob_to_loc.end())
{
std::cerr << "proc " << MyGlobals::_Rank << " : KO cell_list[" << i << "] : " << cell_list[i] << std::endl;
/*!Converts a list of global face numbers
* to a distributed array with local face numbers
*/
-void ParallelTopology::convertGlobalFaceList(const int* face_list, int nbface, int* local, int* ip)
+void ParallelTopology::convertGlobalFaceList(const mcIdType* face_list, mcIdType nbface, mcIdType* local, int* ip)
{
- for (int i=0; i< nbface; i++)
+ for (mcIdType i=0; i< nbface; i++)
{
- INTERP_KERNEL::HashMap<int, std::pair<int,int> >::const_iterator iter = _face_glob_to_loc.find(face_list[i]);
+ INTERP_KERNEL::HashMap<mcIdType, std::pair<int,mcIdType> >::const_iterator iter = _face_glob_to_loc.find(face_list[i]);
if (iter == _face_glob_to_loc.end())
{
throw INTERP_KERNEL::Exception("ParallelTopology::convertGlobalFaceList : Face not found");
* only the value with domain ip is returned
*
*/
-void ParallelTopology::convertGlobalFaceList(const int* face_list, int nbface, int* local, int ip)
+void ParallelTopology::convertGlobalFaceList(const mcIdType* face_list, mcIdType nbface, mcIdType* local, int ip)
{
- for (int i=0; i< nbface; i++)
+ for (mcIdType i=0; i< nbface; i++)
{
- typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> >::iterator mmiter;
std::pair<mmiter,mmiter> range=_face_glob_to_loc.equal_range(face_list[i]);
for (mmiter it=range.first; it !=range.second; it++)
{
//replacing a table of global numbering with a table with local numberings
// type_connectivity contains global connectivity for each type in input
// type_connectivity contains local connectivity for each type in output
-void ParallelTopology::convertToLocal2ndVersion(int* nodes, int nbnodes, int idomain)
+void ParallelTopology::convertToLocal2ndVersion(mcIdType* nodes, mcIdType nbnodes, int idomain)
{
- for (int inode=0; inode<nbnodes; inode++)
+ for (mcIdType inode=0; inode<nbnodes; inode++)
{
// cout <<" inode :"<<inode<< " global = "<<type_connectivity[type][inode];
- int global = nodes[inode];
- typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ mcIdType global = nodes[inode];
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> >::iterator mmiter;
std::pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(global);
for (mmiter it=range.first; it !=range.second; it++)
{
/*!
* \brief Return max global face number
*/
-int ParallelTopology::getMaxGlobalFace() const
+mcIdType ParallelTopology::getMaxGlobalFace() const
{
- int max = 0;
+ mcIdType max = 0;
TGlob2LocsMap::const_iterator g_l_l = _face_glob_to_loc.begin();
for ( ; g_l_l != _face_glob_to_loc.end(); ++g_l_l )
if ( g_l_l->first > max )
return max;
}
-int ParallelTopology::getNodeNumber() const
+mcIdType ParallelTopology::getNodeNumber() const
{
if (_node_glob_to_loc.empty()) return 0;
- std::set <int> keys;
- for (INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator iter= _node_glob_to_loc.begin(); iter!=_node_glob_to_loc.end(); iter++)
+ std::set <mcIdType> keys;
+ for (INTERP_KERNEL::HashMultiMap<mcIdType, std::pair<int,mcIdType> >::const_iterator iter= _node_glob_to_loc.begin(); iter!=_node_glob_to_loc.end(); iter++)
{
keys.insert(iter->first);
}
- return keys.size();
+ return ToIdType(keys.size());
}
/*!
* retrieving list of nodes in global numbers
*/
-void ParallelTopology::getNodeList(int idomain, int *list) const
+void ParallelTopology::getNodeList(int idomain, mcIdType *list) const
{
- for (int i=0; i<_nb_nodes[idomain]; i++)
+ for (mcIdType i=0; i<_nb_nodes[idomain]; i++)
list[i]=_node_loc_to_glob[idomain][i];
}
/*!
* retrieving list of nodes in global numbers
*/
-void ParallelTopology::getCellList(int idomain, int *list) const
+void ParallelTopology::getCellList(int idomain, mcIdType *list) const
{
- for (int i=0; i<_nb_cells[idomain];i++)
+ for (mcIdType i=0; i<_nb_cells[idomain];i++)
list[i]=_loc_to_glob[idomain][i];
}
-int ParallelTopology::getFaceNumber() const
+mcIdType ParallelTopology::getFaceNumber() const
{
if (_face_glob_to_loc.empty())
return 0;
- std::set <int> keys;
- for (INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator iter= _face_glob_to_loc.begin(); iter!=_face_glob_to_loc.end(); iter++)
+ std::set <mcIdType> keys;
+ for (INTERP_KERNEL::HashMultiMap<mcIdType, std::pair<int,mcIdType> >::const_iterator iter= _face_glob_to_loc.begin(); iter!=_face_glob_to_loc.end(); iter++)
{
keys.insert(iter->first);
}
- return keys.size();
+ return ToIdType(keys.size());
}
/*!
* retrieving list of faces in global numbers
*/
-void ParallelTopology::getFaceList(int idomain, int *list) const
+void ParallelTopology::getFaceList(int idomain, mcIdType *list) const
{
- for (int i=0; i<_nb_faces[idomain];i++)
+ for (mcIdType i=0; i<_nb_faces[idomain];i++)
list[i]=_face_loc_to_glob[idomain][i];
}
-int ParallelTopology::convertGlobalFace(int iglobal, int idomain)
+mcIdType ParallelTopology::convertGlobalFace(mcIdType iglobal, int idomain)
{
- typedef INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator MMiter;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType, std::pair<int,mcIdType> >::const_iterator MMiter;
std::pair<MMiter,MMiter> eq = _face_glob_to_loc.equal_range(iglobal);
for (MMiter it=eq.first; it != eq.second; it++)
if (it->second.first == idomain)
return -1;
}
-int ParallelTopology::convertGlobalNode(int iglobal, int idomain)
+mcIdType ParallelTopology::convertGlobalNode(mcIdType iglobal, int idomain)
{
- typedef INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator MMiter;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType, std::pair<int,mcIdType> >::const_iterator MMiter;
std::pair<MMiter,MMiter> eq = _node_glob_to_loc.equal_range(iglobal);
for (MMiter it=eq.first; it != eq.second; it++)
{
/*!
* adding a face to the topology
*/
-void ParallelTopology::appendFace(int idomain, int ilocal, int iglobal)
+void ParallelTopology::appendFace(int idomain, mcIdType ilocal, mcIdType iglobal)
{
_face_loc_to_glob[idomain].push_back(iglobal);
_face_glob_to_loc.insert(std::make_pair(iglobal,std::make_pair(idomain,ilocal)));
ParallelTopology(const std::vector<MEDCoupling::MEDCouplingUMesh*>&);
ParallelTopology(const std::vector<MEDCoupling::MEDCouplingUMesh*>&,
const std::vector<MEDPARTITIONER::ConnectZone*>&,
- std::vector<int*>&,
- std::vector<int*>&,
- std::vector<int*>&);
+ std::vector<mcIdType*>&,
+ std::vector<mcIdType*>&,
+ std::vector<mcIdType*>&);
ParallelTopology(Graph* graph, Topology* oldTopology, int nbdomain, int mesh_dimension);
~ParallelTopology();
/*! 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);
+ void convertGlobalNodeList(const mcIdType*, mcIdType,mcIdType*,int*);
+ void convertGlobalNodeList(const mcIdType*, mcIdType,mcIdType*,int);
+ void convertGlobalNodeListWithTwins(const mcIdType* face_list, mcIdType nbnode, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size);
/*! converts a list of global node numbers
* to a distributed array with local cell numbers
*/
- void convertGlobalCellList(const int*, int , int*, int *);
+ void convertGlobalCellList(const mcIdType*, mcIdType , mcIdType*, int *);
/*! 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);
+ void convertGlobalFaceList(const mcIdType*, mcIdType , mcIdType*, int *);
+ void convertGlobalFaceList(const mcIdType*, mcIdType , mcIdType*, int);
+ void convertGlobalFaceListWithTwins(const mcIdType* face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array,mcIdType& size);
/*! converting node global numberings to local numberings */
- void convertToLocal2ndVersion(int* nodes, int nbnodes, int idomain);
+ void convertToLocal2ndVersion(mcIdType* nodes, mcIdType nbnodes, int idomain);
/*! converting node local numbering to global */
- int convertNodeToGlobal(int ip, int icell) const { return _node_loc_to_glob[ip][icell]; }
+ mcIdType convertNodeToGlobal(int ip, mcIdType icell) const { return _node_loc_to_glob[ip][icell]; }
/*! converting face local numbering to global */
- int convertFaceToGlobal(int ip, int iface) const { return _face_loc_to_glob[ip][iface]; }
+ mcIdType convertFaceToGlobal(int ip, mcIdType iface) const { return _face_loc_to_glob[ip][iface]; }
/*! converting cell global numbering to local */
- int convertCellToGlobal(int ip, int icell) const { return _loc_to_glob[ip][icell]; }
+ mcIdType convertCellToGlobal(int ip, mcIdType icell) const { return _loc_to_glob[ip][icell]; }
- void convertNodeToGlobal(int ip, const int* local, int n, int *global) const
+ void convertNodeToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const
{
- for (int i=0; i<n; i++)
+ for (mcIdType i=0; i<n; i++)
global[i]=_node_loc_to_glob[ip][local[i]];
}
- void convertCellToGlobal(int ip, const int* local, int n, int *global) const
+ void convertCellToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const
{
- for (int i=0; i<n; i++)
+ for (mcIdType i=0; i<n; i++)
global[i]=_loc_to_glob[ip][local[i]];
}
- void convertFaceToGlobal(int ip, const int* local, int n, int *global) const
+ void convertFaceToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const
{
- for (int i=0; i<n; i++)
+ for (mcIdType i=0; i<n; i++)
global[i]=_face_loc_to_glob[ip][local[i]];
}
int nbDomain() const { return _nb_domain; }
- int nbCells() const { return _nb_total_cells; }
+ mcIdType nbCells() const { return _nb_total_cells; }
- int nbNodes() const { return _nb_total_nodes; }
+ mcIdType nbNodes() const { return _nb_total_nodes; }
- int nbCells( int idomain) const { return _nb_cells[idomain]; }
+ mcIdType nbCells( int idomain) const { return _nb_cells[idomain]; }
/*! retrieving number of nodes */
- int getNodeNumber(int idomain) const { return _nb_nodes[idomain]; }
+ mcIdType getNodeNumber(int idomain) const { return _nb_nodes[idomain]; }
- int getNodeNumber() const;
+ mcIdType getNodeNumber() const;
- void getNodeList(int idomain, int* list) const;
+ void getNodeList(int idomain, mcIdType* list) const;
/*! retrieving cell numbers after merging in parallel mode */
- std::vector<int> & getFusedCellNumbers(int idomain) { return _cell_loc_to_glob_fuse[idomain]; }
+ std::vector<mcIdType> & getFusedCellNumbers(int idomain) { return _cell_loc_to_glob_fuse[idomain]; }
- const std::vector<int>& getFusedCellNumbers(int idomain) const { return _cell_loc_to_glob_fuse[idomain]; }
+ const std::vector<mcIdType>& getFusedCellNumbers(int idomain) const { return _cell_loc_to_glob_fuse[idomain]; }
/*! retrieving face numbers after merging in parallel mode */
- std::vector<int> & getFusedFaceNumbers(int idomain) { return _face_loc_to_glob_fuse[idomain]; }
+ std::vector<mcIdType> & getFusedFaceNumbers(int idomain) { return _face_loc_to_glob_fuse[idomain]; }
- const std::vector<int>& getFusedFaceNumbers(int idomain) const { return _face_loc_to_glob_fuse[idomain]; }
+ const std::vector<mcIdType>& getFusedFaceNumbers(int idomain) const { return _face_loc_to_glob_fuse[idomain]; }
/*! retrieving number of nodes */
- int getCellNumber(int idomain) const { return _nb_cells[idomain]; }
+ mcIdType getCellNumber(int idomain) const { return _nb_cells[idomain]; }
- int getCellDomainNumber(int global) const { return (_glob_to_loc.find(global)->second).first; }
+ mcIdType getCellDomainNumber(int global) const { return (_glob_to_loc.find(global)->second).first; }
- void getCellList(int idomain, int* list) const;
+ void getCellList(int idomain, mcIdType* list) const;
- int getFaceNumber(int idomain) const { return _nb_faces[idomain]; }
+ mcIdType getFaceNumber(int idomain) const { return _nb_faces[idomain]; }
- int getFaceNumber() const;
+ mcIdType getFaceNumber() const;
- void getFaceList(int idomain, int* list) const;
+ void getFaceList(int idomain, mcIdType* list) const;
/*! converting a global cell number to a local representation (domain + local number) */
- std::pair<int,int> convertGlobalCell(int iglobal) const { return _glob_to_loc.find(iglobal)->second; }
+ std::pair<int,mcIdType> convertGlobalCell(mcIdType iglobal) const { return _glob_to_loc.find(iglobal)->second; }
- int convertGlobalFace(int iglobal, int idomain);
+ mcIdType convertGlobalFace(mcIdType iglobal, int idomain);
- int convertGlobalNode(int iglobal, int idomain);
+ mcIdType convertGlobalNode(mcIdType iglobal, int idomain);
std::vector<MEDPARTITIONER::ConnectZone*>& getCZ();
//adding a face to the topology
- void appendFace(int idomain, int ilocal, int iglobal);
+ void appendFace(int idomain, mcIdType ilocal, mcIdType iglobal);
//return max global face number
- int getMaxGlobalFace() const;
+ mcIdType getMaxGlobalFace() const;
private:
- bool hasCellWithNodes( const MeshCollection&, int dom, const std::set<int>& nodes );
+ bool hasCellWithNodes( const MeshCollection&, int dom, const std::set<mcIdType>& nodes );
private:
//mapping global -> local
- typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> > TGlob2DomainLoc;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> > TGlob2DomainLoc;
TGlob2DomainLoc _glob_to_loc;
TGlob2DomainLoc _node_glob_to_loc;
//mapping local -> global
- std::vector<std::vector<int> > _loc_to_glob;
- std::vector<std::vector <int> > _node_loc_to_glob;
+ std::vector<std::vector<mcIdType> > _loc_to_glob;
+ std::vector<std::vector <mcIdType> > _node_loc_to_glob;
// global numbers in parallel mode
- std::vector<std::vector <int> > _cell_loc_to_glob_fuse; // glob nums after merging
- std::vector<std::vector <int> > _face_loc_to_glob_fuse; // glob nums after merging
+ std::vector<std::vector <mcIdType> > _cell_loc_to_glob_fuse; // glob nums after merging
+ std::vector<std::vector <mcIdType> > _face_loc_to_glob_fuse; // glob nums after merging
//mapping global -> local
- typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> > TGlob2LocsMap;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> > TGlob2LocsMap;
TGlob2LocsMap _face_glob_to_loc;
//mapping local -> global
- std::vector<std::vector <int> > _face_loc_to_glob;
- std::vector<int> _nb_cells;
- std::vector<int> _nb_nodes;
- std::vector<int> _nb_faces;
- int _nb_total_cells;
- int _nb_total_nodes;
- int _nb_total_faces;
+ std::vector<std::vector <mcIdType> > _face_loc_to_glob;
+ std::vector<mcIdType> _nb_cells;
+ std::vector<mcIdType> _nb_nodes;
+ std::vector<mcIdType> _nb_faces;
+ mcIdType _nb_total_cells;
+ mcIdType _nb_total_nodes;
+ mcIdType _nb_total_faces;
int _nb_domain;
int _mesh_dimension;
std::cout << "proc " << MyGlobals::_Rank << " : SCOTCHGraph::partGraph" << std::endl;
//number of graph vertices
- int n = _graph->getNumberOf();
+ int n = FromIdType<int>(_graph->getNumberOf());
//graph
+#ifdef MEDCOUPLING_USE_64BIT_IDS
+ std::vector<int> indexVec( _graph->getIndex(), _graph->getIndexArray()->end() );
+ std::vector<int> valueVec( _graph->getValues(), _graph->getValuesArray()->end() );
+ int * xadj=indexVec.data();
+ int * adjncy=valueVec.data();
+#else
int * xadj=const_cast<int*>(_graph->getIndex());
int * adjncy=const_cast<int*>(_graph->getValues());
+#endif
//ndomain
int nparts=ndomain;
SCOTCH_stratExit(&scotch_strategy);
SCOTCH_graphExit(&scotch_graph);
- std::vector<int> index(n+1);
- std::vector<int> value(n);
+ std::vector<mcIdType> index(n+1);
+ std::vector<mcIdType> value(n);
index[0]=0;
for (int i=0; i<n; i++)
{
index[i+1]=index[i]+1;
- value[i]=partition[i];
+ value[i]=ToIdType(partition[i]);
}
delete [] partition;
#define __MEDPARTITIONER_TOPOLOGY_HXX__
#include "MEDPARTITIONER.hxx"
+#include "MCType.hxx"
#include <map>
#include <vector>
/*! 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;
+ virtual void convertGlobalNodeList(const mcIdType *list, mcIdType nb, mcIdType *local, int*ip) = 0;
+ virtual void convertGlobalNodeList(const mcIdType *list, mcIdType nb, mcIdType *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;
+ virtual void convertGlobalCellList(const mcIdType*list , mcIdType nb, mcIdType *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;
+ virtual void convertGlobalFaceList(const mcIdType*list , mcIdType nb, mcIdType* local, int*ip) = 0;
+ virtual void convertGlobalFaceList(const mcIdType*list , mcIdType nb, mcIdType* local, int ip) = 0;
+ virtual void convertGlobalFaceListWithTwins(const mcIdType *face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size) = 0;
+ virtual void convertGlobalNodeListWithTwins(const mcIdType *face_list, mcIdType nbnode, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size) = 0;
/*! number of doamins */
virtual int nbDomain() const = 0;
/*! number of cells */
- virtual int nbCells() const = 0;
+ virtual mcIdType nbCells() const = 0;
/*! number of nodes */
- virtual int nbNodes() const = 0;
+ virtual mcIdType nbNodes() const = 0;
/*! number of cells on a specific domain */
- virtual int nbCells(int idomain) const = 0;
+ virtual mcIdType 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(mcIdType*,mcIdType,int) = 0;
+ virtual mcIdType convertNodeToGlobal(int ip,mcIdType icell) const = 0;
+ virtual mcIdType convertFaceToGlobal(int ip,mcIdType icell) const = 0;
+ virtual mcIdType convertCellToGlobal(int ip,mcIdType icell) const = 0;
+ virtual void convertNodeToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0;
+ virtual void convertCellToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0;
+ virtual void convertFaceToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0;
/*! retrieving number of nodes */
- virtual int getNodeNumber(int idomain) const = 0;
- virtual int getNodeNumber() const = 0;
+ virtual mcIdType getNodeNumber(int idomain) const = 0;
+ virtual mcIdType getNodeNumber() const = 0;
/*! retrieving list of nodes */
- virtual void getNodeList(int idomain, int *list) const = 0;
- virtual std::vector<int> & getFusedCellNumbers(int idomain) = 0;
- virtual const std::vector<int> & getFusedCellNumbers(int idomain) const = 0;
- virtual std::vector<int> & getFusedFaceNumbers(int idomain) = 0;
- virtual const std::vector<int> & getFusedFaceNumbers(int idomain) const = 0;
+ virtual void getNodeList(int idomain, mcIdType *list) const = 0;
+ virtual std::vector<mcIdType> & getFusedCellNumbers(int idomain) = 0;
+ virtual const std::vector<mcIdType> & getFusedCellNumbers(int idomain) const = 0;
+ virtual std::vector<mcIdType> & getFusedFaceNumbers(int idomain) = 0;
+ virtual const std::vector<mcIdType> & getFusedFaceNumbers(int idomain) const = 0;
/*! retrieving number of nodes */
- virtual int getCellNumber(int idomain) const = 0;
+ virtual mcIdType getCellNumber(int idomain) const = 0;
/*! retrieving list of nodes */
- virtual void getCellList(int idomain, int *list) const = 0;
+ virtual void getCellList(int idomain, mcIdType *list) const = 0;
/*! retrieving number of faces */
- virtual int getFaceNumber(int idomain) const = 0;
- virtual int getFaceNumber() const = 0;
+ virtual mcIdType getFaceNumber(int idomain) const = 0;
+ virtual mcIdType getFaceNumber() const = 0;
/*! retrieving list of nodes */
- virtual void getFaceList(int idomain, int *list) const = 0;
+ virtual void getFaceList(int idomain, mcIdType *list) const = 0;
/*! adding a face to the mapping */
- virtual void appendFace(int idomain, int ilocal, int iglobal) = 0;
+ virtual void appendFace(int idomain, mcIdType ilocal, mcIdType iglobal) = 0;
/*! returns max global face number */
- virtual int getMaxGlobalFace() const = 0;
+ virtual mcIdType getMaxGlobalFace() const = 0;
/*! converting a global cell number to a local representation */
- virtual std::pair<int,int> convertGlobalCell(int iglobal) const = 0;
+ virtual std::pair<int,mcIdType> convertGlobalCell(mcIdType iglobal) const = 0;
/*! converting a global face number to a local representation */
- virtual int convertGlobalFace(int iglobal, int idomain) = 0;
+ virtual mcIdType convertGlobalFace(mcIdType iglobal, int idomain) = 0;
/*! converting a global node number to a local representation */
- virtual int convertGlobalNode(int iglobal, int idomain) = 0;
+ virtual mcIdType convertGlobalNode(mcIdType iglobal, int idomain) = 0;
/*! getting a reference to connect zones vector */
virtual std::vector<MEDPARTITIONER::ConnectZone*>& getCZ() = 0;
};
* (domain numbers range from 0 to ndomain-1
* \param n number of cells in the mesh
*/
-UserGraph::UserGraph(MEDCoupling::MEDCouplingSkyLineArray *array, const int *partition, int n):Graph(array,0)
+UserGraph::UserGraph(MEDCoupling::MEDCouplingSkyLineArray *array, const int *partition, mcIdType n):Graph(array,0)
{
- std::vector<int> index(n+1),value(n);
+ std::vector<mcIdType> index(n+1),value(n);
index[0]=0;
- for (int i=0; i<n; i++)
+ for (mcIdType i=0; i<n; i++)
{
index[i+1]=index[i]+1;
value[i]=partition[i];
class MEDPARTITIONER_EXPORT UserGraph : public Graph
{
public:
- UserGraph(MEDCoupling::MEDCouplingSkyLineArray*, const int*, int);
+ UserGraph(MEDCoupling::MEDCouplingSkyLineArray*, const int*, mcIdType);
virtual ~UserGraph();
void partGraph(int, const std::string& options=std::string(""), ParaDomainSelector *sel=0);
};
std::cerr << "MEDPARTITIONER::RandomizeAdj only works on one proc!" << std::endl;
return;
}
- int size=ran.size();
+ std::size_t size=ran.size();
std::vector<int> invran(size);
- for (int i=0; i<size; i++)
+ for (unsigned int i=0; i<size; i++)
invran[ran[i]]=i;
vx.resize(size+1);
int lga=xadj[size];
va.resize(lga);
int jj=0;
vx[0]=0;
- for (int i=0; i<size; i++)
+ for (std::size_t i=0; i<size; i++)
{
int ir=ran[i];
int ii=xadj[ir];
return oss.str();
}
-std::string MEDPARTITIONER::ReprMapOfStringInt(const std::map<std::string,int>& mymap)
+std::string MEDPARTITIONER::ReprMapOfStringInt(const std::map<std::string,mcIdType>& mymap)
{
if (mymap.size()==0)
return std::string(" NONE\n");
std::ostringstream oss;
- for (std::map<std::string,int>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
+ for (std::map<std::string,mcIdType>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
oss << " -> [" << (*i).first << "]=" << (*i).second << std::endl;
return oss.str();
}
* elements first and second of map give one elements in result vector of string
* converting formatted the int second as firsts characters ending at first slash
*/
-std::vector<std::string> MEDPARTITIONER::VectorizeFromMapOfStringInt(const std::map<std::string,int>& mymap)
+std::vector<std::string> MEDPARTITIONER::VectorizeFromMapOfStringInt(const std::map<std::string,mcIdType>& mymap)
{
std::vector<std::string> res;
- for (std::map<std::string,int>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
+ for (std::map<std::string,mcIdType>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
{
std::ostringstream oss;
oss << (*i).second << "/" << (*i).first;
/*
* if existing identicals (first,second) in vector no problem, else Exception
*/
-std::map<std::string,int> MEDPARTITIONER::DevectorizeToMapOfStringInt(const std::vector<std::string>& vec)
+std::map<std::string,mcIdType> MEDPARTITIONER::DevectorizeToMapOfStringInt(const std::vector<std::string>& vec)
{
- std::map<std::string,int> res;
+ std::map<std::string,mcIdType> res;
for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
{
std::size_t pos=0;
std::size_t found=(*i).find('/'); //first slash
if ((found==std::string::npos) || (found<1))
throw INTERP_KERNEL::Exception("Error aIntNumber/anyString is expected");
- int second;
+ mcIdType second;
std::istringstream iss((*i).substr(pos,found));
iss >> second;
std::string first=(*i).substr(pos+found+1,posmax-found);
- std::map<std::string,int>::iterator it=res.find(first);
+ std::map<std::string,mcIdType>::iterator it=res.find(first);
if (it!=res.end())
if ((*it).second!=second)
throw INTERP_KERNEL::Exception("Error not the same map value");
IT=StrToInt(ExtractFromDescription(description,"IT="));
}
-MEDCoupling::DataArrayInt *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<int>& v)
+MEDCoupling::DataArrayIdType *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<mcIdType>& v)
{
- MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New();
p->alloc(v.size(),1);
std::copy(v.begin(),v.end(),p->getPointer());
return p;
}
-MEDCoupling::DataArrayInt *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<int>& v,const int nbComponents)
+MEDCoupling::DataArrayIdType *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<mcIdType>& v,const int nbComponents)
{
- MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New();
if (v.size()%nbComponents!=0)
throw INTERP_KERNEL::Exception("Problem size modulo nbComponents != 0");
p->alloc(v.size()/nbComponents,nbComponents);
std::vector<std::string> res;
if (fd->getArray())
{
- int nb=fd->getArray()->getNumberOfComponents();
- res.push_back("nbComponents="); res.back()+=IntToStr(nb);
- for (int i=0; i<nb; i++)
+ std::size_t nb=fd->getArray()->getNumberOfComponents();
+ res.push_back("nbComponents="); res.back()+=IntToStr((int)nb);
+ for (unsigned int i=0; i<nb; i++)
{
res.push_back("componentInfo");
res.back()+=IntToStr(i)+"="+fd->getArray()->getInfoOnComponent(i);
{
for (int j=0; j<lggeom; j++)
{
- int profilesize=0,nbi=0;
+ med_int profilesize=0,nbi=0;
med_entity_type enttype=ENTITYTYPE[ie];
//enttype=MED_NODE;enttype=MED_CELL;enttype=MED_NODE_ELEMENT;
char pflname[MED_NAME_SIZE+1]="";
return res;
}
+MEDCoupling::MCAuto< MEDCoupling::DataArrayInt32 > MEDPARTITIONER::FromIdTypeVec( const std::vector< mcIdType >& vec )
+{
+ MEDCoupling::DataArrayInt32* array = MEDCoupling::DataArrayInt32::New();
+ array->alloc( vec.size(), 1 );
+ std::copy( vec.begin(), vec.end(), array->getPointer() );
+ return array;
+}
+
+
/*!
* quick almost human readable information on all fields on a mesh in a .med file
*/
namespace MEDPARTITIONER
{
- BBTreeOfDim::BBTreeOfDim( int dim,
+ BBTreeOfDim::BBTreeOfDim( std::size_t dim,
const double* bbs,
- int* elems,
+ mcIdType* elems,
int level,
- int nbelems,
+ mcIdType nbelems,
double epsilon)
{
switch ( dim )
{
case 3:
- _tree=new BBTree<3> (bbs,elems,level,nbelems,epsilon);
+ _tree=new BBTree<3,mcIdType> (bbs,elems,level,nbelems,epsilon);
_PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 3 >;
_PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 3 >;
break;
case 2:
- _tree=new BBTree<2> (bbs,elems,level,nbelems,epsilon);
+ _tree=new BBTree<2,mcIdType> (bbs,elems,level,nbelems,epsilon);
_PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 2 >;
_PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 2 >;
break;
case 1:
- _tree=new BBTree<1> (bbs,elems,level,nbelems,epsilon);
+ _tree=new BBTree<1,mcIdType> (bbs,elems,level,nbelems,epsilon);
_PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 1 >;
_PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 1 >;
break;
}
void BBTreeOfDim::getElementsAroundPoint( const double* coordsPtr,
- std::vector<int>& elems ) const
+ std::vector<mcIdType>& elems ) const
{
BBTreeOfDim* me = (BBTreeOfDim*) this;
(me->*_PgetElementsAroundPoint) ( coordsPtr, elems );
}
void BBTreeOfDim::getIntersectingElems(const double* bb,
- std::vector<int>& elems) const
+ std::vector<mcIdType>& elems) const
{
BBTreeOfDim* me = (BBTreeOfDim*) this;
(me->*_PgetIntersectingElems) ( bb, elems );
MEDPARTITIONER_EXPORT std::string ReprVectorOfString(const std::vector<std::string>& vec);
MEDPARTITIONER_EXPORT std::string ReprVectorOfString(const std::vector<std::string>& vec, const std::string separator);
- MEDPARTITIONER_EXPORT std::string ReprMapOfStringInt(const std::map<std::string,int>& mymap);
+ MEDPARTITIONER_EXPORT std::string ReprMapOfStringInt(const std::map<std::string,mcIdType>& mymap);
MEDPARTITIONER_EXPORT std::string ReprMapOfStringVectorOfString(const std::map< std::string,std::vector<std::string> >& mymap);
MEDPARTITIONER_EXPORT std::string ReprFieldDescriptions(const std::vector<std::string>& vec,const std::string separator);
MEDPARTITIONER_EXPORT std::vector<std::string> DeserializeToVectorOfString(const std::string& str);
MEDPARTITIONER_EXPORT std::string EraseTagSerialized(const std::string& fromStr, const std::string& tag);
- MEDPARTITIONER_EXPORT std::vector<std::string> VectorizeFromMapOfStringInt(const std::map<std::string,int>& mymap);
- MEDPARTITIONER_EXPORT std::map<std::string,int> DevectorizeToMapOfStringInt(const std::vector<std::string>& vec);
+ MEDPARTITIONER_EXPORT std::vector<std::string> VectorizeFromMapOfStringInt(const std::map<std::string,mcIdType>& mymap);
+ MEDPARTITIONER_EXPORT std::map<std::string,mcIdType> DevectorizeToMapOfStringInt(const std::vector<std::string>& vec);
MEDPARTITIONER_EXPORT std::vector<std::string> VectorizeFromMapOfStringVectorOfString(const std::map< std::string,std::vector<std::string> >& mymap);
MEDPARTITIONER_EXPORT std::map< std::string,std::vector<std::string> > DevectorizeToMapOfStringVectorOfString(const std::vector<std::string>& vec);
int& idomain, std::string& fileName, std::string& meshName, std::string& fieldName,
int& typeField, int& DT, int& IT);
MEDPARTITIONER_EXPORT void FieldShortDescriptionToData(const std::string& description,
- std::string& fieldName, int& typeField, int& entity, int& DT, int& IT);
-
- MEDCoupling::DataArrayInt *CreateDataArrayIntFromVector(const std::vector<int>& v);
- MEDCoupling::DataArrayInt *CreateDataArrayIntFromVector(const std::vector<int>& v, const int nbComponents);
+ std::string& fieldName, int& typeField, int& entity, int& DT, int& IT);
+
+ MEDCoupling::DataArrayIdType *CreateDataArrayIntFromVector(const std::vector<mcIdType>& v);
+ MEDCoupling::DataArrayIdType *CreateDataArrayIntFromVector(const std::vector<mcIdType>& v, const int nbComponents);
MEDCoupling::DataArrayDouble *CreateDataArrayDoubleFromVector(const std::vector<double>& v);
MEDCoupling::MEDCouplingUMesh *CreateEmptyMEDCouplingUMesh();
std::vector<std::string> BrowseAllFieldsOnMesh(const std::string& myfile, const std::string& mymesh, const int idomain);
std::vector<std::string> GetInfosOfField(const char *fileName, const char *meshName, const int idomain );
+ MEDCoupling::MCAuto< MEDCoupling::DataArrayInt32 > FromIdTypeVec( const std::vector< mcIdType >& vec );
+
+
#ifdef HAVE_MPI
//not advised, interblocking, use sendAndReceive
//void SendVectorOfString(const std::vector<std::string>& vec, const int target);
std::vector<double> *RecvDoubleVec(const int source);
void RecvDoubleVec(std::vector<double>& vec, const int source);
- void SendIntVec(const std::vector<int>& vec, const int target);
+ void SendIntVec(const std::vector<mcIdType>& vec, const int target);
std::vector<int>* RecvIntVec(int source);
- void RecvIntVec(std::vector<int>& vec, const int source);
+ void RecvIntVec(std::vector<mcIdType>& vec, const int source);
void SendDataArrayInt(const MEDCoupling::DataArrayInt* da, const int target);
MEDCoupling::DataArrayInt *RecvDataArrayInt(const int source);
{
void * _tree;
void (BBTreeOfDim::*_PgetElementsAroundPoint)( const double* coordsPtr,
- std::vector<int>& elems ) const;
+ std::vector<mcIdType>& elems ) const;
void (BBTreeOfDim::*_PgetIntersectingElems)( const double* bb,
- std::vector<int>& elems ) const;
+ std::vector<mcIdType>& elems ) const;
template< int dim>
void _getElementsAroundPoint( const double* coordsPtr,
- std::vector<int>& elems ) const
+ std::vector<mcIdType>& elems ) const
{
- ((BBTree<dim,int>*)_tree)->getElementsAroundPoint( coordsPtr, elems );
+ ((BBTree<dim,mcIdType>*)_tree)->getElementsAroundPoint( coordsPtr, elems );
}
template< int dim>
void _getIntersectingElems(const double* bb,
- std::vector<int>& elems) const
+ std::vector<mcIdType>& elems) const
{
- ((BBTree<dim,int>*)_tree)->getIntersectingElems( bb, elems );
+ ((BBTree<dim,mcIdType>*)_tree)->getIntersectingElems( bb, elems );
}
public:
- BBTreeOfDim( int dim,
+ BBTreeOfDim( std::size_t dim,
const double* bbs,
- int* elems,
+ mcIdType* elems,
int level,
- int nbelems,
+ mcIdType nbelems,
double epsilon=1e-12);
~BBTreeOfDim();
- void getElementsAroundPoint(const double* coordsPtr, std::vector<int>& elems ) const;
- void getIntersectingElems (const double* bb, std::vector<int>& elems) const;
+ void getElementsAroundPoint(const double* coordsPtr, std::vector<mcIdType>& elems ) const;
+ void getIntersectingElems (const double* bb, std::vector<mcIdType>& elems) const;
};
}
#endif
#include "MEDCouplingFieldDouble.hxx"
#include "InterpKernelException.hxx"
#include "MCAuto.hxx"
+#include "MEDCouplingMemArray.txx"
#include "InterpKernelAutoPtr.hxx"
#include <fstream>
#include <string>
#ifdef HAVE_MPI
+
#include <mpi.h>
+
+#ifndef MEDCOUPLING_USE_64BIT_IDS
+#define MPI_ID_TYPE MPI_INT
+#else
+#define MPI_ID_TYPE MPI_LONG
+#endif
+
#endif
using namespace MEDPARTITIONER;
if (rank == source)
{
std::string str=SerializeFromVectorOfString(vec);
- int size=str.length();
+ int size=(int)str.length();
MPI_Send( &size, 1, MPI_INT, target, tag, MPI_COMM_WORLD );
- MPI_Send( (void*)str.data(), str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD );
+ MPI_Send( (void*)str.data(), (int)str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD );
}
int recSize=0;
std::string str=SerializeFromVectorOfString(vec);
std::vector<int> indexes(world_size);
- int size=str.length();
+ int size=(int)str.length();
MPI_Allgather(&size, 1, MPI_INT,
&indexes[0], 1, MPI_INT, MPI_COMM_WORLD);
for (int i=0; i<world_size; i++) disp.push_back( disp.back() + indexes[i] );
std::string recData(disp.back(),'x');
- MPI_Allgatherv((void*)str.data(), str.length(), MPI_CHAR,
+ MPI_Allgatherv((void*)str.data(), (int)str.length(), MPI_CHAR,
(void*)recData.data(), &indexes[0], &disp[0], MPI_CHAR,
MPI_COMM_WORLD);
void MEDPARTITIONER::SendDoubleVec(const std::vector<double>& vec, const int target)
{
int tag = 111002;
- int size=vec.size();
+ int size=(int)vec.size();
if (MyGlobals::_Verbose>1000)
std::cout << "proc " << MyGlobals::_Rank << " : --> SendDoubleVec " << size << std::endl;
#ifdef HAVE_MPI
\param vec vector to be sent
\param target processor id of the target
*/
-void MEDPARTITIONER::SendIntVec(const std::vector<int>& vec, const int target)
+void MEDPARTITIONER::SendIntVec(const std::vector<mcIdType>& vec, const int target)
{
int tag = 111003;
- int size=vec.size();
+ int size=(int)vec.size();
if (MyGlobals::_Verbose>1000)
std::cout << "proc " << MyGlobals::_Rank << " : --> SendIntVec " << size << std::endl;
#ifdef HAVE_MPI
- MPI_Send(&size, 1, MPI_INT, target, tag, MPI_COMM_WORLD);
- MPI_Send(const_cast<int*>(&vec[0]), size,MPI_INT, target, tag+100, MPI_COMM_WORLD);
+ MPI_Send(&size, 1, MPI_ID_TYPE, target, tag, MPI_COMM_WORLD);
+ MPI_Send(const_cast<mcIdType*>(&vec[0]), size,MPI_ID_TYPE, target, tag+100, MPI_COMM_WORLD);
#endif
}
return vec;
}
-void MEDPARTITIONER::RecvIntVec(std::vector<int>& vec, const int source)
+void MEDPARTITIONER::RecvIntVec(std::vector<mcIdType>& vec, const int source)
{
int tag = 111003;
int size;
if (MyGlobals::_Verbose>1000)
std::cout << "proc " << MyGlobals::_Rank << " : <-- RecvIntVec " << size << std::endl;
vec.resize(size);
- MPI_Recv(&vec[0], size, MPI_INT, source, tag+100, MPI_COMM_WORLD,&status);
+ MPI_Recv(&vec[0], size, MPI_ID_TYPE, source, tag+100, MPI_COMM_WORLD,&status);
#endif
}
throw INTERP_KERNEL::Exception("Problem send DataArrayInt* NULL");
int tag = 111004;
int size[3];
- size[0]=da->getNbOfElems();
- size[1]=da->getNumberOfTuples();
- size[2]=da->getNumberOfComponents();
+ size[0]=(int)da->getNbOfElems();
+ size[1]=(int)da->getNumberOfTuples();
+ size[2]=(int)da->getNumberOfComponents();
if (MyGlobals::_Verbose>1000)
std::cout << "proc " << MyGlobals::_Rank << " : --> SendDataArrayInt " << size[0] << std::endl;
#ifdef HAVE_MPI
throw INTERP_KERNEL::Exception("Problem send DataArrayDouble* NULL");
int tag = 111005;
int size[3];
- size[0]=da->getNbOfElems();
- size[1]=da->getNumberOfTuples();
- size[2]=da->getNumberOfComponents();
+ size[0]=(int)da->getNbOfElems();
+ size[1]=(int)da->getNumberOfTuples();
+ size[2]=(int)da->getNumberOfComponents();
if (MyGlobals::_Verbose>1000)
std::cout << "proc " << MyGlobals::_Rank << " : --> SendDataArrayDouble " << size[0] << std::endl;
#ifdef HAVE_MPI
void MEDPARTITIONER::TestMapOfStringIntMpi()
{
int rank=MyGlobals::_Rank;
- std::map<std::string,int> myMap;
+ std::map<std::string,mcIdType> myMap;
myMap["one"]=1;
myMap["two"]=22; //a bug
myMap["three"]=3;
if (rank==0)
{
std::vector<std::string> v2=VectorizeFromMapOfStringInt(myMap);
- std::map<std::string,int> m3=DevectorizeToMapOfStringInt(v2);
+ std::map<std::string,mcIdType> m3=DevectorizeToMapOfStringInt(v2);
if (ReprMapOfStringInt(m3)!=ReprMapOfStringInt(myMap))
throw INTERP_KERNEL::Exception("Problem in (de)vectorize MapOfStringInt");
}
{
std::cout << "v2 is : a vector of size " << v2.size() << std::endl;
std::cout << ReprVectorOfString(v2) << std::endl;
- std::map<std::string,int> m2=DevectorizeToMapOfStringInt(v2);
+ std::map<std::string,mcIdType> m2=DevectorizeToMapOfStringInt(v2);
std::cout << "m2 is : a map of size " << m2.size() << std::endl;
std::cout << ReprMapOfStringInt(m2) << std::endl;
}
MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh()
//only hexa8
{
- vector<int> conn;
+ vector<mcIdType> conn;
vector<double> coor;
for (int k=0; k<=_nk; k++)
for (int j=0; j<=_nj; j++)
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(3);
- int nbc=conn.size()/8; //nb of cells
- int nbv=coor.size()/3; //nb of vertices
- mesh->allocateCells(nbc);
- for(int i=0; i<nbc; i++)
+ std::size_t nbc=conn.size()/8; //nb of cells
+ std::size_t nbv=coor.size()/3; //nb of vertices
+ mesh->allocateCells(ToIdType(nbc));
+ for(std::size_t i=0; i<nbc; i++)
{
- int onehexa[8];
+ mcIdType onehexa[8];
std::copy(conn.begin()+i*8,conn.begin()+(i+1)*8,onehexa);
if (false) //(_verbose)
{
MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh()
//only quad4 in oblique (k=j)
{
- vector<int> conn;
+ vector<mcIdType> conn;
vector<double> coor;
for (int j=0; j<=_nj; j++)
for (int i=0; i<=_ni; i++)
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
- int nbc=conn.size()/4; //nb of cells
- int nbv=coor.size()/3; //nb of vertices
- mesh->allocateCells(nbc);
- for(int i=0; i<nbc; i++)
+ std::size_t nbc=conn.size()/4; //nb of cells
+ std::size_t nbv=coor.size()/3; //nb of vertices
+ mesh->allocateCells(ToIdType(nbc));
+ for(std::size_t i=0; i<nbc; i++)
{
- int onequa[4];
+ mcIdType onequa[4];
std::copy(conn.begin()+i*4,conn.begin()+(i+1)*4,onequa);
if (false) //(_verbose)
{
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
- int nbc=conn.size()/4; //nb of cells
- int nbv=coor.size()/3; //nb of vertices
- mesh->allocateCells(nbc);
- for(int i=0; i<nbc; i++)
+ std::size_t nbc=conn.size()/4; //nb of cells
+ std::size_t nbv=coor.size()/3; //nb of vertices
+ mesh->allocateCells(ToIdType(nbc));
+ for(std::size_t i=0; i<nbc; i++)
{
- int onequa[4];
+ mcIdType onequa[4];
std::copy(conn.begin()+i*4,conn.begin()+(i+1)*4,onequa);
if (false) //(_verbose)
{
}
MEDCouplingUMesh *mesh=ReadUMeshFromFile(myfileName.c_str(),_mesh_name.c_str(),0);
- int nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
f1->setName("VectorFieldOnCells");
f1->setDescription("DescriptionOfFieldOnCells"); //not saved in file?
}
MEDCouplingUMesh *mesh=ReadUMeshFromFile(_file_name.c_str(),_mesh_name.c_str(),0);
- int nbOfNodes=mesh->getNumberOfNodes();
+ mcIdType nbOfNodes=mesh->getNumberOfNodes();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
f1->setName("VectorFieldOnNodes");
f1->setDescription("DescriptionOfFieldOnNodes"); //not saved in file?
WriteUMeshes(_file_name_with_faces.c_str(), meshes, true);
MEDCoupling::MEDFileUMesh* mfm=MEDCoupling::MEDFileUMesh::New(_file_name_with_faces.c_str(), mesh1->getName().c_str());
- DataArrayInt* FacesFam=DataArrayInt::New();
+ DataArrayIdType* FacesFam=DataArrayIdType::New();
FacesFam->alloc(mfm->getSizeAtLevel(-1),1);
FacesFam->fillWithValue(-1);
- DataArrayInt* CellsFam=DataArrayInt::New();
+ DataArrayIdType* CellsFam=DataArrayIdType::New();
CellsFam->alloc(mfm->getSizeAtLevel(0),1);
CellsFam->fillWithValue(1);
mfm->setFamilyFieldArr(-1,FacesFam);
mfm->setFamilyFieldArr(0,CellsFam);
- map<string,int> theFamilies;
+ map<string,mcIdType> theFamilies;
theFamilies["FAMILLE_ZERO"]=0;
theFamilies["FamilyFaces"]=-1;
theFamilies["FamilyCells"]=1;
DataArrayDouble* coords=mesh->getCoords();
//int nbOfComp=coords->getNumberOfComponents(); //be 3D
- int nbOfTuple=coords->getNumberOfTuples();
+ mcIdType nbOfTuple=coords->getNumberOfTuples();
double* ptr=coords->getPointer();
double* ptrini=ptrInit;
- for (int i=0; i<nbOfTuple; i++)
+ for (mcIdType i=0; i<nbOfTuple; i++)
{
*ptr=(*ptrini)+dx; ptr++; ptrini++; //be 3D
*ptr=(*ptrini)+dy; ptr++; ptrini++;
//more nbptgauss=8 by default needs set MEDCouplingFieldDiscretizationPerCell
//theory: (may be) http://www.code-aster.org/V2/doc/v9/fr/man_r/r3/r3.06.03.pdf
int nbptgauss=8; //nb pt de gauss by cell
- int nbcell=f3->getMesh()->getNumberOfCells();
- int nb=nbcell*nbptgauss;
+ mcIdType nbcell=f3->getMesh()->getNumberOfCells();
+ mcIdType nb=nbcell*nbptgauss;
int nbcomp=2;
array->alloc(nb,nbcomp);
double *ptr=array->getPointer();
CPPUNIT_ASSERT(collection.getName()=="testMesh");
CPPUNIT_ASSERT_EQUAL(1,collection.getNbOfLocalMeshes());
CPPUNIT_ASSERT_EQUAL(1,collection.getNbOfGlobalMeshes());
- CPPUNIT_ASSERT_EQUAL(_ni*_nj*_nk,collection.getNbOfLocalCells());
- CPPUNIT_ASSERT_EQUAL(_ni*_nj,collection.getNbOfLocalFaces());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj*_nk),collection.getNbOfLocalCells());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj),collection.getNbOfLocalFaces());
}
void MEDPARTITIONERTest::testMeshCollectionXml()
CPPUNIT_ASSERT(collection.getName()=="testMesh");
CPPUNIT_ASSERT_EQUAL(8,collection.getNbOfLocalMeshes());
CPPUNIT_ASSERT_EQUAL(8,collection.getNbOfGlobalMeshes());
- CPPUNIT_ASSERT_EQUAL(_ni*_nj*_nk*8,collection.getNbOfLocalCells());
- CPPUNIT_ASSERT_EQUAL(0,collection.getNbOfLocalFaces());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj*_nk*8),collection.getNbOfLocalCells());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),collection.getNbOfLocalFaces());
}
CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension());
std::vector<MEDCoupling::MEDCouplingUMesh*>cellMeshes=collection.getMesh();
CPPUNIT_ASSERT_EQUAL(5, (int) cellMeshes.size());
- int nbcells=0;
+ mcIdType nbcells=0;
for (std::size_t i = 0; i < cellMeshes.size(); i++)
nbcells+=cellMeshes[i]->getNumberOfCells();
- CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells);
+ CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells);
std::vector<MEDCoupling::MEDCouplingUMesh*>faceMeshes=collection.getFaceMesh();
CPPUNIT_ASSERT_EQUAL(5, (int) faceMeshes.size());
- int nbfaces=0;
+ mcIdType nbfaces=0;
for (std::size_t i=0; i < faceMeshes.size(); i++)
nbfaces+=faceMeshes[i]->getNumberOfCells();
- CPPUNIT_ASSERT_EQUAL((int)faceMesh->getNumberOfCells(), nbfaces);
+ CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), nbfaces);
//merge split meshes and test equality
cmd=execName+" --ndomains=1 --split-method="+MetisOrScotch; //on same proc
*/
std::vector<const MEDCouplingUMesh *> meshes;
- std::vector<DataArrayInt *> corr;
+ std::vector<DataArrayIdType *> corr;
meshes.push_back(cellMesh);
refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9);
meshes.push_back(refusedCellMesh);
CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
std::vector<const MEDCouplingUMesh *> meshes;
- std::vector<DataArrayInt *> corr;
+ std::vector<DataArrayIdType *> corr;
meshes.push_back(cellMesh);
refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9);
meshes.push_back(refusedCellMesh);
MCAuto<MEDCouplingField> field2Tmp(ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1));
MCAuto<MEDCouplingFieldDouble> field1(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field1Tmp)),field2(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field2Tmp));
- int nbcells=corr[1]->getNumberOfTuples();
- CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells);
+ mcIdType nbcells=corr[1]->getNumberOfTuples();
+ CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells);
//use corr to test equality of field
DataArrayDouble* f1=field1->getArray();
DataArrayDouble* f2=field2->getArray();
}
int nbequal=0;
- int nbcomp=field1->getNumberOfComponents();
+ std::size_t nbcomp=field1->getNumberOfComponents();
double* p1=f1->getPointer();
double* p2=f2->getPointer();
- int* pc=corr[1]->getPointer();
+ mcIdType* pc=corr[1]->getPointer();
for (int i = 0; i < nbcells; i++)
{
- int i1=pc[i]*nbcomp;
- int i2=i*nbcomp;
- for (int j = 0; j < nbcomp; j++)
+ std::size_t i1=pc[i]*nbcomp;
+ std::size_t i2=i*nbcomp;
+ for (std::size_t j = 0; j < nbcomp; j++)
{
if (p1[i1+j]==p2[i2+j]) nbequal++;
//cout<<" "<<p1[i1+j]<<"="<<p2[i2+j];
}
}
- CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp, nbequal);
+ CPPUNIT_ASSERT_EQUAL((int)(nbcells*nbcomp), nbequal);
for (std::size_t i = 0; i < corr.size(); i++)
corr[i]->decrRef();
CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
std::vector<const MEDCouplingUMesh *> meshes;
- std::vector<DataArrayInt *> corr;
+ std::vector<DataArrayIdType *> corr;
meshes.push_back(cellMesh);
refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9);
meshes.push_back(refusedCellMesh);
MCAuto<MEDCouplingField> field2Tmp=ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6);
MCAuto<MEDCouplingFieldDouble> field1(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field1Tmp)),field2(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field2Tmp));
- int nbcells=corr[1]->getNumberOfTuples();
- CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells);
+ mcIdType nbcells=corr[1]->getNumberOfTuples();
+ CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells);
//use corr to test equality of field
DataArrayDouble* f1=field1->getArray();
DataArrayDouble* f2=field2->getArray();
}
int nbequal=0;
int nbptgauss=8;
- int nbcomp=field1->getNumberOfComponents();
+ std::size_t nbcomp=field1->getNumberOfComponents();
double* p1=f1->getPointer();
double* p2=f2->getPointer();
- int* pc=corr[1]->getPointer();
+ mcIdType* pc=corr[1]->getPointer();
for (int i = 0; i < nbcells; i++)
{
- int i1=pc[i]*nbcomp*nbptgauss;
- int i2=i*nbcomp*nbptgauss;
- for (int j = 0; j < nbcomp*nbptgauss; j++)
+ std::size_t i1=pc[i]*nbcomp*nbptgauss;
+ std::size_t i2=i*nbcomp*nbptgauss;
+ for (std::size_t j = 0; j < nbcomp*nbptgauss; j++)
{
if (p1[i1+j]==p2[i2+j]) nbequal++;
//cout<<" "<<p1[i1+j]<<"="<<p2[i2+j];
}
}
- CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp*nbptgauss, nbequal);
+ CPPUNIT_ASSERT_EQUAL((int)(nbcells*nbcomp*nbptgauss), nbequal);
for (std::size_t i = 0; i < corr.size(); i++)
corr[i]->decrRef();
int nbFam1, nbFam2, nbc;
{
const int nbX = 20, nbY = 15;
- vector<int> conn;
+ vector<mcIdType> conn;
vector<double> coor;
for (int j=0; j<=nbY; j++)
for (int i=0; i<=nbX; i++)
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
- nbc=conn.size()/4; //nb of cells
+ nbc=(int)conn.size()/4; //nb of cells
mesh->allocateCells(nbc);
- int* pConn = &conn[0];
+ mcIdType* pConn = &conn[0];
for(int i=0; i<nbc; i++, pConn+=4)
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,pConn);
mesh->finishInsertingCells();
- int nbv=coor.size()/2; //nb of vertices
+ int nbv=(int)coor.size()/2; //nb of vertices
DataArrayDouble *myCoords=DataArrayDouble::New();
myCoords->useArray( &coor[0], /*ownership=*/false, DeallocType::CPP_DEALLOC, nbv, 2 );
mesh->setCoords(myCoords);
mesh->checkConsistencyLight();
// groups of cells
- DataArrayInt* cellsFam=DataArrayInt::New();
+ DataArrayIdType* cellsFam=DataArrayIdType::New();
cellsFam->alloc(nbc,1);
nbFam1 = nbc/3, nbFam2 = nbc/2;
int iE = 0;
for ( int i = 0; i < nbFam1; ++i ) cellsFam->getPointer()[ iE++ ] = idFam1;
for ( int i = 0; i < nbFam2; ++i ) cellsFam->getPointer()[ iE++ ] = idFam2;
for ( ; iE < nbc; ) cellsFam->getPointer()[ iE++ ] = 0;
- map<string,int> theFamilies;
+ map<string,mcIdType> theFamilies;
theFamilies["FAMILLE_ZERO"]=0;
theFamilies["Family1" ]=idFam1;
theFamilies["Family2" ]=idFam2;
CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfLocalMeshes());
CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfGlobalMeshes());
CPPUNIT_ASSERT_EQUAL(collection.getNbOfLocalCells(),new_collection.getNbOfLocalCells());
- CPPUNIT_ASSERT_EQUAL(0,collection.getNbOfLocalFaces());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),collection.getNbOfLocalFaces());
CPPUNIT_ASSERT (new_collection.getNbOfLocalFaces() > 0 );
MyGlobals::_General_Informations.clear();
// Check that "groups and family handling is NOT bugged"
MeshCollection new_collection(std::string(xmlName)+".xml");
- std::map< int, int > famId2nb; // count total nb of cells in divided families
- std::map< int, int >::iterator id2nn;
+ std::map< mcIdType, int > famId2nb; // count total nb of cells in divided families
+ std::map< mcIdType, int >::iterator id2nn;
{
- const std::vector<MEDCoupling::DataArrayInt*>& famIdsVec = new_collection.getCellFamilyIds();
+ const std::vector<MEDCoupling::DataArrayIdType*>& famIdsVec = new_collection.getCellFamilyIds();
for ( size_t i = 0; i < famIdsVec.size(); ++i )
{
- MEDCoupling::DataArrayInt* famIdsArr = famIdsVec[i];
- for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
+ MEDCoupling::DataArrayIdType* famIdsArr = famIdsVec[i];
+ for ( mcIdType j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
{
id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first;
id2nn->second++;
// Check that "creates boundary faces option is handled"
famId2nb.clear();
- const std::vector<MEDCoupling::DataArrayInt*>& famIdsVec = new_collection.getFaceFamilyIds();
+ const std::vector<MEDCoupling::DataArrayIdType*>& famIdsVec = new_collection.getFaceFamilyIds();
for ( size_t i = 0; i < famIdsVec.size(); ++i )
{
- MEDCoupling::DataArrayInt* famIdsArr = famIdsVec[i];
- for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
+ MEDCoupling::DataArrayIdType* famIdsArr = famIdsVec[i];
+ for ( mcIdType j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
{
id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first;
id2nn->second++;
// for each "JOINT_n_p_..." group there must be "JOINT_p_n_..." group
// of the same size
- std::map<std::string,int>& famName2id = new_collection.getFamilyInfo();
- std::map<std::string,int>::iterator na2id = famName2id.begin(), na2id2;
- std::set< int > okFamIds;
+ std::map<std::string,mcIdType>& famName2id = new_collection.getFamilyInfo();
+ std::map<std::string,mcIdType>::iterator na2id = famName2id.begin(), na2id2;
+ std::set< mcIdType > okFamIds;
okFamIds.insert(0);
for ( ; na2id != famName2id.end(); ++na2id )
{
ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES CPLUSPLUS ON)
IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES SWIG_FLAGS "-py3")
ADD_DEFINITIONS("-DHDF5_IS_PARALLEL")
ENDIF(HDF5_ENABLE_PARALLEL OR HDF5_IS_PARALLEL)
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
INCLUDE_DIRECTORIES(
${MPI_INCLUDE_DIRS}
${MEDFILE_INCLUDE_DIRS}
MEDFileUMesh *ParaMEDFileUMesh::NewPrivate(med_idt fid, int iPart, int nbOfParts, const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
{
MCAuto<MEDFileUMesh> ret;
- int meshDim, spaceDim, numberOfNodes;
+ int meshDim, spaceDim;
+ mcIdType numberOfNodes;
std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > typesDistrib(GetUMeshGlobalInfo(fileName,mName,meshDim,spaceDim,numberOfNodes));
std::vector<INTERP_KERNEL::NormalizedCellType> types;
- std::vector<int> distrib;
+ std::vector<mcIdType> distrib;
for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it0=typesDistrib.begin();it0!=typesDistrib.end();it0++)
for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
{
types.push_back((*it1).first);
- int tmp[3];
+ mcIdType tmp[3];
DataArray::GetSlice(0,(*it1).second,1,iPart,nbOfParts,tmp[0],tmp[1]);
tmp[2]=1;
distrib.insert(distrib.end(),tmp,tmp+3);
*/
void ParaMEDLoader::WriteMasterFile(const char *fileName, const std::vector<std::string>& fileNames, const char *meshName)
{
- int nbOfDom=fileNames.size();
+ std::size_t nbOfDom=fileNames.size();
std::ofstream fs(fileName);
fs << "#MED Fichier V 2.3" << " " << std::endl;
fs << "#"<<" " << std::endl;
fs << nbOfDom <<" " << std::endl;
- for(int i=0;i<nbOfDom;i++)
+ for(std::size_t i=0;i<nbOfDom;i++)
fs << meshName << " " << i+1 << " " << meshName << "_" << i+1 << " localhost " << fileNames[i] << " " << std::endl;
}
BlockTopology::BlockTopology(const ProcessorGroup& group, MEDCouplingCMesh *grid):
_dimension(grid->getSpaceDimension()), _proc_group(&group), _owns_processor_group(false)
{
- vector <int> axis_length(_dimension);
+ vector <mcIdType> axis_length(_dimension);
_nb_elems=1;
for (int idim=0; idim <_dimension; idim++)
{
_proc_group=geom_topo.getProcGroup();
_local_array_indices=geom_topo._local_array_indices;
vector<int> comp_indices = *(comp_topo.getBlockIndices());
- _local_array_indices.push_back(comp_indices);
+ _local_array_indices.emplace_back( comp_indices.begin(), comp_indices.end() );
_nb_procs_per_dim=geom_topo._nb_procs_per_dim;
_nb_procs_per_dim.push_back(comp_topo.nbBlocks());
_cycle_type=geom_topo._cycle_type;
* to \a group will cause an MPI error, while calling from a subset
* of \a group will result in a deadlock.
*/
- BlockTopology::BlockTopology(const ProcessorGroup& group, int nb_elem):_dimension(1),_proc_group(&group),_owns_processor_group(false)
+ BlockTopology::BlockTopology(const ProcessorGroup& group, mcIdType nb_elem):_dimension(1),_proc_group(&group),_owns_processor_group(false)
{
- int* nbelems_per_proc = new int[group.size()];
+ mcIdType* nbelems_per_proc = new mcIdType[group.size()];
const MPIProcessorGroup* mpi_group=dynamic_cast<const MPIProcessorGroup*>(_proc_group);
const MPI_Comm* comm=mpi_group->getComm();
- int nbtemp=nb_elem;
- mpi_group->getCommInterface().allGather(&nbtemp, 1, MPI_INT,
- nbelems_per_proc, 1, MPI_INT,
+ mcIdType nbtemp=nb_elem;
+ mpi_group->getCommInterface().allGather(&nbtemp, 1, MPI_ID_TYPE,
+ nbelems_per_proc, 1, MPI_ID_TYPE,
*comm);
- _nb_elems=0;
+ _nb_elems=0;
//splitting along only dimension
_local_array_indices.resize(1);
}
//!converts a pair <subdomainid,local> to a global number
- std::pair<int,int> BlockTopology::globalToLocal(const int global) const
+ std::pair<int,mcIdType> BlockTopology::globalToLocal(const mcIdType global) const
{
int subdomain_id=0;
- int position=global;
- int size=_nb_elems;
- int size_procs=_proc_group->size();
- int increment=size;
- vector<int>axis_position(_dimension);
- vector<int>axis_offset(_dimension);
+ mcIdType position=global;
+ mcIdType size=_nb_elems;
+ std::size_t size_procs=_proc_group->size();
+ mcIdType increment=size;
+ vector<mcIdType>axis_position(_dimension);
+ vector<mcIdType>axis_offset(_dimension);
for (int idim=0; idim<_dimension; idim++)
{
- int axis_size=_local_array_indices[idim].size()-1;
- int axis_nb_elem=_local_array_indices[idim][axis_size];
+ std::size_t axis_size=_local_array_indices[idim].size()-1;
+ mcIdType axis_nb_elem=_local_array_indices[idim][axis_size];
increment=increment/axis_nb_elem;
- int proc_increment = size_procs/(axis_size);
- int axis_pos=position/increment;
+ int proc_increment = (int)(size_procs/axis_size);
+ mcIdType axis_pos=position/increment;
position=position%increment;
int iaxis=1;
while (_local_array_indices[idim][iaxis]<=axis_pos)
axis_position[idim]=axis_pos-_local_array_indices[idim][iaxis-1];
axis_offset[idim]=iaxis;
}
- int local=0;
- int local_increment=1;
+ mcIdType local=0;
+ mcIdType local_increment=1;
for (int idim=_dimension-1; idim>=0; idim--)
{
local+=axis_position[idim]*local_increment;
}
//!converts local number to a global number
- int BlockTopology::localToGlobal(const pair<int,int> local) const
+ mcIdType BlockTopology::localToGlobal(const pair<int,mcIdType> local) const
{
- int subdomain_id=local.first;
- int global=0;
- int loc=local.second;
- int increment=_nb_elems;
- int proc_increment=_proc_group->size();
- int local_increment=getNbLocalElements();
+ std::size_t subdomain_id=local.first;
+ mcIdType global=0;
+ mcIdType loc=local.second;
+ mcIdType increment=_nb_elems;
+ std::size_t proc_increment=_proc_group->size();
+ mcIdType local_increment=getNbLocalElements();
for (int idim=0; idim < _dimension; idim++)
{
- int axis_size=_local_array_indices[idim].size()-1;
- int axis_nb_elem=_local_array_indices[idim][axis_size];
+ std::size_t axis_size=_local_array_indices[idim].size()-1;
+ mcIdType axis_nb_elem=_local_array_indices[idim][axis_size];
increment=axis_nb_elem==0?0:increment/axis_nb_elem;
- proc_increment = proc_increment/(axis_size);
- int proc_axis=subdomain_id/proc_increment;
+ proc_increment = proc_increment/axis_size;
+ std::size_t proc_axis=subdomain_id/proc_increment;
subdomain_id=subdomain_id%proc_increment;
- int local_axis_nb_elem=_local_array_indices[idim][proc_axis+1]-_local_array_indices[idim][proc_axis];
+ mcIdType local_axis_nb_elem=_local_array_indices[idim][proc_axis+1]-_local_array_indices[idim][proc_axis];
local_increment = (local_axis_nb_elem==0)?0:(local_increment/local_axis_nb_elem);
- int iaxis=((local_increment==0)?0:(loc/local_increment))+_local_array_indices[idim][proc_axis];
+ mcIdType iaxis=((local_increment==0)?0:(loc/local_increment))+_local_array_indices[idim][proc_axis];
global+=increment*iaxis;
loc = (local_increment==0)?0:(loc%local_increment);
}
}
//Retrieves the local number of elements
- int BlockTopology::getNbLocalElements()const
+ mcIdType BlockTopology::getNbLocalElements()const
{
int position=_proc_group->myRank();
- int nb_elem = 1;
+ mcIdType nb_elem = 1;
int increment=1;
for (int i=_dimension-1; i>=0; i--)
{
increment *=_nb_procs_per_dim[i];
int idim=position%increment;
position=position/increment;
- int imin=_local_array_indices[i][idim];
- int imax=_local_array_indices[i][idim+1];
+ mcIdType imin=_local_array_indices[i][idim];
+ mcIdType imax=_local_array_indices[i][idim+1];
nb_elem*=(imax-imin);
}
return nb_elem;
* as a size and each pair <int,int> contains min and max. Indices
* range from min to max-1.
*/
- std::vector<std::pair<int,int> > BlockTopology::getLocalArrayMinMax() const
+ std::vector<std::pair<int,mcIdType> > BlockTopology::getLocalArrayMinMax() const
{
- vector<pair<int,int> > local_indices (_dimension);
+ vector<pair<int,mcIdType> > local_indices (_dimension);
int myrank=_proc_group->myRank();
int increment=1;
for (int i=_dimension-1; i>=0; i--)
{
increment *=_nb_procs_per_dim[i];
int idim=myrank%increment;
- local_indices[i].first=_local_array_indices[i][idim];
+ local_indices[i].first=(int)_local_array_indices[i][idim];
local_indices[i].second=_local_array_indices[i][idim+1];
cout << local_indices[i].first << " "<< local_indices[i].second<<endl;
}
/*! Serializes the data contained in the Block Topology
* for communication purposes*/
- void BlockTopology::serialize(int* & serializer, int& size) const
+ void BlockTopology::serialize(mcIdType* & serializer, mcIdType& size) const
{
- vector<int> buffer;
+ vector<mcIdType> buffer;
buffer.push_back(_dimension);
buffer.push_back(_nb_elems);
{
buffer.push_back(_nb_procs_per_dim[i]);
buffer.push_back(_cycle_type[i]);
- buffer.push_back(_local_array_indices[i].size());
- for (int j=0; j<(int)_local_array_indices[i].size(); j++)
+ buffer.push_back(ToIdType(_local_array_indices[i].size()));
+ for (std::size_t j=0; j<_local_array_indices[i].size(); j++)
buffer.push_back(_local_array_indices[i][j]);
}
//serializing the comm group
- int size_comm=_proc_group->size();
+ mcIdType size_comm=_proc_group->size();
buffer.push_back(size_comm);
MPIProcessorGroup world_group(_proc_group->getCommInterface());
for (int i=0; i<size_comm;i++)
buffer.push_back(world_rank);
}
- serializer=new int[buffer.size()];
- size=buffer.size();
+ serializer=new mcIdType[buffer.size()];
+ size=ToIdType(buffer.size());
copy(buffer.begin(), buffer.end(), serializer);
}
* after communication. Uses the same structure as the one used for serialize()
*
*/
- void BlockTopology::unserialize(const int* serializer,const CommInterface& comm_interface)
+ void BlockTopology::unserialize(const mcIdType* serializer,const CommInterface& comm_interface)
{
- const int* ptr_serializer=serializer;
+ const mcIdType* ptr_serializer=serializer;
cout << "unserialize..."<<endl;
- _dimension=*(ptr_serializer++);
+ _dimension=(int)*(ptr_serializer++);
cout << "dimension "<<_dimension<<endl;
_nb_elems=*(ptr_serializer++);
cout << "nbelems "<<_nb_elems<<endl;
_local_array_indices.resize(_dimension);
for (int i=0; i<_dimension; i++)
{
- _nb_procs_per_dim[i]=*(ptr_serializer++);
+ _nb_procs_per_dim[i]=(int)*(ptr_serializer++);
_cycle_type[i]=(CYCLE_TYPE)*(ptr_serializer++);
_local_array_indices[i].resize(*(ptr_serializer++));
- for (int j=0; j<(int)_local_array_indices[i].size(); j++)
+ for (std::size_t j=0; j<_local_array_indices[i].size(); j++)
_local_array_indices[i][j]=*(ptr_serializer++);
}
set<int> procs;
- int size_comm=*(ptr_serializer++);
+ mcIdType size_comm=*(ptr_serializer++);
for (int i=0; i<size_comm; i++)
- procs.insert(*(ptr_serializer++));
+ procs.insert((int)*(ptr_serializer++));
cout << "unserialize..."<<procs.size()<<endl;
_proc_group=new MPIProcessorGroup(comm_interface,procs);
_owns_processor_group=true;
BlockTopology();
BlockTopology(const ProcessorGroup& group, MEDCouplingCMesh *grid);
BlockTopology(const BlockTopology& geom_topo, const ComponentTopology& comp_topo);
- BlockTopology(const ProcessorGroup& group, int nb_elem);
+ BlockTopology(const ProcessorGroup& group, mcIdType nb_elem);
virtual ~BlockTopology();
//!Retrieves the number of elements for a given topology
- int getNbElements()const { return _nb_elems; }
- int getNbLocalElements() const;
+ mcIdType getNbElements()const { return _nb_elems; }
+ mcIdType getNbLocalElements() const;
const ProcessorGroup* getProcGroup()const { return _proc_group; }
- std::pair<int,int> globalToLocal (const int) const ;
- int localToGlobal (const std::pair<int,int>) const;
- std::vector<std::pair<int,int> > getLocalArrayMinMax() const ;
+ std::pair<int,mcIdType> globalToLocal (const mcIdType) const ;
+ mcIdType localToGlobal (const std::pair<int,mcIdType>) const;
+ std::vector<std::pair<int,mcIdType> > getLocalArrayMinMax() const ;
int getDimension() const { return _dimension; }
- void serialize(int* & serializer, int& size) const ;
- void unserialize(const int* serializer, const CommInterface& comm_interface);
+ void serialize(mcIdType* & serializer, mcIdType& size) const ;
+ void unserialize(const mcIdType* serializer, const CommInterface& comm_interface);
private:
//dimension : 2 or 3
int _dimension;
//proc array
std::vector<int> _nb_procs_per_dim;
//stores the offsets vector
- std::vector<std::vector<int> > _local_array_indices;
+ std::vector<std::vector<mcIdType> > _local_array_indices;
//stores the cycle type (block or cyclic)
std::vector<CYCLE_TYPE> _cycle_type;
//Processor group
const ProcessorGroup* _proc_group;
//nb of elements
- int _nb_elems;
+ mcIdType _nb_elems;
bool _owns_processor_group;
};
}
ADD_DEFINITIONS(${MPI_DEFINITIONS})
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
INCLUDE_DIRECTORIES(
${MPI_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
#define __COMMINTERFACE_HXX__
#include <mpi.h>
+
+#include "ParaIdType.hxx"
+
namespace MEDCoupling
{
//!returns the number of the first MED component on local processor
int firstLocalComponent() const ;
//!returns the number of blocks in the topology
- int nbBlocks()const {return _component_array.size()-1;}
+ int nbBlocks()const {return (int)_component_array.size()-1;}
//!returns the block structure
const std::vector<int>* getBlockIndices() const { return &_component_array; }
const ProcessorGroup* getProcGroup()const { return _proc_group; }
const std::set<int>& target_ids,
const MPI_Comm& world_comm):
_local_field(0),
+ _comm_interface(0),
_owns_field(false),
_owns_groups(true),
- _comm_interface(0),
_union_comm(MPI_COMM_NULL)
{
MEDCoupling::CommInterface comm;
// Create a communicator on these procs
MPI_Group union_group,world_group;
comm.commGroup(world_comm,&world_group);
- comm.groupIncl(world_group,union_ids.size(),union_ranks_world,&union_group);
+ comm.groupIncl(world_group,(int)union_ids.size(),union_ranks_world,&union_group);
comm.commCreate(world_comm,union_group,&_union_comm);
delete[] union_ranks_world;
if (_union_comm==MPI_COMM_NULL)
int* target_ranks_world=new int[target_ids.size()]; // ranks of targets in world_comm
std::copy(target_ids.begin(), target_ids.end(),target_ranks_world);
int* target_ranks_union=new int[target_ids.size()]; // ranks of targets in union_comm
- MPI_Group_translate_ranks(world_group,source_ids.size(),source_ranks_world,union_group,source_ranks_union);
- MPI_Group_translate_ranks(world_group,target_ids.size(),target_ranks_world,union_group,target_ranks_union);
+ MPI_Group_translate_ranks(world_group,(int)source_ids.size(),source_ranks_world,union_group,source_ranks_union);
+ MPI_Group_translate_ranks(world_group,(int)target_ids.size(),target_ranks_world,union_group,target_ranks_union);
std::set<int> source_ids_union;
for (int i=0;i<(int)source_ids.size();i++)
source_ids_union.insert(source_ranks_union[i]);
std::set<int> union_ids; // source and target ids in world_comm
union_ids.insert(src->getProcIDs().begin(),src->getProcIDs().end());
union_ids.insert(tgt->getProcIDs().begin(),tgt->getProcIDs().end());
- if(union_ids.size()!=size)
+ if((int)union_ids.size()!=size)
throw INTERP_KERNEL::Exception("DisjointDEC constructor: source_ids and target_ids do not form a partition of the communicator! Restrain the world communicator passed to MPIProcessorGroup ctor.");
}
void DisjointDEC::renormalizeTargetField(bool isWAbs)
{
if (_source_group->containsMyRank())
- for (int icomp=0; icomp<_local_field->getField()->getArray()->getNumberOfComponents(); icomp++)
+ for (int icomp=0; icomp<(int)_local_field->getField()->getArray()->getNumberOfComponents(); icomp++)
{
double total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs);
double source_norm = total_norm;
}
if (_target_group->containsMyRank())
{
- for (int icomp=0; icomp<_local_field->getField()->getArray()->getNumberOfComponents(); icomp++)
+ for (int icomp=0; icomp<(int)_local_field->getField()->getArray()->getNumberOfComponents(); icomp++)
{
double total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs);
double source_norm=total_norm;
*/
void ElementLocator::exchangeMesh(int idistantrank,
MEDCouplingPointSet*& distant_mesh,
- int*& distant_ids)
+ mcIdType*& distant_ids)
{
int rank = _union_group->translateRank(&_distant_group,idistantrank);
if (find(_distant_proc_ids.begin(), _distant_proc_ids.end(),rank)==_distant_proc_ids.end())
return;
- MCAuto<DataArrayInt> elems;
+ MCAuto<DataArrayIdType> elems;
#ifdef USE_DIRECTED_BB
INTERP_KERNEL::DirectedBoundingBox dbb;
double* distant_bb = _domain_bounding_boxes+rank*dbb.dataSize(_local_cell_mesh_space_dim);
elems=_local_cell_mesh->getCellsInBoundingBox(distant_bb,getBoundingBoxAdjustment());
#endif
- DataArrayInt *distant_ids_send;
+ DataArrayIdType *distant_ids_send;
MEDCouplingPointSet *send_mesh = (MEDCouplingPointSet *)_local_para_field.getField()->buildSubMeshData(elems->begin(),elems->end(),distant_ids_send);
_exchangeMesh(send_mesh, distant_mesh, idistantrank, distant_ids_send, distant_ids);
distant_ids_send->decrRef();
void ElementLocator::_exchangeMesh( MEDCouplingPointSet* local_mesh,
MEDCouplingPointSet*& distant_mesh,
int iproc_distant,
- const DataArrayInt* distant_ids_send,
- int*& distant_ids_recv)
+ const DataArrayIdType* distant_ids_send,
+ mcIdType*& distant_ids_recv)
{
CommInterface comm_interface=_union_group->getCommInterface();
// First stage : exchanging sizes
// ------------------------------
vector<double> tinyInfoLocalD,tinyInfoDistantD(1);//not used for the moment
- vector<int> tinyInfoLocal,tinyInfoDistant;
+ vector<mcIdType> tinyInfoLocal,tinyInfoDistant;
vector<string> tinyInfoLocalS;
//Getting tiny info of local mesh to allow the distant proc to initialize and allocate
//the transmitted mesh.
int iprocdistant_in_union = group->translateRank(&_distant_group,
iproc_distant);
- comm_interface.sendRecv(&tinyInfoLocal[0], tinyInfoLocal.size(), MPI_INT, iprocdistant_in_union, 1112,
- &tinyInfoDistant[0], tinyInfoDistant.size(), MPI_INT,iprocdistant_in_union,1112,
+ comm_interface.sendRecv(&tinyInfoLocal[0], (int)tinyInfoLocal.size(), MPI_ID_TYPE, iprocdistant_in_union, 1112,
+ &tinyInfoDistant[0], (int)tinyInfoDistant.size(), MPI_ID_TYPE,iprocdistant_in_union,1112,
*comm, &status);
- DataArrayInt *v1Local=0;
+ DataArrayIdType *v1Local=0;
DataArrayDouble *v2Local=0;
- DataArrayInt *v1Distant=DataArrayInt::New();
+ DataArrayIdType *v1Distant=DataArrayIdType::New();
DataArrayDouble *v2Distant=DataArrayDouble::New();
//serialization of local mesh to send data to distant proc.
local_mesh->serialize(v1Local,v2Local);
MEDCouplingPointSet *distant_mesh_tmp=MEDCouplingPointSet::BuildInstanceFromMeshType((MEDCouplingMeshType)tinyInfoDistant[0]);
std::vector<std::string> unusedTinyDistantSts;
distant_mesh_tmp->resizeForUnserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
- int nbLocalElems=0;
- int nbDistElem=0;
- int *ptLocal=0;
- int *ptDist=0;
+ mcIdType nbLocalElems=0;
+ mcIdType nbDistElem=0;
+ mcIdType *ptLocal=0;
+ mcIdType *ptDist=0;
if(v1Local)
{
nbLocalElems=v1Local->getNbOfElems();
nbDistElem=v1Distant->getNbOfElems();
ptDist=v1Distant->getPointer();
}
- comm_interface.sendRecv(ptLocal, nbLocalElems, MPI_INT,
+ comm_interface.sendRecv(ptLocal, (int)nbLocalElems, MPI_ID_TYPE,
iprocdistant_in_union, 1111,
- ptDist, nbDistElem, MPI_INT,
+ ptDist, (int)nbDistElem, MPI_ID_TYPE,
iprocdistant_in_union,1111,
*comm, &status);
nbLocalElems=0;
nbDistElem=v2Distant->getNbOfElems();
ptDist2=v2Distant->getPointer();
}
- comm_interface.sendRecv(ptLocal2, nbLocalElems, MPI_DOUBLE,
+ comm_interface.sendRecv(ptLocal2, (int)nbLocalElems, MPI_DOUBLE,
iprocdistant_in_union, 1112,
- ptDist2, nbDistElem, MPI_DOUBLE,
+ ptDist2, (int)nbDistElem, MPI_DOUBLE,
iprocdistant_in_union, 1112,
*comm, &status);
//
//finish unserialization
distant_mesh->unserialization(tinyInfoDistantD,tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
//
- distant_ids_recv=new int[tinyInfoDistant.back()];
- comm_interface.sendRecv(const_cast<void *>(reinterpret_cast<const void *>(distant_ids_send->getConstPointer())),tinyInfoLocal.back(), MPI_INT,
+ distant_ids_recv=new mcIdType[tinyInfoDistant.back()];
+ comm_interface.sendRecv(const_cast<void *>(reinterpret_cast<const void *>(distant_ids_send->getConstPointer())),(int)tinyInfoLocal.back(), MPI_ID_TYPE,
iprocdistant_in_union, 1113,
- distant_ids_recv,tinyInfoDistant.back(), MPI_INT,
+ distant_ids_recv,(int)tinyInfoDistant.back(), MPI_ID_TYPE,
iprocdistant_in_union,1113,
*comm, &status);
if(v1Local)
/*!
* connected with ElementLocator::recvFromWorkingSideL
*/
- void ElementLocator::sendSumToLazySideW(const std::vector< std::vector<int> >& distantLocEltIds, const std::vector< std::vector<double> >& partialSumRelToDistantIds)
+ void ElementLocator::sendSumToLazySideW(const std::vector< std::vector<mcIdType> >& distantLocEltIds, const std::vector< std::vector<double> >& partialSumRelToDistantIds)
{
int procId=0;
CommInterface comm;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- const vector<int>& eltIds=distantLocEltIds[procId];
+ const vector<mcIdType>& eltIds=distantLocEltIds[procId];
const vector<double>& valued=partialSumRelToDistantIds[procId];
- int lgth=eltIds.size();
+ int lgth=(int)eltIds.size();
comm.send(&lgth,1,MPI_INT,*iter,1114,*_comm);
- comm.send(const_cast<void *>(reinterpret_cast<const void *>(&eltIds[0])),lgth,MPI_INT,*iter,1115,*_comm);
+ comm.send(const_cast<void *>(reinterpret_cast<const void *>(&eltIds[0])),lgth,MPI_ID_TYPE,*iter,1115,*_comm);
comm.send(const_cast<void *>(reinterpret_cast<const void *>(&valued[0])),lgth,MPI_DOUBLE,*iter,1116,*_comm);
}
}
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
std::vector<double>& vec=globalSumRelToDistantIds[procId];
- comm.recv(&vec[0],vec.size(),MPI_DOUBLE,*iter,1117,*_comm,&status);
+ comm.recv(&vec[0],(int)vec.size(),MPI_DOUBLE,*iter,1117,*_comm,&status);
}
}
/*!
* connected with ElementLocator::recvLocalIdsFromWorkingSideL
*/
- void ElementLocator::sendLocalIdsToLazyProcsW(const std::vector< std::vector<int> >& distantLocEltIds)
+ void ElementLocator::sendLocalIdsToLazyProcsW(const std::vector< std::vector<mcIdType> >& distantLocEltIds)
{
int procId=0;
CommInterface comm;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- const vector<int>& eltIds=distantLocEltIds[procId];
- int lgth=eltIds.size();
+ const vector<mcIdType>& eltIds=distantLocEltIds[procId];
+ int lgth=(int)eltIds.size();
comm.send(&lgth,1,MPI_INT,*iter,1121,*_comm);
- comm.send(const_cast<void *>(reinterpret_cast<const void *>(&eltIds[0])),lgth,MPI_INT,*iter,1122,*_comm);
+ comm.send(const_cast<void *>(reinterpret_cast<const void *>(&eltIds[0])),lgth,MPI_ID_TYPE,*iter,1122,*_comm);
}
}
/*!
* connected with ElementLocator::sendGlobalIdsToWorkingSideL
*/
- void ElementLocator::recvGlobalIdsFromLazyProcsW(const std::vector< std::vector<int> >& distantLocEltIds, std::vector< std::vector<int> >& globalIds)
+ void ElementLocator::recvGlobalIdsFromLazyProcsW(const std::vector< std::vector<mcIdType> >& distantLocEltIds, std::vector< std::vector<mcIdType> >& globalIds)
{
int procId=0;
CommInterface comm;
globalIds.resize(_distant_proc_ids.size());
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- const std::vector<int>& vec=distantLocEltIds[procId];
- std::vector<int>& global=globalIds[procId];
+ const std::vector<mcIdType>& vec=distantLocEltIds[procId];
+ std::vector<mcIdType>& global=globalIds[procId];
global.resize(vec.size());
- comm.recv(&global[0],vec.size(),MPI_INT,*iter,1123,*_comm,&status);
+ comm.recv(&global[0],(int)vec.size(),MPI_ID_TYPE,*iter,1123,*_comm,&status);
}
}
/*!
* connected with ElementLocator::sendCandidatesGlobalIdsToWorkingSideL
*/
- void ElementLocator::recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector<int> >& globalIds)
+ void ElementLocator::recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector<mcIdType> >& globalIds)
{
int procId=0;
CommInterface comm;
globalIds.resize(_distant_proc_ids.size());
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- std::vector<int>& global=globalIds[procId];
+ std::vector<mcIdType>& global=globalIds[procId];
int lgth;
comm.recv(&lgth,1,MPI_INT,*iter,1132,*_comm,&status);
global.resize(lgth);
- comm.recv(&global[0],lgth,MPI_INT,*iter,1133,*_comm,&status);
+ comm.recv(&global[0],lgth,MPI_ID_TYPE,*iter,1133,*_comm,&status);
}
}
/*!
* connected with ElementLocator::recvSumFromWorkingSideL
*/
- void ElementLocator::sendPartialSumToLazyProcsW(const std::vector<int>& distantGlobIds, const std::vector<double>& sum)
+ void ElementLocator::sendPartialSumToLazyProcsW(const std::vector<mcIdType>& distantGlobIds, const std::vector<double>& sum)
{
int procId=0;
CommInterface comm;
- int lgth=distantGlobIds.size();
+ int lgth=(int)distantGlobIds.size();
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
comm.send(&lgth,1,MPI_INT,*iter,1124,*_comm);
- comm.send(const_cast<void *>(reinterpret_cast<const void *>(&distantGlobIds[0])),lgth,MPI_INT,*iter,1125,*_comm);
+ comm.send(const_cast<void *>(reinterpret_cast<const void *>(&distantGlobIds[0])),lgth,MPI_ID_TYPE,*iter,1125,*_comm);
comm.send(const_cast<void *>(reinterpret_cast<const void *>(&sum[0])),lgth,MPI_DOUBLE,*iter,1126,*_comm);
}
}
/*!
* connected with ElementLocator::recvCandidatesForAddElementsL
*/
- void ElementLocator::sendCandidatesForAddElementsW(const std::vector<int>& distantGlobIds)
+ void ElementLocator::sendCandidatesForAddElementsW(const std::vector<mcIdType>& distantGlobIds)
{
int procId=0;
CommInterface comm;
- int lgth=distantGlobIds.size();
+ int lgth=(int)distantGlobIds.size();
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
comm.send(const_cast<void *>(reinterpret_cast<const void *>(&lgth)),1,MPI_INT,*iter,1128,*_comm);
- comm.send(const_cast<void *>(reinterpret_cast<const void *>(&distantGlobIds[0])),lgth,MPI_INT,*iter,1129,*_comm);
+ comm.send(const_cast<void *>(reinterpret_cast<const void *>(&distantGlobIds[0])),lgth,MPI_ID_TYPE,*iter,1129,*_comm);
}
}
/*!
* connected with ElementLocator::sendAddElementsToWorkingSideL
*/
- void ElementLocator::recvAddElementsFromLazyProcsW(std::vector<std::vector<int> >& elementsToAdd)
+ void ElementLocator::recvAddElementsFromLazyProcsW(std::vector<std::vector<mcIdType> >& elementsToAdd)
{
int procId=0;
CommInterface comm;
MPI_Status status;
- int lgth=_distant_proc_ids.size();
+ int lgth=(int)_distant_proc_ids.size();
elementsToAdd.resize(lgth);
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
int locLgth;
- std::vector<int>& eltToFeed=elementsToAdd[procId];
+ std::vector<mcIdType>& eltToFeed=elementsToAdd[procId];
comm.recv(&locLgth,1,MPI_INT,*iter,1130,*_comm,&status);
eltToFeed.resize(locLgth);
- comm.recv(&eltToFeed[0],locLgth,MPI_INT,*iter,1131,*_comm,&status);
+ comm.recv(&eltToFeed[0],locLgth,MPI_ID_TYPE,*iter,1131,*_comm,&status);
}
}
{
CommInterface comm;
int toSend;
- DataArrayInt *isCumulative=_local_para_field.returnCumulativeGlobalNumbering();
+ DataArrayIdType *isCumulative=_local_para_field.returnCumulativeGlobalNumbering();
if(isCumulative)
{
toSend=CUMULATIVE_POLICY;
{
int lgth;
comm.recv(&lgth,1,MPI_INT,*iter,1114,*_comm,&status);
- vector<int>& ids=_ids_per_working_proc[procId];
+ vector<mcIdType>& ids=_ids_per_working_proc[procId];
ids.resize(lgth);
vector<double> values(lgth);
- comm.recv(&ids[0],lgth,MPI_INT,*iter,1115,*_comm,&status);
+ comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1115,*_comm,&status);
comm.recv(&values[0],lgth,MPI_DOUBLE,*iter,1116,*_comm,&status);
- for(int i=0;i<lgth;i++)
+ for(mcIdType i=0;i<lgth;i++)
_values_added[ids[i]]+=values[i];
}
}
CommInterface comm;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- vector<int>& ids=_ids_per_working_proc[procId];
+ vector<mcIdType>& ids=_ids_per_working_proc[procId];
vector<double> valsToSend(ids.size());
vector<double>::iterator iter3=valsToSend.begin();
- for(vector<int>::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter3++)
+ for(vector<mcIdType>::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter3++)
*iter3=_values_added[*iter2];
- comm.send(&valsToSend[0],ids.size(),MPI_DOUBLE,*iter,1117,*_comm);
+ comm.send(&valsToSend[0],(int)ids.size(),MPI_DOUBLE,*iter,1117,*_comm);
//ids.clear();
}
//_ids_per_working_proc.clear();
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
int lgth;
- vector<int>& ids=_ids_per_working_proc[procId];
+ vector<mcIdType>& ids=_ids_per_working_proc[procId];
comm.recv(&lgth,1,MPI_INT,*iter,1121,*_comm,&status);
ids.resize(lgth);
- comm.recv(&ids[0],lgth,MPI_INT,*iter,1122,*_comm,&status);
+ comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1122,*_comm,&status);
}
}
{
int procId=0;
CommInterface comm;
- DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering();
- const int *globalIdsC=globalIds->getConstPointer();
+ DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering();
+ const mcIdType *globalIdsC=globalIds->getConstPointer();
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- const vector<int>& ids=_ids_per_working_proc[procId];
- vector<int> valsToSend(ids.size());
- vector<int>::iterator iter1=valsToSend.begin();
- for(vector<int>::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++)
+ const vector<mcIdType>& ids=_ids_per_working_proc[procId];
+ vector<mcIdType> valsToSend(ids.size());
+ vector<mcIdType>::iterator iter1=valsToSend.begin();
+ for(vector<mcIdType>::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++)
*iter1=globalIdsC[*iter2];
- comm.send(&valsToSend[0],ids.size(),MPI_INT,*iter,1123,*_comm);
+ comm.send(&valsToSend[0],(int)ids.size(),MPI_ID_TYPE,*iter,1123,*_comm);
}
if(globalIds)
globalIds->decrRef();
*/
void ElementLocator::recvSumFromWorkingSideL()
{
- int procId=0;
- int wProcSize=_distant_proc_ids.size();
+ std::size_t procId=0;
+ std::size_t wProcSize=_distant_proc_ids.size();
CommInterface comm;
_ids_per_working_proc.resize(wProcSize);
_values_per_working_proc.resize(wProcSize);
MPI_Status status;
- std::map<int,double> sums;
+ std::map<mcIdType,double> sums;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
int lgth;
comm.recv(&lgth,1,MPI_INT,*iter,1124,*_comm,&status);
- vector<int>& ids=_ids_per_working_proc[procId];
+ vector<mcIdType>& ids=_ids_per_working_proc[procId];
vector<double>& vals=_values_per_working_proc[procId];
ids.resize(lgth);
vals.resize(lgth);
- comm.recv(&ids[0],lgth,MPI_INT,*iter,1125,*_comm,&status);
+ comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1125,*_comm,&status);
comm.recv(&vals[0],lgth,MPI_DOUBLE,*iter,1126,*_comm,&status);
- vector<int>::const_iterator iter1=ids.begin();
+ vector<mcIdType>::const_iterator iter1=ids.begin();
vector<double>::const_iterator iter2=vals.begin();
for(;iter1!=ids.end();iter1++,iter2++)
sums[*iter1]+=*iter2;
//assign sum to prepare sending to working side
for(procId=0;procId<wProcSize;procId++)
{
- vector<int>& ids=_ids_per_working_proc[procId];
+ vector<mcIdType>& ids=_ids_per_working_proc[procId];
vector<double>& vals=_values_per_working_proc[procId];
- vector<int>::const_iterator iter1=ids.begin();
+ vector<mcIdType>::const_iterator iter1=ids.begin();
vector<double>::iterator iter2=vals.begin();
for(;iter1!=ids.end();iter1++,iter2++)
*iter2=sums[*iter1];
*/
void ElementLocator::recvCandidatesForAddElementsL()
{
- int procId=0;
- int wProcSize=_distant_proc_ids.size();
+ std::size_t procId=0;
+ std::size_t wProcSize=_distant_proc_ids.size();
CommInterface comm;
_ids_per_working_proc3.resize(wProcSize);
MPI_Status status;
std::map<int,double> sums;
- DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering();
- const int *globalIdsC=globalIds->getConstPointer();
- int nbElts=globalIds->getNumberOfTuples();
- std::set<int> globalIdsS(globalIdsC,globalIdsC+nbElts);
+ DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering();
+ const mcIdType *globalIdsC=globalIds->getConstPointer();
+ mcIdType nbElts=globalIds->getNumberOfTuples();
+ std::set<mcIdType> globalIdsS(globalIdsC,globalIdsC+nbElts);
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- const std::vector<int>& ids0=_ids_per_working_proc[procId];
- int lgth0=ids0.size();
- std::set<int> elts0;
- for(int i=0;i<lgth0;i++)
+ const std::vector<mcIdType>& ids0=_ids_per_working_proc[procId];
+ std::size_t lgth0=ids0.size();
+ std::set<mcIdType> elts0;
+ for(std::size_t i=0;i<lgth0;i++)
elts0.insert(globalIdsC[ids0[i]]);
int lgth;
comm.recv(&lgth,1,MPI_INT,*iter,1128,*_comm,&status);
- vector<int> ids(lgth);
- comm.recv(&ids[0],lgth,MPI_INT,*iter,1129,*_comm,&status);
- set<int> ids1(ids.begin(),ids.end());
+ vector<mcIdType> ids(lgth);
+ comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1129,*_comm,&status);
+ set<mcIdType> ids1(ids.begin(),ids.end());
ids.clear();
set<int> tmp5,tmp6;
set_intersection(globalIdsS.begin(),globalIdsS.end(),ids1.begin(),ids1.end(),inserter(tmp5,tmp5.begin()));
set_difference(tmp5.begin(),tmp5.end(),elts0.begin(),elts0.end(),inserter(tmp6,tmp6.begin()));
- std::vector<int>& ids2=_ids_per_working_proc3[procId];
+ std::vector<mcIdType>& ids2=_ids_per_working_proc3[procId];
ids2.resize(tmp6.size());
std::copy(tmp6.begin(),tmp6.end(),ids2.begin());
//global->local
- for(std::vector<int>::iterator iter2=ids2.begin();iter2!=ids2.end();iter2++)
- *iter2=std::find(globalIdsC,globalIdsC+nbElts,*iter2)-globalIdsC;
+ for(std::vector<mcIdType>::iterator iter2=ids2.begin();iter2!=ids2.end();iter2++)
+ *iter2=ToIdType(std::find(globalIdsC,globalIdsC+nbElts,*iter2)-globalIdsC);
}
if(globalIds)
globalIds->decrRef();
CommInterface comm;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- const std::vector<int>& vals=_ids_per_working_proc3[procId];
- int size=vals.size();
+ const std::vector<mcIdType>& vals=_ids_per_working_proc3[procId];
+ int size=(int)vals.size();
comm.send(const_cast<void *>(reinterpret_cast<const void *>(&size)),1,MPI_INT,*iter,1130,*_comm);
- comm.send(const_cast<void *>(reinterpret_cast<const void *>(&vals[0])),size,MPI_INT,*iter,1131,*_comm);
+ comm.send(const_cast<void *>(reinterpret_cast<const void *>(&vals[0])),size,MPI_ID_TYPE,*iter,1131,*_comm);
}
}
{
int procId=0;
CommInterface comm;
- DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering();
- const int *globalIdsC=globalIds->getConstPointer();
- MCAuto<DataArrayInt> candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes();
- for(int *iter1=candidates->getPointer();iter1!=candidates->getPointer()+candidates->getNumberOfTuples();iter1++)
+ DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering();
+ const mcIdType *globalIdsC=globalIds->getConstPointer();
+ MCAuto<DataArrayIdType> candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes();
+ for(mcIdType *iter1=candidates->getPointer();iter1!=candidates->getPointer()+candidates->getNumberOfTuples();iter1++)
(*iter1)=globalIdsC[*iter1];
- std::set<int> candidatesS(candidates->begin(),candidates->end());
+ std::set<mcIdType> candidatesS(candidates->begin(),candidates->end());
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- const vector<int>& ids=_ids_per_working_proc[procId];
- vector<int> valsToSend(ids.size());
- vector<int>::iterator iter1=valsToSend.begin();
- for(vector<int>::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++)
+ const vector<mcIdType>& ids=_ids_per_working_proc[procId];
+ vector<mcIdType> valsToSend(ids.size());
+ vector<mcIdType>::iterator iter1=valsToSend.begin();
+ for(vector<mcIdType>::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++)
*iter1=globalIdsC[*iter2];
- std::set<int> tmp2(valsToSend.begin(),valsToSend.end());
- std::vector<int> tmp3;
- set_intersection(candidatesS.begin(),candidatesS.end(),tmp2.begin(),tmp2.end(),std::back_insert_iterator< std::vector<int> >(tmp3));
- int lgth=tmp3.size();
+ std::set<mcIdType> tmp2(valsToSend.begin(),valsToSend.end());
+ std::vector<mcIdType> tmp3;
+ set_intersection(candidatesS.begin(),candidatesS.end(),tmp2.begin(),tmp2.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp3));
+ int lgth=(int)tmp3.size();
comm.send(&lgth,1,MPI_INT,*iter,1132,*_comm);
- comm.send(&tmp3[0],lgth,MPI_INT,*iter,1133,*_comm);
+ comm.send(&tmp3[0],lgth,MPI_ID_TYPE,*iter,1133,*_comm);
}
if(globalIds)
globalIds->decrRef();
virtual ~ElementLocator();
void exchangeMesh(int idistantrank,
MEDCouplingPointSet*& target_mesh,
- int*& distant_ids);
+ mcIdType*& distant_ids);
void exchangeMethod(const std::string& sourceMeth, int idistantrank, std::string& targetMeth);
const std::vector<int>& getDistantProcIds() const { return _distant_proc_ids; }
const MPI_Comm *getCommunicator() const;
bool isM1DCorr() const { return _is_m1d_corr; }
//Working side methods
void recvPolicyFromLazySideW(std::vector<int>& policy);
- void sendSumToLazySideW(const std::vector< std::vector<int> >& distantLocEltIds, const std::vector< std::vector<double> >& partialSumRelToDistantIds);
+ void sendSumToLazySideW(const std::vector< std::vector<mcIdType> >& distantLocEltIds, const std::vector< std::vector<double> >& partialSumRelToDistantIds);
void recvSumFromLazySideW(std::vector< std::vector<double> >& globalSumRelToDistantIds);
- void sendCandidatesForAddElementsW(const std::vector<int>& distantGlobIds);
- void recvAddElementsFromLazyProcsW(std::vector<std::vector<int> >& elementsToAdd);
+ void sendCandidatesForAddElementsW(const std::vector<mcIdType>& distantGlobIds);
+ void recvAddElementsFromLazyProcsW(std::vector<std::vector<mcIdType> >& elementsToAdd);
//
- void sendLocalIdsToLazyProcsW(const std::vector< std::vector<int> >& distantLocEltIds);
- void recvGlobalIdsFromLazyProcsW(const std::vector< std::vector<int> >& distantLocEltIds, std::vector< std::vector<int> >& globalIds);
- void recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector<int> >& globalIds);
- void sendPartialSumToLazyProcsW(const std::vector<int>& distantGlobIds, const std::vector<double>& sum);
+ void sendLocalIdsToLazyProcsW(const std::vector< std::vector<mcIdType> >& distantLocEltIds);
+ void recvGlobalIdsFromLazyProcsW(const std::vector< std::vector<mcIdType> >& distantLocEltIds, std::vector< std::vector<mcIdType> >& globalIds);
+ void recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector<mcIdType> >& globalIds);
+ void sendPartialSumToLazyProcsW(const std::vector<mcIdType>& distantGlobIds, const std::vector<double>& sum);
//Lazy side methods
int sendPolicyToWorkingSideL();
void recvFromWorkingSideL();
void _computeBoundingBoxes();
bool _intersectsBoundingBox(int irank);
void _exchangeMesh(MEDCouplingPointSet* local_mesh, MEDCouplingPointSet*& distant_mesh,
- int iproc_distant, const DataArrayInt* distant_ids_send,
- int*& distant_ids_recv);
+ int iproc_distant, const DataArrayIdType* distant_ids_send,
+ mcIdType*& distant_ids_recv);
private:
const ParaFIELD& _local_para_field ;
MEDCouplingPointSet* _local_cell_mesh;
const MPI_Comm *_comm;
//Attributes only used by lazy side
std::vector<double> _values_added;
- std::vector< std::vector<int> > _ids_per_working_proc;
- std::vector< std::vector<int> > _ids_per_working_proc3;
+ std::vector< std::vector<mcIdType> > _ids_per_working_proc;
+ std::vector< std::vector<mcIdType> > _ids_per_working_proc3;
std::vector< std::vector<double> > _values_per_working_proc;
public:
static const int CUMULATIVE_POLICY=3;
vector<int>* target_arrays=new vector<int>[target_size];
- int nb_local = _toposource-> getNbLocalElements();
+ mcIdType nb_local = _toposource-> getNbLocalElements();
- int union_size=group->size();
+ std::size_t union_size=group->size();
_sendcounts=new int[union_size];
_senddispls=new int[union_size];
_recvcounts=new int[union_size];
_recvdispls=new int[union_size];
- for (int i=0; i< union_size; i++)
+ for (std::size_t i=0; i< union_size; i++)
{
_sendcounts[i]=0;
_recvcounts[i]=0;
int* counter=new int [target_size];
counter[0]=0;
for (int i=1; i<target_size; i++)
- counter[i]=counter[i-1]+target_arrays[i-1].size();
+ counter[i]=counter[i-1]+(int)target_arrays[i-1].size();
const double* value = _local_field->getField()->getArray()->getPointer();
return;
MPIProcessorGroup* group=new MPIProcessorGroup(_topotarget->getProcGroup()->getCommInterface());
- vector < vector <int> > source_arrays(_sourcegroup->size());
- int nb_local = _topotarget-> getNbLocalElements();
- for (int ielem=0; ielem< nb_local ; ielem++)
+ vector < vector <mcIdType> > source_arrays(_sourcegroup->size());
+ mcIdType nb_local = _topotarget-> getNbLocalElements();
+ for (mcIdType ielem=0; ielem< nb_local ; ielem++)
{
- //pair<int,int> source_local =_distant_elems[ielem];
- pair <int,int> source_local=_explicit_mapping.getDistantNumbering(ielem);
- source_arrays[source_local.first].push_back(source_local.second);
+ //pair<int,mcIdType> source_local =_distant_elems[ielem];
+ pair <int,mcIdType> source_local=_explicit_mapping.getDistantNumbering(ielem);
+ source_arrays[source_local.first].push_back(source_local.second);
}
- int union_size=group->size();
+ std::size_t union_size=group->size();
_recvcounts=new int[union_size];
_recvdispls=new int[union_size];
_sendcounts=new int[union_size];
_senddispls=new int[union_size];
- for (int i=0; i< union_size; i++)
+ for (std::size_t i=0; i< union_size; i++)
{
_sendcounts[i]=0;
_recvcounts[i]=0;
{
//converts the rank in target to the rank in union communicator
int unionrank=group->translateRank(_sourcegroup,iproc);
- _recvcounts[unionrank]=source_arrays[iproc].size()*_topotarget->getNbComponents();
+ _recvcounts[unionrank]=(int)(source_arrays[iproc].size()*_topotarget->getNbComponents());
}
- for (int i=1; i<union_size; i++)
+ for (std::size_t i=1; i<union_size; i++)
_recvdispls[i]=_recvdispls[i-1]+_recvcounts[i-1];
_recvbuffer=new double[nb_local*_topotarget->getNbComponents()];
{
MPI_Status status;
- int* serializer=0;
- int size;
+ mcIdType* serializer=0;
+ mcIdType size;
MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface);
int itarget=iproc;
if (!toposend->getProcGroup()->contains(itarget))
{
- _comm_interface->send(&size,1,MPI_INT, itarget,tag+itarget,*(group->getComm()));
- _comm_interface->send(serializer, size, MPI_INT, itarget, tag+itarget,*(group->getComm()));
+ _comm_interface->send(&size,1,MPI_ID_TYPE, itarget,tag+itarget,*(group->getComm()));
+ _comm_interface->send(serializer, (int)size, MPI_ID_TYPE, itarget, tag+itarget,*(group->getComm()));
}
}
}
int isource = iproc;
if (!toporecv->getProcGroup()->contains(isource))
{
- int nbelem;
- _comm_interface->recv(&nbelem, 1, MPI_INT, isource, tag+myworldrank, *(group->getComm()), &status);
- int* buffer = new int[nbelem];
- _comm_interface->recv(buffer, nbelem, MPI_INT, isource,tag+myworldrank, *(group->getComm()), &status);
+ mcIdType nbelem;
+ _comm_interface->recv(&nbelem, 1, MPI_ID_TYPE, isource, tag+myworldrank, *(group->getComm()), &status);
+ mcIdType* buffer = new mcIdType[nbelem];
+ _comm_interface->recv(buffer, (int)nbelem, MPI_ID_TYPE, isource,tag+myworldrank, *(group->getComm()), &status);
ExplicitTopology* topotemp=new ExplicitTopology();
topotemp->unserialize(buffer, *_comm_interface);
delete[] buffer;
- for (int ielem=0; ielem<toporecv->getNbLocalElements(); ielem++)
+ for (mcIdType ielem=0; ielem<toporecv->getNbLocalElements(); ielem++)
{
- int global = toporecv->localToGlobal(ielem);
- int sendlocal=topotemp->globalToLocal(global);
+ mcIdType global = toporecv->localToGlobal(ielem);
+ mcIdType sendlocal=topotemp->globalToLocal(global);
if (sendlocal!=-1)
{
size2[iproc]++;
}
_comm_interface->allToAll(nb_transfer_union, 1, MPI_INT, dummy_recv, 1, MPI_INT, MPI_COMM_WORLD);
- int* sendbuffer= _explicit_mapping.serialize(_topotarget->getProcGroup()->myRank());
+ mcIdType* sendbuffer= _explicit_mapping.serialize(_topotarget->getProcGroup()->myRank());
int* sendcounts= new int [world_size];
int* senddispls = new int [world_size];
recvcounts[i]=0;
recvdispls[i]=0;
}
- _comm_interface->allToAllV(sendbuffer, sendcounts, senddispls, MPI_INT, dummyrecv, recvcounts, senddispls, MPI_INT, MPI_COMM_WORLD);
+ _comm_interface->allToAllV(sendbuffer, sendcounts, senddispls, MPI_ID_TYPE, dummyrecv, recvcounts, senddispls, MPI_ID_TYPE, MPI_COMM_WORLD);
}
//receiving in the source subdomains the mapping sent by targets
int* targetranks = new int[ nbtarget];
for (int i=0; i<nbtarget; i++)
targetranks[i]=group->translateRank(_targetgroup,i);
- int* mappingbuffer= new int [total_size*2];
+ mcIdType* mappingbuffer= new mcIdType [total_size*2];
int* sendcounts= new int [world_size];
int* senddispls = new int [world_size];
int* recvcounts=new int[world_size];
sendcounts[i]=0;
senddispls[i]=0;
}
- _comm_interface->allToAllV(dummysend, sendcounts, senddispls, MPI_INT, mappingbuffer, recvcounts, recvdispls, MPI_INT, MPI_COMM_WORLD);
+ _comm_interface->allToAllV(dummysend, sendcounts, senddispls, MPI_ID_TYPE, mappingbuffer, recvcounts, recvdispls, MPI_ID_TYPE, MPI_COMM_WORLD);
_explicit_mapping.unserialize(world_size,nb_transfer_union,nbtarget, targetranks, mappingbuffer);
}
}
_comm_interface->allToAllV(_sendbuffer, _sendcounts, _senddispls, MPI_DOUBLE,
_recvbuffer, _recvcounts, _recvdispls, MPI_DOUBLE,MPI_COMM_WORLD);
cout<<"end AllToAll"<<endl;
- int nb_local = _topotarget->getNbLocalElements();
+ mcIdType nb_local = _topotarget->getNbLocalElements();
double* value=new double[nb_local*_topotarget->getNbComponents()];
vector<int> counters(_sourcegroup->size());
if (_comm_buffer!=0) delete[] _comm_buffer;
}
- void ExplicitMapping::pushBackElem(std::pair<int,int> idistant)
+ void ExplicitMapping::pushBackElem(std::pair<int,mcIdType> idistant)
{
_mapping.push_back(idistant);
}
- void ExplicitMapping::setDistantElem(int ilocal, std::pair<int,int> idistant)
+ void ExplicitMapping::setDistantElem(mcIdType ilocal, std::pair<int,mcIdType> idistant)
{
_mapping[ilocal]=idistant;
}
{
if (_distant_domains.empty())
{
- for (std::vector <std::pair<int,int> >::const_iterator iter= _mapping.begin();
+ for (std::vector <std::pair<int,mcIdType> >::const_iterator iter= _mapping.begin();
iter!=_mapping.end();
iter++)
_distant_domains.insert(iter->first);
}
- return _distant_domains.size();
+ return (int)_distant_domains.size();
}
- std::pair <int,int> ExplicitMapping::getDistantNumbering(int ielem)const
+ std::pair <int,mcIdType> ExplicitMapping::getDistantNumbering(mcIdType ielem)const
{
return _mapping[ielem];
}
return _numbers[i];
}
- int* ExplicitMapping::serialize(int idproc)
+ mcIdType* ExplicitMapping::serialize(int idproc)
{
- _comm_buffer=new int[_mapping.size()*2];
- std::vector<int> offsets(_distant_domains.size());
+ _comm_buffer=new mcIdType[_mapping.size()*2];
+ std::vector<mcIdType> offsets(_distant_domains.size());
offsets[0]=0;
for (int i=1; i<(int)_distant_domains.size();i++)
offsets[i]=offsets[i-1]+_numbers[i-1];
for (int i=0; i<(int)_mapping.size(); i++)
{
- int offset= offsets[_mapping[i].first];
+ mcIdType offset= offsets[_mapping[i].first];
_comm_buffer[offset*2]=idproc;
_comm_buffer[offset*2+1]=_mapping[i].second;
offsets[_mapping[i].first]++;
return _comm_buffer;
}
- void ExplicitMapping::unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, int* commbuffer)
+ void ExplicitMapping::unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, mcIdType* commbuffer)
{
int total_size=0;
for (int i=0; i< nbprocs; i++)
{
_mapping[indmap].first=i;
_mapping[indmap].second=commbuffer[indmap*2+1];
- _buffer_index[indmap]=commbuffer[indmap*2+1];
+ _buffer_index[indmap]=(int)commbuffer[indmap*2+1];
indmap++;
}
_numbers=new int [nbtarget];
#ifndef __EXPLICITMAPPING_HXX__
#define __EXPLICITMAPPING_HXX__
+#include "MCIdType.hxx"
+
#include <vector>
#include <map>
#include <set>
ExplicitMapping();
~ExplicitMapping();
- void pushBackElem(std::pair<int,int> idistant);
- void setDistantElem(int ilocal, std::pair<int,int> idistant);
+ void pushBackElem(std::pair<int,mcIdType> idistant);
+ void setDistantElem(mcIdType ilocal, std::pair<int,mcIdType> idistant);
int nbDistantDomains();
- std::pair <int,int> getDistantNumbering(int ielem) const;
+ std::pair <int,mcIdType> getDistantNumbering(mcIdType ielem) const;
int getDistantDomain(int i);
int getNbDistantElems(int i);
- int* serialize(int idproc);
- void unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, int* commbuffer);
+ mcIdType* serialize(int idproc);
+ void unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, mcIdType* commbuffer);
int* getBufferIndex() const { return _buffer_index; }
int* getCounts() const { return _send_counts; }
private:
- std::vector <std::pair<int,int> > _mapping;
+ std::vector <std::pair<int,mcIdType> > _mapping;
std::set<int> _distant_domains;
int* _numbers;
int* _domains;
- int* _comm_buffer;
+ mcIdType* _comm_buffer;
int* _buffer_index;
int* _send_counts;
_nb_components(1)
{
_nb_elems=paramesh.getCellMesh()->getNumberOfCells();
- const int* global=paramesh.getGlobalNumberingCell();
- _loc2glob=new int[_nb_elems];
+ const mcIdType* global=paramesh.getGlobalNumberingCell();
+ _loc2glob=new mcIdType[_nb_elems];
- for (int i=0; i<_nb_elems; i++)
+ for (mcIdType i=0; i<_nb_elems; i++)
{
_loc2glob[i]=global[i];
_glob2loc[global[i]]=i;
_proc_group = topo._proc_group;
_nb_elems = topo._nb_elems;
_nb_components = nb_components;
- _loc2glob=new int[_nb_elems];
- for (int i=0; i<_nb_elems; i++)
+ _loc2glob=new mcIdType[_nb_elems];
+ for (mcIdType i=0; i<_nb_elems; i++)
{
_loc2glob[i]=topo._loc2glob[i];
}
/*! Serializes the data contained in the Explicit Topology
* for communication purposes*/
-void ExplicitTopology::serialize(int* & serializer, int& size) const
+void ExplicitTopology::serialize(mcIdType* & serializer, mcIdType& size) const
{
- vector <int> buffer;
+ vector <mcIdType> buffer;
buffer.push_back(_nb_elems);
- for (int i=0; i<_nb_elems; i++)
+ for (mcIdType i=0; i<_nb_elems; i++)
{
buffer.push_back(_loc2glob[i]);
}
- serializer=new int[buffer.size()];
- size= buffer.size();
+ serializer=new mcIdType[buffer.size()];
+ size=ToIdType(buffer.size());
copy(buffer.begin(), buffer.end(), serializer);
}
* after communication. Uses the same structure as the one used for serialize()
*
* */
-void ExplicitTopology::unserialize(const int* serializer,const CommInterface& comm_interface)
+void ExplicitTopology::unserialize(const mcIdType* serializer,const CommInterface& comm_interface)
{
- const int* ptr_serializer=serializer;
+ const mcIdType* ptr_serializer=serializer;
cout << "unserialize..."<<endl;
_nb_elems=*ptr_serializer++;
cout << "nbelems "<<_nb_elems<<endl;
- _loc2glob=new int[_nb_elems];
- for (int i=0; i<_nb_elems; i++)
+ _loc2glob=new mcIdType[_nb_elems];
+ for (mcIdType i=0; i<_nb_elems; i++)
{
_loc2glob[i]=*ptr_serializer;
_glob2loc[*ptr_serializer]=i;
ExplicitTopology(const ParaMESH &mesh);
virtual ~ExplicitTopology();
- inline int getNbElements()const;
- inline int getNbLocalElements() const;
+ inline mcIdType getNbElements()const;
+ inline mcIdType getNbLocalElements() const;
const ProcessorGroup* getProcGroup()const { return _proc_group; }
- int localToGlobal (const std::pair<int,int> local) const { return localToGlobal(local.second); }
- inline int localToGlobal(int) const;
- inline int globalToLocal(int) const;
- void serialize(int* & serializer, int& size) const ;
- void unserialize(const int* serializer, const CommInterface& comm_interface);
+ mcIdType localToGlobal (const std::pair<int,mcIdType> local) const { return localToGlobal(local.second); }
+ inline mcIdType localToGlobal(mcIdType) const;
+ inline mcIdType globalToLocal(mcIdType) const;
+ void serialize(mcIdType* & serializer, mcIdType& size) const ;
+ void unserialize(const mcIdType* serializer, const CommInterface& comm_interface);
int getNbComponents() const { return _nb_components; }
private:
//Processor group
const ProcessorGroup* _proc_group;
//nb of elements
- int _nb_elems;
+ mcIdType _nb_elems;
//nb of components
int _nb_components;
//mapping local to global
- int* _loc2glob;
+ mcIdType* _loc2glob;
//mapping global to local
- INTERP_KERNEL::HashMap<int,int> _glob2loc;
+ INTERP_KERNEL::HashMap<mcIdType,mcIdType> _glob2loc;
};
//!converts a pair <subdomainid,local> to a global number
- inline int ExplicitTopology::globalToLocal(const int global) const
+ inline mcIdType ExplicitTopology::globalToLocal(const mcIdType global) const
{
- return (_glob2loc.find(global))->second;;
+ return (_glob2loc.find(global))->second;
}
//!converts local number to a global number
- int ExplicitTopology::localToGlobal(int local) const
+ mcIdType ExplicitTopology::localToGlobal(mcIdType local) const
{
return _loc2glob[local];
}
//!Retrieves the number of elements for a given topology
- inline int ExplicitTopology::getNbElements() const
+ inline mcIdType ExplicitTopology::getNbElements() const
{
return _nb_elems;
}
//Retrieves the local number of elements
- inline int ExplicitTopology::getNbLocalElements()const
+ inline mcIdType ExplicitTopology::getNbLocalElements()const
{
- return _glob2loc.size();
+ return ToIdType(_glob2loc.size());
}
}
//transferring option from InterpKernelDEC to ElementLocator
locator.copyOptions(*this);
MEDCouplingPointSet* distant_mesh=0;
- int* distant_ids=0;
+ mcIdType* distant_ids=0;
std::string distantMeth;
for (int i=0; i<_target_group->size(); i++)
{
//transferring option from InterpKernelDEC to ElementLocator
locator.copyOptions(*this);
MEDCouplingPointSet* distant_mesh=0;
- int* distant_ids=0;
+ mcIdType* distant_ids=0;
for (int i=0; i<_source_group->size(); i++)
{
// int idistant_proc = (i+_target_group->myRank())%_source_group->size();
_source_group(source_group),
_target_group(target_group)
{
- int nbelems = source_field->getField()->getNumberOfTuples();
+ mcIdType nbelems = source_field->getField()->getNumberOfTuples();
_row_offsets.resize(nbelems+1);
_coeffs.resize(nbelems);
_target_volume.resize(nbelems);
*/
void InterpolationMatrix::addContribution ( MEDCouplingPointSet& distant_support,
int iproc_distant,
- const int* distant_elems,
+ const mcIdType* distant_elems,
const std::string& srcMeth,
const std::string& targetMeth)
{
std::string interpMethod(targetMeth);
interpMethod+=srcMeth;
//creating the interpolator structure
- vector<map<int,double> > surfaces;
+ vector<map<mcIdType,double> > surfaces;
//computation of the intersection volumes between source and target elements
MEDCouplingUMesh *distant_supportC=dynamic_cast<MEDCouplingUMesh *>(&distant_support);
MEDCouplingUMesh *source_supportC=dynamic_cast<MEDCouplingUMesh *>(_source_support);
target_triangle_surf->decrRef();
}
- void InterpolationMatrix::fillDSFromVM(int iproc_distant, const int* distant_elems, const std::vector< std::map<int,double> >& values, MEDCouplingFieldDouble *surf)
+ void InterpolationMatrix::fillDSFromVM(int iproc_distant, const mcIdType* distant_elems, const std::vector< std::map<mcIdType,double> >& values, MEDCouplingFieldDouble *surf)
{
//loop over the elements to build the interpolation
//matrix structures
- int source_size=values.size();
- for (int ielem=0; ielem < source_size; ielem++)
+ std::size_t source_size=values.size();
+ for (std::size_t ielem=0; ielem < source_size; ielem++)
{
- _row_offsets[ielem+1] += values[ielem].size();
- for(map<int,double>::const_iterator iter=values[ielem].begin();iter!=values[ielem].end();iter++)
+ _row_offsets[ielem+1] += ToIdType(values[ielem].size());
+ for(map<mcIdType,double>::const_iterator iter=values[ielem].begin();iter!=values[ielem].end();iter++)
{
- int localId;
+ mcIdType localId;
if(distant_elems)
localId=distant_elems[iter->first];
else
localId=iter->first;
//locating the (iproc, itriangle) pair in the list of columns
- map<pair<int,int>,int >::iterator iter2 = _col_offsets.find(make_pair(iproc_distant,localId));
- int col_id;
+ map<pair<int,mcIdType>,mcIdType >::iterator iter2 = _col_offsets.find(make_pair(iproc_distant,localId));
+ mcIdType col_id;
if (iter2 == _col_offsets.end())
{
//(iproc, itriangle) is not registered in the list
//of distant elements
- col_id =_col_offsets.size();
+ col_id =ToIdType(_col_offsets.size());
_col_offsets.insert(make_pair(make_pair(iproc_distant,localId),col_id));
_mapping.addElementFromSource(iproc_distant,localId);
}
}
}
- void InterpolationMatrix::serializeMe(std::vector< std::vector< std::map<int,double> > >& data1, std::vector<int>& data2) const
+ void InterpolationMatrix::serializeMe(std::vector< std::vector< std::map<mcIdType,double> > >& data1, std::vector<int>& data2) const
{
data1.clear();
data2.clear();
- const std::vector<std::pair<int,int> >& sendingIds=_mapping.getSendingIds();
+ const std::vector<std::pair<int,mcIdType> >& sendingIds=_mapping.getSendingIds();
std::set<int> procsS;
- for(std::vector<std::pair<int,int> >::const_iterator iter1=sendingIds.begin();iter1!=sendingIds.end();iter1++)
+ for(std::vector<std::pair<int,mcIdType> >::const_iterator iter1=sendingIds.begin();iter1!=sendingIds.end();iter1++)
procsS.insert((*iter1).first);
data1.resize(procsS.size());
data2.resize(procsS.size());
int id=0;
for(std::set<int>::const_iterator iter2=procsS.begin();iter2!=procsS.end();iter2++,id++)
fastProcAcc[*iter2]=id;
- int nbOfSrcElt=_coeffs.size();
- for(std::vector< std::vector< std::map<int,double> > >::iterator iter3=data1.begin();iter3!=data1.end();iter3++)
+ mcIdType nbOfSrcElt=ToIdType(_coeffs.size());
+ for(std::vector< std::vector< std::map<mcIdType,double> > >::iterator iter3=data1.begin();iter3!=data1.end();iter3++)
(*iter3).resize(nbOfSrcElt);
id=0;
for(std::vector< std::vector< std::pair<int,double> > >::const_iterator iter4=_coeffs.begin();iter4!=_coeffs.end();iter4++,id++)
{
for(std::vector< std::pair<int,double> >::const_iterator iter5=(*iter4).begin();iter5!=(*iter4).end();iter5++)
{
- const std::pair<int,int>& elt=sendingIds[(*iter5).first];
+ const std::pair<int,mcIdType>& elt=sendingIds[(*iter5).first];
data1[fastProcAcc[elt.first]][id][elt.second]=(*iter5).second;
}
}
void InterpolationMatrix::initialize()
{
- int lgth=_coeffs.size();
+ mcIdType lgth=ToIdType(_coeffs.size());
_row_offsets.clear(); _row_offsets.resize(lgth+1);
_coeffs.clear(); _coeffs.resize(lgth);
_target_volume.clear(); _target_volume.resize(lgth);
void InterpolationMatrix::computeGlobalRowSum(ElementLocator& elementLocator, std::vector<std::vector<double> >& denoStrorage, std::vector<std::vector<double> >& denoStrorageInv)
{
//stores id in distant procs sorted by lazy procs connected with
- vector< vector<int> > rowsPartialSumI;
+ vector< vector<mcIdType> > rowsPartialSumI;
//stores for each lazy procs connected with, if global info is available and if it's the case the policy
vector<int> policyPartial;
//stores the corresponding values.
//updateWithNewAdditionnalElements(addingElements);
//stores for each lazy procs connected with, the ids in global mode if it exists (regarding policyPartial). This array has exactly the size of rowsPartialSumI,
//if policyPartial has CUMALATIVE_POLICY in each.
- vector< vector<int> > globalIdsPartial;
+ vector< vector<mcIdType> > globalIdsPartial;
computeLocalRowSum(elementLocator.getDistantProcIds(),rowsPartialSumI,rowsPartialSumD);
elementLocator.sendLocalIdsToLazyProcsW(rowsPartialSumI);
elementLocator.recvCandidatesGlobalIdsFromLazyProcsW(globalIdsPartial);
- std::vector< std::vector<int> > addingElements;
+ std::vector< std::vector<mcIdType> > addingElements;
findAdditionnalElements(elementLocator,addingElements,rowsPartialSumI,globalIdsPartial);
addGhostElements(elementLocator.getDistantProcIds(),addingElements);
rowsPartialSumI.clear();
* It contains the element ids (2nd dimension) of the corresponding lazy proc.
* @param resPerProcD out parameter with the same format than 'resPerProcI'. It contains corresponding sum values.
*/
- void InterpolationMatrix::computeLocalRowSum(const std::vector<int>& distantProcs, std::vector<std::vector<int> >& resPerProcI,
+ void InterpolationMatrix::computeLocalRowSum(const std::vector<int>& distantProcs, std::vector<std::vector<mcIdType> >& resPerProcI,
std::vector<std::vector<double> >& resPerProcD) const
{
resPerProcI.resize(distantProcs.size());
for(vector<pair<int,double> >::const_iterator iter3=(*iter).begin();iter3!=(*iter).end();iter3++)
res[(*iter3).first]+=(*iter3).second;
set<int> procsSet;
- int id=-1;
- const vector<std::pair<int,int> >& mapping=_mapping.getSendingIds();
- for(vector<std::pair<int,int> >::const_iterator iter2=mapping.begin();iter2!=mapping.end();iter2++)
+ std::size_t id=-1;
+ const vector<std::pair<int,mcIdType> >& mapping=_mapping.getSendingIds();
+ for(vector<std::pair<int,mcIdType> >::const_iterator iter2=mapping.begin();iter2!=mapping.end();iter2++)
{
std::pair<set<int>::iterator,bool> isIns=procsSet.insert((*iter2).first);
if(isIns.second)
* This method is only usable when CUMULATIVE_POLICY detected. This method finds elements ids (typically nodes) lazy side that
* are not present in columns of 'this' and that should regarding cumulative merge of elements regarding their global ids.
*/
- void InterpolationMatrix::findAdditionnalElements(ElementLocator& elementLocator, std::vector<std::vector<int> >& elementsToAdd,
- const std::vector<std::vector<int> >& resPerProcI, const std::vector<std::vector<int> >& globalIdsPartial)
+ void InterpolationMatrix::findAdditionnalElements(ElementLocator& elementLocator, std::vector<std::vector<mcIdType> >& elementsToAdd,
+ const std::vector<std::vector<mcIdType> >& resPerProcI, const std::vector<std::vector<mcIdType> >& globalIdsPartial)
{
- std::set<int> globalIds;
- int nbLazyProcs=globalIdsPartial.size();
- for(int i=0;i<nbLazyProcs;i++)
+ std::set<mcIdType> globalIds;
+ std::size_t nbLazyProcs=globalIdsPartial.size();
+ for(std::size_t i=0;i<nbLazyProcs;i++)
globalIds.insert(globalIdsPartial[i].begin(),globalIdsPartial[i].end());
- std::vector<int> tmp(globalIds.size());
+ std::vector<mcIdType> tmp(globalIds.size());
std::copy(globalIds.begin(),globalIds.end(),tmp.begin());
globalIds.clear();
elementLocator.sendCandidatesForAddElementsW(tmp);
elementLocator.recvAddElementsFromLazyProcsW(elementsToAdd);
}
- void InterpolationMatrix::addGhostElements(const std::vector<int>& distantProcs, const std::vector<std::vector<int> >& elementsToAdd)
+ void InterpolationMatrix::addGhostElements(const std::vector<int>& distantProcs, const std::vector<std::vector<mcIdType> >& elementsToAdd)
{
- std::vector< std::vector< std::map<int,double> > > data1;
+ std::vector< std::vector< std::map<mcIdType,double> > > data1;
std::vector<int> data2;
serializeMe(data1,data2);
initialize();
- int nbOfDistProcs=distantProcs.size();
- for(int i=0;i<nbOfDistProcs;i++)
+ std::size_t nbOfDistProcs=distantProcs.size();
+ for(std::size_t i=0;i<nbOfDistProcs;i++)
{
int procId=distantProcs[i];
- const std::vector<int>& eltsForThisProc=elementsToAdd[i];
+ const std::vector<mcIdType>& eltsForThisProc=elementsToAdd[i];
if(!eltsForThisProc.empty())
{
std::vector<int>::iterator iter1=std::find(data2.begin(),data2.end(),procId);
- std::map<int,double> *toFeed=0;
+ std::map<mcIdType,double> *toFeed=0;
if(iter1!=data2.end())
{//to test
- int rank=iter1-data2.begin();
+ std::size_t rank=iter1-data2.begin();
toFeed=&(data1[rank].back());
}
else
{
iter1=std::lower_bound(data2.begin(),data2.end(),procId);
- int rank=iter1-data2.begin();
+ std::size_t rank=iter1-data2.begin();
data2.insert(iter1,procId);
- std::vector< std::map<int,double> > tmp(data1.front().size());
+ std::vector< std::map<mcIdType,double> > tmp(data1.front().size());
data1.insert(data1.begin()+rank,tmp);
toFeed=&(data1[rank].back());
}
- for(std::vector<int>::const_iterator iter2=eltsForThisProc.begin();iter2!=eltsForThisProc.end();iter2++)
+ for(std::vector<mcIdType>::const_iterator iter2=eltsForThisProc.begin();iter2!=eltsForThisProc.end();iter2++)
(*toFeed)[*iter2]=0.;
}
}
//
nbOfDistProcs=data2.size();
- for(int j=0;j<nbOfDistProcs;j++)
+ for(std::size_t j=0;j<nbOfDistProcs;j++)
fillDSFromVM(data2[j],0,data1[j],0);
}
* @param globalIdsLazySideInteraction : out parameter, constituted from all global ids of lazy procs connected with.
* @para sumCorresponding : out parameter, relative to 'globalIdsLazySideInteraction'
*/
- void InterpolationMatrix::mergeRowSum(const std::vector< std::vector<double> >& rowsPartialSumD, const std::vector< std::vector<int> >& globalIdsPartial,
- std::vector<int>& globalIdsLazySideInteraction, std::vector<double>& sumCorresponding)
+ void InterpolationMatrix::mergeRowSum(const std::vector< std::vector<double> >& rowsPartialSumD, const std::vector< std::vector<mcIdType> >& globalIdsPartial,
+ std::vector<mcIdType>& globalIdsLazySideInteraction, std::vector<double>& sumCorresponding)
{
- std::map<int,double> sumToReturn;
- int nbLazyProcs=rowsPartialSumD.size();
- for(int i=0;i<nbLazyProcs;i++)
+ std::map<mcIdType,double> sumToReturn;
+ std::size_t nbLazyProcs=rowsPartialSumD.size();
+ for(std::size_t i=0;i<nbLazyProcs;i++)
{
const std::vector<double>& rowSumOfP=rowsPartialSumD[i];
- const std::vector<int>& globalIdsOfP=globalIdsPartial[i];
+ const std::vector<mcIdType>& globalIdsOfP=globalIdsPartial[i];
std::vector<double>::const_iterator iter1=rowSumOfP.begin();
- std::vector<int>::const_iterator iter2=globalIdsOfP.begin();
+ std::vector<mcIdType>::const_iterator iter2=globalIdsOfP.begin();
for(;iter1!=rowSumOfP.end();iter1++,iter2++)
sumToReturn[*iter2]+=*iter1;
}
//
- int lgth=sumToReturn.size();
+ std::size_t lgth=sumToReturn.size();
globalIdsLazySideInteraction.resize(lgth);
sumCorresponding.resize(lgth);
- std::vector<int>::iterator iter3=globalIdsLazySideInteraction.begin();
+ std::vector<mcIdType>::iterator iter3=globalIdsLazySideInteraction.begin();
std::vector<double>::iterator iter4=sumCorresponding.begin();
- for(std::map<int,double>::const_iterator iter5=sumToReturn.begin();iter5!=sumToReturn.end();iter5++,iter3++,iter4++)
+ for(std::map<mcIdType,double>::const_iterator iter5=sumToReturn.begin();iter5!=sumToReturn.end();iter5++,iter3++,iter4++)
{
*iter3=(*iter5).first;
*iter4=(*iter5).second;
* @param globalIdsLazySideInteraction : in parameter that represents ALL the global ids of every lazy procs in interaction
* @param sumCorresponding : in parameter with same size as 'globalIdsLazySideInteraction' that stores the corresponding sum of 'globalIdsLazySideInteraction'
*/
- void InterpolationMatrix::mergeRowSum2(const std::vector< std::vector<int> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD,
- const std::vector<int>& globalIdsLazySideInteraction, const std::vector<double>& sumCorresponding)
+ void InterpolationMatrix::mergeRowSum2(const std::vector< std::vector<mcIdType> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD,
+ const std::vector<mcIdType>& globalIdsLazySideInteraction, const std::vector<double>& sumCorresponding)
{
- std::map<int,double> acc;
- std::vector<int>::const_iterator iter1=globalIdsLazySideInteraction.begin();
+ std::map<mcIdType,double> acc;
+ std::vector<mcIdType>::const_iterator iter1=globalIdsLazySideInteraction.begin();
std::vector<double>::const_iterator iter2=sumCorresponding.begin();
for(;iter1!=globalIdsLazySideInteraction.end();iter1++,iter2++)
acc[*iter1]=*iter2;
//
- int nbLazyProcs=globalIdsPartial.size();
- for(int i=0;i<nbLazyProcs;i++)
+ std::size_t nbLazyProcs=globalIdsPartial.size();
+ for(std::size_t i=0;i<nbLazyProcs;i++)
{
- const std::vector<int>& tmp1=globalIdsPartial[i];
+ const std::vector<mcIdType>& tmp1=globalIdsPartial[i];
std::vector<double>& tmp2=rowsPartialSumD[i];
- std::vector<int>::const_iterator iter3=tmp1.begin();
+ std::vector<mcIdType>::const_iterator iter3=tmp1.begin();
std::vector<double>::iterator iter4=tmp2.begin();
for(;iter3!=tmp1.end();iter3++,iter4++)
*iter4=acc[*iter3];
}
}
- void InterpolationMatrix::mergeRowSum3(const std::vector< std::vector<int> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD)
+ void InterpolationMatrix::mergeRowSum3(const std::vector< std::vector<mcIdType> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD)
{
- std::map<int,double> sum;
- std::vector< std::vector<int> >::const_iterator iter1=globalIdsPartial.begin();
+ std::map<mcIdType,double> sum;
+ std::vector< std::vector<mcIdType> >::const_iterator iter1=globalIdsPartial.begin();
std::vector< std::vector<double> >::iterator iter2=rowsPartialSumD.begin();
for(;iter1!=globalIdsPartial.end();iter1++,iter2++)
{
- std::vector<int>::const_iterator iter3=(*iter1).begin();
+ std::vector<mcIdType>::const_iterator iter3=(*iter1).begin();
std::vector<double>::const_iterator iter4=(*iter2).begin();
for(;iter3!=(*iter1).end();iter3++,iter4++)
sum[*iter3]+=*iter4;
iter2=rowsPartialSumD.begin();
for(iter1=globalIdsPartial.begin();iter1!=globalIdsPartial.end();iter1++,iter2++)
{
- std::vector<int>::const_iterator iter3=(*iter1).begin();
+ std::vector<mcIdType>::const_iterator iter3=(*iter1).begin();
std::vector<double>::iterator iter4=(*iter2).begin();
for(;iter3!=(*iter1).end();iter3++,iter4++)
*iter4=sum[*iter3];
* @param rowsPartialSumI input parameter : local ids of distant lazy procs elements in interaction with
* @param globalIdsPartial input parameter : global ids of distant lazy procs elements in interaction with
*/
- void InterpolationMatrix::mergeCoeffs(const std::vector<int>& procsInInteraction, const std::vector< std::vector<int> >& rowsPartialSumI,
- const std::vector<std::vector<int> >& globalIdsPartial, std::vector<std::vector<double> >& denoStrorageInv)
+ void InterpolationMatrix::mergeCoeffs(const std::vector<int>& procsInInteraction, const std::vector< std::vector<mcIdType> >& rowsPartialSumI,
+ const std::vector<std::vector<mcIdType> >& globalIdsPartial, std::vector<std::vector<double> >& denoStrorageInv)
{
//preparing fast access structures
std::map<int,int> procT;
int localProcId=0;
for(std::vector<int>::const_iterator iter1=procsInInteraction.begin();iter1!=procsInInteraction.end();iter1++,localProcId++)
procT[*iter1]=localProcId;
- int size=procsInInteraction.size();
- std::vector<std::map<int,int> > localToGlobal(size);
- for(int i=0;i<size;i++)
- {
- std::map<int,int>& myLocalToGlobal=localToGlobal[i];
- const std::vector<int>& locals=rowsPartialSumI[i];
- const std::vector<int>& globals=globalIdsPartial[i];
- std::vector<int>::const_iterator iter3=locals.begin();
- std::vector<int>::const_iterator iter4=globals.begin();
+ std::size_t size=procsInInteraction.size();
+ std::vector<std::map<mcIdType,mcIdType> > localToGlobal(size);
+ for(std::size_t i=0;i<size;i++)
+ {
+ std::map<mcIdType,mcIdType>& myLocalToGlobal=localToGlobal[i];
+ const std::vector<mcIdType>& locals=rowsPartialSumI[i];
+ const std::vector<mcIdType>& globals=globalIdsPartial[i];
+ std::vector<mcIdType>::const_iterator iter3=locals.begin();
+ std::vector<mcIdType>::const_iterator iter4=globals.begin();
for(;iter3!=locals.end();iter3++,iter4++)
myLocalToGlobal[*iter3]=*iter4;
}
//
- const vector<std::pair<int,int> >& mapping=_mapping.getSendingIds();
- std::map<int,double> globalIdVal;
+ const vector<std::pair<int,mcIdType> >& mapping=_mapping.getSendingIds();
+ std::map<mcIdType,double> globalIdVal;
//accumulate for same global id on lazy part.
for(vector<vector<pair<int,double> > >::iterator iter1=_coeffs.begin();iter1!=_coeffs.end();iter1++)
for(vector<pair<int,double> >::iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
{
- const std::pair<int,int>& distantLocalLazyId=mapping[(*iter2).first];
+ const std::pair<int,mcIdType>& distantLocalLazyId=mapping[(*iter2).first];
int localLazyProcId=procT[distantLocalLazyId.first];
- int globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second];
+ mcIdType globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second];
globalIdVal[globalDistantLazyId]+=(*iter2).second;
}
//perform merge
std::vector<double>::iterator iter4=(*iter3).begin();
for(vector<pair<int,double> >::iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++,iter4++)
{
- const std::pair<int,int>& distantLocalLazyId=mapping[(*iter2).first];
+ const std::pair<int,mcIdType>& distantLocalLazyId=mapping[(*iter2).first];
int localLazyProcId=procT[distantLocalLazyId.first];
- int globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second];
+ mcIdType globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second];
double newVal=globalIdVal[globalDistantLazyId];
if((*iter2).second!=0.)
(*iter4)=val*newVal/(*iter2).second;
}
}
- void InterpolationMatrix::divideByGlobalRowSum(const std::vector<int>& distantProcs, const std::vector<std::vector<int> >& resPerProcI,
+ void InterpolationMatrix::divideByGlobalRowSum(const std::vector<int>& distantProcs, const std::vector<std::vector<mcIdType> >& resPerProcI,
const std::vector<std::vector<double> >& resPerProcD, std::vector<std::vector<double> >& deno)
{
- map<int,double> fastSums;
+ map<mcIdType,double> fastSums;
int procId=0;
for(vector<int>::const_iterator iter1=distantProcs.begin();iter1!=distantProcs.end();iter1++,procId++)
{
- const std::vector<int>& currentProcI=resPerProcI[procId];
+ const std::vector<mcIdType>& currentProcI=resPerProcI[procId];
const std::vector<double>& currentProcD=resPerProcD[procId];
vector<double>::const_iterator iter3=currentProcD.begin();
- for(vector<int>::const_iterator iter2=currentProcI.begin();iter2!=currentProcI.end();iter2++,iter3++)
+ for(vector<mcIdType>::const_iterator iter2=currentProcI.begin();iter2!=currentProcI.end();iter2++,iter3++)
fastSums[_col_offsets[std::make_pair(*iter1,*iter2)]]=*iter3;
}
deno.resize(_coeffs.size());
*/
void InterpolationMatrix::prepare()
{
- int nbelems = _source_field->getField()->getNumberOfTuples();
- for (int ielem=0; ielem < nbelems; ielem++)
+ mcIdType nbelems = _source_field->getField()->getNumberOfTuples();
+ for (mcIdType ielem=0; ielem < nbelems; ielem++)
{
_row_offsets[ielem+1]+=_row_offsets[ielem];
}
*/
void InterpolationMatrix::multiply(MEDCouplingFieldDouble& field) const
{
- int nbcomp = field.getArray()->getNumberOfComponents();
+ mcIdType nbcomp = ToIdType(field.getArray()->getNumberOfComponents());
vector<double> target_value(_col_offsets.size()* nbcomp,0.0);
//computing the matrix multiply on source side
if (_source_group.containsMyRank())
{
- int nbrows = _coeffs.size();
+ mcIdType nbrows = ToIdType(_coeffs.size());
// performing W.S
// W is the intersection matrix
// S is the source vector
- for (int irow=0; irow<nbrows; irow++)
+ for (mcIdType irow=0; irow<nbrows; irow++)
{
- for (int icomp=0; icomp< nbcomp; icomp++)
+ for (mcIdType icomp=0; icomp< nbcomp; icomp++)
{
double coeff_row = field.getIJ(irow,icomp);
- for (int icol=_row_offsets[irow]; icol< _row_offsets[irow+1];icol++)
+ for (mcIdType icol=_row_offsets[irow]; icol< _row_offsets[irow+1];icol++)
{
int colid= _coeffs[irow][icol-_row_offsets[irow]].first;
double value = _coeffs[irow][icol-_row_offsets[irow]].second;
if (_target_group.containsMyRank())
{
- int nbelems = field.getArray()->getNumberOfTuples() ;
+ mcIdType nbelems = field.getArray()->getNumberOfTuples() ;
double* value = const_cast<double*> (field.getArray()->getPointer());
- for (int i=0; i<nbelems*nbcomp; i++)
+ for (mcIdType i=0; i<nbelems*nbcomp; i++)
{
value[i]=0.0;
}
*/
void InterpolationMatrix::transposeMultiply(MEDCouplingFieldDouble& field) const
{
- int nbcomp = field.getArray()->getNumberOfComponents();
+ std::size_t nbcomp = field.getArray()->getNumberOfComponents();
vector<double> source_value(_col_offsets.size()* nbcomp,0.0);
_mapping.reverseSendRecv(&source_value[0],field);
//treatment of the transpose matrix multiply on the source side
if (_source_group.containsMyRank())
{
- int nbrows = _coeffs.size();
- double *array = field.getArray()->getPointer() ;
+ mcIdType nbrows = ToIdType( _coeffs.size() );
+ double *array = field.getArray()->getPointer() ;
// Initialization
std::fill(array, array+nbrows*nbcomp, 0.0) ;
//performing WT.T
//WT is W transpose
//T is the target vector
- for (int irow = 0; irow < nbrows; irow++)
+ for (mcIdType irow = 0; irow < nbrows; irow++)
{
- for (int icol = _row_offsets[irow]; icol < _row_offsets[irow+1]; icol++)
+ for (mcIdType icol = _row_offsets[irow]; icol < _row_offsets[irow+1]; icol++)
{
int colid = _coeffs[irow][icol-_row_offsets[irow]].first;
double value = _coeffs[irow][icol-_row_offsets[irow]].second;
double deno = _deno_reverse_multiply[irow][icol-_row_offsets[irow]];
- for (int icomp=0; icomp<nbcomp; icomp++)
+ for (std::size_t icomp=0; icomp<nbcomp; icomp++)
{
double coeff_row = source_value[colid*nbcomp+icomp];
array[irow*nbcomp+icomp] += value*coeff_row/deno;
virtual ~InterpolationMatrix();
void addContribution(MEDCouplingPointSet& distant_support, int iproc_distant,
- const int* distant_elems, const std::string& srcMeth, const std::string& targetMeth);
+ const mcIdType* distant_elems, const std::string& srcMeth, const std::string& targetMeth);
void finishContributionW(ElementLocator& elementLocator);
void finishContributionL(ElementLocator& elementLocator);
void multiply(MEDCouplingFieldDouble& field) const;
void transposeMultiply(MEDCouplingFieldDouble& field)const;
void prepare();
- int getNbRows() const { return _row_offsets.size(); }
+ mcIdType getNbRows() const { return ToIdType(_row_offsets.size()); }
MPIAccessDEC* getAccessDEC() { return _mapping.getAccessDEC(); }
private:
void computeConservVolDenoW(ElementLocator& elementLocator);
void computeRevIntegralDenoL(ElementLocator& elementLocator);
void computeLocalColSum(std::vector<double>& res) const;
- void computeLocalRowSum(const std::vector<int>& distantProcs, std::vector<std::vector<int> >& resPerProcI,
+ void computeLocalRowSum(const std::vector<int>& distantProcs, std::vector<std::vector<mcIdType> >& resPerProcI,
std::vector<std::vector<double> >& resPerProcD) const;
void computeGlobalRowSum(ElementLocator& elementLocator, std::vector<std::vector<double> >& denoStrorage, std::vector<std::vector<double> >& denoStrorageInv);
void computeGlobalColSum(std::vector<std::vector<double> >& denoStrorage);
void resizeGlobalColSum(std::vector<std::vector<double> >& denoStrorage);
- void fillDSFromVM(int iproc_distant, const int* distant_elems, const std::vector< std::map<int,double> >& values, MEDCouplingFieldDouble *surf);
- void serializeMe(std::vector< std::vector< std::map<int,double> > >& data1, std::vector<int>& data2) const;
+ void fillDSFromVM(int iproc_distant, const mcIdType* distant_elems, const std::vector< std::map<mcIdType,double> >& values, MEDCouplingFieldDouble *surf);
+ void serializeMe(std::vector< std::vector< std::map<mcIdType,double> > >& data1, std::vector<int>& data2) const;
void initialize();
- void findAdditionnalElements(ElementLocator& elementLocator, std::vector<std::vector<int> >& elementsToAdd,
- const std::vector<std::vector<int> >& resPerProcI, const std::vector<std::vector<int> >& globalIdsPartial);
- void addGhostElements(const std::vector<int>& distantProcs, const std::vector<std::vector<int> >& elementsToAdd);
+ void findAdditionnalElements(ElementLocator& elementLocator, std::vector<std::vector<mcIdType> >& elementsToAdd,
+ const std::vector<std::vector<mcIdType> >& resPerProcI, const std::vector<std::vector<mcIdType> >& globalIdsPartial);
+ void addGhostElements(const std::vector<int>& distantProcs, const std::vector<std::vector<mcIdType> >& elementsToAdd);
int mergePolicies(const std::vector<int>& policyPartial);
- void mergeRowSum(const std::vector< std::vector<double> >& rowsPartialSumD, const std::vector< std::vector<int> >& globalIdsPartial,
- std::vector<int>& globalIdsLazySideInteraction, std::vector<double>& sumCorresponding);
- void mergeRowSum2(const std::vector< std::vector<int> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD,
- const std::vector<int>& globalIdsLazySideInteraction, const std::vector<double>& sumCorresponding);
- void mergeRowSum3(const std::vector< std::vector<int> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD);
- void mergeCoeffs(const std::vector<int>& procsInInteraction, const std::vector< std::vector<int> >& rowsPartialSumI,
- const std::vector<std::vector<int> >& globalIdsPartial, std::vector<std::vector<double> >& denoStrorageInv);
- void divideByGlobalRowSum(const std::vector<int>& distantProcs, const std::vector<std::vector<int> >& resPerProcI,
+ void mergeRowSum(const std::vector< std::vector<double> >& rowsPartialSumD, const std::vector< std::vector<mcIdType> >& globalIdsPartial,
+ std::vector<mcIdType>& globalIdsLazySideInteraction, std::vector<double>& sumCorresponding);
+ void mergeRowSum2(const std::vector< std::vector<mcIdType> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD,
+ const std::vector<mcIdType>& globalIdsLazySideInteraction, const std::vector<double>& sumCorresponding);
+ void mergeRowSum3(const std::vector< std::vector<mcIdType> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD);
+ void mergeCoeffs(const std::vector<int>& procsInInteraction, const std::vector< std::vector<mcIdType> >& rowsPartialSumI,
+ const std::vector<std::vector<mcIdType> >& globalIdsPartial, std::vector<std::vector<double> >& denoStrorageInv);
+ void divideByGlobalRowSum(const std::vector<int>& distantProcs, const std::vector<std::vector<mcIdType> >& resPerProcI,
const std::vector<std::vector<double> >& resPerProcD, std::vector<std::vector<double> >& deno);
private:
bool isSurfaceComputationNeeded(const std::string& method) const;
private:
const MEDCoupling::ParaFIELD *_source_field;
- std::vector<int> _row_offsets;
- std::map<std::pair<int,int>, int > _col_offsets;
+ std::vector<mcIdType> _row_offsets;
+ std::map<std::pair<int,mcIdType>, mcIdType > _col_offsets;
MEDCouplingPointSet *_source_support;
MxN_Mapping _mapping;
{
int size = 0;
for (int i = 0 ; i < _processor_group_size ; i++ )
- size += _send_requests[ i ].size() ;
+ size += (int)_send_requests[ i ].size() ;
return size ;
}
{
int size = 0 ;
for (int i = 0 ; i < _processor_group_size ; i++ )
- size += _recv_requests[ i ].size() ;
+ size += (int)_recv_requests[ i ].size() ;
return size ;
}
list< int >::const_iterator iter ;
for (iter = _send_requests[ destrank ].begin() ; iter != _send_requests[destrank].end() ; iter++ )
ArrayOfSendRequests[i++] = *iter ;
- return _send_requests[destrank].size() ;
+ return (int)_send_requests[destrank].size() ;
}
// Returns in ArrayOfRecvRequests with the dimension "size" all the
_recv_requests[ sourcerank ] ;
for (iter = _recv_requests[ sourcerank ].begin() ; iter != _recv_requests[sourcerank].end() ; iter++ )
ArrayOfRecvRequests[i++] = *iter ;
- return _recv_requests[sourcerank].size() ;
+ return (int)_recv_requests[sourcerank].size() ;
}
// Send in synchronous mode count values of type datatype from buffer to target
return aextent ;
}
+ // Returns the MPI size of a MPI_LONG
+ MPI_Aint MPIAccess::longExtent() const
+ {
+ MPI_Aint aextent, lbound ;
+ MPI_Type_get_extent( MPI_LONG , &lbound, &aextent ) ;
+ return aextent ;
+ }
+
// Returns the MPI size of a MPI_DOUBLE
MPI_Aint MPIAccess::doubleExtent() const
{
bool isTimeMessage( int MPITag ) const ;
MPI_Aint timeExtent() const ;
MPI_Aint intExtent() const ;
+ MPI_Aint longExtent() const ;
MPI_Aint doubleExtent() const ;
MPI_Aint extent( MPI_Datatype datatype ) const ;
// used to allocate ArrayOfSendRequests for the call to SendRequestIds
inline int MPIAccess::sendRequestIdsSize(int destrank)
{
- return _send_requests[destrank].size() ;
+ return (int)_send_requests[destrank].size() ;
}
// Returns the number of all RecvRequestIds matching a source rank. It may be
// used to allocate ArrayOfRecvRequests for the call to RecvRequestIds
inline int MPIAccess::recvRequestIdsSize(int sourcerank)
{
- return _recv_requests[sourcerank].size() ;
+ return (int)_recv_requests[sourcerank].size() ;
}
// Returns the MPI_Datatype (registered in MPI in the constructor with
return timeExtent() ;
if ( adatatype == MPI_INT )
return intExtent() ;
+ if ( adatatype == MPI_LONG )
+ return longExtent() ;
if ( adatatype == MPI_DOUBLE )
return doubleExtent() ;
return 0 ;
sts = _MPI_access->ISend( &((int *) sendbuf)[offset] , sendcount , sendtype ,
target , SendRequestId ) ;
}
+ else if ( sendtype == MPI_LONG )
+ {
+ sts = _MPI_access->ISend( &((long *) sendbuf)[offset] , sendcount , sendtype ,
+ target , SendRequestId ) ;
+ }
else
{
sts = _MPI_access->ISend( &((double *) sendbuf)[offset] , sendcount , sendtype ,
sts = _MPI_access->send( &((int *) sendbuf)[offset] , sendcount , sendtype ,
target , SendRequestId ) ;
}
+ else if ( sendtype == MPI_LONG )
+ {
+ sts = _MPI_access->send( &((long *) sendbuf)[offset] , sendcount , sendtype ,
+ target , SendRequestId ) ;
+ }
else
{
sts = _MPI_access->send( &((double *) sendbuf)[offset] , sendcount , sendtype ,
sts = _MPI_access->IRecv( &((int *) recvbuf)[offset] , recvcount , recvtype ,
target , RecvRequestId ) ;
}
+ else if ( recvtype == MPI_LONG )
+ {
+ sts = _MPI_access->IRecv( &((long *) recvbuf)[offset] , recvcount , recvtype ,
+ target , RecvRequestId ) ;
+ }
else
{
sts = _MPI_access->IRecv( &((double *) recvbuf)[offset] , recvcount , recvtype ,
sts = _MPI_access->recv( &((int *) recvbuf)[offset] , recvcount , recvtype ,
target , RecvRequestId ) ;
}
+ else if ( recvtype == MPI_LONG )
+ {
+ sts = _MPI_access->recv( &((long *) recvbuf)[offset] , recvcount , recvtype ,
+ target , RecvRequestId ) ;
+ }
else
{
sts = _MPI_access->recv( &((double *) recvbuf)[offset] , recvcount , recvtype ,
{
for ( target = 0 ; target < _group_size ; target++ )
{
- int recvsize = recvcount*_MPI_access->extent( recvtype ) ;
+ int recvsize = (int)(recvcount*_MPI_access->extent( recvtype ));
checkTime( recvcount , recvtype , target , false ) ;
//===========================================================================
//TODO : it is assumed actually that we have only 1 timestep before and after
{
if ( recvcounts[target] )
{
- int recvsize = recvcounts[target]*_MPI_access->extent( recvtype ) ;
+ int recvsize = (int)(recvcounts[target]*_MPI_access->extent( recvtype ));
checkTime( recvcounts[target] , recvtype , target , false ) ;
//===========================================================================
//TODO : it is assumed actually that we have only 1 timestep before nad after
throw INTERP_KERNEL::Exception("invalid rank in set<int> argument of MPIProcessorGroup constructor");
}
- _comm_interface.groupIncl(group_world, _proc_ids.size(), ranks, &_group);
+ _comm_interface.groupIncl(group_world, (int)_proc_ids.size(), ranks, &_group);
_comm_interface.commCreate(_world_comm, _group, &_comm);
\param distant_proc proc rank of the distant processor (in terms of the union group)
\param distant_element id of the element on the distant processor
*/
- void MxN_Mapping::addElementFromSource(int distant_proc, int distant_element)
+ void MxN_Mapping::addElementFromSource(int distant_proc, mcIdType distant_element)
{
_sending_ids.push_back(make_pair(distant_proc,distant_element));
for (int i=distant_proc; i<_union_group->size(); i++)
delete[] nbrecv;
_recv_ids.resize(_recv_proc_offsets[_union_group->size()]);
- int* isendbuf=0;
- int* irecvbuf=0;
+ mcIdType* isendbuf=0;
+ mcIdType* irecvbuf=0;
if (_sending_ids.size()>0)
- isendbuf = new int[_sending_ids.size()];
+ isendbuf = new mcIdType[_sending_ids.size()];
if (_recv_ids.size()>0)
- irecvbuf = new int[_recv_ids.size()];
+ irecvbuf = new mcIdType[_recv_ids.size()];
int* sendcounts = new int[_union_group->size()];
int* senddispls=new int[_union_group->size()];
int* recvcounts=new int[_union_group->size()];
recvdispls[i]=_recv_proc_offsets[i];
}
vector<int> offsets = _send_proc_offsets;
- for (int i=0; i<(int)_sending_ids.size();i++)
+ for (std::size_t i=0; i<_sending_ids.size();i++)
{
int iproc = _sending_ids[i].first;
isendbuf[offsets[iproc]]=_sending_ids[i].second;
offsets[iproc]++;
}
- comm_interface.allToAllV(isendbuf, sendcounts, senddispls, MPI_INT,
- irecvbuf, recvcounts, recvdispls, MPI_INT,
+ comm_interface.allToAllV(isendbuf, sendcounts, senddispls, MPI_ID_TYPE,
+ irecvbuf, recvcounts, recvdispls, MPI_ID_TYPE,
*comm);
for (int i=0; i< _recv_proc_offsets[_union_group->size()]; i++)
CommInterface comm_interface=_union_group->getCommInterface();
const MPIProcessorGroup* group = static_cast<const MPIProcessorGroup*>(_union_group);
- int nbcomp=field.getArray()->getNumberOfComponents();
+ int nbcomp=(int)field.getArray()->getNumberOfComponents();
double* sendbuf=0;
double* recvbuf=0;
if (_sending_ids.size() >0)
break;
case PointToPoint:
_access_DEC->allToAllv(sendbuf, sendcounts, senddispls, MPI_DOUBLE,
- recvbuf, recvcounts, recvdispls, MPI_DOUBLE);
+ recvbuf, recvcounts, recvdispls, MPI_DOUBLE);
break;
}
CommInterface comm_interface=_union_group->getCommInterface();
const MPIProcessorGroup* group = static_cast<const MPIProcessorGroup*>(_union_group);
- int nbcomp=field.getArray()->getNumberOfComponents();
+ int nbcomp=(int)field.getArray()->getNumberOfComponents();
double* sendbuf=0;
double* recvbuf=0;
if (_recv_ids.size() >0)
public:
MxN_Mapping(const ProcessorGroup& source_group, const ProcessorGroup& target_group, const DECOptions& dec_options);
virtual ~MxN_Mapping();
- void addElementFromSource(int distant_proc, int distant_elem);
+ void addElementFromSource(int distant_proc, mcIdType distant_elem);
void prepareSendRecv();
void sendRecv(MEDCouplingFieldDouble& field);
void sendRecv(double* sendfield, MEDCouplingFieldDouble& field) const ;
void reverseSendRecv(double* recvfield, MEDCouplingFieldDouble& field) const ;
//
- const std::vector<std::pair<int,int> >& getSendingIds() const { return _sending_ids; }
+ const std::vector<std::pair<int,mcIdType> >& getSendingIds() const { return _sending_ids; }
const std::vector<int>& getSendProcsOffsets() const { return _send_proc_offsets; }
void initialize();
ProcessorGroup* _union_group;
MPIAccessDEC * _access_DEC;
int _nb_comps;
- std::vector<std::pair<int,int> > _sending_ids;
- std::vector<int> _recv_ids;
+ std::vector<std::pair<int,mcIdType> > _sending_ids;
+ std::vector<mcIdType> _recv_ids;
std::vector<int> _send_proc_offsets;
std::vector<int> _recv_proc_offsets;
};
OverlapDEC::OverlapDEC(const std::set<int>& procIds, const MPI_Comm& world_comm):
_load_balancing_algo(1),
_own_group(true),_interpolation_matrix(0), _locator(0),
+ _default_field_value(0.0),
_source_field(0),_own_source_field(false),
_target_field(0),_own_target_field(false),
- _default_field_value(0.0),
_comm(MPI_COMM_NULL)
{
MEDCoupling::CommInterface comm;
std::copy(procIds.begin(),procIds.end(),ranks_world);
MPI_Group group,world_group;
comm.commGroup(world_comm,&world_group);
- comm.groupIncl(world_group,procIds.size(),ranks_world,&group);
+ comm.groupIncl(world_group,(int)procIds.size(),ranks_world,&group);
delete [] ranks_world;
comm.commCreate(world_comm,group,&_comm);
comm.groupFree(&group);
return ;
}
std::set<int> idsUnion;
- for(std::size_t i=0;i<procIds.size();i++)
+ for(unsigned int i=0;i<procIds.size();i++)
idsUnion.insert(i);
_group=new MPIProcessorGroup(comm,idsUnion,_comm);
}
for(std::vector< std::pair<int,int> >::const_iterator it=jobs.begin();it!=jobs.end();it++)
{
const MEDCouplingPointSet *src=_locator->getSourceMesh((*it).first);
- const DataArrayInt *srcIds=_locator->getSourceIds((*it).first);
+ const DataArrayIdType *srcIds=_locator->getSourceIds((*it).first);
const MEDCouplingPointSet *trg=_locator->getTargetMesh((*it).second);
- const DataArrayInt *trgIds=_locator->getTargetIds((*it).second);
+ const DataArrayIdType *trgIds=_locator->getTargetIds((*it).second);
_interpolation_matrix->computeLocalIntersection(src,srcIds,srcMeth,(*it).first,trg,trgIds,trgMeth,(*it).second);
}
_interpolation_matrix->prepare(_locator->getProcsToSendFieldData());
_local_source_mesh(0),
_local_target_mesh(0),
_domain_bounding_boxes(0),
- _group(group),
- _epsAbs(epsAbs)
+ _epsAbs(epsAbs),
+ _group(group)
{
if(_local_source_field)
_local_source_mesh=_local_source_field->getSupport()->getCellMesh();
else
{
if(cpl.first == procID)
- (*itMap).second = full_set[cpl.second].size();
+ (*itMap).second = (int)full_set[cpl.second].size();
else // cpl.second == srcProcID
- (*itMap).second = full_set[cpl.first].size();
+ (*itMap).second = (int)full_set[cpl.first].size();
}
}
INTERP_KERNEL::AutoPtr<bool> proc_valid = new bool[grp_size];
int max_sz = -1, max_id = -1;
for(itVector = full_set.begin(), procID=0; itVector != full_set.end(); itVector++, procID++)
{
- int sz = (*itVector).size();
+ int sz = (int)(*itVector).size();
if (proc_valid[procID] && sz > max_sz)
{
max_sz = sz;
return (*it).second;
}
- const DataArrayInt *OverlapElementLocator::getSourceIds(int procId) const
+ const DataArrayIdType *OverlapElementLocator::getSourceIds(int procId) const
{
int myProcId=_group.myRank();
if(myProcId==procId)
return (*it).second;
}
- const DataArrayInt *OverlapElementLocator::getTargetIds(int procId) const
+ const DataArrayIdType *OverlapElementLocator::getTargetIds(int procId) const
{
int myProcId=_group.myRank();
if(myProcId==procId)
field=_local_target_field;
}
AutoDAInt elems=local_mesh->getCellsInBoundingBox(distant_bb,getBoundingBoxAdjustment());
- DataArrayInt *old2new_map;
+ DataArrayIdType *old2new_map;
MEDCouplingPointSet *send_mesh=static_cast<MEDCouplingPointSet *>(field->getField()->buildSubMeshData(elems->begin(),elems->end(),old2new_map));
if(sourceOrTarget)
matrix.keepTracksOfSourceIds(procId,old2new_map);
*/
void OverlapElementLocator::receiveRemoteMeshFrom(int procId, bool sourceOrTarget)
{
- DataArrayInt *old2new_map=0;
+ DataArrayIdType *old2new_map=0;
MEDCouplingPointSet *m=0;
receiveMesh(procId,m,old2new_map);
Proc_SrcOrTgt p(procId,sourceOrTarget);
_remote_elems[p]=old2new_map;
}
- void OverlapElementLocator::sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayInt *idsToSend) const
+ void OverlapElementLocator::sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayIdType *idsToSend) const
{
CommInterface comInterface=_group.getCommInterface();
// First stage : exchanging sizes
vector<double> tinyInfoLocalD;//tinyInfoLocalD not used for the moment
- vector<int> tinyInfoLocal;
+ vector<mcIdType> tinyInfoLocal;
vector<string> tinyInfoLocalS;
mesh->getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS);
const MPI_Comm *comm=getCommunicator();
//
- int lgth[2];
- lgth[0]=tinyInfoLocal.size();
+ mcIdType lgth[2];
+ lgth[0]=ToIdType(tinyInfoLocal.size());
lgth[1]=idsToSend->getNbOfElems();
- comInterface.send(&lgth,2,MPI_INT,procId,START_TAG_MESH_XCH,*_comm);
- comInterface.send(&tinyInfoLocal[0],tinyInfoLocal.size(),MPI_INT,procId,START_TAG_MESH_XCH+1,*comm);
+ comInterface.send(&lgth,2,MPI_ID_TYPE,procId,START_TAG_MESH_XCH,*_comm);
+ comInterface.send(&tinyInfoLocal[0],(int)tinyInfoLocal.size(),MPI_ID_TYPE,procId,START_TAG_MESH_XCH+1,*comm);
//
- DataArrayInt *v1Local=0;
+ DataArrayIdType *v1Local=0;
DataArrayDouble *v2Local=0;
mesh->serialize(v1Local,v2Local);
- comInterface.send(v1Local->getPointer(),v1Local->getNbOfElems(),MPI_INT,procId,START_TAG_MESH_XCH+2,*comm);
- comInterface.send(v2Local->getPointer(),v2Local->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm);
+ comInterface.send(v1Local->getPointer(),(int)v1Local->getNbOfElems(),MPI_ID_TYPE,procId,START_TAG_MESH_XCH+2,*comm);
+ comInterface.send(v2Local->getPointer(),(int)v2Local->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm);
//finished for mesh, ids now
- comInterface.send(const_cast<int *>(idsToSend->getConstPointer()),lgth[1],MPI_INT,procId,START_TAG_MESH_XCH+4,*comm);
+ comInterface.send(const_cast<mcIdType *>(idsToSend->getConstPointer()),(int)lgth[1],MPI_ID_TYPE,procId,START_TAG_MESH_XCH+4,*comm);
//
v1Local->decrRef();
v2Local->decrRef();
}
- void OverlapElementLocator::receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayInt *&ids) const
+ void OverlapElementLocator::receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayIdType *&ids) const
{
- int lgth[2];
+ mcIdType lgth[2];
MPI_Status status;
const MPI_Comm *comm=getCommunicator();
CommInterface comInterface=_group.getCommInterface();
- comInterface.recv(lgth,2,MPI_INT,procId,START_TAG_MESH_XCH,*_comm,&status);
- std::vector<int> tinyInfoDistant(lgth[0]);
- ids=DataArrayInt::New();
+ comInterface.recv(lgth,2,MPI_ID_TYPE,procId,START_TAG_MESH_XCH,*_comm,&status);
+ std::vector<mcIdType> tinyInfoDistant(lgth[0]);
+ ids=DataArrayIdType::New();
ids->alloc(lgth[1],1);
- comInterface.recv(&tinyInfoDistant[0],lgth[0],MPI_INT,procId,START_TAG_MESH_XCH+1,*comm,&status);
+ comInterface.recv(&tinyInfoDistant[0],(int)lgth[0],MPI_ID_TYPE,procId,START_TAG_MESH_XCH+1,*comm,&status);
mesh=MEDCouplingPointSet::BuildInstanceFromMeshType((MEDCouplingMeshType)tinyInfoDistant[0]);
std::vector<std::string> unusedTinyDistantSts;
vector<double> tinyInfoDistantD(1);//tinyInfoDistantD not used for the moment
- DataArrayInt *v1Distant=DataArrayInt::New();
+ DataArrayIdType *v1Distant=DataArrayIdType::New();
DataArrayDouble *v2Distant=DataArrayDouble::New();
mesh->resizeForUnserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
- comInterface.recv(v1Distant->getPointer(),v1Distant->getNbOfElems(),MPI_INT,procId,START_TAG_MESH_XCH+2,*comm,&status);
- comInterface.recv(v2Distant->getPointer(),v2Distant->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm,&status);
+ comInterface.recv(v1Distant->getPointer(),(int)v1Distant->getNbOfElems(),MPI_ID_TYPE,procId,START_TAG_MESH_XCH+2,*comm,&status);
+ comInterface.recv(v2Distant->getPointer(),(int)v2Distant->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm,&status);
mesh->unserialization(tinyInfoDistantD,tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
//finished for mesh, ids now
- comInterface.recv(ids->getPointer(),lgth[1],MPI_INT,procId,1144,*comm,&status);
+ comInterface.recv(ids->getPointer(),(int)lgth[1],MPI_ID_TYPE,procId,1144,*comm,&status);
//
v1Distant->decrRef();
v2Distant->decrRef();
std::string getSourceMethod() const;
std::string getTargetMethod() const;
const MEDCouplingPointSet *getSourceMesh(int procId) const;
- const DataArrayInt *getSourceIds(int procId) const;
+ const DataArrayIdType *getSourceIds(int procId) const;
const MEDCouplingPointSet *getTargetMesh(int procId) const;
- const DataArrayInt *getTargetIds(int procId) const;
+ const DataArrayIdType *getTargetIds(int procId) const;
bool isInMyTodoList(int i, int j) const;
void debugPrintWorkSharing(std::ostream & ostr) const;
private:
bool intersectsBoundingBox(int i, int j) const;
void sendLocalMeshTo(int procId, bool sourceOrTarget, OverlapInterpolationMatrix& matrix) const;
void receiveRemoteMeshFrom(int procId, bool sourceOrTarget);
- void sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayInt *idsToSend) const;
- void receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayInt *&ids) const;
+ void sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayIdType *idsToSend) const;
+ void receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayIdType *&ids) const;
private:
typedef MCAuto< MEDCouplingPointSet > AutoMCPointSet;
- typedef MCAuto< DataArrayInt > AutoDAInt;
+ typedef MCAuto< DataArrayIdType > AutoDAInt;
typedef std::pair<int,bool> Proc_SrcOrTgt; // a key indicating a proc ID and whether the data is for source mesh/field or target mesh/field
static const int START_TAG_MESH_XCH;
{
}
- void OverlapInterpolationMatrix::keepTracksOfSourceIds(int procId, DataArrayInt *ids)
+ void OverlapInterpolationMatrix::keepTracksOfSourceIds(int procId, DataArrayIdType *ids)
{
_mapping.keepTracksOfSourceIds(procId,ids);
}
- void OverlapInterpolationMatrix::keepTracksOfTargetIds(int procId, DataArrayInt *ids)
+ void OverlapInterpolationMatrix::keepTracksOfTargetIds(int procId, DataArrayIdType *ids)
{
_mapping.keepTracksOfTargetIds(procId,ids);
}
*
* One of the 2 is necessarily null (the two can be null together)
*/
- void OverlapInterpolationMatrix::computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayInt *srcIds, const std::string& srcMeth, int srcProcId,
- const MEDCouplingPointSet *trg, const DataArrayInt *trgIds, const std::string& trgMeth, int trgProcId)
+ void OverlapInterpolationMatrix::computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayIdType *srcIds, const std::string& srcMeth, int srcProcId,
+ const MEDCouplingPointSet *trg, const DataArrayIdType *trgIds, const std::string& trgMeth, int trgProcId)
{
std::string interpMethod(srcMeth);
interpMethod+=trgMeth;
//creating the interpolator structure
vector<SparseDoubleVec > sparse_matrix_part;
- int colSize=0;
+ mcIdType colSize=0;
//computation of the intersection volumes between source and target elements
const MEDCouplingUMesh *trgC=dynamic_cast<const MEDCouplingUMesh *>(trg);
const MEDCouplingUMesh *srcC=dynamic_cast<const MEDCouplingUMesh *>(src);
vector<SparseDoubleVec > matrixTranspose;
colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,sparse_matrix_part,interpMethod);//not a bug target in source.
TransposeMatrix(matrixTranspose,colSize,sparse_matrix_part);
- colSize=matrixTranspose.size();
+ colSize=ToIdType(matrixTranspose.size());
}
else if ( src->getMeshDimension() == 1 && trg->getMeshDimension() == 2
&& trg->getSpaceDimension() == 2 && src->getSpaceDimension() == 2 )
vector<SparseDoubleVec > matrixTranspose;
colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,matrixTranspose,interpMethod);//not a bug target in source.
TransposeMatrix(matrixTranspose,colSize,sparse_matrix_part);
- colSize=matrixTranspose.size();
+ colSize=ToIdType(matrixTranspose.size());
}
else if (trg->getMeshDimension() != _source_support->getMeshDimension())
{
}
void OverlapInterpolationMatrix::TransposeMatrix(const std::vector<SparseDoubleVec >& matIn,
- int nbColsMatIn, std::vector<SparseDoubleVec >& matOut)
+ mcIdType nbColsMatIn, std::vector<SparseDoubleVec >& matOut)
{
matOut.resize(nbColsMatIn);
int id=0;
const InterpolationOptions& i_opt,
const OverlapElementLocator & loc);
- void keepTracksOfSourceIds(int procId, DataArrayInt *ids);
+ void keepTracksOfSourceIds(int procId, DataArrayIdType *ids);
- void keepTracksOfTargetIds(int procId, DataArrayInt *ids);
+ void keepTracksOfTargetIds(int procId, DataArrayIdType *ids);
- void computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayInt *srcIds, const std::string& srcMeth, int srcProcId,
- const MEDCouplingPointSet *trg, const DataArrayInt *trgIds, const std::string& trgMeth, int trgProcId);
+ void computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayIdType *srcIds, const std::string& srcMeth, int srcProcId,
+ const MEDCouplingPointSet *trg, const DataArrayIdType *trgIds, const std::string& trgMeth, int trgProcId);
void prepare(const std::vector< int > & procsToSendField);
virtual ~OverlapInterpolationMatrix();
private:
- static void TransposeMatrix(const std::vector<SparseDoubleVec>& matIn, int nbColsMatIn,
+ static void TransposeMatrix(const std::vector<SparseDoubleVec>& matIn, mcIdType nbColsMatIn,
std::vector<SparseDoubleVec>& matOut);
private:
ParaFIELD *_source_field;
/*!
* Keeps the link between a given a proc holding source mesh data, and the corresponding cell IDs.
*/
-void OverlapMapping::keepTracksOfSourceIds(int procId, DataArrayInt *ids)
+void OverlapMapping::keepTracksOfSourceIds(int procId, DataArrayIdType *ids)
{
ids->incrRef();
_sent_src_ids[procId] = ids;
/*!
* Same as keepTracksOfSourceIds() but for target mesh data.
*/
-void OverlapMapping::keepTracksOfTargetIds(int procId, DataArrayInt *ids)
+void OverlapMapping::keepTracksOfTargetIds(int procId, DataArrayIdType *ids)
{
ids->incrRef();
_sent_trg_ids[procId] = ids;
*
* One of the 2 is necessarily null (the two can be null together)
*/
-void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& matrixST, const DataArrayInt *srcIds, int srcProcId, const DataArrayInt *trgIds, int trgProcId)
+void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& matrixST, const DataArrayIdType *srcIds, int srcProcId, const DataArrayIdType *trgIds, int trgProcId)
{
_matrixes_st.push_back(matrixST);
_source_proc_id_st.push_back(srcProcId);
_nb_of_rcv_src_ids[srcProcId] = srcIds->getNumberOfTuples();
else // source mesh part is local
{
- std::set<int> s;
+ std::set<mcIdType> s;
// For all source IDs (=col indices) in the sparse matrix:
for(std::vector< SparseDoubleVec >::const_iterator it1=matrixST.begin();it1!=matrixST.end();it1++)
for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
s.insert((*it2).first);
- vector<int> v(s.begin(), s.end()); // turn set into vector
+ vector<mcIdType> v(s.begin(), s.end()); // turn set into vector
_src_ids_zip_comp[trgProcId] = v;
}
}
*
* After the call of this method, 'this' contains the matrixST for all source cells of the current proc
*/
-void OverlapMapping::prepare(const std::vector< int >& procsToSendField, int nbOfTrgElems)
+void OverlapMapping::prepare(const std::vector< int >& procsToSendField, mcIdType nbOfTrgElems)
{
#ifdef DEC_DEBUG
printMatrixesST();
CommInterface commInterface=_group.getCommInterface();
const MPIProcessorGroup *group=static_cast<const MPIProcessorGroup*>(&_group);
const MPI_Comm *comm=group->getComm();
- int grpSize=_group.size();
- INTERP_KERNEL::AutoPtr<int> nbsend=new int[grpSize];
+ std::size_t grpSize=_group.size();
+ INTERP_KERNEL::AutoPtr<mcIdType> nbsend=new mcIdType[grpSize];
INTERP_KERNEL::AutoPtr<int> nbsend2=new int[grpSize];
INTERP_KERNEL::AutoPtr<int> nbsend3=new int[grpSize];
- std::fill<int *>(nbsend,nbsend+grpSize,0);
+ std::fill<mcIdType *>(nbsend,nbsend+grpSize,0);
int myProcId=_group.myRank();
for(std::size_t i=0;i<_matrixes_st.size();i++)
if(_source_proc_id_st[i]==myProcId)
- nbsend[_target_proc_id_st[i]]=_matrixes_st[i].size();
- INTERP_KERNEL::AutoPtr<int> nbrecv=new int[grpSize];
- commInterface.allToAll(nbsend,1,MPI_INT,nbrecv,1,MPI_INT,*comm);
+ nbsend[_target_proc_id_st[i]]=(int)_matrixes_st[i].size();
+ INTERP_KERNEL::AutoPtr<mcIdType> nbrecv=new mcIdType[grpSize];
+ commInterface.allToAll(nbsend,1,MPI_ID_TYPE,nbrecv,1,MPI_ID_TYPE,*comm);
//exchanging matrix
//first exchanging offsets+ids_source
INTERP_KERNEL::AutoPtr<int> nbrecv1=new int[grpSize];
INTERP_KERNEL::AutoPtr<int> nbrecv2=new int[grpSize];
//
- int *tmp=0;
+ mcIdType *tmp=0;
serializeMatrixStep0ST(nbrecv,
tmp,nbsend2,nbsend3,
nbrecv1,nbrecv2);
- INTERP_KERNEL::AutoPtr<int> bigArr=tmp;
- INTERP_KERNEL::AutoPtr<int> bigArrRecv=new int[nbrecv2[grpSize-1]+nbrecv1[grpSize-1]];
- commInterface.allToAllV(bigArr,nbsend2,nbsend3,MPI_INT,
- bigArrRecv,nbrecv1,nbrecv2,MPI_INT,
+ INTERP_KERNEL::AutoPtr<mcIdType> bigArr=tmp;
+ INTERP_KERNEL::AutoPtr<mcIdType> bigArrRecv=new mcIdType[nbrecv2[grpSize-1]+nbrecv1[grpSize-1]];
+ commInterface.allToAllV(bigArr,nbsend2,nbsend3,MPI_ID_TYPE,
+ bigArrRecv,nbrecv1,nbrecv2,MPI_ID_TYPE,
*comm);// sending ids of sparse matrix (n+1 elems)
//second phase echange target ids
std::fill<int *>(nbsend2,nbsend2+grpSize,0);
INTERP_KERNEL::AutoPtr<int> nbrecv3=new int[grpSize];
INTERP_KERNEL::AutoPtr<int> nbrecv4=new int[grpSize];
double *tmp2=0;
- int lgthOfArr=serializeMatrixStep1ST(nbrecv,bigArrRecv,nbrecv1,nbrecv2,
+ mcIdType lgthOfArr=serializeMatrixStep1ST(nbrecv,bigArrRecv,nbrecv1,nbrecv2,
tmp,tmp2,
nbsend2,nbsend3,nbrecv3,nbrecv4);
- INTERP_KERNEL::AutoPtr<int> bigArr2=tmp;
+ INTERP_KERNEL::AutoPtr<mcIdType> bigArr2=tmp;
INTERP_KERNEL::AutoPtr<double> bigArrD2=tmp2;
- INTERP_KERNEL::AutoPtr<int> bigArrRecv2=new int[lgthOfArr];
+ INTERP_KERNEL::AutoPtr<mcIdType> bigArrRecv2=new mcIdType[lgthOfArr];
INTERP_KERNEL::AutoPtr<double> bigArrDRecv2=new double[lgthOfArr];
- commInterface.allToAllV(bigArr2,nbsend2,nbsend3,MPI_INT,
- bigArrRecv2,nbrecv3,nbrecv4,MPI_INT,
+ commInterface.allToAllV(bigArr2,nbsend2,nbsend3,MPI_ID_TYPE,
+ bigArrRecv2,nbrecv3,nbrecv4,MPI_ID_TYPE,
*comm);
commInterface.allToAllV(bigArrD2,nbsend2,nbsend3,MPI_DOUBLE,
bigArrDRecv2,nbrecv3,nbrecv4,MPI_DOUBLE,
/*!
* Compute denominators for ConvervativeVolumic interp.
*/
-void OverlapMapping::computeDenoConservativeVolumic(int nbOfTuplesTrg)
+void OverlapMapping::computeDenoConservativeVolumic(mcIdType nbOfTuplesTrg)
{
int myProcId=_group.myRank();
//
{
const std::vector< SparseDoubleVec >& mat=_the_matrix_st[i];
int curSrcId=_the_matrix_st_source_proc_id[i];
- map < int, MCAuto<DataArrayInt> >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId);
- int rowId=0;
+ map < int, MCAuto<DataArrayIdType> >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId);
+ mcIdType rowId=0;
if(isItem1==_sent_trg_ids.end() || curSrcId==myProcId) // Local computation: simple, because rowId of mat are directly target cell ids.
{
for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++)
}
else // matrix was received, remote computation
{
- const DataArrayInt *trgIds = (*isItem1).second;
- const int *trgIds2=trgIds->getConstPointer();
+ const DataArrayIdType *trgIds = (*isItem1).second;
+ const mcIdType *trgIds2=trgIds->getConstPointer();
for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++)
for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
deno[trgIds2[rowId]]+=(*it2).second;
// Broadcast the vector into a structure similar to the initial sparse matrix of numerators:
for(std::size_t i=0;i<sz1;i++)
{
- int rowId=0;
+ mcIdType rowId=0;
const std::vector< SparseDoubleVec >& mat=_the_matrix_st[i];
int curSrcId=_the_matrix_st_source_proc_id[i];
- map < int, MCAuto<DataArrayInt> >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId);
+ map < int, MCAuto<DataArrayIdType> >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId);
std::vector< SparseDoubleVec >& denoM=_the_deno_st[i];
denoM.resize(mat.size());
if(isItem1==_sent_trg_ids.end() || curSrcId==myProcId)//item1 of step2 main algo. Simple, because rowId of mat are directly target ids.
{
- int rowId=0;
+ mcIdType rowId=0;
for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++)
for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
denoM[rowId][(*it2).first]=deno[rowId];
}
else
{
- const DataArrayInt *trgIds = (*isItem1).second;
- const int *trgIds2=trgIds->getConstPointer();
+ const DataArrayIdType *trgIds = (*isItem1).second;
+ const mcIdType *trgIds2=trgIds->getConstPointer();
for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++)
for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
denoM[rowId][(*it2).first]=deno[trgIds2[rowId]];
* \param offsets tells for a proc i where to start serialize#0 matrix. size equal to _group.size().
* \param nbOfElemsSrc of size _group.size(). Comes from previous all2all call. tells how many srcIds per proc contains matrix for current proc.
*/
-void OverlapMapping::serializeMatrixStep0ST(const int *nbOfElemsSrc, int *&bigArr, int *count, int *offsets,
+void OverlapMapping::serializeMatrixStep0ST(const mcIdType *nbOfElemsSrc, mcIdType *&bigArr, int *count, int *offsets,
int *countForRecv, int *offsetsForRecv) const
{
- int grpSize=_group.size();
+ std::size_t grpSize=_group.size();
std::fill<int *>(count,count+grpSize,0);
- int szz=0;
+ std::size_t szz=0;
int myProcId=_group.myRank();
for(std::size_t i=0;i<_matrixes_st.size();i++)
{
if(_source_proc_id_st[i]==myProcId)// && _target_proc_id_st[i]!=myProcId
{
- count[_target_proc_id_st[i]]=_matrixes_st[i].size()+1;
+ count[_target_proc_id_st[i]]=(int)_matrixes_st[i].size()+1;
szz+=_matrixes_st[i].size()+1;
}
}
- bigArr=new int[szz];
+ bigArr=new mcIdType[szz];
offsets[0]=0;
- for(int i=1;i<grpSize;i++)
+ for(std::size_t i=1;i<grpSize;i++)
offsets[i]=offsets[i-1]+count[i-1];
for(std::size_t i=0;i<_matrixes_st.size();i++)
{
if(_source_proc_id_st[i]==myProcId)
{
- int start=offsets[_target_proc_id_st[i]];
- int *work=bigArr+start;
+ mcIdType start=offsets[_target_proc_id_st[i]];
+ mcIdType *work=bigArr+start;
*work=0;
const std::vector< SparseDoubleVec >& mat=_matrixes_st[i];
for(std::vector< SparseDoubleVec >::const_iterator it=mat.begin();it!=mat.end();it++,work++)
- work[1]=work[0]+(*it).size();
+ work[1]=work[0]+ToIdType((*it).size());
}
}
//
offsetsForRecv[0]=0;
- for(int i=0;i<grpSize;i++)
+ for(std::size_t i=0;i<grpSize;i++)
{
if(nbOfElemsSrc[i]>0)
- countForRecv[i]=nbOfElemsSrc[i]+1;
+ countForRecv[i]=(int)nbOfElemsSrc[i]+1;
else
countForRecv[i]=0;
if(i>0)
* This method performs step#1 and step#2/3. It returns the size of expected array to get allToAllV.
* It is where the locally computed matrices are serialized to be sent to adequate final proc.
*/
-int OverlapMapping::serializeMatrixStep1ST(const int *nbOfElemsSrc, const int *recvStep0, const int *countStep0, const int *offsStep0,
- int *&bigArrI, double *&bigArrD, int *count, int *offsets,
+mcIdType OverlapMapping::serializeMatrixStep1ST(const mcIdType *nbOfElemsSrc, const mcIdType *recvStep0, const int *countStep0, const int *offsStep0,
+ mcIdType *&bigArrI, double *&bigArrD, int *count, int *offsets,
int *countForRecv, int *offsForRecv) const
{
- int grpSize=_group.size();
+ std::size_t grpSize=_group.size();
int myProcId=_group.myRank();
offsForRecv[0]=0;
- int szz=0;
- for(int i=0;i<grpSize;i++)
+ mcIdType szz=0;
+ for(std::size_t i=0;i<grpSize;i++)
{
if(nbOfElemsSrc[i]!=0)
- countForRecv[i]=recvStep0[offsStep0[i]+nbOfElemsSrc[i]];
+ countForRecv[i]=(int)recvStep0[offsStep0[i]+nbOfElemsSrc[i]];
else
countForRecv[i]=0;
szz+=countForRecv[i];
//
std::fill(count,count+grpSize,0);
offsets[0]=0;
- int fullLgth=0;
+ std::size_t fullLgth=0;
for(std::size_t i=0;i<_matrixes_st.size();i++)
{
if(_source_proc_id_st[i]==myProcId)
{
const std::vector< SparseDoubleVec >& mat=_matrixes_st[i];
- int lgthToSend=0;
+ mcIdType lgthToSend=0;
for(std::vector< SparseDoubleVec >::const_iterator it=mat.begin();it!=mat.end();it++)
- lgthToSend+=(*it).size();
- count[_target_proc_id_st[i]]=lgthToSend;
+ lgthToSend+=ToIdType((*it).size());
+ count[_target_proc_id_st[i]]=(int)lgthToSend;
fullLgth+=lgthToSend;
}
}
- for(int i=1;i<grpSize;i++)
+ for(std::size_t i=1;i<grpSize;i++)
offsets[i]=offsets[i-1]+count[i-1];
//
- bigArrI=new int[fullLgth];
+ bigArrI=new mcIdType[fullLgth];
bigArrD=new double[fullLgth];
// feeding arrays
fullLgth=0;
const std::vector< SparseDoubleVec >& mat=_matrixes_st[i];
for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++)
{
- int j=0;
+ mcIdType j=0;
for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++,j++)
{
bigArrI[fullLgth+j]=(*it2).first;
* - The second is the pseudo id of source proc (correspondence with true id is in attribute _the_matrix_st_source_proc_id and _the_matrix_st_source_ids)
* - the third is the srcId in the pseudo source proc
*/
-void OverlapMapping::unserializationST(int nbOfTrgElems,
- const int *nbOfElemsSrcPerProc,//first all2all
- const int *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,//2nd all2all
- const int *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs)//3rd and 4th all2alls
+void OverlapMapping::unserializationST(mcIdType nbOfTrgElems,
+ const mcIdType *nbOfElemsSrcPerProc,//first all2all
+ const mcIdType *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,//2nd all2all
+ const mcIdType *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs)//3rd and 4th all2alls
{
_the_matrix_st.clear();
_the_matrix_st_source_proc_id.clear();
//
- int grpSize=_group.size();
- for(int i=0;i<grpSize;i++)
+ std::size_t grpSize=_group.size();
+ for(unsigned int i=0;i<grpSize;i++)
if(nbOfElemsSrcPerProc[i]!=0)
_the_matrix_st_source_proc_id.push_back(i);
- int nbOfPseudoProcs=_the_matrix_st_source_proc_id.size();//_the_matrix_st_target_proc_id.size() contains number of matrix fetched remotely whose sourceProcId==myProcId
+ std::size_t nbOfPseudoProcs=_the_matrix_st_source_proc_id.size();//_the_matrix_st_target_proc_id.size() contains number of matrix fetched remotely whose sourceProcId==myProcId
_the_matrix_st.resize(nbOfPseudoProcs);
//
- int j=0;
- for(int i=0;i<grpSize;i++)
+ std::size_t j=0;
+ for(std::size_t i=0;i<grpSize;i++)
if(nbOfElemsSrcPerProc[i]!=0)
{
_the_matrix_st[j].resize(nbOfElemsSrcPerProc[i]);
- for(int k=0;k<nbOfElemsSrcPerProc[i];k++)
+ for(mcIdType k=0;k<nbOfElemsSrcPerProc[i];k++)
{
- int offs=bigArrRecv[bigArrRecvOffs[i]+k];
- int lgthOfMap=bigArrRecv[bigArrRecvOffs[i]+k+1]-offs;
- for(int l=0;l<lgthOfMap;l++)
+ mcIdType offs=bigArrRecv[bigArrRecvOffs[i]+k];
+ mcIdType lgthOfMap=bigArrRecv[bigArrRecvOffs[i]+k+1]-offs;
+ for(mcIdType l=0;l<lgthOfMap;l++)
_the_matrix_st[j][k][bigArrRecv2[bigArrRecv2Offs[i]+offs+l]]=bigArrDRecv2[bigArrRecv2Offs[i]+offs+l];
}
j++;
void OverlapMapping::finishToFillFinalMatrixST()
{
int myProcId=_group.myRank();
- int sz=_matrixes_st.size();
+ std::size_t sz=_matrixes_st.size();
int nbOfEntryToAdd=0;
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
if(_source_proc_id_st[i]!=myProcId)
nbOfEntryToAdd++;
if(nbOfEntryToAdd==0)
return ;
- int oldNbOfEntry=_the_matrix_st.size();
- int newNbOfEntry=oldNbOfEntry+nbOfEntryToAdd;
+ std::size_t oldNbOfEntry=_the_matrix_st.size();
+ std::size_t newNbOfEntry=oldNbOfEntry+nbOfEntryToAdd;
_the_matrix_st.resize(newNbOfEntry);
- int j=oldNbOfEntry;
- for(int i=0;i<sz;i++)
+ std::size_t j=oldNbOfEntry;
+ for(std::size_t i=0;i<sz;i++)
if(_source_proc_id_st[i]!=myProcId)
{
const std::vector<SparseDoubleVec >& mat=_matrixes_st[i];
{
using namespace std;
- int nbOfCompo=fieldInput->getNumberOfComponents();//to improve same number of components to test
+ std::size_t nbOfCompo=fieldInput->getNumberOfComponents();//to improve same number of components to test
CommInterface commInterface=_group.getCommInterface();
const MPIProcessorGroup *group=static_cast<const MPIProcessorGroup*>(&_group);
const MPI_Comm *comm=group->getComm();
MCAuto<DataArrayDouble> vals;
if(_locator.isInMyTodoList(myProcID, procID))
{
- map<int, vector<int> >::const_iterator isItem11 = _src_ids_zip_comp.find(procID);
+ map<int, vector<mcIdType> >::const_iterator isItem11 = _src_ids_zip_comp.find(procID);
if (isItem11 == _src_ids_zip_comp.end())
throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: SEND: unexpected end iterator in _src_ids_zip_comp!");
- const vector<int> & v = (*isItem11).second;
- int sz = v.size();
+ const vector<mcIdType> & v = (*isItem11).second;
+ std::size_t sz = v.size();
vals=fieldInput->getArray()->selectByTupleId(&(v[0]),&(v[0])+sz);
}
else
{
- map < int, MCAuto<DataArrayInt> >::const_iterator isItem11 = _sent_src_ids.find( procID );
+ map < int, MCAuto<DataArrayIdType> >::const_iterator isItem11 = _sent_src_ids.find( procID );
if (isItem11 == _sent_src_ids.end())
throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: SEND: unexpected end iterator in _sent_src_ids!");
vals=fieldInput->getArray()->selectByTupleId(*(*isItem11).second);
}
- nbsend[procID] = vals->getNbOfElems();
+ nbsend[procID] = (int)vals->getNbOfElems();
valsToSend.insert(valsToSend.end(),vals->getConstPointer(),vals->getConstPointer()+nbsend[procID]);
}
{
if(_locator.isInMyTodoList(procID, myProcID))
{
- map <int,int>::const_iterator isItem11 = _nb_of_rcv_src_ids.find(procID);
+ map <int,mcIdType>::const_iterator isItem11 = _nb_of_rcv_src_ids.find(procID);
if (isItem11 == _nb_of_rcv_src_ids.end())
throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: RCV: unexpected end iterator in _nb_of_rcv_src_ids!");
- nbrecv[procID] = (*isItem11).second;
+ nbrecv[procID] = (int)((*isItem11).second);
}
else
{
- map<int, vector<int> >::const_iterator isItem11 = _src_ids_zip_recv.find(procID);
+ map<int, vector<mcIdType> >::const_iterator isItem11 = _src_ids_zip_recv.find(procID);
if (isItem11 == _src_ids_zip_recv.end())
throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: RCV: unexpected end iterator in _src_ids_zip_recv!");
- nbrecv[procID] = (*isItem11).second.size()*nbOfCompo;
+ nbrecv[procID] = (int)((*isItem11).second.size()*nbOfCompo);
}
}
}
// For each source processor corresponding to a locally held matrix:
{
int srcProcID = *itProc;
- int id = distance(_the_matrix_st_source_proc_id.begin(),itProc);
+ std::size_t id = std::distance(_the_matrix_st_source_proc_id.begin(),itProc);
const vector< SparseDoubleVec >& mat =_the_matrix_st[id];
const vector< SparseDoubleVec >& deno = _the_deno_st[id];
*/
if (srcProcID == myProcID)
{
- int nbOfTrgTuples=mat.size();
+ std::size_t nbOfTrgTuples=mat.size();
double * targetBase = fieldOutput->getArray()->getPointer();
- for(int j=0; j<nbOfTrgTuples; j++)
+ for(std::size_t j=0; j<nbOfTrgTuples; j++)
{
const SparseDoubleVec& mat1=mat[j];
const SparseDoubleVec& deno1=deno[j];
if(!_locator.isInMyTodoList(srcProcID, myProcID))
{
// invert _src_ids_zip_recv
- map<int,int> revert_zip;
- map<int, vector<int> >::const_iterator it11= _src_ids_zip_recv.find(srcProcID);
+ map<mcIdType,int> revert_zip;
+ map<int, vector<mcIdType> >::const_iterator it11= _src_ids_zip_recv.find(srcProcID);
if (it11 == _src_ids_zip_recv.end())
throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: MULTIPLY: unexpected end iterator in _src_ids_zip_recv!");
- const vector<int> & vec = (*it11).second;
+
+ const vector<mcIdType> & vec = (*it11).second;
int newId=0;
- for(vector<int>::const_iterator it=vec.begin();it!=vec.end();it++,newId++)
+ for(vector<mcIdType>::const_iterator it=vec.begin();it!=vec.end();it++,newId++)
revert_zip[*it]=newId;
- map < int, MCAuto<DataArrayInt> >::const_iterator isItem24 = _sent_trg_ids.find(srcProcID);
+ map < int, MCAuto<DataArrayIdType> >::const_iterator isItem24 = _sent_trg_ids.find(srcProcID);
if (isItem24 == _sent_trg_ids.end())
throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: MULTIPLY: unexpected end iterator in _sent_trg_ids!");
- const DataArrayInt *tgrIdsDA = (*isItem24).second;
- const int *tgrIds = tgrIdsDA->getConstPointer();
+ const DataArrayIdType *tgrIdsDA = (*isItem24).second;
+ const mcIdType *tgrIds = tgrIdsDA->getConstPointer();
- int nbOfTrgTuples=mat.size();
+ std::size_t nbOfTrgTuples=mat.size();
double * targetBase = fieldOutput->getArray()->getPointer();
- for(int j=0;j<nbOfTrgTuples;j++)
+ for(std::size_t j=0;j<nbOfTrgTuples;j++)
{
const SparseDoubleVec& mat1=mat[j];
const SparseDoubleVec& deno1=deno[j];
double * targetPt = targetBase+tgrIds[j]*nbOfCompo;
for(SparseDoubleVec::const_iterator it3=mat1.begin();it3!=mat1.end();it3++,it5++)
{
- map<int,int>::const_iterator it4=revert_zip.find((*it3).first);
+ map<mcIdType,int>::const_iterator it4=revert_zip.find((*it3).first);
if(it4==revert_zip.end())
throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: MULTIPLY: unexpected end iterator in revert_zip!");
double ratio = (*it3).second/(*it5).second;
*/
{
// Same loop as in the case srcProcID == myProcID, except that instead of working on local field data, we work on bigArr
- int nbOfTrgTuples=mat.size();
+ std::size_t nbOfTrgTuples=mat.size();
double * targetBase = fieldOutput->getArray()->getPointer();
- for(int j=0;j<nbOfTrgTuples;j++)
+ for(std::size_t j=0;j<nbOfTrgTuples;j++)
{
const SparseDoubleVec& mat1=mat[j];
const SparseDoubleVec& deno1=deno[j];
CommInterface commInterface=_group.getCommInterface();
int myProcId=_group.myRank();
- int nbOfMatrixRecveived=_the_matrix_st_source_proc_id.size();
- for(int i=0;i<nbOfMatrixRecveived;i++)
+ std::size_t nbOfMatrixRecveived=_the_matrix_st_source_proc_id.size();
+ for(std::size_t i=0;i<nbOfMatrixRecveived;i++)
{
int curSrcProcId=_the_matrix_st_source_proc_id[i];
if(curSrcProcId!=myProcId) // if =, data has been populated by addContributionST()
{
const std::vector< SparseDoubleVec >& mat=_the_matrix_st[i];
- std::set<int> s;
+ std::set<mcIdType> s;
for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++)
for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
s.insert((*it2).first);
- vector<int> vec(s.begin(),s.end());
+ vector<mcIdType> vec(s.begin(),s.end());
_src_ids_zip_recv[curSrcProcId] = vec;
}
}
class MEDCouplingFieldDouble;
using namespace std;
- typedef map<int,double> SparseDoubleVec;
+ typedef map<mcIdType,double> SparseDoubleVec;
/*!
* Internal class, not part of the public API.
public:
OverlapMapping(const ProcessorGroup& group, const OverlapElementLocator& locator);
- void keepTracksOfSourceIds(int procId, DataArrayInt *ids);
- void keepTracksOfTargetIds(int procId, DataArrayInt *ids);
- void addContributionST(const vector< SparseDoubleVec >& matrixST, const DataArrayInt *srcIds, int srcProcId, const DataArrayInt *trgIds, int trgProcId);
- void prepare(const vector< int >& procsToSendField, int nbOfTrgElems);
- void computeDenoConservativeVolumic(int nbOfTuplesTrg);
+ void keepTracksOfSourceIds(int procId, DataArrayIdType *ids);
+ void keepTracksOfTargetIds(int procId, DataArrayIdType *ids);
+ void addContributionST(const vector< SparseDoubleVec >& matrixST, const DataArrayIdType *srcIds, int srcProcId, const DataArrayIdType *trgIds, int trgProcId);
+ void prepare(const vector< int >& procsToSendField, mcIdType nbOfTrgElems);
+ void computeDenoConservativeVolumic(mcIdType nbOfTuplesTrg);
// void computeDenoIntegralGlobConstraint();
// void computeDenoIntegral();
void computeDenoRevIntegral(const DataArrayDouble & targetAreas);
void multiply(const MEDCouplingFieldDouble *fieldInput, MEDCouplingFieldDouble *fieldOutput, double default_val) const;
void transposeMultiply(const MEDCouplingFieldDouble *fieldInput, MEDCouplingFieldDouble *fieldOutput);
private:
- void serializeMatrixStep0ST(const int *nbOfElemsSrc, int *&bigArr, int *count, int *offsets,
+ void serializeMatrixStep0ST(const mcIdType *nbOfElemsSrc, mcIdType *&bigArr, int *count, int *offsets,
int *countForRecv, int *offsetsForRecv) const;
- int serializeMatrixStep1ST(const int *nbOfElemsSrc, const int *recvStep0, const int *countStep0, const int *offsStep0,
- int *&bigArrI, double *&bigArrD, int *count, int *offsets,
+ mcIdType serializeMatrixStep1ST(const mcIdType *nbOfElemsSrc, const mcIdType *recvStep0, const int *countStep0, const int *offsStep0,
+ mcIdType *&bigArrI, double *&bigArrD, int *count, int *offsets,
int *countForRecv, int *offsForRecv) const;
- void unserializationST(int nbOfTrgElems, const int *nbOfElemsSrcPerProc, const int *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,
- const int *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs);
+ void unserializationST(mcIdType nbOfTrgElems, const mcIdType *nbOfElemsSrcPerProc, const mcIdType *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,
+ const mcIdType *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs);
void finishToFillFinalMatrixST();
void fillSourceIdsZipReceivedForMultiply();
* gives an old2new map for the local part of the source mesh that has been sent to proc#i, just based on the
* bounding box computation (this is potentially a larger set than what is finally in the interp matrix).
* Second member gives proc ID. */
- map < int, MCAuto<DataArrayInt> > _sent_src_ids;
+ map < int, MCAuto<DataArrayIdType> > _sent_src_ids;
//! See _sent_src_ids. Same for target mesh.
- map < int, MCAuto<DataArrayInt> > _sent_trg_ids;
+ map < int, MCAuto<DataArrayIdType> > _sent_trg_ids;
/**! Vector of matrixes (partial interpolation ratios), result of the LOCAL interpolator run.
* Indexing shared with _source_proc_id_st, and _target_proc_id_st. */
/**! Number of received source mesh IDs at mesh data exchange.
Counting the number of IDs suffices, as we just need this to prepare the receive side, when doing the final vector matrix multiplication.
First dimension is the remote proc ID from which we received. */
- map <int, int > _nb_of_rcv_src_ids;
+ map <int, mcIdType > _nb_of_rcv_src_ids;
/**! Specifies for each (target) remote proc ID (first dim of the map) the corresponding
* source cell IDs to use.
* This information is stored from the *locally* COMPuted matrices, and corresponds hence to field value that will need to
* sent later on, if this matrix bit itself is sent aways. */
- map<int, vector<int> > _src_ids_zip_comp;
+ map<int, vector<mcIdType> > _src_ids_zip_comp;
/**! Same idea as _src_ids_zip_comp above, but for RECEIVED matrix. */
- map<int, vector<int> > _src_ids_zip_recv;
+ map<int, vector<mcIdType> > _src_ids_zip_recv;
/**! THE matrix for matrix-vector product. The first dimension is indexed in the set of target procs
* that interacts with local source mesh. The second dim is the target cell ID.
*/
ParaFIELD::ParaFIELD(MEDCouplingFieldDouble* subdomain_field, ParaMESH *sup, const ProcessorGroup& proc_group):
_field(subdomain_field),
- _component_topology(ComponentTopology(_field->getNumberOfComponents())),_topology(0),_own_support(false),
+ _component_topology(ComponentTopology((int)_field->getNumberOfComponents())),_topology(0),_own_support(false),
_support(sup)
{
if(_field)
* For example if _field is a nodal field : returned array will be the nodal global numbers.
* The content of this method is used to inform Working side to accumulate data received by lazy side.
*/
- DataArrayInt* ParaFIELD::returnCumulativeGlobalNumbering() const
+ DataArrayIdType* ParaFIELD::returnCumulativeGlobalNumbering() const
{
if(!_field)
return 0;
}
}
- DataArrayInt* ParaFIELD::returnGlobalNumbering() const
+ DataArrayIdType* ParaFIELD::returnGlobalNumbering() const
{
if(!_field)
return 0;
#include "MEDCouplingRefCountObject.hxx"
#include "ComponentTopology.hxx"
+#include "MCType.hxx"
namespace MEDCoupling
{
void synchronizeSource( MEDCoupling::ParaFIELD* target_field);
MEDCouplingFieldDouble* getField() const { return _field; }
void setOwnSupport(bool v) const { _own_support=v; }
- DataArrayInt* returnCumulativeGlobalNumbering() const;
- DataArrayInt* returnGlobalNumbering() const;
+ DataArrayIdType* returnCumulativeGlobalNumbering() const;
+ DataArrayIdType* returnGlobalNumbering() const;
Topology* getTopology() const { return _topology; }
ParaMESH* getSupport() const { return _support; }
int nbComponents() const;
--- /dev/null
+// Copyright (C) 2007-2019 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, or (at your option) any later version.
+//
+// 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
+//
+
+#ifndef __ParaIdType_HXX__
+#define __ParaIdType_HXX__
+
+#include <mpi.h>
+
+#ifndef MEDCOUPLING_USE_64BIT_IDS
+#define MPI_ID_TYPE MPI_INT
+#else
+#define MPI_ID_TYPE MPI_LONG
+#endif
+
+#endif
namespace MEDCoupling
{
ParaMESH::ParaMESH( MEDCouplingPointSet *subdomain_mesh, MEDCouplingPointSet *subdomain_face,
- DataArrayInt *CorrespElt_local2global, DataArrayInt *CorrespFace_local2global,
- DataArrayInt *CorrespNod_local2global, const ProcessorGroup& proc_group ):
+ DataArrayIdType *CorrespElt_local2global, DataArrayIdType *CorrespFace_local2global,
+ DataArrayIdType *CorrespNod_local2global, const ProcessorGroup& proc_group ):
_cell_mesh(subdomain_mesh),
_face_mesh(subdomain_face),
_my_domain_id(proc_group.myRank()),
{
if(_cell_mesh)
_cell_mesh->incrRef();
- int nb_elem=mesh->getNumberOfCells();
+ mcIdType nb_elem=mesh->getNumberOfCells();
_explicit_topology=new BlockTopology(proc_group,nb_elem);
- int nbOfCells=mesh->getNumberOfCells();
- _cell_global = DataArrayInt::New();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
+ _cell_global = DataArrayIdType::New();
_cell_global->alloc(nbOfCells,1);
- int *cellglobal=_cell_global->getPointer();
- int offset = _block_topology->localToGlobal(make_pair(_my_domain_id,0));
- for (int i=0; i<nbOfCells; i++)
+ mcIdType *cellglobal=_cell_global->getPointer();
+ mcIdType offset = _block_topology->localToGlobal(make_pair(_my_domain_id,0));
+ for (mcIdType i=0; i<nbOfCells; i++)
{
cellglobal[i]=offset+i;
}
}
- void ParaMESH::setNodeGlobal(DataArrayInt *nodeGlobal)
+ void ParaMESH::setNodeGlobal(DataArrayIdType *nodeGlobal)
{
if(nodeGlobal!=_node_global)
{
}
}
- void ParaMESH::setCellGlobal(DataArrayInt *cellGlobal)
+ void ParaMESH::setCellGlobal(DataArrayIdType *cellGlobal)
{
if(cellGlobal!=_cell_global)
{
const ProcessorGroup& proc_group, const std::string& name);
ParaMESH( MEDCouplingPointSet *subdomain_mesh,
MEDCouplingPointSet *subdomain_face,
- DataArrayInt *CorrespElt_local2global,
- DataArrayInt *CorrespFace_local2global,
- DataArrayInt *CorrespNod_local2global,
+ DataArrayIdType *CorrespElt_local2global,
+ DataArrayIdType *CorrespFace_local2global,
+ DataArrayIdType *CorrespNod_local2global,
const ProcessorGroup& proc_group ) ;
virtual ~ParaMESH();
- void setNodeGlobal(DataArrayInt *nodeGlobal);
- void setCellGlobal(DataArrayInt *cellGlobal);
+ void setNodeGlobal(DataArrayIdType *nodeGlobal);
+ void setCellGlobal(DataArrayIdType *cellGlobal);
Topology* getTopology() const { return _explicit_topology; }
bool isStructured() const { return _cell_mesh->isStructured(); }
MEDCouplingPointSet *getCellMesh() const { return _cell_mesh; }
MEDCouplingPointSet *getFaceMesh() const { return _face_mesh; }
BlockTopology* getBlockTopology() const { return _block_topology; }
- DataArrayInt* getGlobalNumberingNodeDA() const { if(_node_global) _node_global->incrRef(); return _node_global; }
- DataArrayInt* getGlobalNumberingFaceDA() const { if(_face_global) _face_global->incrRef(); return _face_global; }
- DataArrayInt* getGlobalNumberingCellDA() const { if(_cell_global) _cell_global->incrRef(); return _cell_global; }
- const int* getGlobalNumberingNode() const { if(_node_global) return _node_global->getConstPointer(); return 0; }
- const int* getGlobalNumberingFace() const { if(_face_global) return _face_global->getConstPointer(); return 0; }
- const int* getGlobalNumberingCell() const { if(_cell_global) return _cell_global->getConstPointer(); return 0; }
+ DataArrayIdType* getGlobalNumberingNodeDA() const { if(_node_global) _node_global->incrRef(); return _node_global; }
+ DataArrayIdType* getGlobalNumberingFaceDA() const { if(_face_global) _face_global->incrRef(); return _face_global; }
+ DataArrayIdType* getGlobalNumberingCellDA() const { if(_cell_global) _cell_global->incrRef(); return _cell_global; }
+ const mcIdType* getGlobalNumberingNode() const { if(_node_global) return _node_global->getConstPointer(); return 0; }
+ const mcIdType* getGlobalNumberingFace() const { if(_face_global) return _face_global->getConstPointer(); return 0; }
+ const mcIdType* getGlobalNumberingCell() const { if(_cell_global) return _cell_global->getConstPointer(); return 0; }
private:
//mesh object underlying the ParaMESH object
MEDCoupling::BlockTopology* _block_topology;
Topology* _explicit_topology;
// pointers to global numberings
- DataArrayInt* _node_global;
- DataArrayInt* _face_global;
- DataArrayInt* _cell_global;
+ DataArrayIdType* _node_global;
+ DataArrayIdType* _face_global;
+ DataArrayIdType* _cell_global;
};
}
virtual void intersect (ProcessorGroup&) = 0;
bool contains(int rank) const { return _proc_ids.find(rank)!=_proc_ids.end(); }
virtual bool containsMyRank() const = 0;
- int size() const { return _proc_ids.size(); }
+ int size() const { return (int)_proc_ids.size(); }
const CommInterface& getCommInterface()const { return _comm_interface; }
virtual int myRank() const = 0;
virtual int translateRank(const ProcessorGroup*, int) const = 0;
int myranksource = _topo_source->getProcGroup()->myRank();
- vector <int>* target_arrays=new vector<int>[_topo_target->getProcGroup()->size()];
+ vector <mcIdType>* target_arrays=new vector<mcIdType>[_topo_target->getProcGroup()->size()];
//cout<<" topotarget size"<< _topo_target->getProcGroup()->size()<<endl;
- int nb_local = _topo_source-> getNbLocalElements();
- for (int ielem=0; ielem< nb_local ; ielem++)
+ mcIdType nb_local = _topo_source-> getNbLocalElements();
+ for (mcIdType ielem=0; ielem< nb_local ; ielem++)
{
// cout <<"source local :"<<myranksource<<","<<ielem<<endl;
- int global = _topo_source->localToGlobal(make_pair(myranksource, ielem));
+ mcIdType global = _topo_source->localToGlobal(make_pair(myranksource, ielem));
// cout << "global "<<global<<endl;
- pair<int,int> target_local =_topo_target->globalToLocal(global);
+ pair<int,mcIdType> target_local =_topo_target->globalToLocal(global);
// cout << "target local : "<<target_local.first<<","<<target_local.second<<endl;
target_arrays[target_local.first].push_back(target_local.second);
}
- int union_size=group->size();
+ std::size_t union_size=group->size();
_send_counts=new int[union_size];
_send_displs=new int[union_size];
_recv_counts=new int[union_size];
_recv_displs=new int[union_size];
- for (int i=0; i< union_size; i++)
+ for (std::size_t i=0; i< union_size; i++)
{
_send_counts[i]=0;
_recv_counts[i]=0;
{
//converts the rank in target to the rank in union communicator
int unionrank=group->translateRank(_topo_target->getProcGroup(),iproc);
- _send_counts[unionrank]=target_arrays[iproc].size();
+ _send_counts[unionrank]=(int)target_arrays[iproc].size();
}
for (int iproc=1; iproc<group->size();iproc++)
int* counter=new int [_topo_target->getProcGroup()->size()];
counter[0]=0;
for (int i=1; i<_topo_target->getProcGroup()->size(); i++)
- counter[i]=counter[i-1]+target_arrays[i-1].size();
+ counter[i]=counter[i-1]+(int)target_arrays[i-1].size();
const double* value = _local_field->getField()->getArray()->getPointer();
//cout << "Nb local " << nb_local<<endl;
for (int ielem=0; ielem<nb_local ; ielem++)
{
- int global = _topo_source->localToGlobal(make_pair(myranksource, ielem));
- pair<int,int> target_local =_topo_target->globalToLocal(global);
+ mcIdType global = _topo_source->localToGlobal(make_pair(myranksource, ielem));
+ pair<int,mcIdType> target_local =_topo_target->globalToLocal(global);
//cout <<"global : "<< global<<" local :"<<target_local.first<<" "<<target_local.second;
//cout <<"counter[]"<<counter[target_local.first]<<endl;
_send_buffer[counter[target_local.first]++]=value[ielem];
int myranktarget = _topo_target->getProcGroup()->myRank();
- vector < vector <int> > source_arrays(_topo_source->getProcGroup()->size());
- int nb_local = _topo_target-> getNbLocalElements();
- for (int ielem=0; ielem< nb_local ; ielem++)
+ vector < vector <mcIdType> > source_arrays(_topo_source->getProcGroup()->size());
+ mcIdType nb_local = _topo_target-> getNbLocalElements();
+ for (mcIdType ielem=0; ielem< nb_local ; ielem++)
{
// cout <<"TS target local :"<<myranktarget<<","<<ielem<<endl;
- int global = _topo_target->localToGlobal(make_pair(myranktarget, ielem));
+ mcIdType global = _topo_target->localToGlobal(make_pair(myranktarget, ielem));
//cout << "TS global "<<global<<endl;
- pair<int,int> source_local =_topo_source->globalToLocal(global);
+ pair<int,mcIdType> source_local =_topo_source->globalToLocal(global);
// cout << "TS source local : "<<source_local.first<<","<<source_local.second<<endl;
source_arrays[source_local.first].push_back(source_local.second);
}
- int union_size=group->size();
+ std::size_t union_size=group->size();
_recv_counts=new int[union_size];
_recv_displs=new int[union_size];
_send_counts=new int[union_size];
_send_displs=new int[union_size];
- for (int i=0; i< union_size; i++)
+ for (std::size_t i=0; i< union_size; i++)
{
_send_counts[i]=0;
_recv_counts[i]=0;
{
//converts the rank in target to the rank in union communicator
int unionrank=group->translateRank(_topo_source->getProcGroup(),iproc);
- _recv_counts[unionrank]=source_arrays[iproc].size();
+ _recv_counts[unionrank]=(int)source_arrays[iproc].size();
}
- for (int i=1; i<union_size; i++)
+ for (std::size_t i=1; i<union_size; i++)
_recv_displs[i]=_recv_displs[i-1]+_recv_counts[i-1];
_recv_buffer=new double[nb_local];
{
MPI_Status status;
- int* serializer=0;
- int size;
+ mcIdType* serializer=0;
+ mcIdType size;
MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface);
MESSAGE(" rank "<<group->myRank()<< "received master rank"<<rank_master);
}
// The topology is broadcasted to all processors in the group
- _comm_interface->broadcast(&size, 1,MPI_INT,rank_master,*(group->getComm()));
+ _comm_interface->broadcast(&size, 1,MPI_ID_TYPE,rank_master,*(group->getComm()));
- int* buffer=new int[size];
+ mcIdType* buffer=new mcIdType[size];
if (topo!=0 && topo->getProcGroup()->myRank()==0)
copy(serializer, serializer+size, buffer);
- _comm_interface->broadcast(buffer,size,MPI_INT,rank_master,*(group->getComm()));
+ _comm_interface->broadcast(buffer,(int)size,MPI_ID_TYPE,rank_master,*(group->getComm()));
// Processors which did not possess the source topology
// unserialize it
_recv_buffer, _recv_counts, _recv_displs, MPI_DOUBLE,comm);
cout<<"end AllToAll"<<endl;
- int nb_local = _topo_target->getNbLocalElements();
+ mcIdType nb_local = _topo_target->getNbLocalElements();
//double* value=new double[nb_local];
double* value=const_cast<double*>(_local_field->getField()->getArray()->getPointer());
delete group;
}
- for (int ielem=0; ielem<nb_local ; ielem++)
+ for (mcIdType ielem=0; ielem<nb_local ; ielem++)
{
- int global = _topo_target->localToGlobal(make_pair(myranktarget, ielem));
- pair<int,int> source_local =_topo_source->globalToLocal(global);
+ mcIdType global = _topo_target->localToGlobal(make_pair(myranktarget, ielem));
+ pair<int,mcIdType> source_local =_topo_source->globalToLocal(global);
value[ielem]=_recv_buffer[counters[source_local.first]++];
}
#ifndef __TOPOLOGY_HXX__
#define __TOPOLOGY_HXX__
+#include "MCType.hxx"
+
namespace MEDCoupling
{
class ProcessorGroup;
public:
Topology() { }
virtual ~Topology() { }
- virtual int getNbElements() const = 0;
- virtual int getNbLocalElements() const = 0;
+ virtual mcIdType getNbElements() const = 0;
+ virtual mcIdType getNbLocalElements() const = 0;
virtual const ProcessorGroup* getProcGroup()const = 0;
};
}
const double sourceCoordsAll[2][8]={{0.4,0.5,0.4,1.5,1.6,1.5,1.6,0.5},
{0.3,-0.5,1.6,-0.5,1.6,-1.5,0.3,-1.5}};
- int conn4All[8]={0,1,2,3,4,5,6,7};
+ mcIdType conn4All[8]={0,1,2,3,4,5,6,7};
std::ostringstream stream; stream << "sourcemesh2D proc " << grank;
mesh=MEDCouplingUMesh::New(stream.str().c_str(),2);
const double targetCoordsAll[3][16]={{0.7,1.45,0.7,1.65,0.9,1.65,0.9,1.45, 1.1,1.4,1.1,1.6,1.3,1.6,1.3,1.4},
{0.7,-0.6,0.7,0.7,0.9,0.7,0.9,-0.6, 1.1,-0.7,1.1,0.6,1.3,0.6,1.3,-0.7},
{0.7,-1.55,0.7,-1.35,0.9,-1.35,0.9,-1.55, 1.1,-1.65,1.1,-1.45,1.3,-1.45,1.3,-1.65}};
- int conn4All[8]={0,1,2,3,4,5,6,7};
+ mcIdType conn4All[8]={0,1,2,3,4,5,6,7};
double targetResults[3][2]={{34.,34.},{38.333333333333336,42.666666666666664},{47.,47.}};
std::ostringstream stream; stream << "targetmesh2D proc " << grank-(gsize-lsize);
CommInterface interface;
MPIProcessorGroup group(interface);
BlockTopology blocktopo(group,1);
- CPPUNIT_ASSERT_EQUAL(1,blocktopo.getNbLocalElements());
- CPPUNIT_ASSERT_EQUAL(size,blocktopo.getNbElements());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),blocktopo.getNbLocalElements());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(size),blocktopo.getNbElements());
CPPUNIT_ASSERT_EQUAL(1,blocktopo.getDimension());
//checking access methods
global=blocktopo2.localToGlobal(local);
CPPUNIT_ASSERT_EQUAL(global,2*size-1);
- std::vector<std::pair<int,int> > bounds = blocktopo2.getLocalArrayMinMax();
+ std::vector<std::pair<int,mcIdType> > bounds = blocktopo2.getLocalArrayMinMax();
int vecsize = bounds.size();
CPPUNIT_ASSERT_EQUAL(1,vecsize);
CPPUNIT_ASSERT_EQUAL(2*rank, (bounds[0]).first);
- CPPUNIT_ASSERT_EQUAL(2*rank+2, (bounds[0]).second);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2*rank+2), (bounds[0]).second);
}
void ParaMEDMEMTest::testBlockTopology_serialize()
//testing the serialization process that is used to transfer a
//block topology via a MPI_Send/Recv comm
BlockTopology blocktopo_recv;
- int* serializer;
- int sersize;
+ mcIdType* serializer;
+ mcIdType sersize;
blocktopo.serialize(serializer,sersize);
blocktopo_recv.unserialize(serializer,interface);
CPPUNIT_ASSERT_EQUAL(blocktopo.getNbElements(),blocktopo_recv.getNbElements());
std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
mesh->setCoords(myCoords);
myCoords->decrRef();
- int targetConn[4]={0,2,3,1};
+ mcIdType targetConn[4]={0,2,3,1};
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn);
mesh->finishInsertingCells();
std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
mesh->setCoords(myCoords);
myCoords->decrRef();
- int targetConn[6]={0,2,1,2,3,1};
+ mcIdType targetConn[6]={0,2,1,2,3,1};
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3);
std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
mesh->setCoords(myCoords);
myCoords->decrRef();
- int targetConn[4]={0,2,3,1};
+ mcIdType targetConn[4]={0,2,3,1};
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn);
mesh->finishInsertingCells();
std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
mesh->setCoords(myCoords);
myCoords->decrRef();
- int targetConn[6]={0,2,1,2,3,1};
+ mcIdType targetConn[6]={0,2,1,2,3,1};
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3);
const double dataCoo[24]={0,0,0,1,0,0,0,0,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,1};
coo->alloc(8,3);
std::copy(dataCoo,dataCoo+24,coo->getPointer());
- const int conn[8]={0,1,3,2,4,5,7,6};
+ const mcIdType conn[8]={0,1,3,2,4,5,7,6};
m->allocateCells(2);
m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+4);
const double dataCoo[24]={0,0,0,1,0,0,0,0,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,1};
coo->alloc(8,3);
std::copy(dataCoo,dataCoo+24,coo->getPointer());
- const int conn[12]={0,1,2,1,2,3,4,5,7,4,6,7};
+ const mcIdType conn[12]={0,1,2,1,2,3,4,5,7,4,6,7};
m->allocateCells(2);
for(int i=0;i<4;i++)
m->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3*i);
std::copy(cooData,cooData+189,arr->getPointer());
mesh->setCoords(arr);
mesh->allocateCells(80);
- const int conn[240]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,2,1,31,5,4,32,8,7,33,11,10,34,14,13,35,17,16,36,20,19,37,23,22,38,26,25,39,29,28,30,40,2,31,41,5,32,42,8,33,43,11,34,44,14,35,45,17,36,46,20,37,47,23,38,48,26,39,49,29,31,2,40,32,5,41,33,8,42,34,11,43,35,14,44,36,17,45,37,20,46,38,23,47,39,26,48,50,29,49,3,2,4,6,5,7,9,8,10,12,11,13,15,14,16,18,17,19,21,20,22,24,23,25,27,26,28,51,29,52,31,4,2,32,7,5,33,10,8,34,13,11,35,16,14,36,19,17,37,22,20,38,25,23,39,28,26,50,52,29,0,2,53,3,5,54,6,8,55,9,11,56,12,14,57,15,17,58,18,20,59,21,23,60,24,26,61,27,29,62,3,53,2,6,54,5,9,55,8,12,56,11,15,57,14,18,58,17,21,59,20,24,60,23,27,61,26,51,62,29};
+ const mcIdType conn[240]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,2,1,31,5,4,32,8,7,33,11,10,34,14,13,35,17,16,36,20,19,37,23,22,38,26,25,39,29,28,30,40,2,31,41,5,32,42,8,33,43,11,34,44,14,35,45,17,36,46,20,37,47,23,38,48,26,39,49,29,31,2,40,32,5,41,33,8,42,34,11,43,35,14,44,36,17,45,37,20,46,38,23,47,39,26,48,50,29,49,3,2,4,6,5,7,9,8,10,12,11,13,15,14,16,18,17,19,21,20,22,24,23,25,27,26,28,51,29,52,31,4,2,32,7,5,33,10,8,34,13,11,35,16,14,36,19,17,37,22,20,38,25,23,39,28,26,50,52,29,0,2,53,3,5,54,6,8,55,9,11,56,12,14,57,15,17,58,18,20,59,21,23,60,24,26,61,27,29,62,3,53,2,6,54,5,9,55,8,12,56,11,15,57,14,18,58,17,21,59,20,24,60,23,27,61,26,51,62,29};
for(int i=0;i<80;i++)
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3*i);
MCAuto<MEDCouplingFieldDouble> f(MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME));
std::copy(cooData,cooData+66,arr->getPointer());
mesh->setCoords(arr);
mesh->allocateCells(10);
- const int conn[40]={0,1,3,2,2,3,5,4,4,5,7,6,6,7,9,8,8,9,11,10,10,11,13,12,12,13,15,14,14,15,17,16,16,17,19,18,18,19,21,20};
+ const mcIdType conn[40]={0,1,3,2,2,3,5,4,4,5,7,6,6,7,9,8,8,9,11,10,10,11,13,12,12,13,15,14,14,15,17,16,16,17,19,18,18,19,21,20};
for(int i=0;i<10;i++)
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+4*i);
MCAuto<MEDCouplingFieldDouble> f(MEDCouplingFieldDouble::New(type==0?ON_CELLS:ON_NODES,ONE_TIME));
{
double pmin=1e38, pmax=-1e38;
const double *p(vitesse->getField()->getArray()->begin());
- for(std::size_t i=0;i<vitesse->getField()->getArray()->getNbOfElems();i++,p++)
+ for(mcIdType i=0;i<vitesse->getField()->getArray()->getNbOfElems();i++,p++)
{
if (*p<pmin) pmin=*p;
if (*p>pmax) pmax=*p;
{
//
const double sourceCoords[19*3]={0.5,0.5,0.1,0.5,0.5,1.2,0.5,0.5,1.6,0.5,0.5,1.8,0.5,0.5,2.43,0.5,0.5,2.55,0.5,0.5,4.1,0.5,0.5,4.4,0.5,0.5,4.9,0.5,0.5,5.1,0.5,0.5,7.6,0.5,0.5,7.7,0.5,0.5,8.2,0.5,0.5,8.4,0.5,0.5,8.6,0.5,0.5,8.8,0.5,0.5,9.2,0.5,0.5,9.6,0.5,0.5,11.5};
- const int sourceConn[18*2]={0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18};
+ const mcIdType sourceConn[18*2]={0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18};
const double sourceVals[19]={0.49,2.8899999999999997,7.29,13.69,22.09,32.49,44.89,59.29,75.69,94.09, 114.49,136.89,161.29,187.69,216.09,246.49,278.89,313.29,349.69};
const double targetCoords0[20*3]={0.,0.,0.,1.,0.,0.,0.,1.,0.,1.,1.,0.,0.,0.,1.,1.,0.,1.,0.,1.,1.,1.,1.,1.,0.,0.,2.,1.,0.,2.,0.,1.,2.,1.,1.,2.,0.,0.,3.,1.,0.,3.,0.,1.,3.,1.,1.,3.,0.,0.,4.,1.,0.,4.,0.,1.,4.,1.,1.,4.};
- const int targetConn0[8*4]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19};
+ const mcIdType targetConn0[8*4]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19};
const double targetCoords1[28*3]={0.,0.,4.,1.,0.,4.,0.,1.,4.,1.,1.,4.,0.,0.,5.,1.,0.,5.,0.,1.,5.,1.,1.,5.,0.,0.,6.,1.,0.,6.,0.,1.,6.,1.,1.,6.,0.,0.,7.,1.,0.,7.,0.,1.,7.,1.,1.,7.,0.,0.,8.,1.,0.,8.,0.,1.,8.,1.,1.,8.,0.,0.,9.,1.,0.,9.,0.,1.,9.,1.,1.,9.,0.,0.,10.,1.,0.,10.,0.,1.,10.,1.,1.,10.};
- const int targetConn1[8*6]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19,17,16,18,19,21,20,22,23,21,20,22,23,25,24,26,27};
+ const mcIdType targetConn1[8*6]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19,17,16,18,19,21,20,22,23,21,20,22,23,25,24,26,27};
//
int size;
int rank;
const double dataCoo[24]={0.,0.,0.,1.,0.,0.,0.,0.,1.,1.,0.,1.,0.,1e-05,0.,1.,1e-05,0.,0.,1e-05,1.,1.,1e-05,1.};
coo->alloc(8,3);
std::copy(dataCoo,dataCoo+24,coo->getPointer());
- const int conn[8]={0,1,3,2,4,5,7,6};
+ const mcIdType conn[8]={0,1,3,2,4,5,7,6};
m->allocateCells(2);
m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+4);
const double dataCoo[24]={0.,0.,0.,1.,0.,0.,0.,0.,1.,1.,0.,1.,0.,1e-05,0.,1.,1e-05,0.,0.,1e-05,1.,1.,1e-05,1.};
coo->alloc(8,3);
std::copy(dataCoo,dataCoo+24,coo->getPointer());
- const int conn[12]={0,1,2,1,2,3,4,5,7,4,6,7};
+ const mcIdType conn[12]={0,1,2,1,2,3,4,5,7,4,6,7};
m->allocateCells(4);
for(int i=0;i<4;i++)
m->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3*i);
champ_recepteur->setOwnSupport(true);
}
-
MPI_Barrier(MPI_COMM_WORLD);
clock_t clock0(clock());
if(rank==0)
{
double coords[4]={0.3,0.7, 0.9,1.0};
- int conn[4]={0,1,2,3};
+ mcIdType conn[4]={0,1,2,3};
mesh=MEDCouplingUMesh::New("Source mesh Proc0",1);
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==1)
{
double coords[2]={0.7,0.9};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Source mesh Proc1",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==2)
{
double coords[2]={1.,1.12};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Source mesh Proc2",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==3)
{
double coords[2]={0.5,0.75};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Target mesh Proc3",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==4)
{
double coords[2]={0.75,1.2};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Target mesh Proc4",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==0)
{
double coords[8]={0.3,0.3,0.7,0.7, 0.9,0.9,1.0,1.0};
- int conn[4]={0,1,2,3};
+ mcIdType conn[4]={0,1,2,3};
mesh=MEDCouplingUMesh::New("Source mesh Proc0",1);
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==1)
{
double coords[4]={0.7,0.7,0.9,0.9};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Source mesh Proc1",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==2)
{
double coords[4]={1.,1.,1.12,1.12};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Source mesh Proc2",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==3)
{
double coords[4]={0.5,0.5,0.75,0.75};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Target mesh Proc3",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==4)
{
double coords[4]={0.75,0.75,1.2,1.2};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Target mesh Proc4",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
const double targetCoordsAll[3][16]={{0.7,1.45,0.7,1.65,0.9,1.65,0.9,1.45, 1.1,1.4,1.1,1.6,1.3,1.6,1.3,1.4},
{0.7,-0.6,0.7,0.7,0.9,0.7,0.9,-0.6, 1.1,-0.7,1.1,0.6,1.3,0.6,1.3,-0.7},
{0.7,-1.55,0.7,-1.35,0.9,-1.35,0.9,-1.55, 1.1,-1.65,1.1,-1.45,1.3,-1.45,1.3,-1.65}};
- int conn4All[8]={0,1,2,3,4,5,6,7};
+ mcIdType conn4All[8]={0,1,2,3,4,5,6,7};
double targetResults[3][2]={{34.,34.},{38.333333333333336,42.666666666666664},{47.,47.}};
double targetResults2[3][2]={{0.28333333333333344,0.56666666666666687},{1.8564102564102569,2.0128205128205132},{1.0846153846153845,0.36153846153846159}};
double targetResults3[3][2]={{3.7777777777777781,7.5555555555555562},{24.511111111111113,26.355555555555558},{14.1,4.7}};
if(rank==0)
{
double coords[6]={-0.3,-0.3, 0.7,0.7, 0.7,-0.3};
- int conn[3]={0,1,2};
+ mcIdType conn[3]={0,1,2};
//int globalNode[3]={1,2,0};
mesh=MEDCouplingUMesh::New("Source mesh Proc0",2);
mesh->allocateCells(1);
if(rank==1)
{
double coords[6]={-0.3,-0.3, -0.3,0.7, 0.7,0.7};
- int conn[3]={0,1,2};
+ mcIdType conn[3]={0,1,2};
//int globalNode[3]={1,3,2};
mesh=MEDCouplingUMesh::New("Source mesh Proc1",2);
mesh->allocateCells(1);
if(rank==2)
{
double coords[10]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2 };
- int conn[7]={0,3,4,1, 1,4,2};
+ mcIdType conn[7]={0,3,4,1, 1,4,2};
//int globalNode[5]={4,3,0,2,1};
mesh=MEDCouplingUMesh::New("Target mesh Proc2",2);
mesh->allocateCells(2);
mesh->setCoords(myCoords);
myCoords->decrRef();
paramesh=new ParaMESH(mesh,*target_group,targetMeshName);
- DataArrayInt *da=DataArrayInt::New();
- const int globalNumberingP2[5]={0,1,2,3,4};
+ DataArrayIdType *da=DataArrayIdType::New();
+ const mcIdType globalNumberingP2[5]={0,1,2,3,4};
da->useArray(globalNumberingP2,false,DeallocType::CPP_DEALLOC,5,1);
paramesh->setNodeGlobal(da);
da->decrRef();
if(rank==3)
{
double coords[6]={0.2,0.2, 0.7,-0.3, 0.7,0.2};
- int conn[3]={0,2,1};
+ mcIdType conn[3]={0,2,1};
//int globalNode[3]={1,0,5};
mesh=MEDCouplingUMesh::New("Target mesh Proc3",2);
mesh->allocateCells(1);
mesh->setCoords(myCoords);
myCoords->decrRef();
paramesh=new ParaMESH(mesh,*target_group,targetMeshName);
- DataArrayInt *da=DataArrayInt::New();
- const int globalNumberingP3[3]={4,2,5};
+ DataArrayIdType *da=DataArrayIdType::New();
+ const mcIdType globalNumberingP3[3]={4,2,5};
da->useArray(globalNumberingP3,false,DeallocType::CPP_DEALLOC,3,1);
paramesh->setNodeGlobal(da);
da->decrRef();
if(rank==4)
{
double coords[12]={-0.3,0.2, -0.3,0.7, 0.2,0.7, 0.2,0.2, 0.7,0.7, 0.7,0.2};
- int conn[8]={0,1,2,3, 3,2,4,5};
+ mcIdType conn[8]={0,1,2,3, 3,2,4,5};
//int globalNode[6]={2,6,7,1,8,5};
mesh=MEDCouplingUMesh::New("Target mesh Proc4",2);
mesh->allocateCells(2);
mesh->setCoords(myCoords);
myCoords->decrRef();
paramesh=new ParaMESH(mesh,*target_group,targetMeshName);
- DataArrayInt *da=DataArrayInt::New();
- const int globalNumberingP4[6]={3,6,7,4,8,5};
+ DataArrayIdType *da=DataArrayIdType::New();
+ const mcIdType globalNumberingP4[6]={3,6,7,4,8,5};
da->useArray(globalNumberingP4,false,DeallocType::CPP_DEALLOC,6,1);
paramesh->setNodeGlobal(da);
da->decrRef();
myCoords->decrRef();
if(rank==0)
{
- int targetConn[7]={0,3,4,1, 1,4,2};
+ mcIdType targetConn[7]={0,3,4,1, 1,4,2};
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+4);
}
else
{
- int targetConn[11]={4,5,2, 6,7,4,3, 7,8,5,4};
+ mcIdType targetConn[11]={4,5,2, 6,7,4,3, 7,8,5,4};
mesh->allocateCells(3);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn+3);
std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
mesh->setCoords(myCoords);
myCoords->decrRef();
- int targetConn[4]={0,2,3,1};
+ mcIdType targetConn[4]={0,2,3,1};
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn);
mesh->finishInsertingCells();
std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
mesh->setCoords(myCoords);
myCoords->decrRef();
- int targetConn[6]={0,2,1,2,3,1};
+ mcIdType targetConn[6]={0,2,1,2,3,1};
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3);
if(source_group->containsMyRank())
{
double coords[15]={1.,0.,0., 2.,0.,0., 2.,2.,0., 0.,2.,0., 0.5,0.5,1.};
- int conn[7]={0,1,2,3,0,3,4};
+ mcIdType conn[7]={0,1,2,3,0,3,4};
mesh=MEDCouplingUMesh::New("Source mesh Proc0",2);
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
if(rank==1)
{
double coords[12]={0.25,0.25,0.5, 0.,0.25,0.5, 0.,0.,0.5, 0.25,0.,0.5};
- int conn[4]={0,1,2,3};
+ mcIdType conn[4]={0,1,2,3};
mesh=MEDCouplingUMesh::New("Target mesh Proc1",2);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
if(rank==2)
{
double coords[12]={0.,0.25,0.5, 0.,0.,0.5, -1.,0.,0.5, -1.,0.25,0.5};
- int conn[4]={0,1,2,3};
+ mcIdType conn[4]={0,1,2,3};
mesh=MEDCouplingUMesh::New("Target mesh Proc2",2);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
std::copy(coordsS,coordsS+10,myCoords->getPointer());
meshS->setCoords(myCoords);
myCoords->decrRef();
- int connS[7]={0,3,4,1, 1,4,2};
+ mcIdType connS[7]={0,3,4,1, 1,4,2};
meshS->allocateCells(2);
meshS->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS);
meshS->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connS+4);
std::copy(coordsT,coordsT+6,myCoords->getPointer());
meshT->setCoords(myCoords);
myCoords->decrRef();
- int connT[3]={0,2,1};
+ mcIdType connT[3]={0,2,1};
meshT->allocateCells(1);
meshT->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT);
meshT->finishInsertingCells();
std::copy(coordsS,coordsS+10,myCoords->getPointer());
meshS->setCoords(myCoords);
myCoords->decrRef();
- int connS[7]={0,1,2, 1,3,4,2};
+ mcIdType connS[7]={0,1,2, 1,3,4,2};
meshS->allocateCells(2);
meshS->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connS);
meshS->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS+3);
std::copy(coordsT,coordsT+6,myCoords->getPointer());
meshT->setCoords(myCoords);
myCoords->decrRef();
- int connT[3]={0,2,1};
+ mcIdType connT[3]={0,2,1};
meshT->allocateCells(1);
meshT->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT);
meshT->finishInsertingCells();
std::copy(coordsS,coordsS+8,myCoords->getPointer());
meshS->setCoords(myCoords);
myCoords->decrRef();
- int connS[4]={0,2,3,1};
+ mcIdType connS[4]={0,2,3,1};
meshS->allocateCells(1);
meshS->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS);
meshS->finishInsertingCells();
std::copy(coordsT,coordsT+6,myCoords->getPointer());
meshT->setCoords(myCoords);
myCoords->decrRef();
- int connT[3]={0,1,2};
+ mcIdType connT[3]={0,1,2};
meshT->allocateCells(1);
meshT->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT);
meshT->finishInsertingCells();
myCoords->alloc(5,2);
std::copy(coords,coords+10,myCoords->getPointer());
meshS_0->setCoords(myCoords); myCoords->decrRef();
- int connS[4]={0,1,2,3};
+ mcIdType connS[4]={0,1,2,3};
meshS_0->allocateCells(2);
meshS_0->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS);
//
std::copy(coords,coords+10,myCoords->getPointer());
meshT_0->setCoords(myCoords);
myCoords->decrRef();
- int connT[12]={0,1,4, 1,2,4, 2,3,4, 3,0,4};
+ mcIdType connT[12]={0,1,4, 1,2,4, 2,3,4, 3,0,4};
meshT_0->allocateCells(4);
meshT_0->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT);
meshT_0->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT+3);
parafield = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo);
int nb_local=mesh->getNumberOfCells();
- const int* global_numbering = paramesh->getGlobalNumberingCell();
+ const mcIdType* global_numbering = paramesh->getGlobalNumberingCell();
double *value=parafield->getField()->getArray()->getPointer();
for(int ielem=0; ielem<nb_local;ielem++)
mpi_access.status( RecvRequestId[i] , source , tag , error ,
outcount ) ;
if ( i != 0 ) {
- if ( outcount != 1000*i |
- (recvbuf[i][outcount-1] != (outcount-1)) ) {
+ if (( outcount != 1000*i ) ||
+ ((recvbuf[i][outcount-1] != (outcount-1)))) {
ostringstream strstream ;
strstream << "========================================================"
<< endl << "test" << myrank << " outcount " << outcount
ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})
SET_SOURCE_FILES_PROPERTIES(ParaMEDMEM.i PROPERTIES SWIG_DEFINITIONS "-shadow")
ENDIF()
SET(SWIG_MODULE_ParaMEDMEM_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
+IF(MEDCOUPLING_USE_64BIT_IDS)
+ STRING(APPEND SWIG_MODULE_ParaMEDMEM_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
+ENDIF(MEDCOUPLING_USE_64BIT_IDS)
INCLUDE_DIRECTORIES(
${PYTHON_INCLUDE_DIRS}
def MEDCouplingDataArrayIntIpow(self,*args):
import _ParaMEDMEM
return _ParaMEDMEM.DataArrayInt____ipow___(self, self, *args)
+def MEDCouplingDataArrayInt32Iadd(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32Isub(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32Imul(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32Idiv(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32Imod(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32____imod___(self, self, *args)
+def MEDCouplingDataArrayInt32Ipow(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32____ipow___(self, self, *args)
+def MEDCouplingDataArrayInt64Iadd(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt64____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64Isub(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt64____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64Imul(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt64____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64Idiv(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt64____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64Imod(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt64____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64Ipow(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt64____ipow___(self, self, *args)
def MEDCouplingDataArrayFloatIadd(self,*args):
import _ParaMEDMEM
return _ParaMEDMEM.DataArrayFloat____iadd___(self, self, *args)
def MEDCouplingDataArrayDoubleTupleIdiv(self,*args):
import _ParaMEDMEM
return _ParaMEDMEM.DataArrayDoubleTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIadd(self,*args):
+def MEDCouplingDataArrayInt32TupleIadd(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIsub(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImul(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIdiv(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImod(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32Tuple____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIadd(self,*args):
import _ParaMEDMEM
- return _ParaMEDMEM.DataArrayIntTuple____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIsub(self,*args):
+ return _ParaMEDMEM.DataArrayInt64Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIsub(self,*args):
import _ParaMEDMEM
- return _ParaMEDMEM.DataArrayIntTuple____isub___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImul(self,*args):
+ return _ParaMEDMEM.DataArrayInt64Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImul(self,*args):
import _ParaMEDMEM
- return _ParaMEDMEM.DataArrayIntTuple____imul___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIdiv(self,*args):
+ return _ParaMEDMEM.DataArrayInt64Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIdiv(self,*args):
import _ParaMEDMEM
- return _ParaMEDMEM.DataArrayIntTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImod(self,*args):
+ return _ParaMEDMEM.DataArrayInt64Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImod(self,*args):
import _ParaMEDMEM
- return _ParaMEDMEM.DataArrayIntTuple____imod___(self, self, *args)
+ return _ParaMEDMEM.DataArrayInt64Tuple____imod___(self, self, *args)
def MEDCouplingDenseMatrixIadd(self,*args):
import _ParaMEDMEM
return _ParaMEDMEM.DenseMatrix____iadd___(self, self, *args)
{
PyObject *getGlobalNumberingCell2() const
{
- const int *tmp=self->getGlobalNumberingCell();
- int size=self->getCellMesh()->getNumberOfCells();
+ const mcIdType *tmp=self->getGlobalNumberingCell();
+ mcIdType size=self->getCellMesh()->getNumberOfCells();
PyObject *ret=PyList_New(size);
- for(int i=0;i<size;i++)
+ for(mcIdType i=0;i<size;i++)
PyList_SetItem(ret,i,PyInt_FromLong(tmp[i]));
return ret;
}
PyObject *getGlobalNumberingFace2() const
{
- const int *tmp=self->getGlobalNumberingFace();
- int size=self->getFaceMesh()->getNumberOfCells();
+ const mcIdType *tmp=self->getGlobalNumberingFace();
+ mcIdType size=self->getFaceMesh()->getNumberOfCells();
PyObject *ret=PyList_New(size);
- for(int i=0;i<size;i++)
+ for(mcIdType i=0;i<size;i++)
PyList_SetItem(ret,i,PyInt_FromLong(tmp[i]));
return ret;
}
PyObject *getGlobalNumberingNode2() const
{
- const int *tmp=self->getGlobalNumberingNode();
- int size=self->getCellMesh()->getNumberOfNodes();
+ const mcIdType *tmp=self->getGlobalNumberingNode();
+ mcIdType size=self->getCellMesh()->getNumberOfNodes();
PyObject *ret=PyList_New(size);
- for(int i=0;i<size;i++)
+ for(mcIdType i=0;i<size;i++)
PyList_SetItem(ret,i,PyInt_FromLong(tmp[i]));
return ret;
}
SET_SOURCE_FILES_PROPERTIES(medcoupling.i PROPERTIES SWIG_DEFINITIONS "-shadow")
ENDIF()
SET(SWIG_MODULE_medcoupling_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
+IF(MEDCOUPLING_USE_64BIT_IDS)
+ STRING(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
+ENDIF(MEDCOUPLING_USE_64BIT_IDS)
SET(medcoupling_SWIG_DPYS_FILES medcoupling.i)
def MEDCouplingFieldDoubleIpow(self,*args):
import _medcoupling
return _medcoupling.MEDCouplingFieldDouble____ipow___(self, self, *args)
-def MEDCouplingDataArrayIntIadd(self,*args):
+def MEDCouplingDataArrayInt32Iadd(self,*args):
import _medcoupling
- return _medcoupling.DataArrayInt____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntIsub(self,*args):
+ return _medcoupling.DataArrayInt32____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32Isub(self,*args):
import _medcoupling
- return _medcoupling.DataArrayInt____isub___(self, self, *args)
-def MEDCouplingDataArrayIntImul(self,*args):
+ return _medcoupling.DataArrayInt32____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32Imul(self,*args):
import _medcoupling
- return _medcoupling.DataArrayInt____imul___(self, self, *args)
-def MEDCouplingDataArrayIntIdiv(self,*args):
+ return _medcoupling.DataArrayInt32____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32Idiv(self,*args):
import _medcoupling
- return _medcoupling.DataArrayInt____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntImod(self,*args):
+ return _medcoupling.DataArrayInt32____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32Imod(self,*args):
import _medcoupling
- return _medcoupling.DataArrayInt____imod___(self, self, *args)
-def MEDCouplingDataArrayIntIpow(self,*args):
+ return _medcoupling.DataArrayInt32____imod___(self, self, *args)
+def MEDCouplingDataArrayInt32Ipow(self,*args):
import _medcoupling
- return _medcoupling.DataArrayInt____ipow___(self, self, *args)
+ return _medcoupling.DataArrayInt32____ipow___(self, self, *args)
+def MEDCouplingDataArrayInt64Iadd(self,*args):
+ import _medcoupling
+ return _medcoupling.DataArrayInt64____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64Isub(self,*args):
+ import _medcoupling
+ return _medcoupling.DataArrayInt64____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64Imul(self,*args):
+ import _medcoupling
+ return _medcoupling.DataArrayInt64____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64Idiv(self,*args):
+ import _medcoupling
+ return _medcoupling.DataArrayInt64____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64Imod(self,*args):
+ import _medcoupling
+ return _medcoupling.DataArrayInt64____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64Ipow(self,*args):
+ import _medcoupling
+ return _medcoupling.DataArrayInt64____ipow___(self, self, *args)
def MEDCouplingDataArrayFloatIadd(self,*args):
import _medcoupling
return _medcoupling.DataArrayFloat____iadd___(self, self, *args)
def MEDCouplingDataArrayDoubleTupleIdiv(self,*args):
import _medcoupling
return _medcoupling.DataArrayDoubleTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIadd(self,*args):
+def MEDCouplingDataArrayInt32TupleIadd(self,*args):
+ import _medcoupling
+ return _medcoupling.DataArrayInt32Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIsub(self,*args):
+ import _medcoupling
+ return _medcoupling.DataArrayInt32Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImul(self,*args):
+ import _medcoupling
+ return _medcoupling.DataArrayInt32Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIdiv(self,*args):
+ import _medcoupling
+ return _medcoupling.DataArrayInt32Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImod(self,*args):
+ import _medcoupling
+ return _medcoupling.DataArrayInt32Tuple____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIadd(self,*args):
import _medcoupling
- return _medcoupling.DataArrayIntTuple____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIsub(self,*args):
+ return _medcoupling.DataArrayInt64Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIsub(self,*args):
import _medcoupling
- return _medcoupling.DataArrayIntTuple____isub___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImul(self,*args):
+ return _medcoupling.DataArrayInt64Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImul(self,*args):
import _medcoupling
- return _medcoupling.DataArrayIntTuple____imul___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIdiv(self,*args):
+ return _medcoupling.DataArrayInt64Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIdiv(self,*args):
import _medcoupling
- return _medcoupling.DataArrayIntTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImod(self,*args):
+ return _medcoupling.DataArrayInt64Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImod(self,*args):
import _medcoupling
- return _medcoupling.DataArrayIntTuple____imod___(self, self, *args)
+ return _medcoupling.DataArrayInt64Tuple____imod___(self, self, *args)
def MEDCouplingDenseMatrixIadd(self,*args):
import _medcoupling
return _medcoupling.DenseMatrix____iadd___(self, self, *args)
ADD_DEFINITIONS("-DENABLE_BOOST")
ENDIF(Boost_FOUND)
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
# Include directories
INCLUDE_DIRECTORIES(
${MEDFILE_INCLUDE_DIRS}
#include <boost/graph/properties.hpp>
#include <boost/graph/bandwidth.hpp>
-void BOOSTRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm)
+void BOOSTRenumbering::renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm)
{
- MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> out0(MEDCoupling::DataArrayIdType::New()),out1(MEDCoupling::DataArrayIdType::New());
out0->alloc(nbCell,1); out1->alloc(nbCell,1);
out0->fillWithZero(); out1->fillWithZero();
//
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS,
boost::property<boost::vertex_color_t, boost::default_color_type,
- boost::property<boost::vertex_degree_t,int> > > Graph;
+ boost::property<boost::vertex_degree_t,mcIdType> > > Graph;
typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;
typedef boost::graph_traits<Graph>::vertices_size_type size_type;
Graph G(nbCell);
- for (int i=0;i<nbCell;++i)
- for (int j=index_graph[i];j<index_graph[i+1];++j)
+ for (mcIdType i=0;i<nbCell;++i)
+ for (mcIdType j=index_graph[i];j<index_graph[i+1];++j)
add_edge(i,graph[j],G);
boost::property_map<Graph, boost::vertex_index_t>::type
index_map = boost::get(boost::vertex_index, G);
boost::cuthill_mckee_ordering(G, out0->getPointer(), boost::get(boost::vertex_color, G),
boost::make_degree_map(G));
- int *out0Ptr(out0->getPointer()),*out1Ptr(out1->getPointer());
- for(int c=0;c!=nbCell;++c)
+ mcIdType *out0Ptr(out0->getPointer()),*out1Ptr(out1->getPointer());
+ for(mcIdType c=0;c!=nbCell;++c)
out1Ptr[index_map[out0Ptr[nbCell-c-1]]]=c;
out0->reverse();
iperm=out0.retn(); perm=out1.retn();
class RENUMBER_EXPORT BOOSTRenumbering:public Renumbering
{
public:
- void renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm);
+ void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm);
};
#endif /*BOOSTRENUMBERING_HXX_*/
#include "RENUMBER_METISRenumbering.hxx"
-void METISRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm)
+#ifdef MEDCOUPLING_USE_64BIT_IDS
+#define ID_TYPE_SIZE 64
+#else
+#define ID_TYPE_SIZE 32
+#endif
+
+void METISRenumbering::renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm)
{
- MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> out0(MEDCoupling::DataArrayIdType::New()),out1(MEDCoupling::DataArrayIdType::New());
out0->alloc(nbCell,1); out1->alloc(nbCell,1);
out0->fillWithZero(); out1->fillWithZero();
int num_flag=1;
int options=0;
- METIS_NodeND(&nbCell,(int*)index_graph,(int*)graph,&num_flag,&options,out0->getPointer(),out1->getPointer());
+
+#if ID_TYPE_SIZE == IDXTYPEWIDTH
+
+ METIS_NodeND(&nbCell,(idx_t*)index_graph,(idx_t*)graph,&num_flag,&options,out0->getPointer(),out1->getPointer());
+
+#else
+
+ mcIdType indexSize = nbCell + 1, graphSize = index_graph[indexSize];
+ std::vector<idx_t> indexVec( index_graph, index_graph + indexSize );
+ std::vector<idx_t> graphVec( graph, graph + graphSize );
+ std::vector<idx_t> out0Vec( nbCell ), out1Vec( nbCell );
+ idx_t nb = static_cast<idx_t>( nbCell );
+ METIS_NodeND(&nb,indexVec.data(),graphVec.data(),&num_flag,&options,out0Vec.data(),out1Vec.data());
+ std::copy( out0Vec.begin(),out0Vec.end(),out0->getPointer() );
+ std::copy( out1Vec.begin(),out1Vec.end(),out1->getPointer() );
+
+#endif
+
iperm=out0.retn(); perm=out1.retn();
}
class RENUMBER_EXPORT METISRenumbering:public Renumbering
{
public:
- virtual void renumber(const int *graph, const int *index_graph, int nb_cell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm);
+ virtual void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nb_cell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm);
};
#endif /*METISRENUMBERING_HXX_*/
namespace MEDCoupling
{
- class DataArrayInt;
+ class DataArrayIdType;
}
class RENUMBER_EXPORT Renumbering
{
public:
- virtual void renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm) = 0;
+ virtual void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) = 0;
virtual ~Renumbering() { }
};
int main(int argc, char** argv)
{
double t_begin,t_read_st,t_compute_graph,t_family,t_field;
- t_begin=clock();
+ t_begin=(double)clock();
if (argc <5)
{
cerr << "Usage : " << argv[0]
std::ostringstream oss; oss << "In file \"" << filename_in << "\" the mesh name \"" << meshname<< "\" exists but is not unstructured !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- t_read_st=clock();
+ t_read_st=(double)clock();
cout << (t_read_st-t_begin)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
// Reading mesh
MCAuto<MEDCouplingUMesh> workMesh=mc->getMeshAtLevel(0);
- std::vector<int> code=workMesh->getDistributionOfTypes();
+ //std::vector<mcIdType> code=workMesh->getDistributionOfTypes();
cout << "Building the graph : " << flush;
- DataArrayInt *neighb=0,*neighbI=0;
+ DataArrayIdType *neighb=0,*neighbI=0;
workMesh->computeNeighborsOfCells(neighb,neighbI);
- MCAuto<DataArrayInt> neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe;
- const int *graph=neighbSafe->begin();
- const int *graph_index=neighbISafe->begin();
+ MCAuto<DataArrayIdType> neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe;
+ const mcIdType *graph=neighbSafe->begin();
+ const mcIdType *graph_index=neighbISafe->begin();
// Compute permutation iperm->new2old perm->old2new
- DataArrayInt *iperm(0),*perm(0);
+ DataArrayIdType *iperm(0),*perm(0);
Renumbering *renumb=RenumberingFactory(type_renum);
renumb->renumber(graph,graph_index,workMesh->getNumberOfCells(),iperm,perm);
ipermSafe=iperm; permSafe=perm;
delete renumb;
ipermSafe=0;//erase new2old, we are using only old 2 new
- t_compute_graph=clock();
+ t_compute_graph=(double)clock();
cout << " : " << (t_compute_graph-t_read_st)/(double) CLOCKS_PER_SEC << "s" << endl;
cout.flush();
// Connectivity
cout << "Reordering connectivity & families and writing : " << flush;
workMesh->renumberCells(perm->begin(),false);
mc->setMeshAtLevel(0,workMesh);
- const DataArrayInt *famField=mc->getFamilyFieldAtLevel(0);
+ const DataArrayIdType *famField=mc->getFamilyFieldAtLevel(0);
if(famField)
{
- MCAuto<DataArrayInt> famField2=famField->renumber(perm->begin());
+ MCAuto<DataArrayIdType> famField2=famField->renumber(perm->begin());
mc->setFamilyFieldArr(0,famField2);
}
mc->write(filename_out,2);
- t_family=clock();
+ t_family=(double)clock();
cout << " : " << (t_family-t_compute_graph)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
// Fields
cout << "Reordering fields and writing : " << flush;
fs->write(filename_out,0);
//fs->renumberEntitiesLyingOnMesh(meshname,code,code,o2n); bugged
}
- t_field=clock();
+ t_field=(double)clock();
cout << " : " << (t_field-t_family)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
return 0;
}
ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES CPLUSPLUS ON)
IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_FLAGS "-py3")
SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_DEFINITIONS "-shadow")
ENDIF()
SET(SWIG_MODULE_MEDRenumber_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS};-DWITHOUT_AUTOFIELD")
+IF(MEDCOUPLING_USE_64BIT_IDS)
+ STRING(APPEND SWIG_MODULE_MEDRenumber_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
+ENDIF(MEDCOUPLING_USE_64BIT_IDS)
SET (MEDRenumber_SWIG_DPYS_FILES
MEDRenumberCommon.i
def MEDCouplingDataArrayDoubleIpow(self,*args):
import _MEDRenumber
return _MEDRenumber.DataArrayDouble____ipow___(self, self, *args)
-def MEDCouplingDataArrayIntIadd(self,*args):
+def MEDCouplingDataArrayInt32Iadd(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayInt____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntIsub(self,*args):
+ return _MEDRenumber.DataArrayInt32____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32Isub(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayInt____isub___(self, self, *args)
-def MEDCouplingDataArrayIntImul(self,*args):
+ return _MEDRenumber.DataArrayInt32____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32Imul(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayInt____imul___(self, self, *args)
-def MEDCouplingDataArrayIntIdiv(self,*args):
+ return _MEDRenumber.DataArrayInt32____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32Idiv(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayInt____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntImod(self,*args):
+ return _MEDRenumber.DataArrayInt32____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32Imod(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayInt____imod___(self, self, *args)
-def MEDCouplingDataArrayIntIpow(self,*args):
+ return _MEDRenumber.DataArrayInt32____imod___(self, self, *args)
+def MEDCouplingDataArrayInt32Ipow(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayInt____ipow___(self, self, *args)
+ return _MEDRenumber.DataArrayInt32____ipow___(self, self, *args)
+def MEDCouplingDataArrayInt64Iadd(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64Isub(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64Imul(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64Idiv(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64Imod(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64Ipow(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64____ipow___(self, self, *args)
def MEDCouplingDataArrayFloatIadd(self,*args):
import _MEDRenumber
return _MEDRenumber.DataArrayFloat____iadd___(self, self, *args)
def MEDCouplingDataArrayDoubleTupleIdiv(self,*args):
import _MEDRenumber
return _MEDRenumber.DataArrayDoubleTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIadd(self,*args):
+def MEDCouplingDataArrayInt32TupleIadd(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt32Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIsub(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayIntTuple____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIsub(self,*args):
+ return _MEDRenumber.DataArrayInt32Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImul(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayIntTuple____isub___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImul(self,*args):
+ return _MEDRenumber.DataArrayInt32Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIdiv(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayIntTuple____imul___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIdiv(self,*args):
+ return _MEDRenumber.DataArrayInt32Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImod(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayIntTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImod(self,*args):
+ return _MEDRenumber.DataArrayInt32Tuple____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIadd(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayIntTuple____imod___(self, self, *args)
+ return _MEDRenumber.DataArrayInt64Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIsub(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImul(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIdiv(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImod(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64Tuple____imod___(self, self, *args)
%}
DataArrayDouble.__idiv__=MEDCouplingDataArrayDoubleIdiv
DataArrayDouble.__ipow__=MEDCouplingDataArrayDoubleIpow
-DataArrayInt.__reduce__=MEDCouplingDataArrayIntReduce
-DataArrayInt.__iadd__=MEDCouplingDataArrayIntIadd
-DataArrayInt.__isub__=MEDCouplingDataArrayIntIsub
-DataArrayInt.__imul__=MEDCouplingDataArrayIntImul
-DataArrayInt.__idiv__=MEDCouplingDataArrayIntIdiv
-DataArrayInt.__imod__=MEDCouplingDataArrayIntImod
-DataArrayInt.__ipow__=MEDCouplingDataArrayIntIpow
+DataArrayInt32.__reduce__=MEDCouplingDataArrayInt32Reduce
+DataArrayInt32.__iadd__=MEDCouplingDataArrayInt32Iadd
+DataArrayInt32.__isub__=MEDCouplingDataArrayInt32Isub
+DataArrayInt32.__imul__=MEDCouplingDataArrayInt32Imul
+DataArrayInt32.__idiv__=MEDCouplingDataArrayInt32Idiv
+DataArrayInt32.__imod__=MEDCouplingDataArrayInt32Imod
+DataArrayInt32.__ipow__=MEDCouplingDataArrayInt32Ipow
+DataArrayInt64.__reduce__=MEDCouplingDataArrayInt64Reduce
+DataArrayInt64.__iadd__=MEDCouplingDataArrayInt64Iadd
+DataArrayInt64.__isub__=MEDCouplingDataArrayInt64Isub
+DataArrayInt64.__imul__=MEDCouplingDataArrayInt64Imul
+DataArrayInt64.__idiv__=MEDCouplingDataArrayInt64Idiv
+DataArrayInt64.__imod__=MEDCouplingDataArrayInt64Imod
+DataArrayInt64.__ipow__=MEDCouplingDataArrayInt64Ipow
DataArrayDoubleTuple.__iadd__=MEDCouplingDataArrayDoubleTupleIadd
DataArrayDoubleTuple.__isub__=MEDCouplingDataArrayDoubleTupleIsub
DataArrayDoubleTuple.__imul__=MEDCouplingDataArrayDoubleTupleImul
DataArrayDoubleTuple.__idiv__=MEDCouplingDataArrayDoubleTupleIdiv
-DataArrayIntTuple.__iadd__=MEDCouplingDataArrayIntTupleIadd
-DataArrayIntTuple.__isub__=MEDCouplingDataArrayIntTupleIsub
-DataArrayIntTuple.__imul__=MEDCouplingDataArrayIntTupleImul
-DataArrayIntTuple.__idiv__=MEDCouplingDataArrayIntTupleIdiv
-DataArrayIntTuple.__imod__=MEDCouplingDataArrayIntTupleImod
+DataArrayInt32Tuple.__iadd__=MEDCouplingDataArrayInt32TupleIadd
+DataArrayInt32Tuple.__isub__=MEDCouplingDataArrayInt32TupleIsub
+DataArrayInt32Tuple.__imul__=MEDCouplingDataArrayInt32TupleImul
+DataArrayInt32Tuple.__idiv__=MEDCouplingDataArrayInt32TupleIdiv
+DataArrayInt32Tuple.__itruediv__=MEDCouplingDataArrayInt32TupleIdiv
+DataArrayInt32Tuple.__ifloordiv__=MEDCouplingDataArrayInt32TupleIdiv
+DataArrayInt32Tuple.__imod__=MEDCouplingDataArrayInt32TupleImod
+
+DataArrayInt64Tuple.__iadd__=MEDCouplingDataArrayInt64TupleIadd
+DataArrayInt64Tuple.__isub__=MEDCouplingDataArrayInt64TupleIsub
+DataArrayInt64Tuple.__imul__=MEDCouplingDataArrayInt64TupleImul
+DataArrayInt64Tuple.__idiv__=MEDCouplingDataArrayInt64TupleIdiv
+DataArrayInt64Tuple.__itruediv__=MEDCouplingDataArrayInt64TupleIdiv
+DataArrayInt64Tuple.__ifloordiv__=MEDCouplingDataArrayInt64TupleIdiv
+DataArrayInt64Tuple.__imod__=MEDCouplingDataArrayInt64TupleImod
+
+
+
del INTERPKERNELExceptionReduce
-del MEDCouplingDataArrayDoubleReduce
-del MEDCouplingDataArrayIntReduce
del MEDCouplingDataArrayDoubleIadd
-del MEDCouplingDataArrayDoubleIsub
-del MEDCouplingDataArrayDoubleImul
del MEDCouplingDataArrayDoubleIdiv
-del MEDCouplingDataArrayIntIadd
-del MEDCouplingDataArrayIntIsub
-del MEDCouplingDataArrayIntImul
-del MEDCouplingDataArrayIntIdiv
-del MEDCouplingDataArrayIntImod
+del MEDCouplingDataArrayDoubleImul
+del MEDCouplingDataArrayDoubleIpow
+del MEDCouplingDataArrayDoubleIsub
+del MEDCouplingDataArrayDoubleReduce
del MEDCouplingDataArrayDoubleTupleIadd
-del MEDCouplingDataArrayDoubleTupleIsub
-del MEDCouplingDataArrayDoubleTupleImul
del MEDCouplingDataArrayDoubleTupleIdiv
-del MEDCouplingDataArrayIntTupleIadd
-del MEDCouplingDataArrayIntTupleIsub
-del MEDCouplingDataArrayIntTupleImul
-del MEDCouplingDataArrayIntTupleIdiv
-del MEDCouplingDataArrayIntTupleImod
+del MEDCouplingDataArrayDoubleTupleImul
+del MEDCouplingDataArrayDoubleTupleIsub
+del MEDCouplingDataArrayInt32Iadd
+del MEDCouplingDataArrayInt32Idiv
+del MEDCouplingDataArrayInt32Imod
+del MEDCouplingDataArrayInt32Imul
+del MEDCouplingDataArrayInt32Ipow
+del MEDCouplingDataArrayInt32Isub
+del MEDCouplingDataArrayInt32Reduce
+del MEDCouplingDataArrayInt32TupleIadd
+del MEDCouplingDataArrayInt32TupleIdiv
+del MEDCouplingDataArrayInt32TupleImod
+del MEDCouplingDataArrayInt32TupleImul
+del MEDCouplingDataArrayInt32TupleIsub
+del MEDCouplingDataArrayInt64Iadd
+del MEDCouplingDataArrayInt64Idiv
+del MEDCouplingDataArrayInt64Imod
+del MEDCouplingDataArrayInt64Imul
+del MEDCouplingDataArrayInt64Ipow
+del MEDCouplingDataArrayInt64Isub
+del MEDCouplingDataArrayInt64Reduce
+del MEDCouplingDataArrayInt64TupleIadd
+del MEDCouplingDataArrayInt64TupleIdiv
+del MEDCouplingDataArrayInt64TupleImod
+del MEDCouplingDataArrayInt64TupleImul
+del MEDCouplingDataArrayInt64TupleIsub
+
%}
public:
%extend
{
- virtual PyObject *renumber(const MEDCoupling::DataArrayInt *graph, const MEDCoupling::DataArrayInt *index_graph)
+ virtual PyObject *renumber(const MEDCoupling::DataArrayIdType *graph, const MEDCoupling::DataArrayIdType *index_graph)
{
if(!graph || !index_graph)
throw INTERP_KERNEL::Exception("wrap of Renumbering::renumber : One of the input arrays is NULL !");
if(!graph->isAllocated() || !index_graph->isAllocated())
throw INTERP_KERNEL::Exception("wrap of Renumbering::renumber : One of the input arrays is not allocated !");
- MEDCoupling::DataArrayInt *out0(0),*out1(0);
+ MEDCoupling::DataArrayIdType *out0(0),*out1(0);
self->renumber(graph->begin(),index_graph->begin(),index_graph->getNumberOfTuples()-1,out0,out1);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(out0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(out1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(out0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(out1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
}