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
#define DataArrayIdType DataArrayInt32
+#define DataArrayIdTypeTuple DataArrayInt32Tuple
#else
#define DataArrayIdType DataArrayInt64
+#define DataArrayIdTypeTuple DataArrayInt64Tuple
#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]=ToIdType(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 !");
- mcIdType nbTuples=profile->getNumberOfTuples(),nbOfCells=ToIdType(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
{
- mcIdType nbOfCells=ToIdType(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))
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : all the instances in input vector must have same mesh dimension !");
if((*it)->getCoords()!=coords)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : all the instances must share the same coordinates pointer !");
- nbOfCells+=ToIdType((*it)->getNumberOfCells());
- connSize+=ToIdType((*it)->getNodalConnectivityLength());
+ 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++)
{
- mcIdType curNbCells=ToIdType((*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());
- mcIdType nbCells=ToIdType(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);
+ const DataArrayIdType *c1(_conn);
mcIdType nbOfTuples(c1->getNumberOfTuples());
- mcIdType nbOfNodesPerCell=ToIdType(_cm->getNumberOfNodes());
+ 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();
- mcIdType nbCells=ToIdType(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)
{
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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)
{
- mcIdType nbCells=ToIdType(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
{
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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);
- mcIdType 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=ToIdType(coo->getNumberOfComponents());
+ 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();
- mcIdType nbOfCells=ToIdType((*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++)
{
if(cm!=&((*it)->getCellModel()))
throw INTERP_KERNEL::Exception("Geometric types mismatches, Merge1SGTUMeshes impossible !");
- nbOfCells+=ToIdType((*it)->getNumberOfCells());
+ nbOfCells+=(*it)->getNumberOfCells();
}
std::vector<const MEDCouplingPointSet *> aps(a.size());
std::copy(a.begin(),a.end(),aps.begin());
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++)
{
- mcIdType curConnLgth=ToIdType((*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
{
- mcIdType ncell=ToIdType(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
{
- mcIdType ncell=ToIdType(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()
{
- mcIdType nbOfCells=ToIdType(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()
{
- mcIdType nbOfCells=ToIdType(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()
{
- mcIdType nbOfCells=ToIdType(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()
{
- mcIdType nbOfCells=ToIdType(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=ToIdType(_conn->getNbOfElems());
- a1=DataArrayInt::New();
+ sz=_conn->getNbOfElems();
+ 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)
if(_coords->isAllocated())
- sz=ToIdType(_coords->getNbOfElems());
+ sz=_coords->getNbOfElems();
a2=DataArrayDouble::New();
a2->alloc(sz,1);
if(sz!=0 && (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();
- mcIdType nbOfCells=ToIdType(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 !");
- mcIdType nbHexa8=ToIdType(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());
/// @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
- mcIdType nbHexa8=ToIdType(getNumberOfCells());
- int *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());
+ const mcIdType *ccPtr(ccSafe->begin());
mcIdType nbOfPair=cci->getNumberOfTuples()-1;
- for(int i=0;i<nbOfPair;i++)
+ 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());
- const mcIdType offset0=nbOfNodes+ToIdType(faces->getNumberOfCells());
- const mcIdType offset1=offset0+ToIdType(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 mcIdType nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+ToIdType(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(ToIdType(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));
- mcIdType nbCells=ToIdType(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()));
- mcIdType nbOfNodesPerCell=ToIdType(_cm->getNumberOfNodes()),nbCells=ToIdType(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)
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 !");
//
mcIdType nbOfTuples(c1->getNumberOfTuples());
- int nbOfNodes=getNumberOfNodes();
- const int *w(c1->begin());
- for(int i=0;i<nbOfTuples;i++,w++)
+ 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);
return _conn_indx->deltaShiftIndex();
// for polyhedrons
mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1;
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ 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]-ToIdType(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
mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1;
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ 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++)
+ 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);
mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1;
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ 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(ToIdType(cellId),0),stp=_conn_indx->getIJ(ToIdType(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
{
- mcIdType nbOfCells=ToIdType(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);
+ 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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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)
{
- mcIdType nbCells=ToIdType(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();
- mcIdType nbCells=ToIdType(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)
{
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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=ToIdType(_conn->getNbOfElems());
- if((const DataArrayInt *)_conn_indx)
+ sz=_conn->getNbOfElems();
+ if((const DataArrayIdType *)_conn_indx)
if(_conn_indx->isAllocated())
- sz+=ToIdType(_conn_indx->getNbOfElems());
- a1=DataArrayInt::New();
+ sz+=_conn_indx->getNbOfElems();
+ 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)
if(_coords->isAllocated())
- sz=ToIdType(_coords->getNbOfElems());
+ sz=_coords->getNbOfElems();
a2=DataArrayDouble::New();
a2->alloc(sz,1);
if(sz!=0 && (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();
- mcIdType nbOfCells=ToIdType(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.
//
mcIdType nbOfTuples(_conn->getNumberOfTuples());
- int *pt(_conn->getPointer());
+ mcIdType *pt(_conn->getPointer());
for(mcIdType i=0;i<nbOfTuples;i++,pt++)
{
if(*pt==-1) continue;
}
/*!
- * 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.
//
mcIdType nbElemsIn(getNumberOfNodes()),nbOfTuples(_conn->getNumberOfTuples());
- int *pt(_conn->getPointer());
- for(int i=0;i<nbOfTuples;i++,pt++)
+ 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
{
- mcIdType nbOfCells=ToIdType(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+ToIdType(sz));
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);
- mcIdType 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=ToIdType(coo->getNumberOfComponents());
+ 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());
+ 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(ToIdType(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()));
- mcIdType nbCells=ToIdType(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)
if(sz1==0)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : empty vectors in input !");
mcIdType nbOfTuples=0;
- for(std::vector<const DataArrayInt *>::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++)
+ 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++)
{
mcIdType curNbt=(*it)->getNumberOfTuples();
- const int *inPt=(*it)->begin();
- int offset=offsetInNodeIdsPerElt[i];
- for(int j=0;j<curNbt;j++,pt++)
+ 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());
- mcIdType nbCells=ToIdType(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());
+ mcIdType *begPtr(_conn->getPointer());
mcIdType nbElt(_conn->getNumberOfTuples());
- int *endPtr(begPtr+nbElt);
- for(int *it=begPtr;it!=endPtr;it++)
+ 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.
//
mcIdType nbOfTuples(_conn->getNumberOfTuples());
- int *pt(_conn->getPointer());
- for(int i=0;i<nbOfTuples;i++,pt++)
+ 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());
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]=(char)((int)('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])
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();
- mcIdType nbOfNodes=ToIdType(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.
*/
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++)
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=ToIdType(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;
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,ToIdType(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 ToIdType(_mesh->getNumberOfCells());
+ return _mesh->getNumberOfCells();
}
/*!
*
* \sa getNumberOfCellsAtCurrentLevel
*/
-int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const
+mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const
{
MCAuto<MEDCouplingIMesh> tmp(_mesh->buildWithGhost(ghostLev));
- return ToIdType(tmp->getNumberOfCells());
+ 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
{
- mcIdType ret=ToIdType(_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
{
- mcIdType ret=ToIdType(_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 ( 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(static_cast<double>(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));
+ 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=ToIdType(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=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);
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()!=ToIdType(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 ToIdType(_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 !");
}
}
-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
{
- mcIdType nbcells=ToIdType(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
{
- mcIdType nbcells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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::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();
double *coords=_coords->getPointer();
mcIdType nbNodes(_coords->getNumberOfTuples());
std::size_t dim(_coords->getNumberOfComponents());
- for(int i=0;i<nbNodes;i++)
+ 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();
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ mcIdType nbOfCells=getNumberOfCells();
ret->alloc(nbOfCells,spaceDim);
ret->copyStringInfoFrom(*getCoords());
switch(meshDim)
*/
void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3(DataArrayDouble *bary) const
{
- mcIdType nbOfCells=ToIdType(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
{
- mcIdType nbcells=ToIdType(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=ToIdType(_coords->getNbOfElems());
+ sz=_coords->getNbOfElems();
a2=DataArrayDouble::New();
a2->alloc(sz,1);
if(sz!=0 && (const DataArrayDouble *)_coords)
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 : [";
- mcIdType s_size=ToIdType(_structure.size());
- for(mcIdType i=0;i<s_size;i++)
+ std::size_t s_size=_structure.size();
+ for(std::size_t i=0;i<s_size;i++)
{
char tmp=(char)((int)('X')+i);
stream << " " << tmp << "=" << _structure[i];
if(!coo->isAllocated())
{ stream << std::endl << "Coordinates set but not allocated !"; return ; }
std::size_t nbOfCompo(coo->getNumberOfComponents());
- int nbOfCompoExp(-1);
+ std::size_t nbOfCompoExp(-1);
try
{
nbOfCompoExp=getSpaceDimension();
catch(INTERP_KERNEL::Exception&)
{
}
- if(ToIdType(nbOfCompo)!=nbOfCompoExp)
+ if(nbOfCompo!=nbOfCompoExp)
{ stream << std::endl << "Coordinates set and allocated but mismatch number of components !"; return ; }
stream << std::endl << "Coordinates ( number of tuples = " << coo->getNumberOfTuples() << " ) : ";
coo->reprQuickOverviewData(stream,200);
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(int 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(int 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();
}
{
MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
std::size_t nbOfCompo=arr->getNumberOfComponents();
- int nbOfElems=getNumberOfTuples(mesh);
+ 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(std::size_t j=0;j<nbOfCompo;j++)
{
MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
std::size_t nbOfCompo=arr->getNumberOfComponents();
- int nbOfElems=getNumberOfTuples(mesh);
+ 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(std::size_t j=0;j<nbOfCompo;j++)
*
* \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 !");
mcIdType oldNbOfElems=arr->getNumberOfTuples();
std::size_t nbOfComp=arr->getNumberOfComponents();
- int newNbOfTuples=newNbOfEntity;
+ 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)
{
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 !");
- return ToIdType(mesh->getNumberOfCells());
+ return mesh->getNumberOfCells();
}
/*!
* 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 ToIdType(mesh->getNumberOfCells());
+ 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 !");
std::size_t nbOfTuples=mesh->getNumberOfCells();
- DataArrayInt *ret=DataArrayInt::New();
+ 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 || !da)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::checkCoherencyBetween : NULL input mesh or DataArray !");
- if(ToIdType(mesh->getNumberOfCells())!=da->getNumberOfTuples())
+ if(mesh->getNumberOfCells()!=da->getNumberOfTuples())
{
std::ostringstream message;
message << "Field on cells invalid because there are " << mesh->getNumberOfCells();
{
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();
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();
}
}
-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();
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)
{
mcIdType nbCells=_discr_per_cell->getNumberOfTuples();
- const int *array=old2NewBg;
+ 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();
- mcIdType nbTuples=ToIdType(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;
+ mcIdType nbOfSplit=ToIdType(idsPerType.size());
+ mcIdType nbOfTypes=ToIdType(code.size()/3);
mcIdType ret(0);
- for(int i=0;i<nbOfTypes;i++)
+ 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();
+ const mcIdType *dcPtr=_discr_per_cell->getConstPointer();
mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
mcIdType maxSz=ToIdType(_loc.size());
- for(const int *w=dcPtr;w!=dcPtr+nbOfTuples;w++)
+ 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 !");
- return ToIdType(mesh->getNumberOfCells());
+ return mesh->getNumberOfCells();
}
/*!
* 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 !");
- mcIdType nbOfTuples=ToIdType(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(mcIdType i=0;i<nbOfTuples;i++,start++)
{
}
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());
+ array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
mcIdType 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.
+ 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();
- mcIdType nbOfCells=ToIdType(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("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);
di=0; beginOut=0; endOut=0; stepOut=stepCellIds;
const char msg[]="MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : cell #";
mcIdType 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++)
+ 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());
- if(_discr_per_cell->getNumberOfTuples()!=ToIdType(nbOfCells))
+ 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();
- mcIdType nbCells=ToIdType(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()) !");
mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
- const int *ptr=_discr_per_cell->getConstPointer();
- for(int i=0;i<nbOfTuples;i++)
+ 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 !");
mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- const int *w=_discr_per_cell->begin();
+ 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();
+ const mcIdType *start=_discr_per_cell->begin();
mcIdType 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++)
+ 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;
- mcIdType nbOfCells=ToIdType(mesh->getNumberOfCells());
+ mcIdType ret=0;
+ mcIdType nbOfCells=mesh->getNumberOfCells();
for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
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 ToIdType(mesh->getNumberOfCells());
+ 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 !");
- mcIdType nbOfTuples=ToIdType(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());
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbCells=ToIdType(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();
//
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();
+ 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(int i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++,ptIds2+=wArrSz)
+ for(mcIdType i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++,ptIds2+=wArrSz)
{
for(std::size_t k=0;k<nbOfCompo;k++)
{
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);
ret->setMesh(mesh);
//
std::set<INTERP_KERNEL::NormalizedCellType> types=mesh->getAllGeoTypes();
- MCAuto<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
- int nbTuples=nbOfNodesPerCell->accumulate((std::size_t)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();
+ 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(int i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++)
+ 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 !");
- mcIdType nbOfCells=ToIdType(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 !");
- mcIdType nbOfRows=ToIdType(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);
+ mcIdType nbCols(-1);
std::size_t nbCompo=arr->getNumberOfComponents();
MCAuto<DataArrayDouble> m(computeEvaluationMatrixOnGivenPts(mesh,loc,nbOfTargetPoints,nbCols));
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
*
* \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);
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 !");
* 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 !");
std::size_t spaceDimension(arr->getNumberOfComponents());
mcIdType nbOfPts(arr->getNumberOfTuples()),nbOfEltInMatrx(matr->getNumberOfTuples());
delta=ToIdType(spaceDimension)+1;
- int nbOfCols(nbOfEltInMatrx/nbOfPts);
+ 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=ToIdType(spaceDimension)+1;
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;
const double *srcPt(arrs[j]->begin());
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;
}
}
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);
}
* 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;
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 spatial discretization underlying this field to perform simplexize !");
std::size_t oldNbOfCells=_mesh->getNumberOfCells();
MCAuto<MEDCouplingMesh> meshC2(_mesh->deepCopy());
- MCAuto<DataArrayInt> arr=meshC2->simplexize(policy);
+ MCAuto<DataArrayIdType> arr=meshC2->simplexize(policy);
std::size_t newNbOfCells=meshC2->getNumberOfCells();
if(oldNbOfCells==newNbOfCells)
return false;
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());
}
ret->setMesh(getMesh());
return ret.retn();
}
-MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std::vector<mcIdType>& compoIds) const
-{
- // The method has to be removed as duplicate after SWIG update
- std::vector<std::size_t> ids (compoIds.size());
- cast_to_remove (compoIds, ids);
- return keepSelectedComponents(ids);
-}
-
/*!
* Copy all components in a specified order from another field.
{
timeDiscr()->setSelectedComponents(f->timeDiscr(),compoIds);
}
-void MEDCouplingFieldDouble::setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<mcIdType>& compoIds)
-{
- // The method has to be removed as duplicate after SWIG update
- timeDiscr()->setSelectedComponents(f->timeDiscr(),compoIds);
-}
/*!
* Sorts value within every tuple of \a this field.
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();
}
- std::size_t 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());
+ mcIdType nbPtsPerCell(vorCellsForCurDisc->getNumberOfNodes());
for(mcIdType j=0;j<ToIdType(ids.size());j++)
{
MCAuto<MEDCouplingUMesh> elt(vorCellsForCurDisc->clone(false));
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 applyFuncFast64(const std::string& func);
MEDCOUPLING_EXPORT std::size_t getNumberOfComponents() const;
MEDCOUPLING_EXPORT mcIdType getNumberOfTuples() const;
- MEDCOUPLING_EXPORT std::size_t getNumberOfValues() 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 *maxPerTuple() const;
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 MEDCouplingFieldDouble *keepSelectedComponents(const std::vector<mcIdType>& compoIds) const;
MEDCOUPLING_EXPORT void setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<std::size_t>& compoIds);
MEDCOUPLING_EXPORT void setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<mcIdType>& compoIds);
MEDCOUPLING_EXPORT void sortPerTuple(bool asc);
#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 !");
* \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();
//
- mcIdType nbCells=ToIdType(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());
//
mcIdType nbPts(ptsInRefCoo->getNumberOfTuples());
INTERP_KERNEL::NormalizedCellType typ(getType());
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(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));
+ 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());
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));
+ 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)
{
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 !");
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));
+ 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();
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));
+ 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)
{
{
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 2:
{
- SpreadCoarseToFineGhost2D(inPtr,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
+ SpreadCoarseToFineGhost2D(inPtr,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
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)
- SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
+ 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)
- SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
- for(int i=0;i<ghostSize;i++,outPtr+=nxyWgFine*nbCompo)
- SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
+ for(mcIdType j=0;j<fact2;j++,outPtr+=nxyWgFine*nbCompo)
+ SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
+ for(mcIdType i=0;i<ghostSize;i++,outPtr+=nxyWgFine*nbCompo)
+ SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
break;
}
default:
*
* \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));
+ 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();
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));
+ 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)
{
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 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)
+ 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)
+ for(mcIdType j=0;j<fact2;j++,outPtr+=nxyWgFine*nbCompo)
SpreadCoarseToFineGhostZone2D(inPtr+offset*nbCompo,outPtr,ToIdType(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,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
break;
}
}
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);
}
}
//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());
- mcIdType spaceDim(getSpaceDimension()),nbCells(ToIdType(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=(char)((int)('X')+i);
- int tmpNodes(_structure[i]);
+ mcIdType tmpNodes(_structure[i]);
stream1 << "- Axis " << tmp << " : " << tmpNodes << " nodes (orig=" << _origin[i] << ", inter=" << _dxyz[i] << ").";
if(i!=_space_dim-1)
stream1 << std::endl;
}
}
-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];
* 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));
- mcIdType nbOfLevs=ToIdType(_mesh1D->getNumberOfCells());
- mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells());
+ 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());
- mcIdType nbOfLevs=ToIdType(_mesh1D->getNumberOfCells());
- mcIdType nbOfCells2D=ToIdType(_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());
- mcIdType nbOfLevs=ToIdType(_mesh1D->getNumberOfCells());
- mcIdType nbOfCells2D=ToIdType(_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
{
- mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells());
- int nbOfNodes2D(_mesh2D->getNumberOfNodes());
- int locId(ToIdType(cellId)%nbOfCells2D);
- int lev(ToIdType(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());
- mcIdType nbOf2DCells=ToIdType(_mesh2D->getNumberOfCells()),
- nbOf1DCells=ToIdType(_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)
{
- mcIdType nbOf2DCells=ToIdType(_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);
- mcIdType nbOf1DLev=ToIdType(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());
//
- mcIdType nbOf2DCells=ToIdType(_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(_mesh3D_ids->getNbOfElems()));
+ 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+=ToIdType(a1tmp->getNbOfElems()); la2+=ToIdType(a2tmp->getNbOfElems());
+ 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+=ToIdType(a1tmp->getNbOfElems()); la2+=ToIdType(a2tmp->getNbOfElems());
+ la1+=a1tmp->getNbOfElems(); la2+=a2tmp->getNbOfElems();
a1tmp->decrRef(); a2tmp->decrRef();
um->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;
};
}
}
if(!commonNodes.empty())
{
- cI->pushBackSilent(cI->back()+(mcIdType)commonNodes.size()+1);
+ cI->pushBackSilent(cI->back()+ToIdType(commonNodes.size())+1);
c->pushBackSilent(i);
c->insertAtTheEnd(commonNodes.begin(),commonNodes.end());
}
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()+(mcIdType)commonNodes.size());
+ cI->pushBackSilent(cI->back()+ToIdType(commonNodes.size()));
c->insertAtTheEnd(commonNodes.begin(),commonNodes.end());
}
}
_info_on_compo=other._info_on_compo;
}
-void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vector<mcIdType>& compoIds)
-{
- // The method has to be removed as duplicate after SWIG update
- std::vector<std::size_t> ids (compoIds.size());
- cast_to_remove(compoIds, ids);
- copyPartOfStringInfoFrom(other, ids);
-}
-
void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vector<std::size_t>& compoIds)
{
std::size_t nbOfCompoOth=other.getNumberOfComponents();
setInfoOnComponent(i,other.getInfoOnComponent(compoIds[i]));
}
-void DataArray::copyPartOfStringInfoFrom2(const std::vector<mcIdType>& compoIds, const DataArray& other)
-{
- // The method has to be removed as duplicate after SWIG update
- std::vector<std::size_t> ids (compoIds.size());
- cast_to_remove (compoIds, ids);
- copyPartOfStringInfoFrom2(ids, other);
-}
-
void DataArray::copyPartOfStringInfoFrom2(const std::vector<std::size_t>& compoIds, const DataArray& other)
{
if(compoIds.size()!=other.getNumberOfComponents())
std::vector<std::string> DataArray::getVarsOnComponent() const
{
- mcIdType nbOfCompo=(mcIdType)_info_on_compo.size();
+ std::size_t nbOfCompo=_info_on_compo.size();
std::vector<std::string> ret(nbOfCompo);
- for(mcIdType 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
{
- mcIdType nbOfCompo=(mcIdType)_info_on_compo.size();
+ std::size_t nbOfCompo=_info_on_compo.size();
std::vector<std::string> ret(nbOfCompo);
- for(mcIdType i=0;i<nbOfCompo;i++)
+ for(std::size_t i=0;i<nbOfCompo;i++)
ret[i]=getUnitOnComponent(i);
return ret;
}
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 (" << (mcIdType) _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());
}
}
}
else
{
- std::ostringstream oss; oss << "DataArray::getVarOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << (mcIdType) _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());
}
}
}
else
{
- std::ostringstream oss; oss << "DataArray::getUnitOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << (mcIdType) _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());
}
}
_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 (" << (mcIdType) _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());
}
}
}
}
-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)
{
}
case 1:
{
- double characSize=fabs(bounds[1]-bounds[0])/thisNbOfTuples;
+ 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;
for(std::size_t j=0;j<partOfCompoSz;j++,ac++)
nc[nbOfCompo*i+compoIds[j]]=*ac;
}
-void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std::vector<mcIdType>& compoIds)
-{
- // The method has to be removed as duplicate after SWIG update
- std::vector<std::size_t> ids (compoIds.size());
- cast_to_remove(compoIds, ids);
- setSelectedComponents (a, ids);
-}
/*!
* 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();
- mcIdType nbOfElems=ToIdType(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 !");
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);
}
/*!
checkAllocated();
std::size_t nbCompo(getNumberOfComponents());
mcIdType nbOfTuples(getNumberOfTuples());
- mcIdType sz=ToIdType(std::distance(bgOfIndex,endOfIndex));
+ std::size_t sz=std::distance(bgOfIndex,endOfIndex);
if(sz<1)
throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : invalid size of input index array !");
sz--;
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(mcIdType 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])
{
const double *loc=std::max_element(src,src+nbOfComp);
*dest=*loc;
- *dest1=(mcIdType)std::distance(src,loc);
+ *dest1=ToIdType(std::distance(src,loc));
}
compoIdOfMaxPerTuple=ret1.retn();
return ret0.retn();
checkAllocated();
double *ptr=getPointer();
std::size_t nbOfElems=getNbOfElems();
- mcIdType val2=(mcIdType)val;
+ int val2=(int)val;
bool isInt=((double)val2)==val;
if(!isInt)
{
expr.parse();
std::set<std::string> vars;
expr.getTrueSetOfVars(vars);
- if((mcIdType)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.parse();
std::set<std::string> vars;
expr.getTrueSetOfVars(vars);
- if((mcIdType)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," "));
std::vector<double> stck;
for(std::size_t iComp=0;iComp<nbOfComp;iComp++)
{
- expr.prepareExprEvaluationDouble(varsOrder2,ToIdType(oldNbOfComp),ToIdType(nbOfComp),ToIdType(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;
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<std::size_t>& compoIds);
- MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<mcIdType>& compoIds);
MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom2(const std::vector<std::size_t>& compoIds, const DataArray& other);
- MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom2(const std::vector<mcIdType>& 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 virtual void checkAllocated() const = 0;
MEDCOUPLING_EXPORT virtual void desallocate() = 0;
MEDCOUPLING_EXPORT virtual mcIdType getNumberOfTuples() const = 0;
- MEDCOUPLING_EXPORT virtual std::size_t getNbOfElems() 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 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<mcIdType>& compoIds) 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 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(mcIdType nbOfTuples, std::size_t nbOfCompo, const std::string& msg) const;
- MEDCOUPLING_EXPORT void checkNbOfElems(std::size_t nbOfElems, 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 void updateTime() const { }
//
MEDCOUPLING_EXPORT mcIdType getNumberOfTuples() const { return ToIdType(_info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents()); }
- MEDCOUPLING_EXPORT std::size_t getNbOfElems() const { return _mem.getNbOfElem(); }
+ 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(); }
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 mcIdType *new2OldBg, const mcIdType *new2OldEnd) const;
- typename Traits<T>::ArrayType *myKeepSelectedComponents(const std::vector<mcIdType>& compoIds) 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;
MEDCOUPLING_EXPORT DataArrayFloat *buildNewEmptyInstance() const { return DataArrayFloat::New(); }
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 *keepSelectedComponents(const std::vector<mcIdType>& 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 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 DataArrayDouble *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); }
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 *keepSelectedComponents(const std::vector<mcIdType>& 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 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 void setSelectedComponents(const DataArrayDouble *a, const std::vector<mcIdType>& compoIds);
MEDCOUPLING_EXPORT DataArrayDoubleIterator *iterator();
MEDCOUPLING_EXPORT void checkNoNullValues() const;
MEDCOUPLING_EXPORT void getMinMaxPerComponent(double *bounds) 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 void setSelectedComponents(const DataArrayType *a, const std::vector<mcIdType>& 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;
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 mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplate<mcIdType>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
- MEDCOUPLING_EXPORT DataArrayInt32 *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const { return DataArrayTemplate<mcIdType>::myKeepSelectedComponents(compoIds); }
- MEDCOUPLING_EXPORT DataArrayInt32 *keepSelectedComponents(const std::vector<mcIdType>& compoIds) const { return DataArrayTemplate<mcIdType>::myKeepSelectedComponents(compoIds); }
- MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate<mcIdType>::mySelectByTupleIdSafeSlice(bg,end2,step); }
- MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const { return DataArrayTemplate<mcIdType>::mySelectByTupleRanges(ranges); }
+ 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();
private:
DataArrayInt32() { }
};
- class DataArrayInt64 : public DataArrayDiscrete<Int64>
+ class DataArrayInt64 : public DataArrayDiscreteSigned<Int64>
{
friend class DataArrayDiscrete<Int64>;
public:
MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); }
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 *keepSelectedComponents(const std::vector<mcIdType>& 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 DataArrayChar *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); }
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 *keepSelectedComponents(const std::vector<mcIdType>& 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);
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);
+ return ToIdType((end-1-begin)/step+1);
}
template <class T>
if (step == 0)
return -1;
- if(step>0 && begin<=value && value<end ||
- step<0 && begin>=value && value>end)
+ if((step>0 && begin<=value && value<end) ||
+ (step<0 && begin>=value && value>end))
{
mcIdType id = ToIdType((value-begin)/step);
if (begin + step * id == value)
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
std::size_t nbComp(getNumberOfComponents());
mcIdType oldNbOfTuples(getNumberOfTuples());
- ret->alloc((mcIdType)std::distance(new2OldBg,new2OldEnd),nbComp);
+ ret->alloc(std::distance(new2OldBg,new2OldEnd),nbComp);
ret->copyStringInfoFrom(*this);
T *pt(ret->getPointer());
const T *srcPt(getConstPointer());
return ret.retn();
}
- template<class T>
- typename Traits<T>::ArrayType *DataArrayTemplate<T>::myKeepSelectedComponents(const std::vector<mcIdType>& compoIds) const
- {
- // The method has to be removed as duplicate after SWIG update
- std::vector<std::size_t> ids (compoIds.size());
- cast_to_remove(compoIds, ids);
- return myKeepSelectedComponents (ids);
- }
/*!
* Returns a shorten copy of \a this array. The new DataArrayDouble contains all
* tuples starting from the \a tupleIdBg-th tuple and including all tuples located before
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple 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);
for(const mcIdType *z=bgComp;z!=endComp;z++)
DataArray::CheckValueInRange(ToIdType(nbComp),*z,"invalid component id");
mcIdType newNbOfTuples(ToIdType(std::distance(bgTuples,endTuples)));
- std::size_t newNbOfComp(std::distance(bgComp,endComp));
+ mcIdType newNbOfComp(ToIdType(std::distance(bgComp,endComp)));
bool assignTech(true);
if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
{
const char msg[]="DataArrayTemplate::setPartOfValues3";
checkAllocated();
a->checkAllocated();
- std::size_t newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
+ 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");
if(assignTech)
{
for(const mcIdType *w=bgTuples;w!=endTuples;w++)
- for(std::size_t j=0;j<newNbOfComp;j++,srcPt++)
+ for(mcIdType j=0;j<newNbOfComp;j++,srcPt++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
pt[(std::size_t)(*w)*nbComp+j*stepComp]=*srcPt;
for(const mcIdType *w=bgTuples;w!=endTuples;w++)
{
const T *srcPt2=srcPt;
- for(std::size_t 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;
mcIdType nbOfTuples(getNumberOfTuples());
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
bool assignTech(true);
- if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==ToIdType(newNbOfTuples*newNbOfComp))
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
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=(mcIdType)std::distance(vals,loc);
+ tupleId=ToIdType(std::distance(vals,loc));
return *loc;
}
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=(mcIdType)std::distance(vals,loc);
+ tupleId=ToIdType(std::distance(vals,loc));
return *loc;
}
T a(sttoopp-1-strt),tmp(strt);
if(a%(nbTuples-1)!=0)
return false;
- stteepp=a/(nbTuples-1);
+ stteepp=a/(FromIdType<T>(nbTuples)-1);
for(mcIdType i=0;i<nbTuples;i++,tmp+=stteepp)
if(pt[i]!=tmp)
return false;
T a(strt-sttoopp-1),tmp(strt);
if(a%(nbTuples-1)!=0)
return false;
- stteepp=-(a/(nbTuples-1));
+ stteepp=-(a/(FromIdType<T>(nbTuples)-1));
for(mcIdType i=0;i<nbTuples;i++,tmp+=stteepp)
if(pt[i]!=tmp)
return false;
for(std::size_t j=0;j<partOfCompoSz;j++,ac++)
nc[nbOfCompo*i+compoIds[j]]=*ac;
}
- template <class T>
- void DataArrayDiscrete<T>::setSelectedComponents(const DataArrayType *a, const std::vector<mcIdType>& compoIds)
- {
- // The method has to be removed as duplicate after SWIG update
- std::vector<std::size_t> ids (compoIds.size());
- cast_to_remove(compoIds, ids);
- setSelectedComponents (a, ids);
- }
/*!
* Creates a new DataArrayInt containing IDs (indices) of tuples holding value \b not
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/nbOfSlices);
+ T sumPerSlc(sum/FromIdType<T>(nbOfSlices));
mcIdType pos(0);
const T *w(this->begin());
std::vector< std::pair<mcIdType,mcIdType> > ret(nbOfSlices);
{
public:
OpSwitchedOn(T *pt):_pt(pt),_cnt(0) { }
- void operator()(const bool& b) { if(b) *_pt++=_cnt; _cnt++; }
+ void operator()(const bool& b) { if(b) *_pt++=FromIdType<T>(_cnt); _cnt++; }
private:
T *_pt;
MEDCoupling::mcIdType _cnt;
{
public:
OpSwitchedOff(T *pt):_pt(pt),_cnt(0) { }
- void operator()(const bool& b) { if(!b) *_pt++=_cnt; _cnt++; }
+ void operator()(const bool& b) { if(!b) *_pt++=FromIdType<T>(_cnt); _cnt++; }
private:
T *_pt;
MEDCoupling::mcIdType _cnt;
/*!
* 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();
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];
}
/*!
- * 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
+DataArrayIdType *DataArrayChar::convertToIntArr() const
{
checkAllocated();
- DataArrayInt *ret=DataArrayInt::New();
+ DataArrayIdType *ret=DataArrayIdType::New();
ret->alloc(getNumberOfTuples(),getNumberOfComponents());
std::size_t nbOfVals=getNbOfElems();
const char *src=getConstPointer();
- int *dest=ret->getPointer();
+ mcIdType *dest=ret->getPointer();
std::copy(src,src+nbOfVals,dest);
ret->copyStringInfoFrom(*this);
return ret;
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);
}
/*!
- * 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);
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
mcIdType nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ 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);
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
mcIdType nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ 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();
if(getNumberOfComponents()!=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();
std::size_t nbOfCompo=getNumberOfComponents();
* 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)
* 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();
mcIdType nbOfTuples=getNumberOfTuples();
* \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);
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(0,1);
mcIdType nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr>=vmin && *cptr<vmax)
ret->pushBackSilent(i);
return ret.retn();
std::vector<const DataArrayChar *>::const_iterator it=a.begin();
std::size_t nbOfComp((*it)->getNumberOfComponents());
mcIdType nbt=(*it++)->getNumberOfTuples();
- for(int i=1;it!=a.end();it++,i++)
+ for(;it!=a.end();it++)
{
if((*it)->getNumberOfComponents()!=nbOfComp)
throw INTERP_KERNEL::Exception("DataArrayChar::Aggregate : Nb of components mismatch for array aggregation !");
ret->alloc(nbOfTuples,totalNbOfComp);
char *retPtr=ret->getPointer();
for(mcIdType i=0;i<nbOfTuples;i++)
- for(int j=0;j<(int)a.size();j++)
+ 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++)
+ 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;
const char *data=begin();
mcIdType nbOfTuples=getNumberOfTuples();
std::size_t nbCompo=getNumberOfComponents();
- for(int i=0;i<nbOfTuples;i++,data+=nbCompo)
+ 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
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)
{
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;
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();
const char *data=begin();
mcIdType nbOfTuples=getNumberOfTuples();
std::size_t nbCompo=getNumberOfComponents();
- for(int i=0;i<nbOfTuples;i++,data+=nbCompo)
+ for(mcIdType i=0;i<nbOfTuples;i++,data+=nbCompo)
{
stream << "Tuple #" << i << " : \"";
std::copy(data,data+nbCompo,std::ostream_iterator<char>(stream));
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(std::size_t j=0;j<nbOfCompo;j++)
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)
{
mcIdType nbOfTuples=getNumberOfTuples();
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)
{
* 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);
- mcIdType nbOfCells=ToIdType(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==ToIdType(getNumberOfCells()) && stepCellIds==1)
+ if(beginCellIds==0 && endCellIds==getNumberOfCells() && stepCellIds==1)
{
MEDCouplingMesh *ret(const_cast<MEDCouplingMesh *>(this));
ret->incrRef();
}
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;
- std::size_t getNumberOfElements() const;
- std::size_t nbCellsAlongAxis(int axis) const;
+ mcIdType getNumberOfElements() const;
+ mcIdType nbCellsAlongAxis(int axis) const;
const double * getCoordsAlongAxis(int axis) const;
~MEDCouplingNormalizedCartesianMesh();
private:
}
template<int SPACEDIM>
-std::size_t MEDCouplingNormalizedCartesianMesh<SPACEDIM>::getNumberOfElements() const
+mcIdType MEDCouplingNormalizedCartesianMesh<SPACEDIM>::getNumberOfElements() const
{
return _mesh->getNumberOfCells();
}
template<int SPACEDIM>
-std::size_t MEDCouplingNormalizedCartesianMesh<SPACEDIM>::nbCellsAlongAxis(int axis) const
+mcIdType MEDCouplingNormalizedCartesianMesh<SPACEDIM>::nbCellsAlongAxis(int axis) const
{
return _mesh->getCoordsAt(axis)->getNumberOfTuples() - 1;
}
MEDCouplingNormalizedUnstructuredMesh(const MEDCoupling::MEDCouplingPointSet *mesh);
void getBoundingBox(double *boundingBox) const;
INTERP_KERNEL::NormalizedCellType getTypeOfElement(mcIdType eltId) const;
- int getNumberOfNodesOfElement(mcIdType eltId) const;
+ mcIdType getNumberOfNodesOfElement(mcIdType eltId) const;
mcIdType getNumberOfElements() const;
mcIdType getNumberOfNodes() const;
const mcIdType *getConnectivityPtr() const;
}
template<int SPACEDIM,int MESHDIM>
-int MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfNodesOfElement(mcIdType eltId) const
+mcIdType MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfNodesOfElement(mcIdType eltId) const
{
return _mesh->getNumberOfNodesInCell(eltId);
}
_coords->decrRef();
}
-int MEDCouplingPointSet::getNumberOfNodes() const
+mcIdType MEDCouplingPointSet::getNumberOfNodes() const
{
if(_coords)
return _coords->getNumberOfTuples();
int MEDCouplingPointSet::getSpaceDimension() const
{
if(_coords)
- return ToIdType(_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();
}
*/
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==ToIdType(getNumberOfCells()) && stepCellIds==1)
{
*
* \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(ToIdType(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);
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,ToIdType(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(ToIdType(getNumberOfCells()),ToIdType(da->getNbOfElems()),1);
+ MCAuto<DataArrayIdType> cellCor2=da->selectByTupleIdSafeSlice(ToIdType(getNumberOfCells()),ToIdType(da->getNbOfElems()),1);
cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
}
* \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(ToIdType(m.size())!=target->getNumberOfTuplesExpected())
if(array)
{
srcField->checkConsistencyLight();
- if(trgNbOfCompo!=(std::size_t)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,ToIdType(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);
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);
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);
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);
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:
default:
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyUC : only dimension 1 2 or 3 supported !");
}
- ReverseMatrix(res,ToIdType(target_mesh->getNumberOfCells()),_matrix);
+ ReverseMatrix(res,target_mesh->getNumberOfCells(),_matrix);
nullifiedTinyCoeffInCrudeMatrixAbs(0.);
//
_deno_multiply.clear();
MCAuto<DataArrayDouble> trgLoc=_target_ft->getLocalizationOfDiscr();
const double *trgLocPtr=trgLoc->begin();
mcIdType trgSpaceDim=ToIdType(trgLoc->getNumberOfComponents());
- MCAuto<DataArrayInt> srcOffsetArr=_src_ft->getDiscretization()->getOffsetArr(_src_ft->getMesh());
+ 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;
+ 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();
computeDeno(srcField->getNature(),srcField,targetField);
double *resPointer(targetField->getArray()->getPointer());
const double *inputPointer(srcField->getArray()->getConstPointer());
- computeProduct(inputPointer,ToIdType(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;
- mcIdType _time_deno_update=ToIdType(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)
{
mcIdType nbOf2DCellsTrg=ToIdType(m2D.size());
mcIdType nbOf1DCellsTrg=ToIdType(m1D.size());
- int nbOf3DCellsTrg=nbOf2DCellsTrg*nbOf1DCellsTrg;
+ 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 = ToIdType(distance(w, w2));
+ mcIdType d = ToIdType(distance(w, w2));
cnt += d; work +=d;
idx.push_back(cnt); cnt2++;
w = w2+1; // skip the -1
* 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((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
+ 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
{
super_index->alloc(2,1);
super_index->setIJSilent(0,0,0);
- super_index->setIJSilent(1,0,ToIdType(_index->getNbOfElems())-1);
+ super_index->setIJSilent(1,0,_index->getNbOfElems()-1);
}
oss << " Nb of packs: " << getNumberOf() << std::endl;
oss << " Nb of values: " << getLength() << std::endl;
{
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;
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
- mcIdType nt = ToIdType(_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
- mcIdType initValSz=ToIdType(_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
- mcIdType nt=ToIdType(_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());
- mcIdType nt = ToIdType(_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 += ToIdType((*values).size());
*(++iP) = 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());
- mcIdType initValSz = ToIdType(_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
- mcIdType nt = ToIdType(_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(ToIdType(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->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());
+ mcIdType * iP(_index->getPointer());
mcIdType newSz = ToIdType(std::distance(packBg, packEnd));
- const int start = iP[idx], end = iP[idx+1];
+ const mcIdType start = iP[idx], end = iP[idx+1];
// _values
- mcIdType initValSz = ToIdType(_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());
+ mcIdType * siP(_super_index->getPointer()), *iP(_index->getPointer());
mcIdType newSz = ToIdType(std::distance(packBg, packEnd));
- const int start = iP[siP[superIdx]+idx], end = iP[siP[superIdx]+idx+1];
+ const mcIdType start = iP[siP[superIdx]+idx], end = iP[siP[superIdx]+idx+1];
// _values
- mcIdType initValSz = ToIdType(_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 );
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
{
std::size_t nbCells=getNumberOfCells();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ 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
{
std::size_t nbCells=getNumberOfCells();
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
+ 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];
- GetPosFromId(ToIdType(cellId),meshDim,tmpCell,tmp2);
+ mcIdType tmp2[3];
+ GetPosFromId(cellId,meshDim,tmpCell,tmp2);
switch(meshDim)
{
case 1:
*/
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]=ToIdType(getNumberOfCells());
+ ret[1]=getNumberOfCells();
ret[2]=-1; //ret[3*k+2]==-1 because it has no sense here
return ret;
}
*
* 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
{
- mcIdType nbOfCells=ToIdType(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 !");
mcIdType nbTuples(profile->getNumberOfTuples());
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ 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());
- mcIdType nbOfCells=ToIdType(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)
{
mcIdType nbOfCells=*nodeStBg-1;
- MCAuto<DataArrayInt> conn(DataArrayInt::New());
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New());
conn->alloc(2*nbOfCells,1);
- int *cp=conn->getPointer();
+ mcIdType *cp=conn->getPointer();
for(mcIdType i=0;i<nbOfCells;i++)
{
cp[2*i+0]=i;
return conn.retn();
}
-DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity2D(const int *nodeStBg)
+DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivity2D(const mcIdType *nodeStBg)
{
mcIdType n1(nodeStBg[0]-1),n2(nodeStBg[1]-1);
- MCAuto<DataArrayInt> conn(DataArrayInt::New());
+ 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(mcIdType j=0;j<n2;j++)
for(mcIdType i=0;i<n1;i++,pos++)
return conn.retn();
}
-DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity3D(const int *nodeStBg)
+DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivity3D(const mcIdType *nodeStBg)
{
mcIdType n1(nodeStBg[0]-1),n2(nodeStBg[1]-1),n3(nodeStBg[2]-1);
- MCAuto<DataArrayInt> conn(DataArrayInt::New());
+ 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(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));
+ 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);
{
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));
+ mcIdType nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st));
std::size_t nbCompo(da->getNumberOfComponents());
if(da->getNumberOfTuples()!=nbOfTuplesExp)
{
{
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);
ret->setArrays(arrays3,0);
return ret;
}
-MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedComponents(const std::vector<mcIdType>& compoIds) const
-{
- // The method has to be removed as duplicate after SWIG update
- std::vector<std::size_t> ids (compoIds.size());
- cast_to_remove(compoIds, ids);
- return keepSelectedComponents(ids);
-}
void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<std::size_t>& compoIds)
{
throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : some time array in correspondence are not defined symmetrically !");
}
}
-void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<mcIdType>& compoIds)
-{
- // The method has to be removed as duplicate after SWIG update
- std::vector<std::size_t> ids (compoIds.size());
- cast_to_remove (compoIds, ids);
- setSelectedComponents (other, ids);
-}
void MEDCouplingTimeDiscretization::changeNbOfComponents(std::size_t newNbOfComp, double dftValue)
{
}
}
-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());
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]);
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());
if(_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 *negate() const;
MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *maxPerTuple() const;
MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const;
- MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector<mcIdType>& compoIds) const;
MEDCOUPLING_EXPORT virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<std::size_t>& compoIds);
- MEDCOUPLING_EXPORT virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<mcIdType>& 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;
}
template<class T>
- void MEDCouplingTimeDiscretizationTemplate<T>::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+ void MEDCouplingTimeDiscretizationTemplate<T>::getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const
{
if(_array)
{
}
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];
std::size_t nbOfCompo=_array->getNumberOfComponents();
namespace MEDCoupling
{
- inline void cast_to_remove (const std::vector<mcIdType>& in, std::vector<std::size_t>& out)
- {
- out.resize (in.size());
- std::copy (in.begin(), in.end(), out.begin());
- }
-
template<class T>
struct MEDCOUPLING_EXPORT Traits
{
/// @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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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(mcIdType i=1;i<nbOfCells;i++,ci++)
if(ret.back()!=((INTERP_KERNEL::NormalizedCellType)c[*ci]))
* \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());
- mcIdType nbOfCells(ToIdType(getNumberOfCells())),nbOfEltsInRevNodal(0);
+ 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");
- mcIdType nbCells=ToIdType(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);
+ 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();
//
mcIdType nbCells=descIndx->getNumberOfTuples()-1;
- MCAuto<DataArrayInt> out0=DataArrayInt::New();
- MCAuto<DataArrayInt> out1=DataArrayInt::New(); out1->alloc(nbCells+1,1);
- int *out1Ptr=out1->getPointer();
+ 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());
- mcIdType nbOfCells=ToIdType(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];
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 !");
- mcIdType nbOfCells=ToIdType(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()
{
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
- std::vector<int> cellIds(nbOfCells);
+ mcIdType nbOfCells=getNumberOfCells();
+ std::vector<mcIdType> cellIds(nbOfCells);
for(mcIdType i=0;i<nbOfCells;i++)
cellIds[i]=i;
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!");
- mcIdType nbOfCells=ToIdType(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;
- mcIdType nbOfCells=ToIdType(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);
//
- mcIdType nbOfCells=ToIdType(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
{
mcIdType nbOfNodes=ToIdType(nodeIdsInUse.size()),
- nbOfCells=ToIdType(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++)
+ 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);
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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-ToIdType(std::count(conn+connI[i]+1,conn+connI[i+1],-1));
* 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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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);
+ 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);
- mcIdType nbOfCells=ToIdType(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;
- mcIdType thisNbCells=ToIdType(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();
- mcIdType otherNbCells=ToIdType(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();
+ 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());
}
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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, ToIdType(meshM2->getNumberOfCells()));
+ DAInt validIds = corresp->findIdsInRange(0, meshM2->getNumberOfCells());
corresp->decrRef();
if (validIds->getNumberOfTuples())
{
//
MCUMesh m0Part2=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(cellsAroundGroup->begin(),cellsAroundGroup->end(),true));
- mcIdType nCells2 = ToIdType(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);
mcIdType cnt(0);
- for (int * ptr = connexCheck->getPointer(); cnt < connexCheck->getNumberOfTuples(); ptr++, cnt++)
+ 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());
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ mcIdType *conn(getNodalConnectivity()->getPointer());
+ const mcIdType *connIndex(getNodalConnectivityIndex()->getConstPointer());
+ mcIdType nbOfCells=getNumberOfCells();
for(mcIdType i=0;i<nbOfCells;i++)
- for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
+ 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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ mcIdType *conn=getNodalConnectivity()->getPointer();
+ const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer();
+ mcIdType nbOfCells=getNumberOfCells();
for(mcIdType i=0;i<nbOfCells;i++)
- for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
+ 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();
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ mcIdType *conn=getNodalConnectivity()->getPointer();
+ const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer();
+ mcIdType nbOfCells=getNumberOfCells();
for(mcIdType i=0;i<nbOfCells;i++)
- for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
+ 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();
- mcIdType nbCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbCells=ToIdType(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 ToIdType(_nodal_connec->getNbOfElems());
+ 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(ToIdType(getMeshDimension()));
- tinyInfo.push_back(ToIdType(getNumberOfCells()));
+ tinyInfo.push_back(getNumberOfCells());
if(_nodal_connec)
tinyInfo.push_back(getNodalConnectivityArrayLen());
else
/*!
* 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();
- mcIdType nbelem=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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);
- mcIdType ncellsSub=ToIdType(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);
- mcIdType nbCellsRet(ToIdType(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 !");
- mcIdType nbCells=ToIdType(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();
- mcIdType nbCells=ToIdType(getNumberOfCells());
+ mcIdType nbCells=getNumberOfCells();
if(nbCells==0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : no cells in this !");
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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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++)
{
mcIdType pos=nodalConnecOut->getNumberOfTuples();
if(BuildConvexEnvelopOf2DCellJarvis(coords,nodalConnecIn+nodalConnecIndexIn[i],nodalConnecIn+nodalConnecIndexIn[i+1],nodalConnecOut))
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;
- mcIdType nbOfCells=ToIdType(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;
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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 !");
- mcIdType nbCells=ToIdType(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 !");
- mcIdType nbOfCells=ToIdType(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 !");
- mcIdType nbOfCells=ToIdType(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(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 !");
- mcIdType nbOfCells=ToIdType(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 !");
- mcIdType nbOfCells=ToIdType(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());
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 !");
- mcIdType nbOfCells=ToIdType(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());
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 !");
- mcIdType nbOfCells=ToIdType(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 !");
- mcIdType nbOfCells=ToIdType(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);
//
- mcIdType nbOfCells=ToIdType(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 !");
- mcIdType nbOfCells=ToIdType(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);
- mcIdType nbOfCells=ToIdType(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);
- mcIdType nbOfCells=ToIdType(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);
- mcIdType nbOfCells=ToIdType(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);
- mcIdType nbOfCells=ToIdType(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);
- mcIdType spaceDim(getSpaceDimension()),nbCells(ToIdType(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()),nbOfNodes(getNumberOfNodes());
- mcIdType nbOfCells(ToIdType(getNumberOfCells()));
+ 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++)
INTERP_KERNEL::QuadraticPlanarPrecision arcPrec(arcDetEps);
int spaceDim(getSpaceDimension()),mDim(getMeshDimension());
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ 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())
{
checkFullyDefined();
int spaceDim(getSpaceDimension()),mDim(getMeshDimension());
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ 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;
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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;
//
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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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());
}
- mcIdType nbCells=ToIdType(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 !");
- mcIdType nbCells=ToIdType(getNumberOfCells()),
+ 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++)
{
MEDCouplingUMesh *singleCell=static_cast<MEDCouplingUMesh *>((*it2)->buildPartOfMySelf(&fake,&fake+1,true));
m1ssmSingleAuto.push_back(singleCell);
m1ssmSingle.push_back(singleCell);
- ret1->pushBackSilent(ToIdType((*it2)->getNumberOfCells())); ret2->pushBackSilent(rk);
+ ret1->pushBackSilent((*it2)->getNumberOfCells()); ret2->pushBackSilent(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(mcIdType i=0;i<ToIdType(m1ssm.size());i++)
m1ssmfinal[renum->getIJ(i,0)]=m1ssm[i];
}
/*!
- * 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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfElems=ToIdType(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
{
- mcIdType ncell=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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());
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
- int 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);
ret->setName("Mesh");
ret->setCoords(da);
mcIdType nbOfTuples(da->getNumberOfTuples());
- MCAuto<DataArrayInt> c(DataArrayInt::New()),cI(DataArrayInt::New());
+ 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=ToIdType(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())
if(meshDim!=(*iter)->getMeshDimension())
throw INTERP_KERNEL::Exception("Mesh dimensions mismatches, FuseUMeshesOnSameCoords impossible !");
meshLgth+=(*iter)->getNodalConnectivityArrayLen();
- meshIndexLgth+=ToIdType((*iter)->getNumberOfCells());
+ 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();
- mcIdType nbOfCells=ToIdType((*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();
- mcIdType curNbOfCells=ToIdType(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);
+ MCAuto<DataArrayIdType> tmp1(comm),tmp2(commI);
mcIdType oldNbOfNodes=coo->getNumberOfTuples();
- int newNbOfNodes;
- MCAuto<DataArrayInt> o2n=DataArrayInt::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes);
+ 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.};
/*!
* 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();
+ MCAuto<DataArrayIdType> comm1Auto(comm1),commI1Auto(commI1);
+ const mcIdType *comm1Ptr=comm1->begin();
+ const mcIdType *commI1Ptr=commI1->begin();
mcIdType nbOfGrps1=commI1Auto->getNumberOfTuples()-1;
- res->pushBackSilent((int)INTERP_KERNEL::NORM_POLYHED);
+ 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();
+ MCAuto<DataArrayIdType> comm2Auto(comm2),commI2Auto(commI2);
+ const mcIdType *comm2Ptr=comm2->begin();
+ const mcIdType *commI2Ptr=commI2->begin();
mcIdType nbOfGrps2=commI2Auto->getNumberOfTuples()-1;
- for(int j=0;j<nbOfGrps2;j++)
+ 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();
- mcIdType nbOfCells=ToIdType(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));
- mcIdType nbCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbCells=ToIdType(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
{
- mcIdType nbOfCells=ToIdType(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);
}
}
{//presence of Polyhedra
connectivity->reAlloc(szConn);
faceoffsets->writeVTK(ofs,8,"Int32","faceoffsets",byteData);
- MCAuto<DataArrayInt> faces=DataArrayInt::New(); faces->alloc(szFaceOffsets,1);
+ 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)
{
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;
}
* 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!");
- mcIdType nc=ToIdType(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;
}
}
* \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)
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 !");
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 !");
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
- int 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);
if(mesh)
{
mesh->incrRef();
- _nb_cell=ToIdType(mesh->getNumberOfCells());
+ _nb_cell=mesh->getNumberOfCells();
}
}
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;
}
if(mesh)
{
mesh->incrRef();
- _nb_cell=ToIdType(mesh->getNumberOfCells());
+ _nb_cell=mesh->getNumberOfCells();
}
}
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());
+ mcIdType *conn(getNodalConnectivity()->getPointer());
+ const mcIdType *connIndex(getNodalConnectivityIndex()->getConstPointer());
mcIdType nbOfCells=ToIdType(getNumberOfCells());
- for(int i=0;i<nbOfCells;i++)
- for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
+ 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)
{
- mcIdType nbOfCells=ToIdType(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 !");
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- mcIdType nbOfCutCells=ToIdType(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 !");
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- mcIdType nbOfCutCells=ToIdType(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 !");
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- mcIdType nbOfCutCells=ToIdType(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 !");
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- mcIdType nbOfCutCells=ToIdType(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
- mcIdType nbCells=ToIdType(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
{
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 !");
- mcIdType nbOfCells=ToIdType(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;
- mcIdType nbOfCells=ToIdType(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 !");
- mcIdType ncells=ToIdType(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();
+ mcIdType oldNbOfNodes=getNumberOfNodes();
mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells());
- int spaceDim=getSpaceDimension();
+ 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();
+ 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();
+ 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);
- mcIdType nbOf2DCells=ToIdType(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();
- mcIdType ncell=ToIdType(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();
- mcIdType ncell=ToIdType(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);
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
- const int *cPtr=_nodal_connec->begin();
- const int *icPtr=_nodal_connec_index->begin();
- int lastVal=0;
+ 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(int i=0;i<nbOfCells;i++,icPtr++,descIPtr++)
+ 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();
- mcIdType nbOfCells=ToIdType(getNumberOfCells());
- const int *cPtr=_nodal_connec->begin();
- const int *icPtr=_nodal_connec_index->begin();
- int lastVal=0;
+ 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(int i=0;i<nbOfCells;i++,icPtr++,descIPtr++,desc2IPtr++)
+ 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];
+ 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;
std::vector<const MEDCouplingUMesh *>::const_iterator it=a.begin();
int meshDim=(*it)->getMeshDimension();
mcIdType nbOfCells=ToIdType((*it)->getNumberOfCells());
- int meshLgth=(*it++)->getNodalConnectivityArrayLen();
+ mcIdType meshLgth=(*it++)->getNodalConnectivityArrayLen();
for(;it!=a.end();it++)
{
if(meshDim!=(*it)->getMeshDimension())
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++)
{
mcIdType curNbOfCell=ToIdType((*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++)
+ 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)
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());
- mcIdType nbOfCells=ToIdType(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());
+ 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());
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());
+ 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());
- mcIdType nbOfCells=ToIdType(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();
- mcIdType nbOfCells=ToIdType(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);
}
- mcIdType nbOfCellsM1=ToIdType(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)
{
}
}
-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)
{
}
}
-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)
}
}
-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]));
- std::size_t nbs(cm.getNumberOfSons2(connBg+1,ToIdType(sz)));
+ unsigned nbs(cm.getNumberOfSons2(connBg+1,ToIdType(sz)));
unsigned nbOfHit(0); // number of fusions operated
int posBaseElt(0),posEndElt(0),nbOfTurn(0);
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,ToIdType(sz),tmpConn,typeOfSon);
- std::map<MCAuto<INTERP_KERNEL::Node>,int> m;
+ 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(ToIdType(nbs-i),connBg+1,ToIdType(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,ToIdType(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();
- mcIdType ncell2=ToIdType(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);
- mcIdType nCells=ToIdType(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());
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]);
+ const std::vector<mcIdType>& subEdges(intersectEdge2[i]);
mcIdType nbSubEdge=ToIdType(subEdges.size()/2);
- for(int j=0;j<nbSubEdge;j++,kk++)
+ 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,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]]));
- mcIdType 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);
mcIdType offset(coords->getNumberOfTuples());
- for(const int *it2(descBg);it2!=descEnd;it2++,ii++)
+ 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
else
{//the current edge has been subsplit -> create corresponding centers.
mcIdType nbOfCentersToAppend=ToIdType(edge1.size()/2);
- std::map< MCAuto<INTERP_KERNEL::Node>,int> m;
+ 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());
+ std::vector<mcIdType>::const_iterator it3(allEdges.end()-edge1.size());
for(mcIdType k=0;k<nbOfCentersToAppend;k++)
{
double tmpp[2];
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());
*
* \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++)
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());
* 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);
- mcIdType iEnd=ToIdType(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(ToIdType(pos));//to check pos
+ get(pos);//to check pos
bool isFast(pos==0 && _pool.size()==1);
std::size_t sz(edges.size());
// dealing with edges
if(sz==1)
_edge_info.push_back(EdgeInfo(istart,iend,mesh1DInCase));
else
- _edge_info.push_back(EdgeInfo(istart,iend,ToIdType(pos),edgePtrs[0].back()));
+ _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]);
_pool=pool;
//
if(sz==2)
- updateEdgeInfo(ToIdType(pos),edgePtrs[0],edgePtrs[1]);
+ updateEdgeInfo(pos,edgePtrs[0],edgePtrs[1]);
//
if(isFast)
{
std::vector< MCAuto<MEDCouplingUMesh> > ms;
if(pos>0)
{
- MCAuto<MEDCouplingUMesh> elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelfSlice(0,ToIdType(pos),true)));
+ MCAuto<MEDCouplingUMesh> elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelfSlice(0,pos,true)));
ms.push_back(elt);
}
ms.push_back(mesh);
if(pos<_ze_mesh->getNumberOfCells()-1)
{
- MCAuto<MEDCouplingUMesh> elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelfSlice(ToIdType(pos)+1,ToIdType(_ze_mesh->getNumberOfCells()),true)));
+ MCAuto<MEDCouplingUMesh> elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelfSlice(pos+1,_ze_mesh->getNumberOfCells(),true)));
ms.push_back(elt);
}
std::vector< const MEDCouplingUMesh *> ms2(ms.size());
_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)
{
- mcIdType nbCellsInSplitMesh1D=ToIdType(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());
- mcIdType nDescCell1=ToIdType(m1Desc->getNumberOfCells()),nDescCell2=ToIdType(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,ToIdType(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,ToIdType(m2->getNumberOfCells()),eps);
- mcIdType ncell1=ToIdType(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());
- mcIdType nbOfCells=ToIdType(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(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();
- mcIdType ncells=ToIdType(getNumberOfCells());
+ mcIdType ncells=getNumberOfCells();
mcIdType 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++)
+ 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();
- mcIdType ncells=ToIdType(getNumberOfCells());
+ mcIdType ncells=getNumberOfCells();
mcIdType lgthToReach(getNodalConnectivityArrayLen()+2*subNodesInSeg->getNumberOfTuples());
mcIdType nodesCnt(getNumberOfNodes());
- MCAuto<DataArrayInt> c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach);
+ 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(ToIdType(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));
- if(eltsIndex2->count(0)+eltsIndex3->getNumberOfTuples()!=ToIdType(ret1NonCol->getNumberOfCells()))
+ 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(ToIdType(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());
}
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());
- mcIdType nCell=ToIdType(getNumberOfCells()),nDescCell=ToIdType(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);
- mcIdType nbOfCells(ToIdType(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;
- mcIdType dst = ToIdType(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!");
- mcIdType d = ToIdType(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();
- mcIdType nDescCell=ToIdType(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;
+ 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<DataArrayDouble> baryPart = mPartCand->computeCellCenterOfMass();
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());
- mcIdType nDesc2Cell=ToIdType(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;
+ 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));
- nbElemsNotM1 = ToIdType(tmp->getNbOfElems());
+ 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 (mcIdType ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++)
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);
- mcIdType nbCells=ToIdType(getNumberOfCells());
+ mcIdType nbCells=getNumberOfCells();
for(mcIdType ii = 0; ii < nbCells; ii++)
- for (int jj=descIP[ii]; jj < descIP[ii+1]; jj++)
+ 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(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],
}
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(mcIdType i=0;i<commI->getNumberOfTuples()-1;i++,jj++)
{
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(ToIdType(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());
+ const mcIdType *cPtr(tmp->getNodalConnectivity()->begin()),*ciPtr(tmp->getNodalConnectivityIndex()->begin());
for(mcIdType i=0;i<remain->getNumberOfTuples();i++,jj++)
{
if(jj!=0)
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();
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;
}
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(ToIdType(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(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 : 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<ToIdType(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
{
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;
}